Skip to content
New issue

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

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

Already on GitHub? # to your account

Not being able to load the 2.1.0 forcefield file #1635

Closed
ijpulidos opened this issue Jun 9, 2023 · 12 comments
Closed

Not being able to load the 2.1.0 forcefield file #1635

ijpulidos opened this issue Jun 9, 2023 · 12 comments

Comments

@ijpulidos
Copy link
Collaborator

ijpulidos commented Jun 9, 2023

Describe the bug
I noticed that the latest release (0.13.1) is having errors with loading the 2.1.0 forcefield release. The same happens with 2.1.0.rc-1.

Even though the files exist in the directory

❯ ls /home/user/miniconda3/envs/openff-ffs-test/lib/python3.10/site-packages/openforcefields/offxml
opc-1.0.0.offxml         openff-1.2.0.offxml          openff-2.1.0.offxml                    openff_unconstrained-1.2.0.offxml          openff_unconstrained-2.1.0.offxml
opc.offxml               openff-1.2.1.offxml          openff-2.1.0-rc.1.offxml               openff_unconstrained-1.2.1.offxml          openff_unconstrained-2.1.0-rc.1.offxml
openff-1.0.0.offxml      openff-1.3.0.offxml          openff_unconstrained-1.0.0.offxml      openff_unconstrained-1.3.0.offxml          README.md
openff-1.0.0-RC1.offxml  openff-1.3.1-alpha.1.offxml  openff_unconstrained-1.0.0-RC1.offxml  openff_unconstrained-1.3.1-alpha.1.offxml  tip3p-1.0.0.offxml
openff-1.0.0-RC2.offxml  openff-1.3.1.offxml          openff_unconstrained-1.0.0-RC2.offxml  openff_unconstrained-1.3.1.offxml          tip3p_fb-1.0.0.offxml
openff-1.0.1.offxml      openff-2.0.0.offxml          openff_unconstrained-1.0.1.offxml      openff_unconstrained-2.0.0.offxml          tip3p_fb.offxml
openff-1.1.0.offxml      openff-2.0.0-rc.1.offxml     openff_unconstrained-1.1.0.offxml      openff_unconstrained-2.0.0-rc.1.offxml     tip3p.offxml
openff-1.1.1.offxml      openff-2.0.0-rc.2.offxml     openff_unconstrained-1.1.1.offxml      openff_unconstrained-2.0.0-rc.2.offxml

To Reproduce

In [1]: from openff.toolkit import ForceField

In [2]: force_field = ForceField('openff-2.1.0.offxml')

Output

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
Cell In[2], line 1
----> 1 force_field = ForceField('openff-2.1.0.offxml')

File ~/miniconda3/envs/openff-ffs-test/lib/python3.10/site-packages/openff/toolkit/typing/engines/smirnoff/forcefield.py:334, in ForceField.__init__(self, aromaticity_model, parameter_handler_classes, parameter_io_handler_classes, disable_version_check, allow_cosmetic_attributes, load_plugins, *sources)
    331 self._register_parameter_io_handler_classes(parameter_io_handler_classes)
    333 # Parse all sources containing SMIRNOFF parameter definitions
--> 334 self.parse_sources(sources, allow_cosmetic_attributes=allow_cosmetic_attributes)

File ~/miniconda3/envs/openff-ffs-test/lib/python3.10/site-packages/openff/toolkit/typing/engines/smirnoff/forcefield.py:797, in ForceField.parse_sources(self, sources, allow_cosmetic_attributes)
    795 for source in sources:
    796     smirnoff_data = self.parse_smirnoff_from_source(source)
--> 797     self._load_smirnoff_data(
    798         smirnoff_data, allow_cosmetic_attributes=allow_cosmetic_attributes
    799     )

File ~/miniconda3/envs/openff-ffs-test/lib/python3.10/site-packages/openff/toolkit/typing/engines/smirnoff/forcefield.py:908, in ForceField._load_smirnoff_data(self, smirnoff_data, allow_cosmetic_attributes)
    905     self._add_date(smirnoff_data["SMIRNOFF"]["Date"])
    907 # Go through the whole SMIRNOFF data structure, trying to convert all strings to Quantity
--> 908 smirnoff_data = convert_all_strings_to_quantity(
    909     smirnoff_data,
    910     ignore_keys=["smirks", "name"],
    911 )
    913 # Go through the subsections, delegating each to the proper ParameterHandler
    914 
    915 # Define keys which are expected from the spec, but are not parameter sections
    916 l1_spec_keys = ["Author", "Date", "version", "aromaticity_model"]

File ~/miniconda3/envs/openff-ffs-test/lib/python3.10/site-packages/openff/toolkit/utils/utils.py:241, in convert_all_strings_to_quantity(smirnoff_data, ignore_keys)
    239             smirnoff_data[key] = value
    240         else:
--> 241             smirnoff_data[key] = convert_all_strings_to_quantity(
    242                 value,
    243                 ignore_keys=ignore_keys,
    244             )
    245     obj_to_return = smirnoff_data
    247 elif isinstance(smirnoff_data, list):

File ~/miniconda3/envs/openff-ffs-test/lib/python3.10/site-packages/openff/toolkit/utils/utils.py:241, in convert_all_strings_to_quantity(smirnoff_data, ignore_keys)
    239             smirnoff_data[key] = value
    240         else:
--> 241             smirnoff_data[key] = convert_all_strings_to_quantity(
    242                 value,
    243                 ignore_keys=ignore_keys,
    244             )
    245     obj_to_return = smirnoff_data
    247 elif isinstance(smirnoff_data, list):

File ~/miniconda3/envs/openff-ffs-test/lib/python3.10/site-packages/openff/toolkit/utils/utils.py:241, in convert_all_strings_to_quantity(smirnoff_data, ignore_keys)
    239             smirnoff_data[key] = value
    240         else:
--> 241             smirnoff_data[key] = convert_all_strings_to_quantity(
    242                 value,
    243                 ignore_keys=ignore_keys,
    244             )
    245     obj_to_return = smirnoff_data
    247 elif isinstance(smirnoff_data, list):

File ~/miniconda3/envs/openff-ffs-test/lib/python3.10/site-packages/openff/toolkit/utils/utils.py:249, in convert_all_strings_to_quantity(smirnoff_data, ignore_keys)
    247 elif isinstance(smirnoff_data, list):
    248     for index, item in enumerate(smirnoff_data):
--> 249         smirnoff_data[index] = convert_all_strings_to_quantity(
    250             item,
    251             ignore_keys=ignore_keys,
    252         )
    253     obj_to_return = smirnoff_data
    255 elif isinstance(smirnoff_data, int) or isinstance(smirnoff_data, float):

File ~/miniconda3/envs/openff-ffs-test/lib/python3.10/site-packages/openff/toolkit/utils/utils.py:241, in convert_all_strings_to_quantity(smirnoff_data, ignore_keys)
    239             smirnoff_data[key] = value
    240         else:
--> 241             smirnoff_data[key] = convert_all_strings_to_quantity(
    242                 value,
    243                 ignore_keys=ignore_keys,
    244             )
    245     obj_to_return = smirnoff_data
    247 elif isinstance(smirnoff_data, list):

File ~/miniconda3/envs/openff-ffs-test/lib/python3.10/site-packages/openff/toolkit/utils/utils.py:260, in convert_all_strings_to_quantity(smirnoff_data, ignore_keys)
    258 else:
    259     try:
--> 260         obj_to_return = object_to_quantity(smirnoff_data)
    261     except (TypeError, DefinitionSyntaxError):
    262         obj_to_return = smirnoff_data

File ~/miniconda3/envs/openff-ffs-test/lib/python3.10/functools.py:889, in singledispatch.<locals>.wrapper(*args, **kw)
    885 if not args:
    886     raise TypeError(f'{funcname} requires at least '
    887                     '1 positional argument')
--> 889 return dispatch(args[0].__class__)(*args, **kw)

File ~/miniconda3/envs/openff-ffs-test/lib/python3.10/site-packages/openff/toolkit/utils/utils.py:332, in _(obj)
    329 import pint
    331 try:
