sisl.geometry module¶
Geometry class to retain the atomic structure.
-
class
sisl.geometry.
Geometry
(xyz, atom=None, sc=None)[source]¶ Bases:
sisl.supercell.SuperCellChild
Holds atomic information, coordinates, species, lattice vectors
The
Geometry
class holds information regarding atomic coordinates, the atomic species, the corresponding lattice-vectors.It enables the interaction and conversion of atomic structures via simple routine methods.
All lengths are assumed to be in units of Angstrom, however, as long as units are kept same the exact units are irrespective.
Parameters: xyz :
array_like
atomic coordinates
xyz[i,:]
is the atomic coordinate of the i’th atom.atom :
array_like
atomic species retrieved from the
PeriodicTable
sc :
SuperCell
the unit-cell describing the atoms in a periodic super-cell
Examples
An atomic lattice consisting of Hydrogen atoms. An atomic square lattice of Hydrogen atoms
>>> xyz = [[0, 0, 0], [1, 1, 1]] >>> sc = SuperCell([2,2,2]) >>> g = Geometry(xyz,Atom['H'],sc)
The following estimates the lattice vectors from the atomic coordinates, although possible, it is not recommended to be used.
>>> xyz = [[0, 0, 0], [1, 1, 1]] >>> g = Geometry(xyz,Atom['H'])
Attributes
atom
Retrieve the atoms for the geometry ( Atoms
object)dR
Returns the maximum orbital range of the atoms na (int) number of atoms, len(self)
xyz (ndarray) atomic coordinates sc ( SuperCell
) the supercell describing the periodicity of the geometryno: int total number of orbitals in the geometry Methods
ArgumentParser
([parser])a2isc
(ia)Returns the super-cell index for a specific/list atom a2o
(ia[, all])Returns an orbital index of the first orbital of said atom. a2sc
(a)Returns the super-cell offset for a specific atom add
(other)Adds atoms (as is) from the other
geometry.append
(other, axis)Appends structure along axis
.asc2uc
(atom[, uniq])Returns atom from super-cell indices to unit-cell indices, possibly removing dublicates attach
(s_idx, other, o_idx[, dist, axis])Attaches another Geometry
at thes_idx
index with respect too_idx
using different methods.axyz
([atom, isc])Return the atomic coordinates in the supercell of a given atom. bond_correct
(ia, atom[, method])Corrects the bond between ia
and theatom
.center
([atom, which])Returns the center of the geometry close
(xyz_ia[, dR, idx, idx_xyz, ret_xyz, ...])Returns supercell atomic indices for all atoms connecting to xyz_ia
close_all
(xyz_ia[, dR, idx, idx_xyz, ...])Returns supercell atomic indices for all atoms connecting to xyz_ia
close_sc
(xyz_ia[, isc, dR, idx, idx_xyz, ...])Calculates which atoms are close to some atom or point in space, only returns so relative to a super-cell. copy
()Returns a copy of the object. cut
(seps, axis[, seg, rtol, atol])Returns a subset of atoms from the geometry by cutting the geometry into seps
parts along the directionaxis
.fromASE
(aseg)Returns geometry from an ASE object. iR
([na, iR, dR])Return an integer number of maximum radii ( self.dR
) which holds approximatelyna
atomsinsert
(atom, geom)Inserts other atoms right before index is_orthogonal
()Return true if all cell vectors are linearly independent iter
()Returns an iterator for atoms ranges. iter_block
([iR, dR, atom, method])Returns an iterator for performance critical looping. iter_block_rand
([iR, dR, atom])Perform the random block-iteration by randomly selecting the next center of block iter_block_shape
([shape, iR, atom])Perform the grid block-iteration by looping a grid iter_orbitals
([atom, local])Returns an iterator over all atoms and their associated orbitals iter_species
([atom])Returns an iterator over all atoms and species as a tuple in this geometry mirror
(plane[, atom])Mirrors the structure around the center of the atoms move
(v[, atom, cell])Translates the geometry by v
o2a
(io)Returns an atomic index corresponding to the orbital indicies. o2isc
(io)Returns the super-cell index for a specific orbital. o2sc
(o)Returns the super-cell offset for a specific orbital. orij
(io, jo)Return distance between orbital io
andjo
, orbitals are expected to be in super-cell indicesosc2uc
(orbs[, uniq])Returns orbitals from super-cell indices to unit-cell indices, possibly removing dublicates prepend
(other, axis)Prepends structure along axis
.read
(sile)Reads geometry from the Sile
usingSile.read_geom
remove
(atom)Remove atom from the geometry. repeat
(reps, axis)Returns a geometry repeated, i.e. reverse
([atom])Returns a reversed geometry rij
(ia, ja)Return distance between atom ia
andja
, atoms are expected to be in super-cell indicesrotate
(angle, v[, origo, atom, only, radians])Rotates the geometry, in-place by the angle around the vector rotate_miller
(m, v)Align Miller direction along v
rotatea
(angle[, origo, atom, only, radians])Rotate around first lattice vector, see rotate
rotateb
(angle[, origo, atom, only, radians])Rotate around second lattice vector, see rotate
rotatec
(angle[, origo, atom, only, radians])Rotate around third lattice vector, see rotate
sc2uc
(atom[, uniq])Returns atom from super-cell indices to unit-cell indices, possibly removing dublicates sc_index
(*args, **kwargs)Call local SuperCell
objectsc_index
functionscale
(scale)Scale coordinates and unit-cell to get a new geometry with proper scaling set_nsc
(nsc)Set the number of super-cells in the SuperCell
objectset_sc
(sc)Overwrites the local supercell set_supercell
(sc)Overwrites the local supercell sparserij
([dtype, na_iR, method])Return the sparse matrix with all distances in the matrix sub
(atom[, cell])Returns a subset of atoms from the geometry. swap
(a, b)Returns a geometry with swapped atoms swapaxes
(a, b[, swap])Returns geometry with swapped axis tile
(reps, axis)Returns a geometry tiled, i.e. toASE
()Returns the geometry as an ASE Atoms
objecttranslate
(v[, atom, cell])Translates the geometry by v
within
(shapes[, idx, idx_xyz, ret_xyz, ret_rij])Returns supercell atomic indices for all atoms connecting to xyz_ia
within_sc
(shapes[, isc, idx, idx_xyz, ...])Calculates which atoms are close to some atom or point in space, only returns so relative to a super-cell. write
(sile, *args, **kwargs)Writes geometry to the Sile
usingsile.write_geom
-
ArgumentParser
(parser=None, *args, **kwargs)¶
-
a2isc
(ia)[source]¶ Returns the super-cell index for a specific/list atom
Returns a vector of 3 numbers with integers.
-
a2o
(ia, all=False)[source]¶ Returns an orbital index of the first orbital of said atom. This is particularly handy if you want to create TB models with more than one orbital per atom.
Note that this will preserve the super-cell offsets.
Parameters: ia :
array_like
Atomic indices
all :
bool
(False
)False
, return only the first orbital corresponding to the atom,True
, returns list of the full atom
-
add
(other)[source]¶ Adds atoms (as is) from the
other
geometry. This will not alter the cell vectors.Parameters: other :
Geometry
Other geometry class which is added
-
append
(other, axis)[source]¶ Appends structure along
axis
. This will automatically add theself.cell[axis,:]
to all atomic coordiates in theother
structure before appending.The basic algorithm is this:
>>> oxa = other.xyz + self.cell[axis,:][None,:] >>> self.xyz = np.append(self.xyz,oxa) >>> self.cell[axis,:] += other.cell[axis,:]
NOTE: The cell appended is only in the axis that is appended, which means that the other cell directions need not conform.
Parameters: other :
Geometry
,SuperCell
Other geometry class which needs to be appended If a
SuperCell
only the super cell will be extendedaxis :
int
Cell direction to which the
other
geometry should be appended.
-
asc2uc
(atom, uniq=False)¶ Returns atom from super-cell indices to unit-cell indices, possibly removing dublicates
-
atoms
¶ Number of atoms
-
attach
(s_idx, other, o_idx, dist='calc', axis=None)[source]¶ Attaches another
Geometry
at thes_idx
index with respect too_idx
using different methods.Parameters: dist :
array_like
,float
,str
('calc'
)the distance (in
Ang
) between the attached coordinates. Ifdist
isarraylike it should be the vector between the atoms; if `dist
isfloat
the argumentaxis
is required and the vector will be calculated along the corresponding latticevector; else ifdist
isstr
this will correspond to themethod
argument of theAtom.radius
class of the two atoms. Hereaxis
is also required.axis :
int
specify the direction of the lattice vectors used. Not used if
dist
is an array-like argument.
-
axyz
(atom=None, isc=None)[source]¶ Return the atomic coordinates in the supercell of a given atom.
The
Geometry[...]
slicing is calling this function with appropriate options.Parameters: atom : int or array_like
atom(s) from which we should return the coordinates, the atomic indices may be in supercell format.
isc :
array_like
,[0,0,0]
Returns the atomic coordinates shifted according to the integer parts of the cell.
Examples
>>> geom = Geometry(cell=1., xyz=[[0,0,0],[0.5,0,0]]) >>> print(geom.axyz(isc=[1,0,0]) [[ 1. 0. 0. ] [ 1.5 0. 0. ]]
>>> geom = Geometry(cell=1., xyz=[[0,0,0],[0.5,0,0]]) >>> print(geom.axyz(0)) [ 1. 0. 0. ]
-
bond_correct
(ia, atom, method='calc')[source]¶ Corrects the bond between
ia
and theatom
.Corrects the bond-length between atom
ia
andatom
in such a way that the atomic radius is preserved. I.e. the sum of the bond-lengths minimizes the distance matrix.Only atom
ia
is moved.Parameters: ia :
int
The atom to be displaced according to the atomic radius
atom :
array_like
,int
The atom(s) from which the radius should be reduced.
method :
str
,float
If str will use that as lookup in
Atom.radius
. Else it will be the new bond-length.
-
center
(atom=None, which='xyz')[source]¶ Returns the center of the geometry
By specifying
which
one can control whether it should be:xyz|position
: Center of coordinates (default)mass
: Center of masscell
: Center of cell
Parameters: atom :
array_like
list of atomic indices to find center of
which :
str
determine whether center should be of ‘cell’, mass-centered (‘mass’), or absolute center of the positions.
-
close
(xyz_ia, dR=None, idx=None, idx_xyz=None, ret_xyz=False, ret_rij=False)[source]¶ Returns supercell atomic indices for all atoms connecting to
xyz_ia
This heavily relies on the
close_sc
method.Note that if a connection is made in a neighbouring super-cell then the atomic index is shifted by the super-cell index times number of atoms. This allows one to decipher super-cell atoms from unit-cell atoms.
Parameters: xyz_ia : coordinate/index
Either a point in space or an index of an atom. If an index is passed it is the equivalent of passing the atomic coordinate
close_sc(self.xyz[xyz_ia,:])
.dR : (None), float/tuple of float
The radii parameter to where the atomic connections are found. If
dR
is an array it will return the indices: in the ranges:>>> ``( x <= dR[0] , dR[0] < x <= dR[1], dR[1] < x <= dR[2] )``
If a single float it will return:
>>> ``x <= dR``
idx : (None), array_like
List of indices for atoms that are to be considered
idx_xyz : (None), array_like
The atomic coordinates of the equivalent
idx
variable (idx
must also be passed)ret_xyz : (False), boolean
If true this method will return the coordinates for each of the couplings.
ret_rij : (False), boolean
If true this method will return the distances from the
xyz_ia
for each of the couplings.
-
close_all
(xyz_ia, dR=None, idx=None, idx_xyz=None, ret_xyz=False, ret_rij=False)¶ Returns supercell atomic indices for all atoms connecting to
xyz_ia
This heavily relies on the
close_sc
method.Note that if a connection is made in a neighbouring super-cell then the atomic index is shifted by the super-cell index times number of atoms. This allows one to decipher super-cell atoms from unit-cell atoms.
Parameters: xyz_ia : coordinate/index
Either a point in space or an index of an atom. If an index is passed it is the equivalent of passing the atomic coordinate
close_sc(self.xyz[xyz_ia,:])
.dR : (None), float/tuple of float
The radii parameter to where the atomic connections are found. If
dR
is an array it will return the indices: in the ranges:>>> ``( x <= dR[0] , dR[0] < x <= dR[1], dR[1] < x <= dR[2] )``
If a single float it will return:
>>> ``x <= dR``
idx : (None), array_like
List of indices for atoms that are to be considered
idx_xyz : (None), array_like
The atomic coordinates of the equivalent
idx
variable (idx
must also be passed)ret_xyz : (False), boolean
If true this method will return the coordinates for each of the couplings.
ret_rij : (False), boolean
If true this method will return the distances from the
xyz_ia
for each of the couplings.
-
close_sc
(xyz_ia, isc=None, dR=None, idx=None, idx_xyz=None, ret_xyz=False, ret_rij=False)[source]¶ Calculates which atoms are close to some atom or point in space, only returns so relative to a super-cell.
This returns a set of atomic indices which are within a sphere of radius
dR
.If dR is a tuple/list/array it will return the indices: in the ranges: >>> ( x <= dR[0] , dR[0] < x <= dR[1], dR[1] < x <= dR[2] )
Parameters: xyz_ia :
coordinate
,int
Either a point in space or an index of an atom. If an index is passed it is the equivalent of passing the atomic coordinate
close_sc(self.xyz[xyz_ia,:])
.isc :
array_like
, ([ 0, 0, 0]
)The super-cell which the coordinates are checked in.
dR :
float
,array_like
(None
)The radii parameter to where the atomic connections are found. If
dR
is an array it will return the indices: in the ranges:( x <= dR[0] , dR[0] < x <= dR[1], dR[1] < x <= dR[2] )
- If a single float it will return:
x <= dR
idx :
array_like
(None
)List of atoms that will be considered. This can be used to only take out a certain atoms.
idx_xyz :
array_like
(None
)The atomic coordinates of the equivalent
idx
variable (idx
must also be passed)ret_xyz :
bool
(False
)If true this method will return the coordinates for each of the couplings.
ret_rij :
bool
(False
)If true this method will return the distance for each of the couplings.
-
cut
(seps, axis, seg=0, rtol=0.0001, atol=0.0001)[source]¶ Returns a subset of atoms from the geometry by cutting the geometry into
seps
parts along the directionaxis
. It will then _only_ return the first cut.This will effectively change the unit-cell in the
axis
as-well as removingself.na/seps
atoms. It requires thatself.na % seps == 0
.REMARK: You need to ensure that all atoms within the first cut out region are within the primary unit-cell.
Doing
geom.cut(2,1).tile(seps=2,axis=1)
, could for symmetric setups, be equivalent to a no-op operation. AUserWarning
will be issued if this is not the case.Parameters: seps :
int
number of times the structure will be cut.
axis :
int
the axis that will be cut
seg :
int
(0
)returns the i’th segment of the cut structure Currently the atomic coordinates are not translated, this may change in the future.
rtol : (tolerance for checking tiling, see
numpy.allclose
)atol : (tolerance for checking tiling, see
numpy.allclose
)
-
dR
¶ Returns the maximum orbital range of the atoms
-
classmethod
fromASE
(aseg)[source]¶ Returns geometry from an ASE object.
Parameters: aseg : ASE
Atoms
object which contains the following routines:get_atomic_numbers
,get_positions
,get_cell
. From those methods a sisl package object will be created.
-
fxyz
¶ Returns geometry coordinates in fractional coordinates
-
iR
(na=1000, iR=20, dR=None)[source]¶ Return an integer number of maximum radii (
self.dR
) which holds approximatelyna
atomsParameters: na :
int
number of atoms within the radius
iR :
int
initial
iR
value, which the sphere is estitametd fromdR :
float
the value used for atomic range (defaults to
self.dR
)
-
insert
(atom, geom)[source]¶ Inserts other atoms right before index
We insert the
geom
Geometry
beforeatom
. Note that this will not change the unit cell.Parameters: atom :
int
the index at which atom the other geometry is inserted
geom :
Geometry
the other geometry to be inserted
-
iter
()[source]¶ Returns an iterator for atoms ranges.
This iterator is the same as:
>>> for ia in range(len(self)): >>> <do something>
- or equivalently
>>> for ia in self: >>> <do something>
-
iter_block
(iR=10, dR=None, atom=None, method='rand')[source]¶ Returns an iterator for performance critical looping.
NOTE: This requires that dR has been set correctly as the maximum interaction range.
I.e. the loop would look like this:
>>> for ias, idxs in Geometry.iter_block(): >>> for ia in ias: >>> idx_a = dev.close(ia, dR = dR, idx = idxs)
This iterator is intended for systems with more than 1000 atoms.
Remark that the iterator used is non-deterministic, i.e. any two iterators need not return the same atoms in any way.
Parameters: atom :
array_like
enables only effectively looping a subset of the full geometry
iR :
int
(10
)the number of
dR
ranges taken into account when doing the iteratordR :
float
, (self.dR
)enables overwriting the local dR quantity.
method :
str
('rand'
)select the method by which the block iteration is performed. Possible values are:
rand
: a spherical object is constructed with a random center accordingto the internal atoms
sphere
: a spherical equispaced shape is constructed and loopedcube
: a cube shape is constructed and loopedReturns two lists with [0] being a list of atoms to be looped and [1] being the atoms that
need searched.
-
iter_block_rand
(iR=10, dR=None, atom=None)[source]¶ Perform the random block-iteration by randomly selecting the next center of block
-
iter_block_shape
(shape=None, iR=10, atom=None)[source]¶ Perform the grid block-iteration by looping a grid
-
iter_orbitals
(atom=None, local=True)[source]¶ Returns an iterator over all atoms and their associated orbitals
>>> for ia, io in self.iter_orbitals():
with
ia
being the atomic index,io
the associated orbital index on atomia
. Note thatio
will start from0
.Parameters: atom :
int
,array_like
only loop on the given atoms, default to all atoms
local :
bool=True
whether the orbital index is the global index, or the local index relative to the atom it resides on.
-
iter_species
(atom=None)[source]¶ Returns an iterator over all atoms and species as a tuple in this geometry
>>> for ia, a, idx_specie in self.iter_species():
with
ia
being the atomic index,a
theAtom
object,idx_specie
is the index of the specieParameters: atom :
int
,array_like
only loop on the given atoms, default to all atoms
-
lasto
¶ The first orbital on the corresponding atom
-
mass
¶ Returns the mass of all atoms as an array
-
move
(v, atom=None, cell=False)[source]¶ Translates the geometry by
v
One can translate a subset of the atoms by supplying
atom
.Returns a copy of the structure translated by
v
.
-
na_s
¶ Number of supercell atoms
-
no_s
¶ Number of supercell orbitals
-
o2a
(io)[source]¶ Returns an atomic index corresponding to the orbital indicies.
This is a particurlaly slow algorithm due to for-loops.
Note that this will preserve the super-cell offsets.
Parameters: io: ``array_like``
List of indices to return the atoms for
-
o2isc
(io)[source]¶ Returns the super-cell index for a specific orbital.
Returns a vector of 3 numbers with integers.
-
orbitalss
¶ Number of orbitals
-
orij
(io, jo)[source]¶ Return distance between orbital
io
andjo
, orbitals are expected to be in super-cell indicesReturns the distance between two orbitals:
\[r\_{ij} = |r\_j - r\_i|\]Parameters: io :
int
orbital index of first orbital
jo :
int
,array_like
orbital indices
-
osc2uc
(orbs, uniq=False)[source]¶ Returns orbitals from super-cell indices to unit-cell indices, possibly removing dublicates
-
prepend
(other, axis)[source]¶ Prepends structure along
axis
. This will automatically add theself.cell[axis,:]
to all atomic coordiates in theother
structure before prepending.The basic algorithm is this:
>>> oxa = other.xyz >>> self.xyz = np.append(oxa, self.xyz + other.cell[axis,:][None,:]) >>> self.cell[axis,:] += other.cell[axis,:]
NOTE: The cell prepended is only in the axis that is prependend, which means that the other cell directions need not conform.
Parameters: other :
Geometry
,SuperCell
Other geometry class which needs to be prepended If a
SuperCell
only the super cell will be extendedaxis :
int
Cell direction to which the
other
geometry should be prepended
-
static
read
(sile)[source]¶ Reads geometry from the
Sile
usingSile.read_geom
Parameters: sile :
Sile
, str
-
remove
(atom)[source]¶ Remove atom from the geometry.
Indices passed MUST be unique.
Negative indices are wrapped and thus works.
Parameters: atom :
array_like
indices of all atoms to be removed.
-
repeat
(reps, axis)[source]¶ Returns a geometry repeated, i.e. copied in a special way.
The atomic indices are NOT retained for the base structure.
The expansion of the atoms are basically performed using this algorithm:
>>> ja = 0 >>> for ia in range(self.na): >>> for id,r in args: >>> for i in range(r): >>> ja = ia + cell[id,:] * i
This method allows to utilise Bloch’s theorem when creating Hamiltonian parameter sets for TBtrans.
For geometries with a single atom this routine returns the same as
tile
.It is adviced to only use this for electrode Bloch’s theorem purposes as
tile
is faster.Parameters: reps :
int
number of repetitions
axis :
int
direction of repetition, 0, 1, 2 according to the cell-direction
Examples
>>> geom = Geometry(cell=[[1.,0,0],[0,1.,0.],[0,0,1.]],xyz=[[0,0,0],[0.5,0,0]]) >>> g = geom.repeat(2,axis=0) >>> print(g.xyz) [[ 0. 0. 0. ] [ 1. 0. 0. ] [ 0.5 0. 0. ] [ 1.5 0. 0. ]] >>> g = geom.repeat(2,0).repeat(2,1) >>> print(g.xyz) [[ 0. 0. 0. ] [ 1. 0. 0. ] [ 0. 1. 0. ] [ 1. 1. 0. ] [ 0.5 0. 0. ] [ 1.5 0. 0. ] [ 0.5 1. 0. ] [ 1.5 1. 0. ]]
-
reverse
(atom=None)[source]¶ Returns a reversed geometry
Also enables reversing a subset of the atoms.
-
rij
(ia, ja)[source]¶ Return distance between atom
ia
andja
, atoms are expected to be in super-cell indicesReturns the distance between two atoms:
\[r\_{ij} = |r\_j - r\_i|\]Parameters: ia : int or array_like
atomic index of first atom
ja : int or array_like
atomic indices
-
rotate
(angle, v, origo=None, atom=None, only='abc+xyz', radians=False)[source]¶ Rotates the geometry, in-place by the angle around the vector
Per default will the entire geometry be rotated, such that everything is aligned as before rotation.
However, by supplying
only='abc|xyz'
one can designate which part of the geometry that will be rotated.Parameters: angle :
float
the angle in radians of which the geometry should be rotated
v :
array_like
[3]the normal vector to the rotated plane, i.e. v = [1,0,0] will rotate the
yz
planeorigo : int or array_like, [0, 0, 0]
the origin of rotation. Anything but [0, 0, 0] is equivalent to a
self.move(-origo).rotate(...).move(origo)
. If this is anint
it corresponds to the atomic index.atom : int or array_like
only rotate the given atomic indices, if not specified, all atoms will be rotated.
only : (‘abc+xyz’), str, optional
which coordinate subject should be rotated, if
abc
is in this string the cell will be rotated ifxyz
is in this string the coordinates will be rotated
-
rotate_miller
(m, v)[source]¶ Align Miller direction along
v
Rotate geometry and cell such that the Miller direction points along the Cartesian vector
v
.
-
rotatea
(angle, origo=None, atom=None, only='abc+xyz', radians=False)[source]¶ Rotate around first lattice vector, see
rotate
-
rotateb
(angle, origo=None, atom=None, only='abc+xyz', radians=False)[source]¶ Rotate around second lattice vector, see
rotate
-
rotatec
(angle, origo=None, atom=None, only='abc+xyz', radians=False)[source]¶ Rotate around third lattice vector, see
rotate
-
sc2uc
(atom, uniq=False)[source]¶ Returns atom from super-cell indices to unit-cell indices, possibly removing dublicates
-
scale
(scale)[source]¶ Scale coordinates and unit-cell to get a new geometry with proper scaling
Parameters: scale :
float
the scale factor for the new geometry (lattice vectors, coordinates and the atomic radii are scaled).
-
sparserij
(dtype=<type 'numpy.float64'>, na_iR=1000, method='rand')[source]¶ Return the sparse matrix with all distances in the matrix
The sparse matrix will only be defined for the elements which have orbitals overlapping with other atoms.
Parameters: dtype : numpy.dtype, numpy.float64
the data-type of the sparse matrix
na_iR : int, 1000
number of atoms within the sphere for speeding up the
iter_block
loop.method : str, ‘rand’
see
iter_block
for detailsReturns: SparseCSR
sparse matrix with all rij elements
-
sub
(atom, cell=None)[source]¶ Returns a subset of atoms from the geometry.
Indices passed MUST be unique.
Negative indices are wrapped and thus works.
Parameters: atom :
array_like
indices of all atoms to be removed.
cell :
array_like
,SuperCell
(self.cell
)the new associated cell of the geometry
-
swap
(a, b)[source]¶ Returns a geometry with swapped atoms
This can be used to reorder elements of a geometry.
-
swapaxes
(a, b, swap='cell+xyz')[source]¶ Returns geometry with swapped axis
If
swapaxes(0,1)
it returns the 0 and 1 values swapped in thecell
variable.Parameters: a :
int
axes 1, swaps with
b
b :
int
axes 2, swaps with
a
swap :
str
("cell+xyz"
)
-
tile
(reps, axis)[source]¶ Returns a geometry tiled, i.e. copied.
The atomic indices are retained for the base structure.
Parameters: reps :
int
number of tiles (repetitions)
axis :
int
direction of tiling, 0, 1, 2 according to the cell-direction
Examples
>>> geom = Geometry(cell=[[1.,0,0],[0,1.,0.],[0,0,1.]],xyz=[[0,0,0],[0.5,0,0]]) >>> g = geom.tile(2,axis=0) >>> print(g.xyz) [[ 0. 0. 0. ] [ 0.5 0. 0. ] [ 1. 0. 0. ] [ 1.5 0. 0. ]] >>> g = geom.tile(2,0).tile(2,axis=1) >>> print(g.xyz) [[ 0. 0. 0. ] [ 0.5 0. 0. ] [ 1. 0. 0. ] [ 1.5 0. 0. ] [ 0. 1. 0. ] [ 0.5 1. 0. ] [ 1. 1. 0. ] [ 1.5 1. 0. ]]
-
translate
(v, atom=None, cell=False)¶ Translates the geometry by
v
One can translate a subset of the atoms by supplying
atom
.Returns a copy of the structure translated by
v
.
-
within
(shapes, idx=None, idx_xyz=None, ret_xyz=False, ret_rij=False)[source]¶ Returns supercell atomic indices for all atoms connecting to
xyz_ia
This heavily relies on the
close_sc
method.Note that if a connection is made in a neighbouring super-cell then the atomic index is shifted by the super-cell index times number of atoms. This allows one to decipher super-cell atoms from unit-cell atoms.
Parameters: shapes :
Shape
, list of ``Shape``sidx :
array_like
(None
)List of indices for atoms that are to be considered
idx_xyz :
array_like
(None
)The atomic coordinates of the equivalent
idx
variable (idx
must also be passed)ret_xyz :
bool
(False
)If true this method will return the coordinates for each of the couplings.
ret_rij :
bool
(False
)If true this method will return the distances from the
xyz_ia
for each of the couplings.
-
within_sc
(shapes, isc=None, idx=None, idx_xyz=None, ret_xyz=False, ret_rij=False)[source]¶ Calculates which atoms are close to some atom or point in space, only returns so relative to a super-cell.
This returns a set of atomic indices which are within a sphere of radius
dR
.If dR is a tuple/list/array it will return the indices: in the ranges: >>> ( x <= dR[0] , dR[0] < x <= dR[1], dR[1] < x <= dR[2] )
Parameters: shapes :
Shape
,list of Shape
A list of increasing shapes that define the extend of the geometric volume that is searched. It is vital that:
shapes[0] in shapes[1] in shapes[2] ...
isc :
array_like
([0, 0, 0]
)The super-cell which the coordinates are checked in.
idx :
array_like
(None
)List of atoms that will be considered. This can be used to only take out a certain atoms.
idx_xyz :
array_like
(None
)The atomic coordinates of the equivalent
idx
variable (idx
must also be passed)ret_xyz :
bool
(False
)If true this method will return the coordinates for each of the couplings.
ret_rij :
bool
(False
)If true this method will return the distance for each of the couplings.
-
-
sisl.geometry.
sgeom
(geom=None, argv=None, ret_geometry=False)[source]¶ Main script for sgeom script.
This routine may be called with
argv
and/or aSile
which is the geometry at hand.Parameters: geom :
Geometry
,BaseSile
this may either be the geometry, as-is, or a
Sile
which contains the geometry.argv : list of
str
the arguments passed to sgeom
ret_geometry :
bool
(False
)whether the function should return the geometry