예제 #1
0
CnSymmAxisDetector::CnSymmAxisDetector(int symm_deg,
                                       const atom::Hierarchies &mhs)
    : symm_deg_(symm_deg) {
  // create a density map
  kernel::Particles ps;
  for (atom::Hierarchies::const_iterator it = mhs.begin(); it != mhs.end();
       it++) {
    kernel::Particles temp_ps = core::get_leaves(*it);
    ps.insert(ps.end(), temp_ps.begin(), temp_ps.end());
  }
  // TODO - check the number of particles!!
  IMP_NEW(em::SampledDensityMap, sampled_dmap, (ps, 3., 1.));
  sampled_dmap->resample();
  sampled_dmap->calcRMS();
  dmap_ = new em::DensityMap(*(sampled_dmap->get_header()));
  dmap_->copy_map(sampled_dmap);
  double top_20_den_val = get_top_density_value(dmap_,
                                          dmap_->get_header()->dmin, 0.8);
  vecs_ = em::density2vectors(dmap_, top_20_den_val);
  // calculate  pca
  pca_ = algebra::get_principal_components(vecs_);
  // calculate transformation from the native axes system to the one
  // defined by the pca
  from_native_ = algebra::get_rotation_from_x_y_axes(
      pca_.get_principal_component(0), pca_.get_principal_component(1));
  to_native_ = from_native_.get_inverse();
  sampled_dmap = nullptr;
}
예제 #2
0
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);
}
예제 #3
0
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;
}
예제 #4
0
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));
}
예제 #5
0
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);
}
예제 #6
0
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);
}