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

Permit fits with virtual sites #292

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion devtools/conda-envs/test_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ dependencies:
- openff-evaluator-base >= 0.4.1
- pint =0.20
# - openff-recharge
# - openeye-toolkits (Don't have a license file to use with GH Actions.)
- openeye-toolkits
35 changes: 23 additions & 12 deletions src/smirnoffio.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,27 @@ def smirnoff_update_pgrads(target):

class SMIRNOFF(OpenMM):

""" Derived from Engine object for carrying out OpenMM calculations that use the SMIRNOFF force field. """
"""
Derived from Engine object for carrying out OpenMM calculations that use the SMIRNOFF force field.

Parameters
----------
name : str
ffxml : str
pdb : str
mol :
mol2 : list[str]
mol : Molecule
coords : str
platname : string
precision : string
nonbonded_cutoff
mmopts : dict
vsite_bonds : list
implicit_solvent : string
restrain_k : float
freeze_atoms : list
"""

def __init__(self, name="openmm", **kwargs):
self.valkwd = ['ffxml', 'pdb', 'mol2', 'platname', 'precision', 'mmopts', 'vsite_bonds', 'implicit_solvent', 'restrain_k', 'freeze_atoms']
Expand Down Expand Up @@ -419,8 +439,8 @@ def prepare(self, pbc=False, mmopts={}, **kwargs):

n_virtual_sites = 0
self._has_virtual_sites = False
if 'VirtualSites' in interchange.handlers:
n_virtual_sites = len(interchange['VirtualSites'].slot_map)
if 'VirtualSites' in interchange.collections:
n_virtual_sites = len(interchange['VirtualSites'].key_map)
if n_virtual_sites > 0:
self._has_virtual_sites = True

Expand Down Expand Up @@ -504,15 +524,6 @@ def update_simulation(self, **kwargs):
# delattr(self, 'simulation')
# self.vsprm = vsprm.copy()

has_vsites = False
for particle_idx in range(self.system.getNumParticles()):
if self.system.isVirtualSite(particle_idx):
has_vsites = True

if has_vsites:
raise Exception("ForceBalance can't currently handle SMIRNOFF vsites. "
"Downgrade to ForceBalance 1.9.3 or earlier to handle those.")

if hasattr(self, 'simulation'):
UpdateSimulationParameters(self.system, self.simulation)
else:
Expand Down
21 changes: 21 additions & 0 deletions src/tests/files/opc/dimer.mol2
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@<TRIPOS>MOLECULE
*****
8 5 0 0 0
SMALL
GASTEIGER

@<TRIPOS>ATOM
1 O 11.9600 8.3530 7.6660 O.3 1 HOH1 0.0000
2 H 11.8800 7.4390 7.3960 H 0 HOH0 0.0000
3 H 11.5470 8.8500 6.9600 H 0 HOH0 0.0000
4 M 10.0920 10.1310 9.5470 Du 1 HOH1 0.0000
5 O 9.3160 9.6510 9.8370 O.3 1 HOH1 0.0000
6 H 10.7430 9.4520 9.3730 H 1 HOH1 0.0000
7 H 11.8930 8.2960 7.5330 H 2 UNK2 0.0000
8 M 10.0750 9.9730 9.5630 Du 1 HOH1 0.0000
@<TRIPOS>BOND
1 1 2 1
2 1 3 1
3 4 5 1
4 5 8 1
5 6 8 1
13 changes: 13 additions & 0 deletions src/tests/files/opc/dimer.pdb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
REMARK 1 CREATED WITH OPENMM 8.1, 2023-12-05
CRYST1 93.604 93.604 93.604 90.00 90.00 90.00 P 1 1
HETATM 1 O HOH A 1 11.960 8.353 7.666 1.00 0.00 O
HETATM 2 H1 HOH A 1 11.880 7.439 7.396 1.00 0.00 H
HETATM 3 H2 HOH A 1 11.547 8.850 6.960 1.00 0.00 H
HETATM 4 EP HOH A 1 10.092 10.131 9.547 1.00 0.00 EP
TER 5 HOH A 1
HETATM 6 O HOH B 1 9.316 9.651 9.837 1.00 0.00 O
HETATM 7 H1 HOH B 1 10.743 9.452 9.373 1.00 0.00 H
HETATM 8 H2 HOH B 1 11.893 8.296 7.533 1.00 0.00 H
HETATM 9 EP HOH B 1 10.075 9.973 9.563 1.00 0.00 EP
TER 10 HOH B 1
END
Loading
Loading