The Gnome Chemistry Utils  0.14.0
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
gcu::Molecule Class Reference

#include <gcu/molecule.h>

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

Public Member Functions

 Molecule (TypeId Type=MoleculeType, ContentType ct=ContentType3D)
 Molecule (Atom *pAtom, ContentType ct=ContentType3D)
virtual ~Molecule ()
void AddChild (Object *object)
virtual void AddAtom (Atom *pAtom)
virtual void AddBond (Bond *pBond)
virtual void Remove (gcu::Object *pObject)
void UpdateCycles (Bond *pBond)
void UpdateCycles ()
bool operator== (Molecule const &molecule) const
virtual unsigned GetAtomsNumber () const
void Clear ()
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 ()
virtual std::string GetRawFormula () const
- 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 xmlNodePtr Save (xmlDocPtr xml) const
virtual bool Load (xmlNodePtr node)
virtual bool GetCoords (double *x, double *y, double *z=NULL) const
virtual void Move (double x, double y, double z=0.)
virtual void Transform2D (Matrix2D &m, double x, double y)
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 ObjectGetAtomAt (double x, double y, double z=0.)
virtual bool Build (std::set< Object * > const &Children) throw (std::invalid_argument)
virtual double GetYAlign ()
virtual bool BuildContextualMenu (UIManager *uim, Object *object, double x, double y)
void EmitSignal (SignalId Signal)
virtual bool OnSignal (SignalId Signal, Object *Child)
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
virtual void OnLoaded ()
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

Static Public Member Functions

static MoleculeMoleculeFromFormula (Document *Doc, Formula const &formula, bool add_pseudo=true)
- Static Public Member Functions inherited from gcu::Object
static TypeId AddType (std::string TypeName, Object *(*CreateFunc)(), TypeId id=OtherType)
static void AddAlias (TypeId id, std::string TypeName)
static ObjectCreateObject (const std::string &TypeName, Object *parent=NULL)
static TypeId GetTypeId (const std::string &Name)
static std::string GetTypeName (TypeId Id)
static void AddMenuCallback (TypeId Id, BuildMenuCb cb)
static void AddRule (TypeId type1, RuleId rule, TypeId type2)
static void AddRule (const std::string &type1, RuleId rule, const std::string &type2)
static const std::set< TypeId > & GetRules (TypeId type, RuleId rule)
static const std::set< TypeId > & GetRules (const std::string &type, RuleId rule)
static void SetCreationLabel (TypeId Id, std::string Label)
static const std::string & GetCreationLabel (TypeId Id)
static const std::string & GetCreationLabel (const std::string &TypeName)
static SignalId CreateNewSignalId ()

Protected Attributes

std::list< Cycle * > m_Cycles
std::list< Chain * > m_Chains
std::list< Atom * > m_Atoms
std::list< Bond * > m_Bonds

Additional Inherited Members

- Protected Member Functions inherited from gcu::Object
virtual DialogBuildPropertiesDialog ()

Detailed Description

Represents molecules.

Definition at line 43 of file gcu/molecule.h.

Constructor & Destructor Documentation

gcu::Molecule::Molecule ( TypeId  Type = MoleculeType,
ContentType  ct = ContentType3D 
)
Parameters
Typethe type id of a derived class
ctthe content type for the molecule (2d or 3d), defaults to ContentType3D.

The constructor. The type id may be changed in derived classes, otherwise the argument is not needed, since the default value is enough.

Reimplemented in gcugtk::Molecule.

gcu::Molecule::Molecule ( Atom pAtom,
ContentType  ct = ContentType3D 
)
Parameters
pAtom
ctthe content type for the molecule (2d or 3d), defaults to ContentType3D.

Builds a molecule from an atom. If the atom has bonds, the connectivity will be explored and all atoms and bonds found will be added to the molecule.

Reimplemented in gcugtk::Molecule.

virtual gcu::Molecule::~Molecule ( )
virtual

The destructor.

Reimplemented in gcp::Molecule, and gcugtk::Molecule.

Member Function Documentation

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

Adds an atom to the molecule.

Reimplemented in gcp::Molecule.

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

Adds a bond to the molecule.

Reimplemented in gcp::Molecule.

void gcu::Molecule::AddChild ( Object object)
virtual
Parameters
objectan object, generally an atom or a bond.

Adds an object (which might be an atom or a bond) to the molecule.

Reimplemented from gcu::Object.

Reimplemented in gcp::Molecule.

void gcu::Molecule::Clear ( )
virtual

Clears cycles and chains and call gcu::Object::Clear().

Reimplemented from gcu::Object.

Reimplemented in gcp::Molecule.

void gcu::Molecule::ClearCycles ( )

Clears all information related to cycles.

virtual unsigned gcu::Molecule::GetAtomsNumber ( ) const
inlinevirtual
Returns
the number of atoms in the molecule.

Reimplemented in gcp::Molecule.

Definition at line 113 of file gcu/molecule.h.

References m_Atoms.

Referenced by gcu::Chem3dDoc::IsEmpty().

std::string const& gcu::Molecule::GetCML ( )
Returns
a CML representation of the molecule.
Atom const* gcu::Molecule::GetFirstAtom ( std::list< Atom * >::const_iterator &  i) const
Parameters
ian uninitialized iterator.
Returns
the first atom of the molecule.
Bond const* gcu::Molecule::GetFirstBond ( std::list< Bond * >::const_iterator &  i) const
Parameters
ian uninitialized iterator.
Returns
the first bond of the molecule.
std::string const& gcu::Molecule::GetInChI ( )
Returns
the InChI.
std::string const& gcu::Molecule::GetInChIKey ( )
Returns
the InChIKey.
char const* gcu::Molecule::GetName ( char const *  convention = NULL)
Parameters
conventiona naming convention.
Returns
the molecule name using convention if known.
Atom const* gcu::Molecule::GetNextAtom ( std::list< Atom * >::const_iterator &  i) const
Parameters
ian iterator initialized by a call to GetFirstAtom().
Returns
the next atom of the molecule or NULL if all atoms have been previously returned.
Bond const* gcu::Molecule::GetNextBond ( std::list< Bond * >::const_iterator &  i) const
Parameters
ian iterator initialized by a call to GetFirstBond().
Returns
the next bond of the molecule or NULL if all bonds have been previously returned.
virtual std::string gcu::Molecule::GetRawFormula ( ) const
virtual
Returns
the raw formula as a string.

Reimplemented in gcp::Molecule.

std::string const& gcu::Molecule::GetSMILES ( )
Returns
the canonical SMILES for the molecule.
static Molecule* gcu::Molecule::MoleculeFromFormula ( Document Doc,
Formula const &  formula,
bool  add_pseudo = true 
)
static
Parameters
Doca document.
formulaa formula
add_pseudotells if a pseudo atom (with Z = 0) has to be added (used when building a gcu::Residue instance).

Tries to build a molecule from a formula, adding bonds between atoms. Atoms coordinates are not calculated.

Returns
a molecule on success or NULL.
std::string gcu::Molecule::Name ( )
virtual
Returns
the localized object generic name.

Reimplemented from gcu::Object.

bool gcu::Molecule::operator== ( Molecule const &  molecule) const
Parameters
moleculea molecule.
Returns
true if the molecules have identical atoms and the connection framework between the atoms.
virtual void gcu::Molecule::Remove ( gcu::Object pObject)
virtual
Parameters
pObjectan atom or a bond in the molecule.

Removes an atom or a bond from a molecule.

Reimplemented in gcp::Molecule.

void gcu::Molecule::ResetIndentifiers ( )

Reinitialize all chemical identifiers for the molecule (InChI, InChIKey, and SMILES

void gcu::Molecule::SetName ( char const *  name,
char const *  convention 
)
Returns
the localized object generic name.
Parameters
namea name.
conventiona naming convention, might be NULL.

Adds a molecule name following convention. Only one name can be stored for a given convention.

void gcu::Molecule::UpdateCycles ( Bond pBond)
Parameters
pBonda bond in the molecule.

Updates the cycles list after a change, starting the exploration from pBond.

void gcu::Molecule::UpdateCycles ( )

Updates the cycles list after a change.

Member Data Documentation

std::list<Atom*> gcu::Molecule::m_Atoms
protected

The atoms in the molecule.

Definition at line 224 of file gcu/molecule.h.

Referenced by GetAtomsNumber().

std::list<Bond*> gcu::Molecule::m_Bonds
protected

The bonds in the molecule.

Definition at line 228 of file gcu/molecule.h.

std::list<Chain*> gcu::Molecule::m_Chains
protected

The non cyclic chains contained in the molecules (not used at the moment).

Definition at line 220 of file gcu/molecule.h.

std::list<Cycle*> gcu::Molecule::m_Cycles
protected

The cycles contained in the molecules.

Definition at line 216 of file gcu/molecule.h.


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