ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/restraints/Restraint.hpp
Revision: 1465
Committed: Fri Jul 9 23:08:25 2010 UTC (14 years, 9 months ago) by chuckv
File size: 5835 byte(s)
Log Message:
Creating busticated version of OpenMD

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. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the
15 * distribution.
16 *
17 * This software is provided "AS IS," without a warranty of any
18 * kind. All express or implied conditions, representations and
19 * warranties, including any implied warranty of merchantability,
20 * fitness for a particular purpose or non-infringement, are hereby
21 * excluded. The University of Notre Dame and its licensors shall not
22 * be liable for any damages suffered by licensee as a result of
23 * using, modifying or distributing the software or its
24 * derivatives. In no event will the University of Notre Dame or its
25 * licensors be liable for any lost revenue, profit or data, or for
26 * direct, indirect, special, consequential, incidental or punitive
27 * damages, however caused and regardless of the theory of liability,
28 * arising out of the use of or inability to use software, even if the
29 * University of Notre Dame has been advised of the possibility of
30 * such damages.
31 *
32 * SUPPORT OPEN SCIENCE! If you use OpenMD or its source code in your
33 * research, please cite the appropriate papers when you publish your
34 * work. Good starting points are:
35 *
36 * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).
37 * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).
38 * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).
39 * [4] Vardeman & Gezelter, in progress (2009).
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 OpenMD {
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 void setPrintRestraint(bool printRest) {
141 printRest_ = printRest;
142 }
143
144 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 std::map<int, RealPair> getRestraintInfo() { return restInfo_; }
152 bool getPrintRestraint() { return printRest_; }
153
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 bool printRest_;
166
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

Properties

Name Value
svn:executable *
svn:keywords Author Id Revision Date