diff --git a/gufe/solventcomponent.py b/gufe/solventcomponent.py index 3736e0a5..a6d20b12 100644 --- a/gufe/solventcomponent.py +++ b/gufe/solventcomponent.py @@ -61,13 +61,13 @@ def __init__(self, *, # force kwarg usage norm = positive_ion.strip('-+').capitalize() if norm not in _CATIONS: raise ValueError(f"Invalid positive ion, got {positive_ion}") - positive_ion = norm + positive_ion = norm + '+' self._positive_ion = positive_ion if negative_ion is not None: norm = negative_ion.strip('-+').capitalize() if norm not in _ANIONS: raise ValueError(f"Invalid negative ion, got {negative_ion}") - negative_ion = norm + negative_ion = norm + '-' self._negative_ion = negative_ion self._neutralize = neutralize diff --git a/gufe/tests/test_solvents.py b/gufe/tests/test_solvents.py index a62975fb..81947d93 100644 --- a/gufe/tests/test_solvents.py +++ b/gufe/tests/test_solvents.py @@ -23,7 +23,8 @@ def test_hash(pos, neg): assert s1 == s2 assert hash(s1) == hash(s2) - + assert s2.positive_ion == 'Na+' + assert s2.negative_ion == 'Cl-' def test_neq(): s1 = SolventComponent(positive_ion='Na', negative_ion='Cl') @@ -36,8 +37,8 @@ def test_to_dict(): s = SolventComponent(positive_ion='Na', negative_ion='Cl') assert s.to_dict() == {'smiles': 'O', - 'positive_ion': 'Na', - 'negative_ion': 'Cl', + 'positive_ion': 'Na+', + 'negative_ion': 'Cl-', 'neutralize': True, 'ion_concentration': None}