Debian Codegraph @

include/BALL/MOLMEC/CHARMM/charmmTorsion.h

raw symbols SCIP
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4
5 // Molecular Mechanics: CHARMM force field, proper torsion component
6
7 #ifndef BALL_MOLMEC_CHARMM_CHARMMTORSION_H
8 #define BALL_MOLMEC_CHARMM_CHARMMTORSION_H
9
10 #ifndef BALL_COMMON_H
11 # include <BALL/common.h>
12 #endif
13
14 #ifndef BALL_MOLMEC_PARAMETER_COSINETORSION_H
15 # include <BALL/MOLMEC/PARAMETER/cosineTorsion.h>
16 #endif
17
18 #ifndef BALL_MOLMEC_PARAMETER_RESIDUETORSIONS_H
19 # include <BALL/MOLMEC/PARAMETER/residueTorsions.h>
20 #endif
21
22 #ifndef BALL_MOLMEC_COMMON_FORCEFIELDCOMPONENT_H
23 # include <BALL/MOLMEC/COMMON/forceFieldComponent.h>
24 #endif
25
26 #ifndef BALL_MOLMEC_COMMON_FORCEFIELD_H
27 # include <BALL/MOLMEC/COMMON/forceField.h>
28 #endif
29
30 namespace BALL
31 {
32 /** CHARMM torsion component
33
34 \ingroup CHARMM
35 */
36 class BALL_EXPORT CharmmTorsion
37 : public ForceFieldComponent
38 {
39 public:
40
41 /// flag to enable Torsions
42 #define CHARMM_TORSIONS_ENABLED "enable Torsions"
43
44 /** @name Type Definitions
45 */
46 //@{
47
48 struct SingleCharmmTorsion
49 {
50 Atom* atom1;
51 Atom* atom2;
52 Atom* atom3;
53 Atom* atom4;
54
55 float V;
56 unsigned char f;
57 float phase;
58
59 SingleCharmmTorsion()
60 : atom1(0),
61 atom2(0),
62 atom3(0),
63 atom4(0),
64 V(0),
65 f(0),
66 phase(0)
67 {
68 }
69
70 SingleCharmmTorsion(CosineTorsion::SingleData& t)
71 {
72 atom1 = t.atom1;
73 atom2 = t.atom2;
74 atom3 = t.atom3;
75 atom4 = t.atom4;
76
77 V = t.values.V / t.values.n;
78 f = (unsigned char)t.values.f;
79
80 // convert phase from degrees to radiant
81 phase = (float)(BALL::Constants::PI / 180.0) * t.values.phase;
82 }
83 };
84
85 //@}
86 /** @name Constructors and Destructors
87 */
88 //@{
89
90 BALL_CREATE(CharmmTorsion)
91
92 /** Default constructor.
93 */
94 CharmmTorsion();
95
96 /** Constructor.
97 */
98 CharmmTorsion(ForceField& force_field);
99
100 /** Copy constructor
101 */
102 CharmmTorsion(const CharmmTorsion& charmm_stretch);
103
104 /** Destructor.
105 */
106 virtual ~CharmmTorsion();
107
108 //@}
109 /** @name Setup Methods
110 */
111 //@{
112
113 /** Setup method.
114 * @throws BALL::Exception::TooManyErrors
115 */
116 virtual bool setup();
117
118 //@}
119 /** @name Accessors
120 */
121 //@{
122
123 /** Calculates and returns the component's energy.
124 */
125 virtual double updateEnergy();
126
127 /** Calculates and returns the component's forces.
128 */
129 virtual void updateForces();
130
131 //@}
132
133 private:
134
135 /*_ @name Private Attributes
136 */
137 //_@{
138
139 /*_ Vector containing the parameters for each torsion.
140 */
141 vector<SingleCharmmTorsion> torsion_;
142
143 /*_ Contents of the [Torsions] section of the parameter file.
144 */
145 CosineTorsion torsion_parameters_;
146
147 /*_ Contents of the [ResidueTorsions] section of the parameter file.
148 */
149 ResidueTorsions residue_torsions_;
150
151 /*_ true, if the torsions are read from the ResidueTorsions section.
152 */
153 bool use_residue_torsion_list_;
154
155 //_@}
156
157 };
158 } // namespace BALL
159
160 #endif // BALL_MOLMEC_CHARMM_CHARMMTORSION_H