当前位置: 首页>>代码示例>>C++>>正文


C++ Particles::size方法代码示例

本文整理汇总了C++中Particles::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Particles::size方法的具体用法?C++ Particles::size怎么用?C++ Particles::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Particles的用法示例。


在下文中一共展示了Particles::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: compute_chisquare_derivative

/*
compute derivative for each particle in particles1 with respect to particles2
SCORING function : chi
For calculation in real space the quantity Delta(r) is needed to get
derivatives of an atom
Delta(r) = f_iatom * sum_i f_i delta(r-r_{i,iatom}) (x_iatom-x_i)
  // e_q = exp( -0.23 * q*q )
*/
void DerivativeCalculator::compute_chisquare_derivative(
    const Profile* model_profile, const Particles& particles1,
    const Particles& particles2,
    Vector<algebra::Vector3D>& derivatives,
    const Vector<double>& effect_size) const {

  algebra::Vector3D dIdx, chisquare_derivative;

  Vector<Vector<double> > sinc_cos_values;
  DeltaDistributionFunction delta_dist = precompute_derivative_helpers(
      model_profile, particles1, particles2, sinc_cos_values);

  unsigned int profile_size =
      std::min(model_profile->size(), exp_profile_->size());
  derivatives.clear();
  derivatives.resize(particles1.size());
  for (unsigned int iatom = 0; iatom < particles1.size(); iatom++) {
    // Compute a delta distribution per atom
    delta_dist.calculate_derivative_distribution(particles1[iatom]);
    chisquare_derivative = algebra::Vector3D(0.0, 0.0, 0.0);

    for (unsigned int iq = 0; iq < profile_size; iq++) {
      compute_intensity_derivatives(delta_dist, sinc_cos_values, iq, dIdx);
      chisquare_derivative += dIdx * effect_size[iq];
    }
    derivatives[iatom] = chisquare_derivative;
  }
}
开发者ID:AljGaber,项目名称:imp,代码行数:36,代码来源:DerivativeCalculator.cpp

示例2: Restraint

IMPEM_BEGIN_NAMESPACE

EnvelopePenetrationRestraint::EnvelopePenetrationRestraint(
   Particles ps,
   DensityMap *em_map,Float threshold
   ): Restraint("Envelope penetration restraint")
{
  IMP_LOG_TERSE("Load envelope penetration with the following input:"<<
          "number of particles:"<<ps.size()<<
           "\n");
  threshold_=threshold;
  target_dens_map_ = em_map;
  IMP_IF_CHECK(USAGE) {
    for (unsigned int i=0; i< ps.size(); ++i) {
      IMP_USAGE_CHECK(core::XYZR::particle_is_instance(ps[i]),
                      "Particle " << ps[i]->get_name()
                      << " is not XYZR"
                      << std::endl);
    }
  }
  add_particles(ps);
  ps_=ps;
  IMP_LOG_TERSE("after adding particles"<<std::endl);
  IMP_LOG_TERSE( "Finish initialization" << std::endl);
}
开发者ID:drussel,项目名称:imp,代码行数:25,代码来源:EnvelopePenetrationRestraint.cpp

示例3: compute_all_derivatives

/*
 * loop over all particles and rigid bodies, and call compute_chi_derivative on
 * them
 */
void DerivativeCalculator::compute_all_derivatives(const Particles& particles,
               const std::vector<Particles>& rigid_bodies,
               const std::vector<core::RigidBody>& rigid_bodies_decorators,
               const Profile& model_profile,
               const std::vector<double>& effect_size,
               DerivativeAccumulator *acc) const
{
  std::vector<IMP::algebra::VectorD<3> > derivatives;
  const FloatKeys keys = IMP::core::XYZ::get_xyz_keys();

  // 1. compute derivatives for each rigid body
  for(unsigned int i=0; i<rigid_bodies.size(); i++) {
    if(!rigid_bodies_decorators[i].get_coordinates_are_optimized()) continue;
    // contribution from other rigid bodies
    for(unsigned int j=0; j<rigid_bodies.size(); j++) {
      if(i == j) continue;
      compute_chisquare_derivative(model_profile, rigid_bodies[i],
              rigid_bodies[j], derivatives, effect_size);
      for (unsigned int k = 0; k < rigid_bodies[i].size(); k++) {
        rigid_bodies[i][k]->add_to_derivative(keys[0],derivatives[k][0], *acc);
        rigid_bodies[i][k]->add_to_derivative(keys[1],derivatives[k][1], *acc);
        rigid_bodies[i][k]->add_to_derivative(keys[2],derivatives[k][2], *acc);
      }
    }
    if(particles.size() > 0) {
      // contribution from other particles
      compute_chisquare_derivative(model_profile, rigid_bodies[i],
                                          particles, derivatives, effect_size);
      for (unsigned int k = 0; k < rigid_bodies[i].size(); k++) {
        rigid_bodies[i][k]->add_to_derivative(keys[0],derivatives[k][0], *acc);
        rigid_bodies[i][k]->add_to_derivative(keys[1],derivatives[k][1], *acc);
        rigid_bodies[i][k]->add_to_derivative(keys[2],derivatives[k][2], *acc);
      }
    }
  }

  // 2. compute derivatives for other particles
  if(particles.size() > 0) {
    // particles own contribution
    compute_chisquare_derivative(model_profile, particles, derivatives,
            effect_size);
    for (unsigned int i = 0; i < particles.size(); i++) {
      particles[i]->add_to_derivative(keys[0], derivatives[i][0], *acc);
      particles[i]->add_to_derivative(keys[1], derivatives[i][1], *acc);
      particles[i]->add_to_derivative(keys[2], derivatives[i][2], *acc);
    }
    // rigid bodies contribution
    for(unsigned int i=0; i<rigid_bodies.size(); i++) {
      compute_chisquare_derivative(model_profile, particles, rigid_bodies[i],
              derivatives, effect_size);
      for (unsigned int i = 0; i < particles.size(); i++) {
        particles[i]->add_to_derivative(keys[0], derivatives[i][0], *acc);
        particles[i]->add_to_derivative(keys[1], derivatives[i][1], *acc);
        particles[i]->add_to_derivative(keys[2], derivatives[i][2], *acc);
      }
    }
  }
}
开发者ID:andreyto,项目名称:imp-fork-proddl,代码行数:62,代码来源:DerivativeCalculator.cpp

示例4: while

const Particles &_give_particles(Model *m) {
  static Particles ret;
  while (ret.size() < 10) {
    ret.push_back(new Particle(m));
  }
  return ret;
}
开发者ID:apolitis,项目名称:imp,代码行数:7,代码来源:swig.cpp

示例5: set_secondary_structure_probabilities

void AnchorsData::set_secondary_structure_probabilities(
    const Particles &ssres_ps, const Ints &indices) {

  IMP_USAGE_CHECK(secondary_structure_ps_.size() == points_.size(),
                  "Secondary structure has not been set up, "
                  "run AnchorsData::setup_secondary_structure() first");
  int anum;
  for (int ssnum = 0; ssnum < (int)ssres_ps.size(); ssnum++) {
    IMP_USAGE_CHECK(
        atom::SecondaryStructureResidue::get_is_setup(ssres_ps[ssnum]),
        "SSE Particles must be decorated as"
        "SecondaryStructureResidues");
    if (indices.size() == 0)
      anum = ssnum;
    else
      anum = indices[ssnum];
    atom::SecondaryStructureResidue(secondary_structure_ps_[anum])
        .set_prob_helix(
             atom::SecondaryStructureResidue(ssres_ps[ssnum]).get_prob_helix());
    atom::SecondaryStructureResidue(secondary_structure_ps_[anum])
        .set_prob_strand(atom::SecondaryStructureResidue(ssres_ps[ssnum])
                             .get_prob_strand());
    atom::SecondaryStructureResidue(secondary_structure_ps_[anum])
        .set_prob_coil(
             atom::SecondaryStructureResidue(ssres_ps[ssnum]).get_prob_coil());
  }
}
开发者ID:AljGaber,项目名称:imp,代码行数:27,代码来源:anchors_reader.cpp

示例6: _give_particles_copy

Particles _give_particles_copy(Model *m) {
  Particles ret;
  while (ret.size() < 10) {
    ret.push_back(new Particle(m));
  }
  return ret;
}
开发者ID:apolitis,项目名称:imp,代码行数:7,代码来源:swig.cpp

示例7: get_particles

Particles RigidBodyMover::get_particles(Particles ps) {
  Particles ps_norb;
  for (unsigned i = 0; i < ps.size(); ++i) {
    if (!core::RigidMember::get_is_setup(ps[i])) {
      ps_norb.push_back(ps[i]);
    }
  }
  return ps_norb;
}
开发者ID:j-ma-bu-l-l-ock,项目名称:imp,代码行数:9,代码来源:RigidBodyMover.cpp

示例8: Restraint

RadiusOfGyrationRestraint::RadiusOfGyrationRestraint(Particles ps,
                                                     int num_residues,
                                                     Float scale):
    Restraint(IMP::internal::get_model(ps), "RadiusOfGyrationRestraint"){
  if (ps.size()==0) return;
  add_particles(ps);
  mdl_=ps[0]->get_model();
  predicted_rog_ = get_approximated_radius_of_gyration(num_residues);
  scale_=scale;
  hub_=new core::HarmonicUpperBound(predicted_rog_*scale_,1);
}
开发者ID:andreyto,项目名称:imp-fork-proddl,代码行数:11,代码来源:RadiusOfGyrationRestraint.cpp

示例9: onInitParticles

	virtual void onInitParticles(Particles& particles)
	{
		const float time = parentDocument()->getAnimationTime();
		int oldNb = birth.size();
		int newNb = oldNb + particles.size();
		birth.resize(newNb);

		std::uniform_real_distribution<float> dist(0, variation.getValue());
		for(int i=oldNb; i<newNb; ++i)
			birth[i] = time - dist(gen);	// Giving them negative age based on the variation value
	}
开发者ID:cguebert,项目名称:Panda,代码行数:11,代码来源:ParticleDestruction.cpp

示例10: add_PbcBoxedMover

void add_PbcBoxedMover(Particles ps, double dx, algebra::Vector3Ds centers,
                       algebra::Transformation3Ds trs,
                       core::MonteCarloMovers &mvs, Particle *SideXY,
                       Particle *SideZ) {
  IMP_NEW(spb::PbcBoxedMover, mv,
          (ps[0], ps, dx, centers, trs, SideXY, SideXY, SideZ));
  mvs.push_back(mv);
  for (unsigned int k = 1; k < ps.size(); ++k) {
    IMP_NEW(core::BallMover, bmv, (ps[k]->get_model(), ps[k]->get_index(), dx));
    mvs.push_back(bmv);
  }
}
开发者ID:salilab,项目名称:imp,代码行数:12,代码来源:spb_sampler.cpp

示例11: randomizeInSphere

void randomizeInSphere(Particles& particles, real sphereSize)
{
    const unsigned size = particles.size();
    //const Real3& spherePos = sphere.p_;
    
    particles.pos_.resize(size);
    for (unsigned i=0;i<size;++i) {
        particles.pos_[i]= sphereSize*( Real3(-.5f,-.5f,-.5f)+Real3(randnorm<real>(),randnorm<real>(),randnorm<real>()) ); 
//        particles.pos_[i]= i%2?Real3(sphereSize-0.1,0,0):Real3(-sphereSize+0.1,0,0);
//        particles.vel_[i]= i%2?Real3(2.5,0.5,0):Real3(-3,0,0);
//        particles.acc_[i]=Real3(0.f,0.f,0.f);
    }
}
开发者ID:sutuglon,项目名称:Motor,代码行数:13,代码来源:particles.cpp

示例12: vonMisesSufficient

TALOSRestraint::TALOSRestraint(Particles p, unsigned N, double R0, double
          chiexp, Particle *kappa) : kappa_(kappa) {
  if (p.size() != 4) {
    IMP_THROW("please provide a list with 4 particles!", ModelException);
  }
  p_[0]=static_cast<Particle*>(p[0]);
  p_[1]=static_cast<Particle*>(p[1]);
  p_[2]=static_cast<Particle*>(p[2]);
  p_[3]=static_cast<Particle*>(p[3]);
  // create von Mises
  double kappaval=Scale(kappa_).get_scale();
  mises_ = new vonMisesSufficient(0, N, R0, chiexp, kappaval);
  //mises_->set_was_used(true);
  }
开发者ID:drussel,项目名称:imp,代码行数:14,代码来源:TALOSRestraint.cpp

示例13: distributeLocally

//LC: added for local (re)localization
void MapModel::distributeLocally(Particles& particles, double roll, double pitch, double yaw,
                                    double x, double y, double z,
                                    UniformGeneratorT& rngUniform, double dist_linear, double dist_angular){        //maxHeight added by LC
  double sizeX,sizeY,sizeZ, minX, minY, minZ;
  //LC: get total map size
  m_map->getMetricSize(sizeX,sizeY,sizeZ);
  //LC: get minimum values of map bounding box
  m_map->getMetricMin(minX, minY, minZ);

  double weight = 1.0 / particles.size();
  Particles::iterator it = particles.begin();
  while (true){
    if (it == particles.end())
      break;

    // obtain a pose hypothesis:
    double x_new = x + dist_linear * ((rngUniform() - 0.5) * 2);
    double y_new = y + dist_linear * ((rngUniform() - 0.5) * 2);
    double z_new = z + dist_linear * ((rngUniform() - 0.5) * 2);

    double roll_new = roll;// + dist_angular * ((rngUniform() - 0.5) * 2);
    double pitch_new = pitch;// + dist_angular * ((rngUniform() - 0.5) * 2);
    double yaw_new = yaw + dist_angular * ((rngUniform() - 0.5) * 2);

    if(it == particles.begin()) {
        // obtain a pose hypothesis:
        x_new = x;
        y_new = y;
        z_new = z;

        roll_new = roll;
        pitch_new = pitch;
        yaw_new = yaw;
    }

    //set new pose
    it->pose.getOrigin().setX(x_new);
    it->pose.getOrigin().setY(y_new);
    it->pose.getOrigin().setZ(z_new);

    //set orientation
    it->pose.setRotation(tf::createQuaternionFromRPY(roll_new, pitch_new, yaw_new));

    it->weight = weight;
    it++;

  }

}
开发者ID:lennartclaassen,项目名称:3rd-party-ressources,代码行数:50,代码来源:MapModel.cpp

示例14: ret

/** @brief get the central pixel brightess for each coordinate in centers.  */
vector<float> Tracker::getIntensities(const Particles &centers)
{
    vector<float> ret(centers.size());
    for(size_t p=0; p<centers.size(); ++p)
    {
        //convert real coordinates to integer strides
        boost::array<size_t, 3> tmp;
        for(size_t d=0; d<tmp.size(); ++d)
            tmp[d] = centersMap.strides()[d] * (size_t)centers[p][(fortran_order)?(2-d):d];

        //normlize the value by the size of the image to get rid of the FTTW unnormalization and be in the same unit as the threshold parameter
        ret[p] = (*(data+accumulate(tmp.begin(), tmp.end(), 0)))/centersMap.num_elements();
    }
    return ret;
}
开发者ID:MathieuLeocmach,项目名称:colloids,代码行数:16,代码来源:tracker.cpp

示例15: find

std::vector<core::RigidBody> RigidBodyMover::get_rigid_bodies(
    Particles ps) {
  std::vector<core::RigidBody> rbs;
  for (unsigned i = 0; i < ps.size(); ++i) {
    if (core::RigidMember::get_is_setup(ps[i])) {
      core::RigidBody rb = core::RigidMember(ps[i]).get_rigid_body();
      std::vector<core::RigidBody>::iterator it =
          find(rbs.begin(), rbs.end(), rb);
      if (it == rbs.end()) {
        rbs.push_back(rb);
      }
    }
  }
  return rbs;
}
开发者ID:j-ma-bu-l-l-ock,项目名称:imp,代码行数:15,代码来源:RigidBodyMover.cpp


注:本文中的Particles::size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。