Comments (5)
This is either an interesting bug or a combination of a few happening at once. The error you're getting is from positions not being interpreted accurately. I actually get a different error running your code from a fresh environment:
---> 18 i3.to_gromacs("test") # works fine
20 # Does not work
21 i1_upd = Interchange.parse_raw(i1.json())
File ~/software/openff-interchange/openff/interchange/components/interchange.py:449, in Interchange.to_gromacs(self, prefix, decimal, hydrogen_mass, _merge_atom_types)
445 from openff.interchange.interop.gromacs.export._export import GROMACSWriter
446 from openff.interchange.smirnoff._gromacs import _convert
448 writer = GROMACSWriter(
--> 449 system=_convert(self, hydrogen_mass=hydrogen_mass),
450 top_file=prefix + ".top",
451 gro_file=prefix + ".gro",
452 )
454 writer.to_top(_merge_atom_types=_merge_atom_types)
455 writer.to_gro(decimal=decimal)
File ~/software/openff-interchange/openff/interchange/smirnoff/_gromacs.py:131, in _convert(interchange, hydrogen_mass)
127 key = TopologyKey(atom_indices=(topology_index,))
128 vdw_parameters = vdw_collection.potentials[
129 vdw_collection.key_map[key]
130 ].parameters
--> 131 charge = electrostatics_collection.charges[key]
133 # Build atom types
134 system.atom_types[atom_type_name] = LennardJonesAtomType(
135 name=_atom_atom_type_map[atom],
136 bonding_type="",
(...)
142 epsilon=vdw_parameters["epsilon"].to(unit.kilojoule_per_mole),
143 )
KeyError: TopologyKey with atom indices (12,)
from openff-interchange.
For my error, anyway, here's a hint (which is strongly reminiscent of #935 that I think my computer must be stuck in a time machine ...):
In [9]: i1['Electrostatics'].charges
Out[9]:
{TopologyKey with atom indices (0,): -0.1301600026587645 <Unit('elementary_charge')>,
TopologyKey with atom indices (1,): -0.1300999956826369 <Unit('elementary_charge')>,
TopologyKey with atom indices (2,): -0.1300999956826369 <Unit('elementary_charge')>,
TopologyKey with atom indices (3,): -0.1300999956826369 <Unit('elementary_charge')>,
TopologyKey with atom indices (4,): -0.1300999956826369 <Unit('elementary_charge')>,
TopologyKey with atom indices (5,): -0.1300999956826369 <Unit('elementary_charge')>,
TopologyKey with atom indices (6,): 0.13010999684532484 <Unit('elementary_charge')>,
TopologyKey with atom indices (7,): 0.13010999684532484 <Unit('elementary_charge')>,
TopologyKey with atom indices (8,): 0.13010999684532484 <Unit('elementary_charge')>,
TopologyKey with atom indices (9,): 0.13010999684532484 <Unit('elementary_charge')>,
TopologyKey with atom indices (10,): 0.13010999684532484 <Unit('elementary_charge')>,
TopologyKey with atom indices (11,): 0.13010999684532484 <Unit('elementary_charge')>}
In [10]: i2['Electrostatics'].charges
Out[10]:
{TopologyKey with atom indices (0,): -0.09263999895616011 <Unit('elementary_charge')>,
TopologyKey with atom indices (1,): -0.08175999806685881 <Unit('elementary_charge')>,
TopologyKey with atom indices (2,): -0.09263999895616011 <Unit('elementary_charge')>,
TopologyKey with atom indices (3,): 0.03214000029997392 <Unit('elementary_charge')>,
TopologyKey with atom indices (4,): 0.03214000029997392 <Unit('elementary_charge')>,
TopologyKey with atom indices (5,): 0.03214000029997392 <Unit('elementary_charge')>,
TopologyKey with atom indices (6,): 0.037099997089667755 <Unit('elementary_charge')>,
TopologyKey with atom indices (7,): 0.037099997089667755 <Unit('elementary_charge')>,
TopologyKey with atom indices (8,): 0.03214000029997392 <Unit('elementary_charge')>,
TopologyKey with atom indices (9,): 0.03214000029997392 <Unit('elementary_charge')>,
TopologyKey with atom indices (10,): 0.03214000029997392 <Unit('elementary_charge')>}
In [11]: i3['Electrostatics'].charges
Out[11]:
{TopologyKey with atom indices (0,): -0.1301600026587645 <Unit('elementary_charge')>,
TopologyKey with atom indices (1,): -0.1300999956826369 <Unit('elementary_charge')>,
TopologyKey with atom indices (2,): -0.1300999956826369 <Unit('elementary_charge')>,
TopologyKey with atom indices (3,): -0.1300999956826369 <Unit('elementary_charge')>,
TopologyKey with atom indices (4,): -0.1300999956826369 <Unit('elementary_charge')>,
TopologyKey with atom indices (5,): -0.1300999956826369 <Unit('elementary_charge')>,
TopologyKey with atom indices (6,): 0.13010999684532484 <Unit('elementary_charge')>,
TopologyKey with atom indices (7,): 0.13010999684532484 <Unit('elementary_charge')>,
TopologyKey with atom indices (8,): 0.13010999684532484 <Unit('elementary_charge')>,
TopologyKey with atom indices (9,): 0.13010999684532484 <Unit('elementary_charge')>,
TopologyKey with atom indices (10,): 0.13010999684532484 <Unit('elementary_charge')>,
TopologyKey with atom indices (11,): 0.13010999684532484 <Unit('elementary_charge')>}
from openff-interchange.
Haha, this is the cause
In [6]: i1.topology.molecule(0).name
Out[6]: 'MOL0'
In [7]: i2.topology.molecule(0).name
Out[7]: 'MOL0'
In [8]: [molecule.name for molecule in i3.topology.molecules]
Out[8]: ['MOL0', 'MOL0']
from openff-interchange.
Yes, I was expecting smth like this. But was not able to detect it promtly
from openff-interchange.
Please re-open if this is still smelly - but I bet you're going to run into #978 first
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 1
- 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
- `experimental/openmmforcefields/gaff.ipynb` is failing on openff-docs HOT 3
- Dihedrals lost in `Interchange.from_gromacs` HOT 1
- 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.