Package 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
,AtomContainerLegacy
,AtomContainerLegacy
,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
IBond
s in theIAtomContainer
is typically done like:for (IBond bond : atomContainer.bonds()) { // do something }
If you do need an explicit Iterator then useIterator<IBond> bondIter = atomContainer.bonds().iterator();
- Author:
- steinbeck
- Source code:
- main
- Belongs to CDK module:
- interfaces
- Created on:
- 2000-10-02
-
-
Field Summary
-
Fields inherited from interface org.openscience.cdk.interfaces.IChemObject
ALIPHATIC, AROMATIC, CONJUGATED, HYDROGEN_BOND_ACCEPTOR, HYDROGEN_BOND_DONOR, IN_RING, MAPPED, NOT_IN_RING, PLACED, REACTIVE_CENTER, SINGLE_OR_DOUBLE, TYPEABLE, VISITED
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description 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(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
addBond(IBond bond)
Adds a Bond to this AtomContainer.void
addElectronContainer(IElectronContainer electronContainer)
Adds a ElectronContainer to this AtomContainer.void
addLonePair(int atomID)
Adds a LonePair to this Atom.void
addLonePair(ILonePair lonePair)
Adds a lone pair to this AtomContainer.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.IAtomContainer
clone()
Returns a deep clone of this IChemObject.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 idx)
Get the atom at the specified idx, the index should be in the range 0 ≤ idx <getAtomCount()
.int
getAtomCount()
Returns the number of Atoms in this Container.int
getAtomNumber(IAtom atom)
Deprecated.useindexOf(IAtom)
IBond
getBond(int idx)
Get the bond at the specified idx, the index should be in the range 0 ≤ idx <getBondCount()
.IBond
getBond(IAtom atom1, IAtom atom2)
Returns the bond that connects the two given atoms.int
getBondCount()
Returns the number of Bonds in this Container.int
getBondNumber(IAtom atom1, IAtom atom2)
Deprecated.useindexOf(IBond)
int
getBondNumber(IBond bond)
Deprecated.useindexOf(IBond)
double
getBondOrderSum(IAtom atom)
Returns the sum of the bond orders for a given Atom.int
getConnectedAtomsCount(IAtom atom)
Deprecated.List<IAtom>
getConnectedAtomsList(IAtom atom)
Returns the atoms connected connected to the specified atom by a bond.int
getConnectedBondsCount(int idx)
Returns the number of connected bonds (explicit degree) to atom at the specified index.int
getConnectedBondsCount(IAtom atom)
Returns the number of connected bonds (explicit degree) to the specified atom.List<IBond>
getConnectedBondsList(IAtom atom)
Returns the bonds connected connected to the specified atom.List<IElectronContainer>
getConnectedElectronContainersList(IAtom atom)
Returns the electron containers (bonds, radicals, and lone pairs ) connected connected to the specified atom.int
getConnectedLonePairsCount(IAtom atom)
Returns the number of lone pairs connected to the specified atom.List<ILonePair>
getConnectedLonePairsList(IAtom atom)
Returns the lone pairs connected connected to the specified atom.int
getConnectedSingleElectronsCount(IAtom atom)
Returns the number of single electrons connected to the specified atom.List<ISingleElectron>
getConnectedSingleElectronsList(IAtom atom)
Returns the single electrons connected connected to the specified atom.IElectronContainer
getElectronContainer(int number)
Returns the ElectronContainer at positionnumber
in the container.int
getElectronContainerCount()
Returns the number of ElectronContainers in this Container.IAtom
getFirstAtom()
Deprecated.usegetAtom(int)
IAtom
getLastAtom()
Deprecated.usegetAtom(int)
ILonePair
getLonePair(int idx)
Get the lone pair at the specified idx, the index should be in the range 0 ≤ idx <getLonePairCount()
.int
getLonePairCount()
Returns the number of LonePairs in this Container.int
getLonePairNumber(ILonePair lonePair)
Deprecated.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 idx)
Get the single electron at the specified idx, the index should be in the range 0 ≤ idx <getSingleElectronCount()
.int
getSingleElectronCount()
Returns the number of the single electrons in this container.int
getSingleElectronNumber(ISingleElectron singleElectron)
Deprecated.String
getTitle()
Access the title of the record.int
indexOf(IAtom atom)
Access the storage index of an atom.int
indexOf(IBond bond)
Access the storage index of a bond.int
indexOf(ILonePair pair)
Access the storage index of a long pair.int
indexOf(ISingleElectron electron)
Access the storage index of a single electron (radical).boolean
isEmpty()
Indicates whether this container is empty.Iterable<ILonePair>
lonePairs()
Returns an Iterable for looping over all lone pairs in this container.default IAtom
newAtom()
Create a new carbon atom in this container, it will have the implicit hydrogen count initialized to 0.default IAtom
newAtom(int element)
Create a new atom in this container of the specified element, it will have the implicit hydrogen count initialized to 0.default IAtom
newAtom(int element, int numImplH)
Create a new atom in this container of the specified element and implicit hydrogen count.default IAtom
newAtom(IAtom atom)
Create a new atom in the container based on properties of the provided atom.default IBond
newBond(IAtom beg, IAtom end)
Create a new single bond between two atoms.default IBond
newBond(IAtom beg, IAtom end, IBond.Order order)
Create a new bond between two atoms.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, bonds and stereo elements from this container.void
removeAtom(int pos)
Safely remove an atom from the container.void
removeAtom(IAtom atom)
Safely remove an atom from the container.void
removeAtomAndConnectedElectronContainers(IAtom atom)
Deprecated.Method has be renamedremoveAtom(IAtom)
.void
removeAtomOnly(int position)
Unsafely remove atom at index.void
removeAtomOnly(IAtom atom)
Unsafely remove atom.IBond
removeBond(int position)
Removes the bond at the given position 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.IElectronContainer
removeElectronContainer(int position)
Removes the bond at the given position from this container.void
removeElectronContainer(IElectronContainer electronContainer)
Removes this ElectronContainer from this container.ILonePair
removeLonePair(int position)
Removes the lone pair at the given position from the AtomContainer.void
removeLonePair(ILonePair lonePair)
Removes the lone pair 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 idx, IAtom atom)
Set the atom atidx
, the index must have an existing atom and therefore be in the range 0 ≤ idx < mol.getAtomCount().void
setAtoms(IAtom[] atoms)
Sets the array of atoms of this AtomContainer.void
setBonds(IBond[] bonds)
Sets the array of bonds of this AtomContainer.void
setStereoElements(List<IStereoElement> elements)
Set the stereo elements - this will replace the existing instance with a new instance.void
setTitle(String title)
Modify the title of the record.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.ICDKObject
getBuilder
-
Methods inherited from interface org.openscience.cdk.interfaces.IChemObject
addListener, addProperties, clear, flags, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, is, notifyChanged, notifyChanged, removeListener, removeProperty, set, setFlag, setFlags, setID, setNotification, setProperties, setProperty, toString
-
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 newIStereoElement
for this container- See Also:
stereoElements()
-
setStereoElements
void setStereoElements(List<IStereoElement> elements)
Set the stereo elements - this will replace the existing instance with a new instance.- Parameters:
elements
- the new stereo elements
-
stereoElements
Iterable<IStereoElement> stereoElements()
Returns the stereo elements defined for this atom container.- Returns:
- An
Iterable
ofIStereoElement
s. - 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 idx, IAtom atom)
Set the atom atidx
, the index must have an existing atom and therefore be in the range 0 ≤ idx < mol.getAtomCount().- Parameters:
idx
- The index of the atom to be set.atom
- The atom to be stored at positionidx
- Throws:
IndexOutOfBoundsException
- index is out of boundsIllegalArgumentException
- the atom could not be set- See Also:
getAtom(int)
-
getAtom
IAtom getAtom(int idx)
Get the atom at the specified idx, the index should be in the range 0 ≤ idx <getAtomCount()
.- Parameters:
idx
- atom index- Returns:
- the atom stored at the index
- Throws:
IndexOutOfBoundsException
- the index is out of range- See Also:
setAtom(int, org.openscience.cdk.interfaces.IAtom)
-
getBond
IBond getBond(int idx)
Get the bond at the specified idx, the index should be in the range 0 ≤ idx <getBondCount()
.- Parameters:
idx
- bond index- Returns:
- the bond stored at the index
- Throws:
IndexOutOfBoundsException
- the index is out of range
-
getLonePair
ILonePair getLonePair(int idx)
Get the lone pair at the specified idx, the index should be in the range 0 ≤ idx <getLonePairCount()
.- Parameters:
idx
- lone pair index- Returns:
- the lone pair stored at the index
- Throws:
IndexOutOfBoundsException
- the index is out of range
-
getSingleElectron
ISingleElectron getSingleElectron(int idx)
Get the single electron at the specified idx, the index should be in the range 0 ≤ idx <getSingleElectronCount()
.- Parameters:
idx
- single electron index- Returns:
- the single electron stored at the index
- Throws:
IndexOutOfBoundsException
- the index is out of range
-
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
@Deprecated IAtom getFirstAtom()
Deprecated.usegetAtom(int)
Returns the atom at position 0 in the container.- Returns:
- The atom at position 0 .
-
getLastAtom
@Deprecated IAtom getLastAtom()
Deprecated.usegetAtom(int)
Returns the atom at the last position in the container.- Returns:
- The atom at the last position
-
getAtomNumber
@Deprecated int getAtomNumber(IAtom atom)
Deprecated.useindexOf(IAtom)
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
@Deprecated int getBondNumber(IAtom atom1, IAtom atom2)
Deprecated.useindexOf(IBond)
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 atomatom2
- The second atom- Returns:
- The Position of the bond between a1 and a2 in the electronContainers array.
-
getBondNumber
@Deprecated int getBondNumber(IBond bond)
Deprecated.useindexOf(IBond)
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
@Deprecated int getLonePairNumber(ILonePair lonePair)
Deprecated.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)
Deprecated.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.
-
indexOf
int indexOf(IAtom atom)
Access the storage index of an atom.- Parameters:
atom
- atom instance to find- Returns:
- the index, -1 if not found
-
indexOf
int indexOf(IBond bond)
Access the storage index of a bond.- Parameters:
bond
- bond instance to find- Returns:
- the index, -1 if not found
-
indexOf
int indexOf(ISingleElectron electron)
Access the storage index of a single electron (radical).- Parameters:
electron
- the electron- Returns:
- the index, -1 if not found
-
indexOf
int indexOf(ILonePair pair)
Access the storage index of a long pair.- Parameters:
pair
- the long pair- Returns:
- the index, -1 if not found
-
getElectronContainer
IElectronContainer getElectronContainer(int number)
Returns the ElectronContainer at positionnumber
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 connects the two given atoms.- Parameters:
atom1
- The first atomatom2
- The second atom- Returns:
- The bond that connects 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 the atoms connected connected to the specified atom by a bond.- Parameters:
atom
- the atom- Returns:
- connected atoms
- Throws:
NoSuchElementException
- the atom is not present
-
getConnectedBondsList
List<IBond> getConnectedBondsList(IAtom atom)
Returns the bonds connected connected to the specified atom.- Parameters:
atom
- the atom- Returns:
- connected bonds
- Throws:
NoSuchElementException
- the atom is not present
-
getConnectedLonePairsList
List<ILonePair> getConnectedLonePairsList(IAtom atom)
Returns the lone pairs connected connected to the specified atom.- Parameters:
atom
- the atom- Returns:
- connected lone pairs
- Throws:
NoSuchElementException
- the atom is not present
-
getConnectedSingleElectronsList
List<ISingleElectron> getConnectedSingleElectronsList(IAtom atom)
Returns the single electrons connected connected to the specified atom.- Parameters:
atom
- the atom- Returns:
- connected lone pairs
- Throws:
NoSuchElementException
- the atom is not present
-
getConnectedElectronContainersList
List<IElectronContainer> getConnectedElectronContainersList(IAtom atom)
Returns the electron containers (bonds, radicals, and lone pairs ) connected connected to the specified atom.- Parameters:
atom
- the atom- Returns:
- connected lone pairs
- Throws:
NoSuchElementException
- the atom is not present
-
getConnectedAtomsCount
@Deprecated int getConnectedAtomsCount(IAtom atom)
Deprecated.Returns the number of connected atoms (explicit degree) to the specified atom. This does not include bonds to implicit hydrogens.- Parameters:
atom
- the atom- Returns:
- number of connected bonds
- Throws:
NoSuchElementException
- the atom is not present
-
getConnectedBondsCount
int getConnectedBondsCount(IAtom atom)
Returns the number of connected bonds (explicit degree) to the specified atom. This does not include bonds to implicit hydrogens.- Parameters:
atom
- the atom- Returns:
- number of connected bonds
- Throws:
NoSuchElementException
- the atom is not present
-
getConnectedBondsCount
int getConnectedBondsCount(int idx)
Returns the number of connected bonds (explicit degree) to atom at the specified index. This does not include bonds to implicit hydrogens.- Parameters:
idx
- the atom idx- Returns:
- number of connected bonds
- Throws:
IndexOutOfBoundsException
- the index is not in range
-
getConnectedLonePairsCount
int getConnectedLonePairsCount(IAtom atom)
Returns the number of lone pairs connected to the specified atom.- Parameters:
atom
- the atom- Returns:
- number of connected bonds
- Throws:
NoSuchElementException
- the atom is not present
-
getConnectedSingleElectronsCount
int getConnectedSingleElectronsCount(IAtom atom)
Returns the number of single electrons connected to the specified atom.- Parameters:
atom
- the atom- Returns:
- number of connected bonds
- Throws:
NoSuchElementException
- the atom is not present
-
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. If the atom has no bonds but does have implicit hydrogens the minimum bond order isIBond.Order.SINGLE
, otherwise the bond is unsetIBond.Order.UNSET
.- Parameters:
atom
- The atom- Returns:
- The maximum bond order that this atom currently has
- Throws:
NoSuchElementException
- atom does not belong to this container
-
getMinimumBondOrder
IBond.Order getMinimumBondOrder(IAtom atom)
Returns the minimum bond order that this atom currently has in the context of this AtomContainer. If the atom has no bonds but does have implicit hydrogens the minimum bond order isIBond.Order.SINGLE
, otherwise the bond is unsetIBond.Order.UNSET
.- Parameters:
atom
- The atom- Returns:
- The minimum bond order that this atom currently has
- Throws:
NoSuchElementException
- atom does not belong to this container
-
add
void add(IAtomContainer atomContainer)
Adds all atoms and electronContainers of a given atomcontainer to this container.- Parameters:
atomContainer
- The atomcontainer to be added
-
newAtom
default IAtom newAtom()
Create a new carbon atom in this container, it will have the implicit hydrogen count initialized to 0.- Returns:
- thew new atom
-
newAtom
default IAtom newAtom(int element)
Create a new atom in this container of the specified element, it will have the implicit hydrogen count initialized to 0.- Parameters:
element
- the atomic number- Returns:
- thew new atom
-
newAtom
default IAtom newAtom(int element, int numImplH)
Create a new atom in this container of the specified element and implicit hydrogen count.- Parameters:
element
- the atomic numbernumImplH
- the number of implicit hydrogens- Returns:
- thew new atom
-
newAtom
default IAtom newAtom(IAtom atom)
Create a new atom in the container based on properties of the provided atom. The new atom will have the same properties as the original but is distinct.- Parameters:
atom
- the original atom- Returns:
- the new atom
-
newBond
default IBond newBond(IAtom beg, IAtom end)
Create a new single bond between two atoms.- Parameters:
beg
- the begin atomend
- the end atom- Returns:
- the new bond
-
newBond
default IBond newBond(IAtom beg, IAtom end, IBond.Order order)
Create a new bond between two atoms.- Parameters:
beg
- the begin atomend
- the end atomorder
- the bond order- Returns:
- the new bond
-
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- Throws:
NoSuchAtomException
- optionally thrown if the atoms of the bond have not yet been added
-
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
-
removeAtomOnly
void removeAtomOnly(int position)
Unsafely remove atom at index.
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.
-
removeAtomOnly
void removeAtomOnly(IAtom atom)
Unsafely remove 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 atomatom2
- The second atom- Returns:
- The bond that connects 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
-
removeAtom
void removeAtom(IAtom atom)
Safely remove an atom from the container.
Removes a single atom from the container updating all internal state to be consistent. All bonds connected to the atom will be deleted as well as all stereo elements. If multiple atoms/bonds are being deleted they should be gathered into a single transaction and removed withremove(IAtomContainer)
.
If you are removing hydrogens one of the utility methods (e.g. AtomContainerManipulator.removeHydrogens(IAtomContainer)) is preferable.- Parameters:
atom
- the atom to be removed
-
removeAtom
void removeAtom(int pos)
Safely remove an atom from the container.
Removes a single atom from the container updating all internal state to be consistent. All bonds connected to the atom will be deleted as well as all stereo elements. If multiple atoms/bonds are being deleted they should be gathered into a single transaction and removed withremove(IAtomContainer)
.
If you are removing hydrogens one of the utility methods (e.g. AtomContainerManipulator.removeHydrogens(IAtomContainer)) is preferable.- Parameters:
pos
- the position of the atom to be removed
-
removeAtomAndConnectedElectronContainers
@Deprecated void removeAtomAndConnectedElectronContainers(IAtom atom)
Deprecated.Method has be renamedremoveAtom(IAtom)
.Safely remove an atom from the container.- See Also:
removeAtom(IAtom)
-
removeAllElements
void removeAllElements()
Removes all atoms, bonds and stereo elements 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
- Bondorderstereo
- 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
-
isEmpty
boolean isEmpty()
Indicates whether this container is empty. The container is considered empty if there are no atoms. Bonds are not checked as a graph with no vertexes can not have edges.- Returns:
- whether the container is empty
-
getTitle
String getTitle()
Access the title of the record.- Returns:
- the title
-
setTitle
void setTitle(String title)
Modify the title of the record.- Parameters:
title
- the title
-
clone
IAtomContainer clone() throws CloneNotSupportedException
Returns a deep clone of this IChemObject.- Specified by:
clone
in interfaceIChemObject
- Returns:
- Object the clone of this IChemObject.
- Throws:
CloneNotSupportedException
- if the IChemObject cannot be cloned
-
-