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

Comparing trunk/OOPSE-3.0/src/types/ShapeAtomType.cpp (file contents):
Revision 2204 by gezelter, Fri Apr 15 22:04:00 2005 UTC vs.
Revision 2211 by chrisfen, Thu Apr 21 14:12:19 2005 UTC

# Line 10 | Line 10
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
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))
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.
# Line 38 | Line 38
38   * University of Notre Dame has been advised of the possibility of
39   * such damages.
40   */
41 <
41 >
42   #include "types/ShapeAtomType.hpp"
43 + #include "UseTheForce/DarkSide/shapes_interface.h"
44  
45 < using namespace oopse;
45 <
46 < ShapeAtomType::~ShapeAtomType() {
47 <  std::vector<RealSphericalHarmonic*>::iterator iter;
48 <  for (iter = contactFuncs.begin(); iter != contactFuncs.end(); ++iter)
49 <    delete (*iter);
50 <  for (iter = rangeFuncs.begin(); iter != rangeFuncs.end(); ++iter)
51 <    delete (*iter);
52 <  for (iter = strengthFuncs.begin(); iter != strengthFuncs.end(); ++iter)
53 <    delete (*iter);
54 <  contactFuncs.clear();
55 <  rangeFuncs.clear();
56 <  strengthFuncs.clear();
57 < }
58 <
59 < double ShapeAtomType::getContactValueAt(double costheta, double phi) {
45 > namespace oopse {
46    
47 <  std::vector<RealSphericalHarmonic*>::iterator contactIter;
48 <  double contactVal;
47 >  ShapeAtomType::~ShapeAtomType() {
48 >    std::vector<RealSphericalHarmonic*>::iterator iter;
49 >    for (iter = contactFuncs.begin(); iter != contactFuncs.end(); ++iter)
50 >      delete (*iter);
51 >    for (iter = rangeFuncs.begin(); iter != rangeFuncs.end(); ++iter)
52 >      delete (*iter);
53 >    for (iter = strengthFuncs.begin(); iter != strengthFuncs.end(); ++iter)
54 >      delete (*iter);
55 >    contactFuncs.clear();
56 >    rangeFuncs.clear();
57 >    strengthFuncs.clear();
58 >  }
59    
60 <  contactVal = 0.0;
60 >  double ShapeAtomType::getContactValueAt(double costheta, double phi) {
61 >    
62 >    std::vector<RealSphericalHarmonic*>::iterator contactIter;
63 >    double contactVal;
64 >    
65 >    contactVal = 0.0;
66 >    
67 >    for(contactIter = contactFuncs.begin();  contactIter != contactFuncs.end();
68 >        ++contactIter)
69 >      contactVal += (*contactIter)->getValueAt(costheta, phi);
70 >    
71 >    return contactVal;
72 >  }
73    
74 <  for(contactIter = contactFuncs.begin();  contactIter != contactFuncs.end();
75 <      ++contactIter)
76 <    contactVal += (*contactIter)->getValueAt(costheta, phi);
77 <
78 <  return contactVal;
79 < }
80 <
81 < double ShapeAtomType::getRangeValueAt(double costheta, double phi) {
74 >  double ShapeAtomType::getRangeValueAt(double costheta, double phi) {
75 >    
76 >    std::vector<RealSphericalHarmonic*>::iterator rangeIter;
77 >    double rangeVal;
78 >    
79 >    rangeVal = 0.0;
80 >    
81 >    for(rangeIter = rangeFuncs.begin();  rangeIter != rangeFuncs.end();
82 >        ++rangeIter)    
83 >      rangeVal += (*rangeIter)->getValueAt(costheta, phi);
84 >    
85 >    return rangeVal;
86 >  }
87    
88 <  std::vector<RealSphericalHarmonic*>::iterator rangeIter;
89 <  double rangeVal;
88 >  double ShapeAtomType::getStrengthValueAt(double costheta, double phi) {
89 >    
90 >    std::vector<RealSphericalHarmonic*>::iterator strengthIter;
91 >    double strengthVal;
92 >    
93 >    strengthVal = 0.0;
94 >    
95 >    for(strengthIter = strengthFuncs.begin();  
96 >        strengthIter != strengthFuncs.end();
97 >        ++strengthIter)    
98 >      strengthVal += (*strengthIter)->getValueAt(costheta, phi);
99 >    
100 >    return strengthVal;
101 >  }
102    
103 <  rangeVal = 0.0;
104 <  
105 <  for(rangeIter = rangeFuncs.begin();  rangeIter != rangeFuncs.end();
106 <      ++rangeIter)    
107 <    rangeVal += (*rangeIter)->getValueAt(costheta, phi);
108 <  
109 <  return rangeVal;
110 < }
103 >  void ShapeAtomType::complete() {
104 >    
105 >    // first complete all the non-shape atomTypes
106 >    DirectionalAtomType::complete();
107 >    
108 >    int isError = 0;
109 >    
110 >    //setup dipole atom  type in fortran side
111 >    if (isShape()) {
112 >       // vectors for shape transfer to fortran
113 >      std::vector<RealSphericalHarmonic*> tempSHVector;
114 >      std::vector<int> contactL;
115 >      std::vector<int> contactM;
116 >      std::vector<int> contactFunc;
117 >      std::vector<double> contactCoeff;
118 >      std::vector<int> rangeL;
119 >      std::vector<int> rangeM;
120 >      std::vector<int> rangeFunc;
121 >      std::vector<double> rangeCoeff;
122 >      std::vector<int> strengthL;
123 >      std::vector<int> strengthM;
124 >      std::vector<int> strengthFunc;
125 >      std::vector<double> strengthCoeff;
126 >      
127 >      tempSHVector.clear();
128 >      contactL.clear();
129 >      contactM.clear();
130 >      contactFunc.clear();
131 >      contactCoeff.clear();
132 >      
133 >      tempSHVector = getContactFuncs();
134 >      
135 >      int nContact = tempSHVector.size();
136 >      for (int i=0; i<nContact; i++){
137 >        contactL.push_back(tempSHVector[i]->getL());
138 >        contactM.push_back(tempSHVector[i]->getM());
139 >        contactFunc.push_back(tempSHVector[i]->getFunctionType());
140 >        contactCoeff.push_back(tempSHVector[i]->getCoefficient());
141 >      }
142 >      
143 >      tempSHVector.clear();
144 >      rangeL.clear();
145 >      rangeM.clear();
146 >      rangeFunc.clear();
147 >      rangeCoeff.clear();
148 >      
149 >      tempSHVector = getRangeFuncs();
150 >      
151 >      int nRange = tempSHVector.size();
152 >      for (int i=0; i<nRange; i++){
153 >        rangeL.push_back(tempSHVector[i]->getL());
154 >        rangeM.push_back(tempSHVector[i]->getM());
155 >        rangeFunc.push_back(tempSHVector[i]->getFunctionType());
156 >        rangeCoeff.push_back(tempSHVector[i]->getCoefficient());
157 >      }
158 >      
159 >      tempSHVector.clear();
160 >      strengthL.clear();
161 >      strengthM.clear();
162 >      strengthFunc.clear();
163 >      strengthCoeff.clear();
164 >      
165 >      tempSHVector = getStrengthFuncs();
166 >      
167 >      int nStrength = tempSHVector.size();
168 >      for (int i=0; i<nStrength; i++){
169 >        strengthL.push_back(tempSHVector[i]->getL());
170 >        strengthM.push_back(tempSHVector[i]->getM());
171 >        strengthFunc.push_back(tempSHVector[i]->getFunctionType());
172 >        strengthCoeff.push_back(tempSHVector[i]->getCoefficient());
173 >      }
174 >      
175 >      int myATID = getIdent();
176 >      
177 >      
178 >      std::cout << "calling makeShape with myATID = " << myATID << "\n";
179  
180 < double ShapeAtomType::getStrengthValueAt(double costheta, double phi) {
181 <  
182 <  std::vector<RealSphericalHarmonic*>::iterator strengthIter;
183 <  double strengthVal;
184 <  
185 <  strengthVal = 0.0;
186 <  
187 <  for(strengthIter = strengthFuncs.begin();  
188 <      strengthIter != strengthFuncs.end();
189 <      ++strengthIter)    
190 <    strengthVal += (*strengthIter)->getValueAt(costheta, phi);
191 <  
192 <  return strengthVal;
180 >      makeShape( &nContact, &contactL[0], &contactM[0], &contactFunc[0],
181 >                 &contactCoeff[0],
182 >                 &nRange, &rangeL[0], &rangeM[0], &rangeFunc[0], &rangeCoeff[0],
183 >                 &nStrength, &strengthL[0], &strengthM[0], &strengthFunc[0],
184 >                 &strengthCoeff[0],
185 >                 &myATID,
186 >                 &isError);
187 >      
188 >      if( isError ){
189 >        sprintf( painCave.errMsg,
190 >                 "Error initializing the \"%s\" shape in fortran\n",
191 >                 (getName()).c_str() );
192 >        painCave.severity = OOPSE_ERROR;
193 >        painCave.isFatal = 1;
194 >        simError();
195 >      }
196 >    }
197 >  }  
198   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines