Skip to content

Commit

Permalink
added unittest to compare the radical and saturated
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
yunsiechung committed Nov 27, 2019
1 parent 9370237 commit 8e93013
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions rmgpy/data/solvationTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit 8e93013

Please sign in to comment.