Commit dcc7da77 authored by Mikkel Strange's avatar Mikkel Strange

fix atkio2->atkio

parent ce58ded8
......@@ -4,6 +4,7 @@ from parser_configurations2 import parse_configuration
from parser_calculator import parse_calculator
import re
class Reader:
def __init__(self, fname):
self.atoms_x = {} # like {'gID0001': Atoms('H2')}
......@@ -14,7 +15,7 @@ class Reader:
for gid in gids:
conf_name = self.conf_names[gid]
calc_name = self.calc_names[gid]
fpt = self.finger_print_table[gid]
fpt = self.finger_print_table[gid] # req for for analysis parsing
self.atoms_x[gid] = parse_configuration(self.f, conf_name)
self.calculator_x[gid] = parse_calculator(self.f, calc_name)
......@@ -24,6 +25,7 @@ class Reader:
the finger print table which maps between calculated
quantities and configurations.
"""
self.atk_version = self.f.version[:].decode('utf-8').split()[-1]
self.conf_names = self._read_configuration_names()
self.calc_names = self._read_calculator_names()
self.finger_print_table = self._read_finger_print_table()
......@@ -69,12 +71,22 @@ class Reader:
return len(self.conf_names)
def get_atoms(self, n=-1):
"""ASE atoms for sorted gID's
"""
key = [key for key in sorted(self.atoms_x.keys(), reverse=True)][n]
return self.atoms_x[key]
return self.atoms_x[key]
def get_calculator(self, n=-1):
"""LCAOCalculator for sorted gID's
"""
key = [key for key in sorted(self.calculator_x.keys(),
reverse=True)][n]
return self.calculator_x[key]
if __name__ == '__main__':
import sys
r = Reader(sys.argv[1])
for key,value in r.atoms_x.items():
for key, value in r.atoms_x.items():
print(key,value)
print(r.get_atoms(0))
......@@ -4,7 +4,7 @@ from contextlib import contextmanager
import numpy as np
from ase import units
from ase.data import chemical_symbols
from atkio2 import Reader
from atkio import Reader
from scipy.io.netcdf import netcdf_file
from ase.data import atomic_masses
from ase.units import Rydberg
......@@ -46,8 +46,8 @@ def parse(filename):
r = Reader(filename) # Reader(filename)
index = 0 # need to loop over index at some point if more that one conf per
# file
r.calculator = r.calculators[0]
r.atoms = r.configurations_atoms[0]
r.calculator = r.get_calculator(index)
r.atoms = r.get_atoms(index)
p.startedParsingSession(filename, parser_info)
with o(p, 'section_run'):
p.addValue('program_name', 'ATK')
......
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