/** * \file helpers.cpp \brief A set of helper functions * * Copyright 2007-2013 IMP Inventors. All rights reserved. * */ #include "helpers.h" #include #include #include #include #include #include void read_trans_file(const std::string file_name, std::vector& transforms) { std::ifstream trans_file(file_name.c_str()); if(!trans_file) { std::cerr << "Can't find Transformation file " << file_name << std::endl; exit(1); } IMP::algebra::Vector3D rotation_vec, translation; int trans_number; while(trans_file >> trans_number >> rotation_vec >> translation) { IMP::algebra::Rotation3D rotation = IMP::algebra::get_rotation_from_fixed_xyz(rotation_vec[0], rotation_vec[1], rotation_vec[2]); IMP::algebra::Transformation3D trans(rotation, translation); transforms.push_back(trans); } trans_file.close(); std::cout << transforms.size() << " transforms were read from " << file_name << std::endl; } 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()); } } void get_atom_2_residue_map(const IMP::Particles& atom_particles, const IMP::Particles& residue_particles, std::vector& atom_2_residue_map) { atom_2_residue_map.resize(atom_particles.size()); unsigned int residue_index=0; for(unsigned int atom_index=0; atom_indexget_radius(residue_particles[p_index], ff_type); IMP::core::XYZR::setup_particle(residue_particles[p_index], radius); } IMP::saxs::SolventAccessibleSurface s; residue_solvent_accessibility = s.get_solvent_accessibility(IMP::core::XYZRs(residue_particles)); }