ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/primitives/RigidBody.hpp
(Generate patch)

Comparing:
trunk/src/primitives/RigidBody.hpp (file contents), Revision 246 by gezelter, Wed Jan 12 22:41:40 2005 UTC vs.
branches/development/src/primitives/RigidBody.hpp (file contents), Revision 1794 by gezelter, Thu Sep 6 19:44:06 2012 UTC

# Line 1 | Line 1
1 < /*
1 > /*
2   * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved.
3   *
4   * The University of Notre Dame grants you ("Licensee") a
# Line 6 | Line 6
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
9 > * 1. Redistributions of source code must retain the above copyright
10   *    notice, this list of conditions and the following disclaimer.
11   *
12 < * 3. Redistributions in binary form must reproduce the above copyright
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.
# Line 37 | Line 28
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]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40 + * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
42  
43   /**
# Line 54 | Line 55
55   #include "primitives/StuntDouble.hpp"
56   #include "primitives/DirectionalAtom.hpp"
57   #include "types/AtomStamp.hpp"
58 < namespace oopse{
59 < class RigidBody : public StuntDouble {
60 <    public:
60 <        RigidBody();
58 > namespace OpenMD{
59 >  class RigidBody : public StuntDouble {
60 >  public:
61  
62 <        virtual std::string getType() { return name_;}
62 >    typedef std::vector<Atom*>::iterator AtomIterator;        
63 >
64 >    RigidBody();
65 >
66 >    virtual std::string getType() { return name_;}
67          
68 <        /** Sets the name of this stuntdouble*/
69 <        virtual void setType(const std::string& name) { name_ = name;}
68 >    /** Sets the name of this stuntRealType*/
69 >    virtual void setType(const std::string& name) { name_ = name;}
70      
71  
72 <       /**
73 <         * Sets  the previous rotation matrix of this stuntdouble
74 <         * @param a  new rotation matrix
75 <         */        
76 <       virtual void setPrevA(const RotMat3x3d& a);
72 >    /**
73 >     * Sets  the previous rotation matrix of this stuntdouble
74 >     * @param a  new rotation matrix
75 >     */        
76 >    virtual void setPrevA(const RotMat3x3d& a);
77        
78 <       /**
79 <         * Sets  the current rotation matrix of this stuntdouble
80 <         * @param a  new rotation matrix
81 <         * @note setA will not change the position and rotation matrix of Directional atoms belong to
82 <         * this rigidbody. If you want to do that, use #updateAtoms
83 <         */        
84 <        virtual void setA(const RotMat3x3d& a);
85 <       /**
86 <         * Sets  the rotation matrix of this stuntdouble in specified snapshot
87 <         * @param a rotation matrix to be set
88 <         * @param snapshotNo
89 <         * @see #getA
90 <         */        
91 <        virtual void setA(const RotMat3x3d& a, int snapshotNo);
78 >    /**
79 >     * Sets  the current rotation matrix of this stuntdouble
80 >     * @param a  new rotation matrix
81 >     * @note setA will not change the position and rotation matrix of Directional atoms belong to
82 >     * this rigidbody. If you want to do that, use #updateAtoms
83 >     */        
84 >    virtual void setA(const RotMat3x3d& a);
85 >    /**
86 >     * Sets  the rotation matrix of this stuntdouble in specified snapshot
87 >     * @param a rotation matrix to be set
88 >     * @param snapshotNo
89 >     * @see #getA
90 >     */        
91 >    virtual void setA(const RotMat3x3d& a, int snapshotNo);
92  
93 <        /**
94 <         * Returns the inertia tensor of this stuntdouble
95 <         * @return the inertia tensor of this stuntdouble
96 <         */
97 <        virtual Mat3x3d getI();
93 >    /**
94 >     * Returns the inertia tensor of this stuntdouble
95 >     * @return the inertia tensor of this stuntdouble
96 >     */
97 >    virtual Mat3x3d getI();
98  
99 +    /**
100 +     * Returns the gradient of this stuntdouble
101 +     * @return the inertia tensor of this stuntdouble
102 +     * @see #setI
103 +     */
104 +    virtual std::vector<RealType> getGrad();
105  
106 <        /** Sets the internal unit frame of this stuntdouble by three euler angles */
97 <        void setElectroFrameFromEuler(double phi, double theta, double psi);
98 <        
99 <        /**
100 <         * Returns the gradient of this stuntdouble
101 <         * @return the inertia tensor of this stuntdouble
102 <         * @see #setI
103 <         */
104 <        virtual std::vector<double> getGrad();
106 >    virtual void accept(BaseVisitor* v);
107  
108 <        virtual void accept(BaseVisitor* v);
108 >    void addAtom(Atom* at, AtomStamp* ats);
109  
110 <        void addAtom(Atom* at, AtomStamp* ats);
110 >    /** calculates the reference coordinates */
111 >    void calcRefCoords();
112  
113 <        /** calculate the reference coordinates */
114 <        void calcRefCoords();
113 >    /** Converts Atomic forces and torques to total forces and torques */
114 >    void calcForcesAndTorques();
115  
116 <        /** Convert Atomic forces and torques to total forces and torques */
117 <        void calcForcesAndTorques();
116 >    /**
117 >        Converts Atomic forces and torques to total forces and torques
118 >        and computes the rigid body contribution to the virial.
119 >        Returns the rigid body contribution to the virial as a 3x3
120 >        matrix.
121 >        */
122 >    Mat3x3d calcForcesAndTorquesAndVirial();
123 >    
124 >    /** update the positions of atoms belong to this rigidbody */
125 >    void updateAtoms();
126  
127 <        /** update the positions of atoms belong to this rigidbody */
117 <        void updateAtoms();
127 >    void updateAtoms(int frame);
128  
129 <        Atom* beginAtom(std::vector<Atom*>::iterator& i);
129 >    void updateAtomVel();
130  
131 <        Atom* nextAtom(std::vector<Atom*>::iterator& i);
131 >    void updateAtomVel(int frame);
132 >        
133 >    Atom* beginAtom(std::vector<Atom*>::iterator& i) {
134 >      i = atoms_.begin();
135 >      return i != atoms_.end() ? *i : NULL;
136 >    }
137  
138 <        std::vector<Atom*>::iterator getBeginAtomIter() {
139 <            return atoms_.begin();
140 <        }
138 >    Atom* nextAtom(std::vector<Atom*>::iterator& i) {
139 >      ++i;
140 >      return i != atoms_.end() ? *i : NULL;
141 >    }
142 >
143 >    std::vector<Atom*>::iterator getBeginAtomIter() {
144 >      return atoms_.begin();
145 >    }
146          
147 <        std::vector<Atom*>::iterator getEndAtomIter() {
148 <            return atoms_.end();
149 <        }
147 >    std::vector<Atom*>::iterator getEndAtomIter() {
148 >      return atoms_.end();
149 >    }
150  
151 <        /**
152 <         * Returns the atoms of this rigid body
153 <         * @return the atoms of this rigid body in a vector
154 <         * @deprecate
155 <         */          
156 <        std::vector<Atom*> getAtoms() {
157 <            return atoms_;
158 <        }
151 >    /**
152 >     * Returns the atoms of this rigid body
153 >     * @return the atoms of this rigid body in a vector
154 >     * @deprecate
155 >     */          
156 >    std::vector<Atom*> getAtoms() {
157 >      return atoms_;
158 >    }
159  
160 <        /**
161 <         * Returns the number of atoms in this rigid body
162 <         * @return the number of atoms in this rigid body
163 <         */
164 <        int getNumAtoms() {
165 <            return atoms_.size();
166 <        }
160 >    /**
161 >     * Returns the number of atoms in this rigid body
162 >     * @return the number of atoms in this rigid body
163 >     */
164 >    int getNumAtoms() {
165 >      return atoms_.size();
166 >    }
167  
168 <        /**
169 <         * Return the position of atom which belongs to this rigid body.
170 <         * @return true if index is valid otherwise return false
171 <         * @param pos the position of atom which will be set on return if index is valid
172 <         * @param index the index of the atom in rigid body's private data member atoms_
173 <         */
174 <        bool getAtomPos(Vector3d& pos, unsigned int index);
168 >    /**
169 >     * Return the position of atom which belongs to this rigid body.
170 >     * @return true if index is valid otherwise return false
171 >     * @param pos the position of atom which will be set on return if index is valid
172 >     * @param index the index of the atom in rigid body's private data member atoms_
173 >     */
174 >    bool getAtomPos(Vector3d& pos, unsigned int index);
175  
176 <        /**
177 <         * Return the position of atom which belongs to this rigid body.
178 <         * @return true if atom belongs to this rigid body,otherwise return false
179 <         * @param pos position of atom which will be set on return if atom belongs to this rigid body
180 <         * @param atom the pointer to an atom
181 <         */            
182 <        bool getAtomPos(Vector3d& pos, Atom* atom);
176 >    /**
177 >     * Return the position of atom which belongs to this rigid body.
178 >     * @return true if atom belongs to this rigid body,otherwise return false
179 >     * @param pos position of atom which will be set on return if atom belongs to this rigid body
180 >     * @param atom the pointer to an atom
181 >     */            
182 >    bool getAtomPos(Vector3d& pos, Atom* atom);
183  
184 <        /**
185 <         * Return the velocity of atom which belongs to this rigid body.
186 <         * @return true if index is valid otherwise return false
187 <         * @param vel the velocity of atom which will be set on return if index is valid
188 <         * @param index the index of the atom in rigid body's private data member atoms_
189 <         */
190 <        bool getAtomVel(Vector3d& vel, unsigned int index);
184 >    /**
185 >     * Return the velocity of atom which belongs to this rigid body.
186 >     * @return true if index is valid otherwise return false
187 >     * @param vel the velocity of atom which will be set on return if index is valid
188 >     * @param index the index of the atom in rigid body's private data member atoms_
189 >     */
190 >    bool getAtomVel(Vector3d& vel, unsigned int index);
191  
192 <        /**
193 <         * Return the velocity of atom which belongs to this rigid body.
194 <         * @return true if atom belongs to this rigid body,otherwise return false
195 <         * @param vel velocity of atom which will be set on return if atom belongs to this rigid body
196 <         * @param atom the pointer to an atom
197 <         */
198 <        bool getAtomVel(Vector3d& vel, Atom*);
192 >    /**
193 >     * Return the velocity of atom which belongs to this rigid body.
194 >     * @return true if atom belongs to this rigid body,otherwise return false
195 >     * @param vel velocity of atom which will be set on return if atom belongs to this rigid body
196 >     * @param atom the pointer to an atom
197 >     */
198 >    bool getAtomVel(Vector3d& vel, Atom*);
199  
200 <        /**
201 <         * Return the reference coordinate of atom which belongs to this rigid body.
202 <         * @return true if index is valid otherwise return false
203 <         * @param coor the reference coordinate of atom which will be set on return if index is valid
204 <         * @param index the index of the atom in rigid body's private data member atoms_
205 <         */
206 <        bool getAtomRefCoor(Vector3d& coor, unsigned int index);
200 >    /**
201 >     * Return the reference coordinate of atom which belongs to this rigid body.
202 >     * @return true if index is valid otherwise return false
203 >     * @param coor the reference coordinate of atom which will be set on return if index is valid
204 >     * @param index the index of the atom in rigid body's private data member atoms_
205 >     */
206 >    bool getAtomRefCoor(Vector3d& coor, unsigned int index);
207  
208 <        /**
209 <         * Return the velocity of atom which belongs to this rigid body.
210 <         * @return true if atom belongs to this rigid body,otherwise return false
211 <         * @param coor velocity of atom which will be set on return if atom belongs to this rigid body
212 <         * @param atom the pointer to an atom
213 <         */
214 <        bool getAtomRefCoor(Vector3d& coor, Atom* atom);
208 >    /**
209 >     * Return the velocity of atom which belongs to this rigid body.
210 >     * @return true if atom belongs to this rigid body,otherwise return false
211 >     * @param coor velocity of atom which will be set on return if atom belongs to this rigid body
212 >     * @param atom the pointer to an atom
213 >     */
214 >    bool getAtomRefCoor(Vector3d& coor, Atom* atom);
215  
216 <    private:
217 <        std::string name_;        
218 <        Mat3x3d inertiaTensor_;    
219 <        RotMat3x3d sU_;               /**< body fixed standard unit vector */
216 >  private:
217 >    std::string name_;        
218 >    Mat3x3d inertiaTensor_;    
219 >    RotMat3x3d sU_;               /**< body fixed standard unit vector */
220          
221 <        std::vector<Atom*> atoms_;
222 <        std::vector<Vector3d> refCoords_;
223 <        std::vector<RotMat3x3d> refOrients_;
224 < };
221 >    std::vector<Atom*> atoms_;
222 >    std::vector<Vector3d> refCoords_;
223 >    std::vector<RotMat3x3d> refOrients_;
224 >  };
225  
226 < }//namepace oopse
226 > }//namespace OpenMD
227  
228   #endif //PRIMITIVES_RIGIDBODY_HPP
229  

Comparing:
trunk/src/primitives/RigidBody.hpp (property svn:keywords), Revision 246 by gezelter, Wed Jan 12 22:41:40 2005 UTC vs.
branches/development/src/primitives/RigidBody.hpp (property svn:keywords), Revision 1794 by gezelter, Thu Sep 6 19:44:06 2012 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines