9 #ifndef IMPATOM_CHARMM_TOPOLOGY_H
10 #define IMPATOM_CHARMM_TOPOLOGY_H
15 #include <IMP/atom/atom_config.h>
16 #include <cereal/access.hpp>
22 IMPATOM_BEGIN_NAMESPACE
32 std::string charmm_type_;
35 friend class cereal::access;
37 template<
class Archive>
void serialize(Archive &ar) {
38 ar(name_, charmm_type_, charge_);
47 : name_(name), charmm_type_(other.charmm_type_), charge_(other.charge_) {}
49 std::string get_name()
const {
return name_; }
50 std::string get_charmm_type()
const {
return charmm_type_; }
51 double get_charge()
const {
return charge_; }
52 void set_charmm_type(std::string charmm_type) { charmm_type_ = charmm_type; }
53 void set_charge(
double charge) { charge_ = charge; }
55 out <<
"name: " << name_ <<
"; CHARMM type: " << charmm_type_
56 <<
"; charge: " << charge_;
81 std::string atom_name_;
88 std::string get_atom_name()
const {
return atom_name_; }
95 const std::map<const CHARMMResidueTopology *, Hierarchy> &resmap)
const;
103 template <
unsigned int D>
111 for (Strings::const_iterator it = atoms.begin(); it != atoms.end(); ++it) {
118 : endpoints_(endpoints) {
124 return endpoints_[i];
131 it != endpoints_.end(); ++it) {
132 if (it->get_atom_name() == name) {
145 const std::map<const CHARMMResidueTopology *, Hierarchy> &resmap)
const {
149 it != endpoints_.end(); ++it) {
151 it->get_atom(current_residue, previous_residue, next_residue, resmap);
164 it != endpoints_.end(); ++it) {
165 if (it != endpoints_.begin()) {
168 out << it->get_atom_name();
173 typedef CHARMMConnection<2> CHARMMBond;
174 typedef CHARMMConnection<3> CHARMMAngle;
175 typedef CHARMMConnection<4> CHARMMDihedral;
204 float first_distance_, second_distance_, first_angle_, second_angle_,
210 float first_angle,
float dihedral,
211 float second_angle,
float second_distance,
214 first_distance_(first_distance),
215 second_distance_(second_distance),
216 first_angle_(first_angle),
217 second_angle_(second_angle),
219 improper_(improper) {}
221 float first_distance,
float first_angle,
222 float dihedral,
float second_angle,
223 float second_distance,
bool improper)
225 first_distance_(first_distance),
226 second_distance_(second_distance),
227 first_angle_(first_angle),
228 second_angle_(second_angle),
230 improper_(improper) {}
232 float get_first_distance()
const {
return first_distance_; }
233 float get_second_distance()
const {
return second_distance_; }
234 float get_first_angle()
const {
return first_angle_; }
235 float get_second_angle()
const {
return second_angle_; }
237 bool get_improper()
const {
return improper_; }
241 out <<
"; distances: " << first_distance_ <<
", " << second_distance_
242 <<
"; angles: " << first_angle_ <<
", " << second_angle_
243 <<
"; dihedral: " << dihedral_;
264 :
Object(
"CharmmResidueTopoBase%1%"), type_(type) {
265 set_name(std::string(
"CHARMM residue ") + type);
269 std::string get_type()
const {
return type_; }
271 unsigned int get_number_of_atoms()
const {
return atoms_.size(); }
275 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
284 unsigned int get_number_of_bonds()
const {
return bonds_.size(); }
285 void add_bond(
const CHARMMBond &bond) { bonds_.push_back(bond); }
286 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
288 CHARMMBond &
get_bond(
unsigned int index) {
return bonds_[index]; }
291 unsigned int get_number_of_angles()
const {
return angles_.size(); }
292 void add_angle(
const CHARMMAngle &bond) { angles_.push_back(bond); }
293 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
295 CHARMMAngle &
get_angle(
unsigned int index) {
return angles_[index]; }
297 unsigned int get_number_of_dihedrals()
const {
return dihedrals_.size(); }
298 void add_dihedral(
const CHARMMDihedral &bond) { dihedrals_.push_back(bond); }
299 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
301 CHARMMDihedral &
get_dihedral(
unsigned int index) {
return dihedrals_[index]; }
303 unsigned int get_number_of_impropers()
const {
return impropers_.size(); }
304 void add_improper(
const CHARMMDihedral &bond) { impropers_.push_back(bond); }
305 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
306 CHARMMDihedral &get_improper(
unsigned int index) {
return impropers_[index]; }
309 unsigned int get_number_of_internal_coordinates()
const {
310 return internal_coordinates_.size();
313 internal_coordinates_.push_back(ic);
317 return internal_coordinates_[index];
320 const CHARMMBond &
get_bond(
unsigned int index)
const {
return bonds_[index]; }
321 const CHARMMAngle &
get_angle(
unsigned int index)
const {
322 return angles_[index];
324 const CHARMMDihedral &
get_dihedral(
unsigned int index)
const {
325 return dihedrals_[index];
327 const CHARMMDihedral &get_improper(
unsigned int index)
const {
328 return impropers_[index];
350 std::string default_first_patch_, default_last_patch_;
361 void remove_atom(std::string name);
363 void set_default_first_patch(std::string patch) {
364 default_first_patch_ = patch;
366 void set_default_last_patch(std::string patch) {
367 default_last_patch_ = patch;
369 std::string get_default_first_patch()
const {
return default_first_patch_; }
370 std::string get_default_last_patch()
const {
return default_last_patch_; }
390 std::map<std::string, Element> atom_elements_;
397 set_name(std::string(
"CHARMM patching residue ") + type);
400 void add_removed_atom(std::string name) { deleted_atoms_.push_back(name); }
402 unsigned int get_number_of_removed_atoms()
const {
403 return deleted_atoms_.size();
406 std::string get_removed_atom(
unsigned int i)
const {
407 return deleted_atoms_[i];
415 atom_elements_[name] = e;
422 std::map<std::string, Element>::const_iterator it =
423 atom_elements_.find(name);
424 return it == atom_elements_.end() ? UNKNOWN_ELEMENT : it->second;
467 set_default_first_patch(ideal->get_default_first_patch());
468 set_default_last_patch(ideal->get_default_last_patch());
471 for (
unsigned int i = 0; i < ideal->get_number_of_atoms(); ++i) {
472 add_atom(ideal->get_atom(i));
475 for (
unsigned int i = 0; i < ideal->get_number_of_bonds(); ++i) {
476 add_bond(ideal->get_bond(i));
478 for (
unsigned int i = 0; i < ideal->get_number_of_angles(); ++i) {
479 add_angle(ideal->get_angle(i));
481 for (
unsigned int i = 0; i < ideal->get_number_of_dihedrals(); ++i) {
482 add_dihedral(ideal->get_dihedral(i));
484 for (
unsigned int i = 0; i < ideal->get_number_of_impropers(); ++i) {
485 add_improper(ideal->get_improper(i));
487 for (
unsigned int i = 0; i < ideal->get_number_of_internal_coordinates();
489 add_internal_coordinate(ideal->get_internal_coordinate(i));
493 bool get_patched()
const {
return patched_; }
494 void set_patched(
bool patched) { patched_ = patched; }
501 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.
A more IMP-like version of the std::vector.
The end of a bond, angle, dihedral, improper, or internal coordinate.
double get_angle(const Line3D &a, const Line3D &b)
Get angle in radians between two lines around their closest points.
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.
Element get_atom_element(std::string name) const
Get the element of the named atom in the patch.
bool get_contains_atom(std::string name) const
Return true if the bond contains the named atom.
std::ostream & show(Hierarchy h, std::ostream &out=std::cout)
Print the hierarchy using a given decorator to display each node.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
A shared base class to help in debugging and things.
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.
void set_atom_element(std::string name, Element e)
Set the element of the named atom in the patch.
Element
The various elements currently supported/known.
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.