Class Atom
java.lang.Object
org.openscience.cdk.ChemObject
org.openscience.cdk.Element
org.openscience.cdk.Isotope
org.openscience.cdk.AtomType
org.openscience.cdk.Atom
- All Implemented Interfaces:
Serializable, Cloneable, IAtom, IAtomType, ICDKObject, IChemObject, IElement, IIsotope
- Direct Known Subclasses:
DebugAtom, PDBAtom, PharmacophoreAtom, PharmacophoreQueryAtom, PseudoAtom
Represents the idea of an chemical atom.
An Atom class is instantiated with at least the atom symbol:
Atom a = new Atom("C");
Once instantiated all field not filled by passing parameters to the constructor are null. Atoms can be configured by using the IsotopeFactory.configure() method:
IsotopeFactory if = IsotopeFactory.getInstance(a.getNewBuilder()); if.configure(a);
More examples about using this class can be found in the Junit test for this class.
- Author:
- steinbeck
- See Also:
- Keywords:
- atom
- Created on:
- 2000-10-02
-
Nested Class Summary
Nested classes/interfaces inherited from interface IAtomType
IAtomType.HybridizationModifier and TypeInterfaceDescriptionstatic enumAn enum for the different hybridization states. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DoubleThe partial charge of the atom.protected javax.vecmath.Point3dA 3 point specifying the location of this atom in a crystal unit cell.protected IntegerThe number of implicitly bound hydrogen atoms for this atom.protected javax.vecmath.Point2dA 2D point specifying the location of this atom in a 2D coordinate space.protected javax.vecmath.Point3dA 3 point specifying the location of this atom in a 3D coordinate space.protected IntegerA stereo parity descriptor for the stereochemistry of this atom.Fields inherited from class AtomType
electronValency, formalCharge, formalNeighbourCount, hybridizationModifier and TypeFieldDescriptionprotected IntegerThe electron Valency of this atom with CDKConstants.UNSET as default.protected IntegerThe formal charge of the atom with CDKConstants.UNSET as default.protected IntegerThe formal number of neighbours this atom type can have with CDKConstants_UNSET as default.protected IAtomType.HybridizationThe hybridization state of this atom with CDKConstants.HYBRIDIZATION_UNSET as default.Fields inherited from class Isotope
exactMass, naturalAbundanceModifier and TypeFieldDescriptionExact mass of this isotope.Natural abundance of this isotope.Fields inherited from class Element
atomicNumberModifier and TypeFieldDescriptionprotected IntegerThe atomic number for this element giving their position in the periodic table.Fields inherited from interface IChemObject
ALIPHATIC, AROMATIC, CONJUGATED, HIDDEN, HYDROGEN_BOND_ACCEPTOR, HYDROGEN_BOND_DONOR, IN_RING, MAPPED, MARKUSH, NOT_IN_RING, PLACED, REACTIVE_CENTER, SINGLE_OR_DOUBLE, TYPEABLE, VISITEDModifier and TypeFieldDescriptionstatic final intFlag that is set if a ChemObject is part of an aliphatic chain.static final intFlag is set if ChemObject is part of an aromatic system.static final intFlag is set if ChemObject is part of a conjugated system.static final intThis flag can be used when depicted structures to hide certain parts, for example the things are abbreviated (display shortcuts).static final intSets to true if the atom is a hydrogen bond acceptor.static final intSets to true if the atom is a hydrogen bond donor.static final intFlag that is set when the ChemObject is part of a ring.static final intFlag is set if a ChemObject is mapped to another ChemObject.static final intFlag to indicate a flattened molecule holds a Markush structure, you can work on it as is or it might make more sense to repack into something sensible like a RGroupQuery.static final intFlag that is set when the ChemObject is part of a ring.static final intFlag that is set if the ChemObject is placed when calculating 2D/3D layouts.static final intFlag is set if a ChemObject has reactive center.static final intFlag used for marking uncertainty of the bond order.static final intFlag is set if an atom could be typed.static final intFlag is set if ChemObject has been visited.Fields inherited from interface IElement
Ac, Ag, Al, Am, Ar, As, At, Au, B, Ba, Be, Bh, Bi, Bk, Br, C, Ca, Cd, Ce, Cf, Cl, Cm, Cn, Co, Cr, Cs, Cu, Db, Ds, Dy, Er, Es, Eu, F, Fe, Fl, Fm, Fr, Ga, Gd, Ge, H, He, Hf, Hg, Ho, Hs, I, In, Ir, K, Kr, La, Li, Lr, Lu, Lv, Mc, Md, Mg, Mn, Mo, Mt, N, Na, Nb, Nd, Ne, Nh, Ni, No, Np, O, Og, Os, P, Pa, Pb, Pd, Pm, Po, Pr, Pt, Pu, Ra, Rb, Re, Rf, Rg, Rh, Rn, Ru, S, Sb, Sc, Se, Sg, Si, Sm, Sn, Sr, Ta, Tb, Tc, Te, Th, Ti, Tl, Tm, Ts, U, V, W, Wildcard, Xe, Y, Yb, Zn, ZrModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intCarbon atomic numberstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intHydrogen atomic numberstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intNitrogen atomic numberstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intOxygen atomic numberstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intWildcard atom is atomic number 0static final intstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionAtom()Constructs an completely unset Atom.Atom(int elem) Create a new atom with of the specified element.Atom(int elem, int hcnt) Create a new atom with of the specified element and hydrogen count.Atom(int elem, int hcnt, int fchg) Create a new atom with of the specified element, hydrogen count, and formal charge.Constructs an Atom from a string containing an element symbol and optionally the atomic mass, hydrogen count, and formal charge.Constructs an Atom from an Element and a Point2d.Constructs an Atom from an Element and a Point3d.Constructs an isotope by copying the symbol, atomic number, flags, identifier, exact mass, natural abundance, mass number, maximum bond order, bond order sum, van der Waals and covalent radii, formal charge, hybridization, electron valency, formal neighbour count and atom type name from the given IAtomType.Constructs an isotope by copying the symbol, atomic number, flags, identifier, exact mass, natural abundance, mass number, maximum bond order, bond order sum, van der Waals and covalent radii, formal charge, hybridization, electron valency, formal neighbour count and atom type name from the given IAtomType. -
Method Summary
Modifier and TypeMethodDescriptionbonds()Returns the bonds connected to this atom.clone()Clones this atom object and its content.booleanCompares a atom with this atom.booleanReturns the bond connecting 'this' atom to the provided atom.intGet the number of explicit bonds connected to this atom.Returns the partial charge of this atom.Access theIAtomContainerof which this atom is a member of.javax.vecmath.Point3dReturns a point specifying the location of this atom in a Crystal unit cell.Returns the hydrogen count of this atom.intgetIndex()Acces the index of an atom in the context of anIAtomContainer.intAccess the map index for this atom.javax.vecmath.Point2dReturns a point specifying the location of this atom in a 2D space.javax.vecmath.Point3dReturns a point specifying the location of this atom in a 3D space.Returns the stereo parity of this atom.inthashCode()voidSets the partial charge of this atom.voidsetFractionalPoint3d(javax.vecmath.Point3d point3d) Sets a point specifying the location of this atom in a Crystal unit cell.voidsetImplicitHydrogenCount(Integer hydrogenCount) Sets the number of implicit hydrogen count of this atom.voidsetMapIdx(int mapidx) Set the map index for this atom.voidsetPoint2d(javax.vecmath.Point2d point2d) Sets a point specifying the location of this atom in a 2D space.voidsetPoint3d(javax.vecmath.Point3d point3d) Sets a point specifying the location of this atom in 3D space.voidsetStereoParity(Integer stereoParity) Sets the stereo parity for this atom.toString()Returns a one line string representation of this Atom.Methods inherited from class AtomType
getAtomTypeName, getBondOrderSum, getCovalentRadius, getFormalCharge, getFormalNeighbourCount, getHybridization, getMaxBondOrder, getValency, setAtomTypeName, setBondOrderSum, setCovalentRadius, setFormalCharge, setFormalNeighbourCount, setHybridization, setMaxBondOrder, setValencyModifier and TypeMethodDescriptionGets the id attribute of the AtomType object.Gets the bondOrderSum attribute of the AtomType object.Returns the covalent radius for this AtomType.Returns the formal charge of this atom.Returns the formal neighbour count of this atom.Returns the hybridization of this atom.Gets the MaxBondOrder attribute of the AtomType object.Gets the the exact electron valency of the AtomType object.voidsetAtomTypeName(String identifier) Sets the if attribute of the AtomType object.voidsetBondOrderSum(Double bondOrderSum) Sets the the exact bond order sum attribute of the AtomType object.voidsetCovalentRadius(Double radius) Sets the covalent radius for this AtomType.voidsetFormalCharge(Integer charge) Sets the formal charge of this atom.voidsetFormalNeighbourCount(Integer count) Sets the formal neighbour count of this atom.voidsetHybridization(IAtomType.Hybridization hybridization) Sets the hybridization of this atom.voidsetMaxBondOrder(IBond.Order maxBondOrder) Sets the MaxBondOrder attribute of the AtomType object.voidsetValency(Integer valency) Sets the the exact electron valency of the AtomType object.Methods inherited from class Isotope
getExactMass, getMassNumber, getNaturalAbundance, setExactMass, setMassNumber, setNaturalAbundanceModifier and TypeMethodDescriptionGets the ExactMass attribute of the Isotope object.Returns the atomic mass of this element.Gets the NaturalAbundance attribute of the Isotope object.voidsetExactMass(Double exactMass) Sets the ExactMass attribute of the Isotope object.voidsetMassNumber(Integer massNumber) Sets the atomic mass of this element.voidsetNaturalAbundance(Double naturalAbundance) Sets the NaturalAbundance attribute of the Isotope object.Methods inherited from class Element
getAtomicNumber, getSymbol, setAtomicNumber, setSymbolModifier and TypeMethodDescriptionReturns the atomic number of this element.Returns the element symbol of this element.voidsetAtomicNumber(Integer atomicNumber) Sets the atomic number of this element.voidSets the element symbol of this element.Methods inherited from class ChemObject
addListener, addProperties, clear, flags, getBuilder, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, is, notifyChanged, notifyChanged, removeListener, removeProperty, set, setFlag, setFlags, setID, setNotification, setProperties, setProperty, shallowCopyModifier and TypeMethodDescriptionvoidUse this to add yourself to this IChemObject as a listener.voidaddProperties(Map<Object, Object> properties) Sets the properties of this object.voidclear(int flags) Clear the provided flags.intflags()Access the current value of the flags for this ChemObject.Returns aIChemObjectBuilderfor the data classes that extend this class.booleangetFlag(int mask) Returns the value of a given flag.boolean[]getFlags()Returns the whole set of flags.Access the internal value used to store the flags.getID()Returns the identifier (ID) of this object.intReturns the number of ChemObjectListeners registered with this object.booleanReturns the flag that indicates whether notification messages are sent around.Returns a Map with the IChemObject's properties.<T> TgetProperty(Object description) Returns a property for the IChemObject.<T> TgetProperty(Object description, Class<T> c) Access a property of the given description and cast the specified class.booleanis(int flags) Test if a flag(s) are set on this ChemObject.voidThis should be triggered by an method that changes the content of an object to that the registered listeners can react to it.voidThis should be triggered by an method that changes the content of an object to that the registered listeners can react to it.voidUse this to remove a ChemObjectListener from the ListenerList of this IChemObject.voidremoveProperty(Object description) Removes a property for a IChemObject.voidset(int flags) Set the provided flags.voidsetFlag(int mask, boolean value) Sets the value of some flag.voidsetFlags(boolean[] flagsNew) Sets the whole set of flags.voidSets the identifier (ID) of this object.voidsetNotification(boolean bool) Set a flag to use or not use notification.voidsetProperties(Map<Object, Object> properties) Set the properties of this object to the provided map (shallow copy).voidsetProperty(Object description, Object property) Sets a property for a IChemObject.Clones thisIChemObject, but preserves references toObjects.Methods inherited from interface IAtom
getTotalHydrogenCount, isAromatic, isInRing, neighbors, setIsAromatic, setIsInRingModifier and TypeMethodDescriptiondefault IntegerCalculates the total number of hydrogens connected to this atom.default booleanAccess whether this atom has been marked as aromatic.default booleanisInRing()Access whether this atom has been flagged as in a ring.Iterable over the atoms connected to this atom (the neighbors).default voidsetIsAromatic(boolean arom) Mark this atom as being aromatic.default voidsetIsInRing(boolean ring) Mark this atom as being in a ring.
-
Field Details
-
point2d
protected javax.vecmath.Point2d point2dA 2D point specifying the location of this atom in a 2D coordinate space. -
point3d
protected javax.vecmath.Point3d point3dA 3 point specifying the location of this atom in a 3D coordinate space. -
fractionalPoint3d
protected javax.vecmath.Point3d fractionalPoint3dA 3 point specifying the location of this atom in a crystal unit cell. -
hydrogenCount
The number of implicitly bound hydrogen atoms for this atom. -
stereoParity
A stereo parity descriptor for the stereochemistry of this atom. -
charge
The partial charge of the atom. The default value isCDKConstants.UNSETand serves to provide a check whether the charge has been set or not
-
-
Constructor Details
-
Atom
public Atom()Constructs an completely unset Atom. -
Atom
public Atom(int elem) Create a new atom with of the specified element.- Parameters:
elem- atomic number
-
Atom
public Atom(int elem, int hcnt) Create a new atom with of the specified element and hydrogen count.- Parameters:
elem- atomic numberhcnt- hydrogen count
-
Atom
public Atom(int elem, int hcnt, int fchg) Create a new atom with of the specified element, hydrogen count, and formal charge.- Parameters:
elem- atomic numberhcnt- hydrogen countfchg- formal charge
-
Atom
Constructs an Atom from a string containing an element symbol and optionally the atomic mass, hydrogen count, and formal charge. The symbol grammar allows easy construction from common symbols, for example:new Atom("NH+"); // nitrogen cation with one hydrogen new Atom("OH"); // hydroxy new Atom("O-"); // oxygen anion new Atom("13CH3"); // methyl isotope 13atom := {mass}? {symbol} {hcnt}? {fchg}? mass := \d+ hcnt := 'H' \d+ fchg := '+' \d+? | '-' \d+?- Parameters:
symbol- string with the element symbol
-
Atom
Constructs an Atom from an Element and a Point3d.- Parameters:
elementSymbol- The symbol of the atompoint3d- The 3D coordinates of the atom
-
Atom
Constructs an Atom from an Element and a Point2d.- Parameters:
elementSymbol- The Elementpoint2d- The Point
-
Atom
Constructs an isotope by copying the symbol, atomic number, flags, identifier, exact mass, natural abundance, mass number, maximum bond order, bond order sum, van der Waals and covalent radii, formal charge, hybridization, electron valency, formal neighbour count and atom type name from the given IAtomType. It does not copy the listeners and properties. If the element is an instance of IAtom, then the 2D, 3D and fractional coordinates, partial atomic charge, hydrogen count and stereo parity are copied too.- Parameters:
element- IAtomType to copy information from
-
Atom
Constructs an isotope by copying the symbol, atomic number, flags, identifier, exact mass, natural abundance, mass number, maximum bond order, bond order sum, van der Waals and covalent radii, formal charge, hybridization, electron valency, formal neighbour count and atom type name from the given IAtomType. It does not copy the listeners and properties. If the element is an instance of IAtom, then the 2D, 3D and fractional coordinates, partial atomic charge, hydrogen count and stereo parity are copied too.- Parameters:
org- IAtomType to copy information from
-
-
Method Details
-
getContainer
Access theIAtomContainerof which this atom is a member of. Because atoms can be in multiple molecules this method will only work if the atom has been accessed in the context of anIAtomContainer, for example:IAtomContainer mol = new AtomContainer(); IAtom atom = new Atom(6); atom.getContainer(); // null mol.add(atom); atom.getContainer(); // still null mol.getAtom(0).getContainer(); // not-null, returns 'mol'- Specified by:
getContainerin interfaceIAtom- Returns:
- the atom container or null if not accessed in the context of a container
-
getIndex
public int getIndex()Acces the index of an atom in the context of anIAtomContainer. If the index is not known, < 0 is returned. -
bonds
Returns the bonds connected to this atom. If the bonds are not known an exception is thrown. This method will only throw an exception ifIAtom.getIndex()returns < 0 orIAtom.getContainer()returns null.IAtom atom = ...; if (atom.getIndex() >= 0) { for (IBond bond : atom.bonds()) { } } if (atom.getContainer() != null) { for (IBond bond : atom.bonds()) { } } IAtomContainer mol = ...; // guaranteed not throw an exception for (IBond bond : mol.getAtom(i).bonds()) { } -
getBondCount
public int getBondCount()Get the number of explicit bonds connected to this atom.- Specified by:
getBondCountin interfaceIAtom- Returns:
- the total bond count
-
getBond
-
setCharge
-
getCharge
-
setImplicitHydrogenCount
Sets the number of implicit hydrogen count of this atom.- Specified by:
setImplicitHydrogenCountin interfaceIAtom- Parameters:
hydrogenCount- The number of hydrogen atoms bonded to this atom.- See Also:
-
getImplicitHydrogenCount
Returns the hydrogen count of this atom.- Specified by:
getImplicitHydrogenCountin interfaceIAtom- Returns:
- The hydrogen count of this atom.
- See Also:
-
setPoint2d
public void setPoint2d(javax.vecmath.Point2d point2d) Sets a point specifying the location of this atom in a 2D space.- Specified by:
setPoint2din interfaceIAtom- Parameters:
point2d- A point in a 2D plane- See Also:
-
setPoint3d
public void setPoint3d(javax.vecmath.Point3d point3d) Sets a point specifying the location of this atom in 3D space.- Specified by:
setPoint3din interfaceIAtom- Parameters:
point3d- A point in a 3-dimensional space- See Also:
-
setFractionalPoint3d
public void setFractionalPoint3d(javax.vecmath.Point3d point3d) Sets a point specifying the location of this atom in a Crystal unit cell.- Specified by:
setFractionalPoint3din interfaceIAtom- Parameters:
point3d- A point in a 3d fractional unit cell space- See Also:
-
setStereoParity
Sets the stereo parity for this atom.- Specified by:
setStereoParityin interfaceIAtom- Parameters:
stereoParity- The stereo parity for this atom- See Also:
-
getPoint2d
public javax.vecmath.Point2d getPoint2d()Returns a point specifying the location of this atom in a 2D space.- Specified by:
getPoint2din interfaceIAtom- Returns:
- A point in a 2D plane. Null if unset.
- See Also:
-
getPoint3d
public javax.vecmath.Point3d getPoint3d()Returns a point specifying the location of this atom in a 3D space.- Specified by:
getPoint3din interfaceIAtom- Returns:
- A point in 3-dimensional space. Null if unset.
- See Also:
-
getFractionalPoint3d
public javax.vecmath.Point3d getFractionalPoint3d()Returns a point specifying the location of this atom in a Crystal unit cell.- Specified by:
getFractionalPoint3din interfaceIAtom- Returns:
- A point in 3d fractional unit cell space. Null if unset.
- See Also:
-
getStereoParity
Returns the stereo parity of this atom. It uses the predefined values found in CDKConstants.- Specified by:
getStereoParityin interfaceIAtom- Returns:
- The stereo parity for this atom
- See Also:
-
compare
-
getMapIdx
-
setMapIdx
-
toString
Returns a one line string representation of this Atom. Methods is conform RFC #9.- Specified by:
toStringin interfaceIChemObject- Overrides:
toStringin classAtomType- Returns:
- The string representation of this Atom
-
clone
Clones this atom object and its content.- Specified by:
clonein interfaceIAtom- Specified by:
clonein interfaceIChemObject- Overrides:
clonein classAtomType- Returns:
- The cloned object
- Throws:
CloneNotSupportedException- if the IChemObject cannot be cloned
-
hashCode
-
equals
-