IMP  2.0.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-2013 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::base::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 protected:
42  class Bond {
43  public:
44  Bond(AtomType type1, AtomType type2,
45  IMP::atom::Bond::Type bond_type = IMP::atom::Bond::SINGLE) :
46  type1_(type1), type2_(type2), bond_type_(bond_type) {}
47  AtomType type1_,type2_;
48  IMP::atom::Bond::Type bond_type_;
49  };
50 
51  Float get_radius(const String& force_field_atom_type) const;
52  Float get_epsilon(const String& force_field_atom_type) const;
53  virtual String get_force_field_atom_type(Atom atom) const;
54  void add_bonds(Residue rd) const;
55  void add_bonds(Residue rd1, Residue rd2) const;
56 
57 
58  // map between imp_atom_type and force_field parameters (atom_type, charge)
59  typedef std::pair<std::string, double> ChargePair;
60  typedef std::map<AtomType, ChargePair > AtomTypeMap;
61 
62  // hash that maps between residue and atom name to force_field atom type
63  // key1=imp_residue_type, key2= imp_atom_type, value=pair(atom_type, charge)
64  std::map<ResidueType, AtomTypeMap> atom_res_type_2_force_field_atom_type_;
65 
66  // a list of residue bonds
67  std::map<ResidueType, base::Vector<Bond> > residue_bonds_;
68 
69  // map that holds force_field parameters according to force_field atom types
70  // key=force_field_atom_type, value=(epsilon,radius)
71  std::map<String, FloatPair > force_field_2_vdW_;
72 
73  private:
74  WarningContext warn_context_;
75 };
76 
77 IMPATOM_END_NAMESPACE
78 
79 #endif /* IMPATOM_FORCE_FIELD_PARAMETERS_H */