Commit ea52d86d authored by Lauri Himanen's avatar Lauri Himanen

Fixed the issue with mixed basis set types.

parent c7f236b2
......@@ -68,6 +68,10 @@ class TestDFTGaussianEnergy(unittest.TestCase):
result = self.results["program_version"]
self.assertEqual(result, "6.6")
def test_program_basis_set_type(self):
result = self.results["program_basis_set_type"]
self.assertEqual(result, "gaussians")
def test_xc_functional(self):
result = self.results["XC_functional"]
self.assertEqual(result, "1.0*MGGA_C_TPSS+1.0*MGGA_X_TPSS")
......@@ -207,6 +211,10 @@ class TestDFTGaussianForce(unittest.TestCase):
result = self.results["configuration_periodic_dimensions"]
self.assertTrue(np.array_equal(result, np.array([False, False, False])))
def test_program_basis_set_type(self):
result = self.results["program_basis_set_type"]
self.assertEqual(result, "gaussians")
def test_electronic_structure_method(self):
result = self.results["electronic_structure_method"]
self.assertEqual(result, "DFT")
......@@ -236,6 +244,10 @@ class TestDFTGaussianGeoOpt(unittest.TestCase):
def setUpClass(cls):
cls.results = get_results("dft_gaussian/geo_opt", "section_run")
def test_program_basis_set_type(self):
result = self.results["program_basis_set_type"]
self.assertEqual(result, "gaussians")
def test_configuration_periodic_dimensions(self):
result = self.results["configuration_periodic_dimensions"][0]
self.assertTrue(np.array_equal(result, np.array([False, False, False])))
......@@ -414,6 +426,10 @@ class TestDFTGaussianMD(unittest.TestCase):
"K"
)
def test_program_basis_set_type(self):
result = self.results["program_basis_set_type"]
self.assertEqual(result, "gaussians")
def get_system(self, index):
scc = self.get_scc(index)
system_ref = scc["single_configuration_calculation_to_system_ref"]
......@@ -636,6 +652,10 @@ class TestDFTPWEnergy(unittest.TestCase):
result = self.results["program_name"]
self.assertEqual(result, "NWChem")
def test_program_basis_set_type(self):
result = self.results["program_basis_set_type"]
self.assertEqual(result, "plane waves")
def test_configuration_periodic_dimensions(self):
result = self.results["configuration_periodic_dimensions"][0]
self.assertTrue(np.array_equal(result, np.array([True, True, True])))
......
......@@ -21,6 +21,7 @@ class NWChemMainParser(MainHierarchicalParser):
# Cache for storing current method settings
self.method_cache = CacheService(self.parser_context)
self.method_cache.add("single_configuration_to_calculation_method_ref", single=False, update=False)
self.method_cache.add("program_basis_set_type", single=True, update=False)
# Cache for storing current sampling method settings
self.sampling_method_cache = CacheService(self.parser_context)
......@@ -80,7 +81,7 @@ class NWChemMainParser(MainHierarchicalParser):
subMatchers=[
self.energy_force_gaussian_task(),
self.energy_force_pw_task(),
self.geo_opt_module(),
self.gaussian_geo_opt_module(),
self.dft_gaussian_md_task(),
]
),
......@@ -107,6 +108,7 @@ class NWChemMainParser(MainHierarchicalParser):
def energy_force_gaussian_task(self):
return SM( " NWChem DFT Module",
startReAction=self.set_gaussian_basis,
forwardMatch=True,
subMatchers=[
self.dft_calculation_full(),
......@@ -117,6 +119,7 @@ class NWChemMainParser(MainHierarchicalParser):
def energy_force_pw_task(self):
return SM( " \* NWPW PSPW Calculation \*",
sections=["section_single_configuration_calculation", "section_system", "section_method"],
startReAction=self.set_plane_wave_basis,
fixedStartValues={
"electronic_structure_method": "DFT",
},
......@@ -162,8 +165,9 @@ class NWChemMainParser(MainHierarchicalParser):
],
)
def geo_opt_module(self):
def gaussian_geo_opt_module(self):
return SM( " NWChem Geometry Optimization",
startReAction=self.set_gaussian_basis,
sections=["section_frame_sequence", "section_sampling_method", "x_nwchem_section_geo_opt_module"],
subFlags=SM.SubFlags.Sequenced,
subMatchers=[
......@@ -221,6 +225,7 @@ class NWChemMainParser(MainHierarchicalParser):
def dft_gaussian_md_task(self):
return SM( " NWChem QMD Module",
startReAction=self.set_gaussian_basis,
sections=["section_frame_sequence", "section_sampling_method", "x_nwchem_section_qmd_module"],
subMatchers=[
SM(" QMD Run Parameters",
......@@ -421,7 +426,8 @@ class NWChemMainParser(MainHierarchicalParser):
# onClose triggers
def onClose_section_run(self, backend, gIndex, section):
backend.addValue("program_name", "NWChem")
backend.addValue("program_basis_set_type", "gaussians+plane_waves")
self.method_cache.addValue("program_basis_set_type")
# backend.addValue("program_basis_set_type", "gaussians+plane_waves")
def onClose_section_single_configuration_calculation(self, backend, gIndex, section):
self.scc_cache.addValue("single_configuration_calculation_to_system_ref")
......@@ -759,6 +765,12 @@ class NWChemMainParser(MainHierarchicalParser):
charge = groups[0]
self.backend.addValue("total_charge", round(float(charge)))
def set_gaussian_basis(self, backend, groups):
self.method_cache["program_basis_set_type"] = "gaussians"
def set_plane_wave_basis(self, backend, groups):
self.method_cache["program_basis_set_type"] = "plane waves"
#=======================================================================
# Misc
def debug_end(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment