IMP logo
IMP Reference Guide  2.13.0
The Integrative Modeling Platform
SitesPairScoreParameters.h
Go to the documentation of this file.
1 /**
2  * \file SitesPairScoreParameters.h
3  * \brief A summary of useful information about rigid bodies and their
4  * transformation for eg, caching purposes for SitesPairScore
5  *
6  * Copyright 2007-2020 IMP Inventors. All rights reserved.
7  */
8 
9 #ifndef IMPNPCTRANSPORT_SITES_PAIR_SCORE_PARAMS_H
10 #define IMPNPCTRANSPORT_SITES_PAIR_SCORE_PARAMS_H
11 
12 #include "npctransport_config.h"
13 #include <IMP/value_macros.h>
14 #include <IMP/showable_macros.h>
15 
16 IMPNPCTRANSPORT_BEGIN_NAMESPACE
17 
18 
19 /**
20  range and k parameters for npctransport::SitesPairScore,
21  including some useful cached values
22  */
23 struct IMPNPCTRANSPORTEXPORT SitesPairScoreParameters {
24  double r; // range
25  double k; // interaction k
26  double r2; // cached r^2
27  double kr; // cachd k*r
28  double kr2; // cached k*r^2
29  double cosSigma1_max;
30  double cosSigma2_max;
31  bool is_orientational;
32 
33  /** initiates structure based on passed range and k params
34 
35  @param range range of attraction in A
36  @param k_coefficient k in units of kCal/mol/A or kCal/mol/A^2 (for
37  isotropic and anisotropic, respectively - isotropic when
38  either sigma_max is 0.0)
39  @param sigma1_max maximal angle for site 1 (0.0 if isotropic interaction)
40  @param sigma2_max maximal angle for site 2 (0.0 if isotropic interaction)
41  */
42  SitesPairScoreParameters(double range, double k_coefficient, double sigma1_max_deg=0.0, double sigma2_max_deg=0.0)
43  {
44  set_range(range);
45  set_force_coefficient(k_coefficient);
46  set_sigma1_max(sigma1_max_deg);
47  set_sigma2_max(sigma2_max_deg);
48  update_is_orientational();
49  }
50 
51  void set_range(double r){
52  this->r=r;
53  update_cache();
54  }
55 
56  void set_force_coefficient(double k){
57  this->k=k;
58  update_cache();
59  }
60 
61  void set_sigma1_max(double sigma1_max_deg){
62  double sigma1_max_rad= sigma1_max_deg * 4.0 * atan (1.0) / 180.0;
63  cosSigma1_max=std::cos(sigma1_max_rad);
64  update_is_orientational();
65  }
66 
67  void set_sigma2_max(double sigma2_max_deg){
68  double sigma2_max_rad= sigma2_max_deg * 4.0 * atan (1.0) / 180.0;
69  cosSigma2_max=std::cos(sigma2_max_rad);
70  update_is_orientational();
71  }
72 
73  void update_is_orientational(){
74  is_orientational= std::abs((cosSigma1_max-1.0) + (cosSigma2_max-1.0)) < 0.0001;
75  }
76 
77  private:
78  void update_cache(){
79  r2 = r*r;
80  kr = k*r;
81  kr2 = kr*r;
82  }
83 
84  public:
85  IMP_SHOWABLE_INLINE(SitesPairScoreParameters,
86  out << "sites pair score params"
87  << " range " << r
88  << " k " << k
89  << " cos(sigma1_max) " << cosSigma1_max
90  << " cos(sigma2_max) " << cosSigma2_max
91  << " is_orientational " << is_orientational
92  << std::endl);
93 
94 
95 };
96 
98 
99 IMPNPCTRANSPORT_END_NAMESPACE
100 
101 #endif /* IMPNPCTRANSPORT_SITES_PAIR_SCORE_PARAMS_H */
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
SitesPairScoreParameters(double range, double k_coefficient, double sigma1_max_deg=0.0, double sigma2_max_deg=0.0)
A more IMP-like version of the std::vector.
Definition: Vector.h:39
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.
Definition: value_macros.h:23
Various general useful macros for IMP.
Various general useful macros for IMP.