-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathSnakefile
117 lines (97 loc) · 5.03 KB
/
Snakefile
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
import re
WFN_FILE = 'stowfn.data'
WFN_TYPE = 'slater-type'
include: '../Snakefile'
STD_ERR = config['STD_ERR']
VMC_NCONFIG = config['VMC_NCONFIG']
MOLECULES = config['MOLECULES']
METHODS = config['METHODS']
BASES = config['BASES']
JASTROWS = config['JASTROWS']
def get_up_down(method, basis, molecule):
"""Get up and down electron numbers from XYZ output file.
"""
charge, mult = get_XYZ_charge_mul(molecule)
elec = get_XYZ_nel(molecule)
neu = (elec + mult - 1)//2
ned = (elec - mult + 1)//2
return neu, ned
rule ALL:
input:
expand('{method}/{basis}/{molecule}/VMC_DMC/emin/{jastrow}/tmax_1_1024_2/out', method=METHODS, basis=BASES, molecule=MOLECULES, jastrow=JASTROWS),
expand('{method}/{basis}/{molecule}/VMC_DMC/emin/{jastrow}/tmax_2_2048_2/out', method=METHODS, basis=BASES, molecule=MOLECULES, jastrow=JASTROWS),
expand('{method}/{basis}/{molecule}/VMC_DMC/emin/{jastrow}/tmax_4_4096_2/out', method=METHODS, basis=BASES, molecule=MOLECULES, jastrow=JASTROWS),
rule ALL_VMC_DMC:
input:
expand('{method}/{basis}/{molecule}/VMC_DMC/emin/{jastrow}/tmax_1_1024_2/out', method=METHODS, basis=BASES, molecule=MOLECULES, jastrow=JASTROWS),
expand('{method}/{basis}/{molecule}/VMC_DMC/emin/{jastrow}/tmax_2_2048_2/out', method=METHODS, basis=BASES, molecule=MOLECULES, jastrow=JASTROWS),
expand('{method}/{basis}/{molecule}/VMC_DMC/emin/{jastrow}/tmax_4_4096_2/out', method=METHODS, basis=BASES, molecule=MOLECULES, jastrow=JASTROWS),
rule ALL_VMC_DMC_BF:
input:
expand('{method}/{basis}/{molecule}/VMC_DMC_BF/emin_BF/{jastrow}__9_9_33/tmax_1_1024_2/out', method=METHODS, basis=BASES, molecule=MOLECULES, jastrow=JASTROWS),
expand('{method}/{basis}/{molecule}/VMC_DMC_BF/emin_BF/{jastrow}__9_9_33/tmax_2_2048_2/out', method=METHODS, basis=BASES, molecule=MOLECULES, jastrow=JASTROWS),
expand('{method}/{basis}/{molecule}/VMC_DMC_BF/emin_BF/{jastrow}__9_9_33/tmax_4_4096_2/out', method=METHODS, basis=BASES, molecule=MOLECULES, jastrow=JASTROWS),
rule ALL_VMC_OPT_ENERGY:
input:
expand('{method}/{basis}/{molecule}/VMC_OPT_ENERGY/emin/{jastrow}/1000000/out', method=METHODS, basis=BASES, molecule=MOLECULES, jastrow=JASTROWS),
rule ALL_VMC_OPT:
input:
expand('{method}/{basis}/{molecule}/VMC_OPT/emin/{jastrow}/out', method=METHODS, basis=BASES, molecule=MOLECULES, jastrow=JASTROWS),
rule ALL_VMC_OPT_BF:
input:
expand('{method}/{basis}/{molecule}/VMC_OPT_BF/emin_BF/{jastrow}__9_9_33/out', method=METHODS, basis=BASES, molecule=MOLECULES, jastrow=JASTROWS),
rule ALL_VMC:
input:
expand('{method}/{basis}/{molecule}/VMC/10000000/out', method=METHODS, molecule=MOLECULES, basis=BASES),
rule ALL_ADF:
input:
expand('{method}/{basis}/{molecule}/stowfn.data', method=METHODS, molecule=MOLECULES, basis=BASES),
###################################################################################################################
rule MDET:
input: '{method}/{basis}/{molecule}/output.dat'
output: '{method}/{basis}/{molecule}/correlation.data'
shell: 'cd "$(dirname "{output}")" && multideterminant.py 0 output.dat'
rule WFN:
input: '{method}/{basis}/{molecule}/output.dat'
output: '{method}/{basis}/{molecule}/stowfn.data'
shell: 'cd "$(dirname "{output}")" && adf2stowf.py'
#rule WFN:
# input: '{method}/{basis}/{molecule}/TAPE21.asc'
# output: '{method}/{basis}/{molecule}/stowfn.data'
# shell: 'cd "$(dirname "{output}")" && adf2stowf.py'
#rule TAPE21:
# input: '{method}/{basis}/{molecule}/output.dat'
# output: '{method}/{basis}/{molecule}/TAPE21.asc'
# shell: 'dmpkf "$(dirname "{output}")/TAPE21" > "{output}"'
rule ADF_RUN:
input: '{path}/input.dat'
output: '{path}/output.dat'
shell: 'cd "{wildcards.path}" && adf < input.dat > output.dat'
rule ADF_INPUT:
input: INPUTS_DIR + '/{molecule}.xyz'
output: '{method}/{basis}/{molecule}/input.dat'
run:
charge, multiplicity = get_XYZ_charge_mul(wildcards.molecule)
with open(input[0], 'r') as f:
f.readline() # skip first line
f.readline() # skip second line
molecule_data = f.read()[:-1] # skip last NL
with open(output[0], 'w') as f:
basis = wildcards.basis.replace('ZORA_', 'ZORA/')
splited_basis = basis.split('_')
basis = splited_basis[0]
if len(splited_basis) == 2:
# None, Small, Medium, Large
core = splited_basis[1]
else:
core = 'None'
f.write(open('adf.tmpl').read().format(
basis=basis,
core=core,
method=wildcards.method.replace('_', ' '),
molecule=wildcards.molecule,
charge=charge,
a_minus_b=multiplicity-1,
unrestricted='UNRESTRICTED' if multiplicity>1 else '',
molecule_data=molecule_data,
))