Example #1
0
void EMFit::output(std::string out_file_name, std::string out_pdb_file_name) {
  std::ofstream out_file(out_file_name.c_str());
  out_file << "receptorPdb (str) " << rec_file_name_ << std::endl;
  out_file << "ligandPdb (str) " << lig_file_name_ << std::endl;
  EM3DFitResult::print_header(out_file);
  out_file.setf(std::ios::fixed, std::ios::floatfield);
  out_file.setf(std::ios::right, std::ios::adjustfield);

  IMP::algebra::Vector3Ds lig_points;
  IMP::saxs::get_coordinates(lig_particles_, lig_points);
  for (unsigned int i = 0; i < fit_results_.size(); i++) {
    out_file << fit_results_[i] << std::endl;
  }
  out_file.close();
  if (fit_results_.size() == 1) {  // output PDB
    IMP::algebra::Transformation3D tr = fit_results_[0].get_map_trans();
    IMP::Particles ps = rec_particles_;
    ps.insert(ps.end(), lig_particles_.begin(), lig_particles_.end());
    // transform
    for (IMP::Particles::iterator it = ps.begin(); it != ps.end();
         it++) {
      IMP::core::XYZ d(*it);
      d.set_coordinates(tr * d.get_coordinates());
    }
    // output
    std::ofstream out_file2(out_pdb_file_name.c_str());
    IMP::ParticlesTemp pst = ps;
    IMP::atom::write_pdb(pst, out_file2);
    out_file2.close();
  }
}
Example #2
0
void transform(IMP::Particles& ps, IMP::algebra::Transformation3D& t) {
  for(IMP::Particles::iterator it = ps.begin(); it != ps.end(); it++) {
    IMP::core::XYZ d(*it);
    d.set_coordinates(t * d.get_coordinates());
  }
}