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

LAMMPS writer can't export TIP3P water with constraints #1141

Open
timbernat opened this issue Jan 15, 2025 · 6 comments
Open

LAMMPS writer can't export TIP3P water with constraints #1141

timbernat opened this issue Jan 15, 2025 · 6 comments
Assignees
Labels
bug Something isn't working feedback needed Could use feedback from users lammps Relating to LAMMPS needs-info Needs more information from user(s)

Comments

@timbernat
Copy link
Contributor

timbernat commented Jan 15, 2025

Description
Interchange instances created from a Topology containing any number of water molecules (including just 1) and from the SMIRNOFF TIP3P force field cannot be written to LAMMPS input/data files using Interchange.to_lammps(), "citing unsupported constraints in the LAMMPS writer".

Incidentally (unless I've misunderstood what's going on), Interchange creation does NOT use TIP3P library charges supplied by the FF, but rather assigns explicit AM1-BCC charges. This is evidenced by the telltale Warning: Cannot perform Hydrogen sampling with GPU-Omega: GPU-Omega disabled. log message generated by the OpenEye charge model when calling ForceField.create_interchange(...). Resolved in #1144

Reproduction

from openff.toolkit import Molecule, ForceField


offmol = Molecule.from_smiles('O')
offmol.generate_conformers(n_conformers=1)

ff = ForceField('tip3p.offxml')
inc = ff.create_interchange(offmol.to_topology())

inc.to_lammps(prefix='water')

Output

---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Cell In[2], line 10
      7 ff = ForceField('tip3p.offxml')
      8 inc = ff.create_interchange(offmol.to_topology())
---> 10 inc.to_lammps(prefix='water')

File ~/miniconda3/envs/nrel-polymers/lib/python3.11/site-packages/openff/interchange/components/interchange.py:474, in Interchange.to_lammps(self, prefix)
    472 datafile_path = prefix + ".lmp"
    473 self.to_lammps_datafile(datafile_path)
--> 474 self.to_lammps_input(
    475     prefix + "_pointenergy.in",
    476     datafile_path,
    477 )

File ~/miniconda3/envs/nrel-polymers/lib/python3.11/site-packages/openff/interchange/components/interchange.py:511, in Interchange.to_lammps_input(self, file_path, data_file)
    508     data_file = Path(file_path).with_suffix(".lmp")
    510 mdconfig = MDConfig.from_interchange(self)
--> 511 mdconfig.write_lammps_input(self, str(file_path), data_file=str(data_file))

File ~/miniconda3/envs/nrel-polymers/lib/python3.11/site-packages/openff/interchange/components/mdconfig.py:271, in MDConfig.write_lammps_input(self, interchange, input_file, data_file)
    250     return (
    251         {
    252             key
   (...)
    264         },
    265     )
    267 # zero-indexed here
    268 (
    269     constrained_bond_coeffs,
    270     constrained_angle_coeffs,
--> 271 ) = _get_coeffs_of_constrained_bonds_and_angles(interchange)
    273 # Construct the input file in memory so nothing is written to disk if an
    274 # error is encountered.
    275 with StringIO() as lmp:

File ~/miniconda3/envs/nrel-polymers/lib/python3.11/site-packages/openff/interchange/components/mdconfig.py:238, in MDConfig.write_lammps_input.<locals>._get_coeffs_of_constrained_bonds_and_angles(interchange)
    235 constraint_styles = {key.associated_handler for key in interchange["Constraints"].potentials}
    237 if len(constraint_styles.difference({"Bonds", "Angles"})) > 0:
--> 238     raise NotImplementedError(
    239         "Found unsupported constraints case in LAMMPS input writer.",
    240     )
    242 constrained_bond_smirks = {
    243     key.id for key in interchange["Constraints"].potentials if key.associated_handler == "Bonds"
    244 }
    246 constrained_angle_smirks = {
    247     key.id for key in interchange["Constraints"].potentials if key.associated_handler == "Angles"
    248 }

NotImplementedError: Found unsupported constraints case in LAMMPS input writer.

Software versions

  • OS: Ubuntu 20.04.6 LTS
  • Interchange installed via mamba. Using openff.interchange 0.4.0 and openff.toolkit 0.16.7, running Python 3.11.11
  • Output of conda list:
