TaskDoc

class emmet.core.tasks.TaskDoc(**data)

Bases: CoreTaskDoc

Flexible wrapper around CoreTaskDoc

Parameters:
  • nsites (int | None)

  • elements (list[Annotated[ElementTypeVar, BeforeValidator(func=~emmet.core.types.pymatgen_types.element_adapter.<lambda>, json_schema_input_type=PydanticUndefined), WrapSerializer(func=~emmet.core.types.pymatgen_types.element_adapter.<lambda>, return_type=str, when_used=always)]] | None)

  • nelements (int | None)

  • composition (Annotated[CompositionTypeVar, BeforeValidator(func=~emmet.core.types.pymatgen_types.composition_adapter.<lambda>, json_schema_input_type=PydanticUndefined), WrapSerializer(func=~emmet.core.types.pymatgen_types.composition_adapter.<lambda>, return_type=dict[str, float], when_used=always)] | None)

  • composition_reduced (Annotated[CompositionTypeVar, BeforeValidator(func=~emmet.core.types.pymatgen_types.composition_adapter.<lambda>, json_schema_input_type=PydanticUndefined), WrapSerializer(func=~emmet.core.types.pymatgen_types.composition_adapter.<lambda>, return_type=dict[str, float], when_used=always)] | None)

  • formula_pretty (str | None)

  • formula_anonymous (str | None)

  • chemsys (str | None)

  • volume (float | None)

  • density (float | None)

  • density_atomic (float | None)

  • symmetry (SymmetryData | None)

  • batch_id (str | None)

  • calc_type (CalcType | None)

  • completed_at (Annotated[datetime | None, BeforeValidator(func=~emmet.core.utils.convert_datetime, json_schema_input_type=PydanticUndefined)])

  • dir_name (str | None)

  • icsd_id (int | None)

  • input (CalculationInput | None)

  • last_updated (Annotated[datetime, BeforeValidator(func=~emmet.core.utils.convert_datetime, json_schema_input_type=PydanticUndefined)])

  • orig_inputs (CalculationInput | None)

  • output (OutputDoc | None)

  • run_type (RunType | None)

  • structure (Annotated[StructureTypeVar, BeforeValidator(func=~emmet.core.types.pymatgen_types.structure_adapter.pop_empty_structure_keys, json_schema_input_type=PydanticUndefined), WrapSerializer(func=~emmet.core.types.pymatgen_types.structure_adapter.<lambda>, return_type=~emmet.core.types.pymatgen_types.structure_adapter.TypedStructureDict, when_used=always)] | None)

  • tags (list[str] | None)

  • task_id (Annotated[MPID | AlphaID, BeforeValidator(func=~emmet.core.types.typing._fault_tolerant_id_serde, json_schema_input_type=PydanticUndefined), PlainSerializer(func=~emmet.core.types.typing.<lambda>, return_type=PydanticUndefined, when_used=always)] | None)

  • task_type (TaskType | CalcType | None)

  • transformations (Annotated[dict[str, Any] | None, BeforeValidator(func=~emmet.core.types.typing._deser_json_like, json_schema_input_type=PydanticUndefined), WrapSerializer(func=~emmet.core.types.typing._ser_json_like, return_type=PydanticUndefined, when_used=always)])

  • vasp_objects (Annotated[dict[VaspObject, Any] | None, BeforeValidator(func=~emmet.core.types.typing._deser_json_like, json_schema_input_type=PydanticUndefined), WrapSerializer(func=~emmet.core.types.typing._ser_json_like, return_type=PydanticUndefined, when_used=always)])

  • additional_json (Annotated[dict[str, Any] | None, BeforeValidator(func=~emmet.core.types.typing._deser_json_like, json_schema_input_type=PydanticUndefined), WrapSerializer(func=~emmet.core.types.typing._ser_json_like, return_type=PydanticUndefined, when_used=always)])

  • analysis (AnalysisDoc | None)

  • author (str | None)

  • calcs_reversed (list[Calculation] | None)

  • custodian (list[CustodianDoc] | None)

  • entry (Annotated[ComputedEntryTypeVar, BeforeValidator(func=~emmet.core.types.pymatgen_types.computed_entries_adapter.entry_deserializer, json_schema_input_type=PydanticUndefined), WrapSerializer(func=~emmet.core.types.pymatgen_types.computed_entries_adapter.entry_serializer, return_type=dict[str, Any], when_used=always)] | None)

  • included_objects (list[VaspObject] | None)

  • run_stats (dict[str, RunStatistics] | None)

  • state (TaskState | None)

  • task_label (str | None)

  • extra_data (Any)

classmethod set_model_pre_fields(values)

Ensure all important model fields are set and refreshed.

Return type:

Any

Parameters:

values (Any)

classmethod from_directory(dir_name, volumetric_files=_VOLUMETRIC_FILES, store_additional_json=True, additional_fields=None, volume_change_warning_tol=0.2, task_names=None, **vasp_calculation_kwargs)

Create a task document from a directory containing VASP files.

Return type:

Self

Parameters:
  • dir_name (Path | str)

  • volumetric_files (tuple[str, ...])

  • store_additional_json (bool)

  • additional_fields (dict[str, Any] | None)

  • volume_change_warning_tol (float)

  • task_names (list[str] | None)

Parameters

dir_name

The path to the folder containing the calculation outputs.

store_additional_json

Whether to store additional json files found in the calculation directory.

volumetric_files

Volumetric files to search for.

additional_fields

Dictionary of additional fields to add to output document.

volume_change_warning_tol

Maximum volume change allowed in VASP relaxations before the calculation is tagged with a warning.

task_names

Naming scheme for multiple calculations in on folder e.g. [“relax1”,”relax2”]. Can be subfolder or extension.

**vasp_calculation_kwargs

Additional parsing options that will be passed to the Calculation.from_vasp_files function.

Returns

TaskDoc

A task document for the calculation.

classmethod from_vasprun(path, additional_fields=None, volume_change_warning_tol=0.2, **vasp_calculation_kwargs)

Create a task document from a vasprun.xml file.

This is not recommended and will raise warnings, since some necessary information is absent from the vasprun.xml file, such as per-atom magnetic moments. However, the majority of the TaskDoc will be complete.

Return type:

Self

Parameters:
  • path (str | Path)

  • additional_fields (dict[str, Any] | None)

  • volume_change_warning_tol (float)

Parameters

path

The path to the vasprun.xml.

additional_fields: dict[str, Any] = None, volume_change_warning_tol

Maximum volume change allowed in VASP relaxations before the calculation is tagged with a warning.

**vasp_calculation_kwargs

Additional parsing options that will be passed to the Calculation.from_vasp_files function.

Returns

TaskDoc

A task document for the calculation.

static get_entry(calcs_reversed, task_id=None)

Get a computed entry from a list of VASP calculation documents.

Return type:

ComputedEntry

Parameters:
  • calcs_reversed (list[Calculation | dict])

  • task_id (Annotated[MPID | AlphaID, BeforeValidator(func=~emmet.core.types.typing._fault_tolerant_id_serde, json_schema_input_type=PydanticUndefined), PlainSerializer(func=~emmet.core.types.typing.<lambda>, return_type=PydanticUndefined, when_used=always)] | str | int | None)

Parameters

calcs_reversed

A list of VASP calculation documents in a reverse order.

task_id

The job identifier.

Returns

ComputedEntry

A computed entry.

property structure_entry: ComputedStructureEntry

Retrieve a ComputedStructureEntry for this TaskDoc.

Returns

ComputedStructureEntry

The TaskDoc.entry with corresponding TaskDoc.structure added.

property trajectories: list[Trajectory] | None

Get Trajectory objects representing calcs_reversed.

Note that the Trajectory objects represent the proper calculation order, not the reversed.

Thus the first Trajectory represents the first calculation that was performed (self.calcs_reversed[-1]).

model_config: ClassVar[ConfigDict] = {'extra': 'allow'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].