Package org.biojava.nbio.structure.xtal
Class SpaceGroup
- java.lang.Object
-
- org.biojava.nbio.structure.xtal.SpaceGroup
-
- All Implemented Interfaces:
Serializable
public class SpaceGroup extends Object implements Serializable
A crystallographic space group. We store the standard numeric identifier, the international short symbol and the transformations corresponding to each space group (as Matrix4ds and in algebraic notation). The information for all (protein crystallography) space groups can be parsed from the XML file in the resource directory. See: http://en.wikipedia.org/wiki/Space_group- Author:
- duarte_j
- See Also:
SymoplibParser
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static double
DELTA
-
Constructor Summary
Constructors Constructor Description SpaceGroup(int id, int multiplicity, int primitiveMultiplicity, String shortSymbol, String altShortSymbol, BravaisLattice bravLattice)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTransformation(String transfAlgebraic)
boolean
areInSameAxis(int tId1, int tId2)
Returns true if both given transform ids belong to the same crystallographic axis (a, b or c) For two non-rotation transformations (i.e. identity operators) it returns trueprotected static boolean
deltaComp(double d1, double d2, double delta)
boolean
equals(Object o)
static String
getAlgebraicFromMatrix(javax.vecmath.Matrix4d m)
String
getAltShortSymbol()
Gets the alternative international short name (as sometimes used in PDB), e.g.int
getAxisFoldType(int transformId)
Given a transformId returns the type of axis of rotation: 1 (no rotation), 2, 3, 4 or 6 -fold and for improper rotations: -1, -2, -3, -4 and -6int[]
getAxisTypes()
BravaisLattice
getBravLattice()
javax.vecmath.Vector3d
getCellTranslation(int i)
javax.vecmath.Vector3d[]
getCellTranslations()
static Pattern
getCoordpat()
static double
getDelta()
int
getId()
Gets the standard numeric identifier for the space group.static javax.vecmath.Matrix4d
getMatrixFromAlgebraic(String transfAlgebraic)
int
getMultiplicity()
static Pattern
getNonenantpat()
int
getNumOperators()
Gets the number of symmetry operators corresponding to this SpaceGroup (counting the identity operator)int
getPrimitiveMultiplicity()
static javax.vecmath.AxisAngle4d
getRotAxisAndAngle(javax.vecmath.Matrix3d m)
Given a rotation matrix calculates the rotation axis and angle for it.javax.vecmath.AxisAngle4d
getRotAxisAngle(int transformId)
static int
getRotAxisType(javax.vecmath.Matrix4d m)
Given a transformation matrix containing a rotation returns the type of rotation: 1 for identity, 2 for 2-fold rotation, 3 for 3-fold rotation, 4 for 4-fold rotation, 6 for 6-fold rotation, -1 for inversions, -2 for mirror planes, -3 for 3-fold improper rotation, -4 for 4-fold improper rotation and -6 for 6-fold improper rotationstatic long
getSerialversionuid()
String
getShortSymbol()
Gets the international short name (as used in PDB), e.g.static Pattern
getSplitpat1()
static Pattern
getSplitpat2()
static Pattern
getTranscoefpat()
List<String>
getTransfAlgebraic()
String
getTransfAlgebraic(int i)
Gets a transformation algebraic string given its index.javax.vecmath.Matrix4d
getTransformation(int i)
Gets a transformation by index expressed in crystal axes basis.List<javax.vecmath.Matrix4d>
getTransformations()
Gets all transformations except for the identity in crystal axes basis.int
hashCode()
protected void
initializeCellTranslations()
boolean
isEnantiomorphic()
static SpaceGroup
parseSpaceGroup(String shortName)
Get the space group for the given international short name, using the PDB format, e.g.void
setAltShortSymbol(String altShortSymbol)
void
setAxisTypes(int[] axisTypes)
void
setBravLattice(BravaisLattice bravLattice)
void
setId(int id)
void
setMultiplicity(int multiplicity)
void
setPrimitiveMultiplicity(int primitiveMultiplicity)
void
setShortSymbol(String shortSymbol)
void
setTransfAlgebraic(List<String> transfAlgebraic)
String
toString()
String
toXML()
-
-
-
Field Detail
-
DELTA
protected static final double DELTA
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SpaceGroup
public SpaceGroup(int id, int multiplicity, int primitiveMultiplicity, String shortSymbol, String altShortSymbol, BravaisLattice bravLattice)
-
-
Method Detail
-
parseSpaceGroup
public static SpaceGroup parseSpaceGroup(String shortName)
Get the space group for the given international short name, using the PDB format, e.g. 'P 21 21 21' or 'C 1 c 1'- Parameters:
shortName
-- Returns:
- the SpaceGroup or null if the shortName is not valid
- See Also:
SymoplibParser.getSpaceGroup(String)
-
addTransformation
public void addTransformation(String transfAlgebraic)
-
initializeCellTranslations
protected void initializeCellTranslations()
-
getMultiplicity
public int getMultiplicity()
-
getPrimitiveMultiplicity
public int getPrimitiveMultiplicity()
-
getCellTranslations
public javax.vecmath.Vector3d[] getCellTranslations()
-
getCellTranslation
public javax.vecmath.Vector3d getCellTranslation(int i)
-
getMatrixFromAlgebraic
public static javax.vecmath.Matrix4d getMatrixFromAlgebraic(String transfAlgebraic)
-
getId
public int getId()
Gets the standard numeric identifier for the space group. See for example http://en.wikipedia.org/wiki/Space_group or the IUCr crystallographic tables- Returns:
-
getShortSymbol
public String getShortSymbol()
Gets the international short name (as used in PDB), e.g. "P 21 21 21" or "C 1 c 1"- Returns:
-
getAltShortSymbol
public String getAltShortSymbol()
Gets the alternative international short name (as sometimes used in PDB), e.g. "I 1 2 1" instead of "I 2"- Returns:
-
getTransformations
public List<javax.vecmath.Matrix4d> getTransformations()
Gets all transformations except for the identity in crystal axes basis.- Returns:
-
getRotAxisAngle
public javax.vecmath.AxisAngle4d getRotAxisAngle(int transformId)
-
areInSameAxis
public boolean areInSameAxis(int tId1, int tId2)
Returns true if both given transform ids belong to the same crystallographic axis (a, b or c) For two non-rotation transformations (i.e. identity operators) it returns true- Parameters:
tId1
-tId2
-- Returns:
-
getAxisFoldType
public int getAxisFoldType(int transformId)
Given a transformId returns the type of axis of rotation: 1 (no rotation), 2, 3, 4 or 6 -fold and for improper rotations: -1, -2, -3, -4 and -6- Parameters:
transformId
-- Returns:
-
getTransformation
public javax.vecmath.Matrix4d getTransformation(int i)
Gets a transformation by index expressed in crystal axes basis. Index 0 corresponds always to the identity transformation. Beware the returned Matrix4d is not a copy but it stays linked to the one stored in this SpaceGroup object- Parameters:
i
-- Returns:
-
getTransfAlgebraic
public String getTransfAlgebraic(int i)
Gets a transformation algebraic string given its index. Index 0 corresponds always to the identity transformation.- Parameters:
i
-- Returns:
-
getNumOperators
public int getNumOperators()
Gets the number of symmetry operators corresponding to this SpaceGroup (counting the identity operator)- Returns:
-
getAlgebraicFromMatrix
public static String getAlgebraicFromMatrix(javax.vecmath.Matrix4d m)
-
deltaComp
protected static boolean deltaComp(double d1, double d2, double delta)
-
getBravLattice
public BravaisLattice getBravLattice()
-
isEnantiomorphic
public boolean isEnantiomorphic()
-
getRotAxisAndAngle
public static javax.vecmath.AxisAngle4d getRotAxisAndAngle(javax.vecmath.Matrix3d m)
Given a rotation matrix calculates the rotation axis and angle for it. The angle is calculated from the trace, the axis from the eigenvalue decomposition. If given matrix is improper rotation or identity matrix then axis (0,0,0) and angle 0 are returned.- Parameters:
m
-- Returns:
- Throws:
IllegalArgumentException
- if given matrix is not a rotation matrix (determinant not 1 or -1)
-
getRotAxisType
public static int getRotAxisType(javax.vecmath.Matrix4d m)
Given a transformation matrix containing a rotation returns the type of rotation: 1 for identity, 2 for 2-fold rotation, 3 for 3-fold rotation, 4 for 4-fold rotation, 6 for 6-fold rotation, -1 for inversions, -2 for mirror planes, -3 for 3-fold improper rotation, -4 for 4-fold improper rotation and -6 for 6-fold improper rotation- Parameters:
m
-- Returns:
-
getTransfAlgebraic
public List<String> getTransfAlgebraic()
-
setTransfAlgebraic
public void setTransfAlgebraic(List<String> transfAlgebraic)
-
getAxisTypes
public int[] getAxisTypes()
-
setAxisTypes
public void setAxisTypes(int[] axisTypes)
-
getSerialversionuid
public static long getSerialversionuid()
-
getSplitpat1
public static Pattern getSplitpat1()
-
getSplitpat2
public static Pattern getSplitpat2()
-
getCoordpat
public static Pattern getCoordpat()
-
getTranscoefpat
public static Pattern getTranscoefpat()
-
getNonenantpat
public static Pattern getNonenantpat()
-
getDelta
public static double getDelta()
-
setId
public void setId(int id)
-
setMultiplicity
public void setMultiplicity(int multiplicity)
-
setPrimitiveMultiplicity
public void setPrimitiveMultiplicity(int primitiveMultiplicity)
-
setShortSymbol
public void setShortSymbol(String shortSymbol)
-
setAltShortSymbol
public void setAltShortSymbol(String altShortSymbol)
-
setBravLattice
public void setBravLattice(BravaisLattice bravLattice)
-
-