-
Notifications
You must be signed in to change notification settings - Fork 3
/
computeQ.py
executable file
·65 lines (49 loc) · 1.99 KB
/
computeQ.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
__author__ = 'JamesBourbon learn from zpliu-LASP_pythonlib'
# modifed from screenminimum -- only for compute Q
import time
import cmath as m
import os
import numpy as np
import random
import sys
#import template as Tp
import string
# sys.path.append('/home11/Liugroup/tools/')
from multiprocessing import Pool
from structure_new import Str, ParaWrap_SteinhartQ_cal ,ParaWrap_JudgeShape
from allstr_new import BadStr
from allstr_new import AllStr as allstr_new
if __name__ == "__main__":
allstr = allstr_new()
allstr.read_arc('all.arc') # structure file name of all.arc
print('All Str:',len(allstr))
Ncore = 56
print(' python job started at', time.strftime('%d/%m/%Y %H:%M:%S'))
# parallel version
#Ncore=4
# stage 1
f= ParaWrap_SteinhartQ_cal
results = allstr.para_run(f,Ncore)
record=0
b=[]
for x in results:
for y1,y2,y3,y4,y5,y6 in x.get():
record +=1
allstr[record-1].Q.append(y1)
allstr[record-1].Q.append(y2)
allstr[record-1].Q.append(y3)
allstr[record-1].Q.append(y4)
allstr[record-1].Q.append(y5)
allstr[record-1].Q.append(y6)
# if len(allstr) >0:
# allstr.Gen_arc(range(len(allstr)))
print("Summary of Stein-Q value Minimum")
print(" Q2 Q4 Q6 ")
for i in range(len(allstr)):
print("%5d %8.4f %8.4f %8.4f %8.4f "%(i,allstr[i].energy,float(allstr[i].Q[0]),float(allstr[i].Q[1]),float(allstr[i].Q[2])))
print('Finish ---------------------------------------------')
print("Summary of Distance-weighted Stein-Q value Minimum")
print(" Q2 Q4 Q6 ")
for i in range(len(allstr)):
print("%5d %8.4f %8.4f %8.4f %8.4f "%(i,allstr[i].energy,float(allstr[i].Q[3]),float(allstr[i].Q[4]),float(allstr[i].Q[5])))
print('Finish ---------------------------------------------')