chemaxon.struc
Class MolBond

java.lang.Object
  extended bychemaxon.struc.CEdge
      extended bychemaxon.struc.MolBond
All Implemented Interfaces:
java.io.Serializable, StereoConstants

public class MolBond
extends CEdge
implements StereoConstants

Chemical bond.

Version:
3.3, 08/26/2003
Author:
Peter Csizmadia, Tamas Karpati, Andras Volford
See Also:
Serialized Form

Field Summary
static int ANY
          Any bond type.
static int AROMATIC
          Aromatic bond type.
static int ARROW
          Reaction arrow.
static double CCLENGTH
          Default bond length.
static int DOUBLE_OR_AROMATIC
          Double or aromatic query bond type.
static int DOWN
          Single bond down.
static int SETSEQ_MAX
          Maximum bond set sequence number.
static int SETSEQ_OFF
          Bond set sequence number offset in flags.
static int SINGLE_OR_AROMATIC
          Single or aromatic query bond type.
static int SINGLE_OR_DOUBLE
          Single or double query bond type.
static int STEREO_MASK
          Single and double bond stereo mask.
static int STEREO1_MASK
          Single bond stereo mask.
static int STEREO2_CARE
          Cis/trans info of this bond is taken care of during the SSS process if this flag is set - used only for query bonds.
static int TOPOLOGY_CHAIN
          Bond is in a chain.
static int TOPOLOGY_MASK
          Bond topology mask.
static int TOPOLOGY_RING
          Bond is in a ring.
static int TYPE_MASK
          The lowest bits of the flags that store the bond type.
static int UP
          Single bond up.
 
Fields inherited from class chemaxon.struc.CEdge
node1, node2
 
Fields inherited from interface chemaxon.struc.StereoConstants
ATOMSTEREO_EITHER, ATOMSTEREO_MASK, ATOMSTEREO_NONE, ATOMSTEREO_SPECIFIC, CHIRALITY_MASK, CHIRALITY_R, CHIRALITY_S, CHIRALITYSUPPORT_ALL, CHIRALITYSUPPORT_NONE, CHIRALITYSUPPORT_SELECTED, CIS, CTUMASK, CTUNKNOWN, CTUNSPEC, DBS_ALL, DBS_MARKED, DBS_NONE, PARITY_EITHER, PARITY_EVEN, PARITY_MASK, PARITY_ODD, PARITY_UNSPEC, STGRP_ABS, STGRP_AND, STGRP_NONE, STGRP_OR, TRANS
 
Constructor Summary
MolBond(MolAtom a1, MolAtom a2)
          Construct a single bond between two atoms.
MolBond(MolAtom a1, MolAtom a2, int f)
          Construct a bond between two atoms.
 
Method Summary
 int calcOrderFromLength()
          Calculate the bond order from the atomic distances.
 int calcOrderFromValence()
          Calculate bond order from the types and charges of the two atoms.
 int calcStereo2()
          Computes the stereochemistry of the bond based on the atomic coordinates.
 int calcStereo2(MolAtom atom1, MolAtom atom4)
          Computes the stereochemistry of the bond based on the atomic coordinates.
 java.lang.Object clone()
          Make a copy of this object.
static double desiredLength(int atno1, int atno2, int type, int dim)
          Desired length of a bond between two atoms in Angstroms.
 MolAtom getAtom1()
          Gets the first endpoint.
 MolAtom getAtom2()
          Gets the second endpoint.
 MolAtom getCTAtom1()
          Gets the first atom for cis/trans stereo calculation.
 MolAtom getCTAtom4()
          Gets the fourth atom for cis/trans stereo calculation.
 int getFlags()
          Gets bond type (3 bit), stereo (2+2+1 bit), topology (2 bit) and bond set (5 bit) information.
 double getLength()
          Gets the actual length of the bond.
 MolAtom getOtherAtom(MolAtom atom)
          Gets the other end of the bond.
 int getSetSeq()
          Gets the bond set.
 int getStereo1(CNode o)
          Gets wedge bond type relative to the specified chiral atom.
 int getType()
          Gets the bond type.
 boolean isArrow()
          Checks if this edge represents a reaction arrow or not.
 void setFlags(int f)
          Sets bond type (3 bit), stereo (2+2+1 bit), topology (2 bit) and bond set (5 bit) information.
 void setFlags(int f, int mask)
          Sets bond type (3 bit), stereo (2+2+1 bit), and topology (2 bit) information.
 void setSetSeq(int g)
          Sets the bond set.
 void setStereo2Flags(CNode a1, CNode a4, int stereo2)
          Sets double bond stereo information.
 void setType(int t)
          Sets bond type and does valence checking for the endpoints.
 boolean stepWedge()
          Set the bond from 0 to UP or UP to DOWN.
static boolean stepWedge(MolBond[] bs)
          Flip the given bonds to the next state ONLY 1 bond is set to chiral starting from the last bond
 int transformCT(CNode a1, CNode a4, int f)
          Transform cis/trans stereo information into the `reference frame' of this bond.
 
Methods inherited from class chemaxon.struc.CEdge
equals, getLock, getNode1, getNode2, getOtherNode, getParent, swap, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CCLENGTH

public static final double CCLENGTH
Default bond length.

See Also:
Constant Field Values

TYPE_MASK

public static final int TYPE_MASK
The lowest bits of the flags that store the bond type.

See Also:
Constant Field Values

AROMATIC

public static final int AROMATIC
Aromatic bond type.

See Also:
Constant Field Values

SINGLE_OR_DOUBLE

public static final int SINGLE_OR_DOUBLE
Single or double query bond type.

See Also:
Constant Field Values

SINGLE_OR_AROMATIC

public static final int SINGLE_OR_AROMATIC
Single or aromatic query bond type.

See Also:
Constant Field Values

DOUBLE_OR_AROMATIC

public static final int DOUBLE_OR_AROMATIC
Double or aromatic query bond type.

See Also:
Constant Field Values

ANY

public static final int ANY
Any bond type.

See Also:
Constant Field Values

UP

public static final int UP
Single bond up.

See Also:
Constant Field Values

DOWN

public static final int DOWN
Single bond down.

See Also:
Constant Field Values

ARROW

public static final int ARROW
Reaction arrow.

See Also:
Constant Field Values

STEREO1_MASK

public static final int STEREO1_MASK
Single bond stereo mask. It equals UP | DOWN.

See Also:
UP, DOWN, Constant Field Values

STEREO2_CARE

public static final int STEREO2_CARE
Cis/trans info of this bond is taken care of during the SSS process if this flag is set - used only for query bonds.

See Also:
STEREO_MASK, Constant Field Values

STEREO_MASK

public static final int STEREO_MASK
Single and double bond stereo mask. It equals STEREO1_MASK | CTUMASK | STEREO2_CARE.

See Also:
STEREO1_MASK, StereoConstants.CTUMASK, STEREO2_CARE, Constant Field Values

TOPOLOGY_RING

public static final int TOPOLOGY_RING
Bond is in a ring.

See Also:
TOPOLOGY_MASK, Constant Field Values

TOPOLOGY_CHAIN

public static final int TOPOLOGY_CHAIN
Bond is in a chain.

See Also:
TOPOLOGY_MASK, Constant Field Values

SETSEQ_OFF

public static final int SETSEQ_OFF
Bond set sequence number offset in flags.

Since:
3.3
See Also:
SETSEQ_MAX, Constant Field Values

SETSEQ_MAX

public static final int SETSEQ_MAX
Maximum bond set sequence number.

Since:
3.3
See Also:
SETSEQ_OFF, Constant Field Values

TOPOLOGY_MASK

public static final int TOPOLOGY_MASK
Bond topology mask. It equals TOPOLOGY_CHAIN | TOPOLOGY_RING

See Also:
TOPOLOGY_CHAIN, TOPOLOGY_RING, Constant Field Values
Constructor Detail

MolBond

public MolBond(MolAtom a1,
               MolAtom a2,
               int f)
Construct a bond between two atoms.

Parameters:
a1 - the first atom
a2 - the second atom
f - bond type and other flags

MolBond

public MolBond(MolAtom a1,
               MolAtom a2)
Construct a single bond between two atoms.

Parameters:
a1 - the first atom
a2 - the second atom
Method Detail

getAtom1

public MolAtom getAtom1()
Gets the first endpoint.

Returns:
the first endpoint

getAtom2

public MolAtom getAtom2()
Gets the second endpoint.

Returns:
the second endpoint

getOtherAtom

public final MolAtom getOtherAtom(MolAtom atom)
Gets the other end of the bond.

Parameters:
atom - one of the edge endpoints
Returns:
the other end
Since:
3.0

getLength

public final double getLength()
Gets the actual length of the bond.

Returns:
the distance between the two atoms

getFlags

public final int getFlags()
Gets bond type (3 bit), stereo (2+2+1 bit), topology (2 bit) and bond set (5 bit) information.

Returns:
the flags
See Also:
TYPE_MASK, STEREO_MASK, TOPOLOGY_MASK, SETSEQ_OFF

setFlags

public final void setFlags(int f)
Sets bond type (3 bit), stereo (2+2+1 bit), topology (2 bit) and bond set (5 bit) information. Bond type can be set by calling
 b.setFlags((b.getFlags() & ~MolBond.TYPE_MASK) | type);
 
Valence checking is omitted if you set the bond type this way, without setType.

Parameters:
f - the flags
Since:
2.5
See Also:
TYPE_MASK, STEREO_MASK, TOPOLOGY_MASK, SETSEQ_OFF, setType(int)

setFlags

public final void setFlags(int f,
                           int mask)
Sets bond type (3 bit), stereo (2+2+1 bit), and topology (2 bit) information. Bond type can be set by calling
 b.setFlags(type, MolBond.TYPE_MASK);
 
Valence checking is omitted if you set the bond type this way, without setType.

Parameters:
f - new value of the specified bits
mask - bits to set
See Also:
TYPE_MASK, STEREO_MASK, TOPOLOGY_MASK, setFlags(int), setType(int)

getType

public final int getType()
Gets the bond type. Possible values: 1 (single), 2 (double), 3 (triple), query bond types.

Returns:
the bond type
See Also:
AROMATIC, SINGLE_OR_DOUBLE, SINGLE_OR_AROMATIC, DOUBLE_OR_AROMATIC, ANY

setType

public final void setType(int t)
Sets bond type and does valence checking for the endpoints.

See Also:
getType()

getSetSeq

public final int getSetSeq()
Gets the bond set.

Returns:
a number between 0 and SETSEQ_MAX
Since:
3.3

setSetSeq

public final void setSetSeq(int g)
Sets the bond set.

Parameters:
g - a number between 0 and SETSEQ_MAX
Since:
3.3

isArrow

public final boolean isArrow()
Checks if this edge represents a reaction arrow or not.

Returns:
true if this edge represents a reaction arrow, false otherwise
See Also:
ARROW

calcOrderFromLength

public int calcOrderFromLength()
Calculate the bond order from the atomic distances. The returned value should only be considered as an approximation.

Returns:
the bond order

calcOrderFromValence

public final int calcOrderFromValence()
Calculate bond order from the types and charges of the two atoms.

Returns:
the bond order

clone

public java.lang.Object clone()
Make a copy of this object.

Overrides:
clone in class CEdge
Returns:
the clone

desiredLength

public static double desiredLength(int atno1,
                                   int atno2,
                                   int type,
                                   int dim)
Desired length of a bond between two atoms in Angstroms.

Parameters:
atno1 - atomic number of the first atom
atno2 - atomic number of the second atom
type - bond order
dim - space dimension, 2 or 3
Returns:
the desired length

getStereo1

public final int getStereo1(CNode o)
Gets wedge bond type relative to the specified chiral atom.

Parameters:
o - the chiral atom
Returns:
the wedge bond type or zero
See Also:
UP, DOWN, STEREO1_MASK, getFlags()

getCTAtom1

public final MolAtom getCTAtom1()
Gets the first atom for cis/trans stereo calculation.

Returns:
atom a1 from a1-a2=a3-a4, or null in other configurations
See Also:
calcStereo2()

getCTAtom4

public final MolAtom getCTAtom4()
Gets the fourth atom for cis/trans stereo calculation.

Returns:
atom a4 from a1-a2=a3-a4, or null in other configurations
See Also:
calcStereo2()

setStereo2Flags

public void setStereo2Flags(CNode a1,
                            CNode a4,
                            int stereo2)
Sets double bond stereo information. Normally invoked by the SMILES import process.

Parameters:
a1 - atom number 1 in scheme a1-a2=a3-a4
a4 - atom number 4
stereo2 - CIS/TRANS information
See Also:
StereoConstants.CIS, StereoConstants.TRANS, StereoConstants.CTUNSPEC, StereoConstants.CTUMASK, calcStereo2(MolAtom, MolAtom)

transformCT

public int transformCT(CNode a1,
                       CNode a4,
                       int f)
Transform cis/trans stereo information into the `reference frame' of this bond. a1 == null and/or a4 == null is also accepted, null corresponds to any neighbor of a2 or a4 that is different than the reference atoms (the first ligands).

Parameters:
a1 - atom connected to node1
a4 - atom connected to node2
f - original flags
Returns:
the transformed flags

calcStereo2

public int calcStereo2()
Computes the stereochemistry of the bond based on the atomic coordinates. Note that this member function does not change the stereo flags. Bond type is not checked.

Returns:
0, CIS, TRANS, or CTUNKNOWN
See Also:
StereoConstants, getCTAtom1(), getCTAtom4(), calcStereo2(MolAtom, MolAtom)

calcStereo2

public int calcStereo2(MolAtom atom1,
                       MolAtom atom4)
Computes the stereochemistry of the bond based on the atomic coordinates. Note that this member function does not change the stereo flags. Bond type and connectivity are not checked (thus being bound to this bond is not a requirement for atoms a1 and a4).

Parameters:
atom1 - atom number 1 in scheme a1-a2=a3-a4
atom4 - atom number 4
Returns:
0, CIS, TRANS, or CTUNKNOWN
See Also:
StereoConstants

stepWedge

public boolean stepWedge()
Set the bond from 0 to UP or UP to DOWN.

Returns:
true if the initial state was 0 or UP, false after DOWN

stepWedge

public static boolean stepWedge(MolBond[] bs)
Flip the given bonds to the next state ONLY 1 bond is set to chiral starting from the last bond

Parameters:
bs - bond array which elements can be flipped
Returns:
true if flipping can be continued, false after last step