1 |
cli2 |
1361 |
/* |
2 |
|
|
* Copyright (c) 2009 The University of Notre Dame. All Rights Reserved. |
3 |
|
|
* |
4 |
|
|
* The University of Notre Dame grants you ("Licensee") a |
5 |
|
|
* non-exclusive, royalty free, license to use, modify and |
6 |
|
|
* redistribute this software in source and binary code form, provided |
7 |
|
|
* that the following conditions are met: |
8 |
|
|
* |
9 |
|
|
* 1. Acknowledgement of the program authors must be made in any |
10 |
|
|
* publication of scientific results based in part on use of the |
11 |
|
|
* program. An acceptable form of acknowledgement is citation of |
12 |
|
|
* the article in which the program was described (Matthew |
13 |
|
|
* A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
14 |
|
|
* J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
15 |
|
|
* Parallel Simulation Engine for Molecular Dynamics," |
16 |
|
|
* J. Comput. Chem. 26, pp. 252-271 (2005)) |
17 |
|
|
* |
18 |
|
|
* 2. Redistributions of source code must retain the above copyright |
19 |
|
|
* notice, this list of conditions and the following disclaimer. |
20 |
|
|
* |
21 |
|
|
* 3. Redistributions in binary form must reproduce the above copyright |
22 |
|
|
* notice, this list of conditions and the following disclaimer in the |
23 |
|
|
* documentation and/or other materials provided with the |
24 |
|
|
* distribution. |
25 |
|
|
* |
26 |
|
|
* This software is provided "AS IS," without a warranty of any |
27 |
|
|
* kind. All express or implied conditions, representations and |
28 |
|
|
* warranties, including any implied warranty of merchantability, |
29 |
|
|
* fitness for a particular purpose or non-infringement, are hereby |
30 |
|
|
* excluded. The University of Notre Dame and its licensors shall not |
31 |
|
|
* be liable for any damages suffered by licensee as a result of |
32 |
|
|
* using, modifying or distributing the software or its |
33 |
|
|
* derivatives. In no event will the University of Notre Dame or its |
34 |
|
|
* licensors be liable for any lost revenue, profit or data, or for |
35 |
|
|
* direct, indirect, special, consequential, incidental or punitive |
36 |
|
|
* damages, however caused and regardless of the theory of liability, |
37 |
|
|
* arising out of the use of or inability to use software, even if the |
38 |
|
|
* University of Notre Dame has been advised of the possibility of |
39 |
|
|
* such damages. |
40 |
|
|
*/ |
41 |
|
|
|
42 |
|
|
/** |
43 |
|
|
* @file Restraint.hpp |
44 |
|
|
* @author cli2 |
45 |
|
|
* @date 06/17/2009 |
46 |
|
|
* @version 1.0 |
47 |
|
|
*/ |
48 |
|
|
|
49 |
|
|
#ifndef RESTRAINTS_RESTRAINT_HPP |
50 |
|
|
#define RESTRAINTS_RESTRAINT_HPP |
51 |
|
|
|
52 |
|
|
#include "config.h" |
53 |
|
|
#include "utils/GenericData.hpp" |
54 |
|
|
#include "math/Vector3.hpp" |
55 |
|
|
#include <map> |
56 |
|
|
|
57 |
|
|
namespace oopse { |
58 |
|
|
|
59 |
|
|
class Restraint { |
60 |
|
|
public: |
61 |
|
|
|
62 |
|
|
enum { |
63 |
|
|
rtDisplacement = 1, |
64 |
|
|
rtTwist = 2, |
65 |
|
|
rtSwingX = 4, |
66 |
|
|
rtSwingY = 8 |
67 |
|
|
}; |
68 |
|
|
|
69 |
|
|
typedef std::pair<RealType, RealType> RealPair; |
70 |
|
|
|
71 |
|
|
Restraint() : twist0_(0.0), swingX0_(0.0), swingY0_(0.0), restType_(0) { |
72 |
|
|
} |
73 |
|
|
|
74 |
|
|
virtual ~Restraint() {} |
75 |
|
|
|
76 |
|
|
// these are place-holders. The subclasses will have different arguments |
77 |
|
|
// to the two functions. |
78 |
|
|
void calcForce() {} |
79 |
|
|
void setReferenceStructure() {} |
80 |
|
|
|
81 |
|
|
RealType getUnscaledPotential() { return pot_; } |
82 |
|
|
RealType getPotential() { return scaleFactor_ * pot_; } |
83 |
|
|
|
84 |
|
|
void setRestraintName(std::string name) { restName_ = name; } |
85 |
|
|
std::string getRestraintName() { return restName_; } |
86 |
|
|
|
87 |
|
|
/** Returns the restraint type */ |
88 |
|
|
int getRestraintType(){ return restType_; } |
89 |
|
|
/** Sets the restraint type */ |
90 |
|
|
void setRestraintType(int restType) { restType_ = restType; } |
91 |
|
|
|
92 |
|
|
void setScaleFactor(RealType sf) { scaleFactor_ = sf;} |
93 |
|
|
|
94 |
|
|
void setDisplacementForceConstant(RealType kDisp) { |
95 |
|
|
kDisp_ = kDisp; |
96 |
|
|
restType_ |= rtDisplacement; |
97 |
|
|
restInfo_[rtDisplacement] = std::make_pair(0.0, 0.0); |
98 |
|
|
} |
99 |
|
|
|
100 |
|
|
void setTwistForceConstant(RealType kTwist) { |
101 |
|
|
kTwist_ = kTwist/4; |
102 |
|
|
restType_ |= rtTwist; |
103 |
|
|
restInfo_[rtTwist] = std::make_pair(0.0, 0.0); |
104 |
|
|
} |
105 |
|
|
|
106 |
|
|
void setSwingXForceConstant(RealType kSwingX) { |
107 |
|
|
kSwingX_ = kSwingX; |
108 |
|
|
restType_ |= rtSwingX; |
109 |
|
|
restInfo_[rtSwingX] = std::make_pair(0.0, 0.0); |
110 |
|
|
} |
111 |
|
|
|
112 |
|
|
void setSwingYForceConstant(RealType kSwingY) { |
113 |
|
|
kSwingY_ = kSwingY; |
114 |
|
|
restType_ |= rtSwingY; |
115 |
|
|
restInfo_[rtSwingY] = std::make_pair(0.0, 0.0); |
116 |
|
|
} |
117 |
|
|
|
118 |
|
|
/* restraint angles are measured relative to the ideal structure, |
119 |
|
|
and are measured in radians. If you want to restrain to the |
120 |
|
|
same structure as the ideal structure, these do not need to be set. |
121 |
|
|
*/ |
122 |
|
|
void setRestrainedTwistAngle(RealType twist0) { |
123 |
|
|
twist0_ = twist0; |
124 |
|
|
restType_ |= rtTwist; |
125 |
|
|
restInfo_[rtTwist] = std::make_pair(0.0, 0.0); |
126 |
|
|
} |
127 |
|
|
|
128 |
|
|
void setRestrainedSwingXAngle(RealType swingX0) { |
129 |
|
|
swingX0_ = swingX0; |
130 |
|
|
restType_ |= rtSwingX; |
131 |
|
|
restInfo_[rtSwingX] = std::make_pair(0.0, 0.0); |
132 |
|
|
} |
133 |
|
|
|
134 |
|
|
void setRestrainedSwingYAngle(RealType swingY0) { |
135 |
|
|
swingY0_ = swingY0; |
136 |
|
|
restType_ |= rtSwingY; |
137 |
|
|
restInfo_[rtSwingY] = std::make_pair(0.0, 0.0); |
138 |
|
|
} |
139 |
|
|
|
140 |
cli2 |
1364 |
void setPrintRestraint(bool printRest) { |
141 |
|
|
printRest_ = printRest; |
142 |
|
|
} |
143 |
|
|
|
144 |
cli2 |
1361 |
RealType getDisplacementForceConstant() { return kDisp_; } |
145 |
|
|
RealType getTwistForceConstant() { return kTwist_; } |
146 |
|
|
RealType getSwingXForceConstant() { return kSwingX_; } |
147 |
|
|
RealType getSwingYForceConstant() { return kSwingY_; } |
148 |
|
|
RealType getRestrainedTwistAngle() { return twist0_; } |
149 |
|
|
RealType getRestrainedSwingXAngle() { return swingX0_; } |
150 |
|
|
RealType getRestrainedSwingYAngle() { return swingY0_; } |
151 |
cli2 |
1364 |
std::map<int, RealPair> getRestraintInfo() { return restInfo_; } |
152 |
|
|
bool getPrintRestraint() { return printRest_; } |
153 |
cli2 |
1361 |
|
154 |
|
|
protected: |
155 |
|
|
|
156 |
|
|
RealType scaleFactor_; |
157 |
|
|
RealType kDisp_; |
158 |
|
|
RealType kTwist_; |
159 |
|
|
RealType kSwingX_; |
160 |
|
|
RealType kSwingY_; |
161 |
|
|
RealType pot_; |
162 |
|
|
RealType twist0_; |
163 |
|
|
RealType swingX0_; |
164 |
|
|
RealType swingY0_; |
165 |
cli2 |
1364 |
bool printRest_; |
166 |
cli2 |
1361 |
|
167 |
|
|
int restType_; |
168 |
|
|
std::string restName_; |
169 |
|
|
std::map<int, RealPair> restInfo_; |
170 |
|
|
}; |
171 |
|
|
|
172 |
|
|
typedef SimpleTypeData<Restraint*> RestraintData; |
173 |
|
|
|
174 |
|
|
|
175 |
|
|
} |
176 |
|
|
#endif |