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 useStructure.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
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_cell
()get_ekin
()ekin [eV]
get_etot
()Total anergy.
FakeASEAtoms
instance representing this Structure.Forces.
get_mass
()1D array of atomic masses in amu (atomic mass unit 1.660538782e-27 kg as in periodic table).
Dict with number of atoms per species.
Number of atomic species.
Dict which maps
symbols_unique
to numbers, starting at 1.get_return_attr
(attr_name)Call try_set_attr() are return self.<attr_name> if set.
Return spglib input tuple (cell, coords_frac, znucl).
Stress tensor
List of atomic symbols.
List of unique atom symbols.
[K]
get_time
()get_traj
(nstep)Return a Trajectory object, where this Structure is copied nstep times.
List of atom type integers in
self.order
, same length as symbols.Calculate velocity from coords and timestep if velocity=None.
All atomic numbers.
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