Skip to content
This repository was archived by the owner on Jul 7, 2019. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
925 changes: 924 additions & 1 deletion README.rst

Large diffs are not rendered by default.

Binary file added mpworks/.DS_Store
Binary file not shown.
Binary file added mpworks/docs/MPWorks_docs_old.docx
Binary file not shown.
Binary file added mpworks/docs/MPWorks_docs_old.pdf
Binary file not shown.
Binary file added mpworks/docs/a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mpworks/docs/b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mpworks/docs/c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mpworks/docs/d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mpworks/docs/e.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mpworks/docs/f.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mpworks/docs/g.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mpworks/docs/h.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mpworks/docs/original/a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mpworks/docs/original/b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mpworks/docs/original/c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mpworks/docs/original/d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mpworks/docs/original/e.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mpworks/docs/original/f.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mpworks/docs/original/g.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions mpworks/drones/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Drones package

The MPVaspDrone is currently used by the production workflow.

The drones package is an extension of the pymatgen-db drone, which converts a VASP directory into a database dictionary. The MPVaspDrone adds a "post_process" method and modifies some of the default drone behavior. It would be better if this could extend the existing drone rather than repeat a lot of the pymatgen-db drone, but it was not workable at the time of its creation.

For example, the signal detectors help tag extra things that have might gone wrong with the run, and put it in the key analysis.signals and analysis.critical_signals.

