Skip to content

Commit

Permalink
Check perturbable molecules for velocity property. [closes #192]
Browse files Browse the repository at this point in the history
  • Loading branch information
lohedges committed Oct 27, 2023
1 parent cb92227 commit f234669
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
15 changes: 14 additions & 1 deletion python/BioSimSpace/Sandpit/Exscientia/_SireWrappers/_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def addMolecules(self, molecules):

# Remove velocities if any molecules are missing them.
if self.nMolecules() > 1:
# Search for water molecules in the system.
# Search for molecules with a velocity property.
try:
mols_with_velocities = self.search(
f"mols with property velocity"
Expand All @@ -638,6 +638,19 @@ def addMolecules(self, molecules):
except:
num_vels = 0

# Search for perturbable molecules with a velocity property.
# Only consider the lambda = 0 end state.
try:
pert_mols_with_velocities = self.search(
f"mols with property velocity0"
).molecules()
num_pert_vels = len(pert_mols_with_velocities)
except:
num_pert_vels = 0

# Compute the total number of molecules with velocities.
num_vels = num_vels + num_pert_vels

# Not all molecules have velocities.
if num_vels > 0 and num_vels != self.nMolecules():
_warnings.warn(
Expand Down
15 changes: 14 additions & 1 deletion python/BioSimSpace/_SireWrappers/_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def addMolecules(self, molecules):

# Remove velocities if any molecules are missing them.
if self.nMolecules() > 1:
# Search for water molecules in the system.
# Search for molecules with a velocity property.
try:
mols_with_velocities = self.search(
f"mols with property velocity"
Expand All @@ -638,6 +638,19 @@ def addMolecules(self, molecules):
except:
num_vels = 0

# Search for perturbable molecules with a velocity property.
# Only consider the lambda = 0 end state.
try:
pert_mols_with_velocities = self.search(
f"mols with property velocity0"
).molecules()
num_pert_vels = len(pert_mols_with_velocities)
except:
num_pert_vels = 0

# Compute the total number of molecules with velocities.
num_vels = num_vels + num_pert_vels

# Not all molecules have velocities.
if num_vels > 0 and num_vels != self.nMolecules():
_warnings.warn(
Expand Down

0 comments on commit f234669

Please sign in to comment.