forked from lkwagner/autogenv2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Crystal2QMCReader.py
35 lines (30 loc) · 1.2 KB
/
Crystal2QMCReader.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os,glob
class Crystal2QMCReader:
""" Tries to extract properties of crystal run, or else diagnose what's wrong. """
def __init__(self):
self.completed=False
self.out={}
#-------------------------------------------------
def collect(self,basename='qw'):
""" Collect results from output."""
self.out['sysfiles']=glob.glob(basename+"*.sys")
self.out['orbfiles']=glob.glob(basename+"*.orb")
self.out['slaterfiles']=glob.glob(basename+"*.slater")
if len(self.out['sysfiles'])!=len(self.out['orbfiles']) or\
len(self.out['orbfiles'])!=len(self.out['slaterfiles']):
print("Inconsistency in conversion!")
print(self.out['sysfiles'])
print(self.out['slaterfiles'])
print(self.out['orbfiles'])
self.completed=False
raise Error
self.out['basenames']=[x.replace('.sys','') for x in self.out['sysfiles']]
print(self.out['basenames'])
self.out['jastfiles']=[basename+".jast2" for x in self.out['basenames']]
self.completed=True
#-------------------------------------------------
def check_status(self,basename='qw'):
""" Decide status of conversion."""
status='ok'
print("status",status)
return status