mirror of
https://github.com/OpenFreeEnergy/openfe.git
synced 2026-06-04 14:14:22 +08:00
Address review comments
This commit is contained in:
@@ -166,7 +166,7 @@ def _get_ion_parameters(
|
||||
continue
|
||||
charge, _, _ = nbf.getParticleParameters(atom.index)
|
||||
charge_val = charge.value_in_unit(omm_unit.elementary_charge)
|
||||
if (abs(abs(charge_val) - 1.0) < 0.01 and np.sign(charge_val) == desired_sign):
|
||||
if np.isclose(abs(charge_val), 1.0, atol=0.01) and np.sign(charge_val) == desired_sign:
|
||||
ion_counts[residue.name] += 1
|
||||
if residue.name not in ion_atom_indices:
|
||||
ion_atom_indices[residue.name] = atom.index
|
||||
|
||||
@@ -437,22 +437,11 @@ class RelativeHybridTopologyProtocol(gufe.Protocol):
|
||||
)
|
||||
raise ValueError(errmsg)
|
||||
|
||||
# resolve ion names from SolventComponent or topology
|
||||
if isinstance(solvent_component, SolventComponent):
|
||||
positive_ion = solvent_component.positive_ion.strip("-+").upper()
|
||||
negative_ion = solvent_component.negative_ion.strip("-+").upper()
|
||||
ion = {-1: positive_ion, 1: negative_ion}[difference]
|
||||
wmsg = (
|
||||
f"A charge difference of {difference} is observed "
|
||||
"between the end states. This will be addressed by "
|
||||
f"transforming a water into a {ion} ion"
|
||||
)
|
||||
elif isinstance(solvent_component, SolvatedPDBComponent):
|
||||
wmsg = (
|
||||
f"A charge difference of {difference} is observed "
|
||||
"between the end states. This will be addressed by "
|
||||
"transforming a water into an ion."
|
||||
)
|
||||
wmsg = (
|
||||
f"A charge difference of {difference} is observed "
|
||||
"between the end states. This will be addressed by "
|
||||
"transforming a water into an ion of opposite charge."
|
||||
)
|
||||
logger.info(wmsg)
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -441,11 +441,10 @@ def test_get_charge_difference(mapping_name, result, request, caplog):
|
||||
mapping = request.getfixturevalue(mapping_name)
|
||||
caplog.set_level(logging.INFO)
|
||||
|
||||
ion = r"NA" if result == -1 else r"CL"
|
||||
msg = (
|
||||
f"A charge difference of {result} is observed "
|
||||
"between the end states. This will be addressed by "
|
||||
f"transforming a water into a {ion} ion"
|
||||
f"transforming a water into an ion of opposite charge"
|
||||
)
|
||||
|
||||
openmm_rfe.RelativeHybridTopologyProtocol._validate_charge_difference(
|
||||
|
||||
Reference in New Issue
Block a user