openforcefield / cmiles

Generate canonical molecule identifiers for quantum chemistry database
https://cmiles.readthedocs.io
MIT License
23 stars 7 forks source link

Fix shape comparisons in geometry array #59

Closed mattwthompson closed 3 years ago

mattwthompson commented 3 years ago

Description

This may fix #55 - all I did was get the snippet to work. I have not investigated if the result oemols/rdmols are valid. I could not find existing tests that compare directly against QCMols, so I used a modified version of the reproducing snippet to spot-check this:

import qcportal as ptl
import cmiles

print(ptl.__version__)
print(cmiles.__version__)

qc_client  = ptl.FractalClient("https://api.qcarchive.molssi.org:443/")
ds         = qc_client.get_collection('TorsionDriveDataset', "OpenFF Substituted Phenyl Set 1")
qcrecord   = ds.get_record("CCC(=O)Nc1[cH:1][c:2](ccn1)[NH:3][CH2:4]C",
                           specification="default")
qcmols     = qcrecord.get_final_molecules()

for torsion_crd, qcmol in qcmols.items():
    print(qcmol.symbols.shape)
    print(qcmol.geometry.shape)
    print(qcmol.symbols.shape[0]==qcmol.geometry.shape[0])
    oemol = cmiles.utils.load_molecule(qcmol.dict(), toolkit="openeye")
    rdmol = cmiles.utils.load_molecule(qcmol.dict(), toolkit="rdkit")

I skimmed the QCElemental/QCSChema chagelogs/histories but could not quickly discern where these changes might have taken place.

wutobias commented 3 years ago

LGTM