Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chemically equivalent atoms with delocalized formal charge are assigned different torsions #56

Open
chapincavender opened this issue Sep 23, 2022 · 5 comments

Comments

@chapincavender
Copy link
Contributor

Describe the bug
Chemically equivalent atoms in which a nonzero charge is delocalized (represented by resonance structures with the formal charge on different atoms) are assigned different torsions by OpenFF 2.0.0. Examples include carboxylate and guanidinium groups.

To Reproduce
MWE for the amino acids aspartate (carboxylate) and arginine (guanidinium).

from openff.toolkit.topology import Molecule
from openff.toolkit.typing.engines.smirnoff import ForceField

ff = ForceField('openff-2.0.0.offxml')

aspartate = Molecule.from_smiles('CC(=O)N[C@@H](CC(=O)[O-])C(=O)NC')
labels = ff.label_molecules(aspartate.to_topology())[0]
torsion_label = labels['ProperTorsions']

print(f'SMILES {aspartate.to_smiles(mapped=True)}')

chi2_smirks = '[#7X3]-[#6X4:1](-[#6X3]=[#8])-[#6X4:2]-[#6X3:3]~[!#1:4]'
for match in aspartate.chemical_environment_matches(chi2_smirks):

    if match in torsion_label:
        parameter = torsion_label[match]
    else:
        parameter = torsion_label[match[::-1]]

    print(
        f'{match[0]+1:2d} {match[1]+1:2d} {match[2]+1:2d} {match[3]+1:2d} '
        f'{parameter.id:4s} {parameter.smirks}'
    )

symmetric_arg = Molecule.from_smiles('CC(=O)N[C@@H](CCC[NH+]=C(N)N)C(=O)NC')
labels = ff.label_molecules(symmetric_arg.to_topology())[0]
torsion_label = labels['ProperTorsions']

print(f'SMILES {symmetric_arg.to_smiles(mapped=True)}')

chi5_smirks = '[#7X3]-[#6X4](-[#6X3]=[#8])-[#6X4]-[#6X4]-[#6X4:1]-[#7:2]~[#6:3]~[#7:4]'
for match in symmetric_arg.chemical_environment_matches(chi5_smirks):

    if match in torsion_label:
        parameter = torsion_label[match]
    else:
        parameter = torsion_label[match[::-1]]

    print(
        f'{match[0]+1:2d} {match[1]+1:2d} {match[2]+1:2d} {match[3]+1:2d} '
        f'{parameter.id:4s} {parameter.smirks}'
    )

asymmetric_arg = Molecule.from_smiles('CC(=O)N[C@@H](CCC[NH]C(=[N+])N)C(=O)NC')
labels = ff.label_molecules(asymmetric_arg.to_topology())[0]
torsion_label = labels['ProperTorsions']

print(f'SMILES {asymmetric_arg.to_smiles(mapped=True)}')

for match in asymmetric_arg.chemical_environment_matches(chi5_smirks):

    if match in torsion_label:
        parameter = torsion_label[match]
    else:
        parameter = torsion_label[match[::-1]]

    print(
        f'{match[0]+1:2d} {match[1]+1:2d} {match[2]+1:2d} {match[3]+1:2d} '
        f'{parameter.id:4s} {parameter.smirks}'
    )

Output
The code above produces

SMILES [H:6][C@@:5]([C:11](=[O:12])[N:13]([H:21])[C:14]([H:22])([H:23])[H:24])([C:7]([H:19])([H:20])[C:8](=[O:9])[O-:10])[N:4]([H:18])[C:2](=[O:3])[C:1]([H:15])([H:16])[H:17]
 5  7  8  9 t18  [*:1]-[#6X4:2]-[#6X3:3]=[*:4]
 5  7  8 10 t17  [*:1]~[#6X3:2]-[#6X4:3]-[*:4]
SMILES [H:6][C@@:5]([C:14](=[O:15])[N:16]([H:33])[C:17]([H:34])([H:35])[H:36])([C:7]([H:22])([H:23])[C:8]([H:24])([H:25])[C:9]([H:26])([H:27])[N+:10](=[C:11]([N:12]([H:29])[H:30])[N:13]([H:31])[H:32])[H:28])[N:4]([H:21])[C:2](=[O:3])[C:1]([H:18])([H:19])[H:20]
 9 10 11 12 t87  [*:1]-[#7X3+1:2]=,:[#6X3:3]-,:[*:4]
 9 10 11 13 t87  [*:1]-[#7X3+1:2]=,:[#6X3:3]-,:[*:4]
SMILES [H:6][C@@:5]([C:14](=[O:15])[N:16]([H:31])[C:17]([H:32])([H:33])[H:34])([C:7]([H:22])([H:23])[C:8]([H:24])([H:25])[C:9]([H:26])([H:27])[N:10]([H:28])[C:11](=[N+:12])[N:13]([H:29])[H:30])[N:4]([H:21])[C:2](=[O:3])[C:1]([H:18])([H:19])[H:20]
 9 10 11 12 t79  [*:1]-[#7X3:2]-!@[#6X3:3](=[#8,#16,#7:4])-[#7X3]
 9 10 11 13 t75  [*:1]-[#7X3:2]-[#6X3$(*=[#8,#16,#7]):3]~[*:4]

For aspartate, the C-C-C=O torsion gets t18, but C-C-C-[O-] gets t17.
For symmetric arginine, where the formal charge is on the epsilon nitrogen, both C-[N+]=C-N torsions get t87.
For asymmetric arginine, where the formal charge is on one of the zeta nitrogens, the C-N-C=[N+] torsion gets t79, but C-N-C-N gets t75.

Computing environment (please complete the following information):
OS is Ubuntu 20.04.5.
openff-toolkit is 0.10.6.
openff-forcefields is 2.0.0.
Output of conda list is

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
abseil-cpp                20210324.2           h9c3ff4c_0    conda-forge
amberlite                 22.0                     pypi_0    pypi
ambertools                22.0             py39hcb9d944_3    conda-forge
amberutils                21.0                     pypi_0    pypi
amqp                      5.1.1              pyhd8ed1ab_0    conda-forge
anyio                     3.6.1              pyhd8ed1ab_1    conda-forge
argcomplete               2.0.0              pyhd8ed1ab_0    conda-forge
arpack                    3.7.0                hdefa2d7_2    conda-forge
arrow-cpp                 6.0.1           py39h2c67c1e_5_cpu    conda-forge
asttokens                 2.0.8              pyhd8ed1ab_0    conda-forge
astunparse                1.6.3              pyhd8ed1ab_0    conda-forge
async-timeout             4.0.2              pyhd8ed1ab_0    conda-forge
attrs                     22.1.0             pyh71513ae_1    conda-forge
aws-c-auth                0.6.8                hadad3cd_1    conda-forge
aws-c-cal                 0.5.12               h70efedd_7    conda-forge
aws-c-common              0.6.17               h7f98852_0    conda-forge
aws-c-compression         0.2.14               h7c7754b_7    conda-forge
aws-c-event-stream        0.2.7               hd2be095_32    conda-forge
aws-c-http                0.6.10               h416565a_3    conda-forge
aws-c-io                  0.10.14              he836878_0    conda-forge
aws-c-mqtt                0.7.10               h885097b_0    conda-forge
aws-c-s3                  0.1.29               h8d70ed6_0    conda-forge
aws-c-sdkutils            0.1.1                h7c7754b_4    conda-forge
aws-checksums             0.1.12               h7c7754b_6    conda-forge
aws-crt-cpp               0.17.10              h6ab17b9_5    conda-forge
aws-sdk-cpp               1.9.160              h36ff4c5_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
basis_set_exchange        0.9                pyhd8ed1ab_0    conda-forge
billiard                  3.6.4.0          py39hb9d737c_2    conda-forge
blosc                     1.21.1               h83bc5f7_3    conda-forge
boost                     1.74.0           py39h5472131_5    conda-forge
boost-cpp                 1.74.0               h75c5d50_8    conda-forge
brotli                    1.0.9                h166bdaf_7    conda-forge
brotli-bin                1.0.9                h166bdaf_7    conda-forge
brotlipy                  0.7.0           py39hb9d737c_1004    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
c-ares                    1.18.1               h7f98852_0    conda-forge
ca-certificates           2022.9.14            ha878542_0    conda-forge
cached-property           1.5.2                hd8ed1ab_1    conda-forge
cached_property           1.5.2              pyha770c72_1    conda-forge
cachetools                5.2.0              pyhd8ed1ab_0    conda-forge
cairo                     1.16.0            ha61ee94_1013    conda-forge
celery                    5.2.7              pyhd8ed1ab_0    conda-forge
certifi                   2022.9.14          pyhd8ed1ab_0    conda-forge
cffi                      1.15.1           py39he91dace_0    conda-forge
charset-normalizer        2.1.1              pyhd8ed1ab_0    conda-forge
chemper                   1.0.1              pyhd8ed1ab_0    conda-forge
click                     8.1.3            py39hf3d152e_0    conda-forge
click-didyoumean          0.3.0              pyhd8ed1ab_0    conda-forge
click-option-group        0.5.3              pyhd8ed1ab_1    conda-forge
click-plugins             1.1.1                      py_0    conda-forge
click-repl                0.2.0              pyhd8ed1ab_0    conda-forge
cmiles                    0.1.6                ha770c72_2    conda-forge
cmiles-base               0.1.6              pyhd8ed1ab_2    conda-forge
colorama                  0.4.5              pyhd8ed1ab_0    conda-forge
commonmark                0.9.1                      py_0    conda-forge
conda-pack                0.7.0              pyh6c4a22f_0    conda-forge
contourpy                 1.0.5            py39hf939315_0    conda-forge
cryptography              37.0.4           py39hd97740a_0    conda-forge
cudatoolkit               11.7.0              hd8887f6_10    conda-forge
curl                      7.83.1               h7bff187_0    conda-forge
cycler                    0.11.0             pyhd8ed1ab_0    conda-forge
cython                    0.29.32          py39h5a03fae_0    conda-forge
dataclasses               0.8                pyhc8e2a94_3    conda-forge
debugpy                   1.6.3            py39h5a03fae_0    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
deprecated                1.2.13             pyh6c4a22f_0    conda-forge
dill                      0.3.5.1            pyhd8ed1ab_0    conda-forge
entrypoints               0.4                pyhd8ed1ab_0    conda-forge
executing                 1.0.0              pyhd8ed1ab_0    conda-forge
expat                     2.4.8                h27087fc_0    conda-forge
fastapi                   0.85.0             pyhd8ed1ab_0    conda-forge
fftw                      3.3.10          nompi_hf0379b8_105    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.0               hc2a2eb6_1    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
fonttools                 4.37.2           py39hb9d737c_0    conda-forge
forcebalance              1.9.3            py39hac2352c_1    conda-forge
freetype                  2.12.1               hca18f0e_0    conda-forge
future                    0.18.2           py39hf3d152e_5    conda-forge
geometric                 0.9.7.2                    py_0    conda-forge
gettext                   0.19.8.1          h73d1719_1008    conda-forge
gflags                    2.2.2             he1b5a44_1004    conda-forge
glog                      0.5.0                h48cff8f_0    conda-forge
greenlet                  1.1.3            py39h5a03fae_0    conda-forge
grpc-cpp                  1.42.0               ha1441d3_1    conda-forge
h11                       0.12.0             pyhd8ed1ab_0    conda-forge
h2                        4.1.0            py39hf3d152e_0    conda-forge
h5py                      3.7.0           nompi_py39hd51670d_101    conda-forge
hdf4                      4.2.15               h9772cbc_4    conda-forge
hdf5                      1.12.2          nompi_h2386368_100    conda-forge
hpack                     4.0.0              pyh9f0ad1d_0    conda-forge
httpcore                  0.15.0             pyhd8ed1ab_0    conda-forge
httpx                     0.23.0           py39hf3d152e_1    conda-forge
hyperframe                6.0.1              pyhd8ed1ab_0    conda-forge
icu                       70.1                 h27087fc_0    conda-forge
idna                      3.3                pyhd8ed1ab_0    conda-forge
importlib-metadata        4.11.4           py39hf3d152e_0    conda-forge
importlib_metadata        4.11.4               hd8ed1ab_0    conda-forge
importlib_resources       5.9.0              pyhd8ed1ab_0    conda-forge
iniconfig                 1.1.1              pyh9f0ad1d_0    conda-forge
ipykernel                 6.15.3             pyh210e3f2_0    conda-forge
ipython                   8.5.0              pyh41d4057_1    conda-forge
ipywidgets                8.0.2              pyhd8ed1ab_1    conda-forge
jedi                      0.18.1             pyhd8ed1ab_2    conda-forge
jinja2                    3.1.2              pyhd8ed1ab_1    conda-forge
jpeg                      9e                   h166bdaf_2    conda-forge
jsonschema                4.16.0             pyhd8ed1ab_0    conda-forge
jupyter_client            7.3.5              pyhd8ed1ab_0    conda-forge
jupyter_core              4.11.1           py39hf3d152e_0    conda-forge
jupyterlab_widgets        3.0.3              pyhd8ed1ab_0    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
kiwisolver                1.4.4            py39hf939315_0    conda-forge
kombu                     5.2.4            py39hf3d152e_1    conda-forge
krb5                      1.19.3               h3790be6_0    conda-forge
lcms2                     2.12                 hddcbb42_0    conda-forge
ld_impl_linux-64          2.36.1               hea4e1c9_2    conda-forge
lerc                      4.0.0                h27087fc_0    conda-forge
libblas                   3.9.0           16_linux64_openblas    conda-forge
libbrotlicommon           1.0.9                h166bdaf_7    conda-forge
libbrotlidec              1.0.9                h166bdaf_7    conda-forge
libbrotlienc              1.0.9                h166bdaf_7    conda-forge
libcblas                  3.9.0           16_linux64_openblas    conda-forge
libcurl                   7.83.1               h7bff187_0    conda-forge
libdeflate                1.14                 h166bdaf_0    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libev                     4.33                 h516909a_1    conda-forge
libevent                  2.1.10               h9b69904_4    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 12.1.0              h8d9b700_16    conda-forge
libgfortran-ng            12.1.0              h69a702a_16    conda-forge
libgfortran5              12.1.0              hdcd56e2_16    conda-forge
libglib                   2.72.1               h2d90d5f_0    conda-forge
libgomp                   12.1.0              h8d9b700_16    conda-forge
libiconv                  1.16                 h516909a_0    conda-forge
liblapack                 3.9.0           16_linux64_openblas    conda-forge
libnetcdf                 4.8.1           nompi_h21705cb_104    conda-forge
libnghttp2                1.47.0               hdcd2b5c_1    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libopenblas               0.3.21          pthreads_h78a6416_3    conda-forge
libpng                    1.6.38               h753d276_0    conda-forge
libprotobuf               3.19.4               h780b84a_0    conda-forge
libsodium                 1.0.18               h36c2ea0_1    conda-forge
libsqlite                 3.39.3               h753d276_0    conda-forge
libssh2                   1.10.0               haa6b8db_3    conda-forge
libstdcxx-ng              12.1.0              ha89aaad_16    conda-forge
libthrift                 0.15.0               he6d91bd_1    conda-forge
libtiff                   4.4.0                h55922b4_4    conda-forge
libutf8proc               2.7.0                h7f98852_0    conda-forge
libuuid                   2.32.1            h7f98852_1000    conda-forge
libwebp-base              1.2.4                h166bdaf_0    conda-forge
libxcb                    1.13              h7f98852_1004    conda-forge
libxml2                   2.9.14               h22db469_4    conda-forge
libxslt                   1.1.35               h8affb1d_0    conda-forge
libzip                    1.9.2                hc869a4a_1    conda-forge
libzlib                   1.2.12               h166bdaf_3    conda-forge
lxml                      4.9.1            py39hb9d737c_0    conda-forge
lz4-c                     1.9.3                h9c3ff4c_1    conda-forge
lzo                       2.10              h516909a_1000    conda-forge
markupsafe                2.1.1            py39hb9d737c_1    conda-forge
matplotlib-base           3.6.0            py39hf9fd14e_0    conda-forge
matplotlib-inline         0.1.6              pyhd8ed1ab_0    conda-forge
mdtraj                    1.9.7            py39hc79b4f4_2    conda-forge
mmpbsa-py                 16.0                     pypi_0    pypi
msgpack-python            1.0.4            py39hf939315_0    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
nbformat                  5.5.0              pyhd8ed1ab_0    conda-forge
ncurses                   6.3                  h27087fc_1    conda-forge
ndcctools                 7.4.14           py39hbe13330_0    conda-forge
nest-asyncio              1.5.5              pyhd8ed1ab_0    conda-forge
netcdf-fortran            4.6.0           nompi_hc402ea5_100    conda-forge
networkx                  2.8.6              pyhd8ed1ab_0    conda-forge
nglview                   3.0.3              pyh8a188c0_0    conda-forge
nomkl                     1.0                  h5ca1d4c_0    conda-forge
numexpr                   2.8.3           py39h194a79d_100    conda-forge
numpy                     1.23.3           py39hba7629e_0    conda-forge
ocl-icd                   2.3.1                h7f98852_0    conda-forge
ocl-icd-system            1.0.0                         1    conda-forge
openeye-toolkits          2021.1.1                 py39_0    openeye
openff-bespokefit         0.1.1              pyhd8ed1ab_0    conda-forge
openff-forcefields        2.0.0              pyh6c4a22f_0    conda-forge
openff-fragmenter-base    0.1.2              pyhd8ed1ab_1    conda-forge
openff-qcsubmit           0.3.1+11.gd1ae421          pypi_0    pypi
openff-toolkit            0.10.6             pyhd8ed1ab_0    conda-forge
openff-toolkit-base       0.10.6             pyhd8ed1ab_0    conda-forge
openff-utilities          0.1.5              pyh6c4a22f_0    conda-forge
openjpeg                  2.5.0                h7d73246_1    conda-forge
openmm                    7.7.0            py39h15fbce5_1    conda-forge
openmmforcefields         0.11.1             pyhd8ed1ab_1    conda-forge
openssl                   1.1.1q               h166bdaf_0    conda-forge
orc                       1.7.1                h1be678f_1    conda-forge
packaging                 21.3               pyhd8ed1ab_0    conda-forge
packmol                   20.010               h86c2bf4_0    conda-forge
packmol-memgen            1.2.3rc0                 pypi_0    pypi
pandas                    1.4.4            py39h1832856_0    conda-forge
parmed                    3.4.3            py39h5a03fae_2    conda-forge
parquet-cpp               1.5.1                         2    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
pcre                      8.45                 h9c3ff4c_0    conda-forge
pdb4amber                 22.0                     pypi_0    pypi
perl                      5.32.1          2_h7f98852_perl5    conda-forge
pexpect                   4.8.0              pyh9f0ad1d_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    9.2.0            py39hd5dbb17_2    conda-forge
pint                      0.19.2             pyhd8ed1ab_0    conda-forge
pip                       22.2.2             pyhd8ed1ab_0    conda-forge
pixman                    0.40.0               h36c2ea0_0    conda-forge
pkgutil-resolve-name      1.3.10             pyhd8ed1ab_0    conda-forge
plotly                    5.10.0             pyhd8ed1ab_0    conda-forge
pluggy                    1.0.0            py39hf3d152e_3    conda-forge
prompt-toolkit            3.0.31             pyha770c72_0    conda-forge
prompt_toolkit            3.0.31               hd8ed1ab_0    conda-forge
psutil                    5.9.2            py39hb9d737c_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                        1.11.0             pyh6c4a22f_0    conda-forge
py-cpuinfo                8.0.0              pyhd8ed1ab_0    conda-forge
pyarrow                   6.0.1           py39hff6fa39_5_cpu    conda-forge
pycairo                   1.21.0           py39h0934665_1    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pydantic                  1.10.2           py39hb9d737c_0    conda-forge
pygments                  2.13.0             pyhd8ed1ab_0    conda-forge
pymbar                    3.1.0            py39hd257fcd_0    conda-forge
pyopenssl                 22.0.0             pyhd8ed1ab_0    conda-forge
pyparsing                 3.0.9              pyhd8ed1ab_0    conda-forge
pyrsistent                0.18.1           py39hb9d737c_1    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
pytables                  3.7.0            py39hee6f8ba_2    conda-forge
pytest                    7.1.3            py39hf3d152e_0    conda-forge
python                    3.9.13          h9a8a25e_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.16.1             pyhd8ed1ab_0    conda-forge
python_abi                3.9                      2_cp39    conda-forge
pytraj                    2.0.6                    pypi_0    pypi
pytz                      2022.2.1           pyhd8ed1ab_0    conda-forge
pyyaml                    6.0              py39hb9d737c_4    conda-forge
pyzmq                     24.0.0           py39headdf64_0    conda-forge
qcelemental               0.25.0             pyhd8ed1ab_0    conda-forge
qcengine                  0.24.1             pyhd8ed1ab_0    conda-forge
qcportal                  0.15.8             pyhd8ed1ab_0    conda-forge
rdkit                     2022.03.5        py39h89e00b9_0    conda-forge
re2                       2021.11.01           h9c3ff4c_0    conda-forge
readline                  8.1.2                h0f457ee_0    conda-forge
redis-py                  4.3.4              pyhd8ed1ab_0    conda-forge
redis-server              7.0.0                h8d01263_0    conda-forge
regex                     2022.9.13        py39hb9d737c_0    conda-forge
reportlab                 3.5.68           py39he59360d_1    conda-forge
requests                  2.28.1             pyhd8ed1ab_1    conda-forge
rfc3986                   1.5.0              pyhd8ed1ab_0    conda-forge
rich                      12.5.1             pyhd8ed1ab_0    conda-forge
s2n                       1.3.0                h9b69904_0    conda-forge
sander                    22.0                     pypi_0    pypi
scipy                     1.9.1            py39h8ba3f38_0    conda-forge
setuptools                65.3.0             pyhd8ed1ab_1    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
smirnoff99frosst          1.1.0              pyh44b312d_0    conda-forge
snappy                    1.1.9                hbd366e4_1    conda-forge
sniffio                   1.3.0              pyhd8ed1ab_0    conda-forge
sqlalchemy                1.4.41           py39hb9d737c_0    conda-forge
sqlite                    3.39.3               h4ff8645_0    conda-forge
stack_data                0.5.0              pyhd8ed1ab_0    conda-forge
starlette                 0.20.4             pyhd8ed1ab_0    conda-forge
tenacity                  8.0.1              pyhd8ed1ab_0    conda-forge
tinydb                    4.7.0              pyhd8ed1ab_0    conda-forge
tk                        8.6.12               h27826a3_0    conda-forge
tomli                     2.0.1              pyhd8ed1ab_0    conda-forge
tornado                   6.2              py39hb9d737c_0    conda-forge
torsiondrive              1.1.0              pyhd8ed1ab_0    conda-forge
tqdm                      4.64.1             pyhd8ed1ab_0    conda-forge
traitlets                 5.4.0              pyhd8ed1ab_0    conda-forge
typing-extensions         4.3.0                hd8ed1ab_0    conda-forge
typing_extensions         4.3.0              pyha770c72_0    conda-forge
tzdata                    2022c                h191b570_0    conda-forge
unicodedata2              14.0.0           py39hb9d737c_1    conda-forge
urllib3                   1.26.11            pyhd8ed1ab_0    conda-forge
uvicorn                   0.18.3           py39hf3d152e_0    conda-forge
validators                0.18.2             pyhd3deb0d_0    conda-forge
vine                      5.0.0              pyhd8ed1ab_1    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
widgetsnbextension        4.0.3              pyhd8ed1ab_0    conda-forge
wrapt                     1.14.1           py39hb9d737c_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.7.2                h7f98852_0    conda-forge
xorg-libxau               1.0.9                h7f98852_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xorg-libxext              1.3.4                h7f98852_1    conda-forge
xorg-libxrender           0.9.10            h7f98852_1003    conda-forge
xorg-libxt                1.2.1                h7f98852_2    conda-forge
xorg-renderproto          0.11.1            h7f98852_1002    conda-forge
xorg-xextproto            7.3.0             h7f98852_1002    conda-forge
xorg-xproto               7.0.31            h7f98852_1007    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
yaml                      0.2.5                h7f98852_2    conda-forge
zeromq                    4.3.4                h9c3ff4c_1    conda-forge
zipp                      3.8.1              pyhd8ed1ab_0    conda-forge
zlib                      1.2.12               h166bdaf_3    conda-forge
zstd                      1.5.2                h6239696_4    conda-forge
@pavankum
Copy link
Member

To add to the list, similar issue with Nitro groups, C1=CC=C(C=C1)[N+](=O)[O-] , t81 and t83 get assigned to the two oxygens.

SMILES [H:10][c:1]1[c:2]([c:3]([c:4]([c:5]([c:6]1[H:14])[H:13])[N+:7](=[O:8])[O-:9])[H:12])[H:11]
 3  4  7  8 t83  [*:1]=[#7X2,#7X3+1:2]-[#6X3:3]=,:[*:4]
 5  4  7  8 t83  [*:1]=[#7X2,#7X3+1:2]-[#6X3:3]=,:[*:4]
 3  4  7  9 t81  [#8X1:1]~[#7X3:2]~[#6X3:3]~[*:4]
 5  4  7  9 t81  [#8X1:1]~[#7X3:2]~[#6X3:3]~[*:4]

@mattwthompson
Copy link
Member

Whatever's going on, I can verify it's not due to recent changes in the toolkit. The reproduction behaves the same back to 0.9.0 and modifying it to the openforcefield imports allows going as far back as Sage can be loaded. All versions assign t17 and t18 to the carboxylate like above.

@pavankum
Copy link
Member

@mattwthompson Yeah, it's not toolkit related, it's from the smarts definition of applied parameters distinguishing single and double bonds.

@pavankum
Copy link
Member

Copying from slack discussion: introducing new parameters t18a, t83a, t87a, which would explicitly match these cases can be a potential workaround.

<Proper smirks="[*:1]-[#6X4:2]-[#6X3:3](~[#8X1])~[#8X1:4]" periodicity1="2" phase1="0.0 * degree" id="t18a" k1="-0.3703352413219 * mole**-1 * kilocalorie" idivf1="1.0"></Proper>

<Proper smirks="[#8X1:1]~[#7X3:2](~[#8X1])-[#6:3]~[*:4]" periodicity1="2" phase1="180.0 * degree" id="t83a" k1="1.550515418264 * mole**-1 * kilocalorie" idivf1="1.0"></Proper>

<Proper smirks="[*:1]-[#7X3:2]~[#6X3:3](~[#7])~[#7:4]" periodicity1="2" phase1="180.0 * degree" id="t87a" k1="3.337310191161 * mole**-1 * kilocalorie" idivf1="1.0"></Proper>

@chapincavender
Copy link
Contributor Author

Following up on some suggestions from Chris Bayly, it looks like phosphate esters and sulfate esters are assigned correctly because there is only one torsion SMIRKS that matches them. The nitrogen torsions in the amidinium cation are assigned incorrectly.

from openff.toolkit.topology import Molecule
from openff.toolkit.typing.engines.smirnoff import ForceField

ff = ForceField('openff-2.0.0.offxml')
offmol = Molecule.from_smiles('CCCC(=[NH2+])N')
labels = ff.label_molecules(offmol.to_topology())[0]
torsion_label = labels['ProperTorsions']

print(f'SMILES {offmol.to_smiles(mapped=True)}')

torsion_smirks = '[#6:1]-[#6:2]-[#6:3]~[#7:4]'
for match in offmol.chemical_environment_matches(torsion_smirks):

    if match in torsion_label:
        parameter = torsion_label[match]
    else:
        parameter = torsion_label[match[::-1]]

    print(
        f'{match[0]+1:2d} {match[1]+1:2d} {match[2]+1:2d} {match[3]+1:2d} '
        f'{parameter.id:4s} {parameter.smirks}'
    )

produces

SMILES [H:7][C:1]([H:8])([H:9])[C:2]([H:10])([H:11])[C:3]([H:12])([H:13])[C:4](=[N+:5]([H:14])[H:15])[N:6]([H:16])[H:17]
 2  3  4  5 t18  [*:1]-[#6X4:2]-[#6X3:3]=[*:4]
 2  3  4  6 t23  [#6X4:1]-[#6X4:2]-[#6X3:3]-[#7X3:4]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants