Exemplo n.º 1
0
ModelObjectsTemp TransformationAndReflectionSymmetry::do_get_inputs(
    kernel::Model *m, const kernel::ParticleIndexes &pis) const {
  kernel::ModelObjectsTemp ret(2 * pis.size());
  for (unsigned int i = 0; i < pis.size(); ++i) {
    ret[2 * i + 0] = m->get_particle(pis[i]);
    ret[2 * i + 0] = Reference(m, pis[i]).get_reference_particle();
  }
  return ret;
}
Exemplo n.º 2
0
ModelObjectsTemp AngleSingletonScore::do_get_inputs(
    kernel::Model *m, const kernel::ParticleIndexes &pi) const {
  kernel::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;
}
Exemplo n.º 3
0
ParticleIndexPairs GridClosePairsFinder::get_close_pairs(
    kernel::Model *m, const kernel::ParticleIndexes &ca,
    const kernel::ParticleIndexes &cb) const {
  IMP_OBJECT_LOG;
  set_was_used(true);
  kernel::ParticleIndexPairs out;
  internal::ParticleIndexHelper::fill_close_pairs(
      internal::ParticleIndexHelper::get_particle_set(ca.begin(), ca.end(), 0),
      internal::ParticleIndexHelper::get_particle_set(cb.begin(), cb.end(), 1),
      internal::ParticleIndexTraits(m, get_distance()),
      internal::ParticleIndexPairSink(m, access_pair_filters(), out));
  return out;
}
Exemplo n.º 4
0
ParticleIndexPairs GridClosePairsFinder::get_close_pairs(
    kernel::Model *m, const kernel::ParticleIndexes &c) const {
  IMP_OBJECT_LOG;
  set_was_used(true);
  IMP_LOG_TERSE("Rebuilding NBL with Grid and cutoff " << get_distance()
                                                       << std::endl);
  kernel::ParticleIndexPairs out;
  internal::ParticleIndexHelper::fill_close_pairs(
      internal::ParticleIndexHelper::get_particle_set(c.begin(), c.end(), 0),
      internal::ParticleIndexTraits(m, get_distance()),
      internal::ParticleIndexPairSink(m, access_pair_filters(), out));
  return out;
}
Exemplo n.º 5
0
void HierarchyLoadLink::create_recursive(kernel::Model *m,
                                         kernel::ParticleIndex root,
                                         kernel::ParticleIndex cur,
                                         RMF::NodeConstHandle name,
                                         kernel::ParticleIndexes rigid_bodies,
                                         Data &data) {
  set_association(name, m->get_particle(cur));
  unsigned int state = get_coords_state(name, intermediate_particle_factory_,
                                        reference_frame_factory_);
  data.load_static.setup_particle(name, m, cur, rigid_bodies);
  data.load_local_coordinates.setup_particle(name, state, m, cur, rigid_bodies);
  data.load_static_coordinates.setup_particle(name, state, m, cur,
                                              rigid_bodies);
  data.load_global_coordinates.setup_particle(name, state, m, cur,
                                              rigid_bodies);

  if (core::RigidBody::get_is_setup(m, cur)) {
    rigid_bodies.push_back(cur);
  }
  RMF::NodeConstHandles ch = name.get_children();
  for (unsigned int i = 0; i < ch.size(); ++i) {
    if (ch[i].get_type() == RMF::REPRESENTATION) {
      kernel::ParticleIndex child = m->add_particle(ch[i].get_name());
      atom::Hierarchy(m, cur)
          .add_child(atom::Hierarchy::setup_particle(m, child));
      create_recursive(m, root, child, ch[i], rigid_bodies, data);
    }
  }
  do_setup_particle(m, root, cur, name);
}
Exemplo n.º 6
0
void HierarchySaveLink::add_recursive(Model *m, kernel::ParticleIndex root,
                                      kernel::ParticleIndex p,
                                      kernel::ParticleIndexes rigid_bodies,
                                      RMF::NodeHandle cur, Data &data) {
  IMP_LOG_VERBOSE("Adding " << atom::Hierarchy(m, p) << std::endl);
  // make sure not to double add
  if (p != root) set_association(cur, m->get_particle(p));
  data.save_static.setup_node(m, p, cur);
  bool local_coords =
      data.save_local_coordinates.setup_node(m, p, cur, rigid_bodies);
  bool global_coords =
      data.save_global_coordinates.setup_node(m, p, cur, rigid_bodies);
  bool static_coords =
      data.save_static_coordinates.setup_node(m, p, cur, rigid_bodies);
  IMP_INTERNAL_CHECK(!local_coords || !global_coords,
                     "A particle can't have saved local and global coords");

  do_setup_node(m, root, p, cur);

  if (core::RigidBody::get_is_setup(m, p)) {
    rigid_bodies.push_back(p);
  }
  for (unsigned int i = 0; i < atom::Hierarchy(m, p).get_number_of_children();
       ++i) {
    kernel::ParticleIndex pc = atom::Hierarchy(m, p).get_child_index(i);
    RMF::NodeHandle curc =
        cur.add_child(get_good_name(m, pc), RMF::REPRESENTATION);
    add_recursive(m, root, pc, rigid_bodies, curc, data);
  }
}
Exemplo n.º 7
0
void HierarchyLoadLink::add_link_recursive(kernel::Model *m,
                                           kernel::ParticleIndex root,
                                           kernel::ParticleIndex cur,
                                           RMF::NodeConstHandle node,
                                           kernel::ParticleIndexes rigid_bodies,
                                           Data &data) {
  IMP_USAGE_CHECK(get_good_name(m, cur) == node.get_name(),
                  "Names don't match");
  set_association(node, m->get_particle(cur), true);
  RMF::NodeConstHandles ch = node.get_children();
  unsigned int state = get_coords_state(node, intermediate_particle_factory_,
                                        reference_frame_factory_);
  data.load_static.link_particle(node, m, cur, rigid_bodies);
  data.load_global_coordinates.link_particle(node, state, m, cur, rigid_bodies);
  // data.load_static_coordinates.link_particle(node, m, cur, rigid_bodies);
  data.load_local_coordinates.link_particle(node, state, m, cur, rigid_bodies);

  do_link_particle(m, root, cur, node);

  if (core::RigidBody::get_is_setup(m, cur)) {
    rigid_bodies.push_back(cur);
  }
  int child = 0;
  for (unsigned int i = 0; i < ch.size(); ++i) {
    if (ch[i].get_type() == RMF::REPRESENTATION) {
      add_link_recursive(m, root,
                         atom::Hierarchy(m, cur).get_child_index(child), ch[i],
                         rigid_bodies, data);
      ++child;
    }
  }
}
Exemplo n.º 8
0
ParticleIndexPairs QuadraticClosePairsFinder::get_close_pairs(
    kernel::Model *m, const kernel::ParticleIndexes &pt) const {
  set_was_used(true);
  IMP_OBJECT_LOG;
  IMP_LOG_TERSE("Adding close pairs from "
                << pt.size() << " particles with threshold " << get_distance()
                << std::endl);
  kernel::ParticleIndexPairs ret;
  for (unsigned int i = 0; i < pt.size(); ++i) {
    for (unsigned int j = 0; j < i; ++j) {
      if (get_are_close(m, pt[i], pt[j])) {
        ret.push_back(kernel::ParticleIndexPair(pt[i], pt[j]));
      }
    }
  }
  return ret;
}
Exemplo n.º 9
0
ParticleIndexPairs QuadraticClosePairsFinder::get_close_pairs(
    kernel::Model *m, const kernel::ParticleIndexes &pta,
    const kernel::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);
  kernel::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(kernel::ParticleIndexPair(pta[i], ptb[j]));
      }
    }
  }
  return ret;
}
Exemplo n.º 10
0
ModelObjectsTemp LeavesRefiner::do_get_inputs(
    kernel::Model *m, const kernel::ParticleIndexes &pis) const {
  kernel::ModelObjectsTemp ret;
  for (unsigned int i = 0; i < pis.size(); ++i) {
    ret += get_all_descendants(Hierarchy(m, pis[i], traits_));
  }
  return ret;
}
Exemplo n.º 11
0
ModelObjectsTemp TransformationSymmetry::do_get_inputs(
    kernel::Model *m, const kernel::ParticleIndexes &pis) const {
  kernel::ModelObjectsTemp ret = IMP::kernel::get_particles(m, pis);
  for (unsigned int i = 0; i < pis.size(); ++i) {
    ret.push_back(Reference(m, pis[i]).get_reference_particle());
  }
  return ret;
}
Exemplo n.º 12
0
ModelObjectsTemp DerivativesToRefined::do_get_outputs(
    kernel::Model *m, const kernel::ParticleIndexes &pis) const {
  kernel::ModelObjectsTemp ret;
  for (unsigned int i = 0; i < pis.size(); ++i) {
    ret +=
        IMP::kernel::get_particles(m, refiner_->get_refined_indexes(m, pis[i]));
  }
  return ret;
}
Exemplo n.º 13
0
ModelObjectsTemp SoftCylinderPairScore::do_get_inputs(
    kernel::Model *m, const kernel::ParticleIndexes &pis) const {
  kernel::ModelObjectsTemp ret(pis.size() * 3);
  for (unsigned int i = 0; i < pis.size(); ++i) {
    ret[3 * i + 0] = m->get_particle(pis[i]);
    ret[3 * i + 1] = atom::Bond(m, pis[i]).get_bonded(0);
    ret[3 * i + 2] = atom::Bond(m, pis[i]).get_bonded(1);
  }
  return ret;
}
Exemplo n.º 14
0
void Selection::set_hierarchies(kernel::Model *m,
                                const kernel::ParticleIndexes &pi) {
  m_ = m;
  h_ = pi;
  for (unsigned int i = 0; i < pi.size(); ++i) {
    Hierarchy h(m_, pi[i]);
    IMP_USAGE_CHECK(h.get_is_valid(true), "Hierarchy " << h
                                                       << " is not valid.");
  }
}
Exemplo n.º 15
0
ModelObjectsTemp RefinedPairsPairScore::do_get_inputs(
    kernel::Model *m, const kernel::ParticleIndexes &pis) const {
  kernel::ParticleIndexes ps;
  for (unsigned int i = 0; i < pis.size(); ++i) {
    ps += get_indexes(get_set(m->get_particle(pis[i]), r_));
  }
  kernel::ModelObjectsTemp ret;
  ret += f_->get_inputs(m, ps);
  ret += r_->get_inputs(m, ps);
  return ret;
}