Skip to content

Commit

Permalink
Merge pull request #48 from OpenBioSim/fix_ghost_sigmas
Browse files Browse the repository at this point in the history
Correct the map option for fixing the ghost LJ sigma values
  • Loading branch information
lohedges authored Jun 5, 2024
2 parents 4891b9a + 7326023 commit 4bfdf5a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/somd2/runner/_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def __init__(self, system, config):
self._config._extra_args["check_for_h_by_mass"] = False
self._config._extra_args["check_for_h_by_element"] = False
self._config._extra_args["check_for_h_by_ambertype"] = False
self._config._extra_args["fix_ghost_sigmas"] = True
self._config._extra_args["fix_perturbable_zero_sigmas"] = True

# Check for a periodic space.
self._check_space()
Expand Down
12 changes: 4 additions & 8 deletions src/somd2/runner/_somd1.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ def _make_compatible(system):
except KeyError:
raise KeyError("No perturbable molecules in the system")

# Store a dummy element and ambertype.
element_dummy = _SireMol.Element("Xx")
ambertype_dummy = "du"

for mol in pert_mols:
# Store the molecule info.
info = mol.info()
Expand All @@ -74,16 +70,16 @@ def _make_compatible(system):
# First fix zero LJ sigmas values.
##################################

# Create a null LJParameter.
null_lj = _SireMM.LJParameter()
# Tolerance for zero sigma values.
null_lj_sigma = 1e-9

for atom in mol.atoms():
# Get the end state LJ sigma values.
lj0 = atom.property("LJ0")
lj1 = atom.property("LJ1")

# Lambda = 0 state has a zero sigma value.
if lj0.sigma() == null_lj.sigma():
if abs(lj0.sigma().value()) <= null_lj_sigma:
# Use the sigma value from the lambda = 1 state.
edit_mol = (
edit_mol.atom(atom.index())
Expand All @@ -94,7 +90,7 @@ def _make_compatible(system):
)

# Lambda = 1 state has a zero sigma value.
if lj1.sigma() == null_lj.sigma():
if abs(lj1.sigma().value()) <= null_lj_sigma:
# Use the sigma value from the lambda = 0 state.
edit_mol = (
edit_mol.atom(atom.index())
Expand Down

0 comments on commit 4bfdf5a

Please sign in to comment.