-
-
Notifications
You must be signed in to change notification settings - Fork 60
Python Geometry
The Geometry
object is a class containing coordinates
of atomic elements. For each atom attached to the geometry
an Atom object is attached.
Also the Geometry
class enherits a multitude of the
SuperCell class which enables a unified
class to contain information about a full simulation cell.
The simplest way to create a Geometry
is
geom = sids.Geometry([[0,0,0],[1,1,1]])
which is a 2-atom Geometry with atoms located at origo
and another shifted by 1 Å along each Cartesian coordinate.
sids will automatically guess the SuperCell to be
[2,2,2]
. This is done per the Cartesian bond-lengths along each direction.
Any Geometry
can have arbitrarily many atoms and any combination of
atomic species.
For creating the graphene honeycomb unit cell you can do this
sc = sids.SuperCell([[1.5, 3.**.5 * 0.5, 0.],
[1.5,-3.**.5 * 0.5, 0.],
[0. , 0. ,10.]], nsc=[3,3,1])
g = sids.Geometry([[0.,0.,0.],[1.,0.,0.]], atoms=sids.Atom[6], sc=sc)
where the bond-length is 1 Å.
Similarly to generate hexagonal boron nitride the following change suffices
g = sids.Geometry([[0.,0.,0.],[1.,0.,0.]],
atoms=[sids.Atom[5],sids.Atom[7]], sc=sc)
sids implement several standard lattice structures defined in sids.geom
.
The following geometries are present
from sids import Atom
from sids.geom import *
honeycomb(1.42,Atom(6)) # graphene
honeycomb(1.42,Atom(6), square=True) # graphene in square unit-cell
honeycomb(1.42,[Atom(5),Atom(7)]) # Hexagonal boron-nitride
honeycomb(1.42,[Atom(5),Atom(7)], square=True) # Hexagonal boron-nitride in square
graphene() # shorthand for `honeycomb(1.42,Atom(6))`
graphene(square=True) # shorthand for `honeycomb(1.42,Atom(6),square=True)`
sc(alat,Atom) # Simple Cubic lattice
bcc(alat,Atom) # BCC lattice
fcc(alat,Atom) # FCC lattice
hcp(alat,Atom) # HCP lattice
diamond(alat,Atom) # diamond lattice
The Geometry
class implements several routines to retrieve information about neighbours
and manipulations.
Note that sgeom is a utility for
using several of the methods inherent to the Geometry
class.
Creating a graphene flake of 40.000 atoms
from sids.geom import graphene
g = graphene().tile(200, 0).tile(100, 1)
g = graphene(square=True).tile(100, 0).tile(100, 1)
which creates a skewed unit cell axis or a square, respectively.
We will here highlight a few methods inherent to the class
-
tile
/repeat
(int, axis)
Expanding the geometry by adding more unit cells in the given lattice directions. Each routine takes an integer to denote number of times it is repeated, and the axis decides which lattice vectors will be expanded. The underlying SuperCell object also gets expanded.
-
close(int|xyz,...)
Returns an array of indices with elements within a certain radius of the, 1) atom corresponding to the integer index, or 2) coordinate given by the vector
xyz
.This is handy for geometry creation as well as finding atoms close to other atoms.
-
sub(list)
Returns a new geometry only with the requested atoms.
-
remove(list)
Returns a new geometry with all other than the removed atoms.
-
append(other, axis)
Extends another geometry on top of the current one in the direction of the axis lattice vector.