forked from lkwagner/autogenv2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Crystal2QMCRunner.py
49 lines (44 loc) · 1.58 KB
/
Crystal2QMCRunner.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from __future__ import print_function
import os
import numpy as np
import subprocess as sub
import shutil
from submitter import LocalSubmitter
import crystal2qmc
####################################################
class LocalCrystal2QMCRunner(LocalSubmitter):
""" Converts from a CRYSTAL run to a QWalk format"""
_name_='LocalCrystal2QMCRunner'
def __init__(self,qwbase='qw',propoutfn='prop.in.o',
kfmt='coord',kset='complex'):
self.qwbase=qwbase
self.propoutfn=propoutfn
self.kfmt=kfmt
self.kset=kset
self.kweights=""
#-------------------------------------------------
def is_consistent(self,other):
skipkeys = ['kweights']
for otherkey in other.__dict__.keys():
if otherkey not in self.__dict__.keys():
print('other is missing a key.')
return False
for selfkey in self.__dict__.keys():
if selfkey not in other.__dict__.keys():
print('self is missing a key.')
return False
for key in self.__dict__.keys():
if self.__dict__[key]!=other.__dict__[key] and key not in skipkeys:
print("Different keys [{}] = \n{}\n or \n {}"\
.format(key,self.__dict__[key],other.__dict__[key]))
return False
return True
#-------------------------------------------------
def check_status(self):
#We always just run it or not.
return 'ok'
#-------------------------------------------------
def run(self):
self.kweights=list(crystal2qmc.convert_crystal(self.qwbase,self.propoutfn,
self.kfmt,self.kset))
print(self.kweights)