本文整理汇总了C++中ParticleIndexes::size方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleIndexes::size方法的具体用法?C++ ParticleIndexes::size怎么用?C++ ParticleIndexes::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleIndexes
的用法示例。
在下文中一共展示了ParticleIndexes::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_get_inputs
ModelObjectsTemp CoverBond::do_get_inputs(
Model *m, const ParticleIndexes &pis) const {
ModelObjectsTemp ret(3 * pis.size());
for (unsigned int i = 0; i < pis.size(); ++i) {
Bond bd(m, pis[i]);
ret[3 * i + 0] = m->get_particle(pis[i]);
ret[3 * i + 1] = bd.get_bonded(0);
ret[3 * i + 2] = bd.get_bonded(1);
}
return ret;
}
示例2: get_range_indexes
ParticleIndexPairs DummyPairContainer::get_range_indexes() const {
ParticleIndexes pis = c_->get_range_indexes();
ParticleIndexPairs ret;
ret.reserve(pis.size() * (pis.size() - 1) / 2);
for (unsigned int i = 0; i < pis.size(); ++i) {
for (unsigned int j = 0; j < i; ++j) {
ret.push_back(ParticleIndexPair(pis[i], pis[j]));
}
}
return ret;
}
示例3: get_range_indexes
ParticleIndexPairs AllPairContainer::get_range_indexes() const {
ParticleIndexes ia = c_->get_range_indexes();
ParticleIndexPairs ret;
ret.reserve(ia.size() * (ia.size() - 1) / 2);
for (unsigned int i = 0; i < ia.size(); ++i) {
for (unsigned int j = 0; j < i; ++j) {
ret.push_back(ParticleIndexPair(ia[i], ia[j]));
}
}
return ret;
}
示例4: do_get_inputs
ModelObjectsTemp AngleSingletonScore::do_get_inputs(
Model *m, const ParticleIndexes &pi) const {
ModelObjectsTemp ret(4 * pi.size());
for (unsigned int i = 0; i < pi.size(); ++i) {
Angle ad(m, pi[i]);
ret[4 * i + 0] = ad.get_particle(0);
ret[4 * i + 1] = ad.get_particle(1);
ret[4 * i + 2] = ad.get_particle(2);
ret[4 * i + 3] = m->get_particle(pi[i]);
}
return ret;
}
示例5: get_range_indexes
ParticleIndexPairs BondPairContainer::get_range_indexes() const {
ParticleIndexes ia = sc_->get_range_indexes();
ParticleIndexPairs ret;
ret.reserve(ia.size());
for (unsigned int i = 0; i < ia.size(); ++i) {
Bond b(get_model(), ia[i]);
ret.push_back(
ParticleIndexPair(b.get_bonded(0).get_particle_index(),
b.get_bonded(1).get_particle_index()));
}
return ret;
}
示例6: get_all_possible_indexes
ParticleIndexes BondPairContainer::get_all_possible_indexes() const {
ParticleIndexes scapp = sc_->get_all_possible_indexes();
ParticleIndexes ret(3 * scapp.size());
for (unsigned int i = 0; i < scapp.size(); ++i) {
ret[i * 3] = scapp[i];
ret[i * 3 + 1] =
Bond(get_model(), scapp[i]).get_bonded(0).get_particle_index();
ret[i * 3 + 2] =
Bond(get_model(), scapp[i]).get_bonded(1).get_particle_index();
}
return ret;
}
示例7: initialize
void NormalMover::initialize(ParticleIndexes pis, FloatKeys keys,
double radius) {
pis_ = pis;
keys_ = keys;
stddev_ = radius;
originals_.resize(pis.size(), algebra::get_zero_vector_kd(keys.size()));
}
示例8: get_close_pairs
ParticleIndexPairs QuadraticClosePairsFinder::get_close_pairs(
Model *m, const ParticleIndexes &pta,
const ParticleIndexes &ptb) const {
set_was_used(true);
IMP_OBJECT_LOG;
IMP_LOG_TERSE("Quadratic add_close_pairs called with "
<< pta.size() << " and " << ptb.size() << std::endl);
ParticleIndexPairs ret;
for (unsigned int i = 0; i < pta.size(); ++i) {
for (unsigned int j = 0; j < ptb.size(); ++j) {
if (get_are_close(m, pta[i], ptb[j])) {
ret.push_back(ParticleIndexPair(pta[i], ptb[j]));
}
}
}
return ret;
}
示例9: do_get_outputs
ModelObjectsTemp WeightedDerivativesToRefined::do_get_outputs(
Model *m, const ParticleIndexes &pis) const {
ModelObjectsTemp ret;
for (unsigned int i = 0; i < pis.size(); ++i) {
ret +=
IMP::get_particles(m, refiner_->get_refined_indexes(m, pis[i]));
}
return ret;
}
示例10: do_get_outputs
ModelObjectsTemp ParticleOutputs::do_get_outputs(
Model *m, const ParticleIndexes &pis) const {
ModelObjectsTemp ret;
for (unsigned int i = 0; i < pis.size(); ++i) {
ret += get_output_containers(m->get_particle(pis[i]));
ret += get_output_particles(m->get_particle(pis[i]));
}
return ret;
}
示例11: transform
void transform(atom::Hierarchy h, const algebra::Transformation3D &tr) {
Model *m = h.get_model();
typedef std::pair<ParticleIndex, ParticleIndexes> RBP;
boost::unordered_map<ParticleIndex, ParticleIndexes>
rigid_bodies;
transform_impl(m, h.get_particle_index(), tr, rigid_bodies);
IMP_FOREACH(const RBP & rbp, rigid_bodies) {
core::RigidBody rb(m, rbp.first);
ParticleIndexes members = rb.get_member_indexes();
if (rbp.second.size() != members.size()) {
IMP_USAGE_CHECK(
rbp.second.size() == members.size(),
"Hierarchy contains rigid body members of incomplete rigid bodies. "
"It must contain all members of a rigid body or no members. Rigid "
"body is "
<< m->get_particle_name(rbp.first));
}
core::transform(rb, tr);
}
示例12: do_get_inputs
ModelObjectsTemp CentroidOfRefined::do_get_inputs(
Model *m, const ParticleIndexes &pis) const {
ModelObjectsTemp ret = refiner_->get_inputs(m, pis);
ret += IMP::get_particles(m, pis);
for (unsigned int i = 0; i < pis.size(); ++i) {
ret +=
IMP::get_particles(m, refiner_->get_refined_indexes(m, pis[i]));
}
return ret;
}
示例13: do_get_inputs
ModelObjectsTemp RigidLeavesRefiner::do_get_inputs(
Model *m, const ParticleIndexes &pis) const {
ModelObjectsTemp ret = IMP::get_particles(m, pis);
for (unsigned int i = 0; i < pis.size(); ++i) {
ParticleIndexes members
= core::RigidBody(m, pis[i]).get_member_particle_indexes();
ret += IMP::get_particles(m, members);
}
return ret;
}
示例14: setup_particle
void HierarchyLoadXYZs::setup_particle(
RMF::NodeConstHandle n, Model *m, ParticleIndex p,
const ParticleIndexes &rigid_bodies) {
if (!ip_factory_.get_is(n)) return;
if (!core::XYZ::get_is_setup(m, p)) core::XYZ::setup_particle(m, p);
/* If there is a rigid body parent set up, add this particle as a child
(unless it's an old-style rigid body, in which case this has been
done already) */
if (!rigid_bodies.empty()
&& !(rigid_bodies.size()==1 && rigid_bodies.back() == p)
&& !n.get_has_value(rb_index_key_)) {
core::RigidBody rb(m, rigid_bodies.back());
/* For nested rigid bodies, this XYZ particle is *also* the rigid body.
So don't make ourselves our own child - add to the parent rigid body
instead. */
if (rigid_bodies.back() == p) {
IMP_INTERNAL_CHECK(rigid_bodies.size() >= 2,
"Nested rigid body " << m->get_particle_name(p)
<< " but could not find parent rigid body");
rb = core::RigidBody(m, rigid_bodies[rigid_bodies.size() - 2]);
}
rb.add_member(p);
if (reference_frame_factory_.get_is(n)
&& !reference_frame_factory_.get_is_static(n)) {
IMP_LOG_VERBOSE("Member particle " << m->get_particle_name(p)
<< " is not static and is also a rigid body"
<< std::endl);
rb.set_is_rigid_member(p, false);
} else if (!ip_factory_.get_is_static(n)) {
IMP_LOG_VERBOSE("Member particle " << m->get_particle_name(p)
<< " is not static" << std::endl);
rb.set_is_rigid_member(p, false);
} else {
IMP_LOG_VERBOSE("Member particle " << m->get_particle_name(p)
<< " is static" << std::endl);
rb.set_is_rigid_member(p, true);
core::RigidBodyMember(m, p)
.set_internal_coordinates(get_coordinates(n, ip_factory_));
}
}
link_particle(n, m, p, rigid_bodies);
}
示例15: get_bond
/* This is implemented like this so that it doesn't read any particles other
than a and b. To do otherwise would make it rather annoying to use in
evaluate.
*/
Bond get_bond(Bonded a, Bonded b) {
if (a == b) return Bond();
ParticleIndexes ba = a.get_bond_indexes();
ParticleIndexes bb = b.get_bond_indexes();
std::sort(bb.begin(), bb.end());
for (unsigned int i = 0; i < ba.size(); ++i) {
if (std::binary_search(bb.begin(), bb.end(), ba[i])) {
return Bond(a.get_model(), ba[i]);
}
}
return Bond();
}