Open wutobias opened 3 years ago
I can reproduce this with a few modifications. I think your suggested fix is good (it's actually somewhat confusing how this was working before).
Could you post the output of conda list
? I'm mostly curious what version of Pydantic you have installed.
Thanks for looking into this. I think this only broke recently, since the geometry in the qcmols seems now to be parsed as (natoms, 3) np.ndarray. I found at least two more lines that may suffer from the same issue (current master branch):
# Add geometry
if molecule.NumAtoms() != geometry.shape[0]/3:
raise ValueError("Number of atoms in molecule does not match length of position array")
geometry = geometry.reshape(int(len(geometry)/3), 3)
My version of Pydantic is 1.8.1, see attached file.
Could you look at the changes in #59 and see if those will fix your issues? I think I found the same changes you did 👍
I can confirm this fixes #55. The fix also works with qcmols from OptimizationDatasets. For instance:
import qcportal as ptl
import cmiles
qc_client = ptl.FractalClient("https://api.qcarchive.molssi.org:443/")
ds = qc_client.get_collection('OptimizationDataset', "FDA Optimization Dataset 1")
qcrecord = ds.get_record("C[NH2+]C[C@@H](c1ccc(c(c1)O)O)O-0",
specification="default")
qcmol = qcrecord.get_final_molecule()
oemol = cmiles.utils.load_molecule(qcmol.dict(), toolkit="openeye")
rdmol = cmiles.utils.load_molecule(qcmol.dict(), toolkit="rdkit")
The oemol is returned successfully, however the rdmol fails due to another reason not related to this issue I think RuntimeError: Could not sanitize molecule
. I'll open another issue for this.
Hi folks,
please have a look at the following code:
Fails with the following error:
The test qcmol in the example should be fine and the number of symbols matches the number of coordinates. I think the offending line must be changed to something like:
Thanks, Tobias