Ejemplo n.º 1
0
/* Return all particles whose attributes are read by the restraints. To
   do this, ask the pair score what particles it uses.*/
IMP::ModelObjectsTemp UniformBoundedRestraint::do_get_inputs() const {
  ParticlesTemp ret;
  ret.push_back(p_);
  ret.push_back(a_);
  ret.push_back(b_);
  return ret;
}
Ejemplo n.º 2
0
ParticlesTemp CHARMMStereochemistryRestraint::get_input_particles() const
{
  ParticlesTemp ps;
  for (Particles::const_iterator b = bonds_.begin(); b != bonds_.end(); ++b) {
    ps.push_back(*b);
    ParticlesTemp bps = bond_score_->get_input_particles(*b);
    ps.insert(ps.end(), bps.begin(), bps.end());
  }
  for (Particles::const_iterator a = angles_.begin();
       a != angles_.end(); ++a) {
    ps.push_back(*a);
    ParticlesTemp bps = angle_score_->get_input_particles(*a);
    ps.insert(ps.end(), bps.begin(), bps.end());
  }
  for (Particles::const_iterator d = dihedrals_.begin();
       d != dihedrals_.end(); ++d) {
    ps.push_back(*d);
    ParticlesTemp bps = dihedral_score_->get_input_particles(*d);
    ps.insert(ps.end(), bps.begin(), bps.end());
  }
  for (Particles::const_iterator i = impropers_.begin();
       i != impropers_.end(); ++i) {
    ps.push_back(*i);
    ParticlesTemp bps = improper_score_->get_input_particles(*i);
    ps.insert(ps.end(), bps.begin(), bps.end());
  }
  return ps;
}
Ejemplo n.º 3
0
ModelObjectsTemp NOERestraint::do_get_inputs() const {
  ParticlesTemp ret;
  ret.push_back(p0_);
  ret.push_back(p1_);
  ret.push_back(sigma_);
  ret.push_back(gamma_);
  return ret;
}
Ejemplo n.º 4
0
/* Return all particles whose attributes are read by the restraints. To
   do this, ask the pair score what particles it uses.*/
ModelObjectsTemp  SigmoidRestraintSphere::do_get_inputs() const
{
  ParticlesTemp ret;
  ret.push_back(get_model()->get_particle(p1_));
  ret.push_back(get_model()->get_particle(p2_));
  return ret;
}
Ejemplo n.º 5
0
const ParticlesTemp
FixedRefiner::get_refined(Particle *) const
{
  ParticlesTemp ps;
  for(unsigned int i=0; i < pis_.size(); i++){
    ps.push_back(m_->get_particle(pis_[i]));
  }
  return ps;
}
ParticlesTemp RadiusOfGyrationRestraint::get_input_particles() const
{
  ParticlesTemp pt;
  for (ParticleConstIterator it= particles_begin();
       it != particles_end(); ++it) {
      pt.push_back(*it);
  }
  return pt;
}
Ejemplo n.º 7
0
/* Return all particles whose attributes are read by the restraints. To
   do this, ask the pair score what particles it uses.*/
ModelObjectsTemp CrossLinkMSRestraint::do_get_inputs() const {
    ParticlesTemp ret;
    for (unsigned int k = 0; k < get_number_of_contributions(); ++k) {
        if (ppis_[k][0] == ppis_[k][1]) {
            ret.push_back(get_model()->get_particle(ppis_[k][0]));
        } else {
            ret.push_back(get_model()->get_particle(ppis_[k][0]));
            ret.push_back(get_model()->get_particle(ppis_[k][1]));
        }
        if ( sigmass_[k][0] == sigmass_[k][1]) {
            ret.push_back(get_model()->get_particle(sigmass_[k][0]));
        } else {
            ret.push_back(get_model()->get_particle(sigmass_[k][0]));
            ret.push_back(get_model()->get_particle(sigmass_[k][1]));
        }
        ret.push_back(get_model()->get_particle(psis_[k]));
    }
    return ret;
}
Ejemplo n.º 8
0
const ParticlesTemp RigidLeavesRefiner::get_refined(Particle *p) const {
  ParticlesTemp members = core::RigidBody(p).get_rigid_members();
  ParticlesTemp ret;
  for (ParticlesTemp::const_iterator it = members.begin(); it != members.end();
       ++it) {
    if (atom::Hierarchy::get_is_setup(*it)
        && atom::Hierarchy(*it).get_number_of_children() == 0) {
      ret.push_back(*it);
    }
  }
  return ret;
}
Ejemplo n.º 9
0
ParticlesTemp get_output_particles(const ModelObjectsTemp &mo) {
  ParticlesTemp ret;
  for (unsigned int i = 0; i < mo.size(); ++i) {
    ModelObject *o = mo[i];
    Particle *p = dynamic_cast<Particle *>(o);
    if (p)
      ret.push_back(p);
    else {
      ret += get_output_particles(o->get_inputs());
    }
  }
  return ret;
}
Ejemplo n.º 10
0
core::MonteCarloMoverResult BallMover::do_propose() {
  IMP_OBJECT_LOG;

  // random displacement
  algebra::Vector3D displacement = algebra::get_random_vector_in(
      algebra::Sphere3D(algebra::Vector3D(0.0, 0.0, 0.0), max_tr_));

  // store old coordinates of master particle
  oldcoord_ = core::XYZ(p_).get_coordinates();

  // master particle coordinates after displacement
  algebra::Vector3D nc = oldcoord_ + displacement;

  // find center of the closest cell
  double mindist = 1.0e+24;
  unsigned icell = 0;
  for (unsigned i = 0; i < ctrs_.size(); ++i) {
    // calculate distance between nc and cell center
    double dist = algebra::get_l2_norm(nc - ctrs_[i]);
    // find minimum distance
    if (dist < mindist) {
      mindist = dist;
      icell = i;
    }
  }

  // find inverse transformation
  algebra::Transformation3D cell_tr = trs_[icell].get_inverse();

  // set new coordinates for master particle
  core::XYZ(p_).set_coordinates(cell_tr.get_transformed(nc));

  // set new coordinates for slave particles
  oldcoords_.clear();
  for (unsigned i = 0; i < ps_.size(); ++i) {
    core::XYZ xyz = core::XYZ(ps_[i]);
    algebra::Vector3D oc = xyz.get_coordinates();
    // store old coordinates
    oldcoords_.push_back(oc);
    // apply transformation
    algebra::Vector3D nc = cell_tr.get_transformed(oc);
    xyz.set_coordinates(nc);
  }

  ParticlesTemp ret;
  ret.push_back(p_);
  ret.insert(ret.end(), ps_.begin(), ps_.end());

  return core::MonteCarloMoverResult(get_indexes(ret), 1.0);
}
/* Return all particles whose attributes are read by the restraints. To
   do this, ask the pair score what particles it uses.*/
