-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.py
53 lines (48 loc) · 2.18 KB
/
build.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
from __future__ import print_function
import sys
import argparse
from setup_class import isv
import os
def main(appnames,datafiles,structure_files,extserver=False):
if extserver:
apptype='server'
else:
apptype='stand_alone'
libfolder=os.path.join(os.path.abspath(os.path.dirname(__file__)),'app-base')
# print (libfolder)
sys.path.insert(0, libfolder)
# print (sys.path)
print ("Number of apps to build: ", len(datafiles))
for i in range(len(datafiles)):
print("Building: ", appnames[i] )
print("Datafile: ", datafiles[i] )
print("Structure File: ", structure_files[i] )
app=isv(appname=appnames[i],apptype=apptype)
app.setup(datafiles[i],structure_files[i])
print ("___________ Success !!_____________")
if extserver :
print (" run: python server.py --app ", ' '.join(appnames) )
print ("_______________________________________" )
else:
print (" run: bokeh serve ",' '.join(appnames) , "--show" )
print ("_______________________________________" )
if __name__=='__main__':
parser = argparse.ArgumentParser(description=""" Python Script to setup Interactive Sketchmap Visualizer """)
parser.add_argument("--data", nargs='+',type=str, help="Name of the files containing Sketchmap data and properties")
parser.add_argument("--traj", nargs='+',type=str, help="Name of the trajectory files containing structures. All formats supported by ase can be used")
parser.add_argument("--extserver",action="store_true", help="Optional argument: The setup will be done consistent to run with external server. Useful when you want to run multiple apps")
parser.add_argument("--app",nargs='+', type=str, help="Name of the apps you are creating")
args = parser.parse_args()
# try:appnames=args.app
# except:appnames=[]
nd=len(args.data)
nf=len(args.traj)
if (nd != nf): sys.exit("number of trajectory and data file mismatch")
# try: nn=len(args.app)
# except:
# nn=0
appnames=[]
for i in range(nd):
try: appnames.append(args.app[i])
except: appnames.append(os.path.basename(args.data[i])[:-4])
main(appnames,args.data,args.traj,args.extserver)