showMol
Class Molecule

java.lang.Object
  extended by showMol.Molecule

public class Molecule
extends java.lang.Object

Molecule contains the structural description of a molecule.

Version:
1.0
Author:
dablauch

Field Summary
static int BALLANDSTICK
           
static int SPACEFILLING
           
static int WIREFRAME
           
 
Constructor Summary
Molecule()
          Creates a Molecule object containing no atoms
Molecule(int s, java.lang.String path)
          Creates a special molecule based upon one of several pre-programmed cases.
Molecule(java.net.URL url, int displayFormat)
          Creates a molecule based upon the specified PDB structure file.
Molecule(java.net.URL url, int displayFormat, int fileFormat)
          Creates a molecule based upon the specified structure file.
 
Method Summary
 void addRotation(double x, double y, double z, double a)
          Rotates the molecule about its center.
 void centerMolecule()
          Positions the molecule so that the average atomic coordinates are at the origin.
 void centerMoleculeOnAtom(int idx)
          Positions the molecule so that the specified atom is positioned at the origin.
 void clearRotation()
          Resets the rotation portion of the transform.
 void destroy()
          Destroys all Java3D objects
 Atom getAtom(int idx)
          Provides the indicated atom
 javax.media.j3d.BranchGroup getBranchGroup()
          Provides the BranchGroup for the molecule.
 javax.vecmath.Point3d getCenter()
           
 int getNbrAtoms()
          Provides the number of atoms in the molecule.
 void setDisplayFormat(int d)
          Sets the display format.
 void setRotation(double x, double y, double z, double a)
          Rotates the molecule about its center.
 void setRotationOnAtom(int idx, double x, double y, double z, double a)
          Rotates the molecule about the specified atom.
 void setTranslation(double x, double y, double z)
          Sets the position of the molecule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BALLANDSTICK

public static int BALLANDSTICK

SPACEFILLING

public static int SPACEFILLING

WIREFRAME

public static int WIREFRAME
Constructor Detail

Molecule

public Molecule()
Creates a Molecule object containing no atoms


Molecule

public Molecule(int s,
                java.lang.String path)
Creates a special molecule based upon one of several pre-programmed cases. 1 graphite 2 cristobalite (requires cristobalite.xyz file)

Parameters:
s - index of special case
path - path to any needed files

Molecule

public Molecule(java.net.URL url,
                int displayFormat)
Creates a molecule based upon the specified PDB structure file.

Parameters:
url - URL pointing to structure file
displayFormat - display format for molecule

Molecule

public Molecule(java.net.URL url,
                int displayFormat,
                int fileFormat)
Creates a molecule based upon the specified structure file.

Parameters:
url - URL pointing to structure file
displayFormat - display format for molecule
fileFormat - file format for structure file
Method Detail

addRotation

public void addRotation(double x,
                        double y,
                        double z,
                        double a)
Rotates the molecule about its center.

Parameters:
x - x component of axis of rotation
y - y component of axis of rotation
z - z component of axis of rotation
a - angle of rotation

centerMolecule

public void centerMolecule()
Positions the molecule so that the average atomic coordinates are at the origin.


centerMoleculeOnAtom

public void centerMoleculeOnAtom(int idx)
Positions the molecule so that the specified atom is positioned at the origin.

Parameters:
idx - index of atom to be placed at origin

destroy

public void destroy()
Destroys all Java3D objects


getAtom

public Atom getAtom(int idx)
Provides the indicated atom

Parameters:
idx - index of atom

clearRotation

public void clearRotation()
Resets the rotation portion of the transform.


getBranchGroup

public javax.media.j3d.BranchGroup getBranchGroup()
Provides the BranchGroup for the molecule.

Returns:
BranchGroup

getCenter

public javax.vecmath.Point3d getCenter()

getNbrAtoms

public int getNbrAtoms()
Provides the number of atoms in the molecule.

Returns:
number of atoms

setDisplayFormat

public void setDisplayFormat(int d)
Sets the display format. The display index is specified with ShowMol.BALLANDSTICK, ShowMol.BALL, ShowMol.SPACEFILLING, or ShowMol.WIREFRAME.

Parameters:
d - index for display

setRotation

public void setRotation(double x,
                        double y,
                        double z,
                        double a)
Rotates the molecule about its center.

Parameters:
x - x component of axis of rotation
y - y component of axis of rotation
z - z component of axis of rotation
a - angle of rotation

setRotationOnAtom

public void setRotationOnAtom(int idx,
                              double x,
                              double y,
                              double z,
                              double a)
Rotates the molecule about the specified atom.

Parameters:
idx - index of atom about which rotation occurs
x - x component of axis of rotation
y - y component of axis of rotation
z - z component of axis of rotation
a - angle of rotation

setTranslation

public void setTranslation(double x,
                           double y,
                           double z)
Sets the position of the molecule.

Parameters:
x - position along x-axis
y - position along y-axis
z - position along z-axis