forked from vanceeasleaf/aces
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.py
68 lines (60 loc) · 1.55 KB
/
App.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#from aces.env import SRCHOME,PROJHOME,PROJNAME
import json,os.path,time
from aces.runners.minimize import minimize as minimize_input
from importlib import import_module as im
from aces import profile,config
from aces.tools import *
class App:
def __init__(self):
"""
while not os.path.exists('app.json'):
time.sleep(1)
print pwd()+'/app.json'
"""
if exists('app.json'):
opt=loadjson('app.json')
elif exists('../app.json'):
opt=loadjson('../app.json')
elif exists('../../app.json'):
opt=loadjson('../../app.json')
elif exists('../../../app.json'):
opt=loadjson('../../../app.json')
else:exit('app.json lost!')
species=opt['species']
s=im('aces.materials.%s'%species)
m=s.structure(opt)
self.m=m
m.home=pwd()
assert m.home!=''
Runner=im('aces.runners.%s'%m.runner)
self.runner=Runner.runner(m)
def minimize(self):
if(self.m.copyN==-1):copymini=False
else: copymini=True
if copymini:
while not exists('../%d/minimize/done'%self.m.copyN):
sleep(30)
print 'copymini'
cp('../%d/minimize'%self.m.copyN,'.')
else:self.creatmini()
def creatmini(self):
print 'creatmini'
mkdir('minimize')
cd('minimize')
minimize_input(self.m)
write(time.strftime('%Y-%m-%d %H:%M:%S'),'done')
cd('..')
def execute(self):
self.minimize()
self.runner.run()
def result(self):
m=self.m
cd('minimize')
m.postMini()
cd('..')
profile.run(**m.__dict__)
class Apps:
def __init__():
obj=[json.loads(json_string) for json_string in open("qloops.txt")]
if __name__=='__main__':
App().execute()