--> 332     return string_to_quantity(obj)
    333 except pint.errors.UndefinedUnitError:
    334     raise ValueError

File ~/miniconda3/envs/openff-ffs-test/lib/python3.10/site-packages/openff/toolkit/utils/utils.py:198, in string_to_quantity(quantity_string)
    195 from pint import UndefinedUnitError
    197 try:
--> 198     quantity = unit.Quantity(quantity_string)
    199 except (TokenError, UndefinedUnitError):
    200     return quantity_string

File ~/miniconda3/envs/openff-ffs-test/lib/python3.10/site-packages/pint/facets/plain/quantity.py:200, in PlainQuantity.__new__(cls, value, units)
    198 if units is None and isinstance(value, str):
    199     ureg = SharedRegistryObject.__new__(cls)._REGISTRY
--> 200     inst = ureg.parse_expression(value)
    201     return cls.__new__(cls, inst)
    203 if units is None and isinstance(value, cls):

File ~/miniconda3/envs/openff-ffs-test/lib/python3.10/site-packages/pint/facets/plain/registry.py:1309, in GenericPlainRegistry.parse_expression(self, input_string, case_sensitive, **values)
   1306 def _define_op(s: str):
   1307     return self._eval_token(s, case_sensitive=case_sensitive, **values)
-> 1309 return build_eval_tree(gen).evaluate(_define_op)

File ~/miniconda3/envs/openff-ffs-test/lib/python3.10/site-packages/pint/pint_eval.py:329, in build_eval_tree(tokens, op_priority)
    325 if not isinstance(tokens, list):
    326     # ensure tokens is list so we can access by index
    327     tokens = list(tokens)
--> 329 result, _ = _build_eval_tree(tokens, op_priority, 0, 0)
    331 return result

File ~/miniconda3/envs/openff-ffs-test/lib/python3.10/site-packages/pint/pint_eval.py:246, in _build_eval_tree(tokens, op_priority, index, depth, prev_op)
    244         return result, index - 1
    245     # get right side of binary op
--> 246     right, index = _build_eval_tree(
    247         tokens, op_priority, index + 1, depth + 1, token_text
    248     )
    249     result = EvalTreeNode(
    250         left=result, operator=current_token, right=right
    251     )
    252 else:
    253     # unary operator

File ~/miniconda3/envs/openff-ffs-test/lib/python3.10/site-packages/pint/pint_eval.py:278, in _build_eval_tree(tokens, op_priority, index, depth, prev_op)
    275     raise DefinitionSyntaxError("unclosed parentheses in tokens")
    276 if depth > 0 or prev_op:
    277     # have to close recursion
--> 278     assert result is not None
    279     return result, index
    280 else:
    281     # recursion all closed, so just return the final result

AssertionError: 

Computing environment (please complete the following information):

  • Operating system: Linux (ArchLinux 64 bits)
  • Freshly created environment with mamba create -n openff-ffs-test -c conda-forge openff-forcefields openmmforcefields
  • Output of running conda list
conda list
# packages in environment at /home/ijpulidos/miniconda3/envs/openff-ffs-test:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
ambertools                23.0            py310he275f01_1    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
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
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                h7f98852_4    conda-forge
c-ares                    1.19.1               hd590300_0    conda-forge
c-blosc2                  2.9.2                hb4ffafa_0    conda-forge
ca-certificates           2023.5.7             hbcca054_0    conda-forge
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
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
edgembar                  0.2                      pypi_0    pypi
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_107    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.39.4          py310h2372a71_0    conda-forge
freetype                  2.12.1               hca18f0e_1    conda-forge
gettext                   0.21.1               h27087fc_0    conda-forge
greenlet                  2.0.2           py310hc6cd4ac_1    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
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.40                 h41732ed_0    conda-forge
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.2                h7f98852_5    conda-forge
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_hdf9a29f_104    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.10.4               hfdac1af_0    conda-forge
libxslt                   1.1.37               h873f0b0_0    conda-forge
libzip                    1.9.2                hc929e4a_1    conda-forge
libzlib                   1.2.13               h166bdaf_4    conda-forge
lxml                      4.9.2           py310hbdc0903_0    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
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.4.0              pyhd8ed1ab_0    conda-forge
nbconvert-core            7.4.0              pyhd8ed1ab_0    conda-forge
nbconvert-pandoc          7.4.0              pyhd8ed1ab_0    conda-forge
nbformat                  5.9.0              pyhd8ed1ab_0    conda-forge
ncurses                   6.4                  hcb278e6_0    conda-forge
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
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_1    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_1    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            2023.2.24                pypi_0    pypi
pandas                    2.0.2           py310h7cbd5c2_0    conda-forge
pandoc                    2.19.2               h32600fe_2    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
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.22               pyhd8ed1ab_1    conda-forge
pip                       23.1.2             pyhd8ed1ab_0    conda-forge
pixman                    0.40.0               h36c2ea0_0    conda-forge
pkgutil-resolve-name      1.3.10             pyhd8ed1ab_0    conda-forge
platformdirs              3.5.1              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.8          py310h2372a71_0    conda-forge
pyedr                     0.7.1              pyhd8ed1ab_0    conda-forge
pygments                  2.15.1             pyhd8ed1ab_0    conda-forge
pymsmt                    22.0                     pypi_0    pypi
pyparsing                 3.0.9              pyhd8ed1ab_0    conda-forge
pyrsistent                0.19.3          py310h1fa729e_0    conda-forge
pysocks                   1.7.1           py310hff52083_5    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                  h8228510_1    conda-forge
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.7.2             pyhd8ed1ab_0    conda-forge
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.15          py310h2372a71_0    conda-forge
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.7.1              pyhd8ed1ab_0    conda-forge
tk                        8.6.12               h27826a3_0    conda-forge
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                h71feb2d_0    conda-forge
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.2              pyhd8ed1ab_0    conda-forge
wheel                     0.40.0             pyhd8ed1ab_0    conda-forge
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.4                h8ee46fc_1    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
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.15.0             pyhd8ed1ab_0    conda-forge
zlib                      1.2.13               h166bdaf_4    conda-forge
zlib-ng                   2.0.7                h0b41bf4_0    conda-forge
zstd                      1.5.2                h3eb15da_6    conda-forge

Additional context

@ijpulidos ijpulidos changed the title Not being able to load the forcefield file Not being able to load the 2.1.0 forcefield file Jun 9, 2023
@ijpulidos
Copy link
Collaborator Author

Just in case it helps, loading the previous 2.0.0 or 1.3.1 versions work fine.

@pavankum
Copy link
Member

pavankum commented Jun 9, 2023

It was loading fine for me on Linux with toolkit version 0.13.1, pint 0.21, and openff-forcefields 2023.05.1.

@pavankum
Copy link
Member

pavankum commented Jun 9, 2023

@ijpulidos might be related to #1632 but the toolkit packages were upgraded so it shouldn't pull 0.22 now.

@j-wags
Copy link
Member

j-wags commented Jun 9, 2023

@ijpulidos Could you try again after downgrading pint=0.21?

Just in case it helps, loading the previous 2.0.0 or 1.3.1 versions work fine.

This is new to me. I'd initially thought this was related to #1632 but maybe it's something new.

@j-wags
Copy link
Member

j-wags commented Jun 9, 2023

I'm able to reproduce this error with OFFTK 0.13.1 and pint 0.22 running ForceField('openff-2.1.0.offxml'), and the problem goes away when I downgrade to pint 0.21

@mattwthompson
Copy link
Member

I can't reproduce this now that the one-liner pulls down Pint 0.21.

Forcing Pint 0.22 and applying the below patch shows that it's choking on trying to convert the LibraryChargeType.id strings into units

diff --git a/openff/toolkit/utils/utils.py b/openff/toolkit/utils/utils.py
index c3542c8e..36837b93 100644
--- a/openff/toolkit/utils/utils.py
+++ b/openff/toolkit/utils/utils.py
@@ -198,6 +198,9 @@ def string_to_quantity(quantity_string) -> Union[str, int, float, unit.Quantity]
         quantity = unit.Quantity(quantity_string)
     except (TokenError, UndefinedUnitError):
         return quantity_string
+    except AssertionError:
+        print(quantity_string)
+        return quantity_string
 
     # TODO: Should intentionally unitless array-likes be Quantity objects
     #       or their raw representation?
$ python -c "from openff.toolkit import ForceField; ForceField('openff-2.1.0.offxml')"
Li+
Na+
K+
Rb+
Cs+
F-
Cl-
Br-
I-

This is reminiscent of #1633 though the behavior is different; parsing something into an object when it should remain a string is different than throwing an exception.

Here is a more direct reproduction of the fundamental issue:

from pint import __version__, UnitRegistry

print(__version__)
# 0.22

unit = UnitRegistry()

for ion in [
    "Li+",
    "Na+",
    "K+",
    "Rb+",
    "Cs+",
    "F-",
    "Cl-",
    "Br-",
    "I-",
]:
    try:
        unit.Quantity(ion)
    except AssertionError:
        pass

    # raises no other exception

#1640 fixes this, but more robust parsing logic than blindly chucking strings to unit.Quantity should be considered for long-term sustainability.

@mattwthompson
Copy link
Member

Oh, and for why 2.0.0 was loadable and 2.1.0 was not:

$ diff openff-2.0.0.offxml openff-2.1.0.offxml | grep Cs
<         <LibraryCharge smirks="[#55+1:1]" charge1="1.0 * elementary_charge" name="Cs+"></LibraryCharge>
>         <LibraryCharge smirks="[#55+1:1]" charge1="1.0 * elementary_charge" id="Cs+"></LibraryCharge>

mattwthompson added a commit that referenced this issue Jun 14, 2023
* Minimal fix for #1635 and #1633

* Pluck a test

Co-authored-by: Lily Wang <31115101+lilyminium@users.noreply.github.com>

* Be extra safe testing loading of Sage 2.1

* Update release history

---------

Co-authored-by: Lily Wang <31115101+lilyminium@users.noreply.github.com>
@mattwthompson
Copy link
Member

This should be resolved via #1640 in the next release (probably 0.13.2, no planned date). The fix was somewhat superficial and a deeper fix may happen in the future. But for now, it should work okay.

I'd like to explicitly thank @ijpulidos for providing such a thorough bug report. For mysterious behaviors that seems like regressions, the more tea leaves to read the better, and this one came with tons of useful information. Thanks!

@pavankum
Copy link
Member

Oh, and for why 2.0.0 was loadable and 2.1.0 was not:

$ diff openff-2.0.0.offxml openff-2.1.0.offxml | grep Cs
<         <LibraryCharge smirks="[#55+1:1]" charge1="1.0 * elementary_charge" name="Cs+"></LibraryCharge>
>         <LibraryCharge smirks="[#55+1:1]" charge1="1.0 * elementary_charge" id="Cs+"></LibraryCharge>

I tried to track this down and I think the change happened when I got a FF with delocalized smirks patterns from @chapincavender , I don't know if this is a change in toolkit itself or a custom function to write library charges. Any idea if this would be an issue for other downstream users who parse our FF directly without toolkit?

@mattwthompson
Copy link
Member

It shouldn't be, but there's really no way to control others' solutions.

I posted that only to help diagnose the issue - there was no obvious reason why 2.0 and 2.1 would be parsed differently. I'm not advocating for that to be changed.

@chapincavender
Copy link

This is a change I made to the LibraryCharge section when I added the library charges for amino acids, so it's not a change in toolkit parsing. The entries for TIP3P library charges used id, while the entries for ion library charges used name, so I standardized them to all use id. Although 2.1 doesn't use the amino acid library charges, I think it inherited this change along with the delocalize charge parameters.

@j-wags
Copy link
Member

j-wags commented Jun 15, 2023

I think you made the right call there, Chapin. I've looked at the openff-2.0.0 offxmls dozens of times and never noticed the inconsistency in use of LibraryCharge id/name. I agree with the decision to put all the identifiers into the id field.

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

No branches or pull requests

5 participants