9 #ifndef IMPATOM_CHARMM_TOPOLOGY_H
10 #define IMPATOM_CHARMM_TOPOLOGY_H
15 #include <IMP/atom/atom_config.h>
16 #include <cereal/access.hpp>
21 IMPATOM_BEGIN_NAMESPACE
31 std::string charmm_type_;
34 friend class cereal::access;
36 template<
class Archive>
void serialize(Archive &ar) {
37 ar(name_, charmm_type_, charge_);
46 : name_(name), charmm_type_(other.charmm_type_), charge_(other.charge_) {}
48 std::string get_name()
const {
return name_; }
49 std::string get_charmm_type()
const {
return charmm_type_; }
50 double get_charge()
const {
return charge_; }
51 void set_charmm_type(std::string charmm_type) { charmm_type_ = charmm_type; }
52 void set_charge(
double charge) { charge_ = charge; }
54 out <<
"name: " << name_ <<
"; CHARMM type: " << charmm_type_
55 <<
"; charge: " << charge_;
80 std::string atom_name_;
87 std::string get_atom_name()
const {
return atom_name_; }
94 const std::map<const CHARMMResidueTopology *, Hierarchy> &resmap)
const;
102 template <
unsigned int D>
110 for (Strings::const_iterator it = atoms.begin(); it != atoms.end(); ++it) {
117 : endpoints_(endpoints) {
123 return endpoints_[i];
130 it != endpoints_.end(); ++it) {
131 if (it->get_atom_name() == name) {
144 const std::map<const CHARMMResidueTopology *, Hierarchy> &resmap)
const {
148 it != endpoints_.end(); ++it) {
150 it->get_atom(current_residue, previous_residue, next_residue, resmap);
163 it != endpoints_.end(); ++it) {
164 if (it != endpoints_.begin()) {
167 out << it->get_atom_name();
172 typedef CHARMMConnection<2> CHARMMBond;
173 typedef CHARMMConnection<3> CHARMMAngle;
174 typedef CHARMMConnection<4> CHARMMDihedral;
203 float first_distance_, second_distance_, first_angle_, second_angle_,
209 float first_angle,
float dihedral,
210 float second_angle,
float second_distance,
213 first_distance_(first_distance),
214 second_distance_(second_distance),
215 first_angle_(first_angle),
216 second_angle_(second_angle),
218 improper_(improper) {}
220 float first_distance,
float first_angle,
221 float dihedral,
float second_angle,
222 float second_distance,
bool improper)
224 first_distance_(first_distance),
225 second_distance_(second_distance),
226 first_angle_(first_angle),
227 second_angle_(second_angle),
229 improper_(improper) {}
231 float get_first_distance()
const {
return first_distance_; }
232 float get_second_distance()
const {
return second_distance_; }
233 float get_first_angle()
const {
return first_angle_; }
234 float get_second_angle()
const {
return second_angle_; }
236 bool get_improper()
const {
return improper_; }
240 out <<
"; distances: " << first_distance_ <<
", " << second_distance_
241 <<
"; angles: " << first_angle_ <<
", " << second_angle_
242 <<
"; dihedral: " << dihedral_;
263 :
Object(
"CharmmResidueTopoBase%1%"), type_(type) {
264 set_name(std::string(
"CHARMM residue ") + type);
268 std::string get_type()
const {
return type_; }
270 unsigned int get_number_of_atoms()
const {
return atoms_.size(); }
274 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
283 unsigned int get_number_of_bonds()
const {
return bonds_.size(); }
284 void add_bond(
const CHARMMBond &bond) { bonds_.push_back(bond); }
285 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
287 CHARMMBond &
get_bond(
unsigned int index) {
return bonds_[index]; }
290 unsigned int get_number_of_angles()
const {
return angles_.size(); }
291 void add_angle(
const CHARMMAngle &bond) { angles_.push_back(bond); }
292 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
294 CHARMMAngle &
get_angle(
unsigned int index) {
return angles_[index]; }
296 unsigned int get_number_of_dihedrals()
const {
return dihedrals_.size(); }
297 void add_dihedral(
const CHARMMDihedral &bond) { dihedrals_.push_back(bond); }
298 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
300 CHARMMDihedral &
get_dihedral(
unsigned int index) {
return dihedrals_[index]; }
302 unsigned int get_number_of_impropers()
const {
return impropers_.size(); }
303 void add_improper(
const CHARMMDihedral &bond) { impropers_.push_back(bond); }
304 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
305 CHARMMDihedral &get_improper(
unsigned int index) {
return impropers_[index]; }
308 unsigned int get_number_of_internal_coordinates()
const {
309 return internal_coordinates_.size();
312 internal_coordinates_.push_back(ic);
316 return internal_coordinates_[index];
319 const CHARMMBond &
get_bond(
unsigned int index)
const {
return bonds_[index]; }
320 const CHARMMAngle &
get_angle(
unsigned int index)
const {
321 return angles_[index];
323 const CHARMMDihedral &
get_dihedral(
unsigned int index)
const {
324 return dihedrals_[index];
326 const CHARMMDihedral &get_improper(
unsigned int index)
const {
327 return impropers_[index];
349 std::string default_first_patch_, default_last_patch_;
360 void remove_atom(std::string name);
362 void set_default_first_patch(std::string patch) {
363 default_first_patch_ = patch;
365 void set_default_last_patch(std::string patch) {
366 default_last_patch_ = patch;
368 std::string get_default_first_patch()
const {
return default_first_patch_; }
369 std::string get_default_last_patch()
const {
return default_last_patch_; }
395 set_name(std::string(
"CHARMM patching residue ") + type);
398 void add_removed_atom(std::string name) { deleted_atoms_.push_back(name); }
400 unsigned int get_number_of_removed_atoms()
const {
401 return deleted_atoms_.size();
404 std::string get_removed_atom(
unsigned int i)
const {
405 return deleted_atoms_[i];
415 void apply(CHARMMResidueTopology *res)
const;
424 void apply(CHARMMResidueTopology *res1, CHARMMResidueTopology *res2)
const;
448 set_default_first_patch(ideal->get_default_first_patch());
449 set_default_last_patch(ideal->get_default_last_patch());
452 for (
unsigned int i = 0; i < ideal->get_number_of_atoms(); ++i) {
453 add_atom(ideal->get_atom(i));
456 for (
unsigned int i = 0; i < ideal->get_number_of_bonds(); ++i) {
457 add_bond(ideal->get_bond(i));
459 for (
unsigned int i = 0; i < ideal->get_number_of_angles(); ++i) {
460 add_angle(ideal->get_angle(i));
462 for (
unsigned int i = 0; i < ideal->get_number_of_dihedrals(); ++i) {
463 add_dihedral(ideal->get_dihedral(i));
465 for (
unsigned int i = 0; i < ideal->get_number_of_impropers(); ++i) {
466 add_improper(ideal->get_improper(i));
468 for (
unsigned int i = 0; i < ideal->get_number_of_internal_coordinates();
470 add_internal_coordinate(ideal->get_internal_coordinate(i));
474 bool get_patched()
const {
return patched_; }
475 void set_patched(
bool patched) { patched_ = patched; }
482 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.
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.
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.