Another thing the custom drone does is SNL management. In particular, for structure optimizations it adds a new SNL to the SNL database (the newly optimized structure). For static runs (where the structure doesn't change), a new SNL is not added. The packages also add keys like "snlgroup_changed" which check whether the new and old SNL match after the relaxation run.
10 changes: 8 additions & 2 deletions mpworks/drones/mp_vaspdrone.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from pymatgen.entries.compatibility import MaterialsProjectCompatibility
from pymatgen.entries.computed_entries import ComputedEntry
from pymatgen.matproj.snl import StructureNL
from pymatgen.io.vaspio.vasp_output import Vasprun, Outcar
from pymatgen.io.vasp.outputs import Vasprun, Outcar
from pymatgen.analysis.structure_analyzer import oxide_type


Expand Down Expand Up @@ -245,7 +245,13 @@ def process_fw(self, dir_name, d):
d['snlgroup_id'] = fw_dict['spec']['snlgroup_id']
d['vaspinputset_name'] = fw_dict['spec'].get('vaspinputset_name')
d['task_type'] = fw_dict['spec']['task_type']

# Process data for deformed structures
if 'deformed' in d['task_type']:
d['deformation_matrix'] = fw_dict['spec']['deformation_matrix']
d['original_task_id'] = fw_dict['spec']['original_task_id']
if 'modified volume' in d['task_type']:
d['strainfactor'] = fw_dict['spec']['strainfactor']
d['original_task_id'] = fw_dict['spec']['original_task_id']
if not self.update_duplicates:
if 'optimize structure' in d['task_type'] and 'output' in d:
# create a new SNL based on optimized structure
Expand Down
3 changes: 3 additions & 0 deletions mpworks/dupefinders/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Dupefinders package

The Dupefinders are currently used by the production workflow. They are used to implement the duplicate checking within the production FireWorks.
3 changes: 3 additions & 0 deletions mpworks/examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Examples package

These are meant to be more simple examples of workflows than the production MP Workflows. They are referred to in the MPWorks docs. These are only examples meant as learning tools and are not used in production. The "fireworks-vasp" repo is a different attempt at this.
2 changes: 1 addition & 1 deletion mpworks/examples/Si_wf.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions mpworks/examples/firetasks_ex.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def __init__(self, parameters):
parameters = parameters if parameters else {}
self.update(parameters)
# get VaspJob objects from 'jobs' parameter in Firework
self.jobs = map(VaspJob.from_dict, parameters['jobs'])
self.jobs = parameters['jobs']
# get VaspHandler objects from 'handlers' parameter in Firework
self.handlers = map(MontyDecoder().process_decoded, parameters['handlers'])
self.handlers = parameters['handlers']
self.max_errors = parameters['max_errors']

def run_task(self, fw_spec):
Expand Down
15 changes: 8 additions & 7 deletions mpworks/examples/wf_ex.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from mpworks.firetasks.vasp_setup_tasks import SetupStaticRunTask
from pymatgen import Composition, Lattice
from pymatgen.core.structure import Structure
from pymatgen.io.vaspio_set import MPGGAVaspInputSet
from pymatgen.io.vasp.sets import MPRelaxSet

__author__ = 'Anubhav Jain'
__copyright__ = 'Copyright 2013, The Materials Project'
Expand All @@ -34,11 +34,12 @@ def structure_to_wf(structure):
connections = defaultdict(list) # dependencies between FireWorks

# generate VASP input objects for 1st VASP run - this is put in the FW spec
mpvis = MPGGAVaspInputSet(user_incar_settings={'NPAR': 2})
incar = mpvis.get_incar(structure)
poscar = mpvis.get_poscar(structure)
kpoints = mpvis.get_kpoints(structure)
potcar = mpvis.get_potcar(structure)
mpvis = MPRelaxSet(structure, user_incar_settings={'NPAR': 2,
"GGAU":False})
incar = mpvis.incar
poscar = mpvis.poscar
kpoints = mpvis.poscar
potcar = mpvis.poscar

# serialize the VASP input objects to the FW spec
spec = {}
Expand All @@ -51,7 +52,7 @@ def structure_to_wf(structure):
spec['task_type'] = 'GGA optimize structure (2x) example'

# set up the custodian that we want to run
jobs = VaspJob.double_relaxation_run('', gzipped=False)
jobs = VaspJob.double_relaxation_run('')
for j in jobs: # turn off auto npar, it doesn't work for >1 node
j.auto_npar = False
handlers = [VaspErrorHandler(), FrozenJobErrorHandler(), MeshSymmetryErrorHandler(),
Expand Down
5 changes: 5 additions & 0 deletions mpworks/firetasks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Firetasks package

This package is used by the production workflow.

It contains implementations of FireTasks that are connected into workflows.
29 changes: 16 additions & 13 deletions mpworks/firetasks/boltztrap_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def get_extreme(self, d, target, maximize=True, iso_cutoff=0.05, max_didx=None):
max_val = val
max_temp = float(t)
max_dope = d['doping'][te_type][didx]
max_mu = d['mu_doping'][te_type][t][didx]
max_mu = d['mu_doping'][te_type][str(t)][didx]

isotropic = evs['isotropic']
data[te_type] = {'value': max_val, 'temperature': max_temp, 'doping': max_dope, 'mu': max_mu, 'isotropic': isotropic}
Expand All @@ -121,7 +121,6 @@ def get_extreme(self, d, target, maximize=True, iso_cutoff=0.05, max_didx=None):

def run_task(self, fw_spec):
# import here to prevent import errors in bigger MPCollab
from mpcollab.thermoelectrics.boltztrap_TE import BoltztrapAnalyzerTE, BoltzSPB
# get the band structure and nelect from files
"""
prev_dir = get_loc(fw_spec['prev_vasp_dir'])
Expand All @@ -132,7 +131,7 @@ def run_task(self, fw_spec):
bs = vr.get_band_structure(kpoints_filename=kpoints_loc)
"""
filename = get_slug(
'JOB--' + fw_spec['mpsnl']['reduced_cell_formula_abc'] + '--'
'JOB--' + fw_spec['mpsnl'].structure.composition.reduced_formula + '--'
+ fw_spec['task_type'])
with open(filename, 'w+') as f:
f.write('')
Expand Down Expand Up @@ -177,6 +176,10 @@ def run_task(self, fw_spec):

# put the data in the database
bta = BoltztrapAnalyzer.from_files(dir)

# 8/21/15 - Anubhav removed fs_id (also see line further below, ted['boltztrap_full_fs_id'] ...)
# 8/21/15 - this is to save space in MongoDB, as well as non-use of full Boltztrap output (vs rerun)
"""
data = bta.as_dict()
data.update(get_meta_from_structure(bs._structure))
data['snlgroup_id'] = fw_spec['snlgroup_id']
Expand All @@ -188,26 +191,25 @@ def run_task(self, fw_spec):
del data['hall'] # remove because it is too large and not useful
fs = gridfs.GridFS(tdb, "boltztrap_full_fs")
btid = fs.put(json.dumps(jsanitize(data)))
"""

# now for the "sanitized" data
te_analyzer = BoltztrapAnalyzerTE.from_BoltztrapAnalyzer(bta)

ted = te_analyzer.as_dict()
ted = bta.as_dict()
del ted['seebeck']
del ted['hall']
del ted['kappa']
del ted['cond']

ted['boltztrap_full_fs_id'] = btid
# ted['boltztrap_full_fs_id'] = btid
ted['snlgroup_id'] = fw_spec['snlgroup_id']
ted['run_tags'] = fw_spec['run_tags']
ted['snl'] = fw_spec['mpsnl']
ted['snl'] = fw_spec['mpsnl'].as_dict()
ted['dir_name_full'] = dir
ted['dir_name'] = get_block_part(dir)
ted['task_id'] = m_task['task_id']

ted['pf_doping'] = te_analyzer.get_power_factor(tau=self.TAU).as_dict()
ted['zt_doping'] = te_analyzer.get_ZT(kappal=self.KAPPAL, tau=self.TAU).as_dict()
ted['pf_doping'] = bta.get_power_factor(output='tensor', relaxation_time=self.TAU)
ted['zt_doping'] = bta.get_zt(output='tensor', relaxation_time=self.TAU, kl=self.KAPPAL)

ted['pf_eigs'] = self.get_eigs(ted, 'pf_doping')
ted['pf_best'] = self.get_extreme(ted, 'pf_eigs')
Expand All @@ -231,7 +233,8 @@ def run_task(self, fw_spec):
ted['kappa_best_dope19'] = self.get_extreme(ted, 'kappa_eigs', maximize=False, max_didx=4)

try:
bzspb = BoltzSPB(te_analyzer)
from mpcollab.thermoelectrics.boltztrap_TE import BoltzSPB
bzspb = BoltzSPB(ted)
maxpf_p = bzspb.get_maximum_power_factor('p', temperature=0, tau=1E-14, ZT=False, kappal=0.5,\
otherprops=('get_seebeck_mu_eig', 'get_conductivity_mu_eig', \
'get_thermal_conductivity_mu_eig', 'get_average_eff_mass_tensor_mu'))
Expand Down Expand Up @@ -278,8 +281,8 @@ def run_task(self, fw_spec):
update_spec = {'prev_vasp_dir': fw_spec['prev_vasp_dir'],
'boltztrap_dir': os.getcwd(),
'prev_task_type': fw_spec['task_type'],
'mpsnl': fw_spec['mpsnl'],
'mpsnl': fw_spec['mpsnl'].as_dict(),
'snlgroup_id': fw_spec['snlgroup_id'],
'run_tags': fw_spec['run_tags'], 'parameters': fw_spec.get('parameters')}

return FWAction(update_spec=update_spec)
return FWAction(update_spec=update_spec)
6 changes: 3 additions & 3 deletions mpworks/firetasks/controller_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def run_task(self, fw_spec):

type_name = 'GGA+U' if 'GGA+U' in fw_spec['prev_task_type'] else 'GGA'

snl = StructureNL.from_dict(fw_spec['mpsnl'])
snl = fw_spec['mpsnl']
f = Composition(snl.structure.composition.reduced_formula).alphabetical_formula

fws = []
Expand Down Expand Up @@ -154,7 +154,7 @@ def run_task(self, fw_spec):
print 'Adding more runs...'
type_name = 'GGA+U' if 'GGA+U' in fw_spec['prev_task_type'] else 'GGA'

snl = StructureNL.from_dict(fw_spec['mpsnl'])
snl = fw_spec['mpsnl']
f = Composition(snl.structure.composition.reduced_formula).alphabetical_formula

fws = []
Expand Down Expand Up @@ -223,4 +223,4 @@ class DummyLegacyTask(FireTaskBase, FWSerializable):
_fw_name = "Dummy Legacy Task"

def run_task(self, fw_spec):
pass
pass
Loading