1
- from atomate .vasp .config import (
2
- VASP_CMD ,
3
- DB_FILE ,
4
- )
5
1
from fireworks import Firework
6
- from pymatgen .io .vasp .sets import MPStaticSet , MPAbsorptionSet
7
- from atomate .common .firetasks .glue_tasks import (
8
- PassCalcLocs ,
9
- CopyFiles ,
10
- DeleteFiles ,
11
- GzipDir ,
12
- CreateFolder ,
13
- PassCalcLocs
14
- )
15
- from atomate .vasp .firetasks import (
16
- CheckBandgap ,
17
- CopyVaspOutputs ,
18
- ModifyIncar ,
19
- RunVaspCustodian ,
20
- VaspToDb ,
21
- )
22
- from atomate .vasp .firetasks .write_inputs import WriteVaspFromIOSet , WriteVaspStaticFromPrev
2
+ from pymatgen .io .vasp .sets import MPStaticSet
3
+
4
+ from atomate .common .firetasks .glue_tasks import PassCalcLocs
5
+ from atomate .vasp .config import DB_FILE , VASP_CMD
6
+ from atomate .vasp .firetasks import CopyVaspOutputs , RunVaspCustodian , VaspToDb
23
7
from atomate .vasp .firetasks .absorption_tasks import WriteVaspAbsorptionFromPrev
8
+ from atomate .vasp .firetasks .write_inputs import (
9
+ WriteVaspFromIOSet ,
10
+ WriteVaspStaticFromPrev ,
11
+ )
24
12
25
13
26
14
class AbsorptionFW (Firework ):
27
15
def __init__ (
28
- self ,
29
- structure ,
30
- name = "frequency dependent dielectrics" ,
31
- mode = ' STATIC' ,
32
- nbands = None ,
33
- nbands_factor = 2 ,
34
- reciprocal_density = 200 ,
35
- nkred = None ,
36
- nedos = 2001 ,
37
- vasp_cmd = VASP_CMD ,
38
- prev_calc_dir = None ,
39
- db_file = DB_FILE ,
40
- vasptodb_kwargs = None ,
41
- parents = None ,
42
- vasp_input_set_params = None ,
43
- ** kwargs ,
16
+ self ,
17
+ structure ,
18
+ name = "frequency dependent dielectrics" ,
19
+ mode = " STATIC" ,
20
+ nbands = None ,
21
+ nbands_factor = 2 ,
22
+ reciprocal_density = 200 ,
23
+ nkred = None ,
24
+ nedos = 2001 ,
25
+ vasp_cmd = VASP_CMD ,
26
+ prev_calc_dir = None ,
27
+ db_file = DB_FILE ,
28
+ vasptodb_kwargs = None ,
29
+ parents = None ,
30
+ vasp_input_set_params = None ,
31
+ ** kwargs ,
44
32
):
45
33
"""
46
34
FW that calculates frequency dependent dielectric function within
@@ -85,7 +73,9 @@ def __init__(
85
73
vasptodb_kwargs ["additional_fields" ]["task_label" ] = name
86
74
87
75
fw_name = "{}-{}-{}" .format (
88
- structure .composition .reduced_formula if structure else "unknown" , name , mode
76
+ structure .composition .reduced_formula if structure else "unknown" ,
77
+ name ,
78
+ mode ,
89
79
)
90
80
91
81
# define what wavecars to copy from the previous run
@@ -102,10 +92,12 @@ def __init__(
102
92
if mode == "IPA" or mode == "RPA" :
103
93
if prev_calc_dir :
104
94
# Copy the WAVECAR from previous calc directory
105
- t .append (CopyVaspOutputs (
106
- calc_dir = prev_calc_dir ,
107
- contcar_to_poscar = True ,
108
- additional_files = wavecars )
95
+ t .append (
96
+ CopyVaspOutputs (
97
+ calc_dir = prev_calc_dir ,
98
+ contcar_to_poscar = True ,
99
+ additional_files = wavecars ,
100
+ )
109
101
)
110
102
111
103
t .append (
@@ -119,17 +111,15 @@ def __init__(
119
111
reciprocal_density = reciprocal_density ,
120
112
nkred = nkred ,
121
113
nedos = nedos ,
122
- ** vasp_input_set_params
114
+ ** vasp_input_set_params ,
123
115
)
124
116
)
125
117
126
118
elif parents :
127
119
# Copy the WAVECAR from previous calc location
128
120
t .append (
129
121
CopyVaspOutputs (
130
- calc_loc = True ,
131
- contcar_to_poscar = True ,
132
- additional_files = wavecars
122
+ calc_loc = True , contcar_to_poscar = True , additional_files = wavecars
133
123
)
134
124
)
135
125
@@ -144,66 +134,80 @@ def __init__(
144
134
reciprocal_density = reciprocal_density ,
145
135
nkred = nkred ,
146
136
nedos = nedos ,
147
- ** vasp_input_set_params
137
+ ** vasp_input_set_params ,
148
138
)
149
139
)
150
140
151
141
else :
152
- raise ValueError ("Must specify previous calculation for {}" . format ( mode ) )
142
+ raise ValueError (f "Must specify previous calculation for { mode } " )
153
143
154
144
# when mode = "static"
155
145
elif mode == "STATIC" :
156
- static_incar = {"LWAVE" : True ,
157
- "ENCUT" : 500 ,
158
- "ISMEAR" : 0 ,
159
- "SIGMA" : 0.01 ,
160
- "LREAL" : False ,
161
- "GGA" : "PE" ,
162
- "LELF" : False ,
163
- "LAECHG" : False ,
164
- "LASPH" : False ,
165
- "LVHAR" : False ,
166
- "LVTOT" : False ,
167
- "METAGGA" : "None" ,
168
- "LMIXTAU" : False }
146
+ static_incar = {
147
+ "LWAVE" : True ,
148
+ "ENCUT" : 500 ,
149
+ "ISMEAR" : 0 ,
150
+ "SIGMA" : 0.01 ,
151
+ "LREAL" : False ,
152
+ "GGA" : "PE" ,
153
+ "LELF" : False ,
154
+ "LAECHG" : False ,
155
+ "LASPH" : False ,
156
+ "LVHAR" : False ,
157
+ "LVTOT" : False ,
158
+ "METAGGA" : "None" ,
159
+ "LMIXTAU" : False ,
160
+ }
169
161
170
162
if prev_calc_dir :
171
163
# Copy only the CONTCAR from previous calc directory (often a relaxation run)
172
164
t .append (
173
165
CopyVaspOutputs (
174
166
calc_dir = prev_calc_dir ,
175
167
contcar_to_poscar = True ,
176
- additional_files = wavecars
168
+ additional_files = wavecars ,
177
169
)
178
170
)
179
171
180
172
t .append (
181
- WriteVaspStaticFromPrev (reciprocal_density = reciprocal_density ,
182
- other_params = {"user_incar_settings" : static_incar })
173
+ WriteVaspStaticFromPrev (
174
+ reciprocal_density = reciprocal_density ,
175
+ other_params = {"user_incar_settings" : static_incar },
176
+ )
183
177
)
184
178
185
179
elif parents :
186
180
# Copy only the CONTCAR from previous calc
187
- t .append (CopyVaspOutputs (calc_loc = True ,
188
- additional_files = wavecars ,
189
- contcar_to_poscar = True )
190
- )
181
+ t .append (
182
+ CopyVaspOutputs (
183
+ calc_loc = True , additional_files = wavecars , contcar_to_poscar = True
184
+ )
185
+ )
191
186
192
187
t .append (
193
- WriteVaspStaticFromPrev (reciprocal_density = reciprocal_density ,
194
- other_params = {"user_incar_settings" : static_incar })
188
+ WriteVaspStaticFromPrev (
189
+ reciprocal_density = reciprocal_density ,
190
+ other_params = {"user_incar_settings" : static_incar },
191
+ )
195
192
)
196
193
197
194
elif structure :
198
- static_input_set = MPStaticSet (structure = structure ,
199
- reciprocal_density = reciprocal_density ,
200
- user_incar_settings = static_incar )
195
+ static_input_set = MPStaticSet (
196
+ structure = structure ,
197
+ reciprocal_density = reciprocal_density ,
198
+ user_incar_settings = static_incar ,
199
+ )
201
200
202
- t .append (WriteVaspFromIOSet (structure = structure , vasp_input_set = static_input_set )
203
- )
201
+ t .append (
202
+ WriteVaspFromIOSet (
203
+ structure = structure , vasp_input_set = static_input_set
204
+ )
205
+ )
204
206
205
207
else :
206
- raise ValueError ("Must specify structure or previous calculation for static calculation" )
208
+ raise ValueError (
209
+ "Must specify structure or previous calculation for static calculation"
210
+ )
207
211
208
212
else :
209
213
raise ValueError ("Must specify a mode from 'STATIC', 'IPA', or 'RPA'" )
@@ -216,15 +220,22 @@ def __init__(
216
220
RunVaspCustodian (
217
221
vasp_cmd = vasp_cmd ,
218
222
auto_npar = ">>auto_npar<<" ,
219
- handler_group = handler_group
223
+ handler_group = handler_group ,
220
224
)
221
225
)
222
226
t .append (PassCalcLocs (name = name ))
223
227
# Parse
224
- t .append (VaspToDb (db_file = db_file ,
225
- additional_fields = {
226
- "task_label" : structure .composition .reduced_formula + " " + name + " " + mode }))
228
+ t .append (
229
+ VaspToDb (
230
+ db_file = db_file ,
231
+ additional_fields = {
232
+ "task_label" : structure .composition .reduced_formula
233
+ + " "
234
+ + name
235
+ + " "
236
+ + mode
237
+ },
238
+ )
239
+ )
227
240
228
241
super ().__init__ (t , parents = parents , name = fw_name , ** kwargs )
229
-
230
-
0 commit comments