ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/parallel/ForceMatrixDecomposition.cpp
(Generate patch)

Comparing branches/development/src/parallel/ForceMatrixDecomposition.cpp (file contents):
Revision 1554 by gezelter, Sat Apr 30 02:54:02 2011 UTC vs.
Revision 1562 by gezelter, Thu May 12 17:00:14 2011 UTC

# Line 343 | Line 343 | namespace OpenMD {
343      if (storageLayout_ & DataStorage::dslFunctionalDerivative) {
344        idat.dfrho1 = &(atomRowData.functionalDerivative[atom1]);
345        idat.dfrho2 = &(atomColData.functionalDerivative[atom2]);
346 +    }
347 + #else
348 +    if (storageLayout_ & DataStorage::dslAmat) {
349 +      idat.A1 = &(snap_->atomData.aMat[atom1]);
350 +      idat.A2 = &(snap_->atomData.aMat[atom2]);
351 +    }
352 +
353 +    if (storageLayout_ & DataStorage::dslElectroFrame) {
354 +      idat.eFrame1 = &(snap_->atomData.electroFrame[atom1]);
355 +      idat.eFrame2 = &(snap_->atomData.electroFrame[atom2]);
356 +    }
357 +
358 +    if (storageLayout_ & DataStorage::dslTorque) {
359 +      idat.t1 = &(snap_->atomData.torque[atom1]);
360 +      idat.t2 = &(snap_->atomData.torque[atom2]);
361 +    }
362 +
363 +    if (storageLayout_ & DataStorage::dslDensity) {
364 +      idat.rho1 = &(snap_->atomData.density[atom1]);
365 +      idat.rho2 = &(snap_->atomData.density[atom2]);
366      }
367 +
368 +    if (storageLayout_ & DataStorage::dslFunctionalDerivative) {
369 +      idat.dfrho1 = &(snap_->atomData.functionalDerivative[atom1]);
370 +      idat.dfrho2 = &(snap_->atomData.functionalDerivative[atom2]);
371 +    }
372   #endif
373      
374    }
375    InteractionData ForceMatrixDecomposition::fillSkipData(int atom1, int atom2){
376 +    InteractionData idat;
377 +    skippedCharge1
378 +      skippedCharge2
379 +      rij
380 +      d
381 +    electroMult
382 +    sw
383 +    f
384 + #ifdef IS_MPI
385 +
386 +    if (storageLayout_ & DataStorage::dslElectroFrame) {
387 +      idat.eFrame1 = &(atomRowData.electroFrame[atom1]);
388 +      idat.eFrame2 = &(atomColData.electroFrame[atom2]);
389 +    }
390 +    if (storageLayout_ & DataStorage::dslTorque) {
391 +      idat.t1 = &(atomRowData.torque[atom1]);
392 +      idat.t2 = &(atomColData.torque[atom2]);
393 +    }
394 +
395 +    
396    }
397    SelfData ForceMatrixDecomposition::fillSelfData(int atom1) {
398 +  }
399 +
400 +
401 +  /*
402 +   * buildNeighborList
403 +   *
404 +   * first element of pair is row-indexed CutoffGroup
405 +   * second element of pair is column-indexed CutoffGroup
406 +   */
407 +  vector<pair<int, int> >  buildNeighborList() {
408 +    Vector3d dr, invWid, rs, shift;
409 +    Vector3i cc, m1v, m2s;
410 +    RealType rrNebr;
411 +    int c, j1, j2, m1, m1x, m1y, m1z, m2, n, offset;
412 +
413 +
414 +    vector<pair<int, int> > neighborList;  
415 +    Vector3i nCells;
416 +    Vector3d invWid, r;
417 +
418 +    rList_ = (rCut_ + skinThickness_);
419 +    rl2 = rList_ * rList_;
420 +
421 +    snap_ = sman_->getCurrentSnapshot();
422 +    Mat3x3d Hmat = snap_->getHmat();
423 +    Vector3d Hx = Hmat.getColumn(0);
424 +    Vector3d Hy = Hmat.getColumn(1);
425 +    Vector3d Hz = Hmat.getColumn(2);
426 +
427 +    nCells.x() = (int) ( Hx.length() )/ rList_;
428 +    nCells.y() = (int) ( Hy.length() )/ rList_;
429 +    nCells.z() = (int) ( Hz.length() )/ rList_;
430 +
431 +    for (i = 0; i < nGroupsInRow; i++) {
432 +      rs = cgRowData.position[i];
433 +      snap_->scaleVector(rs);    
434 +    }
435 +    
436 +
437 +    VDiv (invWid, cells, region);
438 +    for (n = nMol; n < nMol + cells.componentProduct(); n ++) cellList[n] = -1;
439 +    for (n = 0; n < nMol; n ++) {
440 +      VSAdd (rs, mol[n].r, 0.5, region);
441 +      VMul (cc, rs, invWid);
442 +      c = VLinear (cc, cells) + nMol;
443 +      cellList[n] = cellList[c];
444 +      cellList[c] = n;
445 +    }
446 +    nebrTabLen = 0;
447 +    for (m1z = 0; m1z < cells.z(); m1z++) {
448 +      for (m1y = 0; m1y < cells.y(); m1y++) {
449 +        for (m1x = 0; m1x < cells.x(); m1x++) {
450 +          Vector3i m1v(m1x, m1y, m1z);
451 +          m1 = VLinear(m1v, cells) + nMol;
452 +          for (offset = 0; offset < nOffset_; offset++) {
453 +            m2v = m1v + cellOffsets_[offset];
454 +            shift = V3Zero();
455 +
456 +            if (m2v.x() >= cells.x) {
457 +              m2v.x() = 0;          
458 +              shift.x() = region.x();  
459 +            } else if (m2v.x() < 0) {
460 +              m2v.x() = cells.x() - 1;
461 +              shift.x() = - region.x();
462 +            }
463 +
464 +            if (m2v.y() >= cells.y()) {
465 +              m2v.y() = 0;          
466 +              shift.y() = region.y();  
467 +            } else if (m2v.y() < 0) {
468 +              m2v.y() = cells.y() - 1;
469 +              shift.y() = - region.y();
470 +            }
471 +
472 +            m2 = VLinear (m2v, cells) + nMol;
473 +            for (j1 = cellList[m1]; j1 >= 0; j1 = cellList[j1]) {
474 +              for (j2 = cellList[m2]; j2 >= 0; j2 = cellList[j2]) {
475 +                if (m1 != m2 || j2 < j1) {
476 +                  dr = mol[j1].r - mol[j2].r;
477 +                  VSub (dr, mol[j1].r, mol[j2].r);
478 +                  VVSub (dr, shift);
479 +                  if (VLenSq (dr) < rrNebr) {
480 +                    neighborList.push_back(make_pair(j1, j2));
481 +                  }
482 +                }
483 +              }
484 +            }
485 +          }
486 +        }
487 +      }
488 +    }
489    }
490  
491    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines