本文整理汇总了C++中ParticlesTemp::end方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticlesTemp::end方法的具体用法?C++ ParticlesTemp::end怎么用?C++ ParticlesTemp::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticlesTemp
的用法示例。
在下文中一共展示了ParticlesTemp::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assign_velocities
void MolecularDynamics::assign_velocities(Float temperature) {
ParticleIndexes ips = get_simulation_particle_indexes();
setup_degrees_of_freedom(ips);
ParticlesTemp ps = IMP::internal::get_particle(get_model(), ips);
boost::normal_distribution<Float> mrng(0., 1.);
boost::variate_generator<RandomNumberGenerator &,
boost::normal_distribution<Float> >
sampler(random_number_generator, mrng);
for (ParticlesTemp::iterator iter = ps.begin(); iter != ps.end();
++iter) {
Particle *p = *iter;
LinearVelocity(p).set_velocity(algebra::Vector3D(sampler(), sampler(),
sampler()));
}
Float rescale =
sqrt(temperature / get_kinetic_temperature(get_kinetic_energy()));
for (ParticlesTemp::iterator iter = ps.begin(); iter != ps.end();
++iter) {
Particle *p = *iter;
LinearVelocity v(p);
algebra::Vector3D velocity = v.get_velocity();
velocity *= rescale;
v.set_velocity(velocity);
}
}
示例2:
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;
}
示例3: get_input_particles
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;
}
示例4: ScoreState
IMPCORE_BEGIN_NAMESPACE
MoveStatisticsScoreState::MoveStatisticsScoreState(
const ParticlesTemp &ps)
: ScoreState(ps[0]->get_model(), "MoveStatisticsScoreState%1%"),
ps_(ps.begin(), ps.end()) {
reset();
}
示例5:
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;
}
示例6: get_interaction_graph
InteractionGraph get_interaction_graph(ScoringFunctionAdaptor rsi,
const ParticlesTemp &ps) {
if (ps.empty()) return InteractionGraph();
InteractionGraph ret(ps.size());
Restraints rs =
create_decomposition(rsi->create_restraints());
// Model *m= ps[0]->get_model();
boost::unordered_map<ModelObject *, int> map;
InteractionGraphVertexName pm = boost::get(boost::vertex_name, ret);
DependencyGraph dg = get_dependency_graph(ps[0]->get_model());
DependencyGraphVertexIndex index = IMP::get_vertex_index(dg);
/*IMP_IF_LOG(VERBOSE) {
IMP_LOG_VERBOSE( "dependency graph is \n");
IMP::internal::show_as_graphviz(dg, std::cout);
}*/
for (unsigned int i = 0; i < ps.size(); ++i) {
ParticlesTemp t = get_dependent_particles(
ps[i], ParticlesTemp(ps.begin(), ps.end()), dg, index);
for (unsigned int j = 0; j < t.size(); ++j) {
IMP_USAGE_CHECK(map.find(t[j]) == map.end(),
"Currently particles which depend on more "
<< "than one particle "
<< "from the input set are not supported."
<< " Particle \"" << t[j]->get_name()
<< "\" depends on \"" << ps[i]->get_name()
<< "\" and \""
<< ps[map.find(t[j])->second]->get_name() << "\"");
map[t[j]] = i;
}
IMP_IF_LOG(VERBOSE) {
IMP_LOG_VERBOSE("Particle \"" << ps[i]->get_name() << "\" controls ");
for (unsigned int i = 0; i < t.size(); ++i) {
IMP_LOG_VERBOSE("\"" << t[i]->get_name() << "\" ");
}
IMP_LOG_VERBOSE(std::endl);
}
pm[i] = ps[i];
}
IMP::Restraints all_rs = IMP::get_restraints(rs);
for (Restraints::const_iterator it = all_rs.begin();
it != all_rs.end(); ++it) {
ModelObjectsTemp pl = (*it)->get_inputs();
add_edges(ps, pl, map, *it, ret);
}
/* Make sure that composite score states (eg the normalizer for
rigid body rotations) don't induce interactions among unconnected
particles.*/
ScoreStatesTemp ss = get_required_score_states(rs);
for (ScoreStatesTemp::const_iterator it = ss.begin(); it != ss.end(); ++it) {
ModelObjectsTemps interactions = (*it)->get_interactions();
for (unsigned int i = 0; i < interactions.size(); ++i) {
add_edges(ps, interactions[i], map, *it, ret);
}
}
IMP_INTERNAL_CHECK(boost::num_vertices(ret) == ps.size(),
"Wrong number of vertices " << boost::num_vertices(ret)
<< " vs " << ps.size());
return ret;
}
示例7: FloatKey
IMPATOM_BEGIN_NAMESPACE
RemoveRigidMotionOptimizerState::RemoveRigidMotionOptimizerState(
const ParticlesTemp &pis, unsigned skip_steps) :
pis_(pis.begin(), pis.end()), skip_steps_(skip_steps),
call_number_(0)
{
vs_[0] = FloatKey("vx");
vs_[1] = FloatKey("vy");
vs_[2] = FloatKey("vz");
}
示例8: get_refined
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;
}
示例9: do_propose
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);
}
示例10: get_kinetic_energy
Float MolecularDynamics::get_kinetic_energy() const {
// Conversion factor to get energy in kcal/mol from velocities in A/fs and
// mass in g/mol
static const Float conversion = 1.0 / 4.1868e-4;
Float ekinetic = 0.;
ParticlesTemp ps = get_simulation_particles();
for (ParticlesTemp::iterator iter = ps.begin(); iter != ps.end();
++iter) {
Particle *p = *iter;
algebra::Vector3D v = LinearVelocity(p).get_velocity();
Float mass = Mass(p).get_mass();
ekinetic += mass * (v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
}
return 0.5 * ekinetic * conversion;
}
示例11: create_rigid_body
// 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;
}
示例12: get_subset
Subset RestraintCache::get_subset(Restraint *r,
const DepMap &dependencies) const {
ParticlesTemp ups = IMP::get_input_particles(r->get_inputs());
std::sort(ups.begin(), ups.end());
ups.erase(std::unique(ups.begin(), ups.end()), ups.end());
ParticlesTemp outps;
for (unsigned int i = 0; i < ups.size(); ++i) {
DepMap::const_iterator it = dependencies.find(ups[i]);
if (it != dependencies.end()) {
outps = outps + it->second;
}
}
std::sort(outps.begin(), outps.end());
outps.erase(std::unique(outps.begin(), outps.end()), outps.end());
return Subset(outps);
}
示例13:
ExampleSubsetFilterTable::ExampleSubsetFilterTable(
unsigned int max_diff, const ParticlesTemp& ps)
: domino::SubsetFilterTable("ExampleSubsetFilterTable%1%"),
max_diff_(max_diff),
ps_(ps.begin(), ps.end()) {}
示例14: get_restraint_graph
SubsetGraph get_restraint_graph(ScoringFunctionAdaptor in,
const ParticleStatesTable *pst) {
RestraintsTemp rs =
IMP::create_decomposition(in->create_restraints());
// ScoreStatesTemp ss= get_required_score_states(rs);
SubsetGraph ret(rs.size()); // + ss.size());
IMP_LOG_TERSE("Creating restraint graph on " << rs.size() << " restraints."
<< std::endl);
boost::unordered_map<Particle *, int> map;
SubsetGraphVertexName pm = boost::get(boost::vertex_name, ret);
DependencyGraph dg = get_dependency_graph(rs[0]->get_model());
DependencyGraphVertexIndex index = IMP::get_vertex_index(dg);
/*IMP_IF_LOG(VERBOSE) {
IMP_LOG_VERBOSE( "dependency graph is \n");
IMP::internal::show_as_graphviz(dg, std::cout);
}*/
Subset ps = pst->get_subset();
for (unsigned int i = 0; i < ps.size(); ++i) {
ParticlesTemp t = get_dependent_particles(
ps[i], ParticlesTemp(ps.begin(), ps.end()), dg, index);
for (unsigned int j = 0; j < t.size(); ++j) {
IMP_USAGE_CHECK(map.find(t[j]) == map.end(),
"Currently particles which depend on more "
<< "than one particle "
<< "from the input set are not supported."
<< " Particle \"" << t[j]->get_name()
<< "\" depends on \"" << ps[i]->get_name()
<< "\" and \""
<< ps[map.find(t[j])->second]->get_name() << "\"");
map[t[j]] = i;
}
IMP_IF_LOG(VERBOSE) {
IMP_LOG_VERBOSE("Particle \"" << ps[i]->get_name() << "\" controls ");
for (unsigned int i = 0; i < t.size(); ++i) {
IMP_LOG_VERBOSE("\"" << t[i]->get_name() << "\" ");
}
IMP_LOG_VERBOSE(std::endl);
}
}
for (unsigned int i = 0; i < rs.size(); ++i) {
ParticlesTemp pl = IMP::get_input_particles(rs[i]->get_inputs());
std::sort(pl.begin(), pl.end());
pl.erase(std::unique(pl.begin(), pl.end()), pl.end());
Subset os(pl);
for (unsigned int j = 0; j < pl.size(); ++j) {
pl[j] = ps[map[pl[j]]];
}
std::sort(pl.begin(), pl.end());
pl.erase(std::unique(pl.begin(), pl.end()), pl.end());
Subset s(pl);
IMP_LOG_VERBOSE("Subset for restraint " << rs[i]->get_name() << " is " << s
<< " from " << os << std::endl);
pm[i] = s;
}
/*ScoreStatesTemp ss= get_required_score_states(rs);
for (ScoreStatesTemp::const_iterator it= ss.begin();
it != ss.end(); ++it) {
ParticlesTemp pl= (*it)->get_input_particles();
add_edges(ps, pl, map, *it, ret);
ParticlesTemp opl= (*it)->get_output_particles();
add_edges(ps, opl, map, *it, ret);
}
IMP_INTERNAL_CHECK(boost::num_vertices(ret) == ps.size(),
"Wrong number of vertices "
<< boost::num_vertices(ret)
<< " vs " << ps.size());*/
for (unsigned int i = 0; i < boost::num_vertices(ret); ++i) {
for (unsigned int j = 0; j < i; ++j) {
if (get_intersection(pm[i], pm[j]).size() > 0) {
boost::add_edge(i, j, ret);
IMP_LOG_VERBOSE("Connecting " << rs[i]->get_name() << " with "
<< rs[j]->get_name() << std::endl);
}
}
}
return ret;
}
示例15: do_get_inputs
ModelObjectsTemp RigidBodyMover::do_get_inputs() const {
ParticlesTemp ret = ParticlesTemp(1, d_);
ret.insert(ret.end(), ps_.begin(), ps_.end());
return ret;
}