Permalink
Browse files

Some cleanup.

  • Loading branch information...
1 parent 962a3e2 commit f0768000374222629b0de5890ddb644ee73666a8 @shyuep shyuep committed Feb 6, 2014
Showing with 13 additions and 15 deletions.
  1. +3 −3 dev_scripts/update_pt_data.py
  2. +10 −12 pymatgen/io/vaspio_set.py
View
6 dev_scripts/update_pt_data.py
@@ -117,17 +117,17 @@ def parse_radii():
toks = line.strip().split(",")
el = toks[1]
try:
- atomic_radii = float(toks[3])/ 100
+ atomic_radii = float(toks[3]) / 100
except:
atomic_radii = toks[3]
try:
- atomic_radii_calc = float(toks[4])/ 100
+ atomic_radii_calc = float(toks[4]) / 100
except:
atomic_radii_calc = toks[4]
try:
- vdw_radii = float(toks[5])/ 100
+ vdw_radii = float(toks[5]) / 100
except:
vdw_radii = toks[5]
View
22 pymatgen/io/vaspio_set.py
@@ -178,8 +178,8 @@ class DictVaspInputSet(AbstractVaspInputSet):
config_dict. Defaults to False, i.e., follow settings in
config_dict.
user_incar_settings (dict): User INCAR settings. This allows a user
- to override INCAR settings, e.g., setting a different MAGMOM for various elements
- or species.
+ to override INCAR settings, e.g., setting a different MAGMOM for
+ various elements or species.
constrain_total_magmom (bool): Whether to constrain the total magmom
(NUPDOWN in INCAR) to be the sum of the expected MAGMOM for all
species. Defaults to False.
@@ -219,7 +219,7 @@ def get_incar(self, structure):
structure = structure.get_sorted_structure()
comp = structure.composition
elements = sorted([el for el in comp.elements if comp[el] > 0],
- key=lambda el: el.X)
+ key=lambda e: e.X)
most_electroneg = elements[-1].symbol
poscar = Poscar(structure)
for key, setting in self.incar_settings.items():
@@ -267,7 +267,8 @@ def get_incar(self, structure):
del incar[key]
if self.set_nupdown:
- nupdown = sum([mag if abs(mag) > 0.6 else 0 for mag in incar['MAGMOM']])
+ nupdown = sum([mag if abs(mag) > 0.6 else 0
+ for mag in incar['MAGMOM']])
incar['NUPDOWN'] = nupdown
return incar
@@ -588,8 +589,8 @@ class MPStaticVaspInputSet(DictVaspInputSet):
kwargs:
hubbard_off (bool): Whether to turn off Hubbard U if it is specified in
- config_dict ("MP Static"). Defaults to False, i.e., follow settings in
- config_dict.
+ config_dict ("MP Static"). Defaults to False, i.e., follow settings
+ in config_dict.
user_incar_settings (dict): User INCAR settings. This allows a user
to override INCAR settings, e.g., setting a different MAGMOM for
various elements or species.
@@ -614,7 +615,7 @@ def __init__(self, kpoints_density=90, sym_prec=0.01, **kwargs):
"LORBIT": 11, "LVHAR": True, "LWAVE": False, "NSW": 0,
"ICHARG": 0, "EDIFF": 0.000001})
self.kpoints_settings.update({"kpoints_density": kpoints_density})
- self.sym_prec= sym_prec
+ self.sym_prec = sym_prec
def get_kpoints(self, structure):
"""
@@ -763,9 +764,6 @@ def from_previous_vasp_run(previous_vasp_dir, output_dir='.',
previous_incar.write_file(os.path.join(output_dir, "INCAR"))
# Prefer to use k-point scheme from previous run
- previous_kpoints_density = np.prod(previous_kpoints.kpts[0]) / \
- previous_final_structure.lattice.reciprocal_lattice.volume
- new_kpoints_density = max(previous_kpoints_density, kpoints_density)
new_kpoints = mpsvip.get_kpoints(structure)
if previous_kpoints.style[0] != new_kpoints.style[0]:
if previous_kpoints.style[0] == "M" and \
@@ -835,7 +833,7 @@ def __init__(self, user_incar_settings, mode="Line",
constrain_total_magmom=False, sort_structure=False,
kpoints_density=1000, sym_prec=0.01):
self.mode = mode
- self.sym_prec= sym_prec
+ self.sym_prec = sym_prec
if mode not in ["Line", "Uniform"]:
raise ValueError("Supported modes for NonSCF runs are 'Line' and "
"'Uniform'!")
@@ -918,7 +916,7 @@ def get_incar_settings(vasp_run, outcar=None):
incar_settings = {"ISPIN": ispin, "NBANDS": nbands}
for grid in ["NGX", "NGY", "NGZ"]:
if vasp_run.incar.get(grid):
- incar_settings.update({grid:vasp_run.incar.get(grid)})
+ incar_settings.update({grid: vasp_run.incar.get(grid)})
return incar_settings
def get_incar(self, structure):

0 comments on commit f076800

Please sign in to comment.