Commit 7d5783c2 authored by Lauri Himanen's avatar Lauri Himanen
Browse files

Some small things.

parent fbbd0f41
......@@ -201,7 +201,7 @@ def generate_input_metainfos(object_tree):
parent = Section("dummy")
root_section = object_tree.root_section
root_section.name = "CP2K_INPUT"
root_section.description = "The section containing all information that is explicitly stated in the CP2K input file. The sections that control printing (PRINT, EACH) and the hidden input keywords starting with a double underscore are not included."
root_section.description = "This section contains the explicitly stated keywords, default keywords, and section parameters in the CP2K input file. Only some of the sections that control printing (PRINT, EACH) are supported, because including all of them would double the size of this metadata without adding much useful information. The hidden input keywords starting with a double underscore are not included."
container = []
name_stack = []
generate_metainfo_recursively(root_section, parent, container, name_stack)
......
......@@ -4,6 +4,7 @@ import logging
from nomadcore.simple_parser import SimpleMatcher as SM
from nomadcore.simple_parser import extractOnCloseTriggers
from nomadcore.caching_backend import CachingLevel
from nomadcore.unit_conversion.unit_conversion import convert_unit
from inputparser import CP2KInputParser
logger = logging.getLogger("nomad")
......@@ -213,10 +214,10 @@ class CommonMatcher(object):
SM( " QS\|",
forwardMatch=True,
subMatchers=[
SM( " QS\| Method:\s+{}".format(self.regex_word)),
SM( " QS\| Method:\s+(?P<x_cp2k_quickstep_method>{})".format(self.regex_word)),
SM( " QS\| Density plane wave grid type\s+{}".format(self.regex_eol)),
SM( " QS\| Number of grid levels:\s+{}".format(self.regex_i)),
SM( " QS\| Density cutoff \[a\.u\.\]:\s+{}".format(self.regex_f)),
SM( " QS\| Density cutoff \[a\.u\.\]:\s+(?P<x_cp2k_planewave_cutoff>{})".format(self.regex_f)),
SM( " QS\| Multi grid cutoff \[a\.u\.\]: 1\) grid level\s+{}".format(self.regex_f)),
SM( " QS\| 2\) grid level\s+{}".format(self.regex_f)),
SM( " QS\| 3\) grid level\s+{}".format(self.regex_f)),
......@@ -342,6 +343,14 @@ class CommonMatcher(object):
backend.addValue("program_basis_set_type", "gaussian")
backend.addValue("electronic_structure_method", self.test_electronic_structure_method)
# See if the cutoff is available
cutoff = section.get_latest_value("x_cp2k_planewave_cutoff")
if cutoff is not None:
gid = backend.openSection("section_basis_set_cell_dependent")
cutoff = convert_unit(2*cutoff, "hartree")
backend.addValue("basis_set_planewave_cutoff", cutoff)
backend.closeSection("section_basis_set_cell_dependent", gid)
def onClose_section_method_basis_set(self, backend, gIndex, section):
backend.addValue("method_basis_set_kind", "wavefunction")
backend.addValue("number_of_basis_sets_atom_centered", len(self.basis_to_kind_mapping))
......
......@@ -397,6 +397,11 @@ class TestEnergyForce(unittest.TestCase):
self.assertEquals(name, "DZVP-GTH-PADE")
self.assertEquals(number, 14)
def test_section_basis_set_cell_dependent(self):
basis = self.results["section_basis_set_cell_dependent"][0]
cutoff = basis["basis_set_planewave_cutoff"][0]
self.assertEquals(cutoff, convert_unit(300.0, "hartree"))
def test_section_method_atom_kind(self):
kind = self.results["section_method_atom_kind"][0]
self.assertEqual(kind["method_atom_kind_atom_number"][0], 14)
......@@ -1017,14 +1022,14 @@ if __name__ == '__main__':
logger.setLevel(logging.ERROR)
suites = []
suites.append(unittest.TestLoader().loadTestsFromTestCase(TestErrors))
suites.append(unittest.TestLoader().loadTestsFromTestCase(TestXCFunctional))
suites.append(unittest.TestLoader().loadTestsFromTestCase(TestEnergyForce))
suites.append(unittest.TestLoader().loadTestsFromTestCase(TestStressTensorMethods))
suites.append(unittest.TestLoader().loadTestsFromTestCase(TestSelfInteractionCorrectionMethod))
suites.append(unittest.TestLoader().loadTestsFromTestCase(TestConfigurationPeriodicDimensions))
suites.append(unittest.TestLoader().loadTestsFromTestCase(TestSCFConvergence))
suites.append(unittest.TestLoader().loadTestsFromTestCase(TestForceFiles))
# suites.append(unittest.TestLoader().loadTestsFromTestCase(TestErrors))
# suites.append(unittest.TestLoader().loadTestsFromTestCase(TestXCFunctional))
# suites.append(unittest.TestLoader().loadTestsFromTestCase(TestEnergyForce))
# suites.append(unittest.TestLoader().loadTestsFromTestCase(TestStressTensorMethods))
# suites.append(unittest.TestLoader().loadTestsFromTestCase(TestSelfInteractionCorrectionMethod))
# suites.append(unittest.TestLoader().loadTestsFromTestCase(TestConfigurationPeriodicDimensions))
# suites.append(unittest.TestLoader().loadTestsFromTestCase(TestSCFConvergence))
# suites.append(unittest.TestLoader().loadTestsFromTestCase(TestForceFiles))
suites.append(unittest.TestLoader().loadTestsFromTestCase(TestPreprocessor))
suites.append(unittest.TestLoader().loadTestsFromTestCase(TestGeoOpt))
suites.append(unittest.TestLoader().loadTestsFromTestCase(TestGeoOptTrajFormats))
......
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