# packages in environment at /home/timber/miniconda3/envs/nrel-polymers:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
absl-py                   2.1.0              pyhd8ed1ab_1    conda-forge
ambertools                23.3            py311h9fea076_6    conda-forge
amberutils                21.0                     pypi_0    pypi
annotated-types           0.7.0              pyhd8ed1ab_1    conda-forge
anyio                     4.8.0              pyhd8ed1ab_0    conda-forge
anytree                   2.12.1                   pypi_0    pypi
argon2-cffi               23.1.0             pyhd8ed1ab_1    conda-forge
argon2-cffi-bindings      21.2.0          py311h9ecbd09_5    conda-forge
arpack                    3.8.0           nompi_h0baa96a_101    conda-forge
arrow                     1.3.0              pyhd8ed1ab_1    conda-forge
asttokens                 3.0.0              pyhd8ed1ab_1    conda-forge
astunparse                1.6.3              pyhd8ed1ab_3    conda-forge
async-lru                 2.0.4              pyhd8ed1ab_1    conda-forge
attr                      2.5.1                h166bdaf_1    conda-forge
attrs                     24.3.0             pyh71513ae_0    conda-forge
aws-c-auth                0.7.31               h57bd9a3_0    conda-forge
aws-c-cal                 0.7.4                hfd43aa1_1    conda-forge
aws-c-common              0.9.28               hb9d3cd8_0    conda-forge
aws-c-compression         0.2.19               h756ea98_1    conda-forge
aws-c-event-stream        0.4.3                h29ce20c_2    conda-forge
aws-c-http                0.8.10               h5e77a74_0    conda-forge
aws-c-io                  0.14.18             h2af50b2_12    conda-forge
aws-c-mqtt                0.10.7               h02abb05_0    conda-forge
aws-c-s3                  0.6.6                h834ce55_0    conda-forge
aws-c-sdkutils            0.1.19               h756ea98_3    conda-forge
aws-checksums             0.1.20               h756ea98_0    conda-forge
aws-crt-cpp               0.28.3               h3e6eb3e_6    conda-forge
aws-sdk-cpp               1.11.379            h9f1560d_11    conda-forge
babel                     2.16.0             pyhd8ed1ab_1    conda-forge
beautifulsoup4            4.12.3             pyha770c72_1    conda-forge
bleach                    6.2.0              pyhd8ed1ab_3    conda-forge
bleach-with-css           6.2.0                hd8ed1ab_3    conda-forge
blosc                     1.21.6               hef167b5_0    conda-forge
boltons                   24.0.0             pyhd8ed1ab_1    conda-forge
brotli                    1.1.0                hb9d3cd8_2    conda-forge
brotli-bin                1.1.0                hb9d3cd8_2    conda-forge
brotli-python             1.1.0           py311hfdbb021_2    conda-forge
bson                      0.5.9              pyhd8ed1ab_1    conda-forge
bzip2                     1.0.8                h4bc722e_7    conda-forge
c-ares                    1.34.4               hb9d3cd8_0    conda-forge
c-blosc2                  2.15.2               h68e2383_0    conda-forge
ca-certificates           2024.12.14           hbcca054_0    conda-forge
cached-property           1.5.2                hd8ed1ab_1    conda-forge
cached_property           1.5.2              pyha770c72_1    conda-forge
cachetools                5.5.0              pyhd8ed1ab_1    conda-forge
cairo                     1.18.0               hbb29018_2    conda-forge
certifi                   2024.12.14         pyhd8ed1ab_0    conda-forge
cffi                      1.17.1          py311hf29c0ef_0    conda-forge
cftime                    1.6.4.post1              pypi_0    pypi
chardet                   5.2.0           py311h38be061_2    conda-forge
charset-normalizer        3.4.1              pyhd8ed1ab_0    conda-forge
chemspipy                 2.0.0                    pypi_0    pypi
cirpy                     1.0.2                    pypi_0    pypi
click                     8.1.8              pyh707e725_0    conda-forge
click-option-group        0.5.6              pyhd8ed1ab_0    conda-forge
cloudpickle               3.1.0              pyhd8ed1ab_2    conda-forge
colorama                  0.4.6              pyhd8ed1ab_1    conda-forge
comm                      0.2.2              pyhd8ed1ab_1    conda-forge
contourpy                 1.3.1           py311hd18a35c_0    conda-forge
cpython                   3.11.11         py311hd8ed1ab_1    conda-forge
cudatoolkit               11.8.0              h4ba93d1_13    conda-forge
cycler                    0.12.1             pyhd8ed1ab_1    conda-forge
cytoolz                   1.0.1           py311h9ecbd09_0    conda-forge
dask-core                 2024.12.1          pyhd8ed1ab_0    conda-forge
dask-jobqueue             0.9.0              pyhd8ed1ab_0    conda-forge
debugpy                   1.8.11          py311hfdbb021_0    conda-forge
decorator                 5.1.1              pyhd8ed1ab_1    conda-forge
defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
deprecation               2.1.0              pyh9f0ad1d_0    conda-forge
dgl                       2.1.0           py311h1772aec_2    conda-forge
distributed               2024.12.1          pyhd8ed1ab_0    conda-forge
edgembar                  0.2                      pypi_0    pypi
ele                       0.2.0              pyhd8ed1ab_0    conda-forge
entrypoints               0.4                pyhd8ed1ab_1    conda-forge
espaloma_charge           0.0.8              pyhd8ed1ab_1    conda-forge
exceptiongroup            1.2.2              pyhd8ed1ab_1    conda-forge
executing                 2.1.0              pyhd8ed1ab_1    conda-forge
fftw                      3.3.10          nompi_hf1063bd_110    conda-forge
filelock                  3.16.1             pyhd8ed1ab_1    conda-forge
flatbuffers               24.3.25              h59595ed_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                 h77eed37_3    conda-forge
fontconfig                2.15.0               h7e30c49_1    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
fonttools                 4.55.3          py311h2dc5d0c_1    conda-forge
forcefield-utilities      0.3.0              pyhd8ed1ab_0    conda-forge
foyer                     1.0.0              pyhd8ed1ab_0    conda-forge
fqdn                      1.5.1              pyhd8ed1ab_1    conda-forge
freetype                  2.12.1               h267a509_2    conda-forge
freetype-py               2.3.0              pyhd8ed1ab_0    conda-forge
fsspec                    2024.12.0          pyhd8ed1ab_0    conda-forge
gast                      0.6.0              pyhd8ed1ab_0    conda-forge
gflags                    2.2.2             h5888daf_1005    conda-forge
giflib                    5.2.2                hd590300_0    conda-forge
glog                      0.7.1                hbabe93e_0    conda-forge
gmp                       6.3.0                hac33072_2    conda-forge
gmpy2                     2.1.5           py311h0f6cedb_3    conda-forge
gmso                      0.12.4             pyhd8ed1ab_1    conda-forge
google-pasta              0.2.0              pyhd8ed1ab_2    conda-forge
greenlet                  3.1.1           py311hfdbb021_1    conda-forge
grpcio                    1.62.2          py311ha6695c7_0    conda-forge
h11                       0.14.0             pyhd8ed1ab_1    conda-forge
h2                        4.1.0              pyhd8ed1ab_1    conda-forge
h5py                      3.12.1          nompi_py311h5ed33ec_103    conda-forge
hdf4                      4.2.15               h2a13503_7    conda-forge
hdf5                      1.14.4          nompi_h2d575fe_105    conda-forge
hpack                     4.0.0              pyhd8ed1ab_1    conda-forge
httpcore                  1.0.7              pyh29332c3_1    conda-forge
httpx                     0.28.1             pyhd8ed1ab_0    conda-forge
hyperframe                6.0.1              pyhd8ed1ab_1    conda-forge
icu                       73.2                 h59595ed_0    conda-forge
idna                      3.10               pyhd8ed1ab_1    conda-forge
importlib-metadata        8.5.0              pyha770c72_1    conda-forge
importlib_resources       6.5.2              pyhd8ed1ab_0    conda-forge
iniconfig                 2.0.0              pyhd8ed1ab_1    conda-forge
ipykernel                 6.29.5             pyh3099207_0    conda-forge
ipython                   8.31.0             pyh707e725_0    conda-forge
ipywidgets                8.0.4                    pypi_0    pypi
isoduration               20.11.0            pyhd8ed1ab_1    conda-forge
jedi                      0.19.2             pyhd8ed1ab_1    conda-forge
jinja2                    3.1.5              pyhd8ed1ab_0    conda-forge
joblib                    1.4.2              pyhd8ed1ab_1    conda-forge
json5                     0.10.0             pyhd8ed1ab_1    conda-forge
jsonpointer               3.0.0           py311h38be061_1    conda-forge
jsonschema                4.23.0             pyhd8ed1ab_1    conda-forge
jsonschema-specifications 2024.10.1          pyhd8ed1ab_1    conda-forge
jsonschema-with-format-nongpl 4.23.0               hd8ed1ab_1    conda-forge
jupyter-lsp               2.2.5              pyhd8ed1ab_1    conda-forge
jupyter_client            8.6.3              pyhd8ed1ab_1    conda-forge
jupyter_core              5.7.2              pyh31011fe_1    conda-forge
jupyter_events            0.11.0             pyhd8ed1ab_0    conda-forge
jupyter_server            2.15.0             pyhd8ed1ab_0    conda-forge
jupyter_server_terminals  0.5.3              pyhd8ed1ab_1    conda-forge
jupyterlab                4.3.4              pyhd8ed1ab_0    conda-forge
jupyterlab_pygments       0.3.0              pyhd8ed1ab_2    conda-forge
jupyterlab_server         2.27.3             pyhd8ed1ab_1    conda-forge
jupyterlab_widgets        3.0.13             pyhd8ed1ab_1    conda-forge
keras                     3.7.0              pyh753f3f9_1    conda-forge
keyutils                  1.6.1                h166bdaf_0    conda-forge
kiwisolver                1.4.8                    pypi_0    pypi
krb5                      1.21.3               h659f571_0    conda-forge
lammps                    2024.8.29.1.0            pypi_0    pypi
lark                      1.2.2              pyhd8ed1ab_1    conda-forge
lcms2                     2.16                 hb7c19ff_0    conda-forge
ld_impl_linux-64          2.43                 h712a8e2_2    conda-forge
lerc                      4.0.0                h27087fc_0    conda-forge
libabseil                 20240116.2      cxx17_he02047a_1    conda-forge
libaec                    1.1.3                h59595ed_0    conda-forge
libarrow                  15.0.2          hf4cd2cf_32_cpu    conda-forge
libarrow-acero            15.0.2          h5d0bfc1_32_cpu    conda-forge
libarrow-dataset          15.0.2          h5d0bfc1_32_cpu    conda-forge
libarrow-flight           15.0.2          ha69365d_32_cpu    conda-forge
libarrow-flight-sql       15.0.2          hce182e0_32_cpu    conda-forge
libarrow-gandiva          15.0.2          hecbfe32_32_cpu    conda-forge
libarrow-substrait        15.0.2          hce182e0_32_cpu    conda-forge
libblas                   3.9.0           26_linux64_openblas    conda-forge
libboost                  1.82.0               h6fcfa73_6    conda-forge
libboost-python           1.82.0          py311h92ebd52_6    conda-forge
libbrotlicommon           1.1.0                hb9d3cd8_2    conda-forge
libbrotlidec              1.1.0                hb9d3cd8_2    conda-forge
libbrotlienc              1.1.0                hb9d3cd8_2    conda-forge
libcap                    2.71                 h39aace5_0    conda-forge
libcblas                  3.9.0           26_linux64_openblas    conda-forge
libcrc32c                 1.1.2                h9c3ff4c_0    conda-forge
libcurl                   8.11.1               h332b0f4_0    conda-forge
libdeflate                1.23                 h4ddbbb0_0    conda-forge
libedit                   3.1.20240808    pl5321h7949ede_0    conda-forge
libev                     4.33                 hd590300_2    conda-forge
libevent                  2.1.12               hf998b51_1    conda-forge
libexpat                  2.6.4                h5888daf_0    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libflint                  3.1.2              h6fb9888_101    conda-forge
libgcc                    14.2.0               h77fa898_1    conda-forge
libgcc-ng                 14.2.0               h69a702a_1    conda-forge
libgcrypt-lib             1.11.0               hb9d3cd8_2    conda-forge
libgfortran               14.2.0               h69a702a_1    conda-forge
libgfortran-ng            14.2.0               h69a702a_1    conda-forge
libgfortran5              14.2.0               hd5240d6_1    conda-forge
libglib                   2.82.2               h2ff4ddf_0    conda-forge
libgomp                   14.2.0               h77fa898_1    conda-forge
libgoogle-cloud           2.29.0               h435de7b_0    conda-forge
libgoogle-cloud-storage   2.29.0               h0121fbd_0    conda-forge
libgpg-error              1.51                 hbd13f7d_1    conda-forge
libgrpc                   1.62.2               h15f2491_0    conda-forge
libiconv                  1.17                 hd590300_2    conda-forge
libjpeg-turbo             3.0.0                hd590300_1    conda-forge
liblapack                 3.9.0           26_linux64_openblas    conda-forge
liblapacke                3.9.0           26_linux64_openblas    conda-forge
libllvm16                 16.0.6               hb3ce162_3    conda-forge
liblzma                   5.6.3                hb9d3cd8_1    conda-forge
liblzma-devel             5.6.3                hb9d3cd8_1    conda-forge
libnetcdf                 4.9.2           nompi_h2564987_115    conda-forge
libnghttp2                1.64.0               h161d5f1_0    conda-forge
libnl                     3.11.0               hb9d3cd8_0    conda-forge
libnsl                    2.0.1                hd590300_0    conda-forge
libopenblas               0.3.28          pthreads_h94d23a6_1    conda-forge
libparquet                15.0.2          h4141fc9_32_cpu    conda-forge
libpng                    1.6.45               h943b412_0    conda-forge
libprotobuf               4.25.3               hd5b35b9_1    conda-forge
libre2-11                 2023.09.01           h5a48ba9_2    conda-forge
libsodium                 1.0.20               h4ab18f5_0    conda-forge
libsqlite                 3.47.2               hee588c1_0    conda-forge
libssh2                   1.11.1               hf672d98_0    conda-forge
libstdcxx                 14.2.0               hc0a3c3a_1    conda-forge
libstdcxx-ng              14.2.0               h4852527_1    conda-forge
libsystemd0               256.9                h2774228_0    conda-forge
libthrift                 0.20.0               h0e7cc3e_1    conda-forge
libtiff                   4.7.0                hd9ff511_3    conda-forge
libtorch                  2.3.1           cpu_generic_h970db74_0    conda-forge
libudev1                  256.9                h9a4d06a_2    conda-forge
liburing                  2.6                  h297d8ca_0    conda-forge
libutf8proc               2.8.0                hf23e847_1    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libuv                     1.49.2               hb9d3cd8_0    conda-forge
libwebp-base              1.5.0                h851e524_0    conda-forge
libxcb                    1.17.0               h8a09558_0    conda-forge
libxcrypt                 4.4.36               hd590300_1    conda-forge
libxml2                   2.12.7               h4c95cb1_3    conda-forge
libxslt                   1.1.39               h76b75d6_0    conda-forge
libzip                    1.11.2               h6991a6a_0    conda-forge
libzlib                   1.3.1                hb9d3cd8_2    conda-forge
lightning-utilities       0.11.9             pyhd8ed1ab_1    conda-forge
locket                    1.0.0              pyhd8ed1ab_0    conda-forge
lxml                      5.3.0           py311hcfaa980_2    conda-forge
lz4-c                     1.9.4                hcb278e6_0    conda-forge
markdown                  3.6                pyhd8ed1ab_0    conda-forge
markdown-it-py            3.0.0              pyhd8ed1ab_1    conda-forge
markupsafe                3.0.2           py311h2dc5d0c_1    conda-forge
matplotlib-base           3.10.0          py311h2b939e6_0    conda-forge
matplotlib-inline         0.1.7              pyhd8ed1ab_1    conda-forge
mbuild                    1.1.0              pyhd8ed1ab_0    conda-forge
mda-xdrlib                0.2.0              pyhd8ed1ab_1    conda-forge
mdtraj                    1.10.2          py311h2ed89a0_0    conda-forge
mdurl                     0.1.2              pyhd8ed1ab_1    conda-forge
metis                     5.1.1                h59595ed_2    conda-forge
mistune                   3.1.0              pyhd8ed1ab_0    conda-forge
ml_dtypes                 0.3.2           py311h320fe9a_0    conda-forge
mmpbsa-py                 16.0                     pypi_0    pypi
mpc                       1.3.1                h24ddda3_1    conda-forge
mpfr                      4.2.1                h90cbb55_3    conda-forge
mpmath                    1.3.0              pyhd8ed1ab_1    conda-forge
msgpack-python            1.1.0           py311hd18a35c_0    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
namex                     0.0.8              pyhd8ed1ab_1    conda-forge
nbclient                  0.10.2             pyhd8ed1ab_0    conda-forge
nbconvert-core            7.16.5             pyhd8ed1ab_1    conda-forge
nbformat                  5.10.4             pyhd8ed1ab_1    conda-forge
ncurses                   6.5                  he02047a_1    conda-forge
nest-asyncio              1.6.0              pyhd8ed1ab_1    conda-forge
netcdf-fortran            4.6.1           nompi_ha5d1325_108    conda-forge
netcdf4                   1.7.2                    pypi_0    pypi
networkx                  3.4.2              pyh267e887_2    conda-forge
nglview                   3.0.6                    pypi_0    pypi
nomkl                     1.0                  h5ca1d4c_0    conda-forge
notebook                  7.3.2              pyhd8ed1ab_0    conda-forge
notebook-shim             0.2.4              pyhd8ed1ab_1    conda-forge
numexpr                   2.10.2          py311h38b10cd_100    conda-forge
numpy                     1.26.4          py311h64a7726_0    conda-forge
ocl-icd                   2.3.2                hb9d3cd8_2    conda-forge
ocl-icd-system            1.0.0                         1    conda-forge
openbabel                 3.1.1           py311h8b422cb_9    conda-forge
opencl-headers            2024.10.24           h5888daf_0    conda-forge
openeye-toolkits          2024.2.0                py311_0    openeye
openff-amber-ff-ports     0.0.4              pyhca7485f_0    conda-forge
openff-forcefields        2024.09.0          pyhff2d567_0    conda-forge
openff-interchange        0.4.0              pyhd8ed1ab_0    conda-forge
openff-interchange-base   0.4.0              pyhd8ed1ab_0    conda-forge
openff-nagl               0.5.0              pyhd8ed1ab_0    conda-forge
openff-nagl-base          0.5.0              pyhd8ed1ab_0    conda-forge
openff-nagl-models        0.3.0              pyhd8ed1ab_1    conda-forge
openff-recharge           0.5.3              pyhd8ed1ab_0    conda-forge
openff-toolkit            0.16.7             pyhd8ed1ab_0    conda-forge
openff-toolkit-base       0.16.7             pyhd8ed1ab_0    conda-forge
openff-units              0.2.2              pyhd8ed1ab_1    conda-forge
openff-utilities          0.1.13             pyhd8ed1ab_0    conda-forge
openjpeg                  2.5.3                h5fbd93e_0    conda-forge
openmm                    8.2.0                    pypi_0    pypi
openssl                   3.4.0                h7b32b05_1    conda-forge
opt_einsum                3.4.0              pyhd8ed1ab_1    conda-forge
optree                    0.13.1          py311hd18a35c_1    conda-forge
orc                       2.0.2                h669347b_0    conda-forge
overrides                 7.7.0              pyhd8ed1ab_1    conda-forge
packaging                 24.2               pyhd8ed1ab_2    conda-forge
packmol                   20.15.1              hc8b2c43_1    conda-forge
packmol-memgen            2023.2.24                pypi_0    pypi
pandas                    2.2.3                    pypi_0    pypi
pandocfilters             1.5.1                    pypi_0    pypi
panedr                    0.8.0              pyhd8ed1ab_1    conda-forge
parmed                    4.3.0           py311h8cc7b42_0    conda-forge
parso                     0.8.4              pyhd8ed1ab_1    conda-forge
partd                     1.4.2              pyhd8ed1ab_0    conda-forge
pcre2                     10.44                hba22ea6_2    conda-forge
pdb4amber                 22.0                     pypi_0    pypi
perl                      5.32.1          7_hd590300_perl5    conda-forge
pexpect                   4.9.0              pyhd8ed1ab_1    conda-forge
pickleshare               0.7.5           pyhd8ed1ab_1004    conda-forge
pillow                    11.1.0          py311h1322bbf_0    conda-forge
pint                      0.23               pyhd8ed1ab_1    conda-forge
pip                       24.3.1             pyh8b19718_2    conda-forge
pixman                    0.44.2               h29eaf8c_0    conda-forge
pkgutil-resolve-name      1.3.10             pyhd8ed1ab_2    conda-forge
platformdirs              4.3.6              pyhd8ed1ab_1    conda-forge
pluggy                    1.5.0              pyhd8ed1ab_1    conda-forge
polymerist                0.1.4rc1                 pypi_0    pypi
pprofile                  2.2.0                    pypi_0    pypi
prometheus_client         0.21.1             pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.48             pyha770c72_1    conda-forge
protobuf                  4.25.3          py311hbffca5d_1    conda-forge
psutil                    6.1.1           py311h9ecbd09_0    conda-forge
pthread-stubs             0.4               hb9d3cd8_1002    conda-forge
ptyprocess                0.7.0              pyhd8ed1ab_1    conda-forge
pubchempy                 1.0.4                    pypi_0    pypi
pure_eval                 0.2.3              pyhd8ed1ab_1    conda-forge
py-cpuinfo                9.0.0              pyhd8ed1ab_1    conda-forge
py3dmol                   2.4.2                    pypi_0    pypi
pyarrow                   15.0.2          py311h9e7c50d_32_cpu    conda-forge
pycairo                   1.27.0          py311h124c5f0_0    conda-forge
pycparser                 2.22               pyh29332c3_1    conda-forge
pydantic                  2.10.4             pyh3cfb1c2_0    conda-forge
pydantic-core             2.27.2          py311h9e33e62_0    conda-forge
pyedr                     0.8.0              pyhd8ed1ab_1    conda-forge
pygments                  2.19.1             pyhd8ed1ab_0    conda-forge
pymsmt                    22.0                     pypi_0    pypi
pyparsing                 3.2.1              pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyha55dd90_7    conda-forge
pytables                  3.10.2          py311h3ebe2b2_0    conda-forge
pytest                    8.3.4              pyhd8ed1ab_1    conda-forge
python                    3.11.11         h9e4cc4f_1_cpython    conda-forge
python-constraint         1.4.0              pyhff2d567_1    conda-forge
python-dateutil           2.9.0.post0        pyhff2d567_1    conda-forge
python-fastjsonschema     2.21.1             pyhd8ed1ab_0    conda-forge
python-flatbuffers        24.3.25            pyhe33e51e_1    conda-forge
python-json-logger        3.2.1                    pypi_0    pypi
python-symengine          0.13.0          py311hb815d42_2    conda-forge
python-tzdata             2024.2             pyhd8ed1ab_1    conda-forge
python_abi                3.11                    5_cp311    conda-forge
pytorch                   2.3.1           cpu_generic_py311h8ca351a_0    conda-forge
pytorch-lightning         2.5.0.post0        pyh101cb37_0    conda-forge
pytraj                    2.0.6                    pypi_0    pypi
pytz                      2024.2             pyhd8ed1ab_1    conda-forge
pyyaml                    6.0.2           py311h9ecbd09_1    conda-forge
pyzmq                     26.2.0          py311h7deb3e3_3    conda-forge
qhull                     2020.2               h434a139_5    conda-forge
rdkit                     2024.9.4                 pypi_0    pypi
rdma-core                 55.0                 h5888daf_0    conda-forge
re2                       2023.09.01           h7f4b329_2    conda-forge
readline                  8.2                  h8228510_1    conda-forge
referencing               0.35.1             pyhd8ed1ab_1    conda-forge
reportlab                 4.2.5           py311h9ecbd09_0    conda-forge
requests                  2.32.3             pyhd8ed1ab_1    conda-forge
rfc3339-validator         0.1.4              pyhd8ed1ab_1    conda-forge
rfc3986-validator         0.1.1              pyh9f0ad1d_0    conda-forge
rich                      13.9.4             pyhd8ed1ab_1    conda-forge
rlpycairo                 0.2.0              pyhd8ed1ab_0    conda-forge
rpds-py                   0.22.3          py311h9e33e62_0    conda-forge
s2n                       1.5.5                h3931f03_0    conda-forge
sander                    22.0                     pypi_0    pypi
scipy                     1.15.0          py311hc1ac118_1    conda-forge
send2trash                1.8.3              pyh0d859eb_1    conda-forge
setuptools                75.6.0             pyhff2d567_1    conda-forge
signac                    2.2.0              pyhd8ed1ab_1    conda-forge
signac-flow               0.29.0             pyhd8ed1ab_1    conda-forge
six                       1.17.0             pyhd8ed1ab_0    conda-forge
sleef                     3.7                  h1b44611_2    conda-forge
smirnoff99frosst          1.1.0              pyh44b312d_0    conda-forge
snappy                    1.2.1                h8bd8927_1    conda-forge
sniffio                   1.3.1              pyhd8ed1ab_1    conda-forge
sortedcontainers          2.4.0              pyhd8ed1ab_0    conda-forge
soupsieve                 2.6                      pypi_0    pypi
sqlalchemy                2.0.36          py311h9ecbd09_0    conda-forge
sqlite                    3.47.2               h9eae976_0    conda-forge
stack_data                0.6.3              pyhd8ed1ab_1    conda-forge
symengine                 0.13.0               h95c1f20_3    conda-forge
sympy                     1.13.3           pyh2585a3b_105    conda-forge
synced_collections        1.0.0              pyhd8ed1ab_1    conda-forge
tblib                     3.0.0              pyhd8ed1ab_1    conda-forge
tensorboard               2.16.2             pyhd8ed1ab_0    conda-forge
tensorboard-data-server   0.7.0           py311hafd3f86_2    conda-forge
tensorflow                2.16.2          cpu_py311h6ac8430_0    conda-forge
tensorflow-base           2.16.2          cpu_py311h7888847_0    conda-forge
tensorflow-estimator      2.16.2          cpu_py311hbc9741f_0    conda-forge
termcolor                 2.5.0              pyhd8ed1ab_1    conda-forge
terminado                 0.18.1             pyh0d859eb_0    conda-forge
tinycss2                  1.4.0              pyhd8ed1ab_0    conda-forge
tk                        8.6.13          noxft_h4845f30_101    conda-forge
tomli                     2.2.1              pyhd8ed1ab_1    conda-forge
toolz                     1.0.0              pyhd8ed1ab_1    conda-forge
torchdata                 0.7.1           py311h34085b1_7    conda-forge
torchmetrics              1.6.1              pyhd8ed1ab_0    conda-forge
tornado                   6.4.2           py311h9ecbd09_0    conda-forge
tqdm                      4.67.1             pyhd8ed1ab_1    conda-forge
traitlets                 5.14.3             pyhd8ed1ab_1    conda-forge
treelib                   1.7.0              pyhd8ed1ab_1    conda-forge
types-python-dateutil     2.9.0.20241206     pyhd8ed1ab_0    conda-forge
typing-extensions         4.12.2               hd8ed1ab_1    conda-forge
typing_extensions         4.12.2             pyha770c72_1    conda-forge
typing_utils              0.1.0              pyhd8ed1ab_1    conda-forge
tzdata                    2024b                hc8b5060_0    conda-forge
ucx                       1.16.0               h209287a_5    conda-forge
unicodedata2              15.1.0          py311h9ecbd09_1    conda-forge
unyt                      3.0.3              pyhd8ed1ab_2    conda-forge
uri-template              1.3.0              pyhd8ed1ab_1    conda-forge
urllib3                   2.3.0              pyhd8ed1ab_0    conda-forge
wcwidth                   0.2.13             pyhd8ed1ab_1    conda-forge
webcolors                 24.11.1            pyhd8ed1ab_0    conda-forge
webencodings              0.5.1              pyhd8ed1ab_3    conda-forge
websocket-client          1.8.0              pyhd8ed1ab_1    conda-forge
werkzeug                  3.1.3              pyhd8ed1ab_1    conda-forge
wheel                     0.45.1             pyhd8ed1ab_1    conda-forge
widgetsnbextension        4.0.13             pyhd8ed1ab_1    conda-forge
wrapt                     1.17.0          py311h9ecbd09_0    conda-forge
xmltodict                 0.14.2             pyhd8ed1ab_1    conda-forge
xorg-libice               1.1.2                hb9d3cd8_0    conda-forge
xorg-libsm                1.2.5                he73a12e_0    conda-forge
xorg-libx11               1.8.10               h4f16b4b_1    conda-forge
xorg-libxau               1.0.12               hb9d3cd8_0    conda-forge
xorg-libxdmcp             1.1.5                hb9d3cd8_0    conda-forge
xorg-libxext              1.3.6                hb9d3cd8_0    conda-forge
xorg-libxrender           0.9.12               hb9d3cd8_0    conda-forge
xorg-libxt                1.3.1                hb9d3cd8_0    conda-forge
xz                        5.6.3                hbcc6ac9_1    conda-forge
xz-gpl-tools              5.6.3                hbcc6ac9_1    conda-forge
xz-tools                  5.6.3                hb9d3cd8_1    conda-forge
yaml                      0.2.5                h7f98852_2    conda-forge
zeromq                    4.3.5                h3b0a872_7    conda-forge
zict                      3.0.0              pyhd8ed1ab_1    conda-forge
zipp                      3.21.0             pyhd8ed1ab_1    conda-forge
zlib                      1.3.1                hb9d3cd8_2    conda-forge
zlib-ng                   2.2.3                h7955e40_0    conda-forge
zstandard                 0.23.0          py311hbc35293_1    conda-forge
zstd                      1.5.6                ha6fb4c9_0    conda-forge

@timbernat timbernat added the bug Something isn't working label Jan 15, 2025
@mattwthompson
Copy link
Member

The constraints issue is genuine and a little surprising, but probably just not something we've happened to do yet. I'll add it to our triage process and use this issue as a stub for updates.

I suspect the Omega warning you're seeing is from your call to Molecule.generate_conformers. If you can get AM1-BCC charges applied to water from TIP3P (without bending the rules too much) please demonstrate that here: #1144

@timbernat
Copy link
Contributor Author

@mattwthompson see comment in #1144, I've closed that issue following your clarification.

That still does leave the LAMMPS constraints issue pretty seriously open however, can you provide some insight into why the constraint styles for TIP3P would be inconsistent?

Stranger still, this Exception doesn't appear to crop up for other small molecules using a non-tip3p forcefield, but is instead replaced by an "unsupported electrostatics" error:

...: import logging
...: logging.basicConfig(level=logging.INFO)
...: 
...: from openff.toolkit import Molecule, ForceField
...: 
...: offmol = Molecule.from_smiles('CCO')
...: offmol.generate_conformers(n_conformers=1)
...: 
...: ff = ForceField('openff-2.0.0.offxml')
...: inc = ff.create_interchange(offmol.to_topology())
...: 
...: inc.to_lammps(prefix='ethanol')
INFO:rdkit:Enabling RDKit 2023.09.6 jupyter extensions
Warning: Cannot perform Hydrogen sampling with GPU-Omega: GPU-Omega disabled.
INFO:openff.toolkit.typing.engines.smirnoff.parameters:Attempting to up-convert vdW section from 0.3 to 0.4
INFO:openff.toolkit.typing.engines.smirnoff.parameters:Successfully up-converted vdW section from 0.3 to 0.4. `method="cutoff"` is now split into `periodic_method="cutoff"` and `nonperiodic_method="no-cutoff"`.
INFO:openff.toolkit.typing.engines.smirnoff.parameters:Attempting to up-convert Electrostatics section from 0.3 to 0.4
INFO:openff.toolkit.typing.engines.smirnoff.parameters:Successfully up-converted Electrostatics section from 0.3 to 0.4. `method="PME"` is now split into `periodic_potential="Ewald3D-ConductingBoundary"`, `nonperiodic_potential="Coulomb"`, and `exception_potential="Coulomb"`

------------------------------------------------------------------------------------------------------------------------------------------------------
UnsupportedExportError                    Traceback (most recent call last)
Cell In[1], line 12
      9 ff = ForceField('openff-2.0.0.offxml')
     10 inc = ff.create_interchange(offmol.to_topology())
---> 12 inc.to_lammps(prefix='ethanol')

File ~/miniconda3/envs/nrel-polymers/lib/python3.11/site-packages/openff/interchange/components/interchange.py:474, in Interchange.to_lammps(self, prefix)
    472 datafile_path = prefix + ".lmp"
    473 self.to_lammps_datafile(datafile_path)
--> 474 self.to_lammps_input(
    475     prefix + "_pointenergy.in",
    476     datafile_path,
    477 )

File ~/miniconda3/envs/nrel-polymers/lib/python3.11/site-packages/openff/interchange/components/interchange.py:511, in Interchange.to_lammps_input(self, file_path, data_file)
    508     data_file = Path(file_path).with_suffix(".lmp")
    510 mdconfig = MDConfig.from_interchange(self)
--> 511 mdconfig.write_lammps_input(self, str(file_path), data_file=str(data_file))

File ~/miniconda3/envs/nrel-polymers/lib/python3.11/site-packages/openff/interchange/components/mdconfig.py:346, in MDConfig.write_lammps_input(self, interchange, input_file, data_file)
    344     lmp.write(f"pair_style lj/cut/coul/cut {vdw_cutoff} {coul_cutoff}\n")
    345 else:
