atomate.vasp package — atomate 0.9.2 documentation

# atomate.vasp package

## Subpackages

- atomate.vasp.analysis package
  - Submodules
  - atomate.vasp.analysis.phonopy module
  - Module contents
- atomate.vasp.builders package
  - Subpackages
    - atomate.vasp.builders.examples package
      - Submodules
      - atomate.vasp.builders.examples.run_builders module
      - Module contents
  - Submodules
  - atomate.vasp.builders.bandgap_estimation module
  - atomate.vasp.builders.base module
  - atomate.vasp.builders.boltztrap_materials module
  - atomate.vasp.builders.dielectric module
  - atomate.vasp.builders.file_materials module
  - atomate.vasp.builders.fix_tasks module
  - atomate.vasp.builders.materials_descriptor module
  - atomate.vasp.builders.materials_ehull module
  - atomate.vasp.builders.tags module
  - atomate.vasp.builders.tasks_materials module
  - atomate.vasp.builders.utils module
  - Module contents
- atomate.vasp.firetasks package
  - Subpackages
    - atomate.vasp.firetasks.tests package
      - Submodules
      - atomate.vasp.firetasks.tests.test_copy module
      - atomate.vasp.firetasks.tests.test_get_interpolated_poscar module
      - atomate.vasp.firetasks.tests.test_polarization_to_db module
      - atomate.vasp.firetasks.tests.test_write_vasp module
      - atomate.vasp.firetasks.tests.test_write_vasp_from_interpolated_poscar module
      - Module contents
  - Submodules
  - atomate.vasp.firetasks.glue_tasks module
  - atomate.vasp.firetasks.neb_tasks module
  - atomate.vasp.firetasks.parse_outputs module
  - atomate.vasp.firetasks.run_calc module
  - atomate.vasp.firetasks.write_inputs module
  - Module contents
- atomate.vasp.fireworks package
  - Submodules
  - atomate.vasp.fireworks.core module
  - atomate.vasp.fireworks.nmr module
  - atomate.vasp.fireworks.polarization module
  - Module contents
- atomate.vasp.tests package
  - Submodules
  - atomate.vasp.tests.test_drones module
  - atomate.vasp.tests.test_setup module
  - atomate.vasp.tests.test_vasp_powerups module
  - Module contents
- atomate.vasp.workflows package
  - Subpackages
    - atomate.vasp.workflows.base package
      - Submodules
      - atomate.vasp.workflows.base.adsorption module
      - atomate.vasp.workflows.base.bulk_modulus module
      - atomate.vasp.workflows.base.core module
      - atomate.vasp.workflows.base.deformations module
      - atomate.vasp.workflows.base.elastic module
      - atomate.vasp.workflows.base.ferroelectric module
      - atomate.vasp.workflows.base.gibbs module
      - atomate.vasp.workflows.base.magnetism module
      - atomate.vasp.workflows.base.neb module
      - atomate.vasp.workflows.base.raman module
      - atomate.vasp.workflows.base.thermal_expansion module
      - Module contents
    - atomate.vasp.workflows.presets package
      - Submodules
      - atomate.vasp.workflows.presets.core module
      - atomate.vasp.workflows.presets.scan module
      - Module contents
    - atomate.vasp.workflows.tests package
      - Submodules
      - atomate.vasp.workflows.tests.test_adsorbate_workflow module
      - atomate.vasp.workflows.tests.test_bulk_modulus_workflow module
      - atomate.vasp.workflows.tests.test_elastic_workflow module
      - atomate.vasp.workflows.tests.test_ferroelectric_workflow module
      - atomate.vasp.workflows.tests.test_magnetism_workflow module
      - atomate.vasp.workflows.tests.test_neb_workflow module
      - atomate.vasp.workflows.tests.test_nmr module
      - atomate.vasp.workflows.tests.test_raman_workflow module
      - atomate.vasp.workflows.tests.test_vasp_workflows module
      - Module contents
  - Module contents

## Submodules

## atomate.vasp.config module

## atomate.vasp.database module

class `atomate.vasp.database.` `VaspCalcDb`(host='localhost', port=27017, database='vasp', collection='tasks', user=None, password=None, **kwargs)

  Bases: `atomate.utils.database.CalcDb`

  Class to help manage database insertions of Vasp drones

  `__init__`(host='localhost', port=27017, database='vasp', collection='tasks', user=None, password=None, **kwargs)

    Initialize self. See help(type(self)) for accurate signature.

  `build_indexes`(indexes=None, background=True)

    Build the indexes.

    Args:

      indexes (list): list of single field indexes to be built. background (bool): Run in the background or not.

    TODO: make sure that the index building is sensible and check for

      existing indexes.

  `get_aeccar`(task_id, check_valid=True)

    Read the AECCAR0 + AECCAR2 grid_fs data into a Chgcar object Args:

    > task_id(int or str): the task_id containing the gridfs metadata check_valid (bool): make sure that the aeccar is positive definite

    Returns:

      {“aeccar0” : Chgcar, “aeccar2” : Chgcar}: dict of Chgcar objects

  `get_band_structure`(task_id)
  `get_chgcar`(task_id)

    Read the CHGCAR grid_fs data into a Chgcar object Args:

    > task_id(int or str): the task_id containing the gridfs metadata

    Returns:

      chgcar: Chgcar object

  `get_chgcar_string`(task_id)
  `get_dos`(task_id)
  `insert_gridfs`(d, collection='fs', compress=True, oid=None, task_id=None)

    Insert the given document into GridFS.

    Args:

      d (dict): the document collection (string): the GridFS collection name compress (bool): Whether to compress the data or not oid (ObjectId()): the _id of the file; if specified, it must not already exist in GridFS task_id(int or str): the task_id to store into the gridfs metadata

    Returns:

      file id, the type of compression used.

  `insert_task`(task_doc, use_gridfs=False)

    Inserts a task document (e.g., as returned by Drone.assimilate()) into the database. Handles putting DOS, band structure and charge density into GridFS as needed. During testing, a percentage of runs on some clusters had corrupted AECCAR files when even if everything else about the calculation looked OK. So we do a quick check here and only record the AECCARs if they are valid

    Args:

      task_doc: (dict) the task document use_gridfs (bool) use gridfs for bandstructures and DOS

    Returns:

      (int) - task_id of inserted document

  `reset`()
  `retrieve_task`(task_id)

    Retrieves a task document and unpacks the band structure and DOS as dict

    Args:

      task_id: (int) task_id to retrieve

    Returns:

      (dict) complete task document with BS + DOS included

## atomate.vasp.drones module

class `atomate.vasp.drones.` `VaspDrone`(runs=None, parse_dos='auto', bandstructure_mode='auto', parse_locpot=True, additional_fields=None, use_full_uri=True, parse_bader=None, parse_chgcar=False, parse_aeccar=False)

  Bases: `pymatgen.apps.borg.hive.AbstractDrone`

  pymatgen-db VaspToDbTaskDrone with updated schema and documents processing methods. Please refer to matgendb.creator.VaspToDbTaskDrone documentation.

  `__init__`(runs=None, parse_dos='auto', bandstructure_mode='auto', parse_locpot=True, additional_fields=None, use_full_uri=True, parse_bader=None, parse_chgcar=False, parse_aeccar=False)

    Initialize a Vasp drone to parse vasp outputs Args:

    > runs (list): Naming scheme for multiple calcuations in on folder e.g. [“relax1”,”relax2”].

    >   Can be subfolder or extension

    > parse_dos (str or bool): Whether to parse the DOS. Can be “auto”, True or False. “auto” will only parse DOS if NSW = 0, so there are no ionic steps bandstructure_mode (str or bool): How to parse the bandstructure or not. Can be “auto”,”line”, True or False.

    > > “auto” will parse the bandstructure with projections for NSCF calcs and decide automatically

    > >   if it’s line mode or uniform. Saves the bandstructure in the output doc.

    > > “line” will parse the bandstructure as a line mode calculation with projections.

    > >   Saves the bandstructure in the output doc.

    > > True will parse the bandstructure with projections as a uniform calculation.

    > >   Saves the bandstructure in the output doc.

    > > False will parse the bandstructure without projections to calculate vbm, cbm, band_gap, is_metal and efermi

    > >   Dose not saves the bandstructure in the output doc.

    > parse_locpot (bool): Parses the LOCPOT file and saves the 3 axis averages additional_fields (dict): dictionary of additional fields to add to output document use_full_uri (bool): converts the directory path to the full URI path parse_bader (bool): Run and parse Bader charge data. Defaults to True if Bader is present parse_chgcar (bool): Run and parse CHGCAR file parse_aeccar (bool): Run and parse AECCAR0 and AECCAR2 files

  `as_dict`()

    A JSON serializable dict representation of an object.

  `assimilate`(path)

    Adapted from matgendb.creator Parses vasp runs(vasprun.xml file) and insert the result into the db. Get the entire task doc from the vasprum.xml and the OUTCAR files in the path. Also adds some post-processed info.

    Args:

      path (str): Path to the directory containing vasprun.xml and OUTCAR files

    Returns:

      (dict): a task dictionary

  `filter_files`(path, file_pattern='vasprun.xml')

    Find the files that match the pattern in the given path and return them in an ordered dictionary. The searched for files are filtered by the run types defined in self.runs. e.g. [“relax1”, “relax2”, …]. Only 2 schemes of the file filtering is enabled: searching for run types in the list of files and in the filenames. Modify this method if more sophisticated filtering scheme is needed.

    Args:

      path (string): path to the folder file_pattern (string): files to be searched for

    Returns:

      OrderedDict of the names of the files to be processed further. The key is set from list of run types: self.runs

  classmethod `from_dict`(d)
  `generate_doc`(dir_name, vasprun_files, outcar_files)

    Adapted from matgendb.creator.generate_doc

  `get_valid_paths`(path)

    There are some restrictions on the valid directory structures:

    1. There can be only one vasp run in each directory. Nested directories are fine.

    2. Directories designated “relax1”…”relax9” are considered to be parts of a multiple-optimization run.

    3. Directories containing vasp output with “.relax1”…”.relax9” are also considered as parts of a multiple-optimization run.

  `post_process`(dir_name, d)

    Post-processing for various files other than the vasprun.xml and OUTCAR. Looks for files: transformations.json and custodian.json. Modify this if other output files need to be processed.

    Args:
      dir_name:

        The dir_name.

      d:

        Current doc generated.

  `process_bandstructure`(vrun)
  classmethod `process_chgcar`(chg_file)
  `process_dos`(vrun)
  `process_raw_data`(dir_name, taskname='standard')

    It is useful to store what raw data has been calculated and exists for easier querying of the taskdoc.

    Parameters

      - dir_name – directory to search

      - taskname – taskname, e.g. “relax1”

    Returns

      dict of files present

  `process_vasprun`(dir_name, taskname, filename)

    Adapted from matgendb.creator

    Process a vasprun.xml file.

  `schema` = {'analysis': {'delta_volume', 'delta_volume_as_percent', 'errors', 'max_force', 'warnings'}, 'calcs_reversed': {'completed_at', 'composition_reduced', 'composition_unit_cell', 'dir_name', 'elements', 'formula_anonymous', 'formula_pretty', 'formula_reduced_abc', 'has_vasp_completed', 'input', 'nelements', 'nsites', 'output', 'run_type', 'task', 'vasp_version'}, 'input': {'hubbards', 'is_hubbard', 'is_lasph', 'potcar_spec', 'pseudo_potential', 'structure', 'xc_override'}, 'output': {'bandgap', 'cbm', 'density', 'energy', 'energy_per_atom', 'forces', 'is_gap_direct', 'is_metal', 'spacegroup', 'stress', 'structure', 'vbm'}, 'root': {'analysis', 'calcs_reversed', 'chemsys', 'completed_at', 'composition_reduced', 'composition_unit_cell', 'dir_name', 'elements', 'formula_anonymous', 'formula_pretty', 'formula_reduced_abc', 'input', 'nelements', 'nsites', 'output', 'run_stats', 'schema', 'state'}}
  static `set_analysis`(d, max_force_threshold=0.5, volume_change_threshold=0.2)

    Adapted from matgendb.creator

    set the ‘analysis’ key

  `validate_doc`(d)

    Sanity check. Make sure all the important keys are set

## atomate.vasp.powerups module

