diff --git a/solventmapcreator/solvationcalculation/solvationcalculator.py b/solventmapcreator/solvationcalculation/solvationcalculator.py index 1ed157c3e096d4480be80a396505b8a408a2c603..eba12c08cde34cde9c57c60c57571836865f2b34 100644 --- a/solventmapcreator/solvationcalculation/solvationcalculator.py +++ b/solventmapcreator/solvationcalculation/solvationcalculator.py @@ -39,6 +39,16 @@ pairwise manner. As detailed in DOI: http://dx.doi.org/10.1039/c3sc22124e. """ EVDW = -5.6 +def calcluate_association_energy_matrix(epsilon_i_list, epsilon_j_list, temperature, theta, polynomial_coefficients): + """This iterates through and fills an array with all the solvation energies. + """ + association_matrix = np.zeros((len(epsilon_i_list), len(epsilon_j_list))) + for i in range(len(epsilon_i_list)): + for j in range(len(epsilon_j_list)): + association_energy = calculate_association_energy(epsilon_i_list[i], epsilon_j_list[j], temperature, theta, polynomial_coefficients) + association_matrix[i][j] = association_energy + return association_matrix + def calculate_association_energy(epsilon_i, epsilon_j, temperature, theta, polynomial_coefficients): """This calculates the energy described above """ diff --git a/solventmapcreator/test/solvationcalculationtest/solvationcalculatortest.py b/solventmapcreator/test/solvationcalculationtest/solvationcalculatortest.py index a479a06940b8a3466bf39a51e5e32f4c81b9983b..e566d405899fd7e9236e547c4b4df76faff0709a 100644 --- a/solventmapcreator/test/solvationcalculationtest/solvationcalculatortest.py +++ b/solventmapcreator/test/solvationcalculationtest/solvationcalculatortest.py @@ -24,6 +24,12 @@ class SolvationCalculatorTestCase(unittest.TestCase): def tearDown(self): """tear down after tests. """ + def test_calcluate_association_energy_matrix(self): + """Test to see if expected matrix is produced. + """ + expected_array = np.array([[-1.2500649680700651]]) + actual_array = solvationcalculator.calcluate_association_energy_matrix([1.0],[1.0], 298.0, 1.0, np.array([0.5, 1.0])) + np.testing.assert_array_almost_equal(expected_array, actual_array) def test_calculate_association_energy(self): """Test to see if expected_value is returned. """