chemaxon.marvin.util
Class CleanUtil

java.lang.Object
  extended by chemaxon.marvin.util.CleanUtil

public class CleanUtil
extends java.lang.Object

Utility methods for cleaning.

Since:
Marvin 4.1, 01/31/2006
Version:
5.1.2, 09/15/2008
Author:
Peter Csizmadia, Andras Volford

Constructor Summary
CleanUtil()
           
 
Method Summary
static boolean arrangeComponents(MoleculeGraph mol)
          Arranges molecule components (reactants, agents, products, R-group definitions) nicely.
static void arrangeMolecules(CGraph[] mo, int dist, int col)
          Arrange molecules nicely If we have more molecules try to arrange them in a 2D square lattice
static void arrangeReaction(RxnMolecule m)
          Arranges reaction components nicely
static double calcBadness(MoleculeGraph mol1, MoleculeGraph mol2, MolAtom sa, MolBond[] xbonds)
          Calculates a "badness" value for the atomic coordinates.
static CTransform3D createRotationAboutBond(MolBond b, double phi)
          Creates a rotation transformation about a bond.
static double[] createSavedCoordsArray(MoleculeGraph g)
          Creates an empty array for the atomic coordinates of a structure.
static boolean hasWiggly(MolAtom a)
          Check if at least one wiggly bond starts from this atom.
static boolean[] isNonPreferredStereoAtom(MoleculeGraph m)
          Check if the atoms in the molecule is in SP2 hybridization state and has wedge whose getNode1 is the specified atom, but wiggly bonds next to double bonds are allowed.
static boolean removeCTflagFromSmallRings(MoleculeGraph m)
          Remove CIS|TRANS flag from bonds in rings smaller than size 8.
static void restoreCoords(MoleculeGraph g, double[] coords)
          Restores atomic coordinates.
static void saveCoords(MoleculeGraph g, double[] coords)
          Saves atomic coordinates.
static void setCTCrossedBond(MoleculeGraph m)
          Convert wiggly type double bonds to crossed.
static boolean setCTWigglyBond(MoleculeGraph m)
          Convert crossed double bonds to wiggly type.
static double sumDistanceSquare(MoleculeGraph mol, DPoint3 p)
          Calculates the sum of the distance square for each atom from a point.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CleanUtil

public CleanUtil()
Method Detail

sumDistanceSquare

public static double sumDistanceSquare(MoleculeGraph mol,
                                       DPoint3 p)
Calculates the sum of the distance square for each atom from a point.

Parameters:
mol - the molecule
p - the point

calcBadness

public static double calcBadness(MoleculeGraph mol1,
                                 MoleculeGraph mol2,
                                 MolAtom sa,
                                 MolBond[] xbonds)
Calculates a "badness" value for the atomic coordinates.

Parameters:
mol1 - the original molecule
mol2 - the transformed substructure
sa - additional transformed atom or null
xbonds - additional bonds between mol1 and mol2, or null
Returns:
the badness

createSavedCoordsArray

public static double[] createSavedCoordsArray(MoleculeGraph g)
Creates an empty array for the atomic coordinates of a structure.

Parameters:
g - the structure

saveCoords

public static void saveCoords(MoleculeGraph g,
                              double[] coords)
Saves atomic coordinates. This method can be called before trying a coordinate transformation.

Parameters:
g - the structure
coords - array for the coordinates

restoreCoords

public static void restoreCoords(MoleculeGraph g,
                                 double[] coords)
Restores atomic coordinates. This method can be called after trying a coordinate transformation.

Parameters:
g - the structure
coords - array containing the coordinates

createRotationAboutBond

public static CTransform3D createRotationAboutBond(MolBond b,
                                                   double phi)
Creates a rotation transformation about a bond.

Parameters:
b - the bond
phi - rotation angle

arrangeComponents

public static boolean arrangeComponents(MoleculeGraph mol)
Arranges molecule components (reactants, agents, products, R-group definitions) nicely.

Parameters:
mol - the molecule
Returns:
true if components have been rearranged, false if no components found

arrangeReaction

public static void arrangeReaction(RxnMolecule m)
Arranges reaction components nicely

Parameters:
m - the reaction molecule

arrangeMolecules

public static void arrangeMolecules(CGraph[] mo,
                                    int dist,
                                    int col)
Arrange molecules nicely If we have more molecules try to arrange them in a 2D square lattice

Parameters:
mo - molecules
dist - use CCLENGTH distance for the molecules
col - number of colums (if -1 calculate it)

setCTWigglyBond

public static boolean setCTWigglyBond(MoleculeGraph m)
Convert crossed double bonds to wiggly type.

Parameters:
m - molecule

hasWiggly

public static boolean hasWiggly(MolAtom a)
Check if at least one wiggly bond starts from this atom. (The which first atom of the bond should be the given atom.)

Parameters:
a - atom
Returns:
true if has wiggly bond starting from this atom

setCTCrossedBond

public static void setCTCrossedBond(MoleculeGraph m)
Convert wiggly type double bonds to crossed.

Parameters:
m - molecule

isNonPreferredStereoAtom

public static boolean[] isNonPreferredStereoAtom(MoleculeGraph m)
Check if the atoms in the molecule is in SP2 hybridization state and has wedge whose getNode1 is the specified atom, but wiggly bonds next to double bonds are allowed.

Parameters:
m - molecule
Returns:
true for SP2 atom which has wedge with narrow end else false.
Since:
Marvin 5.0

removeCTflagFromSmallRings

public static boolean removeCTflagFromSmallRings(MoleculeGraph m)
Remove CIS|TRANS flag from bonds in rings smaller than size 8. Remove TRANS flag from bonds in rings smaller than size 8, but give warning. Suppose that the stereo info stored already in the flags.

Parameters:
m - molecule
Returns:
false if TRANS stereoinformation is removed, otherwise true.