|
The Octet Molecular Representation Framework v0.8.2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
A builder of molecular representations. RepresentationBuilder decouples the
process of constructing a molecular representation from its implementation, allowing each
to vary independently. Molecular representation
schemes can vary significantly in their performance characteristics and interfaces. Tight
coupling of a representation scheme to a representation build process, as is done in
nearly all molecular informatics toolkits, locks developers into a single molecular
representation scheme. RepresentatationBuilder is designed to to remedy
this situation.
The reasons for constructing a molecular representation vary widely. In some cases, a representation will be written directly to disk or line output. In others, a graph traversal will be performed. Still other uses may involve rendering a molecule in 2-D or 3-D. Each of these tasks will have an optimal representation scheme; this may be a series of ASCII characters, a molecular graph, or a set of polygons, respectively.
RepresentationBuilder presents a uniform abstraction layer to code that
needs to generate a particular molecular representation. Thus, the same code that
generates benzene as a Molecule can also be used to generate benzene
as a FlexMol document. RepresentationBuilder is completely unaware of the
type of representation a client is constructing and instead is only
aware of a request to construct a representation.
RepresentationBuilder uses two design patterns: "Proxy" and "Builder".
In the terminology of the Builder Pattern, RepresentationBuilder is the
"builder" and a client that uses it is a "director". Using the Proxy Pattern
prevents RepresentationBuilder from refering to implementation-specific
components.
Clients may build a valid representation using any sequence of method calls, without an exception being
thrown during the build process. For example, if ionization of a BondingSystem
results in a temporarily negative electron count, RepresentationBuilder
will proceed without throwing an exception.
RepresentationBuilder clients may assume that Atoms are electrically neutral
after being added. In other words, ionization occurs from an electron count that is initially
set to the Atom's proton count.
No automatic perception of implicit hydrogen count is performed by RepresenationBuilder
instances. Clients directly using RepresentationBuilder are, as a result, responsible
for ensuring that the appropriate number of virtual hydrogens are added by invoking
addHydrogens.
Example usage of RepresentationBuilder can be found in
net.sf.octet.util.RepresentationKit.
The code fragment below creates a benzene molecule, which is represented as 1,3,5-cyclohexatriene:
RepresentationBuilder builder = ...; // get the builder
IsotopicDistribution carbon =
AtomicSystem.getNaturalAbundance(AtomicSystem.getSymbol("C"));
AtomProxy c1 = builder.addAtom(carbon);
AtomProxy c2 = builder.addAtom(carbon);
AtomProxy c3 = builder.addAtom(carbon);
AtomProxy c4 = builder.addAtom(carbon);
AtomProxy c5 = builder.addAtom(carbon);
AtomProxy c6 = builder.addAtom(carbon);
BuilderKit.connectSingle(c1, c2, builder);
BuilderKit.connectDouble(c2, c3, builder);
BuilderKit.connectSingle(c3, c4, builder);
BuilderKit.connectDouble(c4, c5, builder);
BuilderKit.connectSingle(c5, c6, builder);
BuilderKit.connectDouble(c6, c1, builder);
builder.addImplicitHydrogens(c1, 1);
builder.addImplicitHydrogens(c2, 1);
builder.addImplicitHydrogens(c3, 1);
builder.addImplicitHydrogens(c4, 1);
builder.addImplicitHydrogens(c5, 1);
builder.addImplicitHydrogens(c6, 1);
RepresentationKit| Method Summary | |
AtomProxy |
addAtom(IsotopicDistribution distribution)
Returns an AtomProxy representing an Atom containing
the specified IsotopicDistribution. |
BondingSystemProxy |
addBondingSystem()
Creates a new BondingSystem and adds it to the current representation. |
ConfigurationProxy |
addConfiguration(AtomProxy atom)
Returns a proxy for a Configuration to be associated with atom. |
void |
addElectron(OrbitalProxy orbital,
boolean spinUp)
Populates orbital with one electron of spin spinUp. |
GammaSequenceProxy |
addGammaSequence(AtomProxy start)
Creates a new GammaSequence beginning at start and adds
it to the representation under construction. |
HalfPlaneProxy |
addHalfPlane(ConfigurationProxy configuration,
AtomProxy neighbor)
Returns a proxy for a HalfPlane to be associated with configuration
and the specified neighboring atom neighbor. |
HalfPlaneProxy |
addHalfPlane(GammaSequenceProxy sequence)
Returns a proxy for a HalfPlane to be associated with sequence. |
void |
addHydrogens(AtomProxy atom,
int hydrogenCount)
Modifies by hydrogenCount the number of virtual hydrogen atoms
associated with atom. |
OrbitalProxy |
addOrbital(AtomProxy atom)
Creates a new, empty, nonbonding Orbital localized on atom. |
void |
connect(AtomProxy source,
AtomProxy target,
BondingSystemProxy system)
Connects source with target within the
BondingSystem denoted by system. |
void |
connect(AtomProxy atom,
GammaSequenceProxy sequence)
Adds atom to sequence. |
void |
constrainCenter(AtomProxy atom,
HalfPlaneProxy plane)
Constrains atom to lie on the horizontal line bisecting plane. |
void |
constrainLower(AtomProxy atom,
HalfPlaneProxy plane)
Constrains atom to lie within the lower portion of the HalfPlane
represented by plane. |
void |
constrainUpper(AtomProxy atom,
HalfPlaneProxy plane)
Constrains atom to lie within the upper portion of the HalfPlane
represented by plane. |
void |
flush()
Clears the instruction queue. |
void |
ionizeAntibondingElectrons(BondingSystemProxy system,
int electronCount)
Modifies by electronCount the number of antibonding electrons
belonging to system. |
void |
ionizeAtom(AtomProxy atom,
int electronCount)
Modifies by electronCount the number of electrons
belonging to atom. |
void |
ionizeBondingElectrons(BondingSystemProxy system,
int electronCount)
Modifies by electronCount the number of bonding electrons
belonging to system. |
| Method Detail |
public void flush()
RepresentationBuilder to a state in which it is ready to start
building a new representation.
public BondingSystemProxy addBondingSystem()
BondingSystem and adds it to the current representation.
public void connect(AtomProxy source,
AtomProxy target,
BondingSystemProxy system)
source with target within the
BondingSystem denoted by system. The designation
of source and target are not be meaningful.
connect produces bonding arrangements suitable for extended pi-systems,
organometallic complexes, unoccupied molecular orbitals, and purely
electrostatic interactions.
source - the proxy for the source atomtarget - the proxy for the target atomsystem - the proxy for the bonding system
NoSuchProxyException - if source, target,
or system are not found
IllegalRepresentationException - if source or target
can not be connected through system, as is the case, for
example, when they are already connected through system
public void ionizeAtom(AtomProxy atom,
int electronCount)
electronCount the number of electrons
belonging to atom. Positive values of
electronCount are interpreted as oxidation (electron removal);
negative values are interpreded as reduction (electron addition).
atom - the proxy for the atom to ionizeelectronCount - the number of electrons, positive for oxidation and
negative for reduction
NoSuchProxyException - if atom is not found
public void addHydrogens(AtomProxy atom,
int hydrogenCount)
Modifies by hydrogenCount the number of virtual hydrogen atoms
associated with atom. Positive values of hydrogenCount
are interpreted as addition of virtual hydrogens; negative values
are interpreted as removal of virtual hydrogens. Invocation of
addHydrogens also modifies by -hydrogenCount
the ionization state of atom.
The intent
of the addHydrogens method is enable hydrogen-suppressed graphs
to be used within Octet, but to remove the ambiguity associated with automatic hydrogen
atom perception. Hydrogen atoms can be explicity placed
into molecular graphs with addAtom. Conversely, hydrogen-suppressed molecular
graphs can also be generated by using addHydrogens. The same representation
may mix both graph-based hydrogens and virtual hydrogens.
Open valencies (i.e. unpaired electrons) not satisfied either through explicit hydrogen addition
via addAtom or association with addHydrogens will be interpreted
as nonbonding electrons. It is the responsibility of clients to ensure that the correct
number of hydrogens is associated with each atom in the molecular representations they
construct with RepresentationBuilder.
atom - the proxy for the atom that will be modifiedhydrogenCount - the number of implicit hydrogens, positive values for
additions, and negative values for removal
NoSuchProxyException - if atom is not found
public void ionizeBondingElectrons(BondingSystemProxy system,
int electronCount)
electronCount the number of bonding electrons
belonging to system. Positive values of
electronCount are interpreted as oxidation (electron removal);
negative values are interpreded as reduction (electron addition).
system - the proxy for the BondingSystem to ionizeelectronCount - the number of electrons, positive for oxidation and
negative for reduction
NoSuchProxyExcpetion - if system is not found
public void ionizeAntibondingElectrons(BondingSystemProxy system,
int electronCount)
electronCount the number of antibonding electrons
belonging to system. Positive values of
electronCount are interpreted as oxidation (electron removal);
negative values are interpreded as reduction (electron addition).
system - the proxy for the BondingSystem to ionizeelectronCount - the number of electrons, positive for oxidation and
negative for reduction
NoSuchProxyExcpetion - if system is not foundpublic ConfigurationProxy addConfiguration(AtomProxy atom)
atom.
atom - the proxy to the Atom for which a Configuration should be created
atom
IllegalRepresentationException - if atom as already been assigned
a Configuration
NoSuchProxyException - if atom is not found
public HalfPlaneProxy addHalfPlane(ConfigurationProxy configuration,
AtomProxy neighbor)
configuration
and the specified neighboring atom neighbor. The order in which
HalfPlanes are added will result in a clockwise distribution about the axis defined
from the atom associated with configuration to neighbor.
configuration - the Configurationneighbor - the neighbor of the Atom associated with configuration
configuration
and the specified neighboring atom neighbor
NoSuchProxyException - if either configuration or neighbor
are not recognized
IllegalRepresentationException - if a HalfPlane can not be added, for example,
due to lack of connectivity of the Atom associated with
configuration and neighbor
public void constrainUpper(AtomProxy atom,
HalfPlaneProxy plane)
atom to lie within the upper portion of the HalfPlane
represented by plane. The order in which Atoms are added defines
the ordering in the resulting HalfPlane; Atoms added first
are considered closer to the horizontal line bisecting plane.
atom - the proxy to the Atom to constrainplane - the plane in which to constrain atom
java.lang.IllegalArgumentException - if atom can not be added to plane,
for example because it has inadequate connectivity
NoSuchProxyException - if either atom or plane are not found
public void constrainLower(AtomProxy atom,
HalfPlaneProxy plane)
atom to lie within the lower portion of the HalfPlane
represented by plane. The order in which Atoms are added defines
the ordering in the resulting HalfPlane; Atoms added first
are considered closer to the horizontal line bisecting plane.
atom - the proxy to the Atom to constrainplane - the plane in which to constrain atom
java.lang.IllegalArgumentException - if atom can not be added to plane,
for example because it has inadequate connectivity
NoSuchProxyException - if either atom or plane are not found
public void constrainCenter(AtomProxy atom,
HalfPlaneProxy plane)
atom to lie on the horizontal line bisecting plane.
atom - the proxy to the Atom to constrainplane - the plane in which to constrain atom
IllegalRepresentationException - if atom can not be added to plane.
One reason could be that plane already has a center Atom. Another reason
could be that plane does not support a center Atom because it belongs to a
GammaSequence
NoSuchProxyException - if either atom or plane are not foundpublic GammaSequenceProxy addGammaSequence(AtomProxy start)
Creates a new GammaSequence beginning at start and adds
it to the representation under construction.
Note: each GammaSequence is specified only once. Thus, it is not
necessary, for example, to specify both A-B and B-A GammaSequences, where
A and B refer to two neighboring nonterminal atoms.
start - the source of the GammaSequence
GammaSequence
NoSuchProxyException - if start is not found
public void connect(AtomProxy atom,
GammaSequenceProxy sequence)
Adds atom to sequence.
Note: each GammaSequence is specified only once. Thus, it is not
necessary, for example, to specify both A-B and B-A GammaSequences, where
A and B refer to two neighboring nonterminal atoms.
atom - the AtomProxy to add to sequencesequence - the GammaSequence to be extended by atom
NoSuchProxyException - if atom or sequence are
not found
IllegalRepresentationException - if atom can not be connected through
sequencepublic HalfPlaneProxy addHalfPlane(GammaSequenceProxy sequence)
sequence. The order in which
HalfPlanes are added will result in a clockwise distribution about the axis defined
by sequence, with the first atom in the gamma sequence at the bottom and the last
atom at the top.
sequence - a proxy to the GammaSequence
sequencepublic OrbitalProxy addOrbital(AtomProxy atom)
Creates a new, empty, nonbonding Orbital localized on atom. Returns
an OrbitalProxy that can be used to to subsequently populate the underlying
Orbital with Electrons.
atom - the AtomProxy on which to localize an Orbital
NoSuchProxyException - if atom can not be found
public void addElectron(OrbitalProxy orbital,
boolean spinUp)
Populates orbital with one electron of spin spinUp. If true
, spinUp results in an Electron with a positive spin. If
false, spinUp results in an Electron with a negative spin.
Invocation of addElectron does not change the number of electrons otherwise
associated with the atom owning orbital. Thus, the electron populating
orbital is generated de novo, rather than being taken from the associated
atom representation. To "transfer" an electron from an atom representation to an orbital
associated with it, both addElectron and ionizeAtom will
be necessary.
orbital - the OrbitalProxy in which to specify an electronspinUp - true for positive spin, or false for negative spin
NoSuchProxyException - if orbital can not be found
IllegalRepresentationException - if orbital already contains two electrons,
or if an electron of spin spinUp is already present in orbitalpublic AtomProxy addAtom(IsotopicDistribution distribution)
AtomProxy representing an Atom containing
the specified IsotopicDistribution.
distribution - the IsotopicDistribtion to be associated with an Atom
|
The Octet Molecular Representation Framework v0.8.2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||