`atomate.vasp.powerups.` `add_additional_fields_to_taskdocs`(original_wf, update_dict=None, task_name_constraint='VaspToDb')

  For all VaspToDbTasks in a given workflow, add information to “additional_fields” to be placed in the task doc.

  Args:

    original_wf (Workflow) update_dict (Dict): dictionary to add additional_fields

  Returns:

    Workflow

`atomate.vasp.powerups.` `add_bandgap_check`(original_wf, check_bandgap_params=None, fw_name_constraint=None)

  Every FireWork that enters into the Db has a band gap check afterwards, e.g. min_gap and max_gap

  Args:

    original_wf (Workflow) check_bandgap_params (dict): a kwargs style dict of params, e.g. min_gap or max_gap fw_name_constraint (str) - Only apply changes to FWs where fw_name contains this substring.

  Returns:

    Workflow

`atomate.vasp.powerups.` `add_common_powerups`(wf, c=None)

  Apply the common powerups such as add_namefile, use_scratch_dir etc. from the given config dict.

  Args:

    wf (Workflow) c (dict): Config dict

  Returns:

    Workflow

`atomate.vasp.powerups.` `add_modify_incar`(original_wf, modify_incar_params=None, fw_name_constraint=None)

  Every FireWork that runs VASP has a ModifyIncar task just beforehand. For example, allows you to modify the INCAR based on the Worker using env_chk or using hard-coded changes.

  Args:

    original_wf (Workflow) modify_incar_params (dict) - dict of parameters for ModifyIncar. fw_name_constraint (str) - Only apply changes to FWs where fw_name contains this substring.

  Returns:

    Workflow

`atomate.vasp.powerups.` `add_modify_incar_envchk`(original_wf, fw_name_constraint=None)

  If you set the “incar_update” parameter in the Worker env, the INCAR will update this parameter for all matching VASP runs

  Args:

    original_wf (Workflow) fw_name_constraint (str) - Only apply changes to FWs where fw_name contains this substring.

  Returns:

    Workflow

`atomate.vasp.powerups.` `add_modify_potcar`(original_wf, modify_potcar_params=None, fw_name_constraint=None)

  Every FireWork that runs VASP has a ModifyIncar task just beforehand. For example, allows you to modify the INCAR based on the Worker using env_chk or using hard-coded changes.

  Args:

    original_wf (Workflow) modify_incar_params (dict) - dict of parameters for ModifyIncar. fw_name_constraint (str) - Only apply changes to FWs where fw_name contains this substring.

  Returns:

    Workflow

`atomate.vasp.powerups.` `add_namefile`(original_wf, use_slug=True)

  Every FireWork begins by writing an empty file with the name “FW–<fw.name>”. This makes it easy to figure out what jobs are in what launcher directories, e.g. “ls -l launch*/FW–*” from within a “block” dir.

  Args:

    original_wf (Workflow) use_slug (bool): whether to replace whitespace-type chars with a slug

  Returns:

    Workflow

`atomate.vasp.powerups.` `add_priority`(original_wf, root_priority, child_priority=None)

  Adds priority to a workflow

  Args:

    original_wf (Workflow): original WF root_priority (int): priority of first (root) job(s) child_priority(int): priority of all child jobs. Defaults to root_priority

  Returns:

    Workflow: priority-decorated workflow

`atomate.vasp.powerups.` `add_small_gap_multiply`(original_wf, gap_cutoff, density_multiplier, fw_name_constraint=None)

  In all FWs with specified name constraints, add a ‘small_gap_multiply’ parameter that multiplies the k-mesh density of compounds with gap < gap_cutoff by density multiplier. Useful for increasing the k-point mesh for metallic or small gap systems. Note that this powerup only works on FireWorks with the appropriate WriteVasp* tasks that accept the small_gap_multiply argument…

  Args:

    original_wf (Workflow) gap_cutoff (float): Only multiply k-points for materials with gap < gap_cutoff (eV) density_multiplier (float): Multiply k-point density by this amount fw_name_constraint (str): Only apply changes to FWs where fw_name contains this substring.

  Returns:

    Workflow

`atomate.vasp.powerups.` `add_stability_check`(original_wf, check_stability_params=None, fw_name_constraint=None)

  Every FireWork that enters into the Db has a CheckStability task afterward. This allows defusing jobs that are not stable. In practice, you might want to set the fw_name_constraint so that the stability is only checked at the beginning of the workflow

  Args:

    original_wf (Workflow) check_stability_params (dict): a kwargs style dict of params fw_name_constraint (str) - Only apply changes to FWs where fw_name contains this substring.

  Returns:

    Workflow

`atomate.vasp.powerups.` `add_tags`(original_wf, tags_list)

  Adds tags to all Fireworks in the Workflow, WF metadata, as well as additional_fields for the VaspDrone to track them later (e.g. all fireworks and vasp tasks related to a research project)

  Args:

    original_wf (Workflow) tags_list: list of tags parameters (list of strings)

  Returns:

    Workflow

`atomate.vasp.powerups.` `add_trackers`(original_wf, tracked_files=None, nlines=25)

  Every FireWork that runs VASP also tracks the OUTCAR, OSZICAR, etc using FWS Trackers.

  Args:

    original_wf (Workflow) tracked_files (list) : list of files to be tracked nlines (int): number of lines at the end of files to be tracked

  Returns:

    Workflow

`atomate.vasp.powerups.` `add_wf_metadata`(original_wf, structure)

  Adds structure metadata to a workflow

  Args:

    original_wf: (Workflow) structure: (Structure) the structure being run by this workflow

  Returns:

    Workflow

`atomate.vasp.powerups.` `clean_up_files`(original_wf, files=('WAVECAR*', ), fw_name_constraint=None, task_name_constraint='RunVasp')

  Cleans up files after another fireworks. Default behavior is to remove WAVECAR after running VASP

  Args:

    original_wf (Workflow) files (list): list of patterns to match for files to clean up fw_name_constraint (str): pattern for firetask to clean up files after

  Returns:

    Workflow

`atomate.vasp.powerups.` `clear_modify`(original_wf, fw_name_constraint=None)

  Simple powerup that clears the modifications to a workflow.

  Args:
    fw_name_constraint (str): name constraint for fireworks to

      have their modification tasks removed

`atomate.vasp.powerups.` `modify_gzip_vasp`(original_wf, gzip_output)

  For all RunVaspCustodian tasks, modify gzip_output boolean Args:

  > original_wf (Workflow) gzip_output (bool): Value to set gzip_output to for RunVaspCustodian

  Returns:

    Workflow

`atomate.vasp.powerups.` `modify_to_soc`(original_wf, nbands, structure=None, modify_incar_params=None, fw_name_constraint=None)

  Takes a regular workflow and transforms its VASP fireworkers that are specified with fw_name_constraints to non-collinear calculations taking spin orbit coupling into account.

  Args:

    original_wf (Workflow) nbands (int): number of bands selected by the user (for now) structure (Structure) modify_incar_params ({}): a dictionary containing the setting for modyfining the INCAR (e.g. {“ICHARG”: 11}) fw_name_constraint (string): name of the fireworks to be modified (all if None is passed)

  Returns:

    Workflow: modified with SOC

`atomate.vasp.powerups.` `preserve_fworker`(original_wf, fw_name_constraint=None)

  set _preserve_fworker spec of Fireworker(s) of a Workflow. Can be used to pin a workflow to the first fworker it is run with. Very useful when running on multiple machines that can’t share files. fw_name_constraint can be used to only preserve fworker after a certain point where file passing becomes important

  Args:

    original_wf (Workflow): fw_name_constraint (str): name of the Fireworks to be tagged (all if None is passed)

  Returns:

    Workflow: modified workflow with specified Fireworkers tagged

`atomate.vasp.powerups.` `remove_custodian`(original_wf, fw_name_constraint=None)

  Replaces all tasks with “RunVasp*” (e.g. RunVaspCustodian) to be RunVaspDirect.

  Args:

    original_wf (Workflow): original workflow fw_name_constraint (str): Only apply changes to FWs where fw_name contains this substring.

  Returns:

    Workflow

`atomate.vasp.powerups.` `set_execution_options`(original_wf, fworker_name=None, category=None, fw_name_constraint=None, task_name_constraint=None)

  set _fworker spec of Fireworker(s) of a Workflow. It can be used to specify a queue; e.g. run large-memory jobs on a separate queue.

  Args:

    original_wf (Workflow): fworker_name (str): user-defined tag to be added under fw.spec._fworker

    > e.g. “large memory”, “big”, etc

    category (str): category of FWorker that should pul job fw_name_constraint (str): name of the Fireworks to be tagged (all if None is passed) task_name_constraint (str): name of the Firetasks to be tagged (e.g. None or ‘RunVasp’)

  Returns:

    Workflow: modified workflow with specified Fireworkers tagged

`atomate.vasp.powerups.` `use_custodian`(original_wf, fw_name_constraint=None, custodian_params=None)

  Replaces all tasks with “RunVasp*” (e.g. RunVaspDirect) to be RunVaspCustodian. Thus, this powerup adds error correction into VASP runs if not originally present and/or modifies the correction behavior.

  Args:

    original_wf (Workflow): original workflow fw_name_constraint (str): Only apply changes to FWs where fw_name contains this substring.

    > For example, use custodian only for certain runs, or set job_type to “double_relaxation_run” only for structure optimization run, or set different handler_group for different runs.

    custodian_params (dict): A dict of parameters for RunVaspCustodian. e.g., use it to set

      a “scratch_dir” or “handler_group”.

  Returns:

    Workflow

`atomate.vasp.powerups.` `use_fake_vasp`(original_wf, ref_dirs, params_to_check=None)

  Replaces all tasks with “RunVasp” (e.g. RunVaspDirect) to be RunVaspFake. Thus, we do not actually run VASP but copy pre-determined inputs and outputs.

  Args:

    original_wf (Workflow) ref_dirs (dict): key=firework name, value=path to the reference vasp calculation directory params_to_check (list): optional list of incar parameters to check.

  Returns:

    Workflow

`atomate.vasp.powerups.` `use_gamma_vasp`(original_wf, gamma_vasp_cmd)

  For all RunVaspCustodian tasks, add the desired scratch dir.

  Args:

    original_wf (Workflow) gamma_vasp_cmd (str): path to gamma_vasp_cmd. Supports env_chk

  Returns:

    Workflow

`atomate.vasp.powerups.` `use_no_vasp`(original_wf, ref_dirs)

  Instead of running VASP, does nothing and pass task documents from task.json files in ref_dirs to task database.

  Args:

    original_wf (Workflow) ref_dirs(dict): key=firework name, value=path to the reference vasp calculation directory

  Returns:

    Workflow

`atomate.vasp.powerups.` `use_scratch_dir`(original_wf, scratch_dir)

  For all RunVaspCustodian tasks, add the desired scratch dir.

  Args:

    original_wf (Workflow) scratch_dir (path): Path to the scratch dir to use. Supports env_chk

  Returns:

    Workflow

## atomate.vasp.submission_filter module

class `atomate.vasp.submission_filter.` `SubmissionFilter`(is_valid=True, potcar_exists=True, max_natoms=200, is_ordered=True, not_in_MP=True, MAPI_KEY=None, require_bandstructure=False)

  Bases: `pymatgen.alchemy.filters.AbstractStructureFilter`

  `NO_POTCARS` = ['Po', 'At', 'Rn', 'Fr', 'Ra', 'Am', 'Cm', 'Bk', 'Cf', 'Es', 'Fm', 'Md', 'No', 'Lr']
  `__init__`(is_valid=True, potcar_exists=True, max_natoms=200, is_ordered=True, not_in_MP=True, MAPI_KEY=None, require_bandstructure=False)

    Initialize a submission filter for checking that structures are valid for calculations.

    Args:

      is_valid (bool): If true, checks structure validity potcar_exists (bool): If true, ensures all elements have VASP PAW_PBE POTCAR max_natoms (int): If not None, ensures structure has <=max_natoms atoms is_ordered (bool): If true, ensures structure is ordered not_in_MP (bool): If true, ensures structure not in MP MAPI_KEY (str): For MP checks, your MAPI key if not previously set as config var require_bandstructure (bool): For MP checks, require a band structure calc

  `as_dict`()

    A JSON serializable dict representation of an object.

  classmethod `from_dict`(d)
  `test`(structure)

    Method to execute the test.

    Returns:

      (bool) Structures that return true are kept in the Transmuter object during filtering.

## atomate.vasp.vasp_config module

## atomate.vasp.vasp_powerups module

## Module contents