public class Atom extends AtomType implements IAtom, Serializable, Cloneable
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.
XMLIsotopeFactory.getInstance(org.openscience.cdk.interfaces.IChemObjectBuilder),
Serialized FormIAtomType.Hybridization| Modifier and Type | Field and Description |
|---|---|
protected Double |
charge
The partial charge of the atom.
|
protected javax.vecmath.Point3d |
fractionalPoint3d
A 3 point specifying the location of this atom in a crystal unit cell.
|
protected Integer |
hydrogenCount
The number of implicitly bound hydrogen atoms for this atom.
|
protected javax.vecmath.Point2d |
point2d
A 2D point specifying the location of this atom in a 2D coordinate
space.
|
protected javax.vecmath.Point3d |
point3d
A 3 point specifying the location of this atom in a 3D coordinate
space.
|
protected Integer |
stereoParity
A stereo parity descriptor for the stereochemistry of this atom.
|
electronValency, formalCharge, formalNeighbourCount, hybridizationexactMass, naturalAbundanceatomicNumberAc, 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, Zr| Constructor and Description |
|---|
Atom()
Constructs an completely unset Atom.
|
Atom(IElement element)
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.
|
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.
|
Atom(String symbol)
Constructs an Atom from a string containing an element symbol and optionally
the atomic mass, hydrogen count, and formal charge.
|
Atom(String elementSymbol,
javax.vecmath.Point2d point2d)
Constructs an Atom from an Element and a Point2d.
|
Atom(String elementSymbol,
javax.vecmath.Point3d point3d)
Constructs an Atom from an Element and a Point3d.
|
| Modifier and Type | Method and Description |
|---|---|
Iterable<IBond> |
bonds()
Returns the bonds connected to this atom.
|
IAtom |
clone()
Clones this atom object and its content.
|
boolean |
compare(Object object)
Compares a atom with this atom.
|
boolean |
equals(Object obj) |
IBond |
getBond(IAtom atom)
Returns the bond connecting 'this' atom to the provided atom.
|
int |
getBondCount()
Get the number of explicit bonds connected to this atom.
|
Double |
getCharge()
Returns the partial charge of this atom.
|
IAtomContainer |
getContainer()
Access the
IAtomContainer of which this atom is a member of. |
javax.vecmath.Point3d |
getFractionalPoint3d()
Returns a point specifying the location of this
atom in a Crystal unit cell.
|
Integer |
getImplicitHydrogenCount()
Returns the hydrogen count of this atom.
|
int |
getIndex()
Acces the index of an atom in the context of an
IAtomContainer. |
int |
getMapIdx()
Access the map index for this atom.
|
javax.vecmath.Point2d |
getPoint2d()
Returns a point specifying the location of this
atom in a 2D space.
|
javax.vecmath.Point3d |
getPoint3d()
Returns a point specifying the location of this
atom in a 3D space.
|
Integer |
getStereoParity()
Returns the stereo parity of this atom.
|
int |
hashCode() |
boolean |
isAromatic()
Access whether this atom has been marked as aromatic.
|
boolean |
isInRing()
Access whether this atom has been flagged as in a ring.
|
void |
setCharge(Double charge)
Sets the partial charge of this atom.
|
void |
setFractionalPoint3d(javax.vecmath.Point3d point3d)
Sets a point specifying the location of this
atom in a Crystal unit cell.
|
void |
setImplicitHydrogenCount(Integer hydrogenCount)
Sets the number of implicit hydrogen count of this atom.
|
void |
setIsAromatic(boolean arom)
Mark this atom as being aromatic.
|
void |
setIsInRing(boolean ring)
Mark this atom as being in a ring.
|
void |
setMapIdx(int mapidx)
Set the map index for this atom.
|
void |
setPoint2d(javax.vecmath.Point2d point2d)
Sets a point specifying the location of this
atom in a 2D space.
|
void |
setPoint3d(javax.vecmath.Point3d point3d)
Sets a point specifying the location of this
atom in 3D space.
|
void |
setStereoParity(Integer stereoParity)
Sets the stereo parity for this atom.
|
String |
toString()
Returns a one line string representation of this Atom.
|
getAtomTypeName, getBondOrderSum, getCovalentRadius, getFormalCharge, getFormalNeighbourCount, getHybridization, getMaxBondOrder, getValency, setAtomTypeName, setBondOrderSum, setCovalentRadius, setFormalCharge, setFormalNeighbourCount, setHybridization, setMaxBondOrder, setValencygetExactMass, getMassNumber, getNaturalAbundance, setExactMass, setMassNumber, setNaturalAbundancegetAtomicNumber, getSymbol, setAtomicNumber, setSymboladdListener, addProperties, getBuilder, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, notifyChanged, notifyChanged, removeListener, removeProperty, setFlag, setFlags, setID, setNotification, setProperties, setProperty, shallowCopyfinalize, getClass, notify, notifyAll, wait, wait, waitgetAtomTypeName, getBondOrderSum, getCovalentRadius, getFormalCharge, getFormalNeighbourCount, getHybridization, getMaxBondOrder, getValency, setAtomTypeName, setBondOrderSum, setCovalentRadius, setFormalCharge, setFormalNeighbourCount, setHybridization, setMaxBondOrder, setValencygetExactMass, getMassNumber, getNaturalAbundance, setExactMass, setMassNumber, setNaturalAbundancegetAtomicNumber, getSymbol, setAtomicNumber, setSymboladdListener, addProperties, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, notifyChanged, notifyChanged, removeListener, removeProperty, setFlag, setFlags, setID, setNotification, setProperties, setPropertygetBuilderprotected javax.vecmath.Point2d point2d
protected javax.vecmath.Point3d point3d
protected javax.vecmath.Point3d fractionalPoint3d
protected Integer hydrogenCount
protected Integer stereoParity
protected Double charge
CDKConstants.UNSET and serves to provide a check whether the charge has been
set or notpublic Atom()
public Atom(int elem)
elem - atomic numberpublic Atom(int elem,
int hcnt)
elem - atomic numberhcnt - hydrogen countpublic Atom(int elem,
int hcnt,
int fchg)
elem - atomic numberhcnt - hydrogen countfchg - formal chargepublic Atom(String symbol)
new Atom("NH+"); // nitrogen cation with one hydrogen
new Atom("OH"); // hydroxy
new Atom("O-"); // oxygen anion
new Atom("13CH3"); // methyl isotope 13
atom := {mass}? {symbol} {hcnt}? {fchg}?
mass := \d+
hcnt := 'H' \d+
fchg := '+' \d+? | '-' \d+?
symbol - string with the element symbolpublic Atom(String elementSymbol, javax.vecmath.Point3d point3d)
elementSymbol - The symbol of the atompoint3d - The 3D coordinates of the atompublic Atom(String elementSymbol, javax.vecmath.Point2d point2d)
elementSymbol - The Elementpoint2d - The Pointpublic Atom(IElement element)
element - IAtomType to copy information frompublic IAtomContainer getContainer()
IAtomContainer of 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 an IAtomContainer, 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'
getContainer in interface IAtompublic int getIndex()
IAtomContainer. If the
index is not known, < 0 is returned.public int getBondCount()
getBondCount in interface IAtompublic Iterable<IBond> bonds()
IAtom.getIndex() returns < 0 or IAtom.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()) {
}
public IBond getBond(IAtom atom)
public void setCharge(Double charge)
setCharge in interface IAtomcharge - The partial chargegetCharge()public Double getCharge()
getCharge in interface IAtomsetCharge(java.lang.Double)public void setImplicitHydrogenCount(Integer hydrogenCount)
setImplicitHydrogenCount in interface IAtomhydrogenCount - The number of hydrogen atoms bonded to this atom.getImplicitHydrogenCount()public Integer getImplicitHydrogenCount()
getImplicitHydrogenCount in interface IAtomsetImplicitHydrogenCount(java.lang.Integer)public void setPoint2d(javax.vecmath.Point2d point2d)
setPoint2d in interface IAtompoint2d - A point in a 2D planegetPoint2d()public void setPoint3d(javax.vecmath.Point3d point3d)
setPoint3d in interface IAtompoint3d - A point in a 3-dimensional spacegetPoint3d()public void setFractionalPoint3d(javax.vecmath.Point3d point3d)
setFractionalPoint3d in interface IAtompoint3d - A point in a 3d fractional unit cell spacegetFractionalPoint3d(),
Crystalpublic void setStereoParity(Integer stereoParity)
setStereoParity in interface IAtomstereoParity - The stereo parity for this atomfor predefined values.,
getStereoParity()public javax.vecmath.Point2d getPoint2d()
getPoint2d in interface IAtomsetPoint2d(javax.vecmath.Point2d)public javax.vecmath.Point3d getPoint3d()
getPoint3d in interface IAtomsetPoint3d(javax.vecmath.Point3d)public javax.vecmath.Point3d getFractionalPoint3d()
getFractionalPoint3d in interface IAtomsetFractionalPoint3d(javax.vecmath.Point3d),
for predefined values.public Integer getStereoParity()
getStereoParity in interface IAtomCDKConstants,
setStereoParity(java.lang.Integer)public boolean compare(Object object)
public boolean isAromatic()
isAromatic in interface IAtomIChemObject.getFlag(int),
Aromaticitypublic void setIsAromatic(boolean arom)
setIsAromatic in interface IAtomarom - aromatic statusIChemObject.setFlag(int, boolean)public boolean isInRing()
isInRing in interface IAtomIChemObject.getFlag(int),
RingSearchpublic void setIsInRing(boolean ring)
setIsInRing in interface IAtomring - ring statusIChemObject.setFlag(int, boolean)public String toString()
toString in interface IChemObjecttoString in class AtomTypepublic int getMapIdx()
IAtompublic void setMapIdx(int mapidx)
IAtompublic IAtom clone() throws CloneNotSupportedException
clone in interface IAtomclone in interface IChemObjectclone in class AtomTypeCloneNotSupportedException - if the IChemObject cannot be clonedCopyright © 2021. All rights reserved.