Loading [MathJax]/extensions/tex2jax.js
IMP logo
IMP Reference Guide  develop.ae08f42f4a,2025/04/10
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-2025 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>
16 
17 IMPATOM_BEGIN_NAMESPACE
18 
19 //! Storage and access to force field
20 class IMPATOMEXPORT ForceFieldParameters : public IMP::Object {
21  public:
22  ForceFieldParameters() : Object("ForceFieldParameters%1%") {}
23  //! get radius
24  Float get_radius(Atom atom) const;
25 
26  //! get epsilon for non bonded vdW
27  Float get_epsilon(Atom atom) const;
28 
29  //! Add or replace radii in the structure defined in the hierarchy.
30  /** Each radius is scaled by the given scale.
31  */
32  void add_radii(Hierarchy mhd, double scale = 1.0,
33  FloatKey radius_key = FloatKey("radius")) const;
34 
35  //! Add LennardJones well depths to the structure
36  void add_well_depths(Hierarchy mhd) const;
37 
38  //! Add Lennard-Jones types to the structure
39  /** This adds LennardJonesTyped decorators to all applicable particles. */
40  void add_lennard_jones_types(Hierarchy mhd) const;
41 
42  //! add bonds to the structure defined in the hierarchy
43  void add_bonds(Hierarchy mhd) const;
44 
46 
47  protected:
48  /** Store endpoints for a bond. */
49  class Bond {
50  public:
51  Bond(AtomType type1, AtomType type2,
52  IMP::atom::Bond::Type bond_type = IMP::atom::Bond::SINGLE)
53  : type1_(type1), type2_(type2), bond_type_(bond_type) {}
54  AtomType type1_, type2_;
55  IMP::atom::Bond::Type bond_type_;
56  };
57 
58  Float get_radius(const String& force_field_atom_type) const;
59  Float get_epsilon(const String& force_field_atom_type) const;
60  LennardJonesType *get_lj_type(const String& force_field_atom_type) const;
61  virtual String get_force_field_atom_type(Atom atom) const;
62  void add_bonds(Residue rd) const;
63  void add_bonds(Residue rd1, Residue rd2) const;
64 
65  // map between imp_atom_type and force_field parameters (atom_type, charge)
66  typedef std::pair<std::string, double> ChargePair;
67  typedef std::map<AtomType, ChargePair> AtomTypeMap;
68 
69  // hash that maps between residue and atom name to force_field atom type
70  // key1=imp_residue_type, key2= imp_atom_type, value=pair(atom_type, charge)
71  std::map<ResidueType, AtomTypeMap> atom_res_type_2_force_field_atom_type_;
72 
73  // a list of residue bonds
74  std::map<ResidueType, Vector<Bond> > residue_bonds_;
75 
76  // map that holds force_field parameters according to force_field atom types
77  // key=force_field_atom_type, value=(epsilon,radius)
78  std::map<String, FloatPair> force_field_2_vdW_;
79 
80  // mapping from parameters to instantianted Lennard Jones types
81  mutable std::map<String, Pointer<LennardJonesType>> force_field_2_lj_type_;
82 
83  private:
84  WarningContext warn_context_;
85 };
86 
87 IMPATOM_END_NAMESPACE
88 
89 #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
Parameters for a Lennard-Jones interaction.
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)
Set up destructor for a ref counted object.
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:111
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
Parameters for a Lennard-Jones interaction.
void add_bonds(Hierarchy d, const ForceFieldParameters *ffp=get_all_atom_CHARMM_parameters())
Add bonds using definitions from given force field parameters.