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
Looks good to me.
On Jun 24, 2008, at 8:03 PM, Ben Webb wrote:
> 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 > -- > ben@salilab.org http://salilab.org/~ben/ > "It is a capital mistake to theorize before one has data." > - Sir Arthur Conan Doyle > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev
participants (2)
-
Ben Webb
-
Daniel Russel