ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-3.0/src/types/DirectionalAtomType.cpp
(Generate patch)

Comparing trunk/OOPSE-3.0/src/types/DirectionalAtomType.cpp (file contents):
Revision 2089 by gezelter, Tue Mar 8 21:07:27 2005 UTC vs.
Revision 2226 by kdaily, Tue May 17 02:09:25 2005 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 42 | Line 42
42   #include "types/DirectionalAtomType.hpp"
43   #include "UseTheForce/DarkSide/electrostatic_interface.h"
44   #include "UseTheForce/DarkSide/sticky_interface.h"
45 + #include "UseTheForce/DarkSide/gb_interface.h"
46   #include "utils/simError.h"
47   namespace oopse {
48  
49 < void DirectionalAtomType::complete() {
49 >  void DirectionalAtomType::complete() {
50  
51      //
52      AtomType::complete();
# Line 85 | Line 86 | void DirectionalAtomType::complete() {
86          simError();          
87        }
88      }
89 +
90 +    if (isSplitDipole()) {
91 +      data = getPropertyByName("SplitDipoleDistance");
92 +      if (data != NULL) {
93 +        DoubleGenericData* doubleData= dynamic_cast<DoubleGenericData*>(data);
94 +        
95 +        if (doubleData != NULL) {
96 +          double splitDipoleDistance = doubleData->getData();
97 +          
98 +          setSplitDipoleDistance(&atp.ident, &splitDipoleDistance, &isError);
99 +          if (isError != 0) {
100 +            sprintf( painCave.errMsg,
101 +                     "Fortran rejected setSplitDipoleDistance\n");
102 +            painCave.severity = OOPSE_ERROR;
103 +            painCave.isFatal = 1;
104 +            simError();          
105 +          }
106 +          
107 +        } else {
108 +          sprintf( painCave.errMsg,
109 +                   "Can not cast GenericData to DoubleGenericData\n");
110 +          painCave.severity = OOPSE_ERROR;
111 +          painCave.isFatal = 1;
112 +          simError();          
113 +        }
114 +      } else {
115 +        sprintf( painCave.errMsg, "Can not find SplitDipole distance parameter\n");
116 +        painCave.severity = OOPSE_ERROR;
117 +        painCave.isFatal = 1;
118 +        simError();          
119 +      }
120 +    }
121      
122      //setup quadrupole atom type in fortran side
123      if (isQuadrupole()) {
124 <      data = getPropertyByName("Quadrupole");
124 >      data = getPropertyByName("QuadrupoleMoments");
125        if (data != NULL) {
126          Vector3dGenericData* vector3dData= dynamic_cast<Vector3dGenericData*>(data);
127      
128 <        // BROKEN:  cartesian quadrupoles have the following properties
129 <        //     They are symmetric and traceless:
130 <        //     Qxy = Qyx          Qxx + Qyy + Qzz = 0
131 <        //     Qxz = Qzx
132 <        //     Qyz = Qzy
128 >        // Quadrupoles in OOPSE are set as the diagonal elements
129 >        // of the diagonalized traceless quadrupole moment tensor.
130 >        // The column vectors of the unitary matrix that diagonalizes
131 >        // the quadrupole moment tensor become the eFrame (or the
132 >        // electrostatic version of the body-fixed frame.
133          
134          if (vector3dData != NULL) {
135            Vector3d diagElem= vector3dData->getData();
103          Mat3x3d Q;
104          Q(0, 0) = diagElem[0];
105          Q(1, 1) = diagElem[1];
106          Q(2, 2) = diagElem[2];
136            
137 <          setCartesianQuadrupole(&atp.ident, Q.getArrayPointer(), &isError);
137 >          setQuadrupoleMoments(&atp.ident, diagElem.getArrayPointer(),
138 >                               &isError);
139            if (isError != 0) {
140              sprintf( painCave.errMsg,
141 <                     "Fortran rejected setCartesianQuadrupole\n");
141 >                     "Fortran rejected setQuadrupoleMoments\n");
142              painCave.severity = OOPSE_ERROR;
143              painCave.isFatal = 1;
144              simError();          
# Line 122 | Line 152 | void DirectionalAtomType::complete() {
152            simError();          
153          }
154        } else {
155 <        sprintf( painCave.errMsg, "Can not find Quadrupole Parameters\n");
155 >        sprintf( painCave.errMsg, "Can not find QuadrupoleMoments\n");
156          painCave.severity = OOPSE_ERROR;
157          painCave.isFatal = 1;
158          simError();          
# Line 132 | Line 162 | void DirectionalAtomType::complete() {
162      
163      //setup sticky atom type in fortran side
164      if (isSticky()) {
165 <        data = getPropertyByName("Sticky");
165 >      data = getPropertyByName("Sticky");
166 >      if (data != NULL) {
167 >        StickyParamGenericData* stickyData = dynamic_cast<StickyParamGenericData*>(data);
168 >
169 >        if (stickyData != NULL) {
170 >          StickyParam stickyParam = stickyData->getData();
171 >
172 >          newStickyType(&atp.ident,&stickyParam.w0, &stickyParam.v0, &stickyParam.v0p, &stickyParam.rl,
173 >                        &stickyParam.ru, &stickyParam.rlp, &stickyParam.rup, &isError);
174 >          if (isError != 0) {
175 >            sprintf( painCave.errMsg,
176 >                     "Fortran rejected newLJtype\n");
177 >            painCave.severity = OOPSE_ERROR;
178 >            painCave.isFatal = 1;
179 >            simError();          
180 >          }
181 >                
182 >        } else {
183 >          sprintf( painCave.errMsg,
184 >                   "Can not cast GenericData to StickyParam\n");
185 >          painCave.severity = OOPSE_ERROR;
186 >          painCave.isFatal = 1;
187 >          simError();          
188 >        }            
189 >      } else {
190 >        sprintf( painCave.errMsg, "Can not find Parameters for Sticky\n");
191 >        painCave.severity = OOPSE_ERROR;
192 >        painCave.isFatal = 1;
193 >        simError();          
194 >      }
195 >    }
196 >
197 >    //setup GayBerne type in fortran side
198 >      if (isGayBerne()) {
199 >        data = getPropertyByName("GayBerne");
200          if (data != NULL) {
201 <            StickyParamGenericData* stickyData = dynamic_cast<StickyParamGenericData*>(data);
201 >            GayBerneParamGenericData* gayBerneData = dynamic_cast<GayBerneParamGenericData*>(data);
202  
203 <            if (stickyData != NULL) {
204 <                StickyParam stickyParam = stickyData->getData();
203 >            if (gayBerneData != NULL) {
204 >                GayBerneParam gayBerneParam = gayBerneData->getData();
205  
206                  /**@todo change fortran interface */
207 <                //makeStickyType(&atp.ident, &stickyParam.w0, &stickyParam.v0, &stickyParam.v0p, &stickyParam.rl,
208 <                //    &stickyParam.ru, &stickyParam.rlp, &stickyParam.rup);
209 <                newStickyType(&atp.ident,&stickyParam.w0, &stickyParam.v0, &stickyParam.v0p, &stickyParam.rl,
210 <                    &stickyParam.ru, &stickyParam.rlp, &stickyParam.rup, &isError);
207 >                //makeGayBerneType(&atp.ident, &gayBerneParam.w0, &gayBerneParam.v0, &gayBerneParam.v0p, &gayBerneParam.rl,
208 >                //    &gayBerneParam.ru, &gayBerneParam.rlp, &gayBerneParam.rup);
209 >                newGayBerneType(&gayBerneParam.GB_sigma, &gayBerneParam.GB_12b_ratio, &gayBerneParam.GB_eps,
210 >                                &gayBerneParam.GB_eps_ratio, &gayBerneParam.GB_mu, &gayBerneParam.GB_nu);
211                  if (isError != 0) {
212                      sprintf( painCave.errMsg,
213 <                           "Fortran rejected newLJtype\n");
213 >                           "Fortran rejected newGayBernetype\n");
214                      painCave.severity = OOPSE_ERROR;
215                      painCave.isFatal = 1;
216                      simError();          
217                  }
218                  
219 <            } else {
219 >            }
220 >            
221 >            else {
222                      sprintf( painCave.errMsg,
223 <                           "Can not cast GenericData to StickyParam\n");
223 >                           "Can not cast GenericData to GayBerneParam\n");
224                      painCave.severity = OOPSE_ERROR;
225                      painCave.isFatal = 1;
226                      simError();          
227              }            
228 <        } else {
229 <            sprintf( painCave.errMsg, "Can not find Parameters for Sticky\n");
230 <            painCave.severity = OOPSE_ERROR;
231 <            painCave.isFatal = 1;
232 <            simError();          
228 >        }
229 >        else {
230 >          sprintf( painCave.errMsg, "Can not find Parameters for GayBerne\n");
231 >          painCave.severity = OOPSE_ERROR;
232 >          painCave.isFatal = 1;
233 >          simError();          
234          }
235      }
169
170    //setup GayBerne type in fortran side
171
236   }
237 +
238  
239  
240   } //end namespace oopse

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines