choderalab / perses

Experiments with expanded ensembles to explore chemical space

Home Page:http://perses.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix potential bug in counterion implementation: get_water_indices()

zhang-ivy opened this issue · comments

Iván and I caught a potential bug in the counterion implementation, specifically in get_water_indices(), which selects the water(s) to alchemically transform into counterion(s).

The function selects waters at least a certain distance from the solute atoms, and the solute atoms are defined as atoms in the topology that are not in mdtraj's _SOLVENT_TYPES:
https://github.com/choderalab/perses/blob/main/perses/utils/charge_changing.py#L88-L89

However, _SOLVENT_TYPES does not include all possible water residue names. It includes HOH, but does not include WAT, or other water residue names, so we should change this line https://github.com/choderalab/perses/blob/main/perses/utils/charge_changing.py#L88 to solvent_types = list(_SOLVENT_TYPES) + list(_WATER_RESIDUES). _WATER_RESIDUES can be imported from mdtraj and is present here: https://github.com/mdtraj/mdtraj/blob/master/mdtraj/core/residue_names.py#L45