Beispiel #1
0
void add_NuisanceMover(Particle *p, double dp, core::MonteCarloMovers &mvs) {
  // put particle in a list
  Particles ps;
  ps.push_back(p);
  // put nuisance floatkey in a list
  FloatKeys fks;
  fks.push_back(FloatKey("nuisance"));
  IMP_NEW(core::NormalMover, mv, (ps, fks, dp));
  mvs.push_back(mv);
}
Beispiel #2
0
FloatKey Weight::get_weight_key(int j) {
  static FloatKeys kk;
  if (kk.empty()) {
    for (int i = 0; i < nstates_max; ++i) {
      std::stringstream out;
      out << i;
      kk.push_back(FloatKey("weight" + out.str()));
    }
  }
  return kk[j];
}
Beispiel #3
0
base::Vector<char>
write_particles_to_buffer(const ParticlesTemp &particles,
                          const FloatKeys &keys) {
  if (particles.empty() || keys.empty()) {
    return base::Vector<char>();
  }
  unsigned int size= particles.size()*keys.size()*sizeof(double);
  base::Vector<char> ret(size);
  write_particles_to_buffer(particles, keys, &ret.front(), size);
  return ret;
}
Beispiel #4
0
void Particle::show(std::ostream &out) const {
  internal::PrefixStream preout(&out);
  preout << "index: " << get_index()
         << (get_is_active() ? " (active)" : " (dead)");
  preout << std::endl;

  if (get_model()) {
    {
      FloatKeys fks = get_float_keys();
      if (!fks.empty()) {
        preout << "float attributes:" << std::endl;
        preout.set_prefix("  ");
        for (FloatKeys::const_iterator it = fks.begin(); it != fks.end();
             ++it) {
          FloatKey k = *it;
          preout << k << ": " << get_model()->get_attribute(k, id_, false);
          preout << " (" << get_model()->get_derivative(k, id_, false) << ") ";
          preout << (get_is_optimized(k) ? " (optimized)" : "");
          preout << std::endl;
        }
        preout.set_prefix("");
      }
    }
    show_attributes(get_model(), get_int_keys(), id_, "int", IdentityValue(),
                    preout);
    show_attributes(get_model(), get_string_keys(), id_, "string",
                    IdentityValue(), preout);
    show_attributes(
        get_model(),
        get_model()->internal::ParticleAttributeTable::get_attribute_keys(id_),
        id_, "particle", NameValue(get_model()), preout);
    show_attributes(
        get_model(),
        get_model()->internal::ObjectAttributeTable::get_attribute_keys(id_),
        id_, "object", DirectNameValue(), preout);
    show_attributes(
        get_model(),
        get_model()->internal::ParticlesAttributeTable::get_attribute_keys(id_),
        id_, "particles", SizeValue<NameValue>(NameValue(get_model())), preout);
    show_attributes(
        get_model(),
        get_model()->internal::ObjectsAttributeTable::get_attribute_keys(id_),
        id_, "objects", SizeValue<DirectNameValue>(), preout);
    show_attributes(
        get_model(),
        get_model()->internal::IntsAttributeTable::get_attribute_keys(id_), id_,
        "ints", SizeValue<IdentityValue>(), preout);
  }
}
Beispiel #5
0
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()));
}
Beispiel #6
0
void KMLProxy::initialize(Model *m,const Particles &ps,
    const FloatKeys &atts,unsigned int num_centers){
  for(Particles::const_iterator it = ps.begin(); it != ps.end();it++)
  {ps_.push_back(*it);}
  for(FloatKeys::const_iterator it = atts.begin();
      it != atts.end();it++)
  {atts_.push_back(*it);}
  m_ = m;
  kcenters_=num_centers;
  dim_=atts.size();
  centroids_ = Particles();
  data_ = new KMData(dim_,ps_.size());
  for(unsigned int i=0;i<ps_.size(); i++) {
    for(unsigned int j=0;j<atts.size();j++){
      (*(*data_)[i])[j]=ps_[i]->get_value(atts[j]);
    }
  }
  is_init_=true;
}
Beispiel #7
0
void
read_particles_from_buffer( const base::Vector<char> &buffer,
                            const ParticlesTemp &particles,
                            const FloatKeys &keys) {
  if (particles.empty() || keys.empty()) {
    return;
  }
  read_particles_from_buffer(&buffer.front(),
                             buffer.size()*sizeof(double), particles, keys);
  IMP_CHECK_MODEL_PARTICLES(particles[0]->get_model());
}
Beispiel #8
0
FloatKeys _pass_float_keys(const FloatKeys &in) {
  for (unsigned int i = 0; i < in.size(); ++i) {
    std::cout << in[i] << " ";
  }
  return in;
}
Beispiel #9
0
const FloatKeys Voxel::get_keys() {
  static FloatKeys keys = core::XYZ::get_xyz_keys();
  keys.push_back(core::XYZR::get_radius_key());
  keys.push_back(Voxel::get_density_key());
  return keys;
}