core

UnitCell class

class core.UnitCell(lattice_matrix: Optional[numpy.ndarray] = None, atom_type: Optional[InterPhon.util.AtomType] = None, num_atom: Optional[numpy.ndarray] = None, selective: bool = False, coordinate: Optional[str] = None, atom_cart: Optional[numpy.ndarray] = None, atom_true: Optional[InterPhon.util.SelectIndex] = None, xyz_true: Optional[InterPhon.util.SelectIndex] = None, mass_true: Optional[numpy.ndarray] = None)[source]

Unit cell class to construct an unit cell object in a standardized format. The information about atomic structure of interest is stored in the instance variables of this class. This class interacts with input files of different DFT programs by employing the modules in inout sub-package.

Parameters
  • lattice_matrix (np.ndarray[float]) – ‘(3, 3) size’ matrix for the lattice vectors of unit cell, defaults to None

  • atom_type (AtomType) – List of atom type in unit cell, defaults to None

  • num_atom (np.ndarray[int]) – Matrix of the number of atoms of each atom type, defaults to None

  • selective (bool) – Selective dynamics (True) or not (False), defaults to False

  • coordinate (str) – ‘direct’ or ‘cartesian’ coordinate, defaults to None

  • atom_cart (np.ndarray[float]) – ‘(total number of atoms, 3) size’ matrix for atom positions in cartesian coordinate, defaults to None

  • atom_true (SelectIndex) – Index of selected atoms which are allowed to move, defaults to None

  • xyz_true (SelectIndex) – (SelectIndex) Index of the atoms which are allowed to move for each x, y, z cartesian direction, defaults to None

  • mass_true (np.ndarray[float]) – ‘(3 * number of selected atoms, ) size’ matrix for mass of selected atoms, defaults to None

initialization()[source]

Initialize the instance variables.

read_unit_cell(in_file: InterPhon.util.FilePath, code_name: str = 'vasp') None[source]

Set the variables of UnitCell instance by reading input file of DFT programs.

Parameters
  • in_file (str) – Path of DFT input file to read

  • code_name (str) – Indicate a DFT program corresponding to the input file, defaults to vasp

set_mass_true() None[source]

Set the instance variable (self.mass_true) for selected atoms which are allowed to move by employing the get_atomic_weight fuction in util sub-package.

write_unit_cell(out_file: InterPhon.util.FilePath, comment: str = 'Unknown', code_name: str = 'vasp') InterPhon.util.File[source]

Write the input file of DFT programs from the information stored in an UnitCell instance.

Parameters
  • out_file (str) – Name of DFT input file to write

  • comment (str) – Comment to be written in the DFT input file, defaults to Unknown

  • code_name (str) – Specification of the file-format by a DFT program, defaults to vasp

SuperCell class

class core.SuperCell(*args: Any, **kwargs: Any)[source]

Super cell class to construct an super cell object in a standardized format. This child class is inherited from the core.UnitCell parent class. The information about atomic structure of super cell is stored in the instance variables of this class. The instance variables are set by the core.SuperCell.set_super_cell and core.SuperCell.set_super_ind_true methods.

Parameters
  • lattice_matrix (np.ndarray[float]) – ‘(3, 3) size’ matrix for the lattice vectors of unit cell, defaults to None

  • atom_type (AtomType) – List of atom type in unit cell, defaults to None

  • num_atom (np.ndarray[int]) – Matrix of the number of atoms of each atom type, defaults to None

  • selective (bool) – Selective dynamics (True) or not (False), defaults to False

  • coordinate (str) – ‘direct’ or ‘cartesian’ coordinate, defaults to None

  • atom_cart (np.ndarray[float]) – ‘(total number of atoms, 3) size’ matrix for atom positions in cartesian coordinate, defaults to None

  • atom_true (SelectIndex) – Index of selected atoms which are allowed to move, defaults to None

  • xyz_true (SelectIndex) – (SelectIndex) Index of the atoms which are allowed to move for each x, y, z cartesian direction, defaults to None

  • mass_true (np.ndarray[float]) – ‘(3 * number of selected atoms, ) size’ matrix for mass of selected atoms, defaults to None

set_super_cell(unit_cell: InterPhon.core.unit_cell.UnitCell, user_arg: InterPhon.core.pre_check.PreArgument) None[source]

Set the variables of SuperCell instance from the information stored in given UnitCell and UserArgument instances.

Parameters
set_super_ind_true(unit_cell: InterPhon.core.unit_cell.UnitCell, user_arg: InterPhon.core.pre_check.PreArgument) None[source]

Set the SuperCell index of selected atoms from the information stored in given UnitCell and UserArgument instances.

Parameters

PreArgument class

class core.PreArgument(displacement: Optional[float] = None, enlargement: Optional[numpy.ndarray] = None, periodicity: Optional[numpy.ndarray] = None)[source]

Pre argument class to construct an argument object during pre-process. The information about user arguments is stored in the instance variables of this class. The instance variables are set by the core.PreArgument.set_user_argument method, and their validity is checked by the core.PreArgument.check_user_argument method.

Parameters
  • displacement (float) – Displacement length (unit: Angst), defaults to None

  • enlargement (np.ndarray[int]) – Extension ratio along each a, b, c lattice direction, defaults to None

  • periodicity (np.ndarray[bool]) – Periodic (True) or not (False) along each a, b, c direction, defaults to None

check_user_argument() None[source]

Check the validity of instance variable.

initialization()[source]

Initialize the instance variables.

set_user_argument(dict_args: dict) None[source]

Set the variables of PreArgument instance from the information given by user.

Parameters

dict_args (dict) – Argument dictionary given by user

PostArgument class

class core.PostArgument(*args: Any, **kwargs: Any)[source]

Post argument class to construct an argument object during post-process. This child class is inherited from the core.PreArgument parent class. The information about user arguments is stored in the instance variables of this class. The instance variables are set by the inherited core.PreArgument.set_user_argument method, and their validity is checked by the inherited core.PreArgument.check_user_argument method and the core.PostArgument.check_match_argument method.

Parameters
  • displacement (float) – Displacement length (unit: Angst), defaults to None

  • enlargement (np.ndarray[int]) – Extension ratio along each a, b, c lattice direction, defaults to None

  • periodicity (np.ndarray[bool]) – Periodic (True) or not (False) along each a, b, c direction, defaults to None

check_match_argument(unit_cell: InterPhon.core.UnitCell, super_cell: InterPhon.core.SuperCell) None[source]

Check the consistency of user arguments between pre- and post-processes.

Parameters

PreProcess class

class core.PreProcess(user_arg=InterPhon.core.pre_check.PreArgument, unit_cell=InterPhon.core.unit_cell.UnitCell, super_cell=InterPhon.core.super_cell.SuperCell)[source]

Pre process class to control pre-process. After pre-process is successfully done, the files of displaced supercells and a pre-process record file (pre_process.yaml) will be generated. The information required in pre-process is stored in the instance variables of this class. The instance variables are set by the core.PreProcess.set_user_arg, core.PreProcess.set_unit_cell, and core.PreProcess.set_super_cell methods.

Parameters
set_super_cell(out_file: InterPhon.util.FilePath, comment: str = 'Supercell', write_file: bool = True, code_name: str = 'vasp') InterPhon.util.File[source]

Set a SuperCell instance from the information stored in its UnitCell and UserArgument instances.

Parameters
  • out_file (str) – Name of DFT input file to write

  • comment (str) – Comment to be written in the DFT input file, defaults to Supercell

  • write_file (bool) – Write (True) or not (False) the DFT input file from the information stored in its SuperCell instance, defaults to True

  • code_name (str) – Specification of the file-format by a DFT program, defaults to vasp

set_unit_cell(in_file: InterPhon.util.FilePath, code_name: str = 'vasp') None[source]

Set a UnitCell instance by reading input file of DFT programs.

Parameters
  • in_file (str) – Path of DFT input file to read

  • code_name (str) – Indicate a DFT program corresponding to the input file, defaults to vasp

set_user_arg(dict_args: dict) None[source]

Set a PreArgument instance from the information given by user.

Parameters

dict_args (dict) – Argument dictionary given by user

write_displace_cell(out_file: InterPhon.util.FilePath, code_name: str = 'vasp', sym_flag: bool = True) InterPhon.util.File[source]

Write displaced supercell files in a format of DFT input file.

Parameters
  • out_file (str) – Name of DFT input file to write

  • code_name (str) – Specification of the file-format by a DFT program, defaults to vasp

  • sym_flag (bool) – Specify whether to use symmetry operation, defaults to True

PostProcess class

class core.PostProcess(*args: Any, **kwargs: Any)[source]

Post process class to control post-process. This child class is inherited from the core.PreProcess parent class. The information required in post-process is stored in the instance variables of this class. The instance variables are set by the core.PostProcess.set_user_arg, core.PostProcess.set_reciprocal_lattice, core.PostProcess.set_force_constant, and core.PostProcess.set_k_points methods. From the instance variables, eigen-frequency and eigen-mode are calculated using the core.PostProcess.eval_phonon method, which will be further analyzed by employing the modules in analysis sub-package.

Parameters
  • in_file_unit_cell (str) – Path of unit cell input file

  • in_file_super_cell (str) – Path of super cell input file

  • code_name (str) – Specification of the file-format by a DFT program, defaults to vasp

  • user_arg (core.PostArgument) – Instance of PostArgument class

  • unit_cell (core.UnitCell) – Instance of UnitCell class

  • super_cell (core.SuperCell) – Instance of SuperCell class

eval_phonon() None[source]

Set the instance variables, eigen-frequency (self.w_q) and corresponding eigen-mode (self.v_q).

set_force_constant(force_files: InterPhon.util.FilePath, code_name: str = 'vasp', sym_flag: bool = True) None[source]

Set the instance variable (self.force_constant).

Parameters
  • force_files (str) – Path of DFT output files which contain atomic forces

  • code_name (str) – Specification of the file-format by a DFT program, defaults to vasp

  • sym_flag (bool) – Specify whether to use symmetry operation, defaults to True

set_k_points(k_file: InterPhon.util.FilePath) None[source]

Set the instance variable (self.k_points) by reading KPOINTS file given in VASP format. The following four samplings of the wave vector k are available: 1) Gamma-centered 2) Monkhorst-Pack 3) Line-path generation (for band plot) 4) Explicit designation

For more details, see the following reference: “The Basics of Electronic Structure Theory for Periodic Systems, Frontiers in chemistry 7, 1 (2019)”.

Parameters

k_file (str) – Path of KPOINTS file

set_reciprocal_lattice() None[source]

Set the instance variable (self.reciprocal_matrix).

set_user_arg(dict_args: dict) None[source]

Set a PostArgument instance from the information given by user.

Parameters

dict_args (dict) – Argument dictionary given by user