# pymatgen.io.jdftx package

## Submodules

## pymatgen.io.jdftx.generic_tags module

Module for class objects for containing JDFTx tags.

This module contains class objects for containing JDFTx tags. These class objects are used to validate the type of the value for the tag, read the value string for the tag, write the tag and its value as a string, and get the token length of the tag.

@mkhorton - This file is ready to review.

class AbstractTag(multiline_tag: bool = False, can_repeat: bool = False, write_tagname: bool = True, write_value: bool = True, optional: bool = True, defer_until_struc: bool = False, is_tag_container: bool = False, allow_list_representation: bool = False)

  Bases: `ClassPrintFormatter`, `ABC`

  Abstract base class for all tags.

  allow_list_representation: bool = False
  can_repeat: bool = False
  defer_until_struc: bool = False
  get_dict_representation(tag: str, value: Any) → dict | list[dict]

    Convert the value to a dict representation.

    Parameters:

      - tag (str) – The tag to convert the value to a dict representation for.

      - value (Any) – The value to convert to a dict representation.

    Returns:

      The value converted to a dict representation.

    Return type:

      dict | list[dict]

  get_list_representation(tag: str, value: Any) → list | list[list]

    Convert the value to a list representation.

    Parameters:

      - tag (str) – The tag to convert the value to a list representation for.

      - value (Any) – The value to convert to a list representation.

    Returns:

      The value converted to a list representation.

    Return type:

      list | list[list]

  abstractmethod get_token_len() → int

    Get the token length of the tag.

    Returns:

      The token length of the tag.

    Return type:

      int

  is_tag_container: bool = False
  multiline_tag: bool = False
  optional: bool = True
  abstractmethod read(tag: str, value_str: str) → Any

    Read and parse the value string for this tag.

    Parameters:

      - tag (str) – The tag to read the value string for.

      - value_str (str) – The value string to read.

    Returns:

      The parsed value.

    Return type:

      Any

  abstractmethod validate_value_type(tag: str, value: Any, try_auto_type_fix: bool = False) → tuple[str, bool, Any]

    Validate the type of the value for this tag.

    Parameters:

      - tag (str) – The tag to validate the type of the value for.

      - value (Any) – The value to validate the type of.

      - try_auto_type_fix (bool, optional) – Whether to try to automatically fix the type of the value.

      - False. (Defaults to)

    Returns:

      The tag, whether the value is of the correct type, and the possibly fixed value.

    Return type:

      tuple[str, bool, Any]

  abstractmethod write(tag: str, value: Any) → str

    Write the tag and its value as a string.

    Parameters:

      - tag (str) – The tag to write.

      - value (Any) – The value to write.

    Returns:

      The tag and its value as a string.

    Return type:

      str

  write_tagname: bool = True
  write_value: bool = True

class BoolTag(multiline_tag: bool = False, can_repeat: bool = False, write_tagname: bool = True, write_value: bool = True, optional: bool = True, defer_until_struc: bool = False, is_tag_container: bool = False, allow_list_representation: bool = False, _TF_read_options: dict[str, bool] = <factory>, _TF_write_options: dict[bool, str] = <factory>)

  Bases: `AbstractTag`

  Tag for boolean values in JDFTx input files.

  Tag for boolean values in JDFTx input files.

  get_token_len() → int

    Get the token length of the tag.

    Returns:

      The token length of the tag.

    Return type:

      int

  raise_value_error(tag: str, value: str) → None

    Raise a ValueError for the value string.

    Parameters:

      - tag (str) – The tag to raise the ValueError for.

      - value (str) – The value string to raise the ValueError for.

  read(tag: str, value: str) → bool

    Read the value string for this tag.

    Parameters:

      - tag (str) – The tag to read the value string for.

      - value (str) – The value string to read.

    Returns:

      The parsed boolean value.

    Return type:

      bool

  validate_value_type(tag: str, value: Any, try_auto_type_fix: bool = False) → tuple[str, bool, Any]

    Validate the type of the value for this tag.

    Parameters:

      - tag (str) – The tag to validate the type of the value for.

      - value (Any) – The value to validate the type of.

      - try_auto_type_fix (bool, optional) – Whether to try to automatically fix the type of the value.

      - False. (Defaults to)

    Returns:

      The tag, whether the value is of the correct type, and the possibly fixed value.

    Return type:

      tuple[str, bool, Any]

  write(tag: str, value: Any) → str

    Write the tag and its value as a string.

    Parameters:

      - tag (str) – The tag to write.

      - value (Any) – The value to write.

    Returns:

      The tag and its value as a string.

    Return type:

      str

class BoolTagContainer(multiline_tag: bool = False, can_repeat: bool = False, write_tagname: bool = True, write_value: bool = True, optional: bool = True, defer_until_struc: bool = False, is_tag_container: bool = True, allow_list_representation: bool = False, linebreak_nth_entry: int | None = None, subtags: dict[str, ~pymatgen.io.jdftx.generic_tags.AbstractTag] = <factory>)

  Bases: `TagContainer`

  BoolTagContainer class for handling the subtags to the “dump” tag.

  This class is used to handle the subtags to the “dump” tag. All subtags are freqs for dump, and all values for these tags are boolean values that are read given the existence of their “var” name.

  read(tag: str, value_str: str) → dict

    Read the value string for this tag.

    This method reads the value string for this tag. It is used to parse the value string for the tag and return the parsed value.

    Parameters:

      - tag (str) – The tag to read the value string for.

      - value_str (str) – The value string to read.

    Returns:

      The parsed value.

    Return type:

      dict

class ClassPrintFormatter

  Bases: `object`

  Generic class for printing to command line in readable format.

  Generic class for printing to command line in readable format.

class DumpTagContainer(multiline_tag: bool = False, can_repeat: bool = False, write_tagname: bool = True, write_value: bool = True, optional: bool = True, defer_until_struc: bool = False, is_tag_container: bool = True, allow_list_representation: bool = False, linebreak_nth_entry: int | None = None, subtags: dict[str, ~pymatgen.io.jdftx.generic_tags.AbstractTag] = <factory>)

  Bases: `TagContainer`

  DumpTagContainer class for handling the “dump” tag.

  This class is used to handle the “dump” tag.

  read(tag: str, value_str: str) → dict

    Read the value string for this tag.

    This method reads the value string for this tag. It is used to parse the value string for the tag and return the parsed value.

    Parameters:

      - tag (str) – The tag to read the value string for.

      - value_str (str) – The value string to read.

    Returns:

      The parsed value.

    Return type:

      dict

class FloatTag(multiline_tag: bool = False, can_repeat: bool = False, write_tagname: bool = True, write_value: bool = True, optional: bool = True, defer_until_struc: bool = False, is_tag_container: bool = False, allow_list_representation: bool = False, prec: int | None = None)

  Bases: `AbstractTag`

  Tag for float values in JDFTx input files.

  Tag for float values in JDFTx input files.

  get_token_len() → int

    Get the token length of the tag.

    Returns:

      The token length of the tag.

    Return type:

      int

  prec: int | None = None
  read(tag: str, value: str) → float

    Read the value string for this tag.

    Parameters:

      - tag (str) – The tag to read the value string for.

      - value (str) – The value string to read.

    Returns:

      The parsed float value.

    Return type:

      float

  validate_value_type(tag: str, value: Any, try_auto_type_fix: bool = False) → tuple[str, bool, Any]

    Validate the type of the value for this tag.

    Parameters:

      - tag (str) – The tag to validate the type of the value for.

      - value (Any) – The value to validate the type of.

      - try_auto_type_fix (bool, optional) – Whether to try to automatically fix the type of the value, by default False.

    Returns:

      The tag, whether the value is of the correct type, and the possibly fixed value.

    Return type:

      tuple[str, bool, Any]

  write(tag: str, value: Any) → str

    Write the tag and its value as a string.

    Parameters:

      - tag (str) – The tag to write.

      - value (Any) – The value to write.

    Returns:

      The tag and its value as a string.

    Return type:

      str

class InitMagMomTag(multiline_tag: bool = False, can_repeat: bool = False, write_tagname: bool = True, write_value: bool = True, optional: bool = True, defer_until_struc: bool = False, is_tag_container: bool = False, allow_list_representation: bool = False)

  Bases: `AbstractTag`

  Tag for initial-magnetic-moments tag in JDFTx input files.

  Tag for initial-magnetic-moments tag in JDFTx input files.

  get_token_len() → int

    Get the token length of the tag.

    Returns:

      The token length of the tag.

    Return type:

      int

  read(tag: str, value: str) → str

    Read the value string for this tag.

    Parameters:

      - tag (str) – The tag to read the value string for.

      - value (str) – The value string to read.

    Returns:

      The parsed string value.

    Return type:

      str

  validate_value_type(tag: str, value: Any, try_auto_type_fix: bool = False) → tuple[str, bool, Any]

    Validate the type of the value for this tag.

    Parameters:

      - tag (str) – The tag to validate the type of the value for.

      - value (Any) – The value to validate the type of.

      - try_auto_type_fix (bool, optional) – Whether to try to automatically fix the type of the value, by default False.

    Returns:

      The tag, whether the value is of the correct type, and the possibly fixed value.

    Return type:

      tuple[str, bool, Any]

  write(tag: str, value: Any) → str

    Write the tag and its value as a string.

    Parameters:

      - tag (str) – The tag to write.

      - value (Any) – The value to write.

    Returns:

      The tag and its value as a string.

    Return type:

      str

class IntTag(multiline_tag: bool = False, can_repeat: bool = False, write_tagname: bool = True, write_value: bool = True, optional: bool = True, defer_until_struc: bool = False, is_tag_container: bool = False, allow_list_representation: bool = False)

  Bases: `AbstractTag`

  Tag for integer values in JDFTx input files.

  Tag for integer values in JDFTx input files.

  get_token_len() → int

    Get the token length of the tag.

    Returns:

      The token length of the tag.

    Return type:

      int

  read(tag: str, value: str) → int

    Read the value string for this tag.

    Parameters:

      - tag (str) – The tag to read the value string for.

      - value (str) – The value string to read.

    Returns:

      The parsed integer value.

    Return type:

      int

  validate_value_type(tag: str, value: Any, try_auto_type_fix: bool = False) → tuple[str, bool, Any]

    Validate the type of the value for this tag.

    Parameters:

      - tag (str) – The tag to validate the type of the value for.

      - value (Any) – The value to validate the type of.

      - try_auto_type_fix (bool, optional) – Whether to try to automatically fix the type of the value, by default False.

    Returns:

      The tag, whether the value is of the correct type, and the possibly fixed value.

    Return type:

      tuple[str, bool, Any]

  write(tag: str, value: Any) → str

    Write the tag and its value as a string.

    Parameters:

      - tag (str) – The tag to write.

      - value (Any) – The value to write.

    Returns:

      The tag and its value as a string.

    Return type:

      str

