Skip to content

Commit

Permalink
Use refactored monty serialization.
Browse files Browse the repository at this point in the history
  • Loading branch information
shyuep committed Jul 30, 2014
1 parent 82a87a4 commit e9d2dfd
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions pymatgen/entries/compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from collections import defaultdict

from monty.design_patterns import cached_class
from monty.serialization import serial_loadf
from monty.serialization import loadfn

from pymatgen.io.vaspio_set import MITVaspInputSet, MPVaspInputSet
from pymatgen.core.periodic_table import Element
Expand Down Expand Up @@ -136,7 +136,7 @@ class GasCorrection(Correction):
corrections are to be applied or not.
"""
def __init__(self, config_file, correct_peroxide=True):
c = serial_loadf(config_file)
c = loadfn(config_file)
self.cpd_energies = c['Advanced']['CompoundEnergies']
self.oxide_correction = c['OxideCorrections']
self.name = c['Name']
Expand Down Expand Up @@ -203,7 +203,7 @@ class AqueousCorrection(Correction):
config_file: Path to the selected compatibility.yaml config file.
"""
def __init__(self, config_file):
c = serial_loadf(config_file)
c = loadfn(config_file)
self.cpd_energies = c['AqueousCompoundEnergies']
self.name = c["Name"]

Expand Down Expand Up @@ -262,7 +262,7 @@ def __init__(self, config_file, input_set, compat_type):
raise CompatibilityError("Invalid compat_type {}"
.format(compat_type))

c = serial_loadf(config_file)
c = loadfn(config_file)

self.input_set = input_set
if compat_type == 'Advanced':
Expand Down
18 changes: 9 additions & 9 deletions pymatgen/io/vaspio_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import numpy as np

from monty.serialization import serial_loadf
from monty.serialization import loadfn

from pymatgen.io.cifio import CifWriter
from pymatgen.io.vaspio.vasp_input import Incar, Poscar, Potcar, Kpoints
Expand Down Expand Up @@ -377,7 +377,7 @@ def from_file(name, filename, **kwargs):
Returns:
DictVaspInputSet
"""
return DictVaspInputSet(name, serial_loadf(filename), **kwargs)
return DictVaspInputSet(name, loadfn(filename), **kwargs)


MITVaspInputSet = partial(DictVaspInputSet.from_file, "MIT",
Expand Down Expand Up @@ -431,7 +431,7 @@ def __init__(self, nimages=8, user_incar_settings=None, **kwargs):

DictVaspInputSet.__init__(
self, "MIT NEB",
serial_loadf(os.path.join(MODULE_DIR, "MITVaspInputSet.yaml")),
loadfn(os.path.join(MODULE_DIR, "MITVaspInputSet.yaml")),
user_incar_settings=defaults, ediff_per_atom=False, **kwargs)
self.nimages = nimages

Expand Down Expand Up @@ -540,7 +540,7 @@ def __init__(self, start_temp, end_temp, nsteps, time_step=2,
defaults.update(user_incar_settings)
DictVaspInputSet.__init__(
self, "MIT MD",
serial_loadf(os.path.join(MODULE_DIR, "MITVaspInputSet.yaml")),
loadfn(os.path.join(MODULE_DIR, "MITVaspInputSet.yaml")),
hubbard_off=hubbard_off, sort_structure=sort_structure,
user_incar_settings=defaults, **kwargs)

Expand All @@ -554,7 +554,7 @@ def __init__(self, start_temp, end_temp, nsteps, time_step=2,
#use VASP default ENCUT
if 'ENCUT' not in self.user_incar_settings:
del self.incar_settings['ENCUT']

if not spin_polarized:
del self.incar_settings['MAGMOM']

Expand Down Expand Up @@ -645,7 +645,7 @@ class MPStaticVaspInputSet(DictVaspInputSet):
def __init__(self, kpoints_density=90, sym_prec=0.1, **kwargs):
DictVaspInputSet.__init__(
self, "MP Static",
serial_loadf(os.path.join(MODULE_DIR, "MPVaspInputSet.yaml")),
loadfn(os.path.join(MODULE_DIR, "MPVaspInputSet.yaml")),
**kwargs)
self.incar_settings.update(
{"IBRION": -1, "ISMEAR": -5, "LAECHG": True, "LCHARG": True,
Expand Down Expand Up @@ -848,7 +848,7 @@ class MPStaticDielectricDFPTVaspInputSet(DictVaspInputSet):
def __init__(self, user_incar_settings=None, ionic=True):
DictVaspInputSet.__init__(
self, "MaterialsProject Static Dielectric DFPT",
serial_loadf(os.path.join(MODULE_DIR, "MPVaspInputSet.yaml")))
loadfn(os.path.join(MODULE_DIR, "MPVaspInputSet.yaml")))
self.user_incar_settings = user_incar_settings if \
user_incar_settings is not None else {}
self.incar_settings.update(self.user_incar_settings)
Expand Down Expand Up @@ -887,7 +887,7 @@ def __init__(self, user_incar_settings=None, added_kpoints=[], mode="Line",
kpoints_density=100):
DictVaspInputSet.__init__(
self, "MaterialsProject HSE Band Structure",
serial_loadf(os.path.join(MODULE_DIR, "MPHSEVaspInputSet.yaml")))
loadfn(os.path.join(MODULE_DIR, "MPHSEVaspInputSet.yaml")))
self.user_incar_settings = user_incar_settings if \
user_incar_settings is not None else {}
self.incar_settings.update(
Expand Down Expand Up @@ -987,7 +987,7 @@ def __init__(self, user_incar_settings, mode="Line",
"'Uniform'!")
DictVaspInputSet.__init__(
self, "MaterialsProject Static",
serial_loadf(os.path.join(MODULE_DIR, "MPVaspInputSet.yaml")),
loadfn(os.path.join(MODULE_DIR, "MPVaspInputSet.yaml")),
constrain_total_magmom=constrain_total_magmom,
sort_structure=sort_structure)
self.user_incar_settings = user_incar_settings
Expand Down
2 changes: 1 addition & 1 deletion requirements-travis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ PyDispatcher==2.0.3
numpy==1.8.1
pybtex==0.17
requests==2.2.1
monty==0.2.4
monty==0.3.0
pyhull==1.4.3
pyyaml==3.10
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ numpy==1.8.1
pybtex==0.17
requests==2.2.1
scipy==0.14.0
monty==0.2.4
monty==0.3.0
pyhull==1.4.3
pyyaml>=3.10
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def get_spglib_ext():
version="2.9.13",
install_requires=["numpy>=1.5", "pyhull>=1.4.3", "PyCifRW>=3.3",
"requests>=1.0", "pybtex>=0.16", "pyyaml>=3.0",
"monty>=0.2.4"],
"monty>=0.3.0"],
extras_require={"electronic_structure": ["scipy>=0.10"],
"plotting": ["matplotlib>=1.1"],
"ase_adaptor": ["ase>=3.3"],
Expand Down

0 comments on commit e9d2dfd

Please sign in to comment.