diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 00000000..3d74b34c --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -0,0 +1,31 @@ +name: github pages + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: refresh apt + run: sudo apt-get update + + - name: install dependencies + run: sudo apt-get install hugo + + - name: install theme + run: git submodule update --init --recursive + + - name: make + run: make + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./public + diff --git a/content/dataset.html b/content/dataset.html index 1a813649..d0d1cbc9 100644 --- a/content/dataset.html +++ b/content/dataset.html @@ -101,16 +101,18 @@ draft: false await loadFiles() } async function loadFiles() { + const db = await indexDB.loadAsync() + const data = await loadAllData() processingIndicator.isActive = true - var data = await loadAllData() + window.defaultDats = [] for (const sub of Object.values(data)) { for (const exSet of uniq(sub.map(d => d.set))) { const subset = sub.filter(d => d.set.isSameSet(exSet)) for (mol of uniq(subset.map(d => d.molecule))) { const submol = subset.filter(d => d.molecule === mol) - const source = await submol.findAsync(async (d) => { - if (await d.set.getDOIAsync() === "10.1021/acs.jctc.8b01205") { + const source = submol.find((d) => { + if (db.sets.get(d.set.name)[d.set.index] === "10.1021/acs.jctc.8b01205") { return d.method.name === "CASPT2" && d.method.basis === "aug-cc-pVDZ" } else { return d.method.isTBE diff --git a/static/js/GeometriesLoader.js b/static/js/GeometriesLoader.js index 2df41181..4370c432 100644 --- a/static/js/GeometriesLoader.js +++ b/static/js/GeometriesLoader.js @@ -6,11 +6,11 @@ class GeometriesLoader{ const myset=item.set.split("#").join("") try { const mol=await Geometry.loadXYZAsync(`/${myset}/${mymol}.xyz`) - xyzs.push(mol) + xyzs.push(mol) } catch (error) { console.error("Geometry not found",item) - } + } } return xyzs.flat() } -} \ No newline at end of file +} diff --git a/static/js/Geometry.js b/static/js/Geometry.js index f0e26c5c..7d9734a4 100644 --- a/static/js/Geometry.js +++ b/static/js/Geometry.js @@ -6,9 +6,8 @@ class Geometry { static async loadXYZAsync(file) { switch (trueTypeOf(file)) { case String.name: - file = getFullDataPath("/structures/"+file) - const maxAge= (DebugMode.Enabled,0,600) - var str = await getTextFromFileUrlAsync(file,{"Cache-Control":`max-age=${maxAge}`}) + file = getFullDataPath("structures"+file) + var str = getTextFromFileUrl(file) break; case File.name: var str = await getTextFromUploadedFileAsync(file) @@ -33,4 +32,4 @@ class Geometry { } return geoms } -} \ No newline at end of file +} diff --git a/static/js/data.js b/static/js/data.js index f711d035..74b8fe9c 100644 --- a/static/js/data.js +++ b/static/js/data.js @@ -261,17 +261,20 @@ class dataFileBase { }) } CopyExcitationsTypeFrom(data) { + var exc_strings = data.excitations.map( e => [e, JSON.stringify(e.initial), JSON.stringify(e.final) ] ) for (const ex of this.excitations) { - const ex2 = data.excitations.find((e) => { - return (JSON.stringify(e.initial) === JSON.stringify(ex.initial)) && (JSON.stringify(e.final) === JSON.stringify(ex.final)) + const exi = JSON.stringify(ex.initial) + const exf = JSON.stringify(ex.final) + const ex2 = exc_strings.find((e) => { + return (e[1]=== exi) && (e[2]=== exf) }) if (ex2 !== undefined) { if (DebugMode.Enabled) { - const restflag=ex.type.Value & ex2.type.Value + const restflag=ex.type.Value & ex2[0].type.Value const result=restflag==ex.type.Value - console.assert(result, "Excitation type error", data.molecule, ex, ex2, this.sourceFile) + console.assert(result, "Excitation type error", data.molecule, ex, ex2[0], this.sourceFile) } - ex.type = ex2.type + ex.type = ex2[0].type } } } @@ -279,9 +282,9 @@ class dataFileBase { switch (trueTypeOf(file)) { case String.name: file = getFullDataPath(file) - const maxAge= (DebugMode.Enabled,0,600) + // const maxAge= (DebugMode.Enabled,0,600) // var str = await getTextFromFileUrlAsync(file,{"Cache-Control":`max-age=${maxAge}`}) - var str = await getTextFromFileUrl(file) + var str = getTextFromFileUrl(file) break; case File.name: var str = await getTextFromUploadedFileAsync(file) @@ -291,6 +294,20 @@ class dataFileBase { dat.sourceFile = new websiteFile(file) return dat } + static load(file, kind = undefined) { + switch (trueTypeOf(file)) { + case String.name: + file = getFullDataPath(file) + var str = getTextFromFileUrl(file) + break; + case File.name: + var str = (async () => await getTextFromUploadedFileAsync(file))().then(x=>x) + break + } + var dat = this.loadString(str, kind); + dat.sourceFile = new websiteFile(file) + return dat + } _OnReadMetaPair(key, value) { switch (key) { case "molecule": diff --git a/static/js/loadAllData.js b/static/js/loadAllData.js index afc0d766..8515f1fa 100644 --- a/static/js/loadAllData.js +++ b/static/js/loadAllData.js @@ -4,10 +4,10 @@ async function loadAllData() { fluo: [], }; for (const f of getAbsFilesName()) { - dic.abs.push(await VertDataFile.loadAsync(f,VertExcitationKinds.Absorbtion)) + dic.abs.push(VertDataFile.load(f,VertExcitationKinds.Absorbtion)) } for (const f of getFluoFilesName()) { - dic.fluo.push(await VertDataFile.loadAsync(f,VertExcitationKinds.Fluorescence)) + dic.fluo.push(VertDataFile.load(f,VertExcitationKinds.Fluorescence)) } return dic; } diff --git a/static/js/uniq.js b/static/js/uniq.js index d492b157..17e067ba 100644 --- a/static/js/uniq.js +++ b/static/js/uniq.js @@ -1,8 +1,11 @@ function uniq(array) { - return uniqueArray = array.filter((obj1,index) => { - return index === array.findIndex(obj2 => { - return JSON.stringify(obj1) === JSON.stringify(obj2); - }); - }); -} \ No newline at end of file + if (array.length == 0) return []; + const sortedArray = array.sort().map( x => [x, JSON.stringify(x)] ); + var uniqueArray = [ sortedArray[0][0] ]; + for (let i=1 ; i