コード例 #1
0
ファイル: coarse_molecule.cpp プロジェクト: drussel/imp
atom::Hierarchy create_coarse_molecule_from_molecule(
               const atom::Hierarchy &mh,int num_beads,
               Model *mdl,
               float bead_radius,
               bool add_conn_restraint) {
  IMP_NEW(IMP::statistics::internal::ParticlesDataPoints, ddp,
          (core::get_leaves(mh)));
  IMP::statistics::internal::VQClustering vq(ddp,num_beads);
  vq.run();
  multifit::DataPointsAssignment assignment(ddp,&vq);
  atom::Selections sel;
  algebra::Vector3Ds vecs;
  for (int i=0;i<num_beads;i++){
    IMP::statistics::internal::Array1DD xyz =
      assignment.get_cluster_engine()->get_center(i);
    vecs.push_back(algebra::Vector3D(xyz[0],xyz[1],xyz[2]));
  }
  //todo - mass should be a parameter
  atom::Hierarchy ret_prot=create_molecule(vecs,bead_radius,3,mdl);
  ParticlesTemp leaves=core::get_leaves(ret_prot);
  for (ParticlesTemp::iterator it = leaves.begin();it != leaves.end();it++){
    sel.push_back(atom::Selection(atom::Hierarchy(*it)));
  }
  if (add_conn_restraint){
  int k=1;//todo - make this a parameter
  Restraint *r = atom::create_connectivity_restraint(sel,k);
  if (r != nullptr){
    mdl->add_restraint(r);}
  }
  return ret_prot;
}
コード例 #2
0
ファイル: coarse_molecule.cpp プロジェクト: newtonjoo/imp
atom::Hierarchy create_coarse_molecule_from_density(em::DensityMap *dmap,
                                                    float dens_threshold,
                                                    int num_beads,
                                                    kernel::Model *mdl,
                                                    float bead_radius) {

  IMP_NEW(DensityDataPoints, ddp, (dmap, dens_threshold));
  IMP_LOG_VERBOSE("initialize calculation of initial centers" << std::endl);
  IMP::statistics::internal::VQClustering vq(ddp, num_beads);
  vq.run();
  multifit::DataPointsAssignment assignment(ddp, &vq);
  algebra::Vector3Ds vecs;
  for (int i = 0; i < num_beads; i++) {
    IMP::statistics::internal::Array1DD xyz =
        assignment.get_cluster_engine()->get_center(i);
    vecs.push_back(algebra::Vector3D(xyz[0], xyz[1], xyz[2]));
  }
  // todo - mass should be a parameter
  atom::Hierarchy ret_prot = create_molecule(vecs, bead_radius, 3, mdl);
  return ret_prot;
}