Changeset 4e8206 for src/interface
- Timestamp:
- May 2, 2012, 1:36:56 PM (14 years ago)
- Children:
- f003a9
- Parents:
- 49f8653
- File:
-
- 1 edited
-
src/interface/interface_particles.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/interface/interface_particles.cpp
r49f8653 r4e8206 149 149 comm.CommLCListToGhosts(lc); 150 150 151 for (i ter=lc.Iterators().Local().Begin(); iter!=lc.Iterators().Local().End(); ++iter) {152 153 ip.ComputeCoefficients(particle_grid, *iter - lc.Local().Begin() + particle_grid.Local().Begin());154 155 std::list<Particle::Particle*>& lc_1 = lc(*iter); 156 157 for (p1=lc_1.begin(); p1!=lc_1.end(); ++p1) { 158 159 ip.Evaluate((*p1)->Pos(), (*p1)->Pot(), (*p1)->Field()); 160 (*p1)->Pot() -= (*p1)->Charge() * spl.GetAntiDerivativeAtZero();161 162 #ifdef DEBUG_OUTPUT 163 e_long += 0.5 * (*p1)->Charge() * ip.Evaluate((*p1)->Pos()); 164 e_self += 0.5 * (*p1)->Charge() * (*p1)->Charge() * spl.GetAntiDerivativeAtZero();165 #endif 166 167 for (i.X()=-1*near_field_cells; i.X()<=near_field_cells; ++i.X()) 168 for (i.Y()=-1*near_field_cells; i.Y()<=near_field_cells; ++i.Y())169 for (i.Z()=-1*near_field_cells; i.Z()<=near_field_cells; ++i.Z()) { 170 171 std::list<Particle::Particle*>& lc_2 = lc(*iter+i); 172 173 for (p2=lc_2.begin(); p2!=lc_2.end(); ++p2) 174 if (*p1 != *p2) {175 176 const Vector dir = (*p1)->Pos() - (*p2)->Pos();177 const vmg_float length = dir.Length();178 179 if (length < r_cut) {180 181 (*p1)->Pot() += (*p2)->Charge() / length * (1.0 + spl.EvaluatePotential(length));182 (*p1)->Field() += (*p2)->Charge() * dir * spl.EvaluateField(length);183 184 #ifdef DEBUG_OUTPUT 185 e_short_peak += 0.5 * (*p1)->Charge() * (*p2)->Charge() / length;186 e_short_spline += 0.5 * (*p1)->Charge() * (*p2)->Charge() / length * spl.EvaluatePotential(length);187 #endif 188 }189 }190 }191 }192 }151 for (int i=lc.Local().Begin().X(); i<lc.Local().End().X(); ++i) 152 for (int j=lc.Local().Begin().Y(); j<lc.Local().End().Y(); ++j) 153 for (int k=lc.Local().Begin().Z(); k<lc.Local().End().Z(); ++k) { 154 155 if (lc(i,j,k).size() > 0) 156 ip.ComputeCoefficients(particle_grid, Index(i,j,k) - lc.Local().Begin() + particle_grid.Local().Begin()); 157 158 for (p1=lc(i,j,k).begin(); p1!=lc(i,j,k).end(); ++p1) { 159 160 ip.Evaluate((*p1)->Pos(), (*p1)->Pot(), (*p1)->Field()); 161 (*p1)->Pot() -= (*p1)->Charge() * spl.GetAntiDerivativeAtZero(); 162 163 #ifdef DEBUG_OUTPUT 164 e_long += 0.5 * (*p1)->Charge() * ip.Evaluate((*p1)->Pos()); 165 e_self += 0.5 * (*p1)->Charge() * (*p1)->Charge() * spl.GetAntiDerivativeAtZero(); 166 #endif 167 168 for (int dx=-1*near_field_cells; dx<=near_field_cells; ++dx) 169 for (int dy=-1*near_field_cells; dy<=near_field_cells; ++dy) 170 for (int dz=-1*near_field_cells; dz<=near_field_cells; ++dz) { 171 172 for (p2=lc(i+dx,j+dy,k+dz).begin(); p2!=lc(i+dx,j+dy,k+dz).end(); ++p2) 173 174 if (*p1 != *p2) { 175 176 const Vector dir = (*p1)->Pos() - (*p2)->Pos(); 177 const vmg_float length = dir.Length(); 178 179 if (length < r_cut) { 180 181 (*p1)->Pot() += (*p2)->Charge() / length * (1.0 + spl.EvaluatePotential(length)); 182 (*p1)->Field() += (*p2)->Charge() * dir * spl.EvaluateField(length); 183 184 #ifdef DEBUG_OUTPUT 185 e_short_peak += 0.5 * (*p1)->Charge() * (*p2)->Charge() / length; 186 e_short_spline += 0.5 * (*p1)->Charge() * (*p2)->Charge() / length * spl.EvaluatePotential(length); 187 #endif 188 } 189 } 190 } 191 } 192 } 193 193 194 194 comm.CommParticlesBack(particles);
Note:
See TracChangeset
for help on using the changeset viewer.
