pymatgen.io.pwscf module

class PWInput(structure, pseudo, control=None, system=None, electrons=None, ions=None, cell=None, kpoints_mode='automatic', kpoints_grid=(1, 1, 1), kpoints_shift=(0, 0, 0))[source]

Bases: object

Base input file class. Right now, only supports no symmetry and is very basic.

Initializes a PWSCF input file.

Parameters:
  • structure (Structure) – Input structure
  • pseudo (dict) – A dict of the pseudopotentials to use.
  • control (dict) – Control parameters. Refer to official PWSCF doc on supported parameters. Default to {“calculation”: “scf”}
  • system (dict) – System parameters. Refer to official PWSCF doc on supported parameters. Default to None, which means {}.
  • electrons (dict) – Electron parameters. Refer to official PWSCF doc on supported parameters. Default to None, which means {}.
  • ions (dict) – Ions parameters. Refer to official PWSCF doc on supported parameters. Default to None, which means {}.
  • cell (dict) – Cell parameters. Refer to official PWSCF doc on supported parameters. Default to None, which means {}.
  • kpoints_mode (str) – Kpoints generation mode. Default to automatic.
  • kpoints_grid (sequence) – The kpoint grid. Default to (1, 1, 1).
  • kpoints_shift (sequence) – The shift for the kpoints. Defaults to (0, 0, 0).
write_file(filename)[source]

Write the PWSCF input file.

Parameters:filename (str) – The string filename to output to.
exception PWInputError[source]

Bases: BaseException

class PWOutput(filename)[source]

Bases: object

final_energy
get_celldm(i)[source]
lattice_type
patterns = {'energies': 'total energy\\s+=\\s+([\\d\\.\\-]+)\\sRy', 'ecut': 'kinetic\\-energy cutoff\\s+=\\s+([\\d\\.\\-]+)\\s+Ry', 'lattice_type': 'bravais\\-lattice index\\s+=\\s+(\\d+)', 'celldm1': 'celldm\\(1\\)=\\s+([\\d\\.]+)\\s', 'celldm2': 'celldm\\(2\\)=\\s+([\\d\\.]+)\\s', 'celldm3': 'celldm\\(3\\)=\\s+([\\d\\.]+)\\s', 'celldm4': 'celldm\\(4\\)=\\s+([\\d\\.]+)\\s', 'celldm5': 'celldm\\(5\\)=\\s+([\\d\\.]+)\\s', 'celldm6': 'celldm\\(6\\)=\\s+([\\d\\.]+)\\s', 'nkpts': 'number of k points=\\s+([\\d]+)'}
read_pattern(patterns, reverse=False, terminate_on_match=False, postprocess=<class 'str'>)[source]

General pattern reading. Uses monty’s regrep method. Takes the same arguments.

Parameters:
  • patterns (dict) – A dict of patterns, e.g., {“energy”: “energy(sigma->0)s+=s+([d-.]+)”}.
  • reverse (bool) – Read files in reverse. Defaults to false. Useful for large files, esp OUTCARs, especially when used with terminate_on_match.
  • terminate_on_match (bool) – Whether to terminate when there is at least one match in each key in pattern.
  • postprocess (callable) – A post processing function to convert all matches. Defaults to str, i.e., no change.
Renders accessible:
Any attribute in patterns. For example, {“energy”: “energy(sigma->0)s+=s+([d-.]+)”} will set the value of self.data[“energy”] = [[-1234], [-3453], ...], to the results from regex and postprocess. Note that the returned values are lists of lists, because you can grep multiple items on one line.