Commit 30cbbae5 authored by Lauri Himanen's avatar Lauri Himanen

Made the code to use the new module structure in python-common.

parent 39930754
......@@ -4,7 +4,7 @@ import os
import re
import logging
import importlib
from nomadcore.baseclasses import ParserInterface
from nomadcore.parsing.baseclasses import ParserInterface
# Needs to be imported in order for the importlib calls to work in python 2.7
import cp2kparser.versions.cp2k262.singlepointparser
......
......@@ -3,10 +3,10 @@ from builtins import str
import re
import numpy as np
import logging
from nomadcore.simple_parser import SimpleMatcher as SM
from nomadcore.caching_backend import CachingLevel
from nomadcore.unit_conversion.unit_conversion import convert_unit
from nomadcore.baseclasses import CommonParser
from nomadcore.parsing.simple_parser import SimpleMatcher as SM
from nomadcore.parsing.caching_backend import CachingLevel
from nomadcore.parsing.unit_conversion import convert_unit
from nomadcore.parsing.baseclasses import CommonParser
from .inputparser import CP2KInputParser
from collections import defaultdict
logger = logging.getLogger("nomad")
......
......@@ -2,12 +2,12 @@ from __future__ import print_function
from __future__ import absolute_import
from builtins import next
from builtins import range
from nomadcore.simple_parser import SimpleMatcher as SM
from nomadcore.baseclasses import MainHierarchicalParser
import nomadcore.configurationreading
import nomadcore.csvparsing
from nomadcore.parsing.simple_parser import SimpleMatcher as SM
from nomadcore.parsing.baseclasses import MainHierarchicalParser
import nomadcore.parsing.configurationreading
import nomadcore.parsing.csvparsing
from .commonparser import CP2KCommonParser
from nomadcore.caching_backend import CachingLevel
from nomadcore.parsing.caching_backend import CachingLevel
import logging
logger = logging.getLogger("nomad")
......@@ -267,10 +267,10 @@ class CP2KGeoOptParser(MainHierarchicalParser):
# Use special parsing for CP2K pdb files because they don't follow the proper syntax
if traj_format == "PDB":
self.traj_iterator = nomadcore.csvparsing.iread(traj_file, columns=[3, 4, 5], start="CRYST", end="END")
self.traj_iterator = nomadcore.parsing.csvparsing.iread(traj_file, columns=[3, 4, 5], start="CRYST", end="END")
else:
try:
self.traj_iterator = nomadcore.configurationreading.iread(traj_file)
self.traj_iterator = nomadcore.parsing.configurationreading.iread(traj_file)
except ValueError:
pass
......
......@@ -3,12 +3,15 @@ standard_library.install_aliases()
from builtins import object
import os
import re
from io import StringIO
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import logging
import pickle
import numpy as np
from nomadcore.baseclasses import AbstractBaseParser
import nomadcore.configurationreading
from nomadcore.parsing.baseclasses import AbstractBaseParser
import nomadcore.parsing.configurationreading
from cp2kparser.generic.inputparsing import metainfo_data_prefix, metainfo_section_prefix
from pint import UnitRegistry
import ase
......
......@@ -2,13 +2,12 @@ from __future__ import absolute_import
from builtins import next
from builtins import range
import numpy as np
from nomadcore.simple_parser import SimpleMatcher as SM
from nomadcore.baseclasses import MainHierarchicalParser
import nomadcore.configurationreading
import nomadcore.csvparsing
from nomadcore.parsing.simple_parser import SimpleMatcher as SM
from nomadcore.parsing.baseclasses import MainHierarchicalParser
from .commonparser import CP2KCommonParser
from nomadcore.caching_backend import CachingLevel
from nomadcore.unit_conversion.unit_conversion import convert_unit
from nomadcore.parsing.caching_backend import CachingLevel
from nomadcore.parsing.unit_conversion import convert_unit
from nomadcore.parsing import configurationreading, csvparsing
import logging
logger = logging.getLogger("nomad")
......@@ -196,10 +195,10 @@ class CP2KMDParser(MainHierarchicalParser):
# Use special parsing for CP2K pdb files because they don't follow the proper syntax
if traj_format == "PDB":
self.traj_iterator = nomadcore.csvparsing.iread(coord_filepath, columns=[3, 4, 5], start="CRYST", end="END")
self.traj_iterator = csvparsing.iread(coord_filepath, columns=[3, 4, 5], start="CRYST", end="END")
else:
try:
self.traj_iterator = nomadcore.configurationreading.iread(coord_filepath)
self.traj_iterator = configurationreading.iread(coord_filepath)
except ValueError:
pass
......@@ -207,17 +206,17 @@ class CP2KMDParser(MainHierarchicalParser):
vel_format = self.cache_service["velocity_format"]
if vel_format is not None and vel_filepath is not None:
try:
self.vel_iterator = nomadcore.configurationreading.iread(vel_filepath)
self.vel_iterator = configurationreading.iread(vel_filepath)
except ValueError:
pass
# Setup energy file iterator
if energies_filepath is not None:
self.energy_iterator = nomadcore.csvparsing.iread(energies_filepath, columns=[0, 1, 2, 3, 4, 5, 6], comments="#")
self.energy_iterator = csvparsing.iread(energies_filepath, columns=[0, 1, 2, 3, 4, 5, 6], comments="#")
# Setup cell file iterator
if cell_filepath is not None:
self.cell_iterator = nomadcore.csvparsing.iread(cell_filepath, columns=[2, 3, 4, 5, 6, 7, 8, 9, 10], comments="#")
self.cell_iterator = csvparsing.iread(cell_filepath, columns=[2, 3, 4, 5, 6, 7, 8, 9, 10], comments="#")
def onClose_x_cp2k_section_md(self, backend, gIndex, section):
......
import logging
import numpy as np
from nomadcore.baseclasses import AbstractBaseParser
from nomadcore.parsing.baseclasses import AbstractBaseParser
logger = logging.getLogger("nomad")
......
from __future__ import absolute_import
from nomadcore.simple_parser import SimpleMatcher as SM
from nomadcore.baseclasses import MainHierarchicalParser
from nomadcore.parsing.simple_parser import SimpleMatcher as SM
from nomadcore.parsing.baseclasses import MainHierarchicalParser
from nomadcore.parsing.caching_backend import CachingLevel
from cp2kparser.versions.cp2k262.singlepointforceparser import CP2KSinglePointForceParser
from nomadcore.caching_backend import CachingLevel
from cp2kparser.versions.cp2k262.commonparser import CP2KCommonParser
import logging
logger = logging.getLogger("nomad")
......
......@@ -4,7 +4,7 @@ import unittest
import logging
import numpy as np
from cp2kparser import CP2KParser
from nomadcore.unit_conversion.unit_conversion import convert_unit
from nomadcore.parsing.unit_conversion import convert_unit
def get_result(folder, metaname=None):
......
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