pwtools.parse.PwMDOutputFile

class pwtools.parse.PwMDOutputFile(filename=None, use_alat=True, **kwds)[source]

Bases: TrajectoryFileParser, PwSCFOutputFile

Parse pw.x MD-like output.

Tested so far: md, relax, vc-relax. For vc-md, see PwVCMDOutputFile.

Notes

Units: Notes on units for PwSCFOutputFile, esp. alat, apply here as well. Additionally, the ATOMIC_POSITIONS and CELL_PARAMETERS blocks can have an optional unit, which we account for. See get_cell(), get_coords() and methods called in there.

ATOMIC_POSITIONS <empty> | bohr | angstrom | alat | crystal
CELL_PARAMETERS <empty> | (alat=…) | bohr | angstrom | alat

In each case, the quantity is multiplied by alat if applicable and converted to Bohr, which is PWscf’s default length, and later to Ang by default (or whatever self.units[‘length’] does).

Initial SCF run: A special “feature” of pwscf is that SCF coords+cell output is printed differently from MD-like output (where we have ATOMIC_POSITIONS and CELL_PARAMETERS blocks). Since this parser uses only the latter, the first etot+coords+cell+stress+… is skipped, i.e. the complete iteration=0 = initial SCF run. Therefore, if you use tr=io.read_pw_md('pw.out'), tr[0] is actually NOT your start input structure! It is the first structure of the MD/relax. This may be a problem if you need to accurately calculate differences between initial and final relax structs, for instance. Then use:

>>> st = io.read_pw_scf('pw.out') # parse initial SCF output only: step=0
>>> tr_md = io.read_pw_md('pw.out') # parse MD-like output: step=1...end
>>> tr = crys.concatenate((st, tr_md))
__init__(filename=None, use_alat=True, **kwds)[source]

Methods

apply_units()

Like _apply_units_raw(), make sure that units are only applied once.

assert_attr(attr)

Raise AssertionError if self.<attr> is not set (is_set_attr() returns False.

assert_attr_lst(attr_lst)

assert_set_attr(attr)

Same as assert_attr(), but run try_set_attr() first.

assert_set_attr_lst(attr_lst)

check_set_attr(attr)

Run try_set_attr() and return the result of is_set_attr(), i.e. True or False.

check_set_attr_lst(attr_lst)

dump(dump_filename[, mkdir])

Write object to binary file using pickle.

get_alat([use_alat])

Lattice parameter "alat" [Bohr].

get_cell()

Cell [Bohr].

get_cell_unit()

get_cont([auto_calc])

Populate and return a Container object.

get_coords()

Cartesian coords [Bohr].

get_coords_frac()

Fractional coords.

get_coords_unit()

get_ekin()

Ion kinetic energy [Ry].

get_etot()

[Ry]

get_forces()

[Ry / Bohr]

get_natoms()

get_nkpoints()

get_nstep_scf()

get_return_attr(attr_name)

Call try_set_attr() are return self.<attr_name> if set.

get_scf_converged()

get_stress()

Stress tensor [kbar].

get_struct(**kwds)

get_symbols()

get_temperature()

Temperature [K]

get_timestep()

Time step [tryd].

get_traj(**kwds)

init_attr_lst([attr_lst])

Set each self.<attr> in attr_lst to None.

is_set_attr(attr)

Check if self has the attribute self.<attr> and if it is _not_ None.

is_set_attr_lst(attr_lst)

load(dump_filename)

Load pickled object.

parse()

raw_return(attr_name)

Call try_set_attr(_<attr_name>_raw) and return it if set, else None.

raw_slice_get(attr_name, sl, axis)

Shortcut method:

set_all([attr_lst])

Call getter for each attr name in attr_lst.

set_attr_lst(attr_lst)

Set self.attr_lst and init each attr to None.

try_set_attr(attr)

If self.<attr> does not exist or is None, then invoke an appropirately named getter as if this command would be executed.

try_set_attr_lst(attr_lst)

update_units(units)

Update self.units dict from units.

Attributes

default_units

timeaxis