Atoms¶
-
class
sisl.
Atoms
(atoms=None, na=None)¶ Bases:
object
A list-like object to contain a list of different atoms with minimum data duplication.
This holds multiple
Atom
objects which are indexed via a species index. This is convenient when having geometries with millions of atoms because it will not duplicate theAtom
object, only a list index.- Parameters
-
atom
¶ a list of unique atoms in this object
- Type
list of Atom
-
specie
¶ a list of unique specie indices
- Type
(na, )
-
q0
¶ initial charge on each orbital
- Type
(no, )
-
mass
¶ mass for each atom
- Type
(na, )
-
firsto
¶ a list of orbital indices for each atom, this corresponds to the first orbital on each of the atoms. The last element is the total number of orbitals and is equivalent to
no
.- Type
(no + 1,)
-
lasto
¶ a list of orbital indices for each atom, this corresponds to the last orbital on each of the atoms.
- Type
(no, )
Attributes
Return an array of atomic numbers (integers)
__doc__
__hash__
__module__
__slots__
_atom
_firsto
_specie
List of unique atoms in this group of atoms
The first orbital of the corresponding atom in the consecutive list of orbitals
The lasto orbital of the corresponding atom in the consecutive list of orbitals
Return an array of masses of the contained objects
Return the total number of orbitals in this list of atoms
Number of different species
Return an array of orbitals of the contained objects
Initial charge per atom
Atomic specie list
Methods
__contains__
(key)Determine whether the key is in the unique atoms list
__delattr__
Implement delattr(self, name).
__dir__
Default dir() implementation.
__eq__
(b)Returns true if the contained atoms are the same
__format__
Default object formatter.
__ge__
Return self>=value.
__getattribute__
Return getattr(self, name).
__getitem__
(key)Return an
Atom
object corresponding to the key(s)__getstate__
()Return the state of this object
__gt__
Return self>value.
__init__
([atoms, na])Initialize self.
__init_subclass__
This method is called when a class is subclassed.
__iter__
()Loop on all atoms with the same specie in order of atoms
__le__
Return self<=value.
__len__
()Return number of atoms in the object
__lt__
Return self<value.
__ne__
Return self!=value.
__new__
Create and return a new object.
__reduce__
Helper for pickle.
__reduce_ex__
Helper for pickle.
__repr__
()Return repr(self).
__setattr__
Implement setattr(self, name, value).
__setitem__
(key, value)Overwrite an
Atom
object corresponding to the key(s)__setstate__
(d)Re-create the state of this object
__sizeof__
Size of object in memory, in bytes.
__str__
()Return the
Atoms
in str__subclasshook__
Abstract classes can override this to customize issubclass().
_update_orbitals
()Internal routine for updating the
firsto
attributeadd
(other)Append other to this list of atoms and return the appended version
append
(other)Append other to this list of atoms and return the appended version
copy
()Return a copy of this atom
equal
(other[, R])True if the contained atoms are the same in the two lists (also checks indices)
hassame
(other[, R])True if the contained atoms are the same in the two lists
index
(atom)Return the species index of the atom object
insert
(index, other)Insert other atoms into the list of atoms at index
iter
([species])Loop on all atoms
maxR
([all])The maximum radius of the atoms
orbital
(io)Return an array of orbital of the contained objects
prepend
(other)reduce
([in_place])Returns a new
Atoms
object by removing non-used atomsremove
(atoms)Remove a set of atoms
reorder
([in_place])Reorders the atoms and species index so that they are ascending (starting with a specie that exists)
repeat
(reps)Repeat this atom object
replace
(index, atom)Replace all atomic indices
index
with the atomatom
(in-place)replace_atom
(atom_from, atom_to)Replace all atoms equivalent to atom_from with atom_to (in-place)
reverse
([atoms])Returns a reversed geometry
scale
(scale)Scale the atomic radii and return an equivalent atom.
sub
(atoms)Return a subset of the list
swap
(a, b)Swaps all atoms
swap_atom
(a, b)Swap specie index positions
tile
(reps)Tile this atom object
-
property
Z
¶ Return an array of atomic numbers (integers)
-
add
(other)¶ Append other to this list of atoms and return the appended version
-
property
atom
¶ List of unique atoms in this group of atoms
-
equal
(other, R=True)[source]¶ True if the contained atoms are the same in the two lists (also checks indices)
- Parameters
See also
hassame
only check whether the two atoms are contained in both
-
property
firsto
¶ The first orbital of the corresponding atom in the consecutive list of orbitals
-
hassame
(other, R=True)[source]¶ True if the contained atoms are the same in the two lists
Notes
This does not necessarily mean that the order, nor the number of atoms are the same.
- Parameters
See also
equal
explicit check of the indices and the contained atoms
-
iter
(species=False)[source]¶ Loop on all atoms
This iterator may be used in two contexts:
species is
False
, this is the slowest method and will yield theAtom
per contained atom.species is
True
, which yields a tuple of (Atom, list) wherelist
contains all indices of atoms that has theAtom
specie. This is much faster than the first option.
- Parameters
species (bool, optional) – If
True
loops only on different species and yields a tuple of (Atom, list) Else yields the atom for the equivalent index.
-
property
lasto
¶ The lasto orbital of the corresponding atom in the consecutive list of orbitals
-
property
mass
¶ Return an array of masses of the contained objects
-
maxR
(all=False)[source]¶ The maximum radius of the atoms
- Parameters
all (bool) – determine the returned maximum radii. If True is passed an array of all atoms maximum radii is returned (array). Else, if False the maximum of all atoms maximum radii is returned (scalar).
-
property
no
¶ Return the total number of orbitals in this list of atoms
-
property
nspecie
¶ Number of different species
-
property
orbitals
¶ Return an array of orbitals of the contained objects
-
property
q0
¶ Initial charge per atom
-
reorder
(in_place=False)[source]¶ Reorders the atoms and species index so that they are ascending (starting with a specie that exists)
- Parameters
in_place (bool, optional) – whether the re-order is done in-place
-
replace
(index, atom)[source]¶ Replace all atomic indices
index
with the atomatom
(in-place)This is the preferred way of replacing atoms in geometries.
- Parameters
index (list of int or Atom) – the indices of the atoms that should be replaced by the new atom. If an
Atom
is passed, this routine defers its call toreplace_atom
.atom (Atom) – the replacement atom.
-
replace_atom
(atom_from, atom_to)[source]¶ Replace all atoms equivalent to atom_from with atom_to (in-place)
I.e. this is the preferred way of adapting all atoms of a specific type with another one.
If the two atoms does not have the same number of orbitals a warning will be raised.
- Parameters
:raises KeyError : if atom_from does not exist in the list of atoms: :raises UserWarning : if the atoms does not have the same number of orbitals.:
-
reverse
(atoms=None)[source]¶ Returns a reversed geometry
Also enables reversing a subset of the atoms.
-
scale
(scale)[source]¶ Scale the atomic radii and return an equivalent atom.
- Parameters
scale (float) – the scale factor for the atomic radii
-
property
specie
¶ Atomic specie list