The Gnome Chemistry Utils  0.14.0
Public Member Functions | List of all members
gcp::Molecule Class Reference

GChemPaint molecule class. More...

#include <gcp/molecule.h>

Inheritance diagram for gcp::Molecule:
gcugtk::Molecule gcu::Molecule gcu::Object

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)
ObjectGetAtomAt (double x, double y, double z=0.)
double GetYAlign ()
bool BuildContextualMenu (gcu::UIManager *UIManager, gcu::Object *object, double x, double y)
bool OnSignal (gcu::SignalId Signal, gcu::Object *Child)
void SelectAlignmentItem (gcu::Object *child)
std::string GetAlignmentId ()
void OpenCalc ()
void CheckCrossings (Bond *pBond)
std::string GetRawFormula () const
void OnLoaded ()
unsigned GetAtomsNumber () const
double GetMeanBondLength () const
void AddChiralAtom (Atom *atom)
bool AtomIsChiral (Atom *atom) const
- Public Member Functions inherited from gcugtk::Molecule
 Molecule (gcu::TypeId Type=gcu::MoleculeType, gcu::ContentType ct=gcu::ContentType3D)
 Molecule (gcu::Atom *pAtom, gcu::ContentType ct=gcu::ContentType3D)
void BuildDatabasesMenu (GtkUIManager *UIManager, char const *path, char const *path_end)
- Public Member Functions inherited from gcu::Molecule
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 ()
void ResetIndentifiers ()
std::string const & GetCML ()
void ClearCycles ()
std::string const & GetInChI ()
std::string const & GetInChIKey ()
std::string const & GetSMILES ()
- Public Member Functions inherited from gcu::Object
 Object (TypeId Id=OtherType)
virtual ~Object ()
TypeId GetType () const
void SetId (gchar const *Id)
char const * GetId () const
ObjectGetMolecule () const
ObjectGetReaction () const
ObjectGetGroup () const
DocumentGetDocument () const
ApplicationGetApplication () const
ObjectGetParentOfType (TypeId Id) const
ObjectGetChild (const gchar *Id) const
ObjectGetFirstChild (std::map< std::string, Object * >::iterator &i)
ObjectGetNextChild (std::map< std::string, Object * >::iterator &i)
ObjectGetDescendant (const char *Id) const
ObjectGetParent () const
void SetParent (Object *Parent)
virtual bool GetCoords (double *x, double *y, double *z=NULL) const
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::set< Object * > const &Children) throw (std::invalid_argument)
void EmitSignal (SignalId Signal)
void Lock (bool state=true)
bool IsLocked ()
ObjectGetFirstLink (std::set< Object * >::iterator &i)
ObjectGetNextLink (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
virtual bool CanSelect () const
virtual void NotifyEmpty ()
void ShowPropertiesDialog ()
bool GetDirty (void) const

Additional Inherited Members

- Static Public Member Functions inherited from gcu::Molecule
static MoleculeMoleculeFromFormula (Document *Doc, Formula const &formula, bool add_pseudo=true)
- Protected Member Functions inherited from gcu::Object
virtual DialogBuildPropertiesDialog ()
- Protected Attributes inherited from gcu::Molecule
std::list< Cycle * > m_Cycles
std::list< Chain * > m_Chains
std::list< Atom * > m_Atoms
std::list< Bond * > m_Bonds

Detailed Description

GChemPaint molecule class.

Definition at line 45 of file gcp/molecule.h.

Constructor & Destructor Documentation

gcp::Molecule::Molecule ( gcu::TypeId  Type = gcu::MoleculeType)

The default constructor. Builds a new empty molecule.

gcp::Molecule::Molecule ( Atom pAtom)
Parameters
pAtoman atom.

Constructs a new molecule containing pAtom and all atoms which might be bonded to it, and the corresponding bonds.

virtual gcp::Molecule::~Molecule ( )
virtual

The destructor.

Reimplemented from gcugtk::Molecule.

Member Function Documentation

void gcp::Molecule::AddAtom ( gcu::Atom pAtom)
virtual
Parameters
pAtoman atom.

Adds an atom to the molecule.

Reimplemented from gcu::Molecule.

void gcp::Molecule::AddBond ( gcu::Bond pBond)
virtual
Parameters
pBonda bond.

Adds a bond to the molecule.

Reimplemented from gcu::Molecule.

void gcp::Molecule::AddChild ( gcu::Object object)
virtual
Parameters
objectthe object to add to the molecule.

Adds an object (atom, bond, or fragment) to the molecule.

Reimplemented from gcu::Molecule.

void gcp::Molecule::AddChiralAtom ( Atom atom)
inline
Parameters
atoma chiral atom

Adds atom to the list of chiral atoms.

Definition at line 214 of file gcp/molecule.h.

void gcp::Molecule::AddFragment ( Fragment pFragment)
Parameters
pFragmentan atoms group.

Adds a fragment to the molecule.

bool gcp::Molecule::AtomIsChiral ( Atom atom) const
Parameters
atoman atom
Returns
true if atom is a chirality center.
bool gcp::Molecule::BuildContextualMenu ( gcu::UIManager UIManager,
gcu::Object object,
double  x,
double  y 
)
virtual
Parameters
UIManagerthe gcu::UIManager to populate.
objectthe Object on which occured the mouse click.
xx coordinate of the mouse click.
yy coordinate of the mouse click.

This method is called to build the contextual menu for the molecule.

Returns
true if something is added to the UIManager, false otherwise.

Reimplemented from gcu::Object.

void gcp::Molecule::CheckCrossings ( Bond pBond)
Parameters
pBonda bond in the molecule.

Checks if any other bond in the molecule crosses pBond, and notify both bonds that they are crossing.

void gcp::Molecule::Clear ( )
virtual

Removes all children from the molecule, resulting in a empty molecule.

Reimplemented from gcu::Molecule.

std::string gcp::Molecule::GetAlignmentId ( )
inline
Returns
the id string of the child used for alignment if any, or an empty string.

Definition at line 176 of file gcp/molecule.h.

References gcu::Object::GetId().

Object* gcp::Molecule::GetAtomAt ( double  x,
double  y,
double  z = 0. 
)
virtual
Parameters
xthe x coordinate
ythe y coordinate
zthe z coordinate (not used)
Returns
a pointer to n atom at or near position defined by the coordinates passed as parameters or NULL if none is found in the molecule.

Reimplemented from gcu::Object.

unsigned gcp::Molecule::GetAtomsNumber ( ) const
virtual
Returns
the number of atoms in the molecule. Atoms groups are counted for one only, whatever their real atomic composition.

Reimplemented from gcu::Molecule.

double gcp::Molecule::GetMeanBondLength ( ) const
Returns
the mean of the bond lengths for the molecule.
std::string gcp::Molecule::GetRawFormula ( ) const
virtual
Returns
the raw formula as a string. Molecules with fragments are not currently supported.

Reimplemented from gcu::Molecule.

double gcp::Molecule::GetYAlign ( )
virtual

Used to retrieve the y coordinate for alignment.

Returns
y coordinate used for the molecule alignment.

Reimplemented from gcu::Object.

bool gcp::Molecule::Load ( xmlNodePtr  node)
virtual
Parameters
nodea pointer to the xmlNode containing the serialized molecule.

Used to load a molecule in memory. The Mlecule instance must already exist.

Returns
true on succes, false otherwise.

Reimplemented from gcu::Object.

bool gcp::Molecule::Merge ( Molecule pMolecule,
bool  RemoveDuplicates = false 
)
Parameters
pMoleculea molecule.
RemoveDuplicateswhether 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.

Returns
true on success, false otherwise.
void gcp::Molecule::OnLoaded ( )
virtual

Updates all cycles after loading.

Reimplemented from gcu::Object.

bool gcp::Molecule::OnSignal ( gcu::SignalId  Signal,
gcu::Object Child 
)
virtual
Parameters
Signalthe appropriate SignalId
Childthe child which emitted the signal or NULL

Signals the molecule that at least one of its children changed.

Returns
true to propagate the signal to the parent.

Reimplemented from gcu::Object.

void gcp::Molecule::OpenCalc ( )

Opens GChemCalc with the formula for the molecule. Molecules with fragments are not currently supported.

void gcp::Molecule::Remove ( gcu::Object pObject)
virtual
Parameters
pObjectan atom, a bond, or a fragment in the molecule.

Removes an atom, a bond, or a fragment from a molecule.

Reimplemented from gcu::Molecule.

xmlNodePtr gcp::Molecule::Save ( xmlDocPtr  xml) const
virtual
Parameters
xmlthe xmlDoc used to save the document.

Used to save the molecule to the xmlDoc.

Returns
the xmlNode containing the serialized molecule.

Reimplemented from gcu::Object.

void gcp::Molecule::SelectAlignmentItem ( gcu::Object child)
Parameters
childthe 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::Transform2D ( gcu::Matrix2D m,
double  x,
double  y 
)
virtual
Parameters
mthe Matrix2D of the transformation.
xthe x component of the center of the transformation.
ythe 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.


The documentation for this class was generated from the following file: