FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit b2450529 authored by M.D. Driver's avatar M.D. Driver
Browse files

added method to get fractional occupancy by giving solvent id.

parent 54d59cb6
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,13 @@ PHASE_NAMESPACE_DICT = {"phase":"http://www-hunter.ch.cam.ac.uk/PhaseSchema",
IDEAL_MAX_SSIP_CONCENTRATION_MOLAR = 300.0
def get_fractional_occupancy_for_solvent(solvent_list_element, solvent_id):
"""This extracts the solvent XML, and calculates the fractional occupancy
contribution for the solvent.
"""
solvent_element = get_solvent_element_by_id(solvent_list_element, solvent_id)
return calculate_fractional_occupancy_for_solvent(solvent_element)
def calculate_fractional_occupancy_for_solvent(solvent_element):
"""This calculates the contribution to the fractional occupancy from the solvent.
"""
......
......@@ -31,6 +31,12 @@ class SolventXMLReaderTestCase(unittest.TestCase):
del self.solvent_list_xml
del self.water_solvent_element
del self.water_molecule_element
def test_get_fractional_occupancy_for_solvent(self):
"""Test to see if expected fractional occupancy is returned.
"""
expected_value = 55.35 * 4.0 /300.0
actual_value = solventxmlreader.get_fractional_occupancy_for_solvent(self.solvent_list_xml, "water")
self.assertAlmostEqual(expected_value, actual_value)
def test_calculate_fractional_occupancy_for_solvent(self):
"""Test to see if expected value is returned for the fractional
occupancy.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment