astex
Class Symmetry

java.lang.Object
  extended by astex.Symmetry
Direct Known Subclasses:
Map

public class Symmetry
extends java.lang.Object

A class for generating symmetry related copies of molecules.


Field Summary
 Matrix cartesianToFractional
          The matrix that converts cartesian to fractional coordinates.
 Matrix fractionalToCartesian
          The matrix that converts fractional to cartesian coordinates.
 boolean matricesAssigned
          Have we precalculated the f2c and c2f matrices from SCALE.
 Matrix scale
          The SCALE matrix from the PDB file if one exists.
 double[] unitCell
          The unit cell for this symmetry object.
 
Constructor Summary
Symmetry()
           
 
Method Summary
 int cnxSpaceGroupNameToNumber(java.lang.String cnxName)
           
static void decodeSymmetryToken(java.lang.String token, double[] components)
          Decode the symmetry token in the String.
static void generateMatrices(double[] cell, Matrix cartesianToFractional, Matrix fractionalToCartesian)
          Generate the fractional to cartesian matrices.
 Matrix getCartesianToFractionalMatrix()
          Get the fractionalising matrix.
 Matrix getFractionalToCartesianMatrix()
          Get the defractionalising matrix.
 java.lang.String getOriginalSpaceGroupName()
          Get the original space group name.
 java.lang.String getSpaceGroupName()
          Get the space group name.
static java.lang.String getSpaceGroupName(java.lang.String spaceGroupDescription)
          Return the symmetry name from the spage group line.
 int getSpaceGroupNumber()
          Get the space group number.
 DynamicArray getSymmetryOperators()
          Get the symmetry operators for the specified space group.
 int getUnitCellCode()
          Get the coding.
static void main(java.lang.String[] args)
          Test method for the symmetry code.
 void prepareSymmetry()
          Generate the cartesian/fractional interconversion matrices.
static void readSymmetryOperator(java.lang.String line, DynamicArray symmetryOperators)
          Decode one symmetry operator.
 void setOriginalSpaceGroupName(java.lang.String s)
          Set the original space group name (with spaces).
 void setSpaceGroupName(java.lang.String name)
          Set the space group name.
 void setSpaceGroupNumber(int number)
          Set the space group number.
 void setUnitCell(double[] newCell)
          Set the unit cell.
 void setUnitCellCode(int code)
          Set the coding.
static double SQ(double x)
          Return the square of the argument.
static void transformPoint2(Point3d p, Matrix m)
          Transform a point by a crystallographic matrix.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

unitCell

public double[] unitCell
The unit cell for this symmetry object.


fractionalToCartesian

public Matrix fractionalToCartesian
The matrix that converts fractional to cartesian coordinates.


cartesianToFractional

public Matrix cartesianToFractional
The matrix that converts cartesian to fractional coordinates.


scale

public Matrix scale
The SCALE matrix from the PDB file if one exists.


matricesAssigned

public boolean matricesAssigned
Have we precalculated the f2c and c2f matrices from SCALE.

Constructor Detail

Symmetry

public Symmetry()
Method Detail

getSymmetryOperators

public DynamicArray getSymmetryOperators()
Get the symmetry operators for the specified space group.


getSpaceGroupName

public static java.lang.String getSpaceGroupName(java.lang.String spaceGroupDescription)
Return the symmetry name from the spage group line. The line is of the form 4 2 2 P21 PG2 MONOCLINIC 'P 1 21 1' Previous versions compressed the name from the pdb file and compared it to P21, but we need to compare it to 'P 1 21 1'. This method returns that compacted name.


readSymmetryOperator

public static void readSymmetryOperator(java.lang.String line,
                                        DynamicArray symmetryOperators)
Decode one symmetry operator.


decodeSymmetryToken

public static void decodeSymmetryToken(java.lang.String token,
                                       double[] components)
Decode the symmetry token in the String.


setUnitCell

public void setUnitCell(double[] newCell)
Set the unit cell.


prepareSymmetry

public void prepareSymmetry()
Generate the cartesian/fractional interconversion matrices. This is more involved than might appear at first. We need to handle a variety of special cases, like when the unit cell does not follow the standard pdb convention. Also there can be mistakes in the supplied SCALE records which we need to trap.


setSpaceGroupNumber

public void setSpaceGroupNumber(int number)
Set the space group number.


getSpaceGroupNumber

public int getSpaceGroupNumber()
Get the space group number.


setSpaceGroupName

public void setSpaceGroupName(java.lang.String name)
Set the space group name.


getSpaceGroupName

public java.lang.String getSpaceGroupName()
Get the space group name.


setOriginalSpaceGroupName

public void setOriginalSpaceGroupName(java.lang.String s)
Set the original space group name (with spaces).


getOriginalSpaceGroupName

public java.lang.String getOriginalSpaceGroupName()
Get the original space group name.


setUnitCellCode

public void setUnitCellCode(int code)
Set the coding.


getUnitCellCode

public int getUnitCellCode()
Get the coding.


getCartesianToFractionalMatrix

public Matrix getCartesianToFractionalMatrix()
Get the fractionalising matrix.


getFractionalToCartesianMatrix

public Matrix getFractionalToCartesianMatrix()
Get the defractionalising matrix.


SQ

public static double SQ(double x)
Return the square of the argument.


generateMatrices

public static void generateMatrices(double[] cell,
                                    Matrix cartesianToFractional,
                                    Matrix fractionalToCartesian)
Generate the fractional to cartesian matrices.


transformPoint2

public static void transformPoint2(Point3d p,
                                   Matrix m)
Transform a point by a crystallographic matrix. This seems to be the transpose of the matrices used for the graphics transformations.


main

public static void main(java.lang.String[] args)
Test method for the symmetry code.


cnxSpaceGroupNameToNumber

public int cnxSpaceGroupNameToNumber(java.lang.String cnxName)