10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-25 05:43:46 +01:00
This commit is contained in:
scemama 2020-12-07 10:16:42 +00:00
parent 3260392245
commit 631010c055
10 changed files with 75 additions and 8 deletions

View File

@ -69,6 +69,8 @@ MathJax.Hub.Config({
<script src="https://unpkg.com/simple-statistics@7.0.2/dist/simple-statistics.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bowser@2.5.3/es5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.13.1/js-yaml.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jszip@3.5.0/dist/jszip.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/file-saver@2.0.2/dist/FileSaver.min.js"></script>
</head>

View File

@ -70,6 +70,8 @@ MathJax.Hub.Config({
<script src="https://unpkg.com/simple-statistics@7.0.2/dist/simple-statistics.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bowser@2.5.3/es5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.13.1/js-yaml.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jszip@3.5.0/dist/jszip.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/file-saver@2.0.2/dist/FileSaver.min.js"></script>
</head>

View File

@ -8,7 +8,7 @@ ul.nestedCbList {
list-style-type: none;
padding-left: 1em;
}
form button.SelectAll {
form button.selectButton {
display: block;
}
form fieldset.main {

View File

@ -59,7 +59,7 @@
"headline": "Dataset",
"description" : "function adjustSticky() { const height = $(\u0022nav\u0022).height() $(\u0022thead.sticky tr th \u0022).css(\u0022top\u0022, height) } window.onload = async () = { window.browser = bowser.getParser(window.navigator.userAgent); $(\u0022input[type=\u0027checkbox\u0027]\u0022).trigger(\u0022change\u0022) $(\u0022input[type=\u0027number\u0027].range\u0022).trigger(\u0022change\u0022) adjustSticky(); $(window).resize(adjustSticky) var slist = $(\u0022#SelectList\u0022) getAllSelect().each(function () { $(\u0022\u0022).text($(\u0027label[for=\u0022\u0027 \u002b $(this).attr(\u0027id\u0027) \u002b \u0027\u0022]\u0027).text()).appendTo(slist) }) $(\u0027[data-needbrowser],[data-neednotbrowser]\u0027).each(function () { function test(key, value) { switch (key) { case \u0022",
"inLanguage" : "en",
"wordCount": 2068 ,
"wordCount": 2158 ,
"datePublished" : "0001-01-01T00:00:00",
"dateModified" : "0001-01-01T00:00:00",
"image" : "https:\/\/lcpq.github.io\/QUESTDB_website\/img\/TOC_JPCL.png",
@ -120,6 +120,8 @@ MathJax.Hub.Config({
<script src="https://unpkg.com/simple-statistics@7.0.2/dist/simple-statistics.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bowser@2.5.3/es5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.13.1/js-yaml.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jszip@3.5.0/dist/jszip.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/file-saver@2.0.2/dist/FileSaver.min.js"></script>
</head>
@ -474,6 +476,7 @@ MathJax.Hub.Config({
processingIndicator.isActive = false
reloadSizeSelector()
reloadSelect("sets")
refreshExportGeoms()
}
async function clearSelect(BeforeName = null) {
var selects = ((BeforeName == null) ? getAllSelect() : getAllSelectAfter(BeforeName, true))
@ -961,6 +964,41 @@ MathJax.Hub.Config({
}
await reloadContent();
}
function refreshExportGeoms() {
const vals=$("#mol_select").val()
const disable = vals === null || vals.length===0
$("#btn_export_geoms").prop("disabled",disable)
}
async function moleculeSelectionChanged(event) {
refreshExportGeoms()
await reloadNextSelect(event)
}
async function exportGeoms() {
var mols = new Set($("#mol_select").val())
if (mols.size!==0) {
const zip = JSZip();
const geomDic=new Map()
for (const geom of window.geoms) {
const molecule =geom.parseMetadata().molecule
if (mols.has(molecule)) {
if (!geomDic.has(molecule)) {
geomDic.set(molecule,[])
}
geomDic.get(molecule).push(geom.toXYZ())
}
}
for (const [molecule,geometries] of geomDic) {
const xyz=geometries.join("\n\n")
var blob=new Blob([xyz],{type: 'chemical/x-xyz'})
zip.file(`${mhchemCE.extract(molecule).toLowerCase().replace(" ","_")}.xyz`,blob)
}
const zipFile = await zip.generateAsync({type: 'blob'})
saveAs(zipFile, "molecules.zip")
}
}
</script>
<script>
function getAbsFilesName(){
@ -1011,23 +1049,24 @@ function getFluoFilesName(){
</p>
<div style="display: inline-block;">
<label for="DOI_select" class="required">Set</label>
<button class="SelectAll" type="button" onclick="selectSelectAll_click(event)">Select all</button>
<button class="selectButton" type="button" onclick="selectSelectAll_click(event)">Select all</button>
<select multiple id="DOI_select" required name="sets" onchange="reloadNextSelect(event)"></select>
</div>
<div style="display:inline-block">
<label for="mol_select" class="required">Molecule</label>
<button class="SelectAll" type="button" onclick="selectSelectAll_click(event)">Select all</button>
<select multiple id="mol_select" required name="molecule" onchange="reloadNextSelect(event)"></select>
<button class="selectButton" type="button" onclick="selectSelectAll_click(event)">Select all</button>
<select multiple id="mol_select" required name="molecule" onchange="moleculeSelectionChanged(event)"></select>
<button id="btn_export_geoms" class="selectButton" type="button" disabled onclick="exportGeoms()">Export geometries</button>
</div>
<br />
<div style="display: inline-block;">
<label for="method_select" class="required">Method</label>
<button class="SelectAll" type="button" onclick="selectSelectAll_click(event)">Select all</button>
<button class="selectButton" type="button" onclick="selectSelectAll_click(event)">Select all</button>
<select multiple id="method_select" required name="method" onchange="reloadNextSelect(event)"></select>
</div>
<div style="display: inline-block;">
<label for="basis_select" class="required">Basis set</label>
<button class="SelectAll" type="button" onclick="selectSelectAll_click(event)">Select all</button>
<button class="selectButton" type="button" onclick="selectSelectAll_click(event)">Select all</button>
<select multiple id="basis_select" required name="basis" onchange="reloadNextSelect(event)"></select>
</div>
</fieldset>

View File

@ -72,6 +72,8 @@ MathJax.Hub.Config({
<script src="https://unpkg.com/simple-statistics@7.0.2/dist/simple-statistics.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bowser@2.5.3/es5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.13.1/js-yaml.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jszip@3.5.0/dist/jszip.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/file-saver@2.0.2/dist/FileSaver.min.js"></script>
</head>

View File

@ -3,6 +3,21 @@ class Geometry {
this.molecule = molecule
this.comment = comment
}
toXYZ() {
var lines =[]
lines.push(this.molecule.atoms.length)
lines.push(this.comment)
for (const a of this.molecule.atoms) {
var line = a.label.padEnd(4, ' ')
line += a.x.toFixed(8).padStart(11,' ')
line += a.y.toFixed(8).padStart(22,` `)
line += a.z.toFixed(8).padStart(22,` `)
lines.push(line)
}
return lines.join("\n")
}
static async loadXYZAsync(file) {
switch (trueTypeOf(file)) {
case String.name:

View File

@ -120,6 +120,8 @@ MathJax.Hub.Config({
<script src="https://unpkg.com/simple-statistics@7.0.2/dist/simple-statistics.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bowser@2.5.3/es5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.13.1/js-yaml.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jszip@3.5.0/dist/jszip.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/file-saver@2.0.2/dist/FileSaver.min.js"></script>
</head>

View File

@ -120,6 +120,8 @@ MathJax.Hub.Config({
<script src="https://unpkg.com/simple-statistics@7.0.2/dist/simple-statistics.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bowser@2.5.3/es5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.13.1/js-yaml.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jszip@3.5.0/dist/jszip.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/file-saver@2.0.2/dist/FileSaver.min.js"></script>
</head>

View File

@ -70,6 +70,8 @@ MathJax.Hub.Config({
<script src="https://unpkg.com/simple-statistics@7.0.2/dist/simple-statistics.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bowser@2.5.3/es5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.13.1/js-yaml.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jszip@3.5.0/dist/jszip.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/file-saver@2.0.2/dist/FileSaver.min.js"></script>
</head>

View File

@ -120,6 +120,8 @@ MathJax.Hub.Config({
<script src="https://unpkg.com/simple-statistics@7.0.2/dist/simple-statistics.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bowser@2.5.3/es5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.13.1/js-yaml.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jszip@3.5.0/dist/jszip.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/file-saver@2.0.2/dist/FileSaver.min.js"></script>
</head>
@ -275,7 +277,6 @@ MathJax.Hub.Config({
<article role="main" class="blog-post">
<script src="https://lcpq.github.io/QUESTDB_website/js/getFullDataPath.js" type="text/javascript"></script>
<script src="https://lcpq.github.io/QUESTDB_website/js/getTextFromFile.js" type="text/javascript"></script>
<script src="https://cdn.jsdelivr.net/npm/file-saver@2.0.2/dist/FileSaver.min.js"></script>
<script src="https://lcpq.github.io/QUESTDB_website/js/Base64ToBlob.js" type="text/javascript"></script>
<script>