ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/integrators/SMIPDynamics.cpp
Revision: 1294
Committed: Wed Sep 17 00:23:39 2008 UTC (16 years, 7 months ago) by chuckv
File size: 5319 byte(s)
Log Message:
Adding back more missing files.

File Contents

# Content
1 /*
2 * Copyright (c) 2005 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 LangevinDynamics.cpp
44 * @author tlin
45 * @date 11/08/2004
46 * @time 15:13am
47 * @version 1.0
48 */
49
50 #include "integrators/SMIPDynamics.hpp"
51 #include "primitives/Molecule.hpp"
52 #include "utils/OOPSEConstant.hpp"
53 #include "integrators/SMIPDForceManager.hpp"
54 namespace oopse {
55
56
57 SMIPDynamics::SMIPDynamics(SimInfo* info) : VelocityVerletIntegrator(info){
58 setForceManager(new SMIPDForceManager(info));
59
60 // Langevin Dynamics Force Manager needs to know about the half-time step
61 // size to get convergence on the friction forces:
62 dynamic_cast<SMIPDForceManager*>(forceMan_)->setDt2(dt2);
63
64 }
65
66 void SMIPDynamics::moveA(){
67 SimInfo::MoleculeIterator i;
68 Molecule::IntegrableObjectIterator j;
69 Molecule* mol;
70 StuntDouble* integrableObject;
71 Vector3d vel;
72 Vector3d pos;
73 Vector3d frc;
74 Vector3d Tb;
75 Vector3d ji;
76 RealType mass;
77
78 for (mol = info_->beginMolecule(i); mol != NULL; mol = info_->nextMolecule(i)) {
79 for (integrableObject = mol->beginIntegrableObject(j); integrableObject != NULL;
80 integrableObject = mol->nextIntegrableObject(j)) {
81
82 vel =integrableObject->getVel();
83 pos = integrableObject->getPos();
84 frc = integrableObject->getFrc();
85 mass = integrableObject->getMass();
86
87 // velocity half step
88 vel += (dt2 /mass * OOPSEConstant::energyConvert) * frc;
89
90 // position whole step
91 pos += dt * vel;
92
93 integrableObject->setVel(vel);
94 integrableObject->setPos(pos);
95
96 if (integrableObject->isDirectional()){
97
98 // get and convert the torque to body frame
99
100 Tb = integrableObject->lab2Body(integrableObject->getTrq());
101
102 // get the angular momentum, and propagate a half step
103
104 ji = integrableObject->getJ();
105
106 ji += (dt2 * OOPSEConstant::energyConvert) * Tb;
107
108 rotAlgo->rotate(integrableObject, ji, dt);
109
110 integrableObject->setJ(ji);
111 }
112
113
114 }
115 } //end for(mol = info_->beginMolecule(i))
116
117 rattle->constraintA();
118
119 }
120
121 void SMIPDynamics::moveB(){
122 SimInfo::MoleculeIterator i;
123 Molecule::IntegrableObjectIterator j;
124 Molecule* mol;
125 StuntDouble* integrableObject;
126 Vector3d vel;
127 Vector3d frc;
128 Vector3d Tb;
129 Vector3d ji;
130 RealType mass;
131
132 for (mol = info_->beginMolecule(i); mol != NULL; mol = info_->nextMolecule(i)) {
133 for (integrableObject = mol->beginIntegrableObject(j); integrableObject != NULL;
134 integrableObject = mol->nextIntegrableObject(j)) {
135
136 vel =integrableObject->getVel();
137 frc = integrableObject->getFrc();
138 mass = integrableObject->getMass();
139
140 // velocity half step
141 vel += (dt2 /mass * OOPSEConstant::energyConvert) * frc;
142
143 integrableObject->setVel(vel);
144
145 if (integrableObject->isDirectional()){
146
147 // get and convert the torque to body frame
148
149 Tb = integrableObject->lab2Body(integrableObject->getTrq());
150
151 // get the angular momentum, and propagate a half step
152
153 ji = integrableObject->getJ();
154
155 ji += (dt2 * OOPSEConstant::energyConvert) * Tb;
156
157 integrableObject->setJ(ji);
158 }
159
160
161 }
162 } //end for(mol = info_->beginMolecule(i))
163
164
165 rattle->constraintB();
166
167 }
168
169
170 RealType SMIPDynamics::calcConservedQuantity() {
171 return 0.0;
172 }
173
174 } //end namespace oopse
175

Properties

Name Value
svn:executable *