Commit acc8eead authored by Mohamed, Fawzi Roberto (fawzi)'s avatar Mohamed, Fawzi Roberto (fawzi)
Browse files

python3: futurize step1

parent e00bb0ce
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
This is the access point to the parser for the scala layer in the This is the access point to the parser for the scala layer in the
nomad project. nomad project.
""" """
from __future__ import absolute_import
import sys import sys
import setup_paths from . import setup_paths
from nomadcore.parser_backend import JsonParseEventsWriterBackend from nomadcore.parser_backend import JsonParseEventsWriterBackend
from cp2kparser import CP2KParser from cp2kparser import CP2KParser
......
...@@ -12,6 +12,7 @@ The actual calculation input contents can later be added to this object. Then ...@@ -12,6 +12,7 @@ The actual calculation input contents can later be added to this object. Then
the object can be queried for the results, or the default values defined by the the object can be queried for the results, or the default values defined by the
cp2k_input.xml. cp2k_input.xml.
""" """
from __future__ import print_function
import xml.etree.cElementTree as ET import xml.etree.cElementTree as ET
import logging import logging
...@@ -68,7 +69,7 @@ def recursive_tree_generation(xml_element, for_metainfo=False, name_stack=[], ig ...@@ -68,7 +69,7 @@ def recursive_tree_generation(xml_element, for_metainfo=False, name_stack=[], ig
] ]
name = "/".join(name_stack) name = "/".join(name_stack)
if "/".join(name_stack) in kept_print_settings: if "/".join(name_stack) in kept_print_settings:
print "KEPT {}".format(name) print("KEPT {}".format(name))
ignore = False ignore = False
else: else:
return return
......
from __future__ import absolute_import
import re import re
import numpy as np import numpy as np
import logging import logging
...@@ -5,7 +6,7 @@ from nomadcore.simple_parser import SimpleMatcher as SM ...@@ -5,7 +6,7 @@ from nomadcore.simple_parser import SimpleMatcher as SM
from nomadcore.simple_parser import extractOnCloseTriggers from nomadcore.simple_parser import extractOnCloseTriggers
from nomadcore.caching_backend import CachingLevel from nomadcore.caching_backend import CachingLevel
from nomadcore.unit_conversion.unit_conversion import convert_unit from nomadcore.unit_conversion.unit_conversion import convert_unit
from inputparser import CP2KInputParser from .inputparser import CP2KInputParser
logger = logging.getLogger("nomad") logger = logging.getLogger("nomad")
......
from __future__ import print_function
from __future__ import absolute_import
from nomadcore.simple_parser import SimpleMatcher as SM from nomadcore.simple_parser import SimpleMatcher as SM
from nomadcore.baseclasses import MainHierarchicalParser from nomadcore.baseclasses import MainHierarchicalParser
from commonmatcher import CommonMatcher from .commonmatcher import CommonMatcher
import cp2kparser.generic.configurationreading import cp2kparser.generic.configurationreading
import cp2kparser.generic.csvparsing import cp2kparser.generic.csvparsing
from nomadcore.caching_backend import CachingLevel from nomadcore.caching_backend import CachingLevel
...@@ -303,5 +305,5 @@ class CP2KGeoOptParser(MainHierarchicalParser): ...@@ -303,5 +305,5 @@ class CP2KGeoOptParser(MainHierarchicalParser):
def debug(self): def debug(self):
def wrapper(parser): def wrapper(parser):
print "DEBUG" print("DEBUG")
return wrapper return wrapper
from __future__ import absolute_import
import numpy as np import numpy as np
from nomadcore.simple_parser import SimpleMatcher as SM from nomadcore.simple_parser import SimpleMatcher as SM
from nomadcore.baseclasses import MainHierarchicalParser from nomadcore.baseclasses import MainHierarchicalParser
from commonmatcher import CommonMatcher from .commonmatcher import CommonMatcher
import cp2kparser.generic.configurationreading import cp2kparser.generic.configurationreading
import cp2kparser.generic.csvparsing import cp2kparser.generic.csvparsing
from nomadcore.caching_backend import CachingLevel from nomadcore.caching_backend import CachingLevel
...@@ -296,7 +297,7 @@ class CP2KMDParser(MainHierarchicalParser): ...@@ -296,7 +297,7 @@ class CP2KMDParser(MainHierarchicalParser):
# Energy file # Energy file
if self.energy_iterator is not None: if self.energy_iterator is not None:
if (i_step + 1) % freqs["energies"][0] == 0: if (i_step + 1) % freqs["energies"][0] == 0:
line = self.energy_iterator.next() line = next(self.energy_iterator)
time = line[1] time = line[1]
kinetic_energy = line[2] kinetic_energy = line[2]
...@@ -317,7 +318,7 @@ class CP2KMDParser(MainHierarchicalParser): ...@@ -317,7 +318,7 @@ class CP2KMDParser(MainHierarchicalParser):
# Cell file # Cell file
if self.cell_iterator is not None: if self.cell_iterator is not None:
if (i_step + 1) % freqs["cell"][0] == 0: if (i_step + 1) % freqs["cell"][0] == 0:
line = self.cell_iterator.next() line = next(self.cell_iterator)
cell = np.reshape(line, (3, 3)) cell = np.reshape(line, (3, 3))
self.cache_service["simulation_cell"] = cell self.cache_service["simulation_cell"] = cell
......
from __future__ import absolute_import
from nomadcore.simple_parser import SimpleMatcher as SM from nomadcore.simple_parser import SimpleMatcher as SM
from nomadcore.baseclasses import MainHierarchicalParser from nomadcore.baseclasses import MainHierarchicalParser
from singlepointforceparser import CP2KSinglePointForceParser from .singlepointforceparser import CP2KSinglePointForceParser
from nomadcore.caching_backend import CachingLevel from nomadcore.caching_backend import CachingLevel
from commonmatcher import CommonMatcher from .commonmatcher import CommonMatcher
import logging import logging
logger = logging.getLogger("nomad") logger = logging.getLogger("nomad")
......
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