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 Atom objects which are indexed via a species index. This is convenient when having geometries with millions of atoms because it will not duplicate the Atom object, only a list index.

Parameters
atomlist of Atom

atoms to be contained in this list of atoms

naint or None

total number of atoms, if len(atom) is smaller than na it will be repeated to match na.

Attributes
atomlist of Atom

List of unique atoms in this group of atoms

specie(na, )

Atomic specie list

noint

Return 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

Z

Return an array of atomic numbers (integers)

atom

List of unique atoms in this group of atoms

firsto

The first orbital of the corresponding atom in the consecutive list of orbitals

lasto

The lasto orbital of the corresponding atom in the consecutive list of orbitals

mass

Return an array of masses of the contained objects

no

Return the total number of orbitals in this list of atoms

nspecie

Number of different species

orbitals

Return an array of orbitals of the contained objects

q0

Initial charge per atom

specie

Atomic specie list

Methods

__init__(self[, atom, na])

Initialize self.

add(self, other)

Append other to this list of atoms and return the appended version

append(self, other)

Append other to this list of atoms and return the appended version

copy(self)

Return a copy of this atom

equal(self, other[, R])

True if the contained atoms are the same in the two lists (also checks indices)

hassame(self, other[, R])

True if the contained atoms are the same in the two lists

index(self, atom)

Return the species index of the atom object

insert(self, index, other)

Insert other atoms into the list of atoms at index

iter(self[, species])

Loop on all atoms

maxR(self[, all])

The maximum radius of the atoms

orbital(self, io)

Return an array of orbital of the contained objects

prepend(self, other)

reduce(self[, in_place])

Returns a new Atoms object by removing non-used atoms

remove(self, atom)

Remove a set of atoms

reorder(self[, in_place])

Reorders the atoms and species index so that they are ascending (starting with a specie that exists)

repeat(self, reps)

Repeat this atom object

replace(self, index, atom)

Replace all atomic indices index with the atom atom (in-place)

replace_atom(self, atom_from, atom_to)

Replace all atoms equivalent to atom_from with atom_to (in-place)

reverse(self[, atom])

Returns a reversed geometry

scale(self, scale)

Scale the atomic radii and return an equivalent atom.

sub(self, atom)

Return a subset of the list

swap(self, a, b)

Swaps all atoms

swap_atom(self, a, b)

Swap specie index positions

tile(self, reps)

Tile this atom object

property Z

Return an array of atomic numbers (integers)

add(self, other)

Append other to this list of atoms and return the appended version

Parameters
otherAtoms or Atom

new atoms to be added

Returns
Atoms

merging of this objects atoms and the other objects atoms.

append(self, other)[source]

Append other to this list of atoms and return the appended version

Parameters
otherAtoms or Atom

new atoms to be added

Returns
Atoms

merging of this objects atoms and the other objects atoms.

property atom

List of unique atoms in this group of atoms

copy(self)[source]

Return a copy of this atom

equal(self, other, R=True)[source]

True if the contained atoms are the same in the two lists (also checks indices)

Parameters
otherAtoms

the list of atoms to check against

Rbool, 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

property firsto

The first orbital of the corresponding atom in the consecutive list of orbitals

hassame(self, other, R=True)[source]

True if the contained atoms are the same in the two lists

Parameters
otherAtoms

the list of atoms to check against

Rbool, 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.

index(self, atom)[source]

Return the species index of the atom object

insert(self, index, other)[source]

Insert other atoms into the list of atoms at index

iter(self, species=False)[source]

Loop on all atoms

This iterator may be used in two contexts:

  1. species is False, this is the slowest method and will yield the Atom per contained atom.

  2. species is True, which yields a tuple of (Atom, list) where list contains all indices of atoms that has the Atom specie. This is much faster than the first option.

Parameters
speciesbool, 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(self, all=False)[source]

The maximum radius of the atoms

Parameters
allbool

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

orbital(self, io)[source]

Return an array of orbital of the contained objects

property orbitals

Return an array of orbitals of the contained objects

prepend(self, other)[source]
property q0

Initial charge per atom

reduce(self, in_place=False)[source]

Returns a new Atoms object by removing non-used atoms

remove(self, atom)[source]

Remove a set of atoms

reorder(self, in_place=False)[source]

Reorders the atoms and species index so that they are ascending (starting with a specie that exists)

Parameters
in_placebool, optional

whether the re-order is done in-place

repeat(self, reps)[source]

Repeat this atom object

replace(self, index, atom)[source]

Replace all atomic indices index with the atom atom (in-place)

This is the preferred way of replacing atoms in geometries.

Parameters
indexlist 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 to replace_atom.

atomAtom

the replacement atom.

replace_atom(self, 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_fromAtom

the atom that should be replaced, if not found in the current list of atoms, nothing will happen.

atom_toAtom

the replacement atom.

Raises
UserWarningif the atoms does not have the same number of orbitals.
reverse(self, atom=None)[source]

Returns a reversed geometry

Also enables reversing a subset of the atoms.

scale(self, scale)[source]

Scale the atomic radii and return an equivalent atom.

Parameters
scalefloat

the scale factor for the atomic radii

property specie

Atomic specie list

sub(self, atom)[source]

Return a subset of the list

swap(self, a, b)[source]

Swaps all atoms

swap_atom(self, a, b)[source]

Swap specie index positions

tile(self, reps)[source]

Tile this atom object