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

Comparing trunk/src/primitives/Inversion.hpp (file contents):
Revision 1390 by gezelter, Wed Nov 25 20:02:06 2009 UTC vs.
Revision 2066 by gezelter, Thu Mar 5 15:22:54 2015 UTC

# Line 35 | Line 35
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).                        
38 > * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (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 49 | Line 50
50   #ifndef PRIMITIVES_INVERSION_HPP
51   #define PRIMITIVES_INVERSION_HPP
52  
53 + #include "primitives/ShortRangeInteraction.hpp"
54   #include "primitives/Atom.hpp"
53
55   #include "types/InversionType.hpp"
56  
57   namespace OpenMD {
# Line 65 | Line 66 | namespace OpenMD {
66      InversionData curr;
67    };
68  
68  
69    /**
70     * @class Inversion Inversion.hpp "primitives/Inversion.hpp"
71     */
72 <  class Inversion {
72 >  class Inversion : public ShortRangeInteraction {
73    public:
74 +    using ShortRangeInteraction::getValue;
75 +    using ShortRangeInteraction::getPrevValue;
76 +
77      Inversion(Atom* atom1, Atom* atom2, Atom* atom3, Atom* atom4, InversionType* it);
78      virtual ~Inversion() {}
79 <    virtual void calcForce(RealType& angle);
79 >    virtual void calcForce(RealType& angle, bool doParticlePot);
80          
81 +    RealType getValue(int snapshotNo) {
82 +      // In OpenMD's version of an inversion, the central atom
83 +      // comes first.  However, to get the planarity in a typical cosine
84 +      // version of this potential (i.e. Amber-style), the central atom
85 +      // is treated as atom *3* in a standard torsion form:
86 +      
87 +      Vector3d pos1 = atoms_[1]->getPos(snapshotNo);
88 +      Vector3d pos2 = atoms_[2]->getPos(snapshotNo);
89 +      Vector3d pos3 = atoms_[0]->getPos(snapshotNo);
90 +      Vector3d pos4 = atoms_[3]->getPos(snapshotNo);
91 +      
92 +      Vector3d r31 = pos1 - pos3;
93 +      Vector3d r23 = pos3 - pos2;
94 +      Vector3d r43 = pos3 - pos4;
95 +      
96 +      //  Calculate the cross products and distances
97 +      Vector3d A = cross(r31, r43);
98 +      Vector3d B = cross(r43, r23);
99 +      
100 +      A.normalize();
101 +      B.normalize();
102 +      
103 +      //  Calculate the sin and cos
104 +      RealType cos_phi = dot(A, B) ;
105 +      if (cos_phi > 1.0) cos_phi = 1.0;
106 +      if (cos_phi < -1.0) cos_phi = -1.0;
107 +      return acos(cos_phi);
108 +    }
109 +
110 +
111      RealType getPotential() {
112        return potential_;
113      }
114  
115      Atom* getAtomA() {
116 <      return atom1_;
116 >      return atoms_[0];
117      }
118  
119      Atom* getAtomB() {
120 <      return atom2_;
120 >      return atoms_[1];
121      }
122  
123      Atom* getAtomC() {
124 <      return atom3_;
124 >      return atoms_[2];
125      }
126  
127      Atom* getAtomD() {
128 <      return atom4_;
128 >      return atoms_[3];
129      }
130  
131      InversionType * getInversionType() {
132        return inversionType_;
133      }
134 <        
135 <  protected:
134 >    virtual std::string getName() { return name_;}        
135 >    /** Sets the name of this inversion for selections */
136 >    virtual void setName(const std::string& name) { name_ = name;}
137  
138 <    Atom* atom1_;
139 <    Atom* atom2_;
140 <    Atom* atom3_;
107 <    Atom* atom4_;
138 >    void accept(BaseVisitor* v) {
139 >      v->visit(this);
140 >    }    
141  
142 +  protected:
143      InversionType* inversionType_;
144 +    InversionKey inversionKey_;
145 +    std::string name_;        
146  
147      RealType potential_;
148    };    

Comparing trunk/src/primitives/Inversion.hpp (property svn:keywords):
Revision 1390 by gezelter, Wed Nov 25 20:02:06 2009 UTC vs.
Revision 2066 by gezelter, Thu Mar 5 15:22:54 2015 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines