本文整理汇总了C++中ParticleIndexes类的典型用法代码示例。如果您正苦于以下问题:C++ ParticleIndexes类的具体用法?C++ ParticleIndexes怎么用?C++ ParticleIndexes使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ParticleIndexes类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_get_inputs
ModelObjectsTemp WeightedDerivativesToRefined::do_get_inputs(
Model *m, const ParticleIndexes &pis) const {
ModelObjectsTemp ret = refiner_->get_inputs(m, pis);
for (unsigned int i = 0; i < pis.size(); ++i) {
ret +=
IMP::get_particles(m, refiner_->get_refined_indexes(m, pis[i]));
}
ret += IMP::get_particles(m, pis);
return ret;
}
示例2: do_get_inputs
ModelObjectsTemp BondedPairFilter::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) {
if (Bonded::get_is_setup(m, pis[i])) {
Bonded b(m, pis[i]);
for (unsigned int i = 0; i < b.get_number_of_bonds(); ++i) {
ret.push_back(b.get_bond(i));
}
}
}
return ret;
}
示例3: propagate_velocities
void MolecularDynamics::propagate_velocities(const ParticleIndexes &ps,
double ts) {
for (unsigned int i = 0; i < ps.size(); ++i) {
Float invmass = 1.0 / Mass(get_model(), ps[i]).get_mass();
core::XYZ d(get_model(), ps[i]);
algebra::Vector3D dcoord = d.get_derivatives();
LinearVelocity v(get_model(), ps[i]);
// calculate velocity at t+(delta t) from that at t+(delta t/2)
algebra::Vector3D velocity = v.get_velocity();
velocity += 0.5 * dcoord * deriv_to_acceleration * invmass * ts;
v.set_velocity(velocity);
}
}
示例4: get_coordinates_from_rbs
Coord get_coordinates_from_rbs(Model* m, ParticleIndexes pis,
ParticleIndex refidx) {
// get current reference frame of rbs
Referential ref(m, refidx);
// get x
Coord x;
for (unsigned i = 0; i < pis.size(); i++) {
internal::Referential target(m, pis[i]);
x.coms.push_back(ref.get_local_coords(target.get_centroid()));
x.quats.push_back(ref.get_local_rotation(target.get_rotation()));
}
return x;
}
示例5: do_get_inputs
ModelObjectsTemp SameResiduePairFilter::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) {
if (Atom::get_is_setup(m, pis[i])) {
Particle *parent = Hierarchy(m, pis[i]).get_parent();
if (parent) {
ret.push_back(parent);
}
}
}
return ret;
}
示例6: 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();
}
示例7: mrng
core::MonteCarloMoverResult RevoluteJointMover::do_propose() {
IMP_OBJECT_LOG;
boost::normal_distribution<double> mrng(0, stddev_);
boost::variate_generator<RandomNumberGenerator &,
boost::normal_distribution<double> >
sampler(random_number_generator, mrng);
for (unsigned int i = 0; i < joints_.size(); ++i) {
originals_[i] = joints_[i]->get_angle();
joints_[i]->set_angle(originals_[i] + sampler());
}
//get changed particles' coordinates
ParticleIndexes idx;
core::RigidMembers tmp(joints_[0]->get_parent_node().get_rigid_members());
for (unsigned int i = 0; i < tmp.size(); ++i)
idx.push_back(tmp[i]->get_index());
for (unsigned int j = 0; j < joints_.size(); ++j) {
tmp = joints_[j]->get_child_node().get_rigid_members();
for (unsigned int i = 0; i < tmp.size(); ++i)
idx.push_back(tmp[i]->get_index());
}
return core::MonteCarloMoverResult(idx, 1.0);
}
示例8: setup_degrees_of_freedom
void MolecularDynamics::setup_degrees_of_freedom(
const ParticleIndexes &ps) {
degrees_of_freedom_ = 3 * ps.size();
// If global rotation and translation have been removed, reduce degrees
// of freedom accordingly (kind of ugly...)
for (OptimizerStateIterator o = optimizer_states_begin();
o != optimizer_states_end(); ++o) {
OptimizerState *os = *o;
if (dynamic_cast<RemoveRigidMotionOptimizerState *>(os)) {
degrees_of_freedom_ -= 6;
break;
}
}
}
示例9: propagate_velocities
void MolecularDynamics::propagate_velocities(const ParticleIndexes &ps,
double ts)
{
for (unsigned int i=0; i< ps.size(); ++i) {
Float invmass = 1.0 / Mass(get_model(), ps[i]).get_mass();
for (unsigned j = 0; j < 3; ++j) {
core::XYZ d(get_model(), ps[i]);
Float dcoord = d.get_derivative(j);
// calculate velocity at t+(delta t) from that at t+(delta t/2)
Float velocity = get_model()->get_attribute(vs_[j], ps[i]);
velocity += 0.5 * dcoord * deriv_to_acceleration * invmass * ts;
get_model()->set_attribute(vs_[j], ps[i], velocity);
}
}
}
示例10: 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);
}
示例11: get_singleton_container
void XYZRMovedSingletonContainer::validate() const {
IMP_OBJECT_LOG;
ParticleIndexes pis = get_singleton_container()->get_indexes();
IMP_USAGE_CHECK(pis.size() == backup_.size(), "Backup is not the right size");
}