class MultiformatTag(multiline_tag: bool = False, can_repeat: bool = False, write_tagname: bool = True, write_value: bool = True, optional: bool = True, defer_until_struc: bool = False, is_tag_container: bool = False, allow_list_representation: bool = False, format_options: list[~pymatgen.io.jdftx.generic_tags.AbstractTag] = <factory>)

  Bases: `AbstractTag`

  Class for tags with multiple format options.

  Class for tags that could have different types of input values given to them or tags where different subtag options directly impact how many expected arguments are provided e.g. the coulomb-truncation or van-der-waals tags.

  This class should not be used for tags with simply some combination of mandatory and optional args because the TagContainer class can handle those cases by itself.

  format_options: list[AbstractTag]
  get_format_index_for_str_value(tag: str, value: str) → int

    Get the format index from string representation of value.

    Parameters:

      - tag (str) – The tag to read the value string for.

      - value (str) – The value string to read.

    Returns:

      The index of the format option for the value of this tag.

    Return type:

      int

    Raises:

      ValueError – If no valid read format is found for the tag.

  get_token_len() → int

    Get the token length of the tag.

    Returns:

      The token length of the tag.

    Return type:

      int

    Raises:

      NotImplementedError – If the method is called directly on MultiformatTag objects.

  raise_invalid_format_option_error(tag: str, i: int) → None

    Raise an error for an invalid format option.

    Parameters:

      - tag (str) – The tag to raise the error for.

      - i (int) – The index of the format option to raise the error for.

    Raises:

      ValueError – If the format option is invalid.

  read(tag: str, value: str) → None

    Read the value string for this tag.

    Parameters:

      - tag (str) – The tag to read the value string for.

      - value (str) – The value string to read.

    Raises:

      RuntimeError – If the method is called directly on MultiformatTag.

  validate_value_type(tag: str, value: Any, try_auto_type_fix: bool = False) → tuple[str, bool, Any]

    Validate the type of the value for this tag.

    Parameters:

      - tag (str) – The tag to validate the value type for.

      - value (Any) – The value to validate the type of.

      - try_auto_type_fix (bool, optional) – Whether to try to automatically fix the type of the value. Defaults to False.

    Returns:

      The tag, whether the value is of the correct type, and the possibly fixed value.

    Return type:

      tuple[str, bool, Any]

  write(tag: str, value: Any) → str

    Write the tag and its value as a string.

    Parameters:

      - tag (str) – The tag to write.

      - value (Any) – The value to write.

    Returns:

      The tag and its value as a string.

    Return type:

      str

    Raises:

      RuntimeError – If the method is called directly on MultiformatTag.

class StrTag(multiline_tag: bool = False, can_repeat: bool = False, write_tagname: bool = True, write_value: bool = True, optional: bool = True, defer_until_struc: bool = False, is_tag_container: bool = False, allow_list_representation: bool = False, options: list | None = None)

  Bases: `AbstractTag`

  Tag for string values in JDFTx input files.

  Tag for string values in JDFTx input files.

  get_token_len() → int

    Get the token length of the tag.

    Returns:

      The token length of the tag.

    Return type:

      int

  options: list | None = None
  read(tag: str, value: str) → str

    Read the value string for this tag.

    Parameters:

      - tag (str) – The tag to read the value string for.

      - value (str) – The value string to read.

    Returns:

      The parsed string value.

    Return type:

      str

  validate_value_type(tag: str, value: Any, try_auto_type_fix: bool = False) → tuple[str, bool, Any]

    Validate the type of the value for this tag.

    Parameters:

      - tag (str) – The tag to validate the type of the value for.

      - value (Any) – The value to validate the type of.

      - try_auto_type_fix (bool, optional) – Whether to try to automatically fix the type of the value. Defaults to False.

    Returns:

      The tag, whether the value is of the correct type, and the possibly fixed value.

    Return type:

      tuple[str, bool, Any]

  write(tag: str, value: Any) → str

    Write the tag and its value as a string.

    Parameters:

      - tag (str) – The tag to write.

      - value (Any) – The value to write.

    Returns:

      The tag and its value as a string.

    Return type:

      str

class TagContainer(multiline_tag: bool = False, can_repeat: bool = False, write_tagname: bool = True, write_value: bool = True, optional: bool = True, defer_until_struc: bool = False, is_tag_container: bool = True, allow_list_representation: bool = False, linebreak_nth_entry: int | None = None, subtags: dict[str, ~pymatgen.io.jdftx.generic_tags.AbstractTag] = <factory>)

  Bases: `AbstractTag`

  TagContainer class for handling tags that contain other tags.

  This class is used to handle tags that contain other tags. It is used to validate the type of the value for the tag, read the value string for the tag, write the tag and its value as a string, and get the token length of the tag.

  Note: When constructing a TagContainer, all subtags must be able to return the correct token length without any information about the value. # TODO: Remove this assumption by changing the signature of get_token_len to take the value as an argument.

  get_dict_representation(tag: str, value: list) → dict | list[dict]

    Convert the value to a dict representation.

    Parameters:

      - tag (str) – The tag to convert the value to a dict representation for.

      - value (list) – The value to convert to a dict representation.

    Returns:

      The value converted to a dict representation.

    Return type:

      dict | list[dict]

  get_list_representation(tag: str, value: Any) → list

    Convert the value to a list representation.

    Parameters:

      - tag (str) – The tag to convert the value to a list representation for.

      - value (Any) – The value to convert to a list representation.

    Returns:

      The value converted to a list representation.

    Return type:

      list

  get_token_len() → int

    Get the token length of the tag.

    Returns:

      The token length of the tag.

    Return type:

      int

  is_tag_container: bool = True
  linebreak_nth_entry: int | None = None
  read(tag: str, value: str) → dict

    Read the value string for this tag.

    Parameters:

      - tag (str) – The tag to read the value string for.

      - value (str) – The value string to read.

    Returns:

      The parsed value.

    Return type:

      dict

  subtags: dict[str, AbstractTag]
  validate_value_type(tag: str, value: Any, try_auto_type_fix: bool = False) → tuple[str, bool, Any]

    Validate the type of the value for this tag.

    Parameters:

      - tag (str) – The tag to validate the type of the value for.

      - value (Any) – The value to validate the type of.

      - try_auto_type_fix (bool, optional) – Whether to try to automatically fix the type of the value, by default False.

    Returns:

      The tag, whether the value is of the correct type, and the possibly fixed value.

    Return type:

      tuple[str, bool, Any]

  write(tag: str, value: Any) → str

    Write the tag and its value as a string.

    Parameters:

      - tag (str) – The tag to write.

      - value (Any) – The value to write.

    Returns:

      The tag and its value as a string.

    Return type:

      str

## pymatgen.io.jdftx.inputs module

Classes for reading/manipulating/writing JDFTx input files.

Classes for reading/manipulating/writing JDFTx input files.

Note: JDFTXInfile will be moved back to its own module once a more broad inputs class is written.

@mkhorton - This file is ready to review.

class JDFTXInfile(params: dict[str, Any] | None = None)

  Bases: `dict`, `MSONable`

  Class for reading/writing JDFtx input files.

  JDFTxInfile object for reading and writing JDFTx input files. Essentially a dictionary with some helper functions.

  Create a JDFTXInfile object.

  Parameters:

    params (dict) – Input parameters as a dictionary.

  append_tag(tag: str, value: Any) → None

    Append a value to a tag.

    Append a value to a tag. Use this method instead of directly appending the list contained in the tag, such that the value is properly processed.

    Parameters:

      - tag (str) – Tag to append to.

      - value (Any) – Value to append.

  as_dict(sort_tags: bool = True, skip_module_keys: bool = False) → dict

    Return JDFTXInfile as MSONable dict.

    Parameters:

      - sort_tags (bool, optional) – Whether to sort the tags. Defaults to True.

      - skip_module_keys (bool, optional) – Whether to skip the module keys. Defaults to False.

    Returns:

      JDFTXInfile as MSONable dict.

    Return type:

      dict

  copy() → JDFTXInfile

    Return a copy of the JDFTXInfile object.

    Returns:

      Copy of the JDFTXInfile object.

    Return type:

      JDFTXInfile

  classmethod from_dict(d: dict[str, Any]) → JDFTXInfile

    Create JDFTXInfile from a dictionary.

    Parameters:

      d (dict) – Dictionary to create JDFTXInfile from.

    Returns:

      The created JDFTXInfile object.

    Return type:

      JDFTXInfile

  classmethod from_file(filename: PathLike, dont_require_structure: bool = False, sort_tags: bool = True, assign_path_parent: bool = True) → Self

    Read a JDFTXInfile object from a file.

    Parameters:

      - filename (PathLike) – Filename to read from.

      - dont_require_structure (bool, optional) – Whether to require structure tags. Defaults to False.

      - sort_tags (bool, optional) – Whether to sort the tags. Defaults to True.

      - assign_path_parent (bool, optional) – Whether to assign the parent directory of the input file for include tags. Defaults to True.

    Returns:

      The created JDFTXInfile object.

    Return type:

      JDFTXInfile

  classmethod from_jdftxstructure(jdftxstructure: JDFTXStructure) → JDFTXInfile

    Create a JDFTXInfile object from a JDFTXStructure object.

    Parameters:

      jdftxstructure (JDFTXStructure) – JDFTXStructure object to convert.

    Returns:

      The created JDFTXInfile object.

    Return type:

      JDFTXInfile

  classmethod from_str(string: str, dont_require_structure: bool = False, sort_tags: bool = True, path_parent: Path | None = None) → JDFTXInfile

    Read a JDFTXInfile object from a string.

    Parameters:

      - string (str) – String to read from.

      - dont_require_structure (bool, optional) – Whether to require structure tags. Defaults to False.

      - sort_tags (bool, optional) – Whether to sort the tags. Defaults to True.

      - path_parent (Path, optional) – Path to the parent directory of the input file for include tags. Defaults to None.

    Returns:

      The created JDFTXInfile object.

    Return type:

      JDFTXInfile

  classmethod from_structure(structure: Structure, selective_dynamics: ArrayLike | None = None, write_cart_coords: bool = False) → JDFTXInfile

    Create a JDFTXInfile object from a pymatgen Structure.

    Parameters:

      - structure (Structure) – Structure to convert.

      - selective_dynamics (ArrayLike, optional) – Selective dynamics attribute for each site if available. Shape Nx1, by default None.

    Returns:

      The created JDFTXInfile object.

    Return type:

      JDFTXInfile

  classmethod get_dict_representation(jdftxinfile: JDFTXInfile) → JDFTXInfile

    Convert JDFTXInfile object properties into dict representation.

    Parameters:

      jdftxinfile (JDFTXInfile) – JDFTXInfile object to convert.

  classmethod get_list_representation(jdftxinfile: JDFTXInfile) → JDFTXInfile

    Convert JDFTXInfile object properties into list representation.

    Parameters:

      jdftxinfile (JDFTXInfile) – JDFTXInfile object to convert.

  get_text_list() → list[str]

    Get a list of strings representation of the JDFTXInfile.

    Returns:

      List of strings representation of the JDFTXInfile.

    Return type:

      list[str]

  path_parent: str | None = None
  property structure: Structure

    Return a pymatgen Structure object.

    Returns:

      Pymatgen structure object.

    Return type:

      Structure

  classmethod to_jdftxstructure(jdftxinfile: JDFTXInfile, sort_structure: bool = False) → JDFTXStructure

    Convert JDFTXInfile to JDFTXStructure object.

    Converts JDFTx lattice, lattice-scale, ion tags into JDFTXStructure, with Pymatgen structure as attribute.

    Parameters:

      - jdftxinfile (JDFTXInfile) – JDFTXInfile object to convert.

      - sort_structure (bool, optional) – Whether to sort the structure. Useful if species are not grouped properly together. Defaults to False.

  classmethod to_pmg_structure(jdftxinfile: JDFTXInfile, sort_structure: bool = False) → Structure

    Convert JDFTXInfile to pymatgen Structure object.

    Converts JDFTx lattice, lattice-scale, ion tags into pymatgen Structure.

    Parameters:

      - jdftxinfile (JDFTXInfile) – JDFTXInfile object to convert.

      - sort_structure (bool, optional) – Whether to sort the structure. Useful if species are not grouped properly together. Defaults to False.

    Returns:

      The created pymatgen Structure object.

    Return type:

      Structure

  validate_tags(try_auto_type_fix: bool = False, error_on_failed_fix: bool = True, return_list_rep: bool = False) → None

    Validate the tags in the JDFTXInfile.

    Validate the tags in the JDFTXInfile. If try_auto_type_fix is True, will attempt to fix the tags. If error_on_failed_fix is True, will raise an error if the tags cannot be fixed. If return_list_rep is True, will return the tags in list representation.

    Parameters:

      - try_auto_type_fix (bool, optional) – Whether to attempt to fix the tags. Defaults to False.

      - error_on_failed_fix (bool, optional) – Whether to raise an error if the tags cannot be fixed. Defaults to True.

      - return_list_rep (bool, optional) – Whether to return the tags in list representation. Defaults to False.

  write_file(filename: PathLike) → None

    Write JDFTXInfile to an in file.

    Parameters:

      filename (PathLike) – Filename to write to.

class JDFTXStructure(structure: Structure = None, selective_dynamics: ArrayLike | None = None, sort_structure: bool = False, write_cart_coords: bool = False)

  Bases: `MSONable`

  Object for representing the data in JDFTXStructure tags.

  structure

    Associated Structure.

    Type:

      Structure

  selective_dynamics

    Selective dynamics attribute for each site if available. Shape Nx1.

    Type:

      ArrayLike

  sort_structure

    Whether to sort the structure. Useful if species are not grouped properly together. Defaults to False.

    Type:

      bool

  as_dict() → dict

    MSONable dict.

    Returns:

      MSONable dictionary representation of the JDFTXStructure.

    Return type:

      dict

  classmethod from_dict(params: dict) → Self

    Get JDFTXStructure from dict.

    Parameters:

      params (dict) – Serialized JDFTXStructure.

    Returns:

      The created JDFTXStructure object.

    Return type:

      JDFTXStructure

  classmethod from_file(filename: str) → JDFTXStructure

    Read JDFTXStructure from file.

    Parameters:

      filename (str) – Filename to read from.

    Returns:

      The created JDFTXStructure object.

    Return type:

      JDFTXStructure

  classmethod from_jdftxinfile(jdftxinfile: JDFTXInfile, sort_structure: bool = False) → JDFTXStructure

    Get JDFTXStructure from JDFTXInfile.

    Parameters:

      - jdftxinfile (JDFTXInfile) – JDFTXInfile object.

      - sort_structure (bool, optional) – Whether to sort the structure. Useful if species are not grouped properly together as JDFTx output will have species sorted.

    Returns:

      The created JDFTXStructure object.

    Return type:

      JDFTXStructure

  classmethod from_str(data: str) → JDFTXStructure

    Read JDFTXStructure from string.

    Parameters:

      data (str) – String to read from.

    Returns:

      The created JDFTXStructure object.

    Return type:

      JDFTXStructure

  get_str(in_cart_coords: bool | None = None) → str

    Return a string to be written as JDFTXInfile tags.

    Allows extra options as compared to calling str(JDFTXStructure) directly.

    Parameters:

      in_cart_coords (bool, optional) – Whether coordinates are output in direct or Cartesian.

    Returns:

      Representation of JDFTXInfile structure tags.

    Return type:

      str

  property natoms: int

    Return number of atoms.

    Returns:

      Number of sites.

    Return type:

      int

  selective_dynamics: ArrayLike | None = None
  sort_structure: bool = False
  structure: Structure = None
  write_cart_coords: bool = False
  write_file(filename: PathLike, **kwargs) → None

    Write JDFTXStructure to a file.

    The supported kwargs are the same as those for the JDFTXStructure.get_str method and are passed through directly.

    Parameters:

      - filename (PathLike) – Filename to write to.

      - **kwargs – Kwargs to pass to JDFTXStructure.get_str.

## pymatgen.io.jdftx.jdftxinfile_master_format module

Master list of AbstractTag-type objects for JDFTx input file generation.

This module contains; - MASTER_TAG_LIST: a dictionary mapping tag categories to dictionaries mapping

> tag names to AbstractTag-type objects.

- get_tag_object: a function that returns an AbstractTag-type object from

    MASTER_TAG_LIST given a tag name.

@mkhorton - this file is ready to review.

get_dump_tag_container() → DumpTagContainer

  Initialize a dump tag container.

  Returns:

    The dump tag container.

  Return type:

    DumpTagContainer

get_tag_object(tag: str) → AbstractTag

  Get the tag object for a given tag name.

  Parameters:

    tag (str) – The tag name.

  Returns:

    The tag object.

  Return type:

    AbstractTag

## pymatgen.io.jdftx.jdftxinfile_ref_options module

Module for containing reference data for JDFTx tags.

This module contains reference data for JDFTx tags, such as valid options for functionals, pseudopotentials, etc.

@mkhorton - this file is ready to review.

## pymatgen.io.jdftx.jdftxoutfileslice module

JDFTx Outfile Slice Class.

This module defines the JDFTxOutfileSlice class, which is used to read and process a JDFTx out file.

class JDFTXOutfileSlice(prefix: str | None = None, jstrucs: JOutStructures | None = None, jsettings_fluid: JMinSettings | None = None, jsettings_electronic: JMinSettings | None = None, jsettings_lattice: JMinSettings | None = None, jsettings_ionic: JMinSettings | None = None, constant_lattice: bool | None = None, xc_func: str | None = None, lattice_initial: np.ndarray | None = None, lattice_final: np.ndarray | None = None, lattice: np.ndarray | None = None, a: float | None = None, b: float | None = None, c: float | None = None, fftgrid: list[int] | None = None, geom_opt: bool | None = None, geom_opt_type: str | None = None, efermi: float | None = None, egap: float | None = None, emin: float | None = None, emax: float | None = None, homo: float | None = None, lumo: float | None = None, homo_filling: float | None = None, lumo_filling: float | None = None, is_metal: bool | None = None, etype: str | None = None, broadening_type: str | None = None, broadening: float | None = None, kgrid: list | None = None, truncation_type: str | None = None, truncation_radius: float | None = None, pwcut: float | None = None, rhocut: float | None = None, pp_type: str | None = None, semicore_electrons: int | None = None, valence_electrons: float | None = None, total_electrons_uncharged: int | None = None, semicore_electrons_uncharged: int | None = None, valence_electrons_uncharged: int | None = None, nbands: int | None = None, atom_elements: list | None = None, atom_elements_int: list | None = None, atom_types: list | None = None, spintype: str | None = None, nspin: int | None = None, nat: int | None = None, atom_coords_initial: list[list[float]] | None = None, atom_coords_final: list[list[float]] | None = None, atom_coords: list[list[float]] | None = None, has_solvation: bool = False, fluid: str | None = None, is_gc: bool | None = None, is_bgw: bool = False, has_eigstats: bool = False, has_parsable_pseudo: bool = False, _total_electrons_backup: int | None = None, total_electrons: float | None = None, _mu_backup: int | None = None, t_s: float | None = None, converged: bool | None = None, structure: Structure | None = None, trajectory: Trajectory | None = None, electronic_output: dict | None = None, eopt_type: str | None = None, elecmindata: JElSteps | None = None, stress: np.ndarray | None = None, strain: np.ndarray | None = None, forces: np.ndarray | None = None, nstep: int | None = None, e: float | None = None, grad_k: float | None = None, alpha: float | None = None, linmin: float | None = None, abs_magneticmoment: float | None = None, tot_magneticmoment: float | None = None, mu: float | None = None, elec_nstep: int | None = None, elec_e: float | None = None, elec_grad_k: float | None = None, elec_alpha: float | None = None, elec_linmin: float | None = None)

  Bases: `object`

  A class to read and process a slice of a JDFTx out file.

  A class to read and process a slice of a JDFTx out file, where a “slice” is a segment of an out file corresponding to a single call of JDFTx.

  from_out_slice(text

    list[str]): Read slice of out file into a JDFTXOutfileSlice instance.

  prefix

    Prefix of dump files for JDFTx calculation.

    Type:

      str | None

  jstrucs

    JOutStructures instance containing intermediate structures. Holds a “slices” attribute, which is a list of JOutStructure instances. (A JOutStructure instance functions as a Structure object, along with a JElSteps instance (stored as elecmindata) and other JDFTx-calculation-specific data.)

    Type:

      JOutStructures | None

  jsettings_fluid

    JMinSettings instance containing fluid optimization settings.

    Type:

      JMinSettings | None

  jsettings_electronic

    JMinSettings instance containing electronic optimization settings.

    Type:

      JMinSettings | None

  jsettings_lattice

    JMinSettings instance containing lattice optimization settings.

    Type:

      JMinSettings | None

  jsettings_ionic

    JMinSettings instance containing ionic optimization settings.

    Type:

      JMinSettings | None

  xc_func

    Exchange-correlation functional used in the calculation.

    Type:

      str | None

  lattice_initial

    Initial lattice matrix in Angstroms.

    Type:

      np.ndarray | None

  lattice_final

    Final lattice matrix in Angstroms.

    Type:

      np.ndarray | None

  lattice

    Current lattice matrix in Angstroms.

    Type:

      np.ndarray | None

  a

    Lattice parameter a in Angstroms.

    Type:

      float | None

  b

    Lattice parameter b in Angstroms.

    Type:

      float | None

  c

    Lattice parameter c in Angstroms.

    Type:

      float | None

  fftgrid

    Shape of FFT grid used in calculation (3 integers).

    Type:

      list[int] | None

  geom_opt

    True if geometric (lattice or ionic) optimization was performed.

    Type:

      bool | None

  geom_opt_type

    Type of geometric optimization performed (lattice or ionic, where lattice implies ionic as well unless geometry was given in direct coordinates).

    Type:

      str | None

  efermi

    Fermi energy in eV (may be None if eigstats are not dumped).

    Type:

      float | None

  egap

    Band gap in eV (None if eigstats are not dumped).

    Type:

      float | None

  emin

    Minimum energy in eV (None if eigstats are not dumped).

    Type:

      float | None

  emax

    Maximum energy in eV (None if eigstats are not dumped).

    Type:

      float | None

  homo

    Energy of last band-state before Fermi level (acronym for Highest Occupied Molecular Orbital, even though these are not molecular orbitals and this state may not be entirely occupied) (None if eigstats are not dumped).

    Type:

      float | None

  lumo

    Energy of first band-state after Fermi level (acronym for Lowest Unoccupied Molecular Orbital, even though these are not molecular orbitals, and this state may not be entirely unoccupied) (None if eigstats are not dumped).

    Type:

      float | None

  homo_filling

    Filling of “homo” band-state as calculated within this class object from the homo energy, Fermi level, electronic broadening type and electronic broadening parameter. (None if eigstats are not dumped).

    Type:

      float | None

  lumo_filling

    Filling of “lumo” band-state as calculated within this class object from the homo energy, Fermi level, electronic broadening type and electronic broadening parameter. (None if eigstats are not dumped).

    Type:

      float | None

  is_metal

    True if fillings of homo and lumo band-states are off-set by 1 and 0 by at least an arbitrary tolerance of 0.01 (ie 1 - 0.015 and 0.012 for homo/lumo fillings would be metallic, while 1-0.001 and 0 would not be). (Only available if eigstats was dumped).

    Type:

      bool | None

  etype

    String representation of total energy-type of system. Commonly “G” (grand-canonical potential) for GC calculations, and “F” for canonical (fixed electron count) calculations.

    Type:

      str | None

  broadening_type

    Type of broadening for electronic filling about Fermi-level requested. Either “Fermi”, “Cold”, “MP1”, or “Gauss”.

    Type:

      str

  broadening

    Magnitude of broadening for electronic filling.

    Type:

      float

  kgrid

    Shape of k-point grid used in calculation. (equivalent to k-point folding).

    Type:

      list[int]

  truncation_type

    Type of coulomb truncation used to prevent interaction between periodic images along certain directions. “periodic” means no coulomb truncation was used.

    Type:

      str

  truncation_radius

    If spherical truncation_type, this is the radius of the coulomb truncation sphere.

    Type:

      float | None

  pwcut

    The plane-wave cutoff energy in Hartrees used in the most recent JDFTx call.

    Type:

      float

  rhocut

    The density cutoff energy in Hartrees used in the most recent JDFTx call.

    Type:

      float

  pp_type

    The pseudopotential library used in the most recent JDFTx call. Currently only “GBRV” and “SG15” are supported by this output parser.

    Type:

      str

  total_electrons

    The total number of electrons in the most recent JDFTx call (redundant to nelectrons).

    Type:

      float

  semicore_electrons

    The number of semicore electrons in the most recent JDFTx call.

    Type:

      int

  valence_electrons

    The number of valence electrons in the most recent JDFTx call.

    Type:

      float

  total_electrons_uncharged

    The total number of electrons in the most recent JDFTx call, uncorrected for charge. (ie total_electrons + charge).

    Type:

      int

  semicore_electrons_uncharged

    The number of semicore electrons in the most recent JDFTx call, uncorrected for charge. (ie semicore_electrons + charge).

    Type:

      int

  valence_electrons_uncharged

    The number of valence electrons in the most recent JDFTx call, uncorrected for charge. (ie valence_electrons + charge).

    Type:

      int

  nbands

    The number of bands used in the most recent JDFTx call.

    Type:

      int

  atom_elements

    The list of each ion’s element symbol in the most recent JDFTx call.

    Type:

      list[str]

  atom_elements_int

    The list of ion’s atomic numbers in the most recent JDFTx call.

    Type:

      list[int]

  atom_types

    Non-repeating list of each ion’s element symbol in the most recent JDFTx call.

    Type:

      list[str]

  spintype

    The spin type used in the most recent JDFTx call. Options are “none”, “collinear”.

    Type:

      str

  nspin

    The number of spins used in the most recent JDFTx call.

    Type:

      int

  nat

    The number of atoms in the most recent JDFTx call.

    Type:

      int

  atom_coords_initial

    The initial atomic coordinates of the most recent JDFTx call.

    Type:

      list[list[float]]

  atom_coords_final

    The final atomic coordinates of the most recent JDFTx call.

    Type:

      list[list[float]]

  atom_coords

    The atomic coordinates of the most recent JDFTx call.

    Type:

      list[list[float]]

  has_solvation

    True if the most recent JDFTx call included a solvation calculation.

    Type:

      bool

  fluid

    The fluid used in the most recent JDFTx call.

    Type:

      str

  is_gc

    True if the most recent slice is a grand canonical calculation.

    Type:

      bool

  is_bgw

    True if data must be usable for a BerkeleyGW calculation (user-set).

    Type:

      bool

  has_eigstats

    True if eigstats were dumped in the most recent JDFTx call.

    Type:

      bool

  has_parsable_pseudo

    True if the most recent JDFTx call used a pseudopotential that can be parsed by this output parser. Options are currently “GBRV” and “SG15”.

    Type:

      bool

  Properties:

    t_s (float | None): The total time in seconds for the calculation. converged (bool | None): True if calculation converged. trajectory (Trajectory): pymatgen Trajectory object containing intermediate Structure’s of outfile slice

    > calculation.

    electronic_output (dict): Dictionary with all relevant electronic information dumped from an eigstats log. structure (Structure): Calculation result as pymatgen Structure. eopt_type (str | None): eopt_type from most recent JOutStructure. elecmindata (JElSteps): elecmindata from most recent JOutStructure. stress (np.ndarray | None): Stress tensor from most recent JOutStructure in units eV/Ang^3. strain (np.ndarray | None): Strain tensor from most recent JOutStructure (unitless). nstep (int | None): (geometric) nstep from most recent JOutStructure. e (float | None): Energy of system “etype” from most recent JOutStructure. grad_k (float): The final norm of the preconditioned gradient for geometric optimization of the most recent

    > JDFTx call (evaluated as dot(g, Kg), where g is the gradient and Kg is the preconditioned gradient). (written as “|grad|_K” in JDFTx output).

    alpha (float): The step size of the final geometric step in the most recent JDFTx call. linmin (float): The final normalized projection of the geometric step direction onto the gradient for the most

    > recent JDFTx call.

    abs_magneticmoment (float | None): The absolute magnetic moment of the most recent JDFTx call. tot_magneticmoment (float | None): The total magnetic moment of the most recent JDFTx call. mu (float): The Fermi energy of the most recent JDFTx call. elec_e (float): The final energy of the most recent electronic optimization step. elec_nstep (int): The number of electronic optimization steps in the most recent JDFTx call. elec_grad_k (float): The final norm of the preconditioned gradient for electronic optimization of the most

    > recent JDFTx call (evaluated as dot(g, Kg), where g is the gradient and Kg is the preconditioned gradient). (written as “|grad|_K” in JDFTx output).

    elec_alpha (float): The step size of the final electronic step in the most recent JDFTx call. elec_linmin (float): The final normalized projection of the electronic step direction onto the gradient for the

    > most recent JDFTx call.

  Magic Methods:
    __getattr__(name: str) -> Any: Overwrite of default __getattr__ method to allow for reference of un-defined

      attributes to the “jstrucs” class field. This referring behavior is ideally never used as (currently) all referrable attributes are defined properties, but is included to prevent errors in the case of future changes.

    __str__() -> str: Return a string representation of the class instance using pprint module. __repr__() -> str: Create string representation of the class instance. Overwritten from default behavior for

    > dataclass so that properties are included in the string, and verbose attributes with redundant information are trimmed.

  a: float | None = None
  abs_magneticmoment: float | None = None
  alpha: float | None = None
  atom_coords: list[list[float]] | None = None
  atom_coords_final: list[list[float]] | None = None
  atom_coords_initial: list[list[float]] | None = None
  atom_elements: list | None = None
  atom_elements_int: list | None = None
  atom_types: list | None = None
  b: float | None = None
  broadening: float | None = None
  broadening_type: str | None = None
  c: float | None = None
  constant_lattice: bool | None = None
  converged: bool | None = None
  determine_is_metal() → bool | None

    Determine if the system is a metal based on the fillings of homo and lumo.

    Returns:

      True if system is metallic.

    Return type:

      bool

  e: float | None = None
  efermi: float | None = None
  egap: float | None = None
  elec_alpha: float | None = None
  elec_e: float | None = None
  elec_grad_k: float | None = None
  elec_linmin: float | None = None
  elec_nstep: int | None = None
  elecmindata: JElSteps | None = None
  electronic_output: dict | None = None
  emax: float | None = None
  emin: float | None = None
  eopt_type: str | None = None
  etype: str | None = None
  fftgrid: list[int] | None = None
  fluid: str | None = None
  forces: np.ndarray | None = None
  geom_opt: bool | None = None
  geom_opt_type: str | None = None
  grad_k: float | None = None
  has_eigstats: bool = False
  has_parsable_pseudo: bool = False
  has_solvation: bool = False
  homo: float | None = None
  homo_filling: float | None = None
  is_bgw: bool = False
  is_gc: bool | None = None
  is_metal: bool | None = None
  jsettings_electronic: JMinSettings | None = None
  jsettings_fluid: JMinSettings | None = None
  jsettings_ionic: JMinSettings | None = None
  jsettings_lattice: JMinSettings | None = None
  jstrucs: JOutStructures | None = None
  kgrid: list | None = None
  lattice: np.ndarray | None = None
  lattice_final: np.ndarray | None = None
  lattice_initial: np.ndarray | None = None
  linmin: float | None = None
  lumo: float | None = None
  lumo_filling: float | None = None
  mu: float | None = None
  nat: int | None = None
  nbands: int | None = None
  nspin: int | None = None
  nstep: int | None = None
  parsable_pseudos: ClassVar[list[str]] = ['GBRV', 'SG15']
  pp_type: str | None = None
  prefix: str | None = None
  pwcut: float | None = None
  rhocut: float | None = None
  semicore_electrons: int | None = None
  semicore_electrons_uncharged: int | None = None
  spintype: str | None = None
  strain: np.ndarray | None = None
  stress: np.ndarray | None = None
  structure: Structure | None = None
  t_s: float | None = None
  to_dict() → dict

    Convert dataclass to dictionary representation.

    Returns:

      JDFTXOutfileSlice in dictionary format.

    Return type:

      dict

  tot_magneticmoment: float | None = None
  total_electrons: float | None = None
  total_electrons_uncharged: int | None = None
  trajectory: Trajectory | None = None
  truncation_radius: float | None = None
  truncation_type: str | None = None
  valence_electrons: float | None = None
  valence_electrons_uncharged: int | None = None
  write() → None

    Return an error.

    Raises:

      NotImplementedError – There is no need to write a JDFTx out file.

  xc_func: str | None = None

get_pseudo_read_section_bounds(text: list[str]) → list[list[int]]

  Get the boundary line numbers for the pseudopotential read section.

  Parameters:

    text (list[str]) – Output of read_file for out file.

  Returns:

    List of line numbers for the pseudopotential read sections.

  Return type:

    list[list[int]]

## pymatgen.io.jdftx.jelstep module

Module for parsing single SCF step from JDFTx.

This module contains the JElStep class for parsing single SCF step from a JDFTx out file.

class JElStep(opt_type: str | None = None, etype: str | None = None, nstep: int | None = None, e: float | None = None, grad_k: float | None = None, alpha: float | None = None, linmin: float | None = None, t_s: float | None = None, mu: float | None = None, nelectrons: float | None = None, abs_magneticmoment: float | None = None, tot_magneticmoment: float | None = None, subspacerotationadjust: float | None = None, converged: bool = False, converged_reason: str | None = None)

  Bases: `object`

  Electronic minimization data for a single SCF step.

  Class object for storing logged electronic minimization data for a single SCF step.

  opt_type

    The type of electronic minimization step (almost always ElecMinimize).

    Type:

      str | None

  etype

    The type of energy component (G, F, or Etot).

    Type:

      str | None

  nstep

    The SCF step number.

    Type:

      int | None

  e

    The total electronic energy in eV.

    Type:

      float | None

  grad_k

    The gradient of the Kohn-Sham energy (along the line minimization direction).

    Type:

      float | None

  alpha

    The step length.

    Type:

      float | None

  linmin

    Normalized line minimization direction / energy gradient projection (-1 for perfectly opposite, 1 for perfectly aligned).

    Type:

      float | None

  t_s

    Time elapsed from beginning of JDFTx calculation.

    Type:

      float | None

  mu

    The chemical potential in eV.

    Type:

      float | None

  nelectrons

    The number of electrons.

    Type:

      float | None

  abs_magneticmoment

    The absolute magnetic moment.

    Type:

      float | None

  tot_magneticmoment

    The total magnetic moment.

    Type:

      float | None

  subspacerotationadjust

    The subspace rotation adjustment factor.

    Type:

      float | None

  abs_magneticmoment: float | None = None
  alpha: float | None = None
  converged: bool = False
  converged_reason: str | None = None
  e: float | None = None
  etype: str | None = None
  grad_k: float | None = None
  linmin: float | None = None
  mu: float | None = None
  nelectrons: float | None = None
  nstep: int | None = None
  opt_type: str | None = None
  subspacerotationadjust: float | None = None
  t_s: float | None = None
  to_dict() → dict

    Return dictionary representation of JElStep object.

    Returns:

      Dictionary representation of JElStep object.

    Return type:

      dict

  tot_magneticmoment: float | None = None

class JElSteps(opt_type: str | None = None, etype: str | None = None, iter_flag: str | None = None, converged: bool | None = None, converged_reason: str | None = None, slices: list[~pymatgen.io.jdftx.jelstep.JElStep] = <factory>)

  Bases: `object`

  Class object for series of SCF steps.

  Class object for collecting and storing a series of SCF steps done between geometric optimization steps.

  opt_type

    The type of electronic minimization step.

    Type:

      str | None

  etype

    The type of energy component.

    Type:

      str | None

  iter_flag

    The flag that indicates the start of a log message for a JDFTx optimization step.

    Type:

      str | None

  converged

    True if the SCF steps converged.

    Type:

      bool

  converged_reason

    The reason for convergence.

    Type:

      str | None

  slices

    A list of JElStep objects.

    Type:

      list[JElStep]

  e

    The total electronic energy in eV.

    Type:

      float | None

  grad_k

    The gradient of the Kohn-Sham energy (along the line minimization direction).

    Type:

      float | None

  alpha

    The step length.

    Type:

      float | None

  linmin

    Normalized line minimization direction / energy gradient projection (-1 for perfectly opposite, 1 for perfectly aligned).

    Type:

      float | None

  t_s

    Time elapsed from beginning of JDFTx calculation.

    Type:

      float | None

  mu

    The chemical potential in eV.

    Type:

      float | None

  nelectrons

    The number of electrons.

    Type:

      float | None

  abs_magneticmoment

    The absolute magnetic moment.

    Type:

      float | None

  tot_magneticmoment

    The total magnetic moment.

    Type:

      float | None

  subspacerotationadjust

    The subspace rotation adjustment factor.

    Type:

      float | None

  nstep

    The SCF step number.

    Type:

      int | None

  abs_magneticmoment: float | None = None
  alpha: float | None = None
  converged: bool | None = None
  converged_reason: str | None = None
  e: float | None = None
  etype: str | None = None
  grad_k: float | None = None
  iter_flag: str | None = None
  linmin: float | None = None
  mu: float | None = None
  nelectrons: float | None = None
  nstep: int | None = None
  opt_type: str | None = None
  slices: list[JElStep]
  subspacerotationadjust: float | None = None
  t_s: float | None = None
  to_dict() → dict[str, Any]

    Return dictionary representation of JElSteps object.

    Returns:

      Dictionary representation of JElSteps object.

    Return type:

      dict

  tot_magneticmoment: float | None = None

## pymatgen.io.jdftx.jminsettings module

Store generic minimization settings read from a JDFTx out file.

This module contains the JMinSettings class for storing generic minimization and mutants for storing specific minimization settings read from a JDFTx out file.

@mkhorton - this file is ready to review.

class JMinSettings(params: dict[str, Any] | None = None)

  Bases: `object`

  Store generic minimization settings read from a JDFTx out file.

  Store generic minimization settings read from a JDFTx out file.

  Initialize a generic JMinSettings class.

  Parameters:

    params (dict[str, Any] | None) – A dictionary of minimization settings.

  params: dict[str, Any] | None = None

class JMinSettingsElectronic(params: dict[str, Any] | None = None)

  Bases: `JMinSettings`

  JMInSettings mutant for electronic minimization settings.

  A class for storing electronic minimization settings read from a JDFTx out file.

  Initialize a generic JMinSettings class.

  Parameters:

    params (dict[str, Any] | None) – A dictionary of minimization settings.

  start_flag: str = 'electronic-minimize'

class JMinSettingsFluid(params: dict[str, Any] | None = None)

  Bases: `JMinSettings`

  JMInSettings mutant for fluid minimization settings.

  A class for storing fluid minimization settings read from a JDFTx out file.

  Initialize a generic JMinSettings class.

  Parameters:

    params (dict[str, Any] | None) – A dictionary of minimization settings.

  start_flag: str = 'fluid-minimize'

class JMinSettingsIonic(params: dict[str, Any] | None = None)

  Bases: `JMinSettings`

  JMInSettings mutant for ionic minimization settings.

  A class for storing ionic minimization settings read from a JDFTx out file.

  Initialize a generic JMinSettings class.

  Parameters:

    params (dict[str, Any] | None) – A dictionary of minimization settings.

  start_flag: str = 'ionic-minimize'

class JMinSettingsLattice(params: dict[str, Any] | None = None)

  Bases: `JMinSettings`

  JMInSettings mutant for lattice minimization settings.

  A class for storing lattice minimization settings read from a JDFTx out file.

  Initialize a generic JMinSettings class.

  Parameters:

    params (dict[str, Any] | None) – A dictionary of minimization settings.

  start_flag: str = 'lattice-minimize'

## pymatgen.io.jdftx.joutstructure module

Class object for storing a single JDFTx geometric optimization step.

A mutant of the pymatgen Structure class for flexibility in holding JDFTx.

class JOutStructure(lattice: ndarray, species: list[str], coords: list[ndarray], site_properties: dict[str, list], **kwargs)

  Bases: `Structure`

  Class object for storing a single JDFTx optimization step.

  A mutant of the pymatgen Structure class for flexibility in holding JDFTx optimization data.

  Properties:

    charges (np.ndarray | None): The Lowdin charges of the atoms in the system. magnetic_moments (np.ndarray | None): The magnetic moments of the atoms in the system.

  opt_type

    The type of optimization step.

    Type:

      str | None

  etype

    The type of energy from the electronic minimization data.

    Type:

      str | None

  eopt_type

    The type of electronic minimization step.

    Type:

      str | None

  emin_flag

    The flag that indicates the start of a log message for a JDFTx optimization step.

    Type:

      str | None

  ecomponents

    The energy components of the system.

    Type:

      dict | None

  elecmindata

    The electronic minimization data.

    Type:

      JElSteps | None

  stress

    The stress tensor.

    Type:

      np.ndarray | None

  strain

    The strain tensor.

    Type:

      np.ndarray | None

  nstep

    The most recent step number.

    Type:

      int | None

  e

    The total energy of the system.

    Type:

      float | None

  grad_k

    The gradient of the electronic density along the most recent line minimization.

    Type:

      float | None

  alpha

    The step size of the most recent SCF step along the line minimization.

    Type:

      float | None

  linmin

    The normalized alignment projection of the electronic energy gradient to the line minimization direction.

    Type:

      float | None

  t_s

    The time in seconds for the optimization step.

    Type:

      float | None

  geom_converged

    Whether the geometry optimization has converged.

    Type:

      bool

  geom_converged_reason

    The reason for geometry optimization convergence.

    Type:

      str | None

  line_types

    The types of lines in a JDFTx out file.

    Type:

      ClassVar[list[str]]

  selective_dynamics

    The selective dynamics flags for the atoms in the system.

    Type:

      list[int] | None

  mu

    The chemical potential (Fermi level) in eV.

    Type:

      float | None

  nelectrons

    The total number of electrons in the electron density.

    Type:

      float | None

  abs_magneticmoment

    The absolute magnetic moment of the electron density.

    Type:

      float | None

  tot_magneticmoment

    The total magnetic moment of the electron density.

    Type:

      float | None

  elec_nstep

    The most recent electronic step number.

    Type:

      int | None

  elec_e

    The most recent electronic energy.

    Type:

      float | None

  elec_grad_k

    The most recent electronic grad_k.

    Type:

      float | None

  elec_alpha

    The most recent electronic alpha.

    Type:

      float | None

  elec_linmin

    The most recent electronic linmin.

    Type:

      float | None

  structure

    The Structure object of the system. (helpful for uses where the JOutStructure metadata causes issues)

    Type:

      Structure | None

  Create a periodic structure.

  Parameters:

    - lattice – The lattice, either as a pymatgen.core.Lattice or simply as any 2D array. Each row should correspond to a lattice vector. e.g. [[10,0,0], [20,10,0], [0,0,30]] specifies a lattice with lattice vectors [10,0,0], [20,10,0] and [0,0,30].

    - species –

      List of species on each site. Can take in flexible input, including:

      1. A sequence of element / species specified either as string symbols, e.g. [“Li”, “Fe2+”, “P”, …] or atomic numbers, e.g. (3, 56, …) or actual Element or Species objects.

      2. List of dict of elements/species and occupancies, e.g. [{“Fe” : 0.5, “Mn”:0.5}, …]. This allows the setup of disordered structures.

    - coords (Nx3 array) – list of fractional/cartesian coordinates of each species.

    - charge (float) – overall charge of the structure. Defaults to behavior in SiteCollection where total charge is the sum of the oxidation states.

    - validate_proximity (bool) – Whether to check if there are sites that are less than 0.01 Ang apart. Defaults to False.

    - to_unit_cell (bool) – Whether to map all sites into the unit cell, i.e., fractional coords between 0 and 1. Defaults to False.

    - coords_are_cartesian (bool) – Set to True if you are providing coordinates in Cartesian coordinates. Defaults to False.

    - site_properties (dict) – Properties associated with the sites as a dict of sequences, e.g. {“magmom”:[5,5,5,5]}. The sequences have to be the same length as the atomic species and fractional_coords. Defaults to None for no properties.

    - labels (list[str]) – Labels associated with the sites as a list of strings, e.g. [‘Li1’, ‘Li2’]. Must have the same length as the species and fractional coords. Defaults to None for no labels.

    - properties (dict) – Properties associated with the whole structure. Will be serialized when writing the structure to JSON or YAML but is lost when converting to other formats.

  abs_magneticmoment: float | None = None
  alpha: float | None = None
  property charges: ndarray | None

    Return the Lowdin charges.

    Returns:

      The Lowdin charges of the atoms in the system.

    Return type:

      np.ndarray

  e: float | None = None
  ecomponents: dict | None = None
  elec_alpha: float | None = None
  elec_e: float | None = None
  elec_grad_k: float | None = None
  elec_linmin: float | None = None
  elec_nstep: int | None = None
  elecmindata: JElSteps | None = None
  emin_flag: str | None = None
  eopt_type: str | None = None
  etype: str | None = None
  forces: np.ndarray | None = None
  geom_converged: bool = False
  geom_converged_reason: str | None = None
  grad_k: float | None = None
  line_types: ClassVar[list[str]] = ['emin', 'lattice', 'strain', 'stress', 'posns', 'forces', 'ecomp', 'lowdin', 'opt']
  linmin: float | None = None
  property magnetic_moments: ndarray | None

    Return the magnetic moments.

    Returns:

      The magnetic moments of the atoms in the system.

    Return type:

      np.ndarray

  mu: float | None = None
  nelectrons: float | None = None
  nstep: int | None = None
  opt_type: str | None = None
  selective_dynamics: list[int] | None = None
  strain: np.ndarray | None = None
  stress: np.ndarray | None = None
  structure: Structure | None = None
  t_s: float | None = None
  to_dict() → dict

    Convert the JOutStructure object to a dictionary.

    Returns:

      A dictionary representation of the JOutStructure object.

    Return type:

      dict

  tot_magneticmoment: float | None = None

## pymatgen.io.jdftx.joutstructures module

Module for JOutStructures class.

This module contains the JOutStructures class for storing a series of JOutStructure.

class JOutStructures(opt_type: str | None = None, geom_converged: bool = False, geom_converged_reason: str | None = None, elec_converged: bool = False, elec_converged_reason: str | None = None, _t_s: float | None = None, slices: list[JOutStructure] = <factory>, eopt_type: str | None = None, etype: str | None = None, emin_flag: str | None = None, ecomponents: list[str] | None = None, elecmindata: JElSteps = None, stress: np.ndarray | None = None, strain: np.ndarray | None = None, forces: np.ndarray | None = None, nstep: int | None = None, e: float | None = None, grad_k: float | None = None, alpha: float | None = None, linmin: float | None = None, nelectrons: float | None = None, abs_magneticmoment: float | None = None, tot_magneticmoment: float | None = None, mu: float | None = None, elec_nstep: int | None = None, elec_e: float | None = None, elec_grad_k: float | None = None, elec_alpha: float | None = None, elec_linmin: float | None = None, charges: np.ndarray[float] | None = None, magnetic_moments: np.ndarray[float] | None = None, selective_dynamics: list[int] | None = None, structure: Structure | None = None)

  Bases: `object`

  Class for storing a series of JStructure objects.

  A class for storing a series of JStructure objects.

  out_slice_start_flag

    The string that marks the beginning of the portion of an out file slice that contains data for a JOutStructures object.

    Type:

      str

  opt_type

    The type of optimization performed on the structures in the JOutStructures object.

    Type:

      str | None

  geom_converged

    Whether the geometry of the last structure in the list has converged.

    Type:

      bool

  geom_converged_reason

    The reason the geometry of the last structure in the list has converged.

    Type:

      str | None

  elec_converged

    Whether the electronic density of the last structure in the list has converged.

    Type:

      bool

  elec_converged_reason

    The reason the electronic density of the last structure in the list has converged.

    Type:

      str | None

  slices

    A list of JOutStructure objects.

    Type:

      list[JOutStructure]

  eopt_type

    The type of electronic optimization performed on the last structure in the list.

    Type:

      str | None

  etype

    String representation of total energy-type of system. Commonly “G”

    Type:

      str | None

  (grand-canonical potential) for GC calculations, and "F" for canonical
    Type:

      fixed electron count

  emin_flag

    The flag for the electronic minimization.

    Type:

      str | None

  ecomponents

    The components of the electronic minimization.

    Type:

      list[str] | None

  elecmindata

    The electronic minimization data.

    Type:

      JElSteps

  stress

    The stress tensor.

    Type:

      np.ndarray | None

  strain

    The strain tensor.

    Type:

      np.ndarray | None

  nstep

    The number of steps in the optimization.

    Type:

      int | None

  e

    The total energy.

    Type:

      float | None

  grad_k

    The final norm of the preconditioned gradient for geometric optimization of the most recent JDFTx call (evaluated as dot(g, Kg), where g is the gradient and Kg is the preconditioned gradient). (written as “|grad|_K” in JDFTx output).

    Type:

      float | None

  alpha

    The step size of the final geometric step in the most recent JDFTx call.

    Type:

      float | None

  linmin

    The final normalized projection of the geometric step direction onto the gradient for the most recent JDFTx call.

    Type:

      float | None

  abs_magneticmoment

    The absolute magnetic moment of the most recent JDFTx call.

    Type:

      float | None

  tot_magneticmoment

    The total magnetic moment of the most recent JDFTx call.

    Type:

      float | None

  mu

    The Fermi energy of the most recent JDFTx call.

    Type:

      float | None

  elec_e

    The final energy of the most recent electronic optimization step.

    Type:

      float

  elec_nstep

    The number of electronic optimization steps in the most recent JDFTx call.

    Type:

      int

  elec_grad_k

    The final norm of the preconditioned gradient for electronic optimization of the most recent JDFTx call (evaluated as dot(g, Kg), where g is the gradient and Kg is the preconditioned gradient). (written as “|grad|_K” in JDFTx output).

    Type:

      float | None

  elec_alpha

    The step size of the final electronic step in the most recent JDFTx call.

    Type:

      float

  elec_linmin

    The final normalized projection of the electronic step direction onto the gradient for the most recent JDFTx call.

    Type:

      float | None

  charges

    The most recent Lowdin-charges.

    Type:

      np.ndarray[float] | None

  magnetic_moments

    The most recent Lowdin-magnetic moments.

    Type:

      np.ndarray[float] | None

  selective_dynamics

    The selective dynamics flags for the most recent JDFTx call.

    Type:

      list[int] | None

  structure

    Cleaned pymatgen Structure object of final JOutStructure

    Type:

      Structure | None

  abs_magneticmoment: float | None = None
  alpha: float | None = None
  charges: np.ndarray[float] | None = None
  e: float | None = None
  ecomponents: list[str] | None = None
  elec_alpha: float | None = None
  elec_converged: bool = False
  elec_converged_reason: str | None = None
  elec_e: float | None = None
  elec_grad_k: float | None = None
  elec_linmin: float | None = None
  elec_nstep: int | None = None
  elecmindata: JElSteps = None
  emin_flag: str | None = None
  eopt_type: str | None = None
  etype: str | None = None
  forces: np.ndarray | None = None
  geom_converged: bool = False
  geom_converged_reason: str | None = None
  grad_k: float | None = None
  linmin: float | None = None
  magnetic_moments: np.ndarray[float] | None = None
  mu: float | None = None
  nelectrons: float | None = None
  nstep: int | None = None
  opt_type: str | None = None
  out_slice_start_flag = '-------- Electronic minimization -----------'
  selective_dynamics: list[int] | None = None
  slices: list[JOutStructure]
  strain: np.ndarray | None = None
  stress: np.ndarray | None = None
  structure: Structure | None = None
  to_dict() → dict

    Convert the JOutStructures object to a dictionary.

    Returns:

      A dictionary representation of the JOutStructures object.

    Return type:

      dict

  tot_magneticmoment: float | None = None

## pymatgen.io.jdftx.outputs module

JDFTx outputs parsing module.

Module for parsing outputs of JDFTx.

Note: JDFTXOutfile will be moved back to its own module once a more broad outputs class is written.

class JDFTXOutfile(slices: list[~pymatgen.io.jdftx.jdftxoutfileslice.JDFTXOutfileSlice] = <factory>)

  Bases: `object`

  JDFTx out file parsing class.

  A class to read and process a JDFTx out file.

  from_file(file_path

    str | Path) -> JDFTXOutfile: Return JDFTXOutfile object from the path to a JDFTx out file.

  slices

    A list of JDFTXOutfileSlice objects. Each slice corresponds to an individual call of the JDFTx executable. Subsequent JDFTx calls within the same directory and prefix will append outputs to the same out file. More than one slice may correspond to restarted calculations, geom + single point calculations, or optimizations done with 3rd-party wrappers like ASE.

    Type:

      list[JDFTXOutfileSlice]

  prefix

    The prefix of the most recent JDFTx call.

    Type:

      str

  jstrucs

    The JOutStructures object from the most recent JDFTx call. This object contains a series of JOutStructure objects in its ‘slices’ attribute, each corresponding to a single structure (multiple iff performing a geometric optimization) as well as convergence data for the structures as a series.

    Type:

      JOutStructures

  jsettings_fluid

    The JMinSettingsFluid object from the most recent JDFTx call. This object contains only a ‘params’ attribute, which is a dictionary of the input parameters for the fluid optimization.

    Type:

      JMinSettingsFluid

  jsettings_electronic

    The JMinSettingsElectronic object from the most recent JDFTx call. This object contains only a ‘params’ attribute, which is a dictionary of the input parameters for the electronic optimization.

    Type:

      JMinSettingsElectronic

  jsettings_lattice

    The JMinSettingsLattice object from the most recent JDFTx call. This object contains only a ‘params’ attribute, which is a dictionary of the input parameters for the lattice optimization.

    Type:

      JMinSettingsLattice

  jsettings_ionic

    The JMinSettingsIonic object from the most recent JDFTx call. This object contains only a ‘params’ attribute, which is a dictionary of the input parameters for the ionic optimization.

    Type:

      JMinSettingsIonic

  xc_func

    The exchange-correlation functional used in the most recent JDFTx call. See documentation for JDFTx online for a list of available exchange-correlation functionals.

    Type:

      str

  lattice_initial

    The initial lattice vectors of the most recent JDFTx call as a 3x3 numpy array. In units of Angstroms.

    Type:

      np.ndarray

  lattice_final

    The final lattice vectors of the most recent JDFTx call as a 3x3 numpy array. In units of Angstroms.

    Type:

      np.ndarray

  lattice

    The lattice vectors of the most recent JDFTx call as a 3x3 numpy array (redundant to lattice_final).

    Type:

      np.ndarray

  a

    Length of the first lattice vector. In units of Angstroms.

    Type:

      float

  b

    Length of the second lattice vector. In units of Angstroms.

    Type:

      float

  c

    Length of the third lattice vector. In units of Angstroms.

    Type:

      float

  fftgrid

    The FFT grid shape used in the most recent JDFTx call. Can be used to properly shape densities dumped as binary files.

    Type:

      list[int]

  geom_opt

    True if the most recent JDFTx call was a geometry optimization (lattice or ionic).

    Type:

      bool

  geom_opt_type

    The type of geometry optimization performed in the most recent JDFTx call. Options are ‘lattice’ or ‘ionic’ if geom_opt, else “single point”. (‘lattice’ optimizations perform ionic optimizations as well unless ion positions are given in direct coordinates).

    Type:

      str

  ecomponents

    The components of the total energy in eV of the most recent JDFTx call.

    Type:

      dict

  efermi

    The Fermi energy in eV of the most recent JDFTx call. Equivalent to “mu”.

    Type:

      float

  egap

    The band gap in eV of the most recent JDFTx call. (Only available if eigstats was dumped).

    Type:

      float

  emin

    The minimum energy in eV (smallest Kohn-Sham eigenvalue) of the most recent JDFTx call. (Only available if eigstats was dumped).

    Type:

      float

  emax

    The maximum energy in eV (largest Kohn-Sham eigenvalue) of the most recent JDFTx call. (Only available if eigstats was dumped).

    Type:

      float

  homo

    The energy in eV of the band-gap lower bound (Highest Occupied Molecular Orbital) (Only available if eigstats was dumped).

    Type:

      float

  lumo

    The energy in eV of the band-gap upper bound (Lowest Unoccupied Molecular Orbital) (Only available if eigstats was dumped).

    Type:

      float

  homo_filling

    The electron filling at the homo band-state. (Only available if eigstats was dumped).

    Type:

      float

  lumo_filling

    The electron filling at the lumo band-state. (Only available if eigstats was dumped).

    Type:

      float

  is_metal

    True if fillings of homo and lumo band-states are off-set by 1 and 0 by at least an arbitrary tolerance of 0.01 (ie 1 - 0.015 and 0.012 for homo/lumo fillings would be metallic, while 1-0.001 and 0 would not be). (Only available if eigstats was dumped).

    Type:

      bool

  converged

    True if most recent SCF cycle converged (and geom forces converged is calc is geom_opt)

    Type:

      bool

  etype

    String representation of total energy-type of system. Commonly “G” (grand-canonical potential) for GC calculations, and “F” for canonical (fixed electron count) calculations.

    Type:

      str

  broadening_type

    Type of broadening for electronic filling about Fermi-level requested. Either “Fermi”, “Cold”, “MP1”, or “Gauss”.

    Type:

      str

  broadening

    Magnitude of broadening for electronic filling.

    Type:

      float

  kgrid

    Shape of k-point grid used in calculation. (equivalent to k-point folding)

    Type:

      list[int]

  truncation_type

    Type of coulomb truncation used to prevent interaction between periodic images along certain directions. “periodic” means no coulomb truncation was used.

    Type:

      str

  truncation_radius

    If spherical truncation_type, this is the radius of the coulomb truncation sphere.

    Type:

      float | None

  pwcut

    The plane-wave cutoff energy in Hartrees used in the most recent JDFTx call.

    Type:

      float

  rhocut

    The density cutoff energy in Hartrees used in the most recent JDFTx call.

    Type:

      float

  pp_type

    The pseudopotential library used in the most recent JDFTx call. Currently only “GBRV” and “SG15” are supported by this output parser.

    Type:

      str

  total_electrons

    The total number of electrons in the most recent JDFTx call (redundant to nelectrons).

    Type:

      float

  semicore_electrons

    The number of semicore electrons in the most recent JDFTx call.

    Type:

      int

  valence_electrons

    The number of valence electrons in the most recent JDFTx call.

    Type:

      float

  total_electrons_uncharged

    The total number of electrons in the most recent JDFTx call, uncorrected for charge. (ie total_electrons + charge)

    Type:

      int

  semicore_electrons_uncharged

    The number of semicore electrons in the most recent JDFTx call, uncorrected for charge. (ie semicore_electrons + charge)

    Type:

      int

  valence_electrons_uncharged

    The number of valence electrons in the most recent JDFTx call, uncorrected for charge. (ie valence_electrons + charge)

    Type:

      int

  nbands

    The number of bands used in the most recent JDFTx call.

    Type:

      int

  atom_elements

    The list of each ion’s element symbol in the most recent JDFTx call.

    Type:

      list[str]

  atom_elements_int

    The list of ion’s atomic numbers in the most recent JDFTx call.

    Type:

      list[int]

  atom_types

    Non-repeating list of each ion’s element symbol in the most recent JDFTx call.

    Type:

      list[str]

  spintype

    The spin type used in the most recent JDFTx call. Options are “none”, “collinear”,

    Type:

      str

  nspin

    The number of spins used in the most recent JDFTx call.

    Type:

      int

  nat

    The number of atoms in the most recent JDFTx call.

    Type:

      int

  atom_coords_initial

    The initial atomic coordinates of the most recent JDFTx call.

    Type:

      list[list[float]]

  atom_coords_final

    The final atomic coordinates of the most recent JDFTx call.

    Type:

      list[list[float]]

  atom_coords

    The atomic coordinates of the most recent JDFTx call.

    Type:

      list[list[float]]

  structure

    The updated pymatgen Structure object of the most recent JDFTx call.

    Type:

      Structure

  trajectory

    The Trajectory object of the most recent JDFTx call.

    Type:

      Trajectory

  has_solvation

    True if the most recent JDFTx call included a solvation calculation.

    Type:

      bool

  fluid

    The fluid used in the most recent JDFTx call.

    Type:

      str

  is_gc

    True if the most recent slice is a grand canonical calculation.

    Type:

      bool

  eopt_type

    The type of energy iteration used in the most recent JDFTx call.

    Type:

      str

  elecmindata

    The JElSteps object from the most recent JDFTx call. This object contains a series of JElStep objects in its ‘steps’ attribute, each corresponding to a single energy iteration.

    Type:

      JElSteps

  stress

    The stress tensor of the most recent JDFTx call as a 3x3 numpy array. In units of eV/Angstrom^3.

    Type:

      np.ndarray

  strain

    The strain tensor of the most recent JDFTx call as a 3x3 numpy array.

    Type:

      np.ndarray

  nstep

    The number of geometric optimization steps in the most recent JDFTx call.

    Type:

      int

  e

    The final energy in eV of the most recent JDFTx call (equivalent to the call’s etype).

    Type:

      float

  grad_k

    The final norm of the preconditioned gradient for geometric optimization of the most recent JDFTx call (evaluated as dot(g, Kg), where g is the gradient and Kg is the preconditioned gradient). (written as “|grad|_K” in JDFTx output).

    Type:

      float

  alpha

    The step size of the final geometric step in the most recent JDFTx call.

    Type:

      float

  linmin

    The final normalized projection of the geometric step direction onto the gradient for the most recent JDFTx call.

    Type:

      float

  abs_magneticmoment

    The absolute magnetic moment of the most recent JDFTx call.

    Type:

      float | None

  tot_magneticmoment

    The total magnetic moment of the most recent JDFTx call.

    Type:

      float | None

  mu

    The Fermi energy in eV of the most recent JDFTx call.

    Type:

      float

  elec_e

    The final energy in eV of the most recent electronic optimization step.

    Type:

      float

  elec_nstep

    The number of electronic optimization steps in the most recent JDFTx call.

    Type:

      int

  elec_grad_k

    The final norm of the preconditioned gradient for electronic optimization of the most recent JDFTx call (evaluated as dot(g, Kg), where g is the gradient and Kg is the preconditioned gradient). (written as “|grad|_K” in JDFTx output).

    Type:

      float

  elec_alpha

    The step size of the final electronic step in the most recent JDFTx call.

    Type:

      float

  elec_linmin

    The final normalized projection of the electronic step direction onto the gradient for the most recent JDFTx call.

    Type:

      float

  Magic Methods:
    __getitem__(key: str | int) -> Any: Decides behavior of how JDFTXOutfile objects are indexed. If the key is a

      string, it will return the value of the property with the same name. If the key is an integer, it will return the slice of the JDFTXOutfile object at that index.

    __len__() -> int: Returns the number of slices in the JDFTXOutfile object. __getattr__(name: str) -> Any: Returns the value of the property with the same name as the input string. __str__() -> str: Returns a string representation of the JDFTXOutfile object.

  a: float
  abs_magneticmoment: float
  alpha: float
  atom_coords: list[list[float]]
  atom_coords_final: list[list[float]]
  atom_coords_initial: list[list[float]]
  atom_elements: list[str]
  atom_elements_int: list[int]
  atom_types: list[str]
  b: float
  broadening: float
  broadening_type: str
  c: float
  converged: bool
  e: float
  efermi: float
  egap: float
  elec_alpha: float
  elec_e: float
  elec_grad_k: float
  elec_linmin: float
  elec_nstep: int
  elecmindata: JElSteps
  electronic_output: float
  emax: float
  emin: float
  eopt_type: str
  etype: str
  fftgrid: list[int]
  fluid: str
  forces: np.ndarray
  classmethod from_calc_dir(calc_dir: str | Path, is_bgw: bool = False, none_slice_on_error: bool = False) → JDFTXOutfile

    Create a JDFTXOutfile object from a directory containing JDFTx out files.

    Parameters:

      - calc_dir (str | Path) – The path to the directory containing the JDFTx out files.

      - is_bgw (bool) – Mark True if data must be usable for BGW calculations. This will change the behavior of the parser to be stricter with certain criteria.

      - none_slice_on_error (bool) – If True, will return None if an error occurs while parsing a slice instead of halting the parsing process. This can be useful for parsing files with multiple slices where some slices may be incomplete or corrupted.

    Returns:

      The JDFTXOutfile object.

    Return type:

      JDFTXOutfile

  classmethod from_file(file_path: str | Path, is_bgw: bool = False, none_slice_on_error: bool | None = None) → JDFTXOutfile

    Create a JDFTXOutfile object from a JDFTx out file.

    Parameters:

      - file_path (str | Path) – The path to the JDFTx out file.

      - is_bgw (bool) – Mark True if data must be usable for BGW calculations. This will change the behavior of the parser to be stricter with certain criteria.

      - none_slice_on_error (bool | None) – If True, will return None if an error occurs while parsing a slice instead of halting the parsing process. This can be useful for parsing files with multiple slices where some slices may be incomplete or corrupted. If False, all slices may raise errors. If None, only the final slice can raise an error upon parsing (default behavior)

    Returns:

      The JDFTXOutfile object.

    Return type:

      JDFTXOutfile

  geom_opt: bool
  geom_opt_type: str
  grad_k: float
  has_solvation: bool
  homo: float
  homo_filling: float
  is_gc: bool
  is_metal: bool
  jsettings_electronic: JMinSettingsElectronic
  jsettings_fluid: JMinSettingsFluid
  jsettings_ionic: JMinSettingsIonic
  jsettings_lattice: JMinSettingsLattice
  jstrucs: JOutStructures
  kgrid: list[int]
  lattice: np.ndarray
  lattice_final: np.ndarray
  lattice_initial: np.ndarray
  linmin: float
  lumo: float
  lumo_filling: float
  mu: float
  nat: int
  nbands: int
  nspin: int
  nstep: int
  pp_type: str
  prefix: str
  pwcut: float
  rhocut: float
  semicore_electrons: int
  semicore_electrons_uncharged: int
  slices: list[JDFTXOutfileSlice]
  spintype: str
  strain: np.ndarray
  stress: np.ndarray
  structure: Structure
  to_dict() → dict

    Convert the JDFTXOutfile object to a dictionary.

    Returns:

      A dictionary representation of the JDFTXOutfile object.

    Return type:

      dict

  tot_magneticmoment: float
  total_electrons: float
  total_electrons_uncharged: int
  trajectory: Trajectory
  truncation_radius: float
  truncation_type: str
  valence_electrons: float
  valence_electrons_uncharged: int
  xc_func: str

class JDFTXOutputs(calc_dir: str | ~pathlib.Path, outfile_name: str | ~pathlib.Path | None, store_vars: list[str] = <factory>)

  Bases: `object`

  JDFTx outputs parsing class.

  A class to read and process JDFTx outputs.

  from_calc_dir(calc_dir

    str | Path, store_vars: list[str] = None) -> JDFTXOutputs: Return JDFTXOutputs object from the path to a directory containing JDFTx out files.

  calc_dir

    The path to the directory containing the JDFTx output files.

    Type:

      str | Path

  store_vars

    A list of the names of dump files to read and store.

    Type:

      list[str]

  paths

    A dictionary of the paths to the dump files.

    Type:

      dict[str, Path]

  outfile

    The JDFTXOutfile object for the out file.

    Type:

      JDFTXOutfile

  bandProjections

    The band projections. Stored in shape (nstates, nbands, nproj) where nstates is nspin*nkpts (nkpts may not equal prod(kfolding) if symmetry reduction occurred), nbands is the number of bands, and nproj is the number of projections. This shape is chosen instead of the pymatgen convention of (nspin, nkpt, nbands, nion, nionproj) to save on memory as nonionproj is different depending on the ion type. This array may also be complex if specified in ‘band-projections-params’ in the JDFTx input, allowing for pCOHP analysis.

    Type:

      np.ndarray

  eigenvals

    The eigenvalues. Stored in shape (nstates, nbands) where nstates is nspin*nkpts (nkpts may not equal prod(kfolding) if symmetry reduction occurred) and nbands is the number of bands.

    Type:

      np.ndarray

  orb_label_list

    A tuple of the orbital labels for the bandProjections file, where the i’th element describes the i’th orbital. Orbital labels are formatted as “<ion>#<ion-number>(<orbital>)”, where <ion> is the element symbol of the ion, <ion-number> is the 1-based index of the ion-type in the structure (ie C#2 would be the second carbon atom, but not necessarily the second ion in the structure), and <orbital> is a string describing “l” and “ml” quantum numbers (ie “p_x” or “d_yz”). Note that while “z” corresponds to the “z” axis, “x” and “y” are arbitrary and may not correspond to the actual x and y axes of the structure. In the case where multiple shells of a given “l” are available within the projections, a 0-based index will appear mimicking a principle quantum number (ie “0px” for first shell and “1px” for second shell). The actual principal quantum number is not stored in the JDFTx output files and must be inferred by the user.

    Type:

      tuple[str, …]

  bandProjections: ndarray | None
  calc_dir: str | Path
  eigenvals: ndarray | None
  classmethod from_calc_dir(calc_dir: str | Path, store_vars: list[str] | None = None, outfile_name: str | Path | None = None) → JDFTXOutputs

    Create a JDFTXOutputs object from a directory containing JDFTx out files.

    Parameters:

      - calc_dir (str | Path) – The path to the directory containing the JDFTx out files.

      - is_bgw (bool) – Mark True if data must be usable for BGW calculations. This will change the behavior of the parser to be stricter with certain criteria.

      - none_slice_on_error (bool) – If True, will return None if an error occurs while parsing a slice instead of halting the parsing process. This can be useful for parsing files with multiple slices where some slices may be incomplete or corrupted.

      - outfile_name (str | Path) – The name of the outfile to use. If None, will search for the outfile in the calc_dir. If provided, will concatenate with calc_dir as the outfile path. Use this if the calc_dir contains multiple files that may be mistaken for the outfile (ie multiple files with the ‘.out’ suffix).

    Returns:

      The JDFTXOutputs object.

    Return type:

      JDFTXOutputs

  orb_label_list: tuple[str, ...] | None
  outfile: JDFTXOutfile
  outfile_name: str | Path | None
  paths: dict[str, Path]
  store_vars: list[str]