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;
}
ParticlesTemp
GaussianProcessInterpolationRestraintSparse::get_input_particles() const
{
    ParticlesTemp ret;
    ParticlesTemp ret1 = gpi_->mean_function_->get_input_particles();
    ret.insert(ret.end(),ret1.begin(),ret1.end());
    ParticlesTemp ret2 = gpi_->covariance_function_->get_input_particles();
    ret.insert(ret.end(),ret2.begin(),ret2.end());
    return ret;
}
ParticlesTemp
CoreCloseBipartitePairContainer::get_all_possible_particles() const {
  ParticlesTemp ret = sc_[0]->get_particles();
  ParticlesTemp ret1= sc_[1]->get_particles();
  ret.insert(ret.end(), ret1.begin(), ret1.end());
  return ret;
}
示例#4
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);
}
示例#5
0
// write approximate function, remove rigid bodies for intermediates
core::RigidBody create_rigid_body(const Hierarchies& h,
                                  std::string name) {
  if (h.empty()) return core::RigidBody();
  for (unsigned int i=0; i< h.size(); ++i) {
    IMP_USAGE_CHECK(h[i].get_is_valid(true), "Invalid hierarchy passed.");
  }
  Particle *rbp= new Particle(h[0]->get_model());
  rbp->set_name(name);
  ParticlesTemp all;
  for (unsigned int i=0; i< h.size(); ++i) {
    ParticlesTemp cur= rb_process(h[i]);
    all.insert(all.end(), cur.begin(), cur.end());
  }
  core::RigidBody rbd
    = core::RigidBody::setup_particle(rbp, core::XYZs(all));
  rbd.set_coordinates_are_optimized(true);
  for (unsigned int i=0; i< h.size(); ++i) {
    IMP_INTERNAL_CHECK(h[i].get_is_valid(true), "Invalid hierarchy produced");
  }
  return rbd;
}
示例#6
0
ModelObjectsTemp BallMover::do_get_inputs() const {
  ParticlesTemp ret;
  ret.push_back(p_);
  ret.insert(ret.end(), ps_.begin(), ps_.end());
  return ret;
}
示例#7
0
core::MonteCarloMoverResult RigidBodyMover::do_propose() {
  IMP_OBJECT_LOG;

  // store last reference frame of master rigid body
  oldtr_ = d_.get_reference_frame().get_transformation_to();

  // generate new coordinates of center of mass of master rb
  algebra::Vector3D nc = algebra::get_random_vector_in(
      algebra::Sphere3D(d_.get_coordinates(), max_tr_));

  // find center of the closest cell
  double mindist = 1.0e+24;
  unsigned icell = 0;
  for (unsigned int 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();

  // r: rotation around random axis
  algebra::VectorD<3> axis = algebra::get_random_vector_on(
      algebra::Sphere3D(algebra::VectorD<3>(0.0, 0.0, 0.0), 1.));

  ::boost::uniform_real<> rand(-max_ang_, max_ang_);
  Float angle = rand(random_number_generator);
  algebra::Rotation3D r = algebra::get_rotation_about_axis(axis, angle);

  // ri: composing rotation of reference frame transformation and
  // rotation due to boundary-crossing
  algebra::Rotation3D ri =
      cell_tr.get_rotation() *
      d_.get_reference_frame().get_transformation_to().get_rotation();
  // rc: composing ri with random rotation r
  algebra::Rotation3D rc = r * ri;

  // new reference frame for master rb
  d_.set_reference_frame(algebra::ReferenceFrame3D(
      algebra::Transformation3D(rc, cell_tr.get_transformed(nc))));

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

  // set new reference frames for slave rbs
  oldtrs_.clear();
  for (unsigned i = 0; i < rbs_.size(); ++i) {
    algebra::Transformation3D ot =
        rbs_[i].get_reference_frame().get_transformation_to();
    // store old reference frame transformation
    oldtrs_.push_back(ot);
    // create new reference frame
    algebra::Rotation3D rr = cell_tr.get_rotation() * ot.get_rotation();
    algebra::Vector3D tt = cell_tr.get_transformed(rbs_[i].get_coordinates());
    // set new reference frame for slave rbs
    rbs_[i].set_reference_frame(
        algebra::ReferenceFrame3D(algebra::Transformation3D(rr, tt)));
  }

  ParticlesTemp ret = ParticlesTemp(1, d_);
  ret.insert(ret.end(), ps_.begin(), ps_.end());

  return core::MonteCarloMoverResult(get_indexes(ret), 1.0);
}
示例#8
0
ModelObjectsTemp RigidBodyMover::do_get_inputs() const {
  ParticlesTemp ret = ParticlesTemp(1, d_);
  ret.insert(ret.end(), ps_.begin(), ps_.end());
  return ret;
}