[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[IMP-dev] Proposal: TypedPairScore



For statistical potentials, TypedPairScore would delegate to another PairScore depending on an integer attribute of the particles:

TypedPairScore(IntKey typekey) {
  create empty map(pair(atype,btype), PairScore*)
}

void set_pair_score(PairScore *ps, Int atype, Int btype) {
  swap if needed so atype <= btype
  set map[pair(atype,btype)] = ps
}

virtual void set_particle_type(Particle *p) {}

virtual Float evaluate(a, b, da) {
  if a does not have typekey, call set_particle_type to set it
  atype = a.get_value(typekey)
  same for b, btype
  swap if needed so atype <= btype
  return map[pair(atype,btype)].s(a,b,da)
}

For something like DOPE, a subclass would a) provide an additional map, from the DOPE residue name:atom name pairs to DOPE types, and b) override set_particle_type to set the DOPE type of a particle by querying the atom and residue decorators.

Comments?

	Ben
--
                      http://salilab.org/~ben/
"It is a capital mistake to theorize before one has data."
	- Sir Arthur Conan Doyle