Package org.biojava.nbio.structure.xtal
Class CrystalCell
- java.lang.Object
-
- org.biojava.nbio.structure.xtal.CrystalCell
-
- All Implemented Interfaces:
Serializable
public class CrystalCell extends Object implements Serializable
A crystal cell's parameters.- Author:
- duarte_j
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static double
MIN_VALID_CELL_SIZE
-
Constructor Summary
Constructors Constructor Description CrystalCell()
CrystalCell(double a, double b, double c, double alpha, double beta, double gamma)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checkScaleMatrix(javax.vecmath.Matrix4d scaleMatrix)
Given a scale matrix parsed from a PDB entry (SCALE1,2,3 records), compares it to our calculated Mtranspose matrix to see if they coincide and returns true if they do.boolean
checkScaleMatrixConsistency(javax.vecmath.Matrix4d scaleMatrix)
Given a scale matrix parsed from the PDB entry (SCALE1,2,3 records), checks that the matrix is a consistent scale matrix by comparing the cell volume to the inverse of the scale matrix determinant (tolerance of 1/100).double
getA()
double
getAlpha()
double
getB()
double
getBeta()
double
getC()
javax.vecmath.Point3i
getCellIndices(javax.vecmath.Tuple3d pt)
Get the index of a unit cell to which the query point belongs.double
getGamma()
double
getMaxDimension()
Gets the maximum dimension of the unit cell.javax.vecmath.Matrix3d
getMTranspose()
double
getVolume()
Returns the volume of this unit cell.boolean
isCellReasonable()
Checks whether the dimensions of this crystal cell are reasonable for protein crystallography: if all 3 dimensions are below 10.0 the cell is considered unrealistic and false returnedvoid
setA(double a)
void
setAlpha(double alpha)
void
setB(double b)
void
setBeta(double beta)
void
setC(double c)
void
setGamma(double gamma)
String
toString()
javax.vecmath.Matrix4d
transfToCrystal(javax.vecmath.Matrix4d m)
Transform given Matrix4d in orthonormal basis to the crystal basis using the PDB axes convention (NCODE=1)void
transfToCrystal(javax.vecmath.Tuple3d v)
Transforms the given orthonormal basis coordinates into crystal coordinates.void
transfToOriginCell(javax.vecmath.Tuple3d pt)
Converts the coordinates in pt so that they occur within the (0,0,0) unit cellvoid
transfToOriginCell(javax.vecmath.Tuple3d[] points, javax.vecmath.Tuple3d reference)
Converts a set of points so that the reference point falls in the unit cell.javax.vecmath.Matrix4d[]
transfToOriginCellCrystal(javax.vecmath.Matrix4d[] ops, javax.vecmath.Tuple3d reference)
javax.vecmath.Matrix4d[]
transfToOriginCellOrthonormal(javax.vecmath.Matrix4d[] ops, javax.vecmath.Tuple3d reference)
javax.vecmath.Matrix4d
transfToOrthonormal(javax.vecmath.Matrix4d m)
Transform given Matrix4d in crystal basis to the orthonormal basis using the PDB axes convention (NCODE=1)void
transfToOrthonormal(javax.vecmath.Tuple3d v)
Transforms the given crystal basis coordinates into orthonormal coordinates.
-
-
-
Field Detail
-
MIN_VALID_CELL_SIZE
public static final double MIN_VALID_CELL_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CrystalCell
public CrystalCell()
-
CrystalCell
public CrystalCell(double a, double b, double c, double alpha, double beta, double gamma)
-
-
Method Detail
-
getA
public double getA()
-
setA
public void setA(double a)
-
getB
public double getB()
-
setB
public void setB(double b)
-
getC
public double getC()
-
setC
public void setC(double c)
-
getAlpha
public double getAlpha()
-
setAlpha
public void setAlpha(double alpha)
-
getBeta
public double getBeta()
-
setBeta
public void setBeta(double beta)
-
getGamma
public double getGamma()
-
setGamma
public void setGamma(double gamma)
-
getVolume
public double getVolume()
Returns the volume of this unit cell. See http://en.wikipedia.org/wiki/Parallelepiped- Returns:
-
getCellIndices
public javax.vecmath.Point3i getCellIndices(javax.vecmath.Tuple3d pt)
Get the index of a unit cell to which the query point belongs.For instance, all points in the unit cell at the origin will return (0,0,0); Points in the unit cell one unit further along the `a` axis will return (1,0,0), etc.
- Parameters:
pt
- Input point (in orthonormal coordinates)- Returns:
- A new point with the three indices of the cell containing pt
-
transfToOriginCell
public void transfToOriginCell(javax.vecmath.Tuple3d pt)
Converts the coordinates in pt so that they occur within the (0,0,0) unit cell- Parameters:
pt
-
-
transfToOriginCell
public void transfToOriginCell(javax.vecmath.Tuple3d[] points, javax.vecmath.Tuple3d reference)
Converts a set of points so that the reference point falls in the unit cell. This is useful to transform a whole chain at once, allowing some of the atoms to be outside the unit cell, but forcing the centroid to be within it.- Parameters:
points
- A set of points to transform (in orthonormal coordinates)reference
- The reference point, which is unmodified but which would be in the unit cell were it to have been transformed. It is safe to use a member of the points array here.
-
transfToOriginCellOrthonormal
public javax.vecmath.Matrix4d[] transfToOriginCellOrthonormal(javax.vecmath.Matrix4d[] ops, javax.vecmath.Tuple3d reference)
- Parameters:
ops
- Set of operations in orthonormal coordinatesreference
- Reference point, which should be in the unit cell after each operation (also in orthonormal coordinates)- Returns:
- A set of orthonormal operators with equivalent rotation to the inputs, but with translation such that the reference point would fall within the unit cell
-
transfToOriginCellCrystal
public javax.vecmath.Matrix4d[] transfToOriginCellCrystal(javax.vecmath.Matrix4d[] ops, javax.vecmath.Tuple3d reference)
- Parameters:
ops
- Set of operations in crystal coordinatesreference
- Reference point, which should be in the unit cell after each operation (also in crystal coordinates)- Returns:
- A set of crystal operators with equivalent rotation to the inputs, but with translation such that the reference point would fall within the unit cell
-
transfToOrthonormal
public javax.vecmath.Matrix4d transfToOrthonormal(javax.vecmath.Matrix4d m)
Transform given Matrix4d in crystal basis to the orthonormal basis using the PDB axes convention (NCODE=1)- Parameters:
m
-- Returns:
-
transfToOrthonormal
public void transfToOrthonormal(javax.vecmath.Tuple3d v)
Transforms the given crystal basis coordinates into orthonormal coordinates. e.g. transfToOrthonormal(new Point3d(1,1,1)) returns the orthonormal coordinates of the vertex of the unit cell. See Giacovazzo section 2.E, eq. 2.E.1 (or any linear algebra manual)- Parameters:
v
-
-
transfToCrystal
public javax.vecmath.Matrix4d transfToCrystal(javax.vecmath.Matrix4d m)
Transform given Matrix4d in orthonormal basis to the crystal basis using the PDB axes convention (NCODE=1)- Parameters:
m
-- Returns:
-
transfToCrystal
public void transfToCrystal(javax.vecmath.Tuple3d v)
Transforms the given orthonormal basis coordinates into crystal coordinates. See Giacovazzo eq 2.20 (or any linear algebra manual)- Parameters:
v
-
-
getMTranspose
public javax.vecmath.Matrix3d getMTranspose()
-
getMaxDimension
public double getMaxDimension()
Gets the maximum dimension of the unit cell.- Returns:
-
checkScaleMatrixConsistency
public boolean checkScaleMatrixConsistency(javax.vecmath.Matrix4d scaleMatrix)
Given a scale matrix parsed from the PDB entry (SCALE1,2,3 records), checks that the matrix is a consistent scale matrix by comparing the cell volume to the inverse of the scale matrix determinant (tolerance of 1/100). If they don't match false is returned. See the PDB documentation for the SCALE record. See also last equation of section 2.5 of "Fundamentals of Crystallography" C. Giacovazzo- Parameters:
scaleMatrix
-- Returns:
-
checkScaleMatrix
public boolean checkScaleMatrix(javax.vecmath.Matrix4d scaleMatrix)
Given a scale matrix parsed from a PDB entry (SCALE1,2,3 records), compares it to our calculated Mtranspose matrix to see if they coincide and returns true if they do. If they don't that means that the PDB entry is not in the standard orthogonalisation (NCODE=1 in ccp4). In 2011's remediation only 148 PDB entries were found not to be in a non-standard orthogonalisation. See: http://www.wwpdb.org/documentation/2011remediation_overview-061711.pdf For normal cases the scale matrix is diagonal without a translation component. Additionally the translation component of the SCALE matrix is also checked to make sure it is (0,0,0), if not false is return- Parameters:
scaleMatrix
-- Returns:
-
isCellReasonable
public boolean isCellReasonable()
Checks whether the dimensions of this crystal cell are reasonable for protein crystallography: if all 3 dimensions are below 10.0 the cell is considered unrealistic and false returned- Returns:
-
-