int main(int argc, char *argv[]) {
  IMP::setup_from_argv(argc, argv, "Test ConsecutivePairContainer.");

  IMP_NEW(IMP::Model, m, ());
  IMP::ParticleIndexes ps;
  IMP::algebra::BoundingBox3D bb(IMP::algebra::Vector3D(0, 0, 0),
                                 IMP::algebra::Vector3D(10, 10, 10));
  for (unsigned int i = 0; i < 15; ++i) {
    ps.push_back(m->add_particle("P"));
    IMP::core::XYZ::setup_particle(m, ps.back(),
                                   IMP::algebra::get_random_vector_in(bb));
  }
  IMP_NEW(IMP::container::ConsecutivePairContainer, cpc, (m, ps));
  IMP_NEW(IMP::core::HarmonicDistancePairScore, hdps, (0, 1));
  IMP::Pointer<IMP::Restraint> r =
      IMP::container::create_restraint(hdps.get(), cpc.get());
  IMP_USAGE_CHECK(r->evaluate(false) > 0, "zero evaluate");
  IMP::Pointer<IMP::Restraint> rd = r->create_decomposition();
  IMP::RestraintsTemp rds = IMP::get_restraints(IMP::RestraintsTemp(1, rd));
  IMP_USAGE_CHECK(rds.size() == ps.size() - 1,
                  "Bad lengths: " << rds.size() << " vs " << ps.size() - 1);
  double re = r->evaluate(false);
  double rde = rd->evaluate(false);
  IMP_CHECK_VARIABLE(re);
  IMP_CHECK_VARIABLE(rde);
  IMP_USAGE_CHECK(std::abs(rde - re) < .1,
                  "Invalid decomposed score: " << re << " vs " << rde);
  return 0;
}
Exemplo n.º 2
0
void transform(IMP::Model* model, IMP::ParticleIndexes& pis,
               const IMP::algebra::Transformation3D& t) {
  for (unsigned int i = 0; i < pis.size(); i++) {
    IMP::core::XYZ d(model, pis[i]);
    d.set_coordinates(t * d.get_coordinates());
  }
}
Exemplo n.º 3
0
IMPINTEGRATIVEDOCKING_BEGIN_INTERNAL_NAMESPACE

IMP::atom::Hierarchy read_pdb(const std::string pdb_file_name,
                              IMP::Model* model,
                              IMP::ParticleIndexes& pis) {

  IMP::atom::Hierarchy mhd = IMP::atom::read_pdb(
      pdb_file_name, model, new IMP::atom::NonWaterNonHydrogenPDBSelector(),
      true, true);

  pis = IMP::get_as<IMP::ParticleIndexes>(
      get_by_type(mhd, IMP::atom::ATOM_TYPE));
  std::cout << pis.size() << " atoms read from " << pdb_file_name << std::endl;
  IMP::atom::add_dope_score_data(mhd);
  return mhd;
}