Skip to content

Commit

Permalink
Make zero LJ sigma check consistent with Sire.
Browse files Browse the repository at this point in the history
  • Loading branch information
lohedges committed Jun 4, 2024
1 parent dc50f26 commit 0c22782
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions python/BioSimSpace/Align/_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,8 +693,8 @@ def merge(
.molecule()
)

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

# Atoms with zero LJ sigma values need to have their sigma values set to the
# value from the other end state.
Expand All @@ -704,7 +704,7 @@ def merge(
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 @@ -713,7 +713,7 @@ def merge(
)

# 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
8 changes: 4 additions & 4 deletions python/BioSimSpace/Sandpit/Exscientia/Align/_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,8 +739,8 @@ def merge(
edit_mol.atom(idx).setProperty(name, atom.property(prop)).molecule()
)

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

# Atoms with zero LJ sigma values need to have their sigma values set to the
# value from the other end state.
Expand All @@ -750,7 +750,7 @@ def merge(
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 @@ -759,7 +759,7 @@ def merge(
)

# 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 0c22782

Please sign in to comment.