Skip to content

Commit

Permalink
unit test for solute GAV with resonance structures
Browse files Browse the repository at this point in the history
A unit test is added to check that the solute data are estimated
correctly using the GAV for the species with multiple resonance
structures. For the species with resonance structures, the
estimated solute data / solvation energy should match those estimated
for the first item in the species's molecule list.
  • Loading branch information
yunsiechung committed Nov 27, 2019
1 parent 90ef60c commit e6a704f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions rmgpy/data/solvationTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,28 @@ def test_solute_generation(self):
self.assertAlmostEqual(solute_data.L, L, places=2)
self.assertAlmostEqual(solute_data.A, A, places=2)

def test_solute_with_resonance_structures(self):
"""
Test we can estimate Abraham solute parameters correctly using group contributions
for the solute species with resonance structures.
"""
smiles = "CC1=CC=CC=C1N"
species = Species(smiles=smiles)
species.generate_resonance_structures()
solute_data = self.database.get_solute_data(species)
solvent_data = self.database.get_solvent_data('water')
solvation_correction = self.database.get_solvation_correction(solute_data, solvent_data)
dGsolv_spc = solvation_correction.gibbs / 1000
for mol in species.molecule:
spc = Species(molecule=[mol])
solute_data = self.database.get_solute_data_from_groups(spc)
solvation_correction = self.database.get_solvation_correction(solute_data, solvent_data)
dGsolv_mol = solvation_correction.gibbs / 1000
if mol == species.molecule[0]:
self.assertEqual(dGsolv_spc, dGsolv_mol)
else:
self.assertNotAlmostEqual(dGsolv_spc, dGsolv_mol)

def test_lone_pair_solute_generation(self):
"""Test we can obtain solute parameters via group additivity for a molecule with lone pairs"""
molecule = Molecule().from_adjacency_list(
Expand Down

0 comments on commit e6a704f

Please sign in to comment.