Go to the documentation of this file.00001
00002
00003
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 #ifndef ESBTL_BUILDER_H
00036 #define ESBTL_BUILDER_H
00037 #include <iostream>
00038
00039 namespace ESBTL {
00040
00045 template<class System>
00046 class All_atom_system_builder{
00047
00048 public:
00052 typedef std::vector <System> System_container;
00053 private:
00054 int current_model;
00055 System_container& systems_;
00056 bool prebuilt_systems;
00057 unsigned max_systems;
00058 public:
00059
00060
00068 All_atom_system_builder(System_container& systems,unsigned max_systems_):
00069 current_model(1),systems_(systems),prebuilt_systems(true),max_systems(max_systems_){
00070 if (systems_.capacity()<max_systems)
00071 systems_.reserve(max_systems);
00072
00073 for (unsigned i=0;i<max_systems;++i) systems_.push_back(System(i+1));
00074 }
00075
00076
00078 template<class Line_format>
00079 void print_line(const Line_format& line_format,const std::string& line){
00080 std::cout << "[" << line_format.get_record_name(line) << "]" ;
00081 std::cout << "[" << line_format.get_atom_serial_number(line) << "]" ;
00082 std::cout << "[" << line_format.get_atom_name(line) << "]" ;
00083 std::cout << "[" << line_format.get_alternate_location(line) << "]" ;
00084 std::cout << "[" << line_format.get_residue_name(line) << "]" ;
00085 std::cout << "[" << line_format.get_chain_identifier(line) << "]" ;
00086 std::cout << "[" << line_format.get_residue_sequence_number(line) << "]" ;
00087 std::cout << "[" << line_format.get_insertion_code(line) << "]" ;
00088 std::cout << "[" << line_format.get_x(line) << "]" ;
00089 std::cout << "[" << line_format.get_y(line) << "]" ;
00090 std::cout << "[" << line_format.get_z(line) << "]" ;
00091 std::cout << "[" << line_format.get_occupancy(line) << "]" ;
00092 std::cout << "[" << line_format.get_temperature_factor(line) << "]" ;
00093 std::cout << "[" << line_format.get_element(line) << "]" ;
00094 std::cout << "[" << line_format.get_charge(line) << "]" ;
00095 }
00097
00105 template<class Line_format>
00106 void interpret_line(const Line_format& line_format,const std::string& line,int system_info){
00107 if (system_info==RMK){
00108 if (line_format.record_type()==PDB::MODEL)
00109 current_model=line_format.get_model_number(line);
00110 }
00111 else{
00112
00113 assert(systems_.capacity()>=(unsigned) system_info);
00114 if (!prebuilt_systems && systems_.size()<(unsigned) system_info)
00115 systems_.push_back(System(system_info));
00116 systems_[system_info-1].interpret_line(line_format,line,current_model);
00117 }
00118 }
00119
00120
00121
00126 void create_systems(char altloc){
00127 for (typename System_container::iterator it=systems_.begin();it!=systems_.end();++it)
00128 it->set_altloc(altloc);
00129 }
00130
00131 };
00132
00133 }
00134
00135 #endif // ESBTL_BUILDER_H