00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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
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