openforcefield / openff-toolkit

The Open Forcefield Toolkit provides implementations of the SMIRNOFF format, parameterization engine, and other tools. Documentation available at http://open-forcefield-toolkit.readthedocs.io
http://openforcefield.org
MIT License
315 stars 92 forks source link

Error loading a valid PDB file #1657

Closed peastman closed 1 year ago

peastman commented 1 year ago

Describe the bug

I am trying to load a valid PDB file. OpenFF Toolkit throws an exception and fails to load it.

This happens because the PDB file describes a strained conformation. By default, RDKit tries to infer bonds based on the distance between atoms. That leads it to incorrectly think there is an extra bond. That is not standard behavior: a correct PDB file lists bonds explicitly with CONECT records, as this one does. To disable that, you need to specify proximityBonding=False when calling MolFromPDBFile().

To Reproduce

Put the following into a file called error.pdb.

HETATM    1  C   ACE A   1     -10.866  -2.016   6.873  1.00  0.00           C  
HETATM    2  O   ACE A   1     -10.273  -0.913   6.985  1.00  0.00           O  
HETATM    3  CH3 ACE A   1     -12.338  -1.737   6.619  1.00  0.00           C  
HETATM    4  H1  ACE A   1     -12.957  -2.613   6.222  1.00  0.00           H  
HETATM    5  H2  ACE A   1     -12.524  -2.428   7.447  1.00  0.00           H  
HETATM    6  H3  ACE A   1     -12.833  -1.159   7.463  1.00  0.00           H  
ATOM      7  N   ILE A   2     -10.560  -3.063   6.062  1.00  0.00           N  
ATOM      8  H   ILE A   2      -9.809  -3.666   6.358  1.00  0.00           H  
ATOM      9  CA  ILE A   2     -10.460  -2.557   4.689  1.00  0.00           C  
ATOM     10  HA  ILE A   2      -9.427  -2.235   4.545  1.00  0.00           H  
ATOM     11  C   ILE A   2     -11.328  -1.323   4.474  1.00  0.00           C  
ATOM     12  O   ILE A   2     -10.995  -0.451   3.672  1.00  0.00           O  
ATOM     13  CB  ILE A   2     -10.768  -3.639   3.634  1.00  0.00           C  
ATOM     14  HB  ILE A   2     -10.154  -4.511   3.870  1.00  0.00           H  
ATOM     15  CG1 ILE A   2     -10.381  -3.118   2.249  1.00  0.00           C  
ATOM     16 HG12 ILE A   2     -11.268  -2.780   1.711  1.00  0.00           H  
ATOM     17 HG13 ILE A   2      -9.716  -2.259   2.343  1.00  0.00           H  
ATOM     18  CG2 ILE A   2     -12.235  -4.051   3.700  1.00  0.00           C  
ATOM     19 HG21 ILE A   2     -12.419  -4.837   2.967  1.00  0.00           H  
ATOM     20 HG22 ILE A   2     -12.894  -3.211   3.474  1.00  0.00           H  
ATOM     21 HG23 ILE A   2     -12.474  -4.446   4.687  1.00  0.00           H  
ATOM     22  CD1 ILE A   2      -9.648  -4.093   1.418  1.00  0.00           C  
ATOM     23 HD11 ILE A   2     -10.267  -4.974   1.247  1.00  0.00           H  
ATOM     24 HD12 ILE A   2      -8.725  -4.390   1.917  1.00  0.00           H  
ATOM     25 HD13 ILE A   2      -9.401  -3.640   0.457  1.00  0.00           H  
HETATM   26  N   NME A   3     -12.075  -0.814   5.466  1.00  0.00           N  
HETATM   27  H   NME A   3     -11.171  -0.712   5.799  1.00  0.00           H  
HETATM   28  C   NME A   3     -12.111   0.618   5.811  1.00  0.00           C  
HETATM   29  H1  NME A   3     -12.546   0.810   6.792  1.00  0.00           H  
HETATM   30  H2  NME A   3     -11.108   1.052   5.782  1.00  0.00           H  
HETATM   31  H3  NME A   3     -12.713   1.140   5.066  1.00  0.00           H  
TER      32      NME A   3
CONECT    1    3    2    7
CONECT    2    1
CONECT    3    4    5    6    1
CONECT    4    3
CONECT    5    3
CONECT    6    3
CONECT    7    1
CONECT   11   26
CONECT   26   27   11   28
CONECT   27   26
CONECT   28   29   30   31   26
CONECT   29   28
CONECT   30   28
CONECT   31   28
END

Then load it with the command

Molecule.from_pdb_and_smiles('error.pdb', '[H][N]([C](=[O])[C@]([H])([N]([H])[C](=[O])[C]([H])([H])[H])[C@]([H])([C]([H])([H])[H])[C]([H])([H])[C]([H])([H])[H])[C]([H])([H])[H]', allow_undefined_stereo=True)

Output

[12:31:23] Explicit valence for atom # 2 C, 5, is greater than permitted
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/peastman/miniconda3/envs/spice/lib/python3.10/site-packages/openff/toolkit/utils/base_wrapper.py", line 55, in wrapped_function
    value = func(*args, **kwargs)
  File "/home/peastman/miniconda3/envs/spice/lib/python3.10/site-packages/openff/toolkit/topology/molecule.py", line 4797, in from_pdb_and_smiles
    return toolkit.from_pdb_and_smiles(
  File "/home/peastman/miniconda3/envs/spice/lib/python3.10/site-packages/openff/toolkit/utils/rdkit_wrapper.py", line 233, in from_pdb_and_smiles
    pdbmol = self.from_rdkit(
  File "/home/peastman/miniconda3/envs/spice/lib/python3.10/site-packages/openff/toolkit/utils/rdkit_wrapper.py", line 1778, in from_rdkit
    rdmol = Chem.Mol(rdmol)
Boost.Python.ArgumentError: Python argument types in
    Mol.__init__(Mol, NoneType)
did not match C++ signature:
    __init__(_object*, RDKit::ROMol mol, bool quickCopy=False, int confId=-1)
    __init__(_object*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > pklString, unsigned int propertyFlags)
    __init__(_object*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > pklString)
    __init__(_object*)

Computing environment (please complete the following information):

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
amberlite                 22.0                     pypi_0    pypi
ambertools                22.5            py310hd182041_0    conda-forge
amberutils                21.0                     pypi_0    pypi
anyio                     3.7.0              pyhd8ed1ab_1    conda-forge
argon2-cffi               21.3.0             pyhd8ed1ab_0    conda-forge
argon2-cffi-bindings      21.2.0          py310h5764c6d_3    conda-forge
arpack                    3.7.0                hdefa2d7_2    conda-forge
ase                       3.22.1             pyhd8ed1ab_1    conda-forge
asttokens                 2.2.1              pyhd8ed1ab_0    conda-forge
astunparse                1.6.3              pyhd8ed1ab_0    conda-forge
attrs                     23.1.0             pyh71513ae_1    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                pyhd8ed1ab_3    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
beautifulsoup4            4.12.2             pyha770c72_0    conda-forge
bleach                    6.0.0              pyhd8ed1ab_0    conda-forge
blinker                   1.6.2              pyhd8ed1ab_0    conda-forge
blosc                     1.21.4               h0f2a231_0    conda-forge
boost                     1.78.0          py310hc4a4660_4    conda-forge
boost-cpp                 1.78.0               h6582d0a_3    conda-forge
brotli                    1.0.9                h166bdaf_8    conda-forge
brotli-bin                1.0.9                h166bdaf_8    conda-forge
bzip2                     1.0.8                h7b6447c_0  
c-ares                    1.19.1               hd590300_0    conda-forge
c-blosc2                  2.9.2                hb4ffafa_0    conda-forge
ca-certificates           2023.05.30           h06a4308_0  
cached-property           1.5.2                hd8ed1ab_1    conda-forge
cached_property           1.5.2              pyha770c72_1    conda-forge
cachetools                5.3.0              pyhd8ed1ab_0    conda-forge
cairo                     1.16.0            hbbf8b49_1016    conda-forge
certifi                   2023.5.7           pyhd8ed1ab_0    conda-forge
cffi                      1.15.1          py310h255011f_3    conda-forge
charset-normalizer        3.1.0              pyhd8ed1ab_0    conda-forge
click                     8.1.3           unix_pyhd8ed1ab_2    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
comm                      0.1.3              pyhd8ed1ab_0    conda-forge
contourpy                 1.0.7           py310hdf3cbec_0    conda-forge
cudatoolkit               11.8.0              h37601d7_11    conda-forge
curl                      8.1.2                h409715c_0    conda-forge
cycler                    0.11.0             pyhd8ed1ab_0    conda-forge
cython                    0.29.35         py310hc6cd4ac_0    conda-forge
debugpy                   1.6.7           py310heca2aa9_0    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
entrypoints               0.4                pyhd8ed1ab_0    conda-forge
exceptiongroup            1.1.1              pyhd8ed1ab_0    conda-forge
executing                 1.2.0              pyhd8ed1ab_0    conda-forge
expat                     2.5.0                hcb278e6_1    conda-forge
fftw                      3.3.10          nompi_hc118613_108    conda-forge
flask                     2.3.2              pyhd8ed1ab_0    conda-forge
flit-core                 3.9.0              pyhd8ed1ab_0    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 hab24e00_0    conda-forge
fontconfig                2.14.2               h14ed4e7_0    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
fonttools                 4.40.0          py310h2372a71_0    conda-forge
freetype                  2.12.1               hca18f0e_1    conda-forge
gettext                   0.21.1               h27087fc_0    conda-forge
gmp                       6.2.1                h58526e2_0    conda-forge
greenlet                  2.0.2           py310hc6cd4ac_1    conda-forge
h5py                      3.8.0           nompi_py310ha66b2ad_101    conda-forge
hdf4                      4.2.15               h501b40f_6    conda-forge
hdf5                      1.14.0          nompi_hb72d44e_103    conda-forge
icu                       72.1                 hcb278e6_0    conda-forge
idna                      3.4                pyhd8ed1ab_0    conda-forge
importlib-metadata        6.6.0              pyha770c72_0    conda-forge
importlib_metadata        6.6.0                hd8ed1ab_0    conda-forge
importlib_resources       5.12.0             pyhd8ed1ab_0    conda-forge
ipykernel                 6.23.1             pyh210e3f2_0    conda-forge
ipython                   8.14.0             pyh41d4057_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
ipywidgets                7.7.5              pyhd8ed1ab_0    conda-forge
itsdangerous              2.1.2              pyhd8ed1ab_0    conda-forge
jedi                      0.18.2             pyhd8ed1ab_0    conda-forge
jinja2                    3.1.2              pyhd8ed1ab_1    conda-forge
joblib                    1.2.0              pyhd8ed1ab_0    conda-forge
jsonschema                4.17.3             pyhd8ed1ab_0    conda-forge
jupyter_client            8.2.0              pyhd8ed1ab_0    conda-forge
jupyter_core              5.3.0           py310hff52083_0    conda-forge
jupyter_events            0.6.3              pyhd8ed1ab_0    conda-forge
jupyter_server            2.6.0              pyhd8ed1ab_0    conda-forge
jupyter_server_terminals  0.4.4              pyhd8ed1ab_1    conda-forge
jupyterlab_pygments       0.2.2              pyhd8ed1ab_0    conda-forge
jupyterlab_widgets        1.1.4              pyhd8ed1ab_0    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
kiwisolver                1.4.4           py310hbf28c38_1    conda-forge
krb5                      1.20.1               h81ceb04_0    conda-forge
lcms2                     2.15                 haa2dc70_1    conda-forge
ld_impl_linux-64          2.38                 h1181459_1  
lerc                      4.0.0                h27087fc_0    conda-forge
libaec                    1.0.6                hcb278e6_1    conda-forge
libblas                   3.9.0           17_linux64_openblas    conda-forge
libbrotlicommon           1.0.9                h166bdaf_8    conda-forge
libbrotlidec              1.0.9                h166bdaf_8    conda-forge
libbrotlienc              1.0.9                h166bdaf_8    conda-forge
libcblas                  3.9.0           17_linux64_openblas    conda-forge
libcurl                   8.1.2                h409715c_0    conda-forge
libdeflate                1.18                 h0b41bf4_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libexpat                  2.5.0                hcb278e6_1    conda-forge
libffi                    3.4.4                h6a678d5_0  
libgcc-ng                 13.1.0               he5830b7_0    conda-forge
libgfortran-ng            13.1.0               h69a702a_0    conda-forge
libgfortran5              13.1.0               h15d22d2_0    conda-forge
libglib                   2.76.3               hebfc3b9_0    conda-forge
libgomp                   13.1.0               he5830b7_0    conda-forge
libiconv                  1.17                 h166bdaf_0    conda-forge
libjpeg-turbo             2.1.5.1              h0b41bf4_0    conda-forge
liblapack                 3.9.0           17_linux64_openblas    conda-forge
libnetcdf                 4.9.2           nompi_h0f3d0bb_105    conda-forge
libnghttp2                1.52.0               h61bc06f_0    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libopenblas               0.3.23          pthreads_h80387f5_0    conda-forge
libpng                    1.6.39               h753d276_0    conda-forge
libsodium                 1.0.18               h36c2ea0_1    conda-forge
libsqlite                 3.42.0               h2797004_0    conda-forge
libssh2                   1.11.0               h0841786_0    conda-forge
libstdcxx-ng              13.1.0               hfd8a6a1_0    conda-forge
libtiff                   4.5.0                ha587672_6    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libwebp-base              1.3.0                h0b41bf4_0    conda-forge
libxcb                    1.15                 h0b41bf4_0    conda-forge
libxml2                   2.11.4               h0d562d8_0    conda-forge
libxslt                   1.1.37               h0054252_1    conda-forge
libzip                    1.9.2                hc929e4a_1    conda-forge
libzlib                   1.2.13               hd590300_5    conda-forge
lxml                      4.9.2           py310h9b7343a_1    conda-forge
lz4-c                     1.9.4                hcb278e6_0    conda-forge
lzo                       2.10              h516909a_1000    conda-forge
markupsafe                2.1.3           py310h2372a71_0    conda-forge
matplotlib-base           3.7.1           py310he60537e_0    conda-forge
matplotlib-inline         0.1.6              pyhd8ed1ab_0    conda-forge
mctc-lib                  0.3.1                h74f4db8_0    conda-forge
mdtraj                    1.9.7           py310h902c554_4    conda-forge
mistune                   2.0.5              pyhd8ed1ab_0    conda-forge
mmpbsa-py                 16.0                     pypi_0    pypi
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
nbclassic                 1.0.0              pyhb4ecaf3_1    conda-forge
nbclient                  0.8.0              pyhd8ed1ab_0    conda-forge
nbconvert                 7.5.0              pyhd8ed1ab_0    conda-forge
nbconvert-core            7.5.0              pyhd8ed1ab_0    conda-forge
nbconvert-pandoc          7.5.0              pyhd8ed1ab_0    conda-forge
nbformat                  5.9.0              pyhd8ed1ab_0    conda-forge
ncurses                   6.4                  h6a678d5_0  
nest-asyncio              1.5.6              pyhd8ed1ab_0    conda-forge
netcdf-fortran            4.6.1           nompi_h4f3791c_100    conda-forge
networkx                  3.1                pyhd8ed1ab_0    conda-forge
nomkl                     1.0                  h5ca1d4c_0    conda-forge
notebook                  6.5.4              pyha770c72_0    conda-forge
notebook-shim             0.2.3              pyhd8ed1ab_0    conda-forge
numexpr                   2.8.4           py310h690d005_100    conda-forge
numpy                     1.24.3          py310ha4c1d20_0    conda-forge
ocl-icd                   2.3.1                h7f98852_0    conda-forge
ocl-icd-system            1.0.0                         1    conda-forge
openbabel                 3.1.1           py310h956b46e_7    conda-forge
openff-amber-ff-ports     0.0.3              pyh6c4a22f_0    conda-forge
openff-forcefields        2023.05.1          pyh1a96a4e_1    conda-forge
openff-interchange        0.3.4              pyhd8ed1ab_2    conda-forge
openff-interchange-base   0.3.4              pyhd8ed1ab_2    conda-forge
openff-models             0.0.5              pyh1a96a4e_0    conda-forge
openff-toolkit            0.13.1             pyhd8ed1ab_0    conda-forge
openff-toolkit-base       0.13.1             pyhd8ed1ab_0    conda-forge
openff-units              0.2.0              pyh1a96a4e_2    conda-forge
openff-utilities          0.1.8              pyh1a96a4e_0    conda-forge
openjpeg                  2.5.0                hfec8fc6_2    conda-forge
openmm                    8.0.0           py310h5728c26_1    conda-forge
openmmforcefields         0.11.2             pyhd8ed1ab_2    conda-forge
openssl                   3.1.1                hd590300_1    conda-forge
overrides                 7.3.1              pyhd8ed1ab_0    conda-forge
packaging                 23.1               pyhd8ed1ab_0    conda-forge
packmol                   20.010               h86c2bf4_0    conda-forge
packmol-memgen            1.2.3rc0                 pypi_0    pypi
pandas                    2.0.2           py310h7cbd5c2_0    conda-forge
pandoc                    3.1.3                h32600fe_0    conda-forge
pandocfilters             1.5.0              pyhd8ed1ab_0    conda-forge
panedr                    0.7.1              pyhd8ed1ab_0    conda-forge
parmed                    4.1.0           py310heca2aa9_0    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
pbr                       5.11.1             pyhd8ed1ab_0    conda-forge
pcre2                     10.40                hc3806b6_0    conda-forge
pdb4amber                 22.0                     pypi_0    pypi
pdbfixer                  1.9                pyh1a96a4e_0    conda-forge
perl                      5.32.1          2_h7f98852_perl5    conda-forge
pexpect                   4.8.0              pyh1a96a4e_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    9.5.0           py310h582fbeb_1    conda-forge
pint                      0.21               pyhd8ed1ab_0    conda-forge
pip                       23.1.2          py310h06a4308_0  
pixman                    0.40.0               h36c2ea0_0    conda-forge
pkgutil-resolve-name      1.3.10             pyhd8ed1ab_0    conda-forge
platformdirs              3.5.3              pyhd8ed1ab_0    conda-forge
pooch                     1.7.0              pyha770c72_3    conda-forge
prometheus_client         0.17.0             pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.38             pyha770c72_0    conda-forge
prompt_toolkit            3.0.38               hd8ed1ab_0    conda-forge
psutil                    5.9.5           py310h1fa729e_0    conda-forge
pthread-stubs             0.4               h36c2ea0_1001    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
py-cpuinfo                9.0.0              pyhd8ed1ab_0    conda-forge
pycairo                   1.23.0          py310hb8a676c_0    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pydantic                  1.10.9          py310h2372a71_0    conda-forge
pyedr                     0.7.1              pyhd8ed1ab_0    conda-forge
pygments                  2.15.1             pyhd8ed1ab_0    conda-forge
pyparsing                 3.0.9              pyhd8ed1ab_0    conda-forge
pyrsistent                0.19.3          py310h1fa729e_0    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
pytables                  3.8.0           py310hde6a235_1    conda-forge
python                    3.10.11         he550d4f_0_cpython    conda-forge
python-constraint         1.4.0                      py_0    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-fastjsonschema     2.17.1             pyhd8ed1ab_0    conda-forge
python-json-logger        2.0.7              pyhd8ed1ab_0    conda-forge
python-tzdata             2023.3             pyhd8ed1ab_0    conda-forge
python_abi                3.10                    3_cp310    conda-forge
pytraj                    2.0.6                    pypi_0    pypi
pytz                      2023.3             pyhd8ed1ab_0    conda-forge
pyyaml                    6.0             py310h5764c6d_5    conda-forge
pyzmq                     25.1.0          py310h5bbb5d0_0    conda-forge
rdkit                     2023.03.1       py310h399bcf7_0    conda-forge
readline                  8.2                  h5eee18b_0  
reportlab                 3.6.13          py310h1a56a1c_0    conda-forge
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
rfc3339-validator         0.1.4              pyhd8ed1ab_0    conda-forge
rfc3986-validator         0.1.1              pyh9f0ad1d_0    conda-forge
sander                    22.0                     pypi_0    pypi
scipy                     1.10.1          py310ha4c1d20_3    conda-forge
send2trash                1.8.2              pyh41d4057_0    conda-forge
setuptools                67.8.0          py310h06a4308_0  
six                       1.16.0             pyh6c4a22f_0    conda-forge
smirnoff99frosst          1.1.0              pyh44b312d_0    conda-forge
snappy                    1.1.10               h9fff704_0    conda-forge
sniffio                   1.3.0              pyhd8ed1ab_0    conda-forge
soupsieve                 2.3.2.post1        pyhd8ed1ab_0    conda-forge
sqlalchemy                2.0.16          py310h2372a71_0    conda-forge
sqlite                    3.41.2               h5eee18b_0  
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
terminado                 0.17.1             pyh41d4057_0    conda-forge
tinycss2                  1.2.1              pyhd8ed1ab_0    conda-forge
tinydb                    4.8.0              pyhd8ed1ab_0    conda-forge
tk                        8.6.12               h1ccaba5_0  
tornado                   6.3.2           py310h2372a71_0    conda-forge
tqdm                      4.65.0             pyhd8ed1ab_1    conda-forge
traitlets                 5.9.0              pyhd8ed1ab_0    conda-forge
typing-extensions         4.6.3                hd8ed1ab_0    conda-forge
typing_extensions         4.6.3              pyha770c72_0    conda-forge
typing_utils              0.1.0              pyhd8ed1ab_0    conda-forge
tzdata                    2023c                h04d1e81_0  
unicodedata2              15.0.0          py310h5764c6d_0    conda-forge
urllib3                   2.0.3              pyhd8ed1ab_0    conda-forge
validators                0.20.0             pyhd8ed1ab_0    conda-forge
wcwidth                   0.2.6              pyhd8ed1ab_0    conda-forge
webencodings              0.5.1                      py_1    conda-forge
websocket-client          1.5.3              pyhd8ed1ab_0    conda-forge
werkzeug                  2.3.6              pyhd8ed1ab_0    conda-forge
wheel                     0.38.4          py310h06a4308_0  
widgetsnbextension        3.6.4              pyhd8ed1ab_0    conda-forge
xmltodict                 0.13.0             pyhd8ed1ab_0    conda-forge
xorg-kbproto              1.0.7             h7f98852_1002    conda-forge
xorg-libice               1.0.10               h7f98852_0    conda-forge
xorg-libsm                1.2.3             hd9c2040_1000    conda-forge
xorg-libx11               1.8.5                h8ee46fc_0    conda-forge
xorg-libxau               1.0.11               hd590300_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xorg-libxext              1.3.4                h0b41bf4_2    conda-forge
xorg-libxrender           0.9.10            h7f98852_1003    conda-forge
xorg-libxt                1.3.0                hd590300_0    conda-forge
xorg-renderproto          0.11.1            h7f98852_1002    conda-forge
xorg-xextproto            7.3.0             h0b41bf4_1003    conda-forge
xorg-xproto               7.0.31            h7f98852_1007    conda-forge
xtb                       6.5.1                h03160e7_1    conda-forge
xtb-python                22.1            py310h1fa729e_0    conda-forge
xz                        5.4.2                h5eee18b_0  
yaml                      0.2.5                h7f98852_2    conda-forge
zeromq                    4.3.4                h9c3ff4c_1    conda-forge
zipp                      3.15.0             pyhd8ed1ab_0    conda-forge
zlib                      1.2.13               hd590300_5    conda-forge
zlib-ng                   2.0.7                h0b41bf4_0    conda-forge
zstd                      1.5.2                h3eb15da_6    conda-forge
peastman commented 1 year ago

Unfortunately, just specifying proximityBonding=False doesn't work either due to another flaw in the RDKit PDB reader: it doesn't fill in bonds for standard residues. I don't think RDKit is capable of reading PDB files correctly.

j-wags commented 1 year ago

Thanks for the report. I think that Molecule.from_pdb_and_smiles(pdbfile, smiles) is now completely superseded by Topology.from_pdb(pdbfile, unique_molecules=[Molecule.from_smiles(smiles)]) (which uses OpenMM to correctly read the PDB).

Does using Topology.from_pdb give you a workaround for the immediate problem?

peastman commented 1 year ago

I didn't know there were two different functions for loading PDB files. The workaround I came up with was to copy the logic from RDKitToolkitWrapper.from_pdb_and_smiles(): create a molecule with Molecule.from_smiles(), load the PDB with OpenMM, construct another Molecule based on it, and call Molecule.are_isomorphic() to find a mapping between them.