The Gnome Chemistry Utils
0.12.13
|
GChemPaint molecule class. More...
#include <gcp/molecule.h>
Public Member Functions | |
Molecule (gcu::TypeId Type=gcu::MoleculeType) | |
Molecule (Atom *pAtom) | |
virtual | ~Molecule () |
void | AddChild (gcu::Object *object) |
void | AddAtom (gcu::Atom *pAtom) |
void | AddFragment (Fragment *pFragment) |
void | AddBond (gcu::Bond *pBond) |
void | Remove (gcu::Object *pObject) |
bool | Merge (Molecule *pMolecule, bool RemoveDuplicates=false) |
bool | Load (xmlNodePtr node) |
xmlNodePtr | Save (xmlDocPtr xml) const |
void | Clear () |
void | Transform2D (gcu::Matrix2D &m, double x, double y) |
Object * | GetAtomAt (double x, double y, double z=0.) |
double | GetYAlign () |
bool | BuildContextualMenu (GtkUIManager *UIManager, gcu::Object *object, double x, double y) |
bool | OnSignal (gcu::SignalId Signal, gcu::Object *Child) |
void | ExportToGhemical () |
void | SelectAlignmentItem (gcu::Object *child) |
std::string | GetAlignmentId () |
void | BuildOBMol (OpenBabel::OBMol &Mol) |
void | BuildOBMol2D (OpenBabel::OBMol &Mol) |
void | ShowInChI () |
void | BuildInChI () |
void | BuildSMILES () |
void | ShowWebBase (char const *uri_start, char const *uri_end) |
void | OpenCalc () |
void | CheckCrossings (Bond *pBond) |
char const * | GetInChI () |
std::string | GetRawFormula () const |
void | OnLoaded () |
unsigned | GetAtomsNumber () const |
![]() | |
Molecule (Atom *pAtom) | |
void | UpdateCycles (Bond *pBond) |
void | UpdateCycles () |
bool | operator== (Molecule const &molecule) const |
Atom const * | GetFirstAtom (std::list< Atom * >::const_iterator &i) const |
Atom const * | GetNextAtom (std::list< Atom * >::const_iterator &i) const |
Bond const * | GetFirstBond (std::list< Bond * >::const_iterator &i) const |
Bond const * | GetNextBond (std::list< Bond * >::const_iterator &i) const |
void | SetName (char const *name, char const *convention) |
char const * | GetName (char const *convention=NULL) |
std::string | Name () |
![]() | |
Object (TypeId Id=OtherType) | |
virtual | ~Object () |
TypeId | GetType () const |
void | SetId (gchar const *Id) |
gchar const * | GetId () const |
Object * | GetMolecule () const |
Object * | GetReaction () const |
Object * | GetGroup () const |
Document * | GetDocument () const |
Object * | GetParentOfType (TypeId Id) const |
Object * | GetChild (const gchar *Id) const |
Object * | GetFirstChild (std::map< std::string, Object * >::iterator &i) |
Object * | GetNextChild (std::map< std::string, Object * >::iterator &i) |
Object * | GetDescendant (const gchar *Id) const |
Object * | GetParent () const |
void | SetParent (Object *Parent) |
virtual void | Move (double x, double y, double z=0.) |
bool | SaveChildren (xmlDocPtr xml, xmlNodePtr node) const |
void | SaveId (xmlNodePtr node) const |
xmlNodePtr | GetNodeByProp (xmlNodePtr node, char const *Property, char const *Id) |
xmlNodePtr | GetNextNodeByProp (xmlNodePtr node, char const *Property, char const *Id) |
xmlNodePtr | GetNodeByName (xmlNodePtr node, char const *Name) |
xmlNodePtr | GetNextNodeByName (xmlNodePtr node, char const *Name) |
bool | HasChildren () const |
unsigned | GetChildrenNumber () const |
virtual bool | Build (std::list< Object * > &Children) throw (std::invalid_argument) |
void | EmitSignal (SignalId Signal) |
void | Lock (bool state=true) |
bool | IsLocked () |
Object * | GetFirstLink (std::set< Object * >::iterator &i) |
Object * | GetNextLink (std::set< Object * >::iterator &i) |
void | Link (Object *object) |
void | Unlink (Object *object) |
virtual void | OnUnlink (Object *object) |
void | GetPossibleAncestorTypes (std::set< TypeId > &types) const |
virtual bool | SetProperty (unsigned property, char const *value) |
virtual std::string | GetProperty (unsigned property) const |
void | SetDirty (bool dirty=true) |
std::string | Identity () |
virtual char const * | HasPropertiesDialog () const |
void | ShowPropertiesDialog () |
bool | GetDirty (void) const |
Additional Inherited Members | |
![]() | |
static Molecule * | MoleculeFromFormula (Document *Doc, Formula const &formula, bool add_pseudo=true) |
![]() | |
virtual Dialog * | BuildPropertiesDialog () |
![]() | |
std::list< Cycle * > | m_Cycles |
std::list< Chain * > | m_Chains |
std::list< Atom * > | m_Atoms |
std::list< Bond * > | m_Bonds |
GChemPaint molecule class.
Definition at line 41 of file gcp/molecule.h.
gcp::Molecule::Molecule | ( | gcu::TypeId | Type = gcu::MoleculeType | ) |
The default constructor. Builds a new empty molecule.
Reimplemented from gcu::Molecule.
gcp::Molecule::Molecule | ( | Atom * | pAtom | ) |
pAtom | an atom. |
Constructs a new molecule containing pAtom and all atoms which might be bonded to it, and the corresponding bonds.
|
virtual |
The destructor.
Reimplemented from gcu::Molecule.
|
virtual |
|
virtual |
|
virtual |
object | the object to add to the molecule. |
Adds an object (atom, bond, or fragment) to the molecule.
Reimplemented from gcu::Molecule.
void gcp::Molecule::AddFragment | ( | Fragment * | pFragment | ) |
pFragment | an atoms group. |
Adds a fragment to the molecule.
|
virtual |
UIManager | the GtkUIManager to populate. |
object | the Object on which occured the mouse click. |
x | x coordinate of the mouse click. |
y | y coordinate of the mouse click. |
This method is called to build the contextual menu for the molecule.
Reimplemented from gcu::Object.
void gcp::Molecule::BuildInChI | ( | ) |
Builds the InChI for the molecule.
void gcp::Molecule::BuildOBMol | ( | OpenBabel::OBMol & | Mol | ) |
Mol | the OpenBabel molecule used for export. |
Builds an OpenBabel molecule from this instance. The new molecule is built trying to guess appropriate z coordinates so that stereochemistry is preserved.
void gcp::Molecule::BuildOBMol2D | ( | OpenBabel::OBMol & | Mol | ) |
Mol | the OpenBabel molecule used for export. |
Builds a 2D OpenBabel molecule from this instance.
void gcp::Molecule::BuildSMILES | ( | ) |
Builds the SMILES representation for the molecule and opens a new StringDlg instance displaying it.
void gcp::Molecule::CheckCrossings | ( | Bond * | pBond | ) |
pBond | a bond in the molecule. |
Checks if any other bond in the molecule crosses pBond, and notify both bonds that they are crossing.
|
virtual |
Removes all children from the molecule, resulting in a empty molecule.
Reimplemented from gcu::Molecule.
void gcp::Molecule::ExportToGhemical | ( | ) |
Opens a Ghemical window with a copy of the molecule trying to preserve the stereochemistry as far as possible.
|
inline |
Definition at line 176 of file gcp/molecule.h.
References gcu::Object::GetId().
|
virtual |
x | the x coordinate |
y | the y coordinate |
z | the z coordinate (not used) |
Reimplemented from gcu::Object.
|
virtual |
Reimplemented from gcu::Molecule.
char const* gcp::Molecule::GetInChI | ( | ) |
std::string gcp::Molecule::GetRawFormula | ( | ) | const |
|
virtual |
Used to retrieve the y coordinate for alignment.
Reimplemented from gcu::Object.
|
virtual |
node | a pointer to the xmlNode containing the serialized molecule. |
Used to load a molecule in memory. The Mlecule instance must already exist.
Reimplemented from gcu::Object.
bool gcp::Molecule::Merge | ( | Molecule * | pMolecule, |
bool | RemoveDuplicates = false |
||
) |
pMolecule | a molecule. |
RemoveDuplicates | whether duplicate atoms should be unififed or not. |
Adds all children from pMolecule in this instance, and removes one of the atoms for each pair of duplicates (atoms with same atomic number and position) if RemoveDuplicates is true. This might fail when it would end with hypervalent atoms. On success pMolecule is deleted.
|
virtual |
Updates all cycles after loading.
Reimplemented from gcu::Object.
|
virtual |
Signal | the appropriate SignalId |
Child | the child which emitted the signal or NULL |
Signals the molecule that at least one of its children changed.
Reimplemented from gcu::Object.
void gcp::Molecule::OpenCalc | ( | ) |
Opens GChemCalc with the formula for the molecule. Molecules with fragments are not currently supported.
|
virtual |
pObject | an atom, a bond, or a fragment in the molecule. |
Removes an atom, a bond, or a fragment from a molecule.
Reimplemented from gcu::Molecule.
|
virtual |
xml | the xmlDoc used to save the document. |
Used to save the molecule to the xmlDoc.
Reimplemented from gcu::Object.
void gcp::Molecule::SelectAlignmentItem | ( | gcu::Object * | child | ) |
child | the child used for alignment. |
Selects the child used for alignment, which might be an atom or group of atoms, or a bond. For bonds, the center of the bonds is used, a while for the others a call to their gcu::Object::GetYAlign() method will be used.
void gcp::Molecule::ShowInChI | ( | ) |
Builds the InChI for the molecule if necessary and opens a new StringDlg instance displaying it.
void gcp::Molecule::ShowWebBase | ( | char const * | uri_start, |
char const * | uri_end | ||
) |
uri_start | the first part of the URI to open. |
uri_end | the last part of the URI to open. |
Opens a web browser with an URI constructed from both arguments and the InChI for the molecule ntercalated between uri_start and uri_end.
|
virtual |
m | the Matrix2D of the transformation. |
x | the x component of the center of the transformation. |
y | the y component of the center of the transformation. |
Used to move and/or transform the molecule taking care of hydrogen atoms positions around heteroatoms.
Reimplemented from gcu::Object.