public class Cell
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
Constructor and Description |
---|
Cell()
Create an empty structure a = b = c = 1, α = β = γ = 90, and
periodic boundary conditions in all directions.
|
Modifier and Type | Method and Description |
---|---|
void |
addAtom(Atom atom)
Add atom to cell
|
void |
addType(java.lang.String name)
Add a new atom type to this cell.
|
Cell |
clone() |
static double[][] |
computeBasis(double[] lengths,
double[] anglesRadians)
Compute the basis vectors given lengths and angles (in radians).
|
double[] |
convertCartesianToFractional(double[] x)
Convert Cartesian coordinates to fractional
|
double[] |
convertFractionalToCartestian(double[] x)
Convert fractional coordinates to Cartesian
|
boolean |
directionIsPeriodic(int index)
Whether a certain direction has boundary conditions
|
boolean |
equals(java.lang.Object obj) |
double[][] |
getAlignedBasis()
Get basis vectors aligned such that the a vector is parallel to the x axis,
and the b vector is in the x-y plane.
|
Atom |
getAtom(int index)
Get a single atom
|
java.util.List<Atom> |
getAtoms()
Get all atoms in the structure
|
double[][] |
getBasis()
Get basis of this structure
|
org.apache.commons.math3.linear.RealMatrix |
getBasisMatrix()
Get basis of this structure
|
AtomImage |
getClosestImage(int center,
int neighbor)
Get the closest image of a neighboring atom to an atom.
|
double[][] |
getInverseBasis()
Get the inverse basis.
|
double[] |
getLatticeAngles()
Get angles between lattice vectors
|
double[] |
getLatticeAnglesRadians()
Get angles between lattice vectors
|
double[] |
getLatticeParameters()
Get the lengths of each lattice vector
|
org.apache.commons.math3.geometry.euclidean.threed.Vector3D[] |
getLatticeVectors()
Get the lattice vectors for this cell
|
double |
getMinimumDistance(double[] point1,
double[] point2)
Get the minimum distance between any images of two points.
|
double[] |
getPeriodicImage(double[] position,
int x,
int y,
int z)
Given position in Cartesian coordinates, compute position periodic image.
|
org.apache.commons.math3.geometry.euclidean.threed.Vector3D[] |
getReciprocalLatticeVectors()
Get the reciprocal lattice vectors for this cell.
|
java.lang.String |
getTypeName(int index)
Get name of atom type
|
void |
mergeLikeTypes()
For types that have the same name, and combine them.
|
int |
nAtoms()
Number of atoms in simulation cell
|
int |
nTypes()
Number of atom types
|
int |
numberOfType(int type)
Get the number of atoms of a certain type
|
void |
replaceTypeNames(java.util.Map<java.lang.String,java.lang.String> changes)
Change the name of several types at once.
|
void |
setBasis(double[][] basis)
Define the basis.
|
void |
setBasis(double[] lengths,
double[] angles)
Define the basis vectors
|
void |
setTypeName(int index,
java.lang.String name)
Define the name for an atom type.
|
void |
setTypeRadius(int index,
double radius)
Set the radius of all atoms of a certain type
|
double |
volume()
Volume of the simulation cell
|
public Cell()
public Cell clone()
clone
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public final void setBasis(double[][] basis) throws java.lang.Exception
ax bx cx
ay by cy
az bz cz
basis
- New basisjava.lang.Exception
- If basis is incorrectly formattedpublic void setBasis(double[] lengths, double[] angles) throws java.lang.Exception
lengths
- a, b, cangles
- α, β, γ in degreesjava.lang.Exception
public static double[][] computeBasis(double[] lengths, double[] anglesRadians)
lengths
- Lengths of lattice vectorsanglesRadians
- Lattice angles in radiansax bx cx
ay by cy
az bz cz
SimulationCell
public void addAtom(Atom atom)
atom
- Atom to be addedpublic boolean directionIsPeriodic(int index)
index
- Desired direction (0: x, 1: y, 2: z)public double volume()
public double[][] getBasis()
SimulationCell
public org.apache.commons.math3.linear.RealMatrix getBasisMatrix()
SimulationCell
public double[][] getInverseBasis()
public org.apache.commons.math3.geometry.euclidean.threed.Vector3D[] getLatticeVectors()
public double[] getLatticeParameters()
public double[] getLatticeAnglesRadians()
public double[] getLatticeAngles()
public double[][] getAlignedBasis()
ax bx cx
ay by cy
az bz cz
public org.apache.commons.math3.geometry.euclidean.threed.Vector3D[] getReciprocalLatticeVectors()
public java.util.List<Atom> getAtoms()
public Atom getAtom(int index)
index
- Index of atompublic int nAtoms()
public int nTypes()
public int numberOfType(int type)
type
- Type indexpublic void addType(java.lang.String name)
name
- Name of type (can be null)public void setTypeName(int index, java.lang.String name)
index
- Index of atom typename
- Desired namepublic void replaceTypeNames(java.util.Map<java.lang.String,java.lang.String> changes)
changes
- Changes to be made. Key: Current Name, Value: New Namepublic void mergeLikeTypes()
public void setTypeRadius(int index, double radius)
index
- Certain typeradius
- Desired radiuspublic java.lang.String getTypeName(int index)
index
- Index of atom typepublic double[] convertFractionalToCartestian(double[] x)
x
- Fractional coordinatespublic double[] convertCartesianToFractional(double[] x)
x
- Cartesian coordinatespublic double[] getPeriodicImage(double[] position, int x, int y, int z)
position
- Position in Cartesian coordinatesx
- Number of steps in X directiony
- Number of steps in Y directionz
- Number of steps in Z directionpublic double getMinimumDistance(double[] point1, double[] point2)
Algorithm:
point1
- Fractional coordinates of point #1point2
- Fractional coordinates of point #2public AtomImage getClosestImage(int center, int neighbor)
center
- ID of central atomneighbor
- Neighboring atom