ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/restraints/Restraint.hpp
Revision: 3521
Committed: Tue Sep 8 13:45:27 2009 UTC (14 years, 9 months ago) by cli2
File size: 5637 byte(s)
Log Message:
Added missing restraint file

File Contents

# Content
1 /*
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 RealType getDisplacementForceConstant() { return kDisp_; }
141 RealType getTwistForceConstant() { return kTwist_; }
142 RealType getSwingXForceConstant() { return kSwingX_; }
143 RealType getSwingYForceConstant() { return kSwingY_; }
144 RealType getRestrainedTwistAngle() { return twist0_; }
145 RealType getRestrainedSwingXAngle() { return swingX0_; }
146 RealType getRestrainedSwingYAngle() { return swingY0_; }
147 std::map<int, RealPair> getRestraintInfo() { return restInfo_; }
148
149 protected:
150
151 RealType scaleFactor_;
152 RealType kDisp_;
153 RealType kTwist_;
154 RealType kSwingX_;
155 RealType kSwingY_;
156 RealType pot_;
157 RealType twist0_;
158 RealType swingX0_;
159 RealType swingY0_;
160
161 int restType_;
162 std::string restName_;
163 std::map<int, RealPair> restInfo_;
164 };
165
166 typedef SimpleTypeData<Restraint*> RestraintData;
167
168
169 }
170 #endif

Properties

Name Value
svn:executable *