spectrophore.h
Go to the documentation of this file.
00001 /**********************************************************************
00002 Spectrophore.h - Spectrophore(TM) calculator.
00003                  Declarations of OBSpectrophore
00004 
00005 Copyright (C) 2005-2010 by Silicos NV
00006 
00007 This file is part of the Open Babel project.
00008 For more information, see <http://openbabel.org/>
00009 
00010 This program is free software; you can redistribute it and/or modify
00011 it under the terms of the GNU General Public License as published by
00012 the Free Software Foundation version 2 of the License.
00013 
00014 The algorithm in this software has been covered by patent WO2009146735.
00015 However, Silicos NV and the inventors of the above mentioned patent assure
00016 that no patent infringment claims will be issued against individuals or
00017 institutions that use this software under the GNU General Public License.
00018 
00019 This program is distributed in the hope that it will be useful,
00020 but WITHOUT ANY WARRANTY; without even the implied warranty of
00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022 GNU General Public License for more details.
00023 ***********************************************************************/
00024 
00025 
00026 #ifndef OB_SPECTROPHORE_H
00027 #define OB_SPECTROPHORE_H
00028 
00029 
00040 #include <set>
00041 #include <openbabel/mol.h>
00042 
00043 
00044 #define MIN(x, y) (((x) < (y)) ? (x) : (y))
00045 #define MAX(x, y) (((x) > (y)) ? (x) : (y))
00046 #define N_PROPERTIES 4
00047 
00048 
00049 
00050 namespace OpenBabel
00051 {
00052 
00302    class OBAPI OBSpectrophore
00303    {
00304       public:
00305 
00308          enum AccuracyOption {AngStepSize1,
00309                               AngStepSize2,
00310                               AngStepSize5,
00311                               AngStepSize10,
00312                               AngStepSize15,
00313                               AngStepSize20,
00314                               AngStepSize30,
00315                               AngStepSize36,
00316                               AngStepSize45,
00317                               AngStepSize60};
00318 
00321          enum NormalizationOption {NoNormalization,
00322                                    NormalizationTowardsZeroMean,
00323                                    NormalizationTowardsUnitStd,
00324                                    NormalizationTowardsZeroMeanAndUnitStd};
00325 
00328          enum StereoOption {NoStereoSpecificProbes,
00329                             UniqueStereoSpecificProbes,
00330                             MirrorStereoSpecificProbes,
00331                             AllStereoSpecificProbes};
00332 
00334 
00339          OBSpectrophore(void);
00340 
00346          OBSpectrophore(const OBSpectrophore& sphore);
00347 
00350          virtual ~OBSpectrophore(void);
00352 
00361          OBSpectrophore& operator=(const OBSpectrophore& sphore);
00363 
00382          void SetResolution(const double r = 3.0);
00383 
00412          void SetAccuracy(const AccuracyOption a = AngStepSize20);
00413 
00436          void SetStereo(const StereoOption s = NoStereoSpecificProbes);
00437 
00455          void SetNormalization(const NormalizationOption n = NoNormalization);
00457 
00468          AccuracyOption GetAccuracy(void) const;
00469 
00474          double GetResolution(void) const;
00475 
00486          StereoOption GetStereo(void) const;
00487 
00498          NormalizationOption GetNormalization(void) const;
00499 
00547          std::vector<double> GetSpectrophore(OpenBabel::OBMol* mol);
00549 
00550 
00551       protected:
00552 
00554          double               _resolution;
00555          AccuracyOption       _accuracy;
00556          StereoOption         _stereoFlag;
00557          NormalizationOption  _normalization;
00558          std::vector<int>     _rotationStepList;
00559          unsigned int         _nAtoms;
00560          double**             _property;
00561          double*              _radii;
00562          double**             _oricoor;
00563          double**             _coor;
00564          unsigned int         _beginProbe;
00565          unsigned int         _endProbe;
00566          unsigned int         _numberOfProbes;
00567          std::vector<double>  _spectro;
00568          struct
00569          {
00570             int value[12];
00571          }                    _probe[48];
00572          struct
00573          {
00574             double x;
00575             double y;
00576             double z;
00577             double v[N_PROPERTIES];
00578          }                    _boxPoint[12];
00580 
00582          void _getMoleculeData(OpenBabel::OBMol*);
00583          void _orient(void);
00584          void _getBox(double**);
00585          void _setBox(void);
00586          void _getEnergies(double**, double*);
00587          void _initiateSpectrophore(double*, double*);
00588          void _rotateX(double**, double**, const double, const double);
00589          void _rotateY(double**, double**, const double, const double);
00590          void _rotateZ(double**, double**, const double, const double);
00591          void _updateSpectrophore(double*, double*);
00592          void _calculateProperties(OpenBabel::OBMol*);
00593          void _solveMatrix(double**, double*, unsigned int);
00594          void _luDecompose(double**, std::vector<int>&, unsigned int);
00595          void _luSolve(double**, std::vector<int>&, double*, unsigned int);
00596          void _swapRows(double*, unsigned int, unsigned int);
00597          void _swapRows(double**, unsigned int, unsigned int, unsigned int);
00599 
00600    };
00601 
00602 } // end namespace OpenBabel
00603 
00604 
00605 #endif   //OB_SPECTROPHORE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines