Skip to content

Commit

Permalink
Exclude ions from the perturbation.
Browse files Browse the repository at this point in the history
  • Loading branch information
lohedges committed Mar 13, 2024
1 parent 243311e commit ddef28f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/somd2/runner/_somd1.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,12 +648,14 @@ def _apply_pert(system, pert_file):
# Try to apply the perturbation to each non-water molecule.
is_pert = False
for mol in non_waters:
try:
pert_mol = _morph.create_from_pertfile(mol, pert_file)
is_pert = True
break
except:
pass
# Exclude ions.
if mol.num_atoms() > 1:
try:
pert_mol = _morph.create_from_pertfile(mol, pert_file)
is_pert = True
break
except:
pass

if not is_pert:
raise ValueError(f"Failed to apply the perturbation in '{pert_file}'.")
Expand Down

0 comments on commit ddef28f

Please sign in to comment.