ParticlesTemp MarginalHBondRestraint::get_input_particles() const
{
  ParticlesTemp ret;
  for (unsigned i=0; i<volumes_.size(); ++i)
  {
      int npairs = contribs_[i]->get_number_of_particle_pairs();
      for (int j=0; j < npairs; ++j)
      {
          ret.push_back(contribs_[i]->get_particle_pair(j)[0]);
          ret.push_back(contribs_[i]->get_particle_pair(j)[1]);
      }
  }
  return ret;
}
Ejemplo n.º 12
0
IMPDOMINOEXPORT CliqueGraph get_clique_graph(const InteractionGraph& cig) {
  InteractionGraphConstVertexName pm= boost::get(boost::vertex_name, cig);
  typedef base::Vector<InteractionGraphVertex> Clique;
  base::Vector<Clique> cliques;
  internal::maximal_cliques(cig, std::back_inserter(cliques));
  for (unsigned int i=0; i< cliques.size(); ++i) {
    /*std::cout << "Clique is ";
      for (unsigned int j=0; j< cliques[i].size(); ++j) {
      std::cout << cliques[i][j] << " ";
      }*/
    std::sort(cliques[i].begin(), cliques[i].end());
  }
  CliqueGraph cg(cliques.size());
  CliqueGraphVertexName cm
    = boost::get(boost::vertex_name, cg);
  for (unsigned int i=0; i< cliques.size(); ++i) {
    ParticlesTemp cur;
    for (unsigned int j=0; j< cliques[i].size(); ++j) {
      cur.push_back(pm[cliques[i][j]]);
    }
    Subset ss(cur);
    cm[i]=ss;
  }
  for (unsigned int i=0; i< cliques.size(); ++i) {
    for (unsigned int j=0; j< i; ++j) {
      Subset intersection= get_intersection(cm[i], cm[j]);
      if (intersection.size() >0) {
        double minus_weight=intersection.size();
        /*std::cout << "edge " << i << " " << j
          << " has weight "
          << -static_cast<int>(intersection.size()) << std::endl;*/
        boost::add_edge(i, j,
                        CliqueGraph::edge_property_type(-minus_weight),
                        cg);
      }
    }
  }
  return cg;
}
Ejemplo n.º 13
0
ModelObjectsTemp DummyRestraint::do_get_inputs() const {
  ParticlesTemp ret;
  ret.push_back(p0_);
  ret.push_back(p1_);
  return ret;
}
Ejemplo n.º 14
0
ModelObjectsTemp DummyRestraint::do_get_inputs() const {
  ParticlesTemp pt;
  pt.push_back(p1_);
  pt.push_back(p2_);
  return pt;
}
ParticlesTemp SameResiduePairFilter::get_input_particles( Particle* t) const {
  ParticlesTemp ret;
  ret.push_back(t);
  ret.push_back(Hierarchy(t).get_parent());
  return ret;
}
Ejemplo n.º 16
0
/* Return all particles whose attributes are read by the restraints. To
   do this, ask the pair score what particles it uses.*/
ModelObjectsTemp WeightRestraint::do_get_inputs() const {
  ParticlesTemp ret;
  ret.push_back(w_);
  return ret;
}
Ejemplo n.º 17
0
ModelObjectsTemp BallMover::do_get_inputs() const {
  ParticlesTemp ret;
  ret.push_back(p_);
  ret.insert(ret.end(), ps_.begin(), ps_.end());
  return ret;
}