JMV 0.80 Programmer's Documentation

Class Molecule

java.lang.Object
  |
  +--Molecule

public class Molecule
extends java.lang.Object

Molecule.java class for storing information about a molecule read in from a pdb file


Nested Class Summary
 class Molecule.Atom
          inner class Atom for use in Molecule
 
Constructor Summary
Molecule()
          Constructor
 
Method Summary
 void addAtom(int serial, java.lang.String name, java.lang.String loc, java.lang.String residue, java.lang.String chain, java.lang.String resid, java.lang.String insertion, float occ, float temp, java.lang.String segmentId, java.lang.String symbol, java.lang.String charge)
          Adds an Atom to this Molecule
 void addAtom(Molecule.Atom newAtom)
          Add an Atom to this Molecule
 void addNewPosition(int atomIndex, float[] position)
          Adds a new position for a new time index for a specified Atom
 float atomRadius(int index)
          Gets the radius for a specified Atom
static float atomRadius(java.lang.String atomName)
          Gets a radius for an atom based on its name gotten from the pdb.
 void calc_minmax()
          Calculates the minimum and maximum x, y, and z coordinates Stores the values in m_fMinX, m_fMaxX, m_fMinY, m_fMaxY, m_fMinZ, m_fMaxZ
 void createBondList()
          Creates the neighbor list, listing the neighbors of each atom for drawing bonds It creates a 2D array, where each element contains an array of integers that correspond to the indeces of its neighbors and stores it in m_iaBondList
 void createCAList()
          Creates a list of atom indeces that are all the C-Alpha (CA) atoms in the molecule Stores result in m_iaCAList
 Molecule.Atom findAtomInResidue(java.lang.String name, int resId)
          Gets the atom given its name and residue id
 java.util.Vector getAllPositions()
          Gets all the coordinates for the Atoms in this Molecule, for all times
 Molecule.Atom getAtom(int index)
          Gets the atom at a specific index
static char getAtomCharacter(java.lang.String name)
          Gets a character representing this atom, based on the String name gotten from the pdb.
 int[][] getBondList()
          Gets the list of bonds between atoms
 float[] getCoords()
          Gets all the coordinates for each Atom in this Molecule for time 0
 float[] getCoords(int time)
          Gets all the coordinates for each Atom in this Molecule for a specified timestep
 float getMaxX()
          Gets maximum x coordinate for this Molecule
 float getMaxY()
          Gets maximum y coordinate for this Molecule
 float getMaxZ()
          Gets maximum z coordinate for this Molecule
 float getMinX()
          Gets minimum x coordinate for this Molecule
 float getMinY()
          Gets minimum y coordinate for this Molecule
 float getMinZ()
          Gets minimum z coordinate for this Molecule
 float[] getPosition(int atomIndex)
          gets the coordinates of an atom position for time 0
 float[] getPosition(int atomIndex, int timeIndex)
          gets the coordinates of an atom position for a specified time index
 int numAtoms()
          Returns the number of atoms in the molecule
 void print()
          Prints information for the Molecule: the serial, name, residue id, and (x,y,z) coordinate for each Atom
 void setPositions(java.util.Vector positions)
          Sets the coordinates for the Atoms in the Molecule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Molecule

public Molecule()
Constructor

Method Detail

numAtoms

public int numAtoms()
Returns the number of atoms in the molecule


addAtom

public void addAtom(Molecule.Atom newAtom)
Add an Atom to this Molecule


getAtom

public Molecule.Atom getAtom(int index)
Gets the atom at a specific index

Parameters:
index - the index for the atom
Returns:
the Atom in the Molecule with the specified index

getCoords

public float[] getCoords()
Gets all the coordinates for each Atom in this Molecule for time 0

Returns:
a float array of the (x,y,z) coordinates for each Atom in the Molecule, i.e. [x1, y1, z1, x2, y2, z2...]

getCoords

public float[] getCoords(int time)
Gets all the coordinates for each Atom in this Molecule for a specified timestep

Parameters:
time - the time position to get the coordinates for
Returns:
a float array of the (x,y,z) coordinates for each Atom in the Molecule, i.e. [x1, y1, z1, x2, y2, z2...]

addAtom

public void addAtom(int serial,
                    java.lang.String name,
                    java.lang.String loc,
                    java.lang.String residue,
                    java.lang.String chain,
                    java.lang.String resid,
                    java.lang.String insertion,
                    float occ,
                    float temp,
                    java.lang.String segmentId,
                    java.lang.String symbol,
                    java.lang.String charge)
Adds an Atom to this Molecule

Parameters:
serial - the serial number
name - the Atom name
loc - the location of the Atom
residue - the residue the Atom is in
chain - the chain the Atom is in
resid - the id for the residue the Atom is in
insertion - the insertion code
occ - the occupancy of the Atom
temp - the temperature of the Atom
segmentId - the id for the segment the Atom is in
symbol - the atomic symbol for the Atom
charge - the charge of the Atom

setPositions

public void setPositions(java.util.Vector positions)
Sets the coordinates for the Atoms in the Molecule

Parameters:
positions - a Vector containing the (x,y,z) coordinates for each Atom for each time index

getAllPositions

public java.util.Vector getAllPositions()
Gets all the coordinates for the Atoms in this Molecule, for all times

Returns:
a Vector containing the (x,y,z) coordinates for each Atom for each time index

getPosition

public float[] getPosition(int atomIndex,
                           int timeIndex)
gets the coordinates of an atom position for a specified time index

Parameters:
atomIndex - the index of the atom in this Molecule's atom vector
timeIndex - the index of the time position for this atom
Returns:
a float array of the x,y,z coordinate for this atom and time

getPosition

public float[] getPosition(int atomIndex)
gets the coordinates of an atom position for time 0

Parameters:
atomIndex - the index of the atom in this Molecule's atom vector
Returns:
a float array of the x,y,z coordinate for this atom and time

calc_minmax

public void calc_minmax()
Calculates the minimum and maximum x, y, and z coordinates Stores the values in m_fMinX, m_fMaxX, m_fMinY, m_fMaxY, m_fMinZ, m_fMaxZ


getMinX

public float getMinX()
Gets minimum x coordinate for this Molecule


getMaxX

public float getMaxX()
Gets maximum x coordinate for this Molecule


getMinY

public float getMinY()
Gets minimum y coordinate for this Molecule


getMaxY

public float getMaxY()
Gets maximum y coordinate for this Molecule


getMinZ

public float getMinZ()
Gets minimum z coordinate for this Molecule


getMaxZ

public float getMaxZ()
Gets maximum z coordinate for this Molecule


addNewPosition

public void addNewPosition(int atomIndex,
                           float[] position)
Adds a new position for a new time index for a specified Atom

Parameters:
atomIndex - the index of the Atom to modify
position - a float array of the (x,y,z) coordinate to add

print

public void print()
Prints information for the Molecule: the serial, name, residue id, and (x,y,z) coordinate for each Atom


atomRadius

public static float atomRadius(java.lang.String atomName)
Gets a radius for an atom based on its name gotten from the pdb.

Returns:
the radius for the atom

atomRadius

public float atomRadius(int index)
Gets the radius for a specified Atom

Parameters:
index - the index of the Atom to get the radius for
Returns:
the radius of the Atom

getAtomCharacter

public static char getAtomCharacter(java.lang.String name)
Gets a character representing this atom, based on the String name gotten from the pdb.

Parameters:
name - the name of the atom gotten from the pdb file
Returns:
the character representing this Atom

createBondList

public void createBondList()
Creates the neighbor list, listing the neighbors of each atom for drawing bonds It creates a 2D array, where each element contains an array of integers that correspond to the indeces of its neighbors and stores it in m_iaBondList


getBondList

public int[][] getBondList()
Gets the list of bonds between atoms

Returns:
a 2d int array representing the neighboring Atom indeces for each Atom

createCAList

public void createCAList()
Creates a list of atom indeces that are all the C-Alpha (CA) atoms in the molecule Stores result in m_iaCAList


findAtomInResidue

public Molecule.Atom findAtomInResidue(java.lang.String name,
                                       int resId)
Gets the atom given its name and residue id

Parameters:
name - the name of the atom ("O", "CA", etc)
resId - the residue id in which you wish to find the atom
Returns:
the Atom in the molecule with the specified residue id and name

Copyright (C) 2000-2002 The Board of Trustees of the University of Illinois