astex
Class Molecule

java.lang.Object
  extended by astex.generic.Generic
      extended by astex.Molecule
All Implemented Interfaces:
GenericInterface, Selectable

public class Molecule
extends Generic
implements Selectable


Field Summary
 DynamicArray atoms
          Dynmamic array of atoms.
 DynamicArray bonds
          Dynamic array of bonds.
 boolean debug
          Is debugging on.
static java.lang.String DisplayBondDetails
           
static java.lang.String Displayed
           
static java.lang.String DisplayHydrogens
           
static int FeatureMolecule
           
static int Normal
          Normal display style.
static int NormalMolecule
          Type for a normal molecule.
static int Off
          Completely off.
static int SkeletonMolecule
           
static int SymmetryMolecule
           
static int Trace
          Backbone trace.
static int TraceAlways
          Backbone trace and atoms.
 
Fields inherited from class astex.generic.Generic
ClassName
 
Fields inherited from interface astex.generic.GenericInterface
Name
 
Constructor Summary
Molecule()
          Constructor which prepares a standard molecule.
 
Method Summary
 Atom addAtom()
          Add an atom to the molecule and return the reference to it.
 Atom addAtom(Residue res)
          Add an atom to the chain, residue set.
 Bond addBond(Atom firstAtom, Atom secondAtom)
          Add a bond between two atoms with default bond order.
 Bond addBond(Atom firstAtom, Atom secondAtom, int bondOrder)
          Add a bond to the molecule and return a reference to it.
 Bond addBond(Atom firstAtom, Atom secondAtom, int bondOrder, boolean explicit)
          Add a bond to the molecule and return a reference to it.
 Bond addBond(int firstAtomIndex, int secondAtomIndex)
          Add a bond to the molecule and return a reference to it.
 Bond addBond(int firstAtomIndex, int secondAtomIndex, int bondOrder)
          Add a bond to the molecule and return a reference to it.
 Bond addBondFromIds(int firstAtomIndex, int secondAtomIndex, int bondOrder)
          Add a bond to the molecule and return a reference to it.
 Chain addChain()
          Add a chain to the molecule.
 void addImproper(Atom a1, Atom a2, Atom a3, Atom a4)
          Create a improper for the 4 specified atoms.
 Residue addResidue()
          Add a residue to the current chain.
 Ring addRing()
          Add a new ring to the molecule.
 void assignAtomNumbers()
          Assign atom numbers.
 boolean atomNeedsImproper(Atom atom)
          Does this atom need a improper restraint.
 void clearVisitFlags()
          Clear the visit flags on all of the atoms.
 void connect()
          Connect the atoms in a molecule using standard bonding radii.
 void connect2()
          Connect the atoms using a neighbour grid.
 void connectResidue(Residue residue)
          Connect all of the atoms in a single residue.
 void connectResidues(Residue firstResidue, Residue secondResidue)
          Connect all of the atoms in a single residue.
 int countAngles()
          Count how many bond angles this molecule has.
 void find3Rings()
          Find 3 membered rings by direct search.
 Chain findChain(java.lang.String name, boolean add)
          Find or add a particular chain.
 void findRings()
          Find rings in the structure.
 void findRings(int ringSize)
          Find rings of a particular size.
 void generateBondImpropers()
          Generate impropers to keep bonds flat.
 void generateDoubleBondImproper(Bond bond)
          Generate the improper for this double bond.
 void generatePlanes(DynamicArray planes)
          Method for CCP4Dictionary that generates list of planes.
 void generateRing(Ring ring)
          Generate the impropers for one ring.
 void generateRingImpropers()
          Generate the impropers that are due to rings.
 void generateSingleBondImproper(Bond bond)
          Generate the improper for this single bond.
 void generateSp2Impropers()
          Generate impropers for sp2 hybrid atoms.
 java.lang.Object get(java.lang.Object key, java.lang.Object def)
          Get Object representing key.
 Angle getAngle(int index)
          Get the specified angle.
 java.lang.Object[] getAngleArray()
          Get the array of angles.
 int getAngleCount()
          Get the number of atoms for this molecule.
 Atom getAtom(int index)
          Return the specified atom.
 java.lang.Object[] getAtomArray()
          Return the atom array.
 int getAtomCount()
          Return the number of atoms in the molecule.
 Atom getAtomWithId(int id)
          Return the atom with the specified id.
 Ring getBestRingContainingBond(Bond bond)
          Return the best ring containing this bond.
 Bond getBond(int index)
          Return the specified bond.
 java.lang.Object[] getBondArray()
          Return the bond array.
 int getBondCount()
          Return the number of bonds in the molecule.
 Point3d getCenter()
          Find the center of the molecule.
 int getCentralAtomCount()
          Get the number of central atoms.
 Chain getChain(int index)
          Return the specified chain.
 int getChainCount()
          Return the number of chains.
 Chain getCurrentChain()
          Get the current chain.
 boolean getDisplayed()
          Is the molecule displayed?
 int getDisplayStyle()
          Get the display style.
 boolean getDisplayStyle(int style)
          Get the display style.
 java.lang.String getFilename()
          Get the filename.
 Improper getImproper(int index)
          Get the specified improper.
 java.lang.Object[] getImproperArray()
          Get the array of impropers.
 int getImproperCount()
          Get the number of atoms for this molecule.
 int getMaximumId()
          Get the maximum id for this molecule.
 int getMoleculeType()
          Return what type of molecule this is.
 java.lang.String getName()
          Get the molecule name.
 java.util.Enumeration getProperties()
          Return an enumeration of our properties.
 double getRadius()
          Get the radius of the molecule.
 int getResidueCount()
          Get the total number of residues.
 Ring getRing(int index)
          Return the specified ring.
 int getRingCount()
          Return the number of rings.
 Symmetry getSymmetry()
          Get the symmetry object.
 java.lang.String getType()
          Get the type.
 void initialise()
          Initialise the molecule.
 boolean isAtomIn3MemberedRing(Atom atom)
          Is this atom in a 3 membered ring.
 boolean isBondIn6Ring(Bond bond)
          Is this bond in a 6 membered ring.
 boolean isBondInAromaticRing(Bond bond)
          Is this bond in an aromatic ring.
 boolean isSpecialAtom(Atom atom)
          Does this atom need treating specially for bonding.
 boolean isSymmetryMolecule()
          Is this a symmetry molecule.
 void markRingBonds()
          Mark the bonds that are part of a ring.
 boolean nitrogenNeedsImproper(Atom atom)
          Does this nitrogen atom need a improper.
 void possiblyCreateRing(Atom[] atomPath, Bond[] bondPath, int ringSize)
          Create a ring if the atoms are in the right order.
 boolean propagateCycleSearch(Atom firstAtom, Atom secondAtom, int depth)
          Propagate the search for cycles.
 void removeAtom(Atom a)
          Remove an atom from the molecule.
 void removeBond(Bond b)
          Remove a bond from the molecule.
 void reorderAtoms()
          Reorder the atoms in a molecule.
 int select(int state)
          Apply a selection recursively.
 java.lang.String selectStatement()
           
 java.lang.Object set(java.lang.Object key, java.lang.Object property)
          Set an object value.
 void setCentralAtomCount(int cac)
          Set the number of central atoms.
 void setDisplayed(int newState)
          Set if the molecule is on or off.
 void setDisplayStyle(int style)
          Set Display style.
 void setFilename(java.lang.String s)
          Set the filename.
 void setMoleculeType(int t)
          Set what type of molecule this is.
 void setName(java.lang.String name)
          Set the molecule name
 void setSpaceGroupName(java.lang.String name)
          Set the space group name.
 void setSymmetry(Symmetry s)
          Set the symmetry entry for this molecule.
 void setType(java.lang.String s)
          Set the type.
 void setUnitCell(double[] newCell)
          Set the unit cell.
 boolean singleBondRequiresImproper(Bond bond)
          Does this single bond require a improper.
 java.lang.String toString()
          Generate a string representation.
 
Methods inherited from class astex.generic.Generic
addChild, addListener, addParent, getBoolean, getChildren, getClassname, getDouble, getInteger, getParents, getString, main, removeChild, removeListener, removeParent, setBoolean, setClassname, setDouble, setInteger, setString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

atoms

public DynamicArray atoms
Dynmamic array of atoms.


bonds

public DynamicArray bonds
Dynamic array of bonds.


Off

public static int Off
Completely off.


Normal

public static int Normal
Normal display style.


Trace

public static int Trace
Backbone trace.


TraceAlways

public static int TraceAlways
Backbone trace and atoms.


NormalMolecule

public static final int NormalMolecule
Type for a normal molecule.

See Also:
Constant Field Values

FeatureMolecule

public static final int FeatureMolecule
See Also:
Constant Field Values

SkeletonMolecule

public static final int SkeletonMolecule
See Also:
Constant Field Values

SymmetryMolecule

public static final int SymmetryMolecule
See Also:
Constant Field Values

debug

public boolean debug
Is debugging on.


Displayed

public static final java.lang.String Displayed
See Also:
Constant Field Values

DisplayHydrogens

public static final java.lang.String DisplayHydrogens
See Also:
Constant Field Values

DisplayBondDetails

public static final java.lang.String DisplayBondDetails
See Also:
Constant Field Values
Constructor Detail

Molecule

public Molecule()
Constructor which prepares a standard molecule.

Method Detail

setCentralAtomCount

public void setCentralAtomCount(int cac)
Set the number of central atoms.


getCentralAtomCount

public int getCentralAtomCount()
Get the number of central atoms.


getMoleculeType

public int getMoleculeType()
Return what type of molecule this is.


setMoleculeType

public void setMoleculeType(int t)
Set what type of molecule this is.


initialise

public void initialise()
Initialise the molecule.


toString

public java.lang.String toString()
Generate a string representation.

Overrides:
toString in class java.lang.Object

setDisplayStyle

public void setDisplayStyle(int style)
Set Display style.


getDisplayStyle

public int getDisplayStyle()
Get the display style.


getDisplayStyle

public boolean getDisplayStyle(int style)
Get the display style.


setDisplayed

public void setDisplayed(int newState)
Set if the molecule is on or off.


getDisplayed

public boolean getDisplayed()
Is the molecule displayed?


getAtomCount

public int getAtomCount()
Return the number of atoms in the molecule.


getAtom

public Atom getAtom(int index)
Return the specified atom.


getAtomWithId

public Atom getAtomWithId(int id)
Return the atom with the specified id.


assignAtomNumbers

public void assignAtomNumbers()
Assign atom numbers.


isSymmetryMolecule

public boolean isSymmetryMolecule()
Is this a symmetry molecule.


getBondCount

public int getBondCount()
Return the number of bonds in the molecule.


getBond

public Bond getBond(int index)
Return the specified bond.


getAngleCount

public int getAngleCount()
Get the number of atoms for this molecule.


getAngle

public Angle getAngle(int index)
Get the specified angle.


getAngleArray

public java.lang.Object[] getAngleArray()
Get the array of angles.


getImproperCount

public int getImproperCount()
Get the number of atoms for this molecule.


getImproper

public Improper getImproper(int index)
Get the specified improper.


getImproperArray

public java.lang.Object[] getImproperArray()
Get the array of impropers.


getAtomArray

public java.lang.Object[] getAtomArray()
Return the atom array.


getBondArray

public java.lang.Object[] getBondArray()
Return the bond array.


getRing

public Ring getRing(int index)
Return the specified ring.


getRingCount

public int getRingCount()
Return the number of rings.


getChainCount

public int getChainCount()
Return the number of chains.


getChain

public Chain getChain(int index)
Return the specified chain.


getCurrentChain

public Chain getCurrentChain()
Get the current chain.


getResidueCount

public int getResidueCount()
Get the total number of residues.


addChain

public Chain addChain()
Add a chain to the molecule.


findChain

public Chain findChain(java.lang.String name,
                       boolean add)
Find or add a particular chain.


addResidue

public Residue addResidue()
Add a residue to the current chain.


getMaximumId

public int getMaximumId()
Get the maximum id for this molecule.


addAtom

public Atom addAtom()
Add an atom to the molecule and return the reference to it.


addAtom

public Atom addAtom(Residue res)
Add an atom to the chain, residue set.


reorderAtoms

public void reorderAtoms()
Reorder the atoms in a molecule. This needs doing to make the molecule master atom list reflect the order of atoms in chains/residues.


addRing

public Ring addRing()
Add a new ring to the molecule.


addBond

public Bond addBond(Atom firstAtom,
                    Atom secondAtom,
                    int bondOrder)
Add a bond to the molecule and return a reference to it.


addBond

public Bond addBond(Atom firstAtom,
                    Atom secondAtom,
                    int bondOrder,
                    boolean explicit)
Add a bond to the molecule and return a reference to it.


addBond

public Bond addBond(Atom firstAtom,
                    Atom secondAtom)
Add a bond between two atoms with default bond order.


addBond

public Bond addBond(int firstAtomIndex,
                    int secondAtomIndex,
                    int bondOrder)
Add a bond to the molecule and return a reference to it.


addBond

public Bond addBond(int firstAtomIndex,
                    int secondAtomIndex)
Add a bond to the molecule and return a reference to it.


addBondFromIds

public Bond addBondFromIds(int firstAtomIndex,
                           int secondAtomIndex,
                           int bondOrder)
Add a bond to the molecule and return a reference to it.


removeAtom

public void removeAtom(Atom a)
Remove an atom from the molecule.


removeBond

public void removeBond(Bond b)
Remove a bond from the molecule.


isSpecialAtom

public boolean isSpecialAtom(Atom atom)
Does this atom need treating specially for bonding.


connect2

public void connect2()
Connect the atoms using a neighbour grid.


connect

public void connect()
Connect the atoms in a molecule using standard bonding radii.


connectResidue

public void connectResidue(Residue residue)
Connect all of the atoms in a single residue.


connectResidues

public void connectResidues(Residue firstResidue,
                            Residue secondResidue)
Connect all of the atoms in a single residue.


countAngles

public int countAngles()
Count how many bond angles this molecule has.


findRings

public void findRings()
Find rings in the structure.


findRings

public void findRings(int ringSize)
Find rings of a particular size.


find3Rings

public void find3Rings()
Find 3 membered rings by direct search.


possiblyCreateRing

public void possiblyCreateRing(Atom[] atomPath,
                               Bond[] bondPath,
                               int ringSize)
Create a ring if the atoms are in the right order. The ring is only created if 1. the first atom has the lowest index. 2. the second atom has a lower index than the last atom.


isBondInAromaticRing

public boolean isBondInAromaticRing(Bond bond)
Is this bond in an aromatic ring.


getBestRingContainingBond

public Ring getBestRingContainingBond(Bond bond)
Return the best ring containing this bond.


isBondIn6Ring

public boolean isBondIn6Ring(Bond bond)
Is this bond in a 6 membered ring.


isAtomIn3MemberedRing

public boolean isAtomIn3MemberedRing(Atom atom)
Is this atom in a 3 membered ring.


setName

public void setName(java.lang.String name)
Set the molecule name


getName

public java.lang.String getName()
Get the molecule name.


setFilename

public void setFilename(java.lang.String s)
Set the filename.


getFilename

public java.lang.String getFilename()
Get the filename.


setType

public void setType(java.lang.String s)
Set the type.


getType

public java.lang.String getType()
Get the type.


generateRingImpropers

public void generateRingImpropers()
Generate the impropers that are due to rings.


generateRing

public void generateRing(Ring ring)
Generate the impropers for one ring.


generateBondImpropers

public void generateBondImpropers()
Generate impropers to keep bonds flat.


singleBondRequiresImproper

public boolean singleBondRequiresImproper(Bond bond)
Does this single bond require a improper.


generateDoubleBondImproper

public void generateDoubleBondImproper(Bond bond)
Generate the improper for this double bond.


generateSingleBondImproper

public void generateSingleBondImproper(Bond bond)
Generate the improper for this single bond.


generateSp2Impropers

public void generateSp2Impropers()
Generate impropers for sp2 hybrid atoms.


addImproper

public void addImproper(Atom a1,
                        Atom a2,
                        Atom a3,
                        Atom a4)
Create a improper for the 4 specified atoms.


atomNeedsImproper

public boolean atomNeedsImproper(Atom atom)
Does this atom need a improper restraint.


nitrogenNeedsImproper

public boolean nitrogenNeedsImproper(Atom atom)
Does this nitrogen atom need a improper.


generatePlanes

public void generatePlanes(DynamicArray planes)
Method for CCP4Dictionary that generates list of planes.


getCenter

public Point3d getCenter()
Find the center of the molecule.


getRadius

public double getRadius()
Get the radius of the molecule.


setUnitCell

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


getSymmetry

public Symmetry getSymmetry()
Get the symmetry object.


setSymmetry

public void setSymmetry(Symmetry s)
Set the symmetry entry for this molecule.


setSpaceGroupName

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


clearVisitFlags

public void clearVisitFlags()
Clear the visit flags on all of the atoms.


markRingBonds

public void markRingBonds()
Mark the bonds that are part of a ring. This method is extremely inefficient (O(N^2)), but I can't figure out how to implement the linear time method without allocating extra storage for each atom (which I don't want to do).


propagateCycleSearch

public boolean propagateCycleSearch(Atom firstAtom,
                                    Atom secondAtom,
                                    int depth)
Propagate the search for cycles.


selectStatement

public java.lang.String selectStatement()
Specified by:
selectStatement in interface Selectable

select

public int select(int state)
Apply a selection recursively.

Specified by:
select in interface Selectable

set

public java.lang.Object set(java.lang.Object key,
                            java.lang.Object property)
Description copied from interface: GenericInterface
Set an object value.

Specified by:
set in interface GenericInterface
Overrides:
set in class Generic

get

public java.lang.Object get(java.lang.Object key,
                            java.lang.Object def)
Description copied from interface: GenericInterface
Get Object representing key.

Specified by:
get in interface GenericInterface
Overrides:
get in class Generic

getProperties

public java.util.Enumeration getProperties()
Description copied from interface: GenericInterface
Return an enumeration of our properties.

Specified by:
getProperties in interface GenericInterface
Overrides:
getProperties in class Generic