GithubHelp home page GithubHelp logo

Comments (4)

mattwthompson avatar mattwthompson commented on July 18, 2024

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.

from cmiles.

wutobias avatar wutobias commented on July 18, 2024

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):

  • cmiles/_cmiles_oe.py line 42
    # Add geometry
    if molecule.NumAtoms() != geometry.shape[0]/3:
        raise ValueError("Number of atoms in molecule does not match length of position array")
  • cmiles/_cmiles_rd.py line 29
geometry = geometry.reshape(int(len(geometry)/3), 3)

My version of Pydantic is 1.8.1, see attached file.

env.txt

from cmiles.

mattwthompson avatar mattwthompson commented on July 18, 2024

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 👍

from cmiles.

wutobias avatar wutobias commented on July 18, 2024

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.

from cmiles.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.