9 #ifndef IMPATOM_CHARMM_TOPOLOGY_H
10 #define IMPATOM_CHARMM_TOPOLOGY_H
15 #include <IMP/atom/atom_config.h>
20 IMPATOM_BEGIN_NAMESPACE
30 std::string charmm_type_;
37 : name_(name), charmm_type_(other.charmm_type_), charge_(other.charge_) {}
39 std::string get_name()
const {
return name_; }
40 std::string get_charmm_type()
const {
return charmm_type_; }
41 double get_charge()
const {
return charge_; }
42 void set_charmm_type(std::string charmm_type) { charmm_type_ = charmm_type; }
43 void set_charge(
double charge) { charge_ = charge; }
45 out <<
"name: " << name_ <<
"; CHARMM type: " << charmm_type_
46 <<
"; charge: " << charge_;
71 std::string atom_name_;
78 std::string get_atom_name()
const {
return atom_name_; }
85 const std::map<const CHARMMResidueTopology *, Hierarchy> &resmap)
const;
93 template <
unsigned int D>
101 for (Strings::const_iterator it = atoms.begin(); it != atoms.end(); ++it) {
108 : endpoints_(endpoints) {
114 return endpoints_[i];
121 it != endpoints_.end(); ++it) {
122 if (it->get_atom_name() == name) {
135 const std::map<const CHARMMResidueTopology *, Hierarchy> &resmap)
const {
139 it != endpoints_.end(); ++it) {
141 it->get_atom(current_residue, previous_residue, next_residue, resmap);
154 it != endpoints_.end(); ++it) {
155 if (it != endpoints_.begin()) {
158 out << it->get_atom_name();
163 typedef CHARMMConnection<2> CHARMMBond;
164 typedef CHARMMConnection<3> CHARMMAngle;
165 typedef CHARMMConnection<4> CHARMMDihedral;
194 float first_distance_, second_distance_, first_angle_, second_angle_,
200 float first_angle,
float dihedral,
201 float second_angle,
float second_distance,
204 first_distance_(first_distance),
205 second_distance_(second_distance),
206 first_angle_(first_angle),
207 second_angle_(second_angle),
209 improper_(improper) {}
211 float first_distance,
float first_angle,
212 float dihedral,
float second_angle,
213 float second_distance,
bool improper)
215 first_distance_(first_distance),
216 second_distance_(second_distance),
217 first_angle_(first_angle),
218 second_angle_(second_angle),
220 improper_(improper) {}
222 float get_first_distance()
const {
return first_distance_; }
223 float get_second_distance()
const {
return second_distance_; }
224 float get_first_angle()
const {
return first_angle_; }
225 float get_second_angle()
const {
return second_angle_; }
227 bool get_improper()
const {
return improper_; }
231 out <<
"; distances: " << first_distance_ <<
", " << second_distance_
232 <<
"; angles: " << first_angle_ <<
", " << second_angle_
233 <<
"; dihedral: " << dihedral_;
254 :
Object(
"CharmmResidueTopoBase%1%"), type_(type) {
255 set_name(std::string(
"CHARMM residue ") + type);
259 std::string get_type()
const {
return type_; }
261 unsigned int get_number_of_atoms()
const {
return atoms_.size(); }
265 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
274 unsigned int get_number_of_bonds()
const {
return bonds_.size(); }
275 void add_bond(
const CHARMMBond &bond) { bonds_.push_back(bond); }
276 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
278 CHARMMBond &
get_bond(
unsigned int index) {
return bonds_[index]; }
281 unsigned int get_number_of_angles()
const {
return angles_.size(); }
282 void add_angle(
const CHARMMAngle &bond) { angles_.push_back(bond); }
283 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
285 CHARMMAngle &get_angle(
unsigned int index) {
return angles_[index]; }
287 unsigned int get_number_of_dihedrals()
const {
return dihedrals_.size(); }
288 void add_dihedral(
const CHARMMDihedral &bond) { dihedrals_.push_back(bond); }
289 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
291 CHARMMDihedral &
get_dihedral(
unsigned int index) {
return dihedrals_[index]; }
293 unsigned int get_number_of_impropers()
const {
return impropers_.size(); }
294 void add_improper(
const CHARMMDihedral &bond) { impropers_.push_back(bond); }
295 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
296 CHARMMDihedral &get_improper(
unsigned int index) {
return impropers_[index]; }
299 unsigned int get_number_of_internal_coordinates()
const {
300 return internal_coordinates_.size();
303 internal_coordinates_.push_back(ic);
307 return internal_coordinates_[index];
310 const CHARMMBond &
get_bond(
unsigned int index)
const {
return bonds_[index]; }
311 const CHARMMAngle &get_angle(
unsigned int index)
const {
312 return angles_[index];
314 const CHARMMDihedral &
get_dihedral(
unsigned int index)
const {
315 return dihedrals_[index];
317 const CHARMMDihedral &get_improper(
unsigned int index)
const {
318 return impropers_[index];
334 std::string default_first_patch_, default_last_patch_;
345 void remove_atom(std::string name);
347 void set_default_first_patch(std::string patch) {
348 default_first_patch_ = patch;
350 void set_default_last_patch(std::string patch) {
351 default_last_patch_ = patch;
353 std::string get_default_first_patch()
const {
return default_first_patch_; }
354 std::string get_default_last_patch()
const {
return default_last_patch_; }
380 set_name(std::string(
"CHARMM patching residue ") + type);
383 void add_removed_atom(std::string name) { deleted_atoms_.push_back(name); }
385 unsigned int get_number_of_removed_atoms()
const {
386 return deleted_atoms_.size();
389 std::string get_removed_atom(
unsigned int i)
const {
390 return deleted_atoms_[i];
400 void apply(CHARMMResidueTopology *res)
const;
409 void apply(CHARMMResidueTopology *res1, CHARMMResidueTopology *res2)
const;
433 set_default_first_patch(ideal->get_default_first_patch());
434 set_default_last_patch(ideal->get_default_last_patch());
437 for (
unsigned int i = 0; i < ideal->get_number_of_atoms(); ++i) {
438 add_atom(ideal->get_atom(i));
441 for (
unsigned int i = 0; i < ideal->get_number_of_bonds(); ++i) {
442 add_bond(ideal->get_bond(i));
444 for (
unsigned int i = 0; i < ideal->get_number_of_angles(); ++i) {
445 add_angle(ideal->get_angle(i));
447 for (
unsigned int i = 0; i < ideal->get_number_of_dihedrals(); ++i) {
448 add_dihedral(ideal->get_dihedral(i));
450 for (
unsigned int i = 0; i < ideal->get_number_of_impropers(); ++i) {
451 add_improper(ideal->get_improper(i));
453 for (
unsigned int i = 0; i < ideal->get_number_of_internal_coordinates();
455 add_internal_coordinate(ideal->get_internal_coordinate(i));
459 bool get_patched()
const {
return patched_; }
460 void set_patched(
bool patched) { patched_ = patched; }
467 IMPATOM_END_NAMESPACE
CHARMMResidueTopology(CHARMMIdealResidueTopology *ideal)
Construct residue topology as a copy of an existing topology.
The ideal topology of a single residue.
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
A connection (bond, angle, dihedral) between some number of endpoints.
A single atom in a CHARMM topology.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
double get_dihedral(XYZ a, XYZ b, XYZ c, XYZ d)
Compute the dihedral angle (in radians) between the four particles.
A geometric relationship between four atoms.
Atom get_atom(Residue rd, AtomType at)
Return a particle atom from the residue.
The end of a bond, angle, dihedral, improper, or internal coordinate.
The topology of a single residue in a model.
A smart pointer to a reference counted object.
#define IMP_INTERNAL_CHECK(expr, message)
An assertion to check for internal errors in IMP. An IMP::ErrorException will be thrown.
Decorator for helping deal with a hierarchy of molecules.
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
Common base class for heavy weight IMP objects.
Base class for all CHARMM residue-based topology.
A decorator for a particle representing an atom.
CHARMMPatch(std::string type)
Construct a new, empty patch residue.
bool get_contains_atom(std::string name) const
Return true if the bond contains the named atom.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
A shared base class to help in debugging and things.
void show(Hierarchy h, std::ostream &out=std::cout)
Print out a molecular hierarchy.
Bond get_bond(Bonded a, Bonded b)
Get the bond between two particles.
CHARMMResidueTopology(ResidueType type)
Create an empty topology, containing no atoms or bonds.
Atoms get_atoms(const CHARMMResidueTopology *current_residue, const CHARMMResidueTopology *previous_residue, const CHARMMResidueTopology *next_residue, const std::map< const CHARMMResidueTopology *, Hierarchy > &resmap) const
Map the bond to a list of Atom particles.