1
1
"""
2
- This module defines the VaspInputSet abstract base class and a concrete
3
- implementation for the parameters developed and tested by the core team
4
- of pymatgen, including the Materials Virtual Lab, Materials Project and the MIT
5
- high throughput project. The basic concept behind an input set is to specify
6
- a scheme to generate a consistent set of VASP inputs from a structure
7
- without further user intervention. This ensures comparability across
8
- runs.
2
+ This module defines the VaspInputSet abstract base class and a concrete implementation for the parameters developed
3
+ and tested by the core team of pymatgen, including the Materials Virtual Lab, Materials Project and the MIT high
4
+ throughput project. The basic concept behind an input set is to specify a scheme to generate a consistent set of VASP
5
+ inputs from a structure without further user intervention. This ensures comparability across runs.
9
6
10
7
Read the following carefully before implementing new input sets:
11
8
12
- 1. 99% of what needs to be done can be done by specifying user_incar_settings
13
- to override some of the defaults of various input sets. Unless there is an
14
- extremely good reason to add a new set, DO NOT add one. E.g., if you want
9
+ 1. 99% of what needs to be done can be done by specifying user_incar_settings to override some of the defaults of
10
+ various input sets. Unless there is an extremely good reason to add a new set, DO NOT add one. E.g., if you want
15
11
to turn the Hubbard U off, just set "LDAU": False as a user_incar_setting.
16
- 2. All derivative input sets should inherit from one of the usual MPRelaxSet or
17
- MITRelaxSet, and proper superclass delegation should be used where possible.
18
- In particular, you are not supposed to implement your own as_dict or
19
- from_dict for derivative sets unless you know what you are doing.
20
- Improper overriding the as_dict and from_dict protocols is the major
21
- cause of implementation headaches. If you need an example, look at how the
22
- MPStaticSet or MPNonSCFSets are constructed.
12
+ 2. All derivative input sets should inherit from one of the usual MPRelaxSet or MITRelaxSet, and proper superclass
13
+ delegation should be used where possible. In particular, you are not supposed to implement your own as_dict or
14
+ from_dict for derivative sets unless you know what you are doing. Improper overriding the as_dict and from_dict
15
+ protocols is the major cause of implementation headaches. If you need an example, look at how the MPStaticSet or
16
+ MPNonSCFSets are constructed.
23
17
24
18
The above are recommendations. The following are UNBREAKABLE rules:
25
19
26
- 1. All input sets must take in a structure or list of structures as the first
27
- argument.
28
- 2. user_incar_settings, user_kpoints_settings and user_<whatever>_settings are
29
- ABSOLUTE. Any new sets you implement must obey this. If a user wants to
30
- override your settings, you assume he knows what he is doing. Do not
31
- magically override user supplied settings. You can issue a warning if you
32
- think the user is wrong.
33
- 3. All input sets must save all supplied args and kwargs as instance variables.
34
- E.g., self.my_arg = my_arg and self.kwargs = kwargs in the __init__. This
35
- ensures the as_dict and from_dict work correctly.
20
+ 1. All input sets must take in a structure or list of structures as the first argument.
21
+ 2. user_incar_settings, user_kpoints_settings and user_<whatever>_settings are ABSOLUTE. Any new sets you implement
22
+ must obey this. If a user wants to override your settings, you assume he knows what he is doing. Do not
23
+ magically override user supplied settings. You can issue a warning if you think the user is wrong.
24
+ 3. All input sets must save all supplied args and kwargs as instance variables. E.g., self.my_arg = my_arg and
25
+ self.kwargs = kwargs in the __init__. This ensures the as_dict and from_dict work correctly.
36
26
"""
37
27
38
28
from __future__ import annotations
@@ -1212,7 +1202,7 @@ class MatPESStaticSet(DictSet):
1212
1202
"""Creates input files for a MatPES static calculation.
1213
1203
1214
1204
The goal of MatPES is to generate PES data. This is a distinctly different from the objectives of the MP static
1215
- calculations, which aims to obtain primarily accurate energies and also electronic structure (DOS). For PES data,
1205
+ calculations, which aims to obtain accurate energies and electronic structure (DOS) primarily . For PES data,
1216
1206
force accuracy (and to some extent, stress accuracy) is of paramount importance.
1217
1207
1218
1208
It should be noted that the default POTCAR versions have been updated to PBE_54, rather than the old PBE set used
@@ -1222,6 +1212,9 @@ class MatPESStaticSet(DictSet):
1222
1212
1223
1213
CONFIG = _load_yaml_config ("MatPESStaticSet" )
1224
1214
1215
+ # These are parameters that we will inherit from any previous INCAR supplied. They are mostly parameters related
1216
+ # to symmetry and convergence set by Custodian when errors are encountered in a previous run. Given that our goal
1217
+ # is to have a strictly homogeneous PES data, all other parameters (e.g., ISMEAR, ALGO, etc.) are not inherited.
1225
1218
INHERITED_INCAR_PARAMS = (
1226
1219
"LPEAD" ,
1227
1220
"NGX" ,
@@ -1265,18 +1258,19 @@ def __init__(
1265
1258
super ().__init__ (structure , MatPESStaticSet .CONFIG , ** kwargs )
1266
1259
1267
1260
if xc_functional .upper () == "R2SCAN" :
1268
- self .user_incar_settings .setdefault ("METAGGA" , "R2SCAN" )
1269
- self .user_incar_settings .setdefault ("ALGO" , "ALL" )
1270
- self .user_incar_settings .setdefault ("GGA" , None )
1261
+ self .user_incar_settings ["METAGGA" ] = "R2SCAN"
1262
+ self .user_incar_settings ["ALGO" ] = "ALL"
1271
1263
elif xc_functional .upper () == "PBE+U" :
1272
- self ._config_dict [ "INCAR" ] ["LDAU" ] = True
1264
+ self .user_incar_settings ["LDAU" ] = True
1273
1265
elif xc_functional .upper () != "PBE" :
1274
1266
raise ValueError (
1275
1267
f"{ xc_functional } is not supported."
1276
1268
" The supported exchange-correlation functionals are PBE, PBE+U and R2SCAN."
1277
1269
)
1278
1270
if user_potcar_functional .upper () != "PBE_54" :
1279
- raise UserWarning (f"POTCAR version ({ user_potcar_functional } ) is inconsistent with the recommended PBE_54." )
1271
+ warnings .warn (
1272
+ f"POTCAR version ({ user_potcar_functional } ) is inconsistent with the recommended PBE_54." , UserWarning
1273
+ )
1280
1274
1281
1275
self .user_potcar_functional = user_potcar_functional .upper ()
1282
1276
0 commit comments