SimpleExcludedVolume create_simple_excluded_volume_on_molecules( atom::Hierarchies const &mhs) { IMP_CHECK_CODE(size_t mhs_size = mhs.size()); IMP_USAGE_CHECK(mhs_size > 0, "At least one hierarchy should be given"); kernel::ParticlesTemp ps; for ( size_t i=0; i<mhs.size(); ++i ) { kernel::ParticlesTemp leaves= IMP::atom::get_leaves(mhs[i]); ps.insert(ps.end(), leaves.begin(), leaves.end()); } /****** Set the restraint ******/ IMP_NEW(container::ListSingletonContainer, lsc, (ps)); IMP_NEW(core::ExcludedVolumeRestraint, evr, (lsc)); /****** Add restraint to the model ******/ //Model *mdl = mhs[0].get_particle()->get_model(); //mdl->add_restraint(evr); /****** Return a SimpleExcludedVolume object ******/ return SimpleExcludedVolume(evr); }
atom::Hierarchies create_coarse_molecules_from_molecules( const atom::Hierarchies &mhs, int frag_len, kernel::Model *mdl, float bead_radius, bool add_conn_restraint) { atom::Hierarchies ret; for (int i = 0; i < (int)mhs.size(); i++) { // decide the number of beads for the molecule int num_beads = std::max( 1, (int)(atom::get_by_type(mhs[i], atom::RESIDUE_TYPE).size()) / frag_len); ret.push_back(create_coarse_molecule_from_molecule( mhs[i], num_beads, mdl, bead_radius, add_conn_restraint)); } return ret; }
core::RigidBodies set_rigid_bodies(atom::Hierarchies const &mhs) { IMPRESTRAINER_DEPRECATED_FUNCTION_DEF(2.1, "Use atom::create_rigid_body() instead."); size_t mhs_size = mhs.size(); IMP_USAGE_CHECK(mhs_size > 0, "At least one hierarchy should be given"); kernel::Particles rbps; for ( size_t i=0; i<mhs_size; ++i ) { // The rigid body is set to be optimized IMP::atom::setup_as_rigid_body(mhs[i]); rbps.push_back(mhs[i].get_particle()); } return (core::RigidBodies(rbps)); }
SimpleEMFit create_simple_em_fit(atom::Hierarchies const &mhs, em::DensityMap *dmap) { size_t mhs_size = mhs.size(); IMP_USAGE_CHECK(mhs_size > 0, "At least one hierarchy should be given"); kernel::ParticlesTemp ps; for ( size_t i=0; i<mhs_size; ++i ) { kernel::ParticlesTemp pss = core::get_leaves(mhs[i]); ps.insert(ps.end(),pss.begin(),pss.end()); } IMP_NEW(em::FitRestraint, fit_rs, (ps, dmap, FloatPair(0.,0.), atom::Mass::get_mass_key(), 1.0)); return SimpleEMFit(fit_rs); }
SimpleConnectivity create_simple_connectivity_on_molecules( const atom::Hierarchies &mhs) { size_t mhs_size = mhs.size(); IMP_USAGE_CHECK(mhs_size > 0, "At least one hierarchy should be given"); kernel::ParticlesTemp ps; for ( size_t i=0; i<mhs_size; ++i ) { ps.push_back(mhs[i].get_particle()); } /****** Define Refiner ******/ // Use LeavesRefiner for the hierarchy leaves under a particle IMP_NEW(core::LeavesRefiner, lr, (atom::Hierarchy::get_traits())); /****** Define PairScore ******/ // Score on the lowest of the pairs defined by refining the two particles. IMP_NEW(core::HarmonicUpperBound, h, (0, 1)); IMP_NEW(core::SphereDistancePairScore, sdps, (h)); IMP_NEW(core::KClosePairsPairScore, lrps, (sdps, lr)); /****** Set the restraint ******/ IMP_NEW(core::ConnectivityRestraint, cr, (lrps)); cr->set_particles((ps)); /****** Add restraint to the model ******/ //Model *mdl = mhs[0].get_particle()->get_model(); //mdl->add_restraint(cr); /****** Return a SimpleConnectivity object ******/ return SimpleConnectivity(cr, h, sdps); }