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_PDBSTRUCT_H 00019 00020 #define OC_PDBSTRUCT_H 00021 #include <vector> 00022 #include <string> 00023 #include <fstream> 00024 #include <sstream> 00025 // 00026 // 00027 #include "fragmentDataBase.h" 00028 00029 class PDBelement{ 00030 00031 public: 00032 //-------------------------------------------------------------// 00033 // Public Method : constructor 00034 //-------------------------------------------------------------// 00035 // 00037 PDBelement (); 00038 //-------------------------------------------------------------// 00039 // Public Method : destructor 00040 //-------------------------------------------------------------// 00041 ~PDBelement (); 00043 void readAtom(std::stringstream & sline) ; 00045 void readConnection(std::stringstream & sline) ; 00047 inline std::string & getAtomName() 00048 {return _atomName ;} ; 00049 inline std::string getAtomName() const 00050 {return _atomName ;} ; 00052 inline std::string getResiduName() const 00053 {return _residuName ;} ; 00054 inline int & numInMolecule() 00055 {return _numInMolecule;} ; 00056 inline int numInMolecule() const 00057 {return _numInMolecule ;} ; 00058 int number() const 00059 {return _numInMolecule ;} 00060 // 00061 int getFragmentNumber() 00062 {return _numResiduInMolecule ;} 00063 // 00064 int numberOfResidu() const 00065 { return _numResiduInMolecule ;} 00066 // 00067 double dist2To(const double *xyz ){ 00068 return (_xyz[0] - xyz[0])*(_xyz[0] - xyz[0]) + (_xyz[1] - xyz[1])*(_xyz[1] - xyz[1]) 00069 + (_xyz[2] - xyz[2])*(_xyz[2] - xyz[2]); 00070 } 00071 double* pos() 00072 { return _xyz ; } 00073 // 00074 void copy(const PDBelement &) ; 00075 // 00076 void addXYZ(const double pas[3]) 00077 { _xyz[0] += pas[0] ; _xyz[1] += pas[1] ;_xyz[2] += pas[2] ;} 00078 // 00079 // 00080 // 00081 //-------------------------------------------------------------// 00082 // Public Data : 00083 //-------------------------------------------------------------// 00084 int _numInMolecule ; 00085 int _numInResidu ; 00086 int _numInFragment ; 00087 int _numResiduInMolecule ; 00088 double _xyz[3] ; 00089 std::vector<int> _connection ; 00090 std::string _residuName ; 00091 std::string _atomName ; 00092 std::string _fragName ; 00093 } ; 00094 00095 00096 00097 class PDBstructure { 00098 00099 public: 00100 // 00101 typedef PDBelement TelementBase ; 00102 // 00103 // 00104 PDBstructure() ; 00105 PDBstructure(const int size) ; 00106 ~PDBstructure() ; 00107 // 00108 bool readPDBFile(std::ifstream & data) ; 00109 void writeQCIFile(std::ofstream & out) ; 00110 void writeXYZFile(std::ofstream & out) ; 00111 void writeXYZFileForAtoms(std::ofstream & out, std::vector<int> & index) ; 00112 void writePDBFileForAtoms(std::ofstream & out, std::vector<int> & index) ; 00113 // 00114 bool setFragName(FragmentsDataBase& base) ; 00115 bool setFragName(FragmentsDataBase& base, const std::string &type) ; 00116 // 00117 std::string getNumberInString(const int numResiduInMolecule) ; 00118 // 00119 // 00120 void swap(const int i, const int j) ; 00121 void findMinMax(double *atomMin , double * atomMax ) ; 00122 void buildGravityCenter(double *G ) ; 00123 00124 // 00125 std::string getAtomName(const int i) const 00126 {return _atoms[i]._atomName ;} 00127 // 00128 // 00129 int numberOfAtoms() const 00130 { return _numberOfAtoms ;} 00131 // 00132 int & numberOfAtoms() 00133 { return _numberOfAtoms ;} 00134 // 00135 int numberOfResidus() const 00136 { return _numberOfResidus ;} 00137 // 00138 int & numberOfResidus() 00139 { return _numberOfResidus ;} 00140 // 00141 int numberOfFragments() const 00142 { return _numberOfFragments ;} 00143 // 00144 int & numberOfFragments() 00145 { return _numberOfFragments ;} 00146 // 00147 std::string fragmentName(const int i) const 00148 {return _atoms[i]._fragName ;} 00149 // 00150 std::string& fragmentName(const int i) 00151 {return _atoms[i]._fragName ;} 00152 00153 PDBelement getElement(const int i) const 00154 { return this->_atoms[i] ; } 00155 // 00156 PDBelement& getElement(const int i) 00157 { return this->_atoms[i] ; } 00158 // 00159 // 00160 //-------------------------------------------------------------// 00161 // Public Data : 00162 //-------------------------------------------------------------// 00163 protected: 00164 // 00165 int _systemCharge ; 00166 int _spinMultiplicity ; 00167 // 00168 int _numberOfAtoms ; 00169 int _numberOfResidus ; 00170 int _numberOfFragments ; 00171 PDBelement *_atoms ; 00172 00173 } ; 00174 00175 #endif