示例#1
0
// for C++
Selection::Selection(Hierarchy h, std::string molname, int residue_index)
    : radius_(-1) {
  set_hierarchies(h.get_model(),
                  kernel::ParticleIndexes(1, h.get_particle_index()));
  set_molecules(Strings(1, molname));
  set_residue_indexes(Ints(1, residue_index));
}
IMPATOM_BEGIN_NAMESPACE

CHARMMStereochemistryRestraint::CHARMMStereochemistryRestraint(Hierarchy h,
                                             CHARMMTopology *topology):
  Restraint(h->get_model(), "CHARMMStereochemistryRestraint%1%")
{
  bonds_ = topology->add_bonds(h);
  angles_ = topology->get_parameters()->create_angles(bonds_);
  dihedrals_ = topology->get_parameters()->create_dihedrals(bonds_);
  impropers_ = topology->add_impropers(h);

  bond_score_ = new BondSingletonScore(new core::Harmonic(0., 1.));
  angle_score_ = new AngleSingletonScore(new core::Harmonic(0., 1.));
  dihedral_score_ = new DihedralSingletonScore();
  improper_score_ = new ImproperSingletonScore(new core::Harmonic(0., 1.));
}
示例#3
0
Hierarchy create_simplified_along_backbone(Hierarchy in,
                                           int num_res,
                                           bool keep_detailed) {
  Hierarchies chains= get_by_type(in, CHAIN_TYPE);
  if (chains.size() > 1) {
    Hierarchy root= Hierarchy::setup_particle(new Particle(in->get_model(),
                                                           in->get_name()));
    for (unsigned int i=0; i< chains.size(); ++i) {
      Chain chain(chains[i].get_particle());
      root.add_child(create_simplified_along_backbone(chain, num_res));
    }
    return root;
  } else if (chains.size()==1) {
    // make sure to cast it to chain to get the right overload
    return create_simplified_along_backbone(Chain(chains[0]), num_res,
                                            keep_detailed);
  } else {
    IMP_THROW("No chains to simplify", ValueException);
  }
}
示例#4
0
IMP::core::RigidBody create_compatible_rigid_body(Hierarchy h,
                                               Hierarchy reference) {
  ParticlesTemp hl= get_leaves(h);
  ParticlesTemp rl= get_leaves(reference);
  algebra::Transformation3D tr
    = algebra::get_transformation_aligning_first_to_second(rl, hl);
  algebra::Transformation3D rtr
    = core::RigidMember(reference).get_rigid_body().\
    get_reference_frame().get_transformation_to();
  algebra::Transformation3D rbtr= tr*rtr;

  Particle *rbp= new Particle(h->get_model());
  rbp->set_name(h->get_name()+" rigid body");
  ParticlesTemp all = rb_process(h);
  core::RigidBody rbd
    = core::RigidBody::setup_particle(rbp, algebra::ReferenceFrame3D(rbtr));
  for (unsigned int i=0; i< all.size(); ++i) {
    rbd.add_member(all[i]);
  }
  rbd.set_coordinates_are_optimized(true);
  IMP_INTERNAL_CHECK(h.get_is_valid(true), "Invalid hierarchy produced");
  return rbd;
}
示例#5
0
Selection::Selection(Hierarchy h) : radius_(-1) {
  set_hierarchies(h.get_model(),
                  kernel::ParticleIndexes(1, h.get_particle_index()));
}