Skip to content
Snippets Groups Projects
Commit d2d9a1e8 authored by Lauri Himanen's avatar Lauri Himanen
Browse files

Fixed issue with missing references from scc to method.

parent 7c1364dc
Branches
Tags
No related merge requests found
......@@ -258,6 +258,12 @@ class TestGeoOpt(unittest.TestCase):
result = self.results["number_of_frames_in_sequence"]
self.assertEqual(result, 5)
def test_single_configuration_calculation_to_system_ref(self):
result = self.results["section_single_configuration_calculation"]
for i_scc, scc in enumerate(result.values()):
self.assertEqual(scc["single_configuration_to_calculation_method_ref"], 0)
self.assertEqual(scc["single_configuration_calculation_to_system_ref"], i_scc)
def test_geometry_optimization_threshold_force(self):
result = self.results["geometry_optimization_threshold_force"]
expected_result = convert_unit(1.000000E-04, "bohr^-1*hartree")
......@@ -487,6 +493,12 @@ class TestMD(unittest.TestCase):
result = self.results["frame_sequence_temperature"]
self.assertTrue(np.array_equal(result, self.temp))
def test_single_configuration_calculation_to_system_ref(self):
result = self.results["section_single_configuration_calculation"]
for i_scc, scc in enumerate(result.values()):
self.assertEqual(scc["single_configuration_to_calculation_method_ref"], 0)
self.assertEqual(scc["single_configuration_calculation_to_system_ref"], i_scc)
def test_frame_sequence_time(self):
result = self.results["frame_sequence_time"]
expected_result = convert_unit(
......
......@@ -35,6 +35,9 @@ class CPMDCommonParser(CommonParser):
self.cache_service.add("print_freq", 1)
self.cache_service.add("configuration_periodic_dimensions", single=False, update=False)
self.cache_service.add("single_configuration_calculation_to_system_ref", single=False, update=True)
self.cache_service.add("single_configuration_to_calculation_method_ref", single=False, update=False)
#===========================================================================
# Common SimpleMatchers
def header(self):
......@@ -209,12 +212,24 @@ class CPMDCommonParser(CommonParser):
]
)
#===========================================================================
# onOpen triggers
def onOpen_section_method(self, backend, gIndex, section):
self.cache_service["single_configuration_to_calculation_method_ref"] = gIndex
def onOpen_section_system(self, backend, gIndex, section):
self.cache_service["single_configuration_calculation_to_system_ref"] = gIndex
#===========================================================================
# onClose triggers
def onClose_section_run(self, backend, gIndex, section):
backend.addValue("program_name", "CPMD")
backend.addValue("program_basis_set_type", "plane waves")
def onClose_section_single_configuration_calculation(self, backend, gIndex, section):
self.cache_service.addValue("single_configuration_calculation_to_system_ref")
self.cache_service.addValue("single_configuration_to_calculation_method_ref")
def onClose_section_system(self, backend, gIndex, section):
self.cache_service.addArrayValues("configuration_periodic_dimensions")
......
......@@ -108,9 +108,6 @@ class CPMDGeoOptParser(MainHierarchicalParser):
self.n_frames += 1
def onClose_section_single_configuration_calculation(self, backend, gIndex, section):
# For single point calculations there is only one method and system.
backend.addValue("single_configuration_calculation_to_system_ref", 0)
backend.addValue("single_configuration_to_calculation_method_ref", 0)
self.frame_refs.append(gIndex)
def onClose_section_frame_sequence(self, backend, gIndex, section):
......
......@@ -84,7 +84,7 @@ class CPMDMDParser(MainHierarchicalParser):
]
)
#=======================================================================
#===========================================================================
# onClose triggers
def onClose_section_sampling_method(self, backend, gIndex, section):
self.sampling_method_gid = gIndex
......@@ -108,7 +108,7 @@ class CPMDMDParser(MainHierarchicalParser):
if pot_mean is not None and pot_std is not None:
backend.addArrayValues("frame_sequence_potential_energy_stats", np.array([pot_mean, pot_std]), unit="hartree")
#=======================================================================
#===========================================================================
# adHoc
def parse_md(self):
"""Parses all the md step information.
......@@ -239,9 +239,6 @@ class CPMDMDParser(MainHierarchicalParser):
self.backend.addRealValue("energy_total", potential_energy, unit="hartree")
self.backend.addValue("time_calculation", tcpu)
# Add reference to system
self.backend.addValue("single_configuration_calculation_to_system_ref", sys_id)
# Close sections
self.backend.closeSection("section_single_configuration_calculation", scc_id)
self.backend.closeSection("section_system", sys_id)
......
......@@ -77,11 +77,6 @@ class CPMDSinglePointParser(MainHierarchicalParser):
def onClose_x_cpmd_section_scf(self, backend, gIndex, section):
backend.addValue("number_of_scf_iterations", self.n_scf_iterations)
def onClose_section_single_configuration_calculation(self, backend, gIndex, section):
# For single point calculations there is only one method and system.
backend.addValue("single_configuration_calculation_to_system_ref", 0)
backend.addValue("single_configuration_to_calculation_method_ref", 0)
def onClose_section_system(self, backend, gIndex, section):
self.cache_service.addArrayValues("atom_positions", "initial_positions", unit="bohr")
self.cache_service.addArrayValues("atom_labels")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment