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 1930 by gezelter, Wed Jan 12 22:41:40 2005 UTC vs.
Revision 2097 by tim, Wed Mar 9 17:30:29 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 40 | Line 40
40   */
41  
42   #include "types/DirectionalAtomType.hpp"
43 < #include "UseTheForce/DarkSide/dipole_interface.h"
43 > #include "UseTheForce/DarkSide/electrostatic_interface.h"
44   #include "UseTheForce/DarkSide/sticky_interface.h"
45   #include "utils/simError.h"
46   namespace oopse {
47  
48 < void DirectionalAtomType::complete() {
48 >  void DirectionalAtomType::complete() {
49  
50      //
51      AtomType::complete();
# Line 55 | Line 55 | void DirectionalAtomType::complete() {
55  
56      //setup dipole atom  type in fortran side
57      if (isDipole()) {
58 <        data = getPropertyByName("Dipole");
59 <        if (data != NULL) {
60 <            DoubleGenericData* doubleData= dynamic_cast<DoubleGenericData*>(data);
61 <
62 <            if (doubleData != NULL) {
63 <                double dipole = doubleData->getData();
64 <                
65 <                newDipoleType(&atp.ident, &dipole, &isError);
66 <                if (isError != 0) {
67 <                    sprintf( painCave.errMsg,
68 <                           "Fortran rejected newDipoleType\n");
69 <                    painCave.severity = OOPSE_ERROR;
70 <                    painCave.isFatal = 1;
71 <                    simError();          
72 <                }
73 <                
74 <            } else {
75 <                    sprintf( painCave.errMsg,
76 <                           "Can not cast GenericData to DoubleGenericData\n");
77 <                    painCave.severity = OOPSE_ERROR;
78 <                    painCave.isFatal = 1;
79 <                    simError();          
80 <            }
81 <        } else {
82 <            sprintf( painCave.errMsg, "Can not find Dipole Parameters\n");
58 >      data = getPropertyByName("Dipole");
59 >      if (data != NULL) {
60 >        DoubleGenericData* doubleData= dynamic_cast<DoubleGenericData*>(data);
61 >        
62 >        if (doubleData != NULL) {
63 >          double dipole = doubleData->getData();
64 >          
65 >          setDipoleMoment(&atp.ident, &dipole, &isError);
66 >          if (isError != 0) {
67 >            sprintf( painCave.errMsg,
68 >                     "Fortran rejected setDipoleMoment\n");
69              painCave.severity = OOPSE_ERROR;
70              painCave.isFatal = 1;
71              simError();          
72 +          }
73 +          
74 +        } else {
75 +          sprintf( painCave.errMsg,
76 +                   "Can not cast GenericData to DoubleGenericData\n");
77 +          painCave.severity = OOPSE_ERROR;
78 +          painCave.isFatal = 1;
79 +          simError();          
80          }
81 +      } else {
82 +        sprintf( painCave.errMsg, "Can not find Dipole Parameters\n");
83 +        painCave.severity = OOPSE_ERROR;
84 +        painCave.isFatal = 1;
85 +        simError();          
86 +      }
87      }
88  
89 +    if (isSplitDipole()) {
90 +      data = getPropertyByName("SplitDipoleDistance");
91 +      if (data != NULL) {
92 +        DoubleGenericData* doubleData= dynamic_cast<DoubleGenericData*>(data);
93 +        
94 +        if (doubleData != NULL) {
95 +          double splitDipoleDistance = doubleData->getData();
96 +          
97 +          setSplitDipoleDistance(&atp.ident, &splitDipoleDistance, &isError);
98 +          if (isError != 0) {
99 +            sprintf( painCave.errMsg,
100 +                     "Fortran rejected setSplitDipoleDistance\n");
101 +            painCave.severity = OOPSE_ERROR;
102 +            painCave.isFatal = 1;
103 +            simError();          
104 +          }
105 +          
106 +        } else {
107 +          sprintf( painCave.errMsg,
108 +                   "Can not cast GenericData to DoubleGenericData\n");
109 +          painCave.severity = OOPSE_ERROR;
110 +          painCave.isFatal = 1;
111 +          simError();          
112 +        }
113 +      } else {
114 +        sprintf( painCave.errMsg, "Can not find SplitDipole distance parameter\n");
115 +        painCave.severity = OOPSE_ERROR;
116 +        painCave.isFatal = 1;
117 +        simError();          
118 +      }
119 +    }
120 +    
121      //setup quadrupole atom type in fortran side
122      if (isQuadrupole()) {
123 <        data = getPropertyByName("Quadrupole");
124 <        if (data != NULL) {
125 <            Vector3dGenericData* vector3dData= dynamic_cast<Vector3dGenericData*>(data);
126 <
127 <            if (vector3dData != NULL) {
128 <                Vector3d diagElem= vector3dData->getData();
129 <                Mat3x3d Q;
130 <                Q(0, 0) = diagElem[0];
131 <                Q(1, 1) = diagElem[1];
132 <                Q(2, 2) = diagElem[2];
133 <
134 <                //newQuadrupoleType(&atp.ident, Q->getArrayPointer, &isError);
135 <                if (isError != 0) {
136 <                    sprintf( painCave.errMsg,
137 <                           "Fortran rejected newQuadrupoleType\n");
138 <                    painCave.severity = OOPSE_ERROR;
139 <                    painCave.isFatal = 1;
140 <                    simError();          
109 <                }
110 <                
111 <            } else {
112 <                    sprintf( painCave.errMsg,
113 <                           "Can not cast GenericData to Vector3dGenericData\n");
114 <                    painCave.severity = OOPSE_ERROR;
115 <                    painCave.isFatal = 1;
116 <                    simError();          
117 <            }
118 <        } else {
119 <            sprintf( painCave.errMsg, "Can not find Quadrupole Parameters\n");
123 >      data = getPropertyByName("QuadrupoleMoments");
124 >      if (data != NULL) {
125 >        Vector3dGenericData* vector3dData= dynamic_cast<Vector3dGenericData*>(data);
126 >    
127 >        // Quadrupoles in OOPSE are set as the diagonal elements
128 >        // of the diagonalized traceless quadrupole moment tensor.
129 >        // The column vectors of the unitary matrix that diagonalizes
130 >        // the quadrupole moment tensor become the eFrame (or the
131 >        // electrostatic version of the body-fixed frame.
132 >        
133 >        if (vector3dData != NULL) {
134 >          Vector3d diagElem= vector3dData->getData();
135 >          
136 >          setQuadrupoleMoments(&atp.ident, diagElem.getArrayPointer(),
137 >                               &isError);
138 >          if (isError != 0) {
139 >            sprintf( painCave.errMsg,
140 >                     "Fortran rejected setQuadrupoleMoments\n");
141              painCave.severity = OOPSE_ERROR;
142              painCave.isFatal = 1;
143              simError();          
144 +          }
145 +          
146 +        } else {
147 +          sprintf( painCave.errMsg,
148 +                   "Can not cast GenericData to Vector3dGenericData\n");
149 +          painCave.severity = OOPSE_ERROR;
150 +          painCave.isFatal = 1;
151 +          simError();          
152          }
153 <
153 >      } else {
154 >        sprintf( painCave.errMsg, "Can not find QuadrupoleMoments\n");
155 >        painCave.severity = OOPSE_ERROR;
156 >        painCave.isFatal = 1;
157 >        simError();          
158 >      }
159 >      
160      }
161      
162      //setup sticky atom type in fortran side
163      if (isSticky()) {
164 <        data = getPropertyByName("Sticky");
165 <        if (data != NULL) {
166 <            StickyParamGenericData* stickyData = dynamic_cast<StickyParamGenericData*>(data);
164 >      data = getPropertyByName("Sticky");
165 >      if (data != NULL) {
166 >        StickyParamGenericData* stickyData = dynamic_cast<StickyParamGenericData*>(data);
167  
168 <            if (stickyData != NULL) {
169 <                StickyParam stickyParam = stickyData->getData();
168 >        if (stickyData != NULL) {
169 >          StickyParam stickyParam = stickyData->getData();
170  
171 <                /**@todo change fortran interface */
172 <                //makeStickyType(&atp.ident, &stickyParam.w0, &stickyParam.v0, &stickyParam.v0p, &stickyParam.rl,
173 <                //    &stickyParam.ru, &stickyParam.rlp, &stickyParam.rup);
174 <                newStickyType(&atp.ident,&stickyParam.w0, &stickyParam.v0, &stickyParam.v0p, &stickyParam.rl,
175 <                    &stickyParam.ru, &stickyParam.rlp, &stickyParam.rup, &isError);
141 <                if (isError != 0) {
142 <                    sprintf( painCave.errMsg,
143 <                           "Fortran rejected newLJtype\n");
144 <                    painCave.severity = OOPSE_ERROR;
145 <                    painCave.isFatal = 1;
146 <                    simError();          
147 <                }
148 <                
149 <            } else {
150 <                    sprintf( painCave.errMsg,
151 <                           "Can not cast GenericData to StickyParam\n");
152 <                    painCave.severity = OOPSE_ERROR;
153 <                    painCave.isFatal = 1;
154 <                    simError();          
155 <            }            
156 <        } else {
157 <            sprintf( painCave.errMsg, "Can not find Parameters for Sticky\n");
171 >          newStickyType(&atp.ident,&stickyParam.w0, &stickyParam.v0, &stickyParam.v0p, &stickyParam.rl,
172 >                        &stickyParam.ru, &stickyParam.rlp, &stickyParam.rup, &isError);
173 >          if (isError != 0) {
174 >            sprintf( painCave.errMsg,
175 >                     "Fortran rejected newLJtype\n");
176              painCave.severity = OOPSE_ERROR;
177              painCave.isFatal = 1;
178              simError();          
179 <        }
179 >          }
180 >                
181 >        } else {
182 >          sprintf( painCave.errMsg,
183 >                   "Can not cast GenericData to StickyParam\n");
184 >          painCave.severity = OOPSE_ERROR;
185 >          painCave.isFatal = 1;
186 >          simError();          
187 >        }            
188 >      } else {
189 >        sprintf( painCave.errMsg, "Can not find Parameters for Sticky\n");
190 >        painCave.severity = OOPSE_ERROR;
191 >        painCave.isFatal = 1;
192 >        simError();          
193 >      }
194      }
195  
196      //setup GayBerne type in fortran side
197  
198 < }
198 >  }
199  
200  
201   } //end namespace oopse

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines