tools.h

Go to the documentation of this file.
00001 // This is a -*- C++ -*-  file
00002 //------------------------------------------------------------------------------------//
00003 //                                                                                    //
00004 //   Copyright (c) 2001                                                               //
00005 //      INRIA                                                                         //
00006 //      54600 VILLERS LES NANCY                                                       //
00007 //      France                                                                        //
00008 //                                                                                    //
00009 //------------------------------------------------------------------------------------//
00010 //                                                                                    //
00011 //                 * NOTICE OF PROPRIETARY INFORMATION *                              //
00012 //                                                                                    //
00013 // The information contained in this file is considered proprietary and the exclusive //
00014 // property of  INRIA. This information may not be disclosed, duplicated              //
00015 // or used, in whole or in part, for  any purpose  whatsoever without express written //
00016 // authorization from INRIA                                                           //
00017 //
00018 #ifndef OC_TOOLS_H
00019 
00020 #define OC_TOOLS_H
00021 //
00022 #include <vector>
00023 #include  <cmath>
00024 //
00025 #include "Atoms.h"
00026 
00027 bool skipString(std::ifstream &data, const std::string &keyword) ;
00028 
00029 int  giveNumberOfOA(const std::string & atom) ;
00030 
00031 inline std::string convertToString(const int n){
00032   std::stringstream  s ;
00033   std::string        sn ;
00034   s << n ; s >> sn ;
00035   return sn ; 
00036 }
00037 inline int posAtomInString(std::string &atomName)
00038 {
00039   int pos = 0 ;
00040   std::stringstream s ; int val = -1;
00041   s << atomName[0] ; s >> val ;
00042   if( val >= 0 && val <= 9 ) 
00043     {pos = 1; }
00044 
00045   return pos ;
00046 }
00047 
00048 void renumLinear(setOfAtoms   & atomsSet, std::vector<int>& newNumerotation ) ;
00049 //
00050 //
00051 //
00052 template <typename SETOFATOMS>
00053 void buildInnerReperOfMolecule(SETOFATOMS   & atomsSet, double *gravityCenter,
00054                                double *axe1, double *axe2, double *axe3) ;
00055  
00056 template <typename SETOFATOMS>
00057 void projectAtomsOnReper(SETOFATOMS & atoms, double* gravityCenter, double* axe1, double* axe2, double* axe3);
00058 
00059 void sortInFirstDimension(setOfAtoms& atoms, std::vector<int>&  newNum) ;
00060 
00061 void readPartitionAndSetColor(std::ifstream& part, std::vector<std::string>& color) ;
00062 
00063 //double  distanceToBox(double * atomMin, double * atomMax, double * minNSD1, double * maxNSD1) ;
00064 
00065 inline double distance(double * P1, double * P2 )
00066 {
00067   double dist  ;
00068   dist = 0.0 ;
00069   for( int i = 0 ; i < 3 ; ++i) { 
00070     dist += (P1[i] - P2[i])* (P1[i] - P2[i]) ;}
00071   return sqrt(dist) ;
00072 }
00073 #endif
00074  

Generated on Sat Jan 28 21:07:30 2006 for QC++ by  doxygen 1.4.4