From 8e93013f8ebf2979a0c4e96fd25abe249bc30615 Mon Sep 17 00:00:00 2001 From: yunsiechung Date: Tue, 26 Nov 2019 21:23:41 -0500 Subject: [PATCH] added unittest to compare the radical and saturated Another uniitest is added to compare the radical and its saturated species solvation free energy in water. The test makes sure the two solvation energies are different. --- rmgpy/data/solvationTest.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/rmgpy/data/solvationTest.py b/rmgpy/data/solvationTest.py index 06402cf970..e7771701e1 100644 --- a/rmgpy/data/solvationTest.py +++ b/rmgpy/data/solvationTest.py @@ -195,9 +195,19 @@ def test_radical_and_lone_pair_generation(self): def test_radical_solute_group(self): """Test that the existing radical group is found for the radical species when using group additivity""" - species = Species(molecule=[Molecule(smiles='[OH]')]) - solute_data = self.database.get_solute_data_from_groups(species) - self.assertTrue('radical' in solute_data.comment) + # First check whether the radical group is found for the radical species + rad_species = Species(smiles='[OH]') + rad_solute_data = self.database.get_solute_data_from_groups(rad_species) + self.assertTrue('radical' in rad_solute_data.comment) + # Then check that the radical and its saturated species give different solvation free energies + saturated_struct = rad_species.molecule[0].copy(deep=True) + saturated_struct.saturate_radicals() + sat_species = Species(molecule=[saturated_struct]) + sat_solute_data = self.database.get_solute_data_from_groups(sat_species) + solvent_data = self.database.get_solvent_data('water') + rad_solvation_correction = self.database.get_solvation_correction(rad_solute_data, solvent_data) + sat_solvation_correction = self.database.get_solvation_correction(sat_solute_data, solvent_data) + self.assertNotAlmostEqual(rad_solvation_correction.gibbs / 1000, sat_solvation_correction.gibbs / 1000) def test_correction_generation(self): """Test we can estimate solvation thermochemistry."""