pwtools.crys.FakeASEAtoms

class pwtools.crys.FakeASEAtoms(scaled_positions=None, cell=None, symbols=None)[source]

Bases: Structure

Mimic the basic behavior of ase.Atoms.

Used to be used as input for spglib in symmetry.py, but not anymore as of spglib 1.9.x. Now, we use Structure.get_spglib().

__init__(scaled_positions=None, cell=None, symbols=None)[source]
Parameters:
  • coords ((natoms, 3) [Ang]) – Cartesian coords. Optional if coords_frac given.

  • coords_frac ((natoms, 3)) – Fractional coords w.r.t. cell. Optional if coords given.

  • symbols (sequence of strings (natoms,)) – atom symbols

  • cell ((3,3)) – Unit cell vectors as rows. [Ang] Optional if cryst_const given.

  • cryst_const ((6,)) – [a,b,c,alpha,beta,gamma]; a,b,c in [Ang] Optional if cell given.

  • forces ((nstep,natoms,3)) – [eV/Ang]

  • stress ((nstep,3,3)) – stress tensor [GPa]

  • etot (float, optional) – total energy [eV]

  • units (optional, dict,) – see UnitsHandler

  • set_all_auto (optional, bool) – Call set_all() in __init__().

  • Trajectory (Only)

  • ekin ((nstep,)) – [eV]

  • forces – [eV/Ang]

  • pressure ((nstep,)) – [GPa]

  • stress – [GPa]

  • temperature ((nstep,)) – [K]

  • timestep (float) – [fs]

  • velocity ((nstep, natoms, 3)) – [Ang/fs]

  • volume ((nstep,)) – [Ang^3]

Notes

cell, cryst_constProvide either cell or cryst_const, or both

(which is redundant). If only one is given, the other is calculated from it. See {cell2cc,cc2cell}.

coords, coords_fracProvide either coords or coords_frac, or both

(which is redundant). If only one is given, the other is calculated from it. See coord_trans().

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)

compress([forget, dtype])

Compress Trajectory by deleting unused or redundant attrs (see forget).

copy()

Return a copy of the inctance.

dump(dump_filename[, mkdir])

Write object to binary file using pickle.

get_ase_atoms(**kwds)

Return ASE Atoms object.

get_atomic_numbers()

get_cell()

get_coords()

get_coords_frac()

get_cryst_const()

get_ekin()

ekin [eV]

get_etot()

Total anergy.

get_fake_ase_atoms()

FakeASEAtoms instance representing this Structure.

get_forces()

Forces.

get_magnetic_moments()

get_mass()

1D array of atomic masses in amu (atomic mass unit 1.660538782e-27 kg as in periodic table).

get_mass_unique()

get_natoms()

get_nspecies()

Dict with number of atoms per species.

get_nstep()

get_ntypat()

Number of atomic species.

get_order()

Dict which maps symbols_unique to numbers, starting at 1.

get_pressure()

get_return_attr(attr_name)

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

get_spglib()

Return spglib input tuple (cell, coords_frac, znucl).

get_stress()

Stress tensor

get_symbols()

List of atomic symbols.

get_symbols_unique()

List of unique atom symbols.

get_temperature()

[K]

get_time()

get_timestep()

get_traj(nstep)

Return a Trajectory object, where this Structure is copied nstep times.

get_typat()

List of atom type integers in self.order, same length as symbols.

get_velocity()

Calculate velocity from coords and timestep if velocity=None.

get_volume()

get_znucl()

All atomic numbers.

get_znucl_unique()

Unique atomic numbers.

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.

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()

Extend arrays, apply units, call all getters.

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

is_struct

is_traj

timeaxis