org.openscience.cdk.interfaces
Interface IAtomContainer

All Superinterfaces:
Cloneable, ICDKObject, IChemObject, IChemObjectListener
All Known Subinterfaces:
IAminoAcid, IBioPolymer, ICrystal, IMonomer, IPDBMonomer, IPDBPolymer, IPolymer, IQueryAtomContainer, IRing, IStrand
All Known Implementing Classes:
AminoAcid, AminoAcid, AtomContainer, AtomContainer, BioPolymer, BioPolymer, ChargeGroup, Crystal, Crystal, DebugAminoAcid, DebugAtomContainer, DebugBioPolymer, DebugCrystal, DebugMonomer, DebugPDBMonomer, DebugPDBPolymer, DebugPolymer, DebugRing, DebugStrand, MDMolecule, Monomer, Monomer, PDBMonomer, PDBMonomer, PDBPolymer, PDBPolymer, PDBStrand, PharmacophoreQuery, Polymer, Polymer, QueryAtomContainer, Residue, Ring, Ring, Strand, Strand

public interface IAtomContainer
extends IChemObject, IChemObjectListener

Base class for all chemical objects that maintain a list of Atoms and ElectronContainers.

Looping over all IBonds in the IAtomContainer is typically done like:

  for (IBond bond : atomContainer.bonds()) {
    // do something
  }
  
If you do need an explicit Iterator then use
 Iterator bondIter = atomContainer.bonds().iterator();
 

Author:
steinbeck
Created on:
2000-10-02
Belongs to CDK module:
interfaces
Source code:
cdk-1.4.x

Method Summary
 void add(IAtomContainer atomContainer)
          Adds all atoms and electronContainers of a given atomcontainer to this container.
 void addAtom(IAtom atom)
          Adds an atom to this container.
 void addBond(IBond bond)
          Adds a Bond to this AtomContainer.
 void addBond(int atom1, int atom2, IBond.Order order)
          Adds a bond to this container.
 void addBond(int atom1, int atom2, IBond.Order order, IBond.Stereo stereo)
          Adds a bond to this container.
 void addElectronContainer(IElectronContainer electronContainer)
          Adds a ElectronContainer to this AtomContainer.
 void addLonePair(ILonePair lonePair)
          Adds a lone pair to this AtomContainer.
 void addLonePair(int atomID)
          Adds a LonePair to this Atom.
 void addSingleElectron(int atomID)
          Adds a SingleElectron to this Atom.
 void addSingleElectron(ISingleElectron singleElectron)
          Adds a single electron to this AtomContainer.
 void addStereoElement(IStereoElement element)
          Adds a stereo element to this container.
 Iterable<IAtom> atoms()
          Returns an Iterable for looping over all atoms in this container.
 Iterable<IBond> bonds()
          Returns an Iterable for looping over all bonds in this container.
 boolean contains(IAtom atom)
          True, if the AtomContainer contains the given atom object.
 boolean contains(IBond bond)
          True, if the AtomContainer contains the given bond object.
 boolean contains(IElectronContainer electronContainer)
          True, if the AtomContainer contains the given ElectronContainer object.
 boolean contains(ILonePair lonePair)
          True, if the AtomContainer contains the given LonePair object.
 boolean contains(ISingleElectron singleElectron)
          True, if the AtomContainer contains the given SingleElectron object.
 Iterable<IElectronContainer> electronContainers()
          Returns an Iterable for looping over all electron containers in this container.
 IAtom getAtom(int number)
          Get the atom at position number in [0,..].
 int getAtomCount()
          Returns the number of Atoms in this Container.
 int getAtomNumber(IAtom atom)
          Returns the position of a given atom in the atoms array.
 IBond getBond(IAtom atom1, IAtom atom2)
          Returns the bond that connectes the two given atoms.
 IBond getBond(int number)
          Get the bond at position number in [0,..].
 int getBondCount()
          Returns the number of Bonds in this Container.
 int getBondNumber(IAtom atom1, IAtom atom2)
          Returns the position of the bond between two given atoms in the electronContainers array.
 int getBondNumber(IBond bond)
          Returns the position of a given bond in the electronContainers array.
 double getBondOrderSum(IAtom atom)
          Returns the sum of the bond orders for a given Atom.
 int getConnectedAtomsCount(IAtom atom)
          Returns the number of atoms connected to the given atom.
 List<IAtom> getConnectedAtomsList(IAtom atom)
          Returns an ArrayList of all atoms connected to the given atom.
 int getConnectedBondsCount(IAtom atom)
          Returns the number of Bonds for a given Atom.
 int getConnectedBondsCount(int atomnumber)
          Returns the number of connected atoms (degree) to the given atom.
 List<IBond> getConnectedBondsList(IAtom atom)
          Returns an ArrayList of all Bonds connected to the given atom.
 List<IElectronContainer> getConnectedElectronContainersList(IAtom atom)
          Returns an ArrayList of all electronContainers connected to the given atom.
 int getConnectedLonePairsCount(IAtom atom)
          Returns the number of LonePairs for a given Atom.
 List<ILonePair> getConnectedLonePairsList(IAtom atom)
          Returns the array of lone pairs connected to an atom.
 int getConnectedSingleElectronsCount(IAtom atom)
          Returns the sum of the SingleElectron for a given Atom.
 List<ISingleElectron> getConnectedSingleElectronsList(IAtom atom)
          Returns an array of all SingleElectron connected to the given atom.
 IElectronContainer getElectronContainer(int number)
          Returns the ElectronContainer at position number in the container.
 int getElectronContainerCount()
          Returns the number of ElectronContainers in this Container.
 IAtom getFirstAtom()
          Returns the atom at position 0 in the container.
 IAtom getLastAtom()
          Returns the atom at the last position in the container.
 ILonePair getLonePair(int number)
          Get the lone pair at position number in [0,..].
 int getLonePairCount()
          Returns the number of LonePairs in this Container.
 int getLonePairNumber(ILonePair lonePair)
          Returns the position of a given lone pair in the lone pair array.
 IBond.Order getMaximumBondOrder(IAtom atom)
          Returns the maximum bond order that this atom currently has in the context of this AtomContainer.
 IBond.Order getMinimumBondOrder(IAtom atom)
          Returns the minimum bond order that this atom currently has in the context of this AtomContainer.
 ISingleElectron getSingleElectron(int number)
          Get the single electron at position number in [0,..].
 int getSingleElectronCount()
          Returns the number of the single electrons in this container.
 int getSingleElectronNumber(ISingleElectron singleElectron)
          Returns the position of a given single electron in the single electron array.
 Iterable<ILonePair> lonePairs()
          Returns an Iterable for looping over all lone pairs in this container.
 void remove(IAtomContainer atomContainer)
          Removes all atoms and electronContainers of a given atomcontainer from this container.
 void removeAllBonds()
          Removes all Bonds from this container.
 void removeAllElectronContainers()
          Removes electronContainers from this container.
 void removeAllElements()
          Removes all atoms and bond from this container.
 void removeAtom(IAtom atom)
          Removes the given atom from the AtomContainer.
 void removeAtom(int position)
          Removes the atom at the given position from the AtomContainer.
 void removeAtomAndConnectedElectronContainers(IAtom atom)
          Removes the given atom and all connected electronContainers from the AtomContainer.
 IBond removeBond(IAtom atom1, IAtom atom2)
          Removes the bond that connects the two given atoms.
 void removeBond(IBond bond)
          Removes the bond from this container.
 IBond removeBond(int position)
          Removes the bond at the given position from the AtomContainer.
 void removeElectronContainer(IElectronContainer electronContainer)
          Removes this ElectronContainer from this container.
 IElectronContainer removeElectronContainer(int position)
          Removes the bond at the given position from this container.
 void removeLonePair(ILonePair lonePair)
          Removes the lone pair from the AtomContainer.
 ILonePair removeLonePair(int position)
          Removes the lone pair at the given position from the AtomContainer.
 ISingleElectron removeSingleElectron(int position)
          Removes the single electron at the given position from the AtomContainer.
 void removeSingleElectron(ISingleElectron singleElectron)
          Removes the single electron from the AtomContainer.
 void setAtom(int number, IAtom atom)
          Set the atom at position number in [0,..].
 void setAtoms(IAtom[] atoms)
          Sets the array of atoms of this AtomContainer.
 void setBonds(IBond[] bonds)
          Sets the array of bonds of this AtomContainer.
 Iterable<ISingleElectron> singleElectrons()
          Returns an Iterable for looping over all single electrons in this container.
 Iterable<IStereoElement> stereoElements()
          Returns the stereo elements defined for this atom container.
 
Methods inherited from interface org.openscience.cdk.interfaces.IChemObject
addListener, clone, getFlag, getFlags, getID, getListenerCount, getNotification, getProperties, getProperty, notifyChanged, notifyChanged, removeListener, removeProperty, setFlag, setFlags, setID, setNotification, setProperties, setProperty, toString
 
Methods inherited from interface org.openscience.cdk.interfaces.ICDKObject
getBuilder
 
Methods inherited from interface org.openscience.cdk.interfaces.IChemObjectListener
stateChanged
 

Method Detail

addStereoElement

void addStereoElement(IStereoElement element)
Adds a stereo element to this container.

Parameters:
element - The new IStereoElement for this container
See Also:
stereoElements()

stereoElements

Iterable<IStereoElement> stereoElements()
Returns the stereo elements defined for this atom container.

Returns:
An Iterable of IStereoElements.
See Also:
addStereoElement(IStereoElement)

setAtoms

void setAtoms(IAtom[] atoms)
Sets the array of atoms of this AtomContainer.

Parameters:
atoms - The array of atoms to be assigned to this AtomContainer
See Also:
atoms()

setBonds

void setBonds(IBond[] bonds)
Sets the array of bonds of this AtomContainer.

Parameters:
bonds - The array of bonds to be assigned to this AtomContainer
See Also:
bonds()

setAtom

void setAtom(int number,
             IAtom atom)
Set the atom at position number in [0,..].

Parameters:
number - The position of the atom to be set.
atom - The atom to be stored at position number
See Also:
getAtom(int)

getAtom

IAtom getAtom(int number)
Get the atom at position number in [0,..].

Parameters:
number - The position of the atom to be retrieved.
Returns:
The atom number
See Also:
setAtom(int, org.openscience.cdk.interfaces.IAtom)

getBond

IBond getBond(int number)
Get the bond at position number in [0,..].

Parameters:
number - The position of the bond to be retrieved.
Returns:
The bond number

getLonePair

ILonePair getLonePair(int number)
Get the lone pair at position number in [0,..].

Parameters:
number - The position of the LonePair to be retrieved.
Returns:
The lone pair number

getSingleElectron

ISingleElectron getSingleElectron(int number)
Get the single electron at position number in [0,..].

Parameters:
number - The position of the SingleElectron to be retrieved.
Returns:
The single electron number

atoms

Iterable<IAtom> atoms()
Returns an Iterable for looping over all atoms in this container.

Returns:
An Iterable with the atoms in this container

bonds

Iterable<IBond> bonds()
Returns an Iterable for looping over all bonds in this container.

Returns:
An Iterable with the bonds in this container

lonePairs

Iterable<ILonePair> lonePairs()
Returns an Iterable for looping over all lone pairs in this container.

Returns:
An Iterable with the lone pairs in this container

singleElectrons

Iterable<ISingleElectron> singleElectrons()
Returns an Iterable for looping over all single electrons in this container.

Returns:
An Iterable with the single electrons in this container

electronContainers

Iterable<IElectronContainer> electronContainers()
Returns an Iterable for looping over all electron containers in this container.

Returns:
An Iterable with the electron containers in this container

getFirstAtom

IAtom getFirstAtom()
Returns the atom at position 0 in the container.

Returns:
The atom at position 0 .

getLastAtom

IAtom getLastAtom()
Returns the atom at the last position in the container.

Returns:
The atom at the last position

getAtomNumber

int getAtomNumber(IAtom atom)
Returns the position of a given atom in the atoms array. It returns -1 if the atom atom does not exist.

Parameters:
atom - The atom to be sought
Returns:
The Position of the atom in the atoms array in [0,..].

getBondNumber

int getBondNumber(IAtom atom1,
                  IAtom atom2)
Returns the position of the bond between two given atoms in the electronContainers array. It returns -1 if the bond does not exist.

Parameters:
atom1 - The first atom
atom2 - The second atom
Returns:
The Position of the bond between a1 and a2 in the electronContainers array.

getBondNumber

int getBondNumber(IBond bond)
Returns the position of a given bond in the electronContainers array. It returns -1 if the bond does not exist.

Parameters:
bond - The bond to be sought
Returns:
The Position of the bond in the electronContainers array in [0,..].

getLonePairNumber

int getLonePairNumber(ILonePair lonePair)
Returns the position of a given lone pair in the lone pair array. It returns -1 if the lone pair does not exist.

Parameters:
lonePair - The lone pair to be sought
Returns:
The Position of the lone pair in the array..

getSingleElectronNumber

int getSingleElectronNumber(ISingleElectron singleElectron)
Returns the position of a given single electron in the single electron array. It returns -1 if the single electron does not exist.

Parameters:
singleElectron - The single electron to be sought
Returns:
The Position of the single electron in the array.

getElectronContainer

IElectronContainer getElectronContainer(int number)
Returns the ElectronContainer at position number in the container.

Parameters:
number - The position of the ElectronContainer to be returned.
Returns:
The ElectronContainer at position number.
See Also:
addElectronContainer(IElectronContainer)

getBond

IBond getBond(IAtom atom1,
              IAtom atom2)
Returns the bond that connectes the two given atoms.

Parameters:
atom1 - The first atom
atom2 - The second atom
Returns:
The bond that connectes the two atoms

getAtomCount

int getAtomCount()
Returns the number of Atoms in this Container.

Returns:
The number of Atoms in this Container

getBondCount

int getBondCount()
Returns the number of Bonds in this Container.

Returns:
The number of Bonds in this Container

getLonePairCount

int getLonePairCount()
Returns the number of LonePairs in this Container.

Returns:
The number of LonePairs in this Container

getSingleElectronCount

int getSingleElectronCount()
Returns the number of the single electrons in this container.

Returns:
The number of SingleElectron objects of this AtomContainer

getElectronContainerCount

int getElectronContainerCount()
Returns the number of ElectronContainers in this Container.

Returns:
The number of ElectronContainers in this Container

getConnectedAtomsList

List<IAtom> getConnectedAtomsList(IAtom atom)
Returns an ArrayList of all atoms connected to the given atom.

Parameters:
atom - The atom the bond partners are searched of.
Returns:
The ArrayList with the connected atoms

getConnectedBondsList

List<IBond> getConnectedBondsList(IAtom atom)
Returns an ArrayList of all Bonds connected to the given atom.

Parameters:
atom - The atom the connected bonds are searched of
Returns:
The ArrayList with connected atoms

getConnectedLonePairsList

List<ILonePair> getConnectedLonePairsList(IAtom atom)
Returns the array of lone pairs connected to an atom.

Parameters:
atom - The atom for which to get lone pairs
Returns:
The array of LonePairs of this AtomContainer

getConnectedSingleElectronsList

List<ISingleElectron> getConnectedSingleElectronsList(IAtom atom)
Returns an array of all SingleElectron connected to the given atom.

Parameters:
atom - The atom on which the single electron is located
Returns:
The array of SingleElectron of this AtomContainer

getConnectedElectronContainersList

List<IElectronContainer> getConnectedElectronContainersList(IAtom atom)
Returns an ArrayList of all electronContainers connected to the given atom.

Parameters:
atom - The atom the connected electronContainers are searched of
Returns:
The ArrayList with the connected atoms

getConnectedAtomsCount

int getConnectedAtomsCount(IAtom atom)
Returns the number of atoms connected to the given atom.

Parameters:
atom - The atom the number of bond partners are searched of.
Returns:
The the size of connected atoms

getConnectedBondsCount

int getConnectedBondsCount(IAtom atom)
Returns the number of Bonds for a given Atom.

Parameters:
atom - The atom
Returns:
The number of Bonds for this atom

getConnectedBondsCount

int getConnectedBondsCount(int atomnumber)
Returns the number of connected atoms (degree) to the given atom.

Parameters:
atomnumber - The atomnumber the degree is searched for
Returns:
The number of connected atoms (degree)

getConnectedLonePairsCount

int getConnectedLonePairsCount(IAtom atom)
Returns the number of LonePairs for a given Atom.

Parameters:
atom - The atom
Returns:
The number of LonePairs for this atom

getConnectedSingleElectronsCount

int getConnectedSingleElectronsCount(IAtom atom)
Returns the sum of the SingleElectron for a given Atom.

Parameters:
atom - The atom on which the single electron is located
Returns:
The array of SingleElectron of this AtomContainer

getBondOrderSum

double getBondOrderSum(IAtom atom)
Returns the sum of the bond orders for a given Atom.

Parameters:
atom - The atom
Returns:
The number of bondorders for this atom

getMaximumBondOrder

IBond.Order getMaximumBondOrder(IAtom atom)
Returns the maximum bond order that this atom currently has in the context of this AtomContainer.

Parameters:
atom - The atom
Returns:
The maximum bond order that this atom currently has

getMinimumBondOrder

IBond.Order getMinimumBondOrder(IAtom atom)
Returns the minimum bond order that this atom currently has in the context of this AtomContainer.

Parameters:
atom - The atom
Returns:
The minimim bond order that this atom currently has

add

void add(IAtomContainer atomContainer)
Adds all atoms and electronContainers of a given atomcontainer to this container.

Parameters:
atomContainer - The atomcontainer to be added

addAtom

void addAtom(IAtom atom)
Adds an atom to this container.

Parameters:
atom - The atom to be added to this container

addBond

void addBond(IBond bond)
Adds a Bond to this AtomContainer.

Parameters:
bond - The bond to added to this container

addLonePair

void addLonePair(ILonePair lonePair)
Adds a lone pair to this AtomContainer.

Parameters:
lonePair - The LonePair to added to this container

addSingleElectron

void addSingleElectron(ISingleElectron singleElectron)
Adds a single electron to this AtomContainer.

Parameters:
singleElectron - The SingleElectron to added to this container

addElectronContainer

void addElectronContainer(IElectronContainer electronContainer)
Adds a ElectronContainer to this AtomContainer.

Parameters:
electronContainer - The ElectronContainer to added to this container

remove

void remove(IAtomContainer atomContainer)
Removes all atoms and electronContainers of a given atomcontainer from this container.

Parameters:
atomContainer - The atomcontainer to be removed

removeAtom

void removeAtom(int position)
Removes the atom at the given position from the AtomContainer. Note that the electronContainers are unaffected: you also have to take care of removing all electronContainers to this atom from the container manually.

Parameters:
position - The position of the atom to be removed.

removeAtom

void removeAtom(IAtom atom)
Removes the given atom from the AtomContainer. Note that the electronContainers are unaffected: you also have to take care of removeing all electronContainers to this atom from the container.

Parameters:
atom - The atom to be removed

removeBond

IBond removeBond(int position)
Removes the bond at the given position from the AtomContainer.

Parameters:
position - The position of the bond to be removed.
Returns:
the bond at the given position

removeBond

IBond removeBond(IAtom atom1,
                 IAtom atom2)
Removes the bond that connects the two given atoms.

Parameters:
atom1 - The first atom
atom2 - The second atom
Returns:
The bond that connectes the two atoms

removeBond

void removeBond(IBond bond)
Removes the bond from this container.

Parameters:
bond - The bond to be removed.

removeLonePair

ILonePair removeLonePair(int position)
Removes the lone pair at the given position from the AtomContainer.

Parameters:
position - The position of the LonePair to be removed.
Returns:
The removed ILonePair.

removeLonePair

void removeLonePair(ILonePair lonePair)
Removes the lone pair from the AtomContainer.

Parameters:
lonePair - The LonePair to be removed.

removeSingleElectron

ISingleElectron removeSingleElectron(int position)
Removes the single electron at the given position from the AtomContainer.

Parameters:
position - The position of the SingleElectron to be removed.
Returns:
The removed ISingleElectron

removeSingleElectron

void removeSingleElectron(ISingleElectron singleElectron)
Removes the single electron from the AtomContainer.

Parameters:
singleElectron - The SingleElectron to be removed.

removeElectronContainer

IElectronContainer removeElectronContainer(int position)
Removes the bond at the given position from this container.

Parameters:
position - The position of the bond in the electronContainers array
Returns:
the IElectronContainer that was removed

removeElectronContainer

void removeElectronContainer(IElectronContainer electronContainer)
Removes this ElectronContainer from this container.

Parameters:
electronContainer - The electronContainer to be removed

removeAtomAndConnectedElectronContainers

void removeAtomAndConnectedElectronContainers(IAtom atom)
Removes the given atom and all connected electronContainers from the AtomContainer.

Parameters:
atom - The atom to be removed

removeAllElements

void removeAllElements()
Removes all atoms and bond from this container.


removeAllElectronContainers

void removeAllElectronContainers()
Removes electronContainers from this container.


removeAllBonds

void removeAllBonds()
Removes all Bonds from this container.


addBond

void addBond(int atom1,
             int atom2,
             IBond.Order order,
             IBond.Stereo stereo)
Adds a bond to this container.

Parameters:
atom1 - Id of the first atom of the Bond in [0,..]
atom2 - Id of the second atom of the Bond in [0,..]
order - Bondorder
stereo - Stereochemical orientation

addBond

void addBond(int atom1,
             int atom2,
             IBond.Order order)
Adds a bond to this container.

Parameters:
atom1 - Id of the first atom of the Bond in [0,..]
atom2 - Id of the second atom of the Bond in [0,..]
order - Bondorder

addLonePair

void addLonePair(int atomID)
Adds a LonePair to this Atom.

Parameters:
atomID - The atom number to which the LonePair is added in [0,..]

addSingleElectron

void addSingleElectron(int atomID)
Adds a SingleElectron to this Atom.

Parameters:
atomID - The atom number to which the SingleElectron is added in [0,..]

contains

boolean contains(IAtom atom)
True, if the AtomContainer contains the given atom object.

Parameters:
atom - the atom this AtomContainer is searched for
Returns:
True, if the AtomContainer contains the given atom object

contains

boolean contains(IBond bond)
True, if the AtomContainer contains the given bond object.

Parameters:
bond - the bond this AtomContainer is searched for
Returns:
True, if the AtomContainer contains the given bond object

contains

boolean contains(ILonePair lonePair)
True, if the AtomContainer contains the given LonePair object.

Parameters:
lonePair - the LonePair this AtomContainer is searched for
Returns:
True, if the AtomContainer contains the given LonePair object

contains

boolean contains(ISingleElectron singleElectron)
True, if the AtomContainer contains the given SingleElectron object.

Parameters:
singleElectron - the SingleElectron this AtomContainer is searched for
Returns:
True, if the AtomContainer contains the given SingleElectron object

contains

boolean contains(IElectronContainer electronContainer)
True, if the AtomContainer contains the given ElectronContainer object.

Parameters:
electronContainer - ElectronContainer that is searched for
Returns:
True, if the AtomContainer contains the given bond object