10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-25 13:53:48 +01:00

Avoid duplicated geometries on export (#8)

* Fix broken link

* Fix bug in indexDB

* Fix sourceFile  for each geometry

* Replaces Array by Set in exportGeoms to avoid duplicates

Co-authored-by: Mickaël Véril <mveril@irsamc.ups-tlse.fr>
This commit is contained in:
mveril 2020-12-07 15:41:39 +01:00 committed by GitHub
parent 4baaaa0fc2
commit 605d20492c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -713,13 +713,13 @@ draft: false
const molecule =geom.parseMetadata().molecule const molecule =geom.parseMetadata().molecule
if (mols.has(molecule)) { if (mols.has(molecule)) {
if (!geomDic.has(molecule)) { if (!geomDic.has(molecule)) {
geomDic.set(molecule,[]) geomDic.set(molecule,new Set())
} }
geomDic.get(molecule).push(geom.toXYZ()) geomDic.get(molecule).add(geom.toXYZ())
} }
} }
for (const [molecule,geometries] of geomDic) { for (const [molecule,geometries] of geomDic) {
const xyz=geometries.join("\n\n") const xyz=Array.from(geometries).join("\n\n")
var blob=new Blob([xyz],{type: 'chemical/x-xyz'}) var blob=new Blob([xyz],{type: 'chemical/x-xyz'})
zip.file(`${mhchemCE.extract(molecule).toLowerCase().replace(" ","_")}.xyz`,blob) zip.file(`${mhchemCE.extract(molecule).toLowerCase().replace(" ","_")}.xyz`,blob)
} }