Package chemaxon.struc
Class MolBond
java.lang.Object
chemaxon.struc.MolBond
- All Implemented Interfaces:
StereoConstants
,Serializable
- Direct Known Subclasses:
QueryBond
Chemical bond.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Any bond type.static final int
Aromatic bond type.static final int
"Bold" attribute of the bond.static final double
Default bond length.static final int
Conjugation state of the bond.static final int
Coordinate bond flag.static final int
Double bond type.static final int
Double or aromatic query bond type.static final int
Single bond down flag.static final int
"Hashed" attribute of the bond.static final int
Hydrogen bond type.static final int
The bond (order) has changed in the reaction.static final int
The bond is created and changed.static final int
The bond is made or broken in the reaction.static final int
The bond is not a reacting center.static final int
The bond is not modified in the reaction.static final int
The bond is a reacting center.static final int
Unmapped bond in reacting center.static final int
Mask for reacting center bits.static final int
Maximum bond set sequence number.static final int
Bond set sequence number offset in flags.static final int
Single bond type.static final int
Single or aromatic query bond type.static final int
Single or double query bond type.static final int
Single and double bond stereo mask.static final int
Single bond stereo mask.static final int
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 final int
Bond is in a chain.static final int
Bond topology mask.static final int
Bond is in a ring.static final int
Triple bond type.static final int
The lowest bits of the flags that store the bond type.static final int
Single bond up flag.static final int
Single bond wavy flag.Fields inherited from interface chemaxon.struc.StereoConstants
ANTI, ATOMSTEREO_EITHER, ATOMSTEREO_MASK, ATOMSTEREO_NONE, ATOMSTEREO_SPECIFIC, CHIRALITY_M, CHIRALITY_MASK, CHIRALITY_P, CHIRALITY_r, CHIRALITY_R, CHIRALITY_s, CHIRALITY_S, CHIRALITYSUPPORT_ALL, CHIRALITYSUPPORT_ALL_POSSIBLE, CHIRALITYSUPPORT_NONE, CHIRALITYSUPPORT_SELECTED, CIS, CIS_TRANS, CTUMASK, CTUNKNOWN, CTUNSPEC, DBS_ALL, DBS_MARKED, DBS_NONE, ENDO, EXO, PARITY_ALLENE, PARITY_EITHER, PARITY_EVEN, PARITY_MASK, PARITY_NONE, PARITY_ODD, PARITY_TETRAHEDRAL, PARITY_UNSPEC, STGRP_ABS, STGRP_AND, STGRP_NONE, STGRP_OR, SYN, TRANS
-
Constructor Summary
ModifierConstructorDescriptionConstruct a single bond between two atoms.Construct a bond between two atoms.Construct a bond between two atoms.protected
Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionint
Calculate the bond order from the atomic distances.final int
Calculate bond order from the types and charges of the two atoms.int
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.static int
calcStereo2
(MolAtom atom1, MolAtom atom2, MolAtom atom3, MolAtom atom4) Computes the stereochemistry of the atom sequence (scheme a1-a2=a3-a4) based on the atomic coordinates.void
Removes all properties from this bond.clone()
Make a copy of this object.Clones this bond.boolean
boolean
Returns true if this bond has a mapping for the specified property key.static double
desiredLength
(int atno1, int atno2, int type, int dim) Desired length of a bond between two atoms in Angstroms.getAtom1()
Gets the first endpoint.getAtom2()
Gets the second endpoint.final BondType
Gets the type of the bond.final MolAtom
Gets the first atom for cis/trans stereo calculation.final MolAtom
Gets the fourth atom for cis/trans stereo calculation.double
Deprecated, for removal: This API element is subject to removal in a future version.double
getDesiredLength
(boolean shortenHbonds) Deprecated, for removal: This API element is subject to removal in a future version.since 5.11, replaced bydesiredLength(int, int, int, int)
.final int
getFlags()
Gets bond type (4 bits), stereo (2+2+1 bits), topology (2 bits), bond set (5 bits) and reacting center (7 bits) information.final double
Gets the actual length of the bond.final MolAtom
getOtherAtom
(MolAtom atom) Gets the other end of the bond.final MoleculeGraph
Gets the parent graph.getProperty
(String key) Returns the property value to which the specified property key is mapped at this bond, or null if this bond has no mapping for this property key.Gets the query properties.final int
Gets the bond set.final int
Gets wedge bond type relative to the specified chiral atom.final int
getType()
Gets the bond type.boolean
Tests whether two bonds have the same properties.final boolean
isBold()
Decides whether this bond is bold or not.boolean
isCollinear
(MolAtom atom) Returns whether atom is collinear with the bond or not.final boolean
Gets the conjugation state of the bond set by the conjugation modul.final boolean
Tests whether the bond is coordinate.final boolean
isHashed()
Decides whether this bond is hashed or not.final boolean
Decides whether this bond is a position variation bond.final boolean
isQuery()
Tests whether it is query bond or has query property: any single or double single or aromatic double or aromatic smarts bond ring or chain topology For more information on smarts bond and query bonds, see The JChem Query Guideprotected boolean
Checks if this bond should override another one when two structures are merged.int
Returns the number of property (property key - property value) mappings of this bond.Returns a set view of the property keys of this bond.Returns a set view of the properties (property key - property value mappings) of this bond.void
putProperty
(String key, Object value) Associates the specified value with the specified key at this bond.removeProperty
(String key) Removes the mapping for this property key from this bond if present.void
setFlags
(int f) Sets bond type (4 bit), stereo (2+2+1 bit), topology (2 bit) bond set (5 bit) and reacting center (7 bits) information.void
setFlags
(int f, int mask) Sets bond type (3 bit), stereo (2+2+1 bit), and topology (2 bit) information.final void
setSetSeq
(int g) Sets the bond set.void
setStereo2Flags
(MolAtom a1, MolAtom a4, int stereo2) Sets double bond stereo information.void
setType
(int t) Sets bond type and does valence checking for the endpoints.boolean
void
swap()
Change orientation.toString()
Overrides Object.toString() to ease debugging.int
transformCT
(MolAtom a1, MolAtom a4, int f) Transform cis/trans stereo information into the `reference frame' of this bond.
-
Field Details
-
CCLENGTH
public static final double CCLENGTHDefault bond length.- See Also:
-
ANY
public static final int ANYAny bond type.- See Also:
-
TYPE_MASK
public static final int TYPE_MASKThe lowest bits of the flags that store the bond type.- See Also:
-
SINGLE
public static final int SINGLESingle bond type.- See Also:
-
DOUBLE
public static final int DOUBLEDouble bond type.- See Also:
-
TRIPLE
public static final int TRIPLETriple bond type.- See Also:
-
AROMATIC
public static final int AROMATICAromatic bond type.- See Also:
-
SINGLE_OR_DOUBLE
public static final int SINGLE_OR_DOUBLESingle or double query bond type.- See Also:
-
SINGLE_OR_AROMATIC
public static final int SINGLE_OR_AROMATICSingle or aromatic query bond type.- See Also:
-
DOUBLE_OR_AROMATIC
public static final int DOUBLE_OR_AROMATICDouble or aromatic query bond type.- See Also:
-
CONJUGATED
public static final int CONJUGATEDConjugation state of the bond.- Since:
- Marvin 4.1, 06/13/2006
- See Also:
-
COORDINATE
public static final int COORDINATECoordinate bond flag.- Since:
- Marvin 5.0, 12/04/2007
- See Also:
-
HYDROGEN
public static final int HYDROGENHydrogen bond type.- Since:
- Marvin 6.2, 15/07/2013
- See Also:
-
UP
public static final int UPSingle bond up flag.- See Also:
-
DOWN
public static final int DOWNSingle bond down flag.- See Also:
-
WAVY
public static final int WAVYSingle bond wavy flag. It equals UP | DOWN.- Since:
- Marvin 4.1
- See Also:
-
STEREO1_MASK
public static final int STEREO1_MASKSingle bond stereo mask. It equals UP | DOWN.- See Also:
-
STEREO2_CARE
public static final int STEREO2_CARECis/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
public static final int STEREO_MASKSingle and double bond stereo mask. It equals STEREO1_MASK | CTUMASK | STEREO2_CARE. -
TOPOLOGY_RING
public static final int TOPOLOGY_RINGBond is in a ring.- See Also:
-
TOPOLOGY_CHAIN
public static final int TOPOLOGY_CHAINBond is in a chain.- See Also:
-
TOPOLOGY_MASK
public static final int TOPOLOGY_MASKBond topology mask. It equals TOPOLOGY_CHAIN | TOPOLOGY_RING- See Also:
-
RC_REACTING_CENTER
public static final int RC_REACTING_CENTERThe bond is a reacting center.- Since:
- Marvin 4.1
- See Also:
-
RC_MAKE_OR_BREAK
public static final int RC_MAKE_OR_BREAKThe bond is made or broken in the reaction.- Since:
- Marvin 4.1
- See Also:
-
RC_CHANGE
public static final int RC_CHANGEThe bond (order) has changed in the reaction.- Since:
- Marvin 4.1
- See Also:
-
RC_MAKE_AND_CHANGE
public static final int RC_MAKE_AND_CHANGEThe bond is created and changed.- Since:
- Marvin 4.1
- See Also:
-
RC_NOT_CENTER
public static final int RC_NOT_CENTERThe bond is not a reacting center. This is an additional ChemDraw feature (value 15 in RXN file).- Since:
- Marvin 4.1
- See Also:
-
RC_NOT_MODIFIED
public static final int RC_NOT_MODIFIEDThe bond is not modified in the reaction.- Since:
- Marvin 4.1
- See Also:
-
RC_UNMAPPED
public static final int RC_UNMAPPEDUnmapped bond in reacting center. This is a ChemDraw feature that is not represented in neither standard nor ChemDraw generated RXN files (likely only in .cdx)- Since:
- Marvin 4.1
- See Also:
-
REACTING_CENTER_MASK
public static final int REACTING_CENTER_MASKMask for reacting center bits.- Since:
- Marvin 4.1
- See Also:
-
SETSEQ_OFF
public static final int SETSEQ_OFFBond set sequence number offset in flags.- Since:
- Marvin 3.3
- See Also:
-
SETSEQ_MAX
public static final int SETSEQ_MAXMaximum bond set sequence number.- Since:
- Marvin 3.3
- See Also:
-
BOLD
public static final int BOLD"Bold" attribute of the bond. Recognized only for single and double bonds- See Also:
-
HASHED
public static final int HASHED"Hashed" attribute of the bond.- See Also:
-
-
Constructor Details
-
MolBond
Construct a bond between two atoms.- Parameters:
a1
- the first atoma2
- the second atombondType
- bond type
-
MolBond
Construct a bond between two atoms.- Parameters:
a1
- the first atoma2
- the second atomf
- bond type and other flags
-
MolBond
Copy constructor.- Parameters:
b
- the original bond- Since:
- 3.5.2, 12/15/2004
-
MolBond
Construct a single bond between two atoms.- Parameters:
a1
- the first atoma2
- the second atom
-
-
Method Details
-
getParent
Gets the parent graph.- Returns:
- the parent graph
-
swap
public void swap()Change orientation. -
getAtom1
Gets the first endpoint.- Returns:
- the first endpoint
-
getAtom2
Gets the second endpoint.- Returns:
- the second endpoint
-
getOtherAtom
Gets the other end of the bond.- Parameters:
atom
- one of the bond endpoints- Returns:
- the other endpoint,
or
null
if the given atom is not an endpoint for this bond - Since:
- Marvin 3.0
-
contains
-
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 (4 bits), stereo (2+2+1 bits), topology (2 bits), bond set (5 bits) and reacting center (7 bits) information.- Returns:
- the flags
- See Also:
-
setFlags
public void setFlags(int f) Sets bond type (4 bit), stereo (2+2+1 bit), topology (2 bit) bond set (5 bit) and reacting center (7 bits) information. Bond type can be set by callingb.setFlags((b.getFlags() & ~MolBond.TYPE_MASK) | type);
setType
.- Parameters:
f
- the flags- Since:
- Marvin 2.5
- See Also:
-
setFlags
public 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 callingb.setFlags(type, MolBond.TYPE_MASK);
setType
.- Parameters:
f
- new value of the specified bitsmask
- bits to set- See Also:
-
getType
public final int getType()Gets the bond type. Possible values: 1 (single), 2 (double), 3 (triple), aromatic, coordinate, conjugated and query bond types.- Returns:
- the bond type
- See Also:
-
getBondType
Gets the type of the bond.- Returns:
- the bond type of the bond
-
setType
public void setType(int t) Sets bond type and does valence checking for the endpoints.- Parameters:
t
- the new bond type- See Also:
-
getSetSeq
public final int getSetSeq()Gets the bond set.- Returns:
- a number between 0 and
SETSEQ_MAX
- Since:
- Marvin 3.3
-
setSetSeq
public final void setSetSeq(int g) Sets the bond set.- Parameters:
g
- a number between 0 andSETSEQ_MAX
- Since:
- Marvin 3.3
-
isConjugated
public final boolean isConjugated()Gets the conjugation state of the bond set by the conjugation modul.- Returns:
true
if the bond is a member of a conjugated system,false
otherwise- Since:
- Marvin 4.1, 06/13/2006
-
isCoordinate
public final boolean isCoordinate()Tests whether the bond is coordinate.- Returns:
true
if it is coordinate bond,false
otherwise- Since:
- Marvin 5.0, 12/04/2007
-
isPositionVariation
public final boolean isPositionVariation()Decides whether this bond is a position variation bond.- Returns:
true
if this is a position variation bond,false
otherwise- Since:
- Marvin 5.3, 01/05/2010
-
isBold
public final boolean isBold()Decides whether this bond is bold or not.- Returns:
true
if this bond is bold,false
otherwise- Since:
- Marvin 5.3, 09/24/2009
- See Also:
-
isHashed
public final boolean isHashed()Decides whether this bond is hashed or not.- Returns:
true
if this bond is hashed,false
otherwise- Since:
- Marvin 5.7
- See Also:
-
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
-
cloneBond
Clones this bond. The parent molecule and the end atoms are not cloned.- Parameters:
a1
- new end atom 1a2
- new end atom 2- Returns:
- the clone
- Since:
- Marvin 4.1, 09/22/2005
-
clone
Make a copy of this object. These are not cloned:- End Atoms;
- Parent molecule;
- MDocument: Although the bondset information is cloned, when the cloned bond is taken to another MDocument, the format (color, font type) will be lost.
-
getDesiredLength
Deprecated, for removal: This API element is subject to removal in a future version.since 5.11, replaced bydesiredLength(int, int, int, int)
.Desired length of a bond between two atoms in Angstroms. Works only for bonds in a molecule.- Returns:
- the desired length
-
getDesiredLength
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public double getDesiredLength(boolean shortenHbonds) Deprecated, for removal: This API element is subject to removal in a future version.since 5.11, replaced bydesiredLength(int, int, int, int)
.Desired length of a bond between two atoms in Angstroms. Works only for bonds in a molecule.- Parameters:
shortenHbonds
- use 1.0 as bond length for explicit H bonds in 2D.- Returns:
- the desired length
-
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 atomatno2
- atomic number of the second atomtype
- bond orderdim
- space dimension, 2 or 3- Returns:
- the desired length
-
getStereo1
Gets wedge bond type relative to the specified chiral atom.- Parameters:
o
- the chiral atom- Returns:
- the wedge bond type or zero
- See Also:
-
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:
-
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:
-
setStereo2Flags
Sets double bond stereo information. Normally invoked by the SMILES import process.- Parameters:
a1
- atom number 1 in scheme a1-a2=a3-a4a4
- atom number 4stereo2
- CIS/TRANS information- See Also:
-
transformCT
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 atom1a4
- atom connected to atom2f
- 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 CIS|TRANS
- See Also:
-
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 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-a4atom4
- atom number 4- Returns:
- 0, CIS, TRANS, or CIS|TRANS
- See Also:
-
calcStereo2
Computes the stereochemistry of the atom sequence (scheme a1-a2=a3-a4) based on the atomic coordinates. Note that this member function does not change any stereo flags. Connectivity are not checked.- Parameters:
atom1
- atom number 1 in scheme a1-a2=a3-a4atom2
- atom number 2 in scheme a1-a2=a3-a4atom3
- atom number 3 in scheme a1-a2=a3-a4atom4
- atom number 4 in scheme a1-a2=a3-a4- Returns:
- 0, CIS, TRANS, or CIS|TRANS
- See Also:
-
stepWedge
public boolean stepWedge() -
getQuerystr
Gets the query properties.- Returns:
- the query string
- Since:
- Marvin 3.4
-
haveEqualProperties
Tests whether two bonds have the same properties. Two bonds have equal properties if their flags are equal.- Returns:
true
if they have the same properties,false
otherwise- Since:
- Marvin 3.4.1, 07/06/2004
-
overridesAtMerge
Checks if this bond should override another one when two structures are merged. Aromatic bonds override non-aromatic bonds, higher order bonds override lower order bonds.- Parameters:
e
- the other bond- Returns:
true
if it overrides e,false
otherwise- Since:
- Marvin 3.5, 09/30/2004
-
isQuery
public final boolean isQuery()Tests whether it is query bond or has query property:- any
- single or double
- single or aromatic
- double or aromatic
- smarts bond
- ring or chain topology
- Returns:
true
if the bond has a query bond type or property,false
otherwise- Since:
- Marvin 3.4
- See Also:
-
isCollinear
Returns whether atom is collinear with the bond or not. (Calculates from coordinates.)- Parameters:
atom
- Atom to decide about.- Returns:
true
ifatom
and the atoms of the bond lie on the same line- Since:
- Marvin 4.0 12/16/2004
-
toString
Overrides Object.toString() to ease debugging. -
propertySet
Returns a set view of the properties (property key - property value mappings) of this bond. Each element in the returned set is a Map.Entry. Changes to the properties are reflected in the set, and vice-versa. The set supports element removal, which removes the corresponding property from this, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.- Returns:
- set view of the properties of this bond.
- Since:
- Marvin 5.10
-
propertyKeySet
Returns a set view of the property keys of this bond. Changes to the properties of this bond are reflected in the set, and vice-versa. The set supports element removal, which removes the corresponding property from this atom, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.- Returns:
- set view of the property keys of this bond.
- Since:
- Marvin 5.10
-
containsPropertyKey
Returns true if this bond has a mapping for the specified property key.- Parameters:
key
- the property key which is to be searched for.- Returns:
- true if this map contains a mapping for the specified property key.
- Since:
- Marvin 5.10
-
removeProperty
Removes the mapping for this property key from this bond if present.- Parameters:
key
- property key whose mapping is to be removed from the bond.- Returns:
- previous poperty value associated with specified property key, or null if there was no mapping for property key. A null return can also indicate that the property mapping previously associated null with the specified property key.
- Since:
- Marvin 5.10
-
propertyCount
public int propertyCount()Returns the number of property (property key - property value) mappings of this bond.- Returns:
- the number of property mappings of this bond.
- Since:
- Marvin 5.10
-
getProperty
Returns the property value to which the specified property key is mapped at this bond, or null if this bond has no mapping for this property key. A return value of null does not necessarily indicate that the bond has no mapping for the property key; it is also possible that the bond explicitly maps the property key to null. The containsKey method may be used to distinguish these two cases.- Parameters:
key
- the property key whose associated property value is to be returned.- Returns:
- the property value to which this bond maps the specified property key, or null if the bond has no mapping for this property key.
- Since:
- Marvin 5.10
-
putProperty
Associates the specified value with the specified key at this bond. If this bond previously had a mapping for this property key, the old property value is replaced.- Parameters:
key
- property key with which the specified value is to be associated.value
- property value to be associated with the specified property key.- Since:
- Marvin 5.10
-
clearProperties
public void clearProperties()Removes all properties from this bond.- Since:
- Marvin 5.10
-
desiredLength(int, int, int, int)
.