Skip to content
Snippets Groups Projects
Commit e3a0ab05 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added metainfo python code.

parent a8b323f8
Branches
No related tags found
No related merge requests found
import sys
from nomad.metainfo import Environment
from nomad.metainfo.legacy import LegacyMetainfoEnvironment
import cpmdparser.metainfo.cpmd
import cpmdparser.metainfo.cpmd_general
import nomad.datamodel.metainfo.common
import nomad.datamodel.metainfo.public
import nomad.datamodel.metainfo.general
m_env = LegacyMetainfoEnvironment()
m_env.m_add_sub_section(Environment.packages, sys.modules['cpmdparser.metainfo.cpmd'].m_package) # type: ignore
m_env.m_add_sub_section(Environment.packages, sys.modules['cpmdparser.metainfo.cpmd_general'].m_package) # type: ignore
m_env.m_add_sub_section(Environment.packages, sys.modules['nomad.datamodel.metainfo.common'].m_package) # type: ignore
m_env.m_add_sub_section(Environment.packages, sys.modules['nomad.datamodel.metainfo.public'].m_package) # type: ignore
m_env.m_add_sub_section(Environment.packages, sys.modules['nomad.datamodel.metainfo.general'].m_package) # type: ignore
This diff is collapsed.
This diff is collapsed.
# Copyright 2016-2018 Lauri Himanen, Fawzi Mohamed, Ankit Kariryaa # Copyright 2016-2018 Lauri Himanen, Fawzi Mohamed, Ankit Kariryaa
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...@@ -208,7 +208,7 @@ class CPMDMDParser(MainHierarchicalParser): ...@@ -208,7 +208,7 @@ class CPMDMDParser(MainHierarchicalParser):
self.backend.addArrayValues("atom_velocities", velocities, unit="bohr/(hbar/hartree)") self.backend.addArrayValues("atom_velocities", velocities, unit="bohr/(hbar/hartree)")
forces = values[:, 7:10] forces = values[:, 7:10]
self.backend.addArrayValues("atom_forces", forces, unit="forceAu") self.backend.addArrayValues("atom_forces", forces, unit="hartree / bohr")
if trajec_file_iterator is None: if trajec_file_iterator is None:
pos = values[:, 1:4] pos = values[:, 1:4]
......
# Copyright 2016-2018 Lauri Himanen, Fawzi Mohamed, Ankit Kariryaa # Copyright 2016-2018 Lauri Himanen, Fawzi Mohamed, Ankit Kariryaa
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...@@ -474,14 +474,14 @@ class TestMD(unittest.TestCase): ...@@ -474,14 +474,14 @@ class TestMD(unittest.TestCase):
[0.15293653991241, -0.00036559789218, -0.00039617900820], [0.15293653991241, -0.00036559789218, -0.00039617900820],
[-0.15293653991238, 0.00036559789217, 0.00039617900820], [-0.15293653991238, 0.00036559789217, 0.00039617900820],
]), ]),
"forceAu" "hartree / bohr"
) )
expected_end = convert_unit( expected_end = convert_unit(
np.array([ np.array([
[-0.03595092814462, -0.00079338139843, -0.00085974499854], [-0.03595092814462, -0.00079338139843, -0.00085974499854],
[0.03595092814462, 0.00079338139843, 0.00085974499854], [0.03595092814462, 0.00079338139843, 0.00085974499854],
]), ]),
"forceAu" "hartree / bohr"
) )
self.assertTrue(np.array_equal(result[0, :], expected_start)) self.assertTrue(np.array_equal(result[0, :], expected_start))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment