Atoms¶
-
class
sisl.Atoms(atom=None, na=None)[source]¶ A list-like object to contain a list of different atoms with minimum data duplication.
This holds multiple
Atomobjects which are indexed via a species index. This is convenient when having geometries with millions of atoms because it will not duplicate theAtomobject, only a list index.Parameters: - atom : list of Atom
atoms to be contained in this list of atoms
- na : int or None
total number of atoms, if
len(atom)is smaller than na it will be repeated to match na.
Attributes: atom: list of AtomReturn the unique atoms list
specie: (na, )Return the specie list
no: intReturn the total number of orbitals in this list of atoms
q0: (no, )Initial charge per atom
mass: (na, )Return an array of masses of the contained objects
firsto: (no + 1,)The first orbital of the corresponding atom in the consecutive list of orbitals
lasto: (no, )The lasto orbital of the corresponding atom in the consecutive list of orbitals
Attributes
ZReturn an array of atomic numbers atomReturn the unique atoms list firstoThe first orbital of the corresponding atom in the consecutive list of orbitals lastoThe lasto orbital of the corresponding atom in the consecutive list of orbitals massReturn an array of masses of the contained objects noReturn the total number of orbitals in this list of atoms orbitalsReturn an array of orbitals of the contained objects q0Initial charge per atom specieReturn the specie list Methods
__init__([atom, na])Initialize self. add(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 Atomsobject by removing non-used atomsremove(atom)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 indexwith the atomatom(in-place)replace_atom(atom_from, atom_to)Replace all atoms equivalent to atom_from with atom_to (in-place) reverse([atom])Returns a reversed geometry scale(scale)Scale the atomic radii and return an equivalent atom. sub(atom)Return a subset of the list swap(a, b)Swaps atoms tile(reps)Tile this atom object -
Z¶ Return an array of atomic numbers
-
add(other)¶ Append other to this list of atoms and return the appended version
Parameters: - other : Atoms or Atom
new atoms to be added
Returns: - Atoms : a merging of this objects atoms and the other objects atoms.
-
append(other)[source]¶ Append other to this list of atoms and return the appended version
Parameters: - other : Atoms or Atom
new atoms to be added
Returns: - Atoms : a merging of this objects atoms and the other objects atoms.
-
atom¶ Return the unique atoms list
-
equal(other, R=True)[source]¶ True if the contained atoms are the same in the two lists (also checks indices)
Parameters: - other : Atoms
the list of atoms to check against
- R : bool, optional
if True also checks that the orbital radius are the same
See also
hassame- only check whether the two atoms are contained in both
-
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
Parameters: - other : Atoms
the list of atoms to check against
- R : bool, optional
if True also checks that the orbital radius are the same
See also
equal- explicit check of the indices and the contained atoms
Notes
This does not necessarily mean that the order, nor the number of atoms are the same.
-
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 theAtomper contained atom. - species is
True, which yields a tuple of (Atom, list) wherelistcontains all indices of atoms that has theAtomspecie. This is much faster than the first option.
Parameters: - species : bool, optional
If
Trueloops only on different species and yields a tuple of (Atom, list) Else yields the atom for the equivalent index.
- species is
-
lasto¶ The lasto orbital of the corresponding atom in the consecutive list of orbitals
-
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).
-
no¶ Return the total number of orbitals in this list of atoms
-
orbitals¶ Return an array of orbitals of the contained objects
-
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
-
replace(index, atom)[source]¶ Replace all atomic indices
indexwith 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
Atomis 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: - atom_from : Atom
the atom that should be replaced, if not found in the current list of atoms, nothing will happen.
- atom_to : Atom
the replacement atom.
Raises: - UserWarning : if the atoms does not have the same number of orbitals.
-
reverse(atom=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
-
specie¶ Return the specie list