00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef OC_NEWTOOLS_H
00019
00020 #define OC_NEWTOOLS_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
00049 void renumLinear(setOfAtoms & atomsSet, std::vector<int>& newNumerotation ) ;
00050
00051
00052
00053
00054 void sortInFirstDimension(setOfAtoms& atoms, std::vector<int>& newNum) ;
00055
00056 void readPartitionAndSetColor(std::ifstream& part, std::vector<std::string>& color) ;
00057
00058
00059 inline double distance(double * P1, double * P2 )
00060 {
00061 double dist ;
00062 dist = 0.0 ;
00063 for( int i = 0 ; i < 3 ; ++i) {
00064 dist += (P1[i] - P2[i])* (P1[i] - P2[i]) ;}
00065 return sqrt(dist) ;
00066 }
00067 #endif
00068