Generated on Wed Apr 29 2015 11:51:40 for GGL-4.1.2 by doxygen 1.8.3.1
MoleculeOB.hh
Go to the documentation of this file.
1 #ifndef GGL_CHEM_MOLECULEOB_HH_
2 #define GGL_CHEM_MOLECULEOB_HH_
3 
4 
5 #include <openbabel/babelconfig.h>
6 #include <openbabel/mol.h>
7 
8 
9 #include <sstream>
10 #include <iostream>
11 #include <limits>
12 
13 #include "ggl/chem/Molecule.hh"
14 
15 
16 namespace ggl {
17 namespace chem {
18 
19 
20  /*! @brief OpenBabel molecule object port
21  *
22  * Wrapper class around an OpenBabel molecule object (OBMol).
23  *
24  * It utilizes the OpenBabel library (http://openbabel.org) for the
25  * conversion.
26  *
27  * @author Martin Mann (c) 2009 http://www.bioinf.uni-freiburg.de/~mmann/
28  *
29  */
30  class MoleculeOB
31  {
32  protected:
33 
34  //! current molecule working on
35  OpenBabel::OBMol curMol;
36 
37  public:
38 
39  /*! Construction
40  *
41  * NOTE: the protons of the molecule are removed during construction.
42  *
43  * @param mol the molecule to be represented by this object
44  */
45  MoleculeOB( const ggl::chem::Molecule & mol );
46 
47  /*! Access to the molar mass of the molecule
48  *
49  * @param implicitH flag whether hydrogens should be added implicitly by openbabel or not
50  *
51  * @return the standard molar mass given by IUPAC atomic masses (amu)
52  */
53  double
54  getMolWeight( const bool implicitH = true );
55 
56  /*! Access to the complete energy of the molecule, calculated via force field methods
57  *
58  * In error case (e.g. force field not loadable) NaN is returned.
59  *
60  * @return the complete energy of this molecule (in kJ/mol)
61  */
62  double
63  getMolEnergy();
64 
65 
66  /**
67  * Converts a Molecule into an OpenBabel molecule instance.
68  *
69  * NOTE: conversion is done via CML encoding and thus currently
70  * inefficient.
71  *
72  * @param mol the molecule to convert
73  * @return the according OBMol instance
74  */
75  static
76  OpenBabel::OBMol
77  convert( const Molecule & mol );
78 
79 
80  /**
81  * Converts an OpenBabel molecule object into a Molecule instance.
82  *
83  * NOTE: only atom label and formal charge are considered for each
84  * atom.
85  *
86  * @param mol the molecule to convert
87  * @return the according Molecule instance
88  */
89  static
90  Molecule
91  convert( const OpenBabel::OBMol & mol );
92 
93  };
94 
95 } // namespace chem
96 } // namespace ggl
97 
98  // include function bodies
99 #include "ggl/chem/MoleculeOB.icc"
100 
101 
102 #endif /*GGL_CHEM_MOLECULEOB_HH_*/