-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathscreen_data.py
63 lines (52 loc) · 1.93 KB
/
screen_data.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
# screen from SSW-NN to vasp-DFT
# JamesBourbon based on LASP-pylib in 20220502
import sys
from allstr_new import AllStr as AllStr_new
from allstr_new import BadStr
def screen_data(strfile, forcefile, nmax = 999999, maxF=10):
'''for screen structure in strfile and force if exist
key function for VASP-run str_file setting
if finished, outstr.arc will be print-out (if force input, outfor.arc be print-out)
noting by JamesBourbon in 20220402
'''
AllStr = AllStr_new()
if forcefile:
AllStr.read_arc(strfile,forcefile)
else :
AllStr.read_arc(strfile)
# Here can set HighE,MaxAngle,MinAngle
if len(AllStr)==0: return
# for screen structure/force data
b=BadStr()
# b.HighE=-3.0
b.MaxFor = maxF
b.MaxLat = 40
b.MinLat = 2.2
#
AllStr = AllStr.filter(b)
# main filter function use allstr_new.py and structure_new.py
if(len(AllStr) > nmax+50):
AllStr.random_arange(200)
AllStr = AllStr_new(AllStr[:(nmax+50)])
print('All Str:',len(AllStr))
#print 'present force',AllStr[0].Lfor
if len(AllStr)==0: return
if(len(AllStr) > nmax):
AllStr.random_arange(200)
AllStr = AllStr_new(AllStr[:(nmax)])
# AllStr.sort_by_energy()
print('Final Str Num:',len(AllStr))
if len(AllStr) >0:
AllStr.gen_arc(list(range(len(AllStr))),'outstr.arc',2)
if AllStr[0].Lfor:
AllStr.gen_forarc(list(range(len(AllStr))),'outfor.arc',2)
if __name__ == "__main__":
if len(sys.argv) == 3:
strfile, forfile = sys.argv[1:]
screen_data(strfile, forfile)
if len(sys.argv) == 4:
strfile, forfile, nmax = sys.argv[1:]
screen_data(strfile, forfile, nmax)
if len(sys.argv) == 5:
strfile, forfile, nmax, maxF = sys.argv[1:]
screen_data(strfile, forfile, nmax, maxF)