int main(int argc, char** argv){ if (argc != 2 ){ std::cerr << "Please provide a filename" << std::endl; return EXIT_FAILURE; } ESBTL::PDB_line_selector_two_systems sel; std::vector<ESBTL::Default_system> systems; ESBTL::All_atom_system_builder<ESBTL::Default_system> builder(systems,sel.max_nb_systems()); T_Atom_classifier atom_classifier; if (ESBTL::read_a_pdb_file(argv[1],sel,builder,Accept_none_occupancy_policy())){ if ( systems.empty() || systems[0].has_no_model() ){ std::cerr << "No atoms found" << std::endl; return EXIT_FAILURE; } //Consider only the first model of the first system const ESBTL::Default_system::Model& model=* systems[0].models_begin(); for (ESBTL::Default_system::Model::Atoms_const_iterator it_atm=model.atoms_begin();it_atm!=model.atoms_end();++it_atm){ std::cout << it_atm->x() << " " << it_atm->y() << " " << it_atm->z() << " " ; std::cout << atom_classifier.get_properties(*it_atm).value() << "\n"; } } else return EXIT_FAILURE; return EXIT_SUCCESS; }
/** * \brief a Method to extract the first system of a PDB file * * \param[in] path path to a pdb file * \return A System, created by ESBTL, used for further parsing. * * */ ESBTL::Default_system parsePdb(const boost::filesystem::path & path) { typedef ESBTL::Accept_none_occupancy_policy<ESBTL::PDB::Line_format<> > Accept_none_occupancy_policy; ESBTL::PDB_line_selector_two_systems sel; std::vector<ESBTL::Default_system> systems; ESBTL::All_atom_system_builder<ESBTL::Default_system> builder(systems,sel.max_nb_systems()); if (ESBTL::read_a_pdb_file(path.c_str(),sel,builder,Accept_none_occupancy_policy())){ if ( systems.empty() || systems[0].has_no_model() ){ std::cerr << "No atoms found" << std::endl; } return systems[0]; } std::cerr << "Problems reading the file" << std::endl; return systems[0]; }