00001
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 #ifndef CLIPPER_MINIMOL
00046 #define CLIPPER_MINIMOL
00047
00048
00049 #include "../core/coords.h"
00050 #include "minimol_data.h"
00051
00052
00053 namespace clipper {
00054
00056 namespace MM {
00057 enum MODE { UNIQUE, ANY };
00058 enum COPY { COPY_NONE, COPY_M, COPY_P, COPY_MP, COPY_C, COPY_MC, COPY_PC, COPY_MPC, MEMBERS=COPY_M, PROPERTIES=COPY_P, CHILDREN=COPY_C };
00059 }
00060
00061
00063
00076 class MAtom : public Atom, public PropertyManager
00077 {
00078 public:
00079 MAtom() {}
00080 MAtom( const clipper::Atom& atom );
00081
00083 const String& id() const { return id_; }
00084 void set_id( const String& s );
00085
00087 String name() const { return id_.substr(0,4); }
00088 void set_name( const String s, const String altconf="" );
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101 const Atom& atom() const { return *this; }
00102 Atom& atom() { return *this; }
00103
00105 MAtom& copy( const MAtom& other, const MM::COPY& mode );
00106
00107 static String id_tidy( const String& id );
00108 static bool id_match( const String& id1, const String& id2, const MM::MODE& mode );
00109 private:
00110 String id_;
00111 };
00112
00114
00129 class MMonomer : public PropertyManager
00130 {
00131 public:
00132 const String& id() const { return id_; }
00133 void set_id( const String& s );
00134
00135 const String& type() const { return type_; }
00136 void set_type( const String& s );
00137
00138 int seqnum() const { return id_.i(); }
00139 void set_seqnum( const int s, const String inscode="" );
00140
00141
00142 Atom_list atom_list() const;
00143 void transform( const RTop_orth rt );
00144
00145 int size() const { return children.size(); }
00147 const MAtom& operator[] ( const int& i ) const { return children[i]; }
00149 MAtom& operator[] ( const int& i ) { return children[i]; }
00151 const MAtom& find( const String& n, const MM::MODE mode=MM::UNIQUE ) const;
00153 MAtom& find( const String& n, const MM::MODE mode=MM::UNIQUE );
00155 MMonomer select( const String& sel, const MM::MODE mode=MM::UNIQUE ) const;
00157 int lookup( const String& str, const MM::MODE& mode ) const;
00158 void insert( const MAtom& add, int pos=-1 );
00159
00161 friend MMonomer operator& ( const MMonomer& m1, const MMonomer& m2 );
00163 friend MMonomer operator| ( const MMonomer& m1, const MMonomer& m2 );
00164
00166 MMonomer& copy( const MMonomer& other, const MM::COPY& mode );
00167
00168 static String id_tidy( const String& id );
00169 static bool id_match( const String& id1, const String& id2, const MM::MODE& mode );
00170
00172 enum TYPE { Default, Dunbrack, Richardson };
00174 void protein_mainchain_build_carbonyl_oxygen( const MMonomer& next );
00176 int protein_sidechain_number_of_rotamers( TYPE t = default_type_ ) const;
00177 int protein_sidechain_number_of_rotomers() const { return protein_sidechain_number_of_rotamers(); }
00179 ftype protein_sidechain_build_rotamer( const int& n, TYPE t = default_type_ );
00180 ftype protein_sidechain_build_rotomer( const int& n ) { return protein_sidechain_build_rotamer( n ); }
00182 static bool protein_peptide_bond( const MMonomer& m1, const MMonomer& m2, ftype r = 1.5 );
00184 static double protein_ramachandran_phi( const MMonomer& m1, const MMonomer& m2 );
00186 static double protein_ramachandran_psi( const MMonomer& m1, const MMonomer& m2 );
00187
00188 static TYPE& default_type() { return default_type_; }
00189 private:
00190 typedef MAtom CHILDTYPE;
00191 std::vector<CHILDTYPE> children;
00192 String id_, type_;
00193 static TYPE default_type_;
00194 static int rotamer_find( String res, int rota, TYPE t );
00195 };
00196
00198
00211 class MPolymer : public PropertyManager
00212 {
00213 public:
00214 const String& id() const { return id_; }
00215 void set_id( const String& s );
00216
00217
00218 Atom_list atom_list() const;
00219 void transform( const RTop_orth rt );
00220
00221 int size() const { return children.size(); }
00223 const MMonomer& operator[] ( const int& i ) const { return children[i]; }
00225 MMonomer& operator[] ( const int& i ) { return children[i]; }
00227 const MMonomer& find( const String& n, const MM::MODE mode=MM::UNIQUE ) const;
00229 MMonomer& find( const String& n, const MM::MODE mode=MM::UNIQUE );
00231 MPolymer select( const String& sel, const MM::MODE mode=MM::UNIQUE ) const;
00233 int lookup( const String& str, const MM::MODE& mode ) const;
00234 void insert( const MMonomer& add, int pos=-1 );
00235
00237 friend MPolymer operator& ( const MPolymer& m1, const MPolymer& m2 );
00239 friend MPolymer operator| ( const MPolymer& m1, const MPolymer& m2 );
00240
00242 MPolymer& copy( const MPolymer& other, const MM::COPY& mode );
00243
00244 static String id_tidy( const String& id );
00245 static bool id_match( const String& id1, const String& id2, const MM::MODE& mode );
00246 private:
00247 typedef MMonomer CHILDTYPE;
00248 std::vector<CHILDTYPE> children;
00249 String id_;
00250 };
00251
00253
00263 class MModel : public PropertyManager
00264 {
00265 public:
00266
00267 Atom_list atom_list() const;
00268 void transform( const RTop_orth rt );
00269
00270 int size() const { return children.size(); }
00272 const MPolymer& operator[] ( const int& i ) const { return children[i]; }
00274 MPolymer& operator[] ( const int& i ) { return children[i]; }
00276 const MPolymer& find( const String& n, const MM::MODE mode=MM::UNIQUE ) const;
00278 MPolymer& find( const String& n, const MM::MODE mode=MM::UNIQUE );
00280 MModel select( const String& sel, const MM::MODE mode=MM::UNIQUE ) const;
00282 int lookup( const String& str, const MM::MODE& mode ) const;
00283 void insert( const MPolymer& add, int pos=-1 );
00284
00286 friend MModel operator& ( const MModel& m1, const MModel& m2 );
00288 friend MModel operator| ( const MModel& m1, const MModel& m2 );
00289
00291 MModel& copy( const MModel& other, const MM::COPY& mode );
00292 private:
00293 typedef MPolymer CHILDTYPE;
00294 std::vector<CHILDTYPE> children;
00295 };
00296
00298
00304 class MiniMol : public MModel
00305 {
00306 public:
00307 enum MODE { UNIQUE, ANY };
00308
00310 MiniMol();
00312 MiniMol( const Spacegroup& spacegroup, const Cell& cell );
00314 void init( const Spacegroup& spacegroup, const Cell& cell );
00316 const Cell& cell() const { return cell_; }
00318 const Spacegroup& spacegroup() const { return spacegroup_; }
00319 const MModel& model() const { return *this; }
00320 MModel& model() { return *this; }
00321
00322 bool is_null() const;
00323 private:
00324 Spacegroup spacegroup_;
00325 Cell cell_;
00326 };
00327
00329 typedef MMonomer MResidue;
00330
00332 typedef MPolymer MChain;
00333
00334
00335 }
00336
00337 #endif
00338