IMP logo
IMP Reference Guide  2.18.0
The Integrative Modeling Platform
ForceFieldParameters.h
Go to the documentation of this file.
1 /**
2  * \file IMP/atom/ForceFieldParameters.h \brief force field base class
3  *
4  * Copyright 2007-2022 IMP Inventors. All rights reserved.
5  *
6  */
7 
8 #ifndef IMPATOM_FORCE_FIELD_PARAMETERS_H
9 #define IMPATOM_FORCE_FIELD_PARAMETERS_H
10 
11 #include "Residue.h"
12 #include "Atom.h"
13 #include "Hierarchy.h"
14 #include <IMP/base_types.h>
15 
16 IMPATOM_BEGIN_NAMESPACE
17 
18 //! Storage and access to force field
19 class IMPATOMEXPORT ForceFieldParameters : public IMP::Object {
20  public:
21  ForceFieldParameters() : Object("ForceFieldParameters%1%") {}
22  //! get radius
23  Float get_radius(Atom atom) const;
24 
25  //! get epsilon for non bonded vdW
26  Float get_epsilon(Atom atom) const;
27 
28  //! Add or replace radii in the structure defined in the hierarchy.
29  /** Each radius is scaled by the given scale.
30  */
31  void add_radii(Hierarchy mhd, double scale = 1.0,
32  FloatKey radius_key = FloatKey("radius")) const;
33 
34  //! Add LennardJones well depths to the structure
35  void add_well_depths(Hierarchy mhd) const;
36 
37  //! add bonds to the structure defined in the hierarchy
38  void add_bonds(Hierarchy mhd) const;
39 
41 
42  protected:
43  /** Store endpoints for a bond. */
44  class Bond {
45  public:
46  Bond(AtomType type1, AtomType type2,
47  IMP::atom::Bond::Type bond_type = IMP::atom::Bond::SINGLE)
48  : type1_(type1), type2_(type2), bond_type_(bond_type) {}
49  AtomType type1_, type2_;
50  IMP::atom::Bond::Type bond_type_;
51  };
52 
53  Float get_radius(const String& force_field_atom_type) const;
54  Float get_epsilon(const String& force_field_atom_type) const;
55  virtual String get_force_field_atom_type(Atom atom) const;
56  void add_bonds(Residue rd) const;
57  void add_bonds(Residue rd1, Residue rd2) const;
58 
59  // map between imp_atom_type and force_field parameters (atom_type, charge)
60  typedef std::pair<std::string, double> ChargePair;
61  typedef std::map<AtomType, ChargePair> AtomTypeMap;
62 
63  // hash that maps between residue and atom name to force_field atom type
64  // key1=imp_residue_type, key2= imp_atom_type, value=pair(atom_type, charge)
65  std::map<ResidueType, AtomTypeMap> atom_res_type_2_force_field_atom_type_;
66 
67  // a list of residue bonds
68  std::map<ResidueType, Vector<Bond> > residue_bonds_;
69 
70  // map that holds force_field parameters according to force_field atom types
71  // key=force_field_atom_type, value=(epsilon,radius)
72  std::map<String, FloatPair> force_field_2_vdW_;
73 
74  private:
75  WarningContext warn_context_;
76 };
77 
78 IMPATOM_END_NAMESPACE
79 
80 #endif /* IMPATOM_FORCE_FIELD_PARAMETERS_H */
Basic types used by IMP.
Storage and access to force field.
Key< 0 > FloatKey
The type used to identify float attributes in the Particles.
Definition: base_types.h:32
void add_radii(Hierarchy d, const ForceFieldParameters *ffp=get_all_atom_CHARMM_parameters(), FloatKey radius_key=FloatKey("radius"))
Add vdW radius from given force field.
Simple atom decorator.
Type
The types a bond can have right now.
The type of an atom.
#define IMP_REF_COUNTED_DESTRUCTOR(Name)
Ref counted objects should have private destructors.
Warnings with the same key within the context are only output once.
Decorator for helping deal with a hierarchy of molecules.
The standard decorator for manipulating molecular structures.
Common base class for heavy weight IMP objects.
Definition: Object.h:106
A decorator for a particle representing an atom.
Definition: atom/Atom.h:238
A decorator for Residues.
A decorator for a residue.
Definition: Residue.h:137
Object(std::string name)
Construct an object with the given name.
double Float
Basic floating-point value (could be float, double...)
Definition: types.h:19
std::string String
Basic string value.
Definition: types.h:43
void add_bonds(Hierarchy d, const ForceFieldParameters *ffp=get_all_atom_CHARMM_parameters())
Add bonds using definitions from given force field parameters.