org.strbio.mol
Class Atom

java.lang.Object
  extended by org.strbio.mol.Atom
Direct Known Subclasses:
AtomNode

public class Atom
extends java.lang.Object

Class to represent an atom. Besides the things already here, the following things might be useful for some people:

 Version 1.12, 2/16/99 - changed writePDB to take a null protein name.
 Version 1.11, 8/7/98 - changed PrintfStream to Printf
 Version 1.1, 4/14/98 - added type, occupancy, tempFactor fields.
   Changed ali to altLoc, to conform to PDB recommendation.
 Version 1.0, 3/31/98 - original version
 

Version:
1.12, 2/16/99
Author:
JMC
See Also:
AtomNode, Molecule, Residue, Protein

Field Summary
 char altLoc
          Here's where you store the Alternate Location Indicator character, which is right after the name in the PDB.
 DVector coord
          Atomic coordinates.
 int n
          Atom serial number.
 java.lang.String name
          Name of the atom (as used in the PDB)... i.e.
 double occupancy
          Occupancy in a structure.
 double tempFactor
          Temperature (B) factor.
 
Constructor Summary
Atom()
          Constructor makes ALI ' ' and coord and name null.
Atom(Atom q)
          copies another atom, making its own copy of the data
 
Method Summary
static double bondAngle(Atom a, Atom b, Atom c)
          returns the bond angle in radians between three atoms, or Double.NaN if the coordinates of any are unknown.
static double dihedralAngle(Atom a, Atom b, Atom c, Atom d)
          returns the dihedral angle in radians between four atoms, or Double.NaN if the coordinates of any are unknown.
static double distance(Atom a, Atom b)
          returns the distance between two atoms, or Double.NaN if the coordinates of either are unknown.
static void find4(Atom a, Atom b, Atom c, Atom d, double r, double theta, double phi)
          relocate an atom (D) , given three nearby atoms (A, B, and C) with known location, a bond length CD, bond angle BCD, and dihedral angle ABCD.
 void find4(Atom a, Atom b, Atom c, double r, double theta, double phi)
          relocate this atom (D) , given three nearby atoms (A, B, and C) with known location, a bond length CD, bond angle BCD, and dihedral angle ABCD.
 void readPDB(java.lang.String buffer)
          Read an atom out of a PDB file.
 void rotate(DMatrix rot)
          rotate an atom by multiplying by a 3x3 rotation matrix.
 void transform(DMatrix trans)
          transform the position of an atom using a 3x4 (or 4x4 with the last column constant) transformation matrix.
 void translate(DVector trans)
          translate an atom by adding a DVector(3) to its coordinates.
 void writePDB(Printf outfile, java.lang.String protname, char chainid, java.lang.String restype, int resnum)
          Write the atom to a file in PDB format.
 double x()
          returns the first coordinate, or Double.NaN if unknown
 double y()
          returns the second coordinate, or Double.NaN if unknown
 double z()
          returns the third coordinate, or Double.NaN if unknown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public java.lang.String name
Name of the atom (as used in the PDB)... i.e. CA, CB, N There should be no spaces at the end. The Alternate Location Indicator field is NOT part of the name; you might see atoms called CA A and CA B in the PDB, but these are both named CA, with altLoc fields with value 'A' and 'B'.


altLoc

public char altLoc
Here's where you store the Alternate Location Indicator character, which is right after the name in the PDB.


n

public int n
Atom serial number.


coord

public DVector coord
Atomic coordinates. If null, they're unknown.


occupancy

public double occupancy
Occupancy in a structure.


tempFactor

public double tempFactor
Temperature (B) factor.

Constructor Detail

Atom

public Atom()
Constructor makes ALI ' ' and coord and name null. Occupancy and tempFactor are both 1.0.


Atom

public Atom(Atom q)
copies another atom, making its own copy of the data

Method Detail

x

public final double x()
returns the first coordinate, or Double.NaN if unknown


y

public final double y()
returns the second coordinate, or Double.NaN if unknown


z

public final double z()
returns the third coordinate, or Double.NaN if unknown


distance

public static final double distance(Atom a,
                                    Atom b)
returns the distance between two atoms, or Double.NaN if the coordinates of either are unknown.


bondAngle

public static final double bondAngle(Atom a,
                                     Atom b,
                                     Atom c)
returns the bond angle in radians between three atoms, or Double.NaN if the coordinates of any are unknown.


dihedralAngle

public static final double dihedralAngle(Atom a,
                                         Atom b,
                                         Atom c,
                                         Atom d)
returns the dihedral angle in radians between four atoms, or Double.NaN if the coordinates of any are unknown.


find4

public final void find4(Atom a,
                        Atom b,
                        Atom c,
                        double r,
                        double theta,
                        double phi)
relocate this atom (D) , given three nearby atoms (A, B, and C) with known location, a bond length CD, bond angle BCD, and dihedral angle ABCD. If any coordinates are unknown, this atom will have unknown coordinates. 3 atom positions A, B, C; bond length CD (r) bond angle BCD (theta, in degrees) dihedral ABCD (phi, in degrees)

Parameters:
a - first atom (A)
b - second atom (B)
c - third atom (C)
r - bond length CD, in Angstroms
theta - bond angle BCD, in radians
phi - dihedral angle ABCD, in radians

find4

public static final void find4(Atom a,
                               Atom b,
                               Atom c,
                               Atom d,
                               double r,
                               double theta,
                               double phi)
relocate an atom (D) , given three nearby atoms (A, B, and C) with known location, a bond length CD, bond angle BCD, and dihedral angle ABCD. If any coordinates are unknown, this atom will have unknown coordinates. 3 atom positions A, B, C; bond length CD (r) bond angle BCD (theta, in degrees) dihedral ABCD (phi, in degrees)

Parameters:
a - first atom (A)
b - second atom (B)
c - third atom (C)
d - fourth atom (D)
r - bond length CD, in Angstroms
theta - bond angle BCD, in radians
phi - dihedral angle ABCD, in radians

translate

public final void translate(DVector trans)
translate an atom by adding a DVector(3) to its coordinates. This has no effect if the coordinates are unknown.


rotate

public final void rotate(DMatrix rot)
rotate an atom by multiplying by a 3x3 rotation matrix. This has no effect if the coordinates are unknown.


transform

public final void transform(DMatrix trans)
transform the position of an atom using a 3x4 (or 4x4 with the last column constant) transformation matrix. This has no effect if the coordinates are unknown.


writePDB

public final void writePDB(Printf outfile,
                           java.lang.String protname,
                           char chainid,
                           java.lang.String restype,
                           int resnum)
                    throws java.io.IOException
Write the atom to a file in PDB format. See the PDB docs for more details.

Parameters:
outfile - an open Printf
protname - the name of the protein or molecule
chainid - the Chain ID character, or space if none
restype - the 3-letter code for the residue/base it's part of
Throws:
java.lang.IllegalArgumentException - if the coordinates are unknown
java.io.IOException

readPDB

public final void readPDB(java.lang.String buffer)
Read an atom out of a PDB file.

Parameters:
buffer - the ATOM line from the PDB file