Comments (1)
Here's a test that would be nice to add, combining this and #974
diff --git a/openff/interchange/_tests/unit_tests/interop/gromacs/export/test_export.py b/openff/interchange/_tests/unit_tests/interop/gromacs/export/test_export.py
index d4e930e8..c9ad7b7d 100644
--- a/openff/interchange/_tests/unit_tests/interop/gromacs/export/test_export.py
+++ b/openff/interchange/_tests/unit_tests/interop/gromacs/export/test_export.py
@@ -414,6 +414,81 @@ class TestGROMACS:
assert [*parmed.load_file("tmp.top").molecules.keys()] == ["MOL0", "MOL1"]
+ @pytest.mark.parametrize("name", ["MOL0", "MOL222", ""])
+ def test_roundtrip_with_combine(
+ self,
+ name,
+ sage_unconstrained,
+ ethanol,
+ cyclohexane,
+ monkeypatch,
+ ):
+ monkeypatch.setenv("INTERCHANGE_EXPERIMENTAL", "1")
+
+ for molecule in [ethanol, cyclohexane]:
+ molecule.name = name
+ molecule.generate_conformers(n_conformers=1)
+
+ # translate one by 1 nm
+ cyclohexane._conformers = [
+ cyclohexane.conformers[0] + Quantity([0, 0, 1], "nanometer")
+ ]
+
+ ethanol_interchange = sage_unconstrained.create_interchange(
+ ethanol.to_topology()
+ )
+ ethanol_interchange.box = [4, 4, 4]
+
+ cyclohexane_interchange = sage_unconstrained.create_interchange(
+ cyclohexane.to_topology()
+ )
+ cyclohexane_interchange.box = [4, 4, 4]
+
+ combined = ethanol_interchange.combine(cyclohexane_interchange)
+
+ ethanol_interchange.to_gromacs("ethanol", decimal=8)
+ cyclohexane_interchange.to_gromacs("cyclohexane", decimal=8)
+ combined.to_gromacs("combined", decimal=8)
+
+ converted_ethanol = Interchange.from_gromacs(
+ "ethanol.top",
+ "ethanol.gro",
+ )
+ converted_cyclohexane = Interchange.from_gromacs(
+ "cyclohexane.top",
+ "cyclohexane.gro",
+ )
+
+ converted_combined = Interchange.from_gromacs(
+ "combined.top",
+ "combined.gro",
+ )
+
+ combined_from_converted = converted_ethanol.combine(converted_cyclohexane)
+
+ assert numpy.allclose(converted_combined.positions, combined.positions)
+ assert numpy.allclose(
+ converted_combined.positions, combined_from_converted.positions
+ )
+ assert numpy.allclose(converted_combined.box, combined.box)
+ assert numpy.allclose(converted_combined.box, combined_from_converted.box)
+
+ get_gromacs_energies(combined).compare(
+ get_gromacs_energies(converted_combined),
+ tolerances={
+ "Bond": 0.002 * combined.topology.n_bonds * unit.kilojoule / unit.mol,
+ "Electrostatics": 0.05 * unit.kilojoule / unit.mol,
+ },
+ )
+
+ get_gromacs_energies(combined).compare(
+ get_gromacs_energies(combined_from_converted),
+ tolerances={
+ "Bond": 0.002 * combined.topology.n_bonds * unit.kilojoule / unit.mol,
+ "Electrostatics": 0.05 * unit.kilojoule / unit.mol,
+ },
+ )
+
class TestGROMACSMetadata:
@skip_if_missing("openmm")
diff --git a/openff/interchange/components/interchange.py b/openff/interchange/components/interchange.py
index f88f4322..2c12a237 100644
--- a/openff/interchange/components/interchange.py
+++ b/openff/interchange/components/interchange.py
@@ -966,7 +966,7 @@ class Interchange(DefaultModel):
@experimental
def combine(self, other: "Interchange") -> "Interchange":
- """Combine two Interchange objects. This method is unstable and not yet unsafe."""
+ """Combine two Interchange objects. This method is unstable and not yet safe for general use."""
from openff.interchange.operations._combine import _combine
return _combine(self, other)
from openff-interchange.
Related Issues (20)
- Loading topologies from OpenMM sometimes scrambles atom order HOT 2
- Electrostatics key mismatch after combination HOT 3
- Positions of `MonovalentLonePair` virtual sites is incorrect (does not affect simulations) HOT 1
- Virtual site parameters can clash if looked up using only SMIRKS HOT 4
- `experimental/openmmforcefields/gaff.ipynb` and `ligand_in_water.ipynb` notebooks broken on OpenFF Docs HOT 1
- units for `Interchange.collection['Bonds'].get_system_parameters()` HOT 2
- Support GROMACS's `3fad` virtual sites
- `get_positions_with_virtual_sites` does not collate virtual sites with molecules HOT 1
- Some combinations of Interchanges do not commute HOT 2
- Improved LAMMPS support. HOT 2
- LAMMPS versions prior to 2023.08.02 are incompatible with Interchange, but may be installed with it HOT 2
- Interchange.to_gromacs() creates a topology with far too many atomtypes, which influences GROMACS performance HOT 4
- Syncing topology and `Interchange` attributes
- Easier indexing into collections
- Look into ordering of charge dictionary
- Combining a Sage interchange with one loaded from OpenMM fails because the electrostatics cutoff is not set by the OpenMM importer, but is checked by the `combine` method HOT 1
- GROMACS writer chokes without unique molecule names HOT 5
- `experimental/openmmforcefields/gaff.ipynb` is failing on openff-docs HOT 3
- PACKMOL wrapper with >100,000 atoms HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openff-interchange.