-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdfh_test.py
More file actions
119 lines (88 loc) · 3.41 KB
/
dfh_test.py
File metadata and controls
119 lines (88 loc) · 3.41 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import os
import glob
import shutil
import callgrasp as GRASP
def dfh_grd(elements_Zlist, number_of_CPUs):
# Calculation for ground state
for n in range(2, 6):
# create input file and generate angular data
# copy csf list as input file
shutil.copyfile('./grd'+str(n)+'.c', 'rcsf.inp')
# Get angular data
GRASP.rangular(mpi_cores=number_of_CPUs)
for z in elements_Zlist:
# go to Z specific directory
os.chdir('Z'+str(z))
# clean directory and import files from main directory
GRASP.clean_files()
shutil.copyfile('../rcsf.inp', 'rcsf.inp')
for ang_file in glob.glob(r'../mcp.*'):
shutil.copy(ang_file, '.')
# Get initial estimates of wave functions
GRASP.rwfnestimate(init_guess=2, inputFile="grd"+str(n-1)+".w")
# Perform self-consistent field calculations (save log)
GRASP.rmcdhf(1,
orbitals=str(n)+"*",
spectroscopic_orbitals='',
output_log="outgrd_rmcdhf_"+str(n)
)
GRASP.rsave('grd'+str(n))
print('Done')
os.chdir('..')
return 0
def dfh_exc(elements_Zlist, number_of_CPUs):
# Calculation for excited state
for n in range(2, 7):
# create input file and generate angular data
# copy csf list as input file
shutil.copyfile('./exc'+str(n)+'.c', 'rcsf.inp')
# Get angular data
GRASP.rangular(mpi_cores=number_of_CPUs)
for z in elements_Zlist:
# go to Z specific directory
os.chdir('Z'+str(z))
# copy input file from parent directory
GRASP.clean_files()
shutil.copyfile('../rcsf.inp', 'rcsf.inp')
for ang_file in glob.glob(r'../mcp.*'):
shutil.copy(ang_file, '.')
# Get initial estimates of wave functions
GRASP.rwfnestimate(init_guess=2, inputFile="exc"+str(n-1)+".w")
# Perform self-consistent field calculations (save log)
ASF = [[1], [1, 2]]
weights = [5, 5]
GRASP.rmcdhf(ASF,
weights,
orbitals=str(n)+"*",
spectroscopic_orbitals='',
output_log="outexc_rmcdhf_"+str(n)
)
GRASP.rsave('exc'+str(n))
print('Done')
# back to test directory
os.chdir('..')
return 0
def rci_run(elements_Zlist, number_of_CPUs):
for z in elements_Zlist:
os.chdir('Z' + str(z))
ASF = [[1], [1, 2]]
GRASP.rci('grd5', 1, '1.d-6', H_normal_mass_shift='n', H_specific_mass_shift='n', selfenergy_limit=1,
output_log='outgrd_rci', mpi_cores=number_of_CPUs)
GRASP.rci('exc5', ASF, '1.d-6', H_normal_mass_shift='n', H_specific_mass_shift='n', selfenergy_limit=1,
output_log='outgrd_rci', mpi_cores=number_of_CPUs)
# back to test directory
os.chdir('..')
return 0
if __name__ == "__main__":
# set environmental variables
GRASP.setENV()
# go to working directory
os.chdir('test')
cores = 1
z_list = [2, 10, 74]
# dfh_grd(z_list, cores)
# dfh_exc(z_list, cores)
cores = 6
rci_run(z_list, cores)
# back to mian directory
os.chdir('..')