--> 346     raise UnsupportedExportError(
    347         f"Unsupported electrostatics method {self.coul_method}",
    348     )
    350 if self.mixing_rule == "lorentz-berthelot":
    351     lmp.write("pair_modify mix arithmetic tail yes\n\n")

UnsupportedExportError: Unsupported electrostatics method Coulomb

@mattwthompson
Copy link
Member

The UnsupportedExportError comes from that particular combination of non-bonded settings not being implemented in that writer; a non-periodic topology gets different non-bonded settings than a periodic topology and that just hasn't been implemented there yet. You can get around that by using a large box a.k.a. pseudo-vacuum to mimic gas phase with PBC

topology = molecule.to_topology()
topology.box_vectors = Quantity([5, 5, 5], "nanometer")

I've split that off to #1145

Back to the constraints - there's a lot that can be done with that code. It doesn't seem to be smart enough to process geometries from constrain parameters without looking up into the bond/angle parameters. I used to avoid special casing for water but that's probably unavoidable now. Some of the annotations are also wrong.

TIP3P constraints are handled differently than Sage's general "let's constrain every H-to-heavy-atom bond" constraints. Sage ships with TIP3P, so you should see the same behavior with either force field. I applied this diff to make the error message more useful:

diff --git a/openff/interchange/components/mdconfig.py b/openff/interchange/components/mdconfig.py
index ce4c3966..bc98e730 100644
--- a/openff/interchange/components/mdconfig.py
+++ b/openff/interchange/components/mdconfig.py
@@ -235,7 +235,8 @@ class MDConfig(_BaseModel):
 
             if len(constraint_styles.difference({"Bonds", "Angles"})) > 0:
                 raise NotImplementedError(
-                    "Found unsupported constraints case in LAMMPS input writer.",
+                    "Found unsupported constraints case in LAMMPS input writer. "
+                    f"Constraint style(s) found: {constraint_styles}",
                 )
 
             constrained_bond_smirks = {
from openff.interchange._tests import ForceField, Topology, get_test_file_path


water_dimer =  Topology.from_pdb(get_test_file_path("water-dimer.pdb"))

def try_lammps_export(force_field: str):
    try:
        ForceField(force_field).create_interchange(water_dimer).to_lammps('f')
    except NotImplementedError as e:
        print(f"failed with {force_field}: {e}")

try_lammps_export("tip3p.offxml")
# failed with tip3p.offxml: Found unsupported constraints case in LAMMPS input writer. Constraint style(s) found: {'Constraints'}

try_lammps_export("openff-2.0.0.offxml")
# failed with openff-2.0.0.offxml: Found unsupported constraints case in LAMMPS input writer. Constraint style(s) found: {'Constraints'}

# no TIP3P parameters - water treated as a small molecule - runs without error
try_lammps_export("openff-1.0.0.offxml")

I think if we can get a water dimer to export sensibly that should handle most other cases. I'm a little surprised we haven't seen this yet (or I'm just forgetting it ...)

@mattwthompson
Copy link
Member

@timbernat could you remind me / point me towards the relevant docs on what a LAMMPS used would expect here? The simplest case of a water molecule or two should be fine, but we will need to worry about constrained/rigid water in the same box as ligands or biopolymers with bonds between heavy atoms and hydrogens constrained. That's what's in Sage out of the box.

The five "Shake X" sections here seems like overkill to my intuition? https://docs.lammps.org/Howto_tip3p.html

@mattwthompson mattwthompson added feedback needed Could use feedback from users needs-info Needs more information from user(s) labels Feb 4, 2025
@mattwthompson
Copy link
Member

The difficulty is in assigning constraint information without bond and angle parameters, since TIP3P doesn't have harmonic bond or angle parameters. I'm not sure what LAMMPS users expect here.

@timbernat
Copy link
Contributor Author

Looping in @DariaLazar who is an expert LAMMPS user, could you provide some insight here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feedback needed Could use feedback from users lammps Relating to LAMMPS needs-info Needs more information from user(s)
Projects
None yet
Development

No branches or pull requests

2 participants