10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-11-04 13:13:55 +01:00

Merge pull request #1 from scemama/master

Accelerate load time
This commit is contained in:
mveril 2020-11-16 17:03:18 +01:00 committed by GitHub
commit f325a22567
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 12 deletions

View File

@ -1,8 +1,11 @@
default:
default: data
hugo
serve:
serve: data
hugo -D server
clean:
rm -rf public
data:
python3 tools/generate_data.py

View File

@ -3,10 +3,10 @@
## Introduction
The QUEST website has been designed to gather and analyze the highly-accurate vertical excitation energies produced by the [QUEST project](https://doi.org/10.1021/acs.jpclett.0c00014).
The QUEST database contains more than 470 accurate vertical excitation energies of various natures ($\pi \to \pis$, $n \to \pis$, double excitation, Rydberg, singlet, doublet, triplet, etc) for small- and medium-sized molecules.
The QUEST database contains more than 470 accurate vertical excitation energies of various natures ($\pi \to \pi^{*}$, $n \to \pi^{*}$, double excitation, Rydberg, singlet, doublet, triplet, etc) for small- and medium-sized molecules.
These values have been obtained using a combination of high-order coupled cluster and selected configuration interaction calculations using increasingly large diffuse basis sets.
One of the key aspect of the QUEST dataset is that it does not rely on any experimental values, avoiding potential biases inherently linked to experiments and facilitating in the process theoretical cross comparisons.
Following this composite protocol, we have been able to produce theoretical best estimate (TBEs) with the aug-cc-pVTZ basis set, as well as basis set corrected TBEs (i.e., near the complete basis set limit) for each of these transitions.
Following this composite protocol, we have been able to produce theoretical best estimates (TBEs) with the aug-cc-pVTZ basis set, as well as basis set corrected TBEs (i.e., near the complete basis set limit) for each of these transitions.
Thanks to the present website, one can easily test and compare the accuracy of a given method with respect to various variables such as the molecule size or its family, the nature of the excited states, the size of the basis set, etc.
## Quick start
@ -19,13 +19,13 @@ cd QUESTDB_website
hugo serve
```
Now you car use your favorite browser to navigate to the website using the URL showed by Hugo in your terminal (normally <localhost:1313>)
Now you can use your favorite browser to navigate to the website using the URL showed by Hugo in your terminal (normally http://localhost:1313)
## Repository content
### The website
The main part of this repository is the website. It is build using the [hugo](https://gohugo.io/) static website generator with the [beautifulhugo](https://themes.gohugo.io/beautifulhugo/) theme.
The main part of this repository is the website. It is built using the [hugo](https://gohugo.io/) static website generator with the [beautifulhugo](https://themes.gohugo.io/beautifulhugo/) theme.
All the data are stored in the [data](static/data) directory.
@ -44,5 +44,5 @@ So you can remove a data file to regenerate it from a LaTeX input file with `dat
#### ADC25generator
The `ADC25generator` is used to build `ADC(2.5)` data files from `ADC(2)` and `ADC(3)` data files
The `ADC25generator` is used to build `ADC(2.5)` data files from `ADC(2)` and `ADC(3)` data files.

View File

@ -232,7 +232,8 @@ class dataFileBase {
return /^#\s*([A-Za-z_]+)\s*:\s*(.*)$/;
}
async getGeometryAsync(state = null) {
var text = await getTextFromFileUrlAsync(`/data/structures/${this.set.name.replace("#", "")}/${this.molecule.toLowerCase()}.xyz`)
// var text = await getTextFromFileUrlAsync(`/data/structures/${this.set.name.replace("#", "")}/${this.molecule.toLowerCase()}.xyz`)
var text = getTextFromFileUrl(`/data/structures/${this.set.name.replace("#", "")}/${this.molecule.toLowerCase()}.xyz`)
var lines = text.split("\n")
var indexes = lines.findAllIndexes((line) => {
return line.match(/^\d+$/)
@ -279,7 +280,8 @@ class dataFileBase {
case String.name:
file = getFullDataPath(file)
const maxAge= (DebugMode.Enabled,0,600)
var str = await getTextFromFileUrlAsync(file,{"Cache-Control":`max-age=${maxAge}`})
// var str = await getTextFromFileUrlAsync(file,{"Cache-Control":`max-age=${maxAge}`})
var str = await getTextFromFileUrl(file)
break;
case File.name:
var str = await getTextFromUploadedFileAsync(file)
@ -413,4 +415,4 @@ class VertDataFile extends dataFileBase {
ex.VertExcitationKind = kind
return ex
}
}
}

View File

@ -1,3 +1,18 @@
var fileCache = function () {
var json_url = "/data/database.json";
var req = new XMLHttpRequest();
req.open("GET",json_url, false);
req.send();
return JSON.parse(req.responseText);
}
_cache = fileCache();
function getTextFromFileUrl(url,header={}) {
return _cache[url];
}
async function getTextFromFileUrlAsync(url,header={}) {
return new Promise(function (resolve, reject) {
var req = new XMLHttpRequest();
@ -21,7 +36,6 @@ async function getTextFromFileUrlAsync(url,header={}) {
req.send();
});
}
async function getTextFromUploadedFileAsync(inputFile){
const temporaryFileReader = new FileReader();
@ -36,4 +50,4 @@ async function getTextFromUploadedFileAsync(inputFile){
};
temporaryFileReader.readAsText(inputFile);
});
};
};

30
tools/generate_data.py Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/env python3
import os
import os.path
import json
def main():
d = {}
os.chdir("static")
try:
os.remove(os.path.join("data","database.json"))
except FileNotFoundError:
pass
for root, dirs, files in os.walk('data'):
for name in files:
filename = os.path.join(root,name)
with open(filename,'r',encoding="utf8") as f:
try:
d["/"+filename] = f.read()
except UnicodeDecodeError:
pass
with open(os.path.join("data","database.json"),'w') as f:
f.write(json.dumps(d,indent=1))
if __name__ == "__main__":
main()