本文整理汇总了C++中ParticlesTemp类的典型用法代码示例。如果您正苦于以下问题:C++ ParticlesTemp类的具体用法?C++ ParticlesTemp怎么用?C++ ParticlesTemp使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ParticlesTemp类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_reject
void MolecularDynamicsMover::do_reject() {
IMP_OBJECT_LOG;
ParticlesTemp ps = md_->get_simulation_particles();
unsigned nparts = ps.size();
IMP_USAGE_CHECK(coordinates_.size() == ps.size(),
"The list of particles that move has been changed!");
IMP_USAGE_CHECK(velocities_.size() == ps.size(),
"The list of particles that move has been changed!");
for (unsigned i = 0; i < nparts; i++) {
bool isnuisance = Nuisance::get_is_setup(ps[i]);
bool isxyz = core::XYZ::get_is_setup(ps[i]);
IMP_USAGE_CHECK(isnuisance || isxyz,
"Particle " << ps[i] << " is neither nuisance nor xyz!");
if (isnuisance) {
IMP_USAGE_CHECK(coordinates_[i].size() == 1,
"wrong size for coordinates_[" << i << "] !");
IMP_USAGE_CHECK(velocities_[i].size() == 1, "wrong size for velocities_["
<< i << "] !");
Nuisance(ps[i]).set_nuisance(coordinates_[i][0]);
ps[i]->set_value(FloatKey("vel"), velocities_[i][0]);
}
if (isxyz) {
IMP_USAGE_CHECK(coordinates_[i].size() == 3,
"wrong size for coordinates_[" << i << "] !");
IMP_USAGE_CHECK(velocities_[i].size() == 3, "wrong size for velocities_["
<< i << "] !");
core::XYZ(ps[i]).set_coordinate(0, coordinates_[i][0]);
core::XYZ(ps[i]).set_coordinate(1, coordinates_[i][1]);
core::XYZ(ps[i]).set_coordinate(2, coordinates_[i][2]);
ps[i]->set_value(FloatKey("vx"), velocities_[i][0]);
ps[i]->set_value(FloatKey("vy"), velocities_[i][1]);
ps[i]->set_value(FloatKey("vz"), velocities_[i][2]);
}
}
}
示例2: create_blame_geometries
display::Geometries create_blame_geometries(const RestraintsTemp &rs,
const ParticlesTemp &ps,
double max, std::string name) {
IMP_FUNCTION_LOG;
FloatKey key("blame temporary key");
assign_blame(rs, ps, key);
if (max == NO_MAX) {
max = -NO_MAX;
for (unsigned int i = 0; i < ps.size(); ++i) {
max = std::max(ps[i]->get_value(key), max);
}
IMP_LOG_TERSE("Maximum blame value is " << max << std::endl);
}
display::Geometries ret;
for (unsigned int i = 0; i < ps.size(); ++i) {
double colorv;
if (max == 0) {
colorv = 0;
} else {
colorv =
display::get_linear_color_map_value(0, max, ps[i]->get_value(key));
}
display::Color c = display::get_hot_color(colorv);
IMP_NEW(XYZRGeometry, g, (ps[i]));
if (!name.empty()) {
g->set_name(name);
}
g->set_color(c);
ret.push_back(g);
}
return ret;
}
示例3: do_get_inputs
/* Return all particles whose attributes are read by the restraints. To
do this, ask the pair score what particles it uses.*/
ModelObjectsTemp SigmoidRestraintSphere::do_get_inputs() const
{
ParticlesTemp ret;
ret.push_back(get_model()->get_particle(p1_));
ret.push_back(get_model()->get_particle(p2_));
return ret;
}
示例4:
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;
}
示例5: ScoreState
IMPCORE_BEGIN_NAMESPACE
MoveStatisticsScoreState::MoveStatisticsScoreState(
const ParticlesTemp &ps)
: ScoreState(ps[0]->get_model(), "MoveStatisticsScoreState%1%"),
ps_(ps.begin(), ps.end()) {
reset();
}
示例6: get_radius_of_gyration
double get_radius_of_gyration(const ParticlesTemp& ps) {
IMP_USAGE_CHECK(ps.size() > 0, "No particles provided");
bool mass = Mass::get_is_setup(ps[0]);
bool radii = core::XYZR::get_is_setup(ps[0]);
algebra::Vector3D cm(0, 0, 0);
double total = 0;
for (unsigned int i = 0; i < ps.size(); ++i) {
double weight = get_weight(mass, radii, ps[i]);
total += weight;
cm += core::XYZ(ps[i]).get_coordinates() * weight;
}
cm /= total;
double ret = 0;
for (unsigned int i = 0; i < ps.size(); ++i) {
double c;
if (radii) {
c = .6 * square(core::XYZR(ps[i]).get_radius());
} else {
c = 0;
}
double d = get_squared_distance(core::XYZ(ps[i]).get_coordinates(), cm);
ret += get_weight(mass, radii, ps[i]) * (d + c);
}
return std::sqrt(ret / total);
}
示例7: destroy
void destroy(Hierarchy d) {
ParticlesTemp all;
//core::Hierarchy h=d;
core::gather(d, True(), std::back_inserter(all));
for (unsigned int i=0; i< all.size(); ++i) {
if (Bonded::particle_is_instance(all[i])) {
Bonded b(all[i]);
while (b.get_number_of_bonds() > 0) {
destroy_bond(b.get_bond(b.get_number_of_bonds()-1));
}
}
Hierarchy hc(all[i]);
while (hc.get_number_of_children() > 0) {
hc.remove_child(hc.get_child(hc.get_number_of_children()-1));
}
}
// If this Hierarchy has a parent, remove the relationship
Hierarchy parent = d.get_parent();
if (parent) {
parent.remove_child(d);
}
for (unsigned int i=0; i< all.size(); ++i) {
all[i]->get_model()->remove_particle(all[i]);
}
}
示例8: assign_blame
void assign_blame(const RestraintsTemp &rs,
const ParticlesTemp &ps, FloatKey attribute) {
IMP_FUNCTION_LOG;
for (unsigned int i = 0; i < ps.size(); ++i) {
if (ps[i]->has_attribute(attribute)) {
ps[i]->set_value(attribute, 0);
} else {
ps[i]->add_attribute(attribute, 0, false);
}
}
Restraints drs;
for (unsigned int i = 0; i < rs.size(); ++i) {
Pointer<Restraint> rd = rs[i]->create_decomposition();
if (rd) {
drs.push_back(rd);
}
}
IMP_NEW(RestraintsScoringFunction, rsf, (drs));
rsf->evaluate(false);
DependencyGraph dg = get_dependency_graph(IMP::internal::get_model(rs));
// attempt to get around boost/gcc bug and the most vexing parse
DependencyGraphVertexIndex dgi((IMP::get_vertex_index(dg)));
ControlledBy controlled_by;
for (unsigned int i = 0; i < ps.size(); ++i) {
ParticlesTemp cps = get_dependent_particles(ps[i], ps, dg, dgi);
IMP_INTERNAL_CHECK(cps.size() > 0, "No dependent particles for " << ps[i]);
for (unsigned int j = 0; j < cps.size(); ++j) {
controlled_by[cps[j]] = ps[i];
}
}
for (unsigned int i = 0; i < drs.size(); ++i) {
distribute_blame(drs[i], controlled_by, attribute, 1.0);
}
}
示例9: save_coordinates
void MolecularDynamicsMover::save_coordinates() {
IMP_OBJECT_LOG;
ParticlesTemp ps = md_->get_simulation_particles();
unsigned nparts = ps.size();
coordinates_.clear();
coordinates_.reserve(nparts);
velocities_.clear();
velocities_.reserve(nparts);
for (unsigned i = 0; i < nparts; i++) {
bool isnuisance = Nuisance::get_is_setup(ps[i]);
bool isxyz = core::XYZ::get_is_setup(ps[i]);
IMP_USAGE_CHECK(isnuisance || isxyz,
"Particle " << ps[i] << " is neither nuisance nor xyz!");
if (isnuisance) {
std::vector<double> x(1, Nuisance(ps[i]).get_nuisance());
coordinates_.push_back(x);
std::vector<double> v(1, ps[i]->get_value(FloatKey("vel")));
velocities_.push_back(v);
}
if (isxyz) {
std::vector<double> coords;
core::XYZ d(ps[i]);
coords.push_back(d.get_coordinate(0));
coords.push_back(d.get_coordinate(1));
coords.push_back(d.get_coordinate(2));
coordinates_.push_back(coords);
std::vector<double> v;
v.push_back(ps[i]->get_value(FloatKey("vx")));
v.push_back(ps[i]->get_value(FloatKey("vy")));
v.push_back(ps[i]->get_value(FloatKey("vz")));
velocities_.push_back(v);
}
}
}
示例10: 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;
}
示例11: do_get_inputs
ModelObjectsTemp NOERestraint::do_get_inputs() const {
ParticlesTemp ret;
ret.push_back(p0_);
ret.push_back(p1_);
ret.push_back(sigma_);
ret.push_back(gamma_);
return ret;
}
示例12:
const ParticlesTemp
FixedRefiner::get_refined(Particle *) const
{
ParticlesTemp ps;
for(unsigned int i=0; i < pis_.size(); i++){
ps.push_back(m_->get_particle(pis_[i]));
}
return ps;
}
示例13: get_input_particles
ParticlesTemp RadiusOfGyrationRestraint::get_input_particles() const
{
ParticlesTemp pt;
for (ParticleConstIterator it= particles_begin();
it != particles_end(); ++it) {
pt.push_back(*it);
}
return pt;
}
示例14:
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;
}
示例15: 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");
}