コード例 #1
0
void SingletonPredicate::remove_if_not_equal(Model *m,
                                             ParticleIndexes& ps,
                                             int value) const {
  ps.erase(std::remove_if(ps.begin(), ps.end(),
                          make_predicate_not_equal(this, m, value)),
           ps.end());

}
コード例 #2
0
/* 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();
}
コード例 #3
0
ファイル: GridClosePairsFinder.cpp プロジェクト: salilab/imp
ParticleIndexPairs GridClosePairsFinder::get_close_pairs(
    Model *m, const ParticleIndexes &ca,
    const ParticleIndexes &cb) const {
  IMP_OBJECT_LOG;
  set_was_used(true);
  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;
}
コード例 #4
0
ParticleIndexes SingletonContainerSet::get_all_possible_indexes() const {
  ParticleIndexes sum;
  for (SingletonContainerConstIterator it= singleton_containers_begin();
       it != singleton_containers_end(); ++it) {
    ParticleIndexes cur=(*it)->get_all_possible_indexes();
    sum.insert(sum.end(), cur.begin(), cur.end());
  }
  return sum;
}
コード例 #5
0
ファイル: GridClosePairsFinder.cpp プロジェクト: salilab/imp
ParticleIndexPairs GridClosePairsFinder::get_close_pairs(
    Model *m, const ParticleIndexes &c) const {
  IMP_OBJECT_LOG;
  set_was_used(true);
  IMP_LOG_TERSE("Rebuilding NBL with Grid and cutoff " << get_distance()
                                                       << std::endl);
  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;
}
コード例 #6
0
bool InternalDynamicListTripletContainer::
check_list(const ParticleIndexes& cp) const {
  ParticleIndexes app
    = IMP::internal::get_index(scope_->get_all_possible_particles());

  compatibility::set<ParticleIndex> all(app.begin(),
                                    app.end());
  for (unsigned int i=0; i< cp.size(); ++i) {
    IMP_USAGE_CHECK(all.find(cp[i]) != all.end(),
                    "Particle " << cp[i]
                    << " is not in the list of all possible particles");
  }
  return true;
}
コード例 #7
0
ファイル: Simulator.cpp プロジェクト: AljGaber/imp
ParticleIndexes Simulator::get_simulation_particle_indexes() const {
  IMP_OBJECT_LOG;
  ParticleIndexes ps;
  if (get_number_of_particles() == 0) {
    Model *m = get_model();
    ParticleIndexes pis = m->get_particle_indexes();
    for (ParticleIndexes::const_iterator it = pis.begin();
         it != pis.end(); ++it) {
      if (get_is_simulation_particle(*it)) {
        ps.push_back(*it);
      }
    }
  } else {
    ps = IMP::internal::get_index(
        ParticlesTemp(particles_begin(), particles_end()));
  }
  return ps;
}