ParticleIndexPairs ConsecutivePairContainer::get_indexes() const {
    ParticleIndexPairs ret(ps_.size()-1);
    for (unsigned int i=1; i< ps_.size(); ++i) {
        ret[i-1]= ParticleIndexPair(ps_[i-1], ps_[i]);
    }
    return ret;
}
예제 #2
0
IMPCORE_BEGIN_NAMESPACE

DistanceRestraint::DistanceRestraint(Model *m, UnaryFunction* score_func,
                                     ParticleIndexAdaptor p1,
                                     ParticleIndexAdaptor p2,
                                     std::string name)
    : IMP::internal::TupleRestraint<DistancePairScore>(
          new DistancePairScore(score_func), m,
          ParticleIndexPair(p1, p2), name) {}
예제 #3
0
IMPCORE_BEGIN_NAMESPACE

DistanceRestraint::DistanceRestraint(UnaryFunction* score_func,
                                     Particle* p1, Particle* p2) :
  IMP::internal::
  TupleRestraint<DistancePairScore>(new DistancePairScore(score_func),
                                    p1->get_model(),
                                    ParticleIndexPair(p1->get_index(),
                                                      p2->get_index()))
{}
예제 #4
0
DistanceRestraint::DistanceRestraint(UnaryFunction* score_func,
                                     Particle* p1, Particle* p2,
                                     std::string name)
    : IMP::internal::TupleRestraint<DistancePairScore>(
          new DistancePairScore(score_func), p1->get_model(),
          ParticleIndexPair( p1->get_index(), p2->get_index() ),
          name) {
  IMPCORE_DEPRECATED_METHOD_DEF(2.5,
                                "Use the index-based constructor instead.");
}
예제 #5
0
ParticleIndexPairs AllPairContainer::get_range_indexes() const {
  ParticleIndexes ia = c_->get_range_indexes();
  ParticleIndexPairs ret;
  ret.reserve(ia.size() * (ia.size() - 1) / 2);
  for (unsigned int i = 0; i < ia.size(); ++i) {
    for (unsigned int j = 0; j < i; ++j) {
      ret.push_back(ParticleIndexPair(ia[i], ia[j]));
    }
  }
  return ret;
}
예제 #6
0
ParticleIndexPairs DummyPairContainer::get_range_indexes() const {
  ParticleIndexes pis = c_->get_range_indexes();
  ParticleIndexPairs ret;
  ret.reserve(pis.size() * (pis.size() - 1) / 2);
  for (unsigned int i = 0; i < pis.size(); ++i) {
    for (unsigned int j = 0; j < i; ++j) {
      ret.push_back(ParticleIndexPair(pis[i], pis[j]));
    }
  }
  return ret;
}
ParticleIndexPairs
CoreCloseBipartitePairContainer::get_all_possible_indexes() const {
  ParticleIndexes pis= sc_[0]->get_all_possible_indexes();
  ParticleIndexes pjs= sc_[1]->get_all_possible_indexes();
  ParticleIndexPairs ret; ret.reserve(pis.size()*pjs.size());
  for (unsigned int i=0; i< pis.size(); ++i) {
    for (unsigned int j=0; j< pjs.size(); ++j) {
      ret.push_back(ParticleIndexPair(pis[i], pjs[j]));
    }
  }
  return ret;
}
예제 #8
0
ParticleIndexPairs BondPairContainer::get_range_indexes() const {
  ParticleIndexes ia = sc_->get_range_indexes();
  ParticleIndexPairs ret;
  ret.reserve(ia.size());
  for (unsigned int i = 0; i < ia.size(); ++i) {
    Bond b(get_model(), ia[i]);
    ret.push_back(
        ParticleIndexPair(b.get_bonded(0).get_particle_index(),
                                  b.get_bonded(1).get_particle_index()));
  }
  return ret;
}
예제 #9
0
IMPATOM_BEGIN_NAMESPACE

HelixRestraint::HelixRestraint(Residues rs, bool ideal)
    : Restraint(rs[0]->get_model(), "HelixRestraint%1%") {
  //dihedral info
  //Float dih1,std1,dih2,std2,distON,kON;
  Float dih1  = -1.117010721276371; //mean = -64deg, std = 6deg
  Float std1  = 0.10471975511965977;
  Float dih2  = -0.715584993317675; //mean = -41deg, std = 8deg
  Float std2  = 0.13962634015954636;
  Float corr = -0.25;
  Float weight = 0.5;
  core::BinormalTerm bt;
  bt.set_means(std::make_pair(dih1,dih2));
  bt.set_standard_deviations(std::make_pair(std1,std2));
  bt.set_correlation(corr);
  bt.set_weight(weight);

  //bond info
  Float distON = 2.96;
  Float kON = core::Harmonic::get_k_from_standard_deviation(0.11);

  //will expand to more bonds and residue types
  bond_ON_score_ = new core::HarmonicDistancePairScore(distON,kON);

  if (rs.size()>=3){
    for(size_t nr=0;nr<rs.size()-2;nr++){
      core::XYZ a1(get_atom(rs[nr],AT_C));
      core::XYZ a2(get_atom(rs[nr+1],AT_N));
      core::XYZ a3(get_atom(rs[nr+1],AT_CA));
      core::XYZ a4(get_atom(rs[nr+1],AT_C));
      core::XYZ a5(get_atom(rs[nr+2],AT_N));
      IMP_NEW(core::MultipleBinormalRestraint,
              mbr,(get_model(),
                   ParticleIndexQuad(a1,a2,a3,a4),
                   ParticleIndexQuad(a2,a3,a4,a5)));
      mbr->add_term(bt);
      dihedral_rs_.push_back(mbr);
    }
  }

  if (rs.size()>=5){
    for(size_t nr=0;nr<rs.size()-4;nr++){
      bonds_ON_.push_back(ParticleIndexPair(
                                            get_atom(rs[nr],AT_O).get_particle_index(),
                                            get_atom(rs[nr+4],AT_N).get_particle_index()));
    }
  }
}
ParticleIndexPairs QuadraticClosePairsFinder::get_close_pairs(
    Model *m, const 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);
  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(ParticleIndexPair(pt[i], pt[j]));
      }
    }
  }
  return ret;
}
ParticleIndexPairs QuadraticClosePairsFinder::get_close_pairs(
    Model *m, const ParticleIndexes &pta,
    const 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);
  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(ParticleIndexPair(pta[i], ptb[j]));
      }
    }
  }
  return ret;
}
예제 #12
0
IMPCORE_BEGIN_NAMESPACE

Float TypedPairScore::evaluate(const ParticlePair &p,
                               DerivativeAccumulator *da) const
{
  PairScore *ps= get_pair_score(p);
  if (!ps) {
    if (!allow_invalid_types_) {
      IMP_THROW("Attempt to evaluate TypedPairScore on "
                "particles with invalid types ("
                << p[0]->get_value(typekey_) << ", "
                << p[1]->get_value(typekey_) << ")",
                ValueException);
    } else {
      return 0.0;
    }
  } else {
    return ps->evaluate_index(p[0]->get_model(),
                              ParticleIndexPair(p[0]->get_index(),
                                                p[1]->get_index()),
                              da);
  }
}