Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

ComputeNonbondedSelf Class Reference

#include <ComputeNonbondedSelf.h>

Inheritance diagram for ComputeNonbondedSelf:

ComputePatch ComputeNonbondedUtil Compute List of all members.

Public Member Functions

 ComputeNonbondedSelf (ComputeID c, PatchID pid, ComputeNonbondedWorkArrays *_workArrays, int minPartition=0, int maxPartition=1, int numPartitions=1)
virtual ~ComputeNonbondedSelf ()

Protected Member Functions

virtual void initialize ()
virtual void doForce (CompAtom *p, CompAtomExt *pExt, Results *r)

Protected Attributes

Box< Patch, CompAtom > * avgPositionBox
SubmitReductionreduction
SubmitReductionpressureProfileReduction
BigRealpressureProfileData
ComputeNonbondedWorkArrays
*const 
workArrays
Pairlists pairlists
int pairlistsValid
BigReal pairlistTolerance
int minPart
int maxPart
int numParts

Detailed Description

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 13 of file ComputeNonbondedSelf.h.


Constructor & Destructor Documentation

ComputeNonbondedSelf::ComputeNonbondedSelf ComputeID  c,
PatchID  pid,
ComputeNonbondedWorkArrays _workArrays,
int  minPartition = 0,
int  maxPartition = 1,
int  numPartitions = 1
 

Definition at line 16 of file ComputeNonbondedSelf.C.

References BigReal, ReductionMgr::Object(), pairlistsValid, pairlistTolerance, pressureProfileData, pressureProfileReduction, reduction, REDUCTIONS_BASIC, REDUCTIONS_PPROF_NONBONDED, and ReductionMgr::willSubmit().

00019   : ComputePatch(c,pid), workArrays(_workArrays),
00020     minPart(minPartition), maxPart(maxPartition), numParts(numPartitions)
00021 {
00022   reduction = ReductionMgr::Object()->willSubmit(REDUCTIONS_BASIC);
00023   if (pressureProfileOn) {
00024     int n = pressureProfileAtomTypes;
00025     pressureProfileData = new BigReal[3*n*n*pressureProfileSlabs];
00026     pressureProfileReduction = ReductionMgr::Object()->willSubmit(
00027         REDUCTIONS_PPROF_NONBONDED, 3*pressureProfileSlabs*((n*(n+1))/2));
00028   } else {
00029     pressureProfileReduction = NULL;
00030     pressureProfileData = NULL;
00031   }
00032   pairlistsValid = 0;
00033   pairlistTolerance = 0.;
00034 }

ComputeNonbondedSelf::~ComputeNonbondedSelf  )  [virtual]
 

Definition at line 44 of file ComputeNonbondedSelf.C.

References avgPositionBox, and Patch::unregisterAvgPositionPickup().

00045 {
00046   delete reduction;
00047   delete pressureProfileReduction;
00048   delete [] pressureProfileData;
00049   if (avgPositionBox != NULL) {
00050     patch->unregisterAvgPositionPickup(cid,&avgPositionBox);
00051   }
00052 }


Member Function Documentation

void ComputeNonbondedSelf::doForce CompAtom p,
CompAtomExt pExt,
Results r
[protected, virtual]
 

Implements ComputePatch.

Definition at line 55 of file ComputeNonbondedSelf.C.

References avgPositionBox, BigReal, Lattice::c(), ComputeNonbondedUtil::calcFullSelf, ComputeNonbondedUtil::calcFullSelfEnergy, ComputeNonbondedUtil::calcMergeSelf, ComputeNonbondedUtil::calcMergeSelfEnergy, ComputeNonbondedUtil::calcSelf, ComputeNonbondedUtil::calcSelfEnergy, ComputeNonbondedUtil::calcSlowSelf, ComputeNonbondedUtil::calcSlowSelfEnergy, Box< Owner, Data >::close(), DebugM, Flags::doEnergy, Flags::doFullElectrostatics, Flags::doMolly, Flags::doNonbonded, LdbCoordinator::endWork(), Results::f, nonbonded::ff, Patch::flags, nonbonded::fullf, nonbonded::groupplcutoff, Patch::lattice, Flags::maxAtomMovement, Flags::maxForceMerged, Flags::maxGroupRadius, nonbonded::maxPart, nonbonded::minPart, NAMD_die(), nonbonded::numAtoms, nonbonded::numParts, LdbCoordinator::Object(), nonbonded::offset, Box< Owner, Data >::open(), Lattice::origin(), nonbonded::p, nonbonded::pairlists, pairlistsValid, Flags::pairlistTolerance, pairlistTolerance, nonbonded::pExt, nonbonded::plcutoff, plint, pressureProfileData, pressureProfileReduction, nonbonded::pressureProfileReduction, reduction, nonbonded::reduction, Flags::savePairlists, nonbonded::savePairlists, LdbCoordinator::startWork(), SubmitReduction::submit(), ComputeNonbondedUtil::submitPressureProfileData(), ComputeNonbondedUtil::submitReductionData(), TRACE_COMPOBJ_IDOFFSET, Flags::usePairlists, nonbonded::usePairlists, nonbonded::workArrays, and Vector::z.

00056 {
00057   // Inform load balancer. 
00058   // I assume no threads will suspend until endWork is called
00059 #ifndef NAMD_CUDA
00060   LdbCoordinator::Object()->startWork(cid,0); // Timestep not used
00061 #endif
00062 
00063 #ifdef TRACE_COMPUTE_OBJECTS
00064   double traceObjStartTime = CmiWallTimer();
00065 #endif
00066 
00067   DebugM(2,"doForce() called.\n");
00068   DebugM(1,numAtoms << " patch 1 atoms\n");
00069   DebugM(3, "NUMATOMSxNUMATOMS = " << numAtoms*numAtoms << "\n");
00070 
00071   BigReal reductionData[reductionDataSize];
00072   for ( int i = 0; i < reductionDataSize; ++i ) reductionData[i] = 0;
00073   if (pressureProfileOn) {
00074     int n = pressureProfileAtomTypes;
00075     memset(pressureProfileData, 0, 3*n*n*pressureProfileSlabs*sizeof(BigReal));
00076     // adjust lattice dimensions to allow constant pressure
00077     const Lattice &lattice = patch->lattice;
00078     pressureProfileThickness = lattice.c().z / pressureProfileSlabs;
00079     pressureProfileMin = lattice.origin().z - 0.5*lattice.c().z;
00080   }
00081   if ( patch->flags.doNonbonded )
00082   {
00083     plint maxa = (plint)(-1);
00084     if ( numAtoms > maxa ) {
00085       char estr[1024];
00086       sprintf(estr,"patch has %d atoms, maximum allowed is %d",numAtoms,maxa);
00087       NAMD_die(estr); 
00088     }
00089 
00090     int doEnergy = patch->flags.doEnergy;
00091     nonbonded params;
00092     params.offset = 0.;
00093     params.p[0] = p;
00094     params.p[1] = p;
00095     params.pExt[0] = pExt;
00096     params.pExt[1] = pExt;
00097     params.ff[0] = r->f[Results::nbond];
00098     params.ff[1] = r->f[Results::nbond];
00099     params.numAtoms[0] = numAtoms;
00100     params.numAtoms[1] = numAtoms;
00101 
00102     // DMK - Atom Separation (water vs. non-water)
00103     #if NAMD_SeparateWaters != 0
00104       params.numWaterAtoms[0] = numWaterAtoms;
00105       params.numWaterAtoms[1] = numWaterAtoms;
00106     #endif
00107 
00108     params.reduction = reductionData;
00109     params.pressureProfileReduction = pressureProfileData;
00110 
00111     params.minPart = minPart;
00112     params.maxPart = maxPart;
00113     params.numParts = numParts;
00114 
00115     params.workArrays = workArrays;
00116 
00117     params.pairlists = &pairlists;
00118     params.savePairlists = 0;
00119     params.usePairlists = 0;
00120     if ( patch->flags.savePairlists ) {
00121       params.savePairlists = 1;
00122       params.usePairlists = 1;
00123     } else if ( patch->flags.usePairlists ) {
00124       if ( ! pairlistsValid ||
00125            ( 2. * patch->flags.maxAtomMovement > pairlistTolerance ) ) {
00126         reductionData[pairlistWarningIndex] += 1;
00127       } else { 
00128         params.usePairlists = 1;
00129       }
00130     }
00131     if ( ! params.usePairlists ) {
00132       pairlistsValid = 0;
00133     }
00134     params.plcutoff = cutoff;
00135     params.groupplcutoff = cutoff + 2. * patch->flags.maxGroupRadius;
00136     if ( params.savePairlists ) {
00137       pairlistsValid = 1;
00138       pairlistTolerance = 2. * patch->flags.pairlistTolerance;
00139       params.plcutoff += pairlistTolerance;
00140       params.groupplcutoff += pairlistTolerance;
00141     }
00142 
00143     if ( patch->flags.doFullElectrostatics )
00144     {
00145       params.fullf[0] = r->f[Results::slow];
00146       params.fullf[1] = r->f[Results::slow];
00147       if ( patch->flags.doMolly ) {
00148         if ( doEnergy ) calcSelfEnergy(&params);
00149         else calcSelf(&params);
00150         CompAtom *p_avg = avgPositionBox->open();
00151         params.p[0] = p_avg;
00152         params.p[1] = p_avg;
00153         if ( doEnergy ) calcSlowSelfEnergy(&params);
00154         else calcSlowSelf(&params);
00155         avgPositionBox->close(&p_avg);
00156       } else if ( patch->flags.maxForceMerged == Results::slow ) {
00157         if ( doEnergy ) calcMergeSelfEnergy(&params);
00158         else calcMergeSelf(&params);
00159       } else {
00160         if ( doEnergy ) calcFullSelfEnergy(&params);
00161         else calcFullSelf(&params);
00162       }
00163     }
00164     else
00165       if ( doEnergy ) calcSelfEnergy(&params);
00166       else calcSelf(&params);
00167   }
00168 
00169   submitReductionData(reductionData,reduction);
00170   if (pressureProfileOn)
00171     submitPressureProfileData(pressureProfileData, pressureProfileReduction);
00172 
00173 #ifdef TRACE_COMPUTE_OBJECTS
00174     traceUserBracketEvent(TRACE_COMPOBJ_IDOFFSET+cid, traceObjStartTime, CmiWallTimer());
00175 #endif
00176 
00177   // Inform load balancer
00178 #ifndef NAMD_CUDA
00179   LdbCoordinator::Object()->endWork(cid,0); // Timestep not used
00180 #endif
00181 
00182   reduction->submit();
00183   if (pressureProfileOn)
00184     pressureProfileReduction->submit();
00185 }

void ComputeNonbondedSelf::initialize  )  [protected, virtual]
 

Reimplemented from ComputePatch.

Definition at line 36 of file ComputeNonbondedSelf.C.

References avgPositionBox, ComputePatch::initialize(), register_cuda_compute_self(), and Patch::registerAvgPositionPickup().

00036                                       {
00037   ComputePatch::initialize();
00038   avgPositionBox = patch->registerAvgPositionPickup(cid);
00039 #ifdef NAMD_CUDA
00040   register_cuda_compute_self(cid, patchID);
00041 #endif
00042 }


Member Data Documentation

Box<Patch,CompAtom>* ComputeNonbondedSelf::avgPositionBox [protected]
 

Definition at line 24 of file ComputeNonbondedSelf.h.

Referenced by doForce(), initialize(), and ~ComputeNonbondedSelf().

int ComputeNonbondedSelf::maxPart [protected]
 

Definition at line 36 of file ComputeNonbondedSelf.h.

int ComputeNonbondedSelf::minPart [protected]
 

Definition at line 36 of file ComputeNonbondedSelf.h.

int ComputeNonbondedSelf::numParts [protected]
 

Definition at line 36 of file ComputeNonbondedSelf.h.

Pairlists ComputeNonbondedSelf::pairlists [protected]
 

Definition at line 32 of file ComputeNonbondedSelf.h.

int ComputeNonbondedSelf::pairlistsValid [protected]
 

Definition at line 33 of file ComputeNonbondedSelf.h.

Referenced by ComputeNonbondedSelf(), and doForce().

BigReal ComputeNonbondedSelf::pairlistTolerance [protected]
 

Definition at line 34 of file ComputeNonbondedSelf.h.

Referenced by ComputeNonbondedSelf(), and doForce().

BigReal* ComputeNonbondedSelf::pressureProfileData [protected]
 

Definition at line 28 of file ComputeNonbondedSelf.h.

Referenced by ComputeNonbondedSelf(), and doForce().

SubmitReduction* ComputeNonbondedSelf::pressureProfileReduction [protected]
 

Definition at line 27 of file ComputeNonbondedSelf.h.

Referenced by ComputeNonbondedSelf(), and doForce().

SubmitReduction* ComputeNonbondedSelf::reduction [protected]
 

Definition at line 26 of file ComputeNonbondedSelf.h.

Referenced by ComputeNonbondedSelf(), and doForce().

ComputeNonbondedWorkArrays* const ComputeNonbondedSelf::workArrays [protected]
 

Definition at line 30 of file ComputeNonbondedSelf.h.


The documentation for this class was generated from the following files:
Generated on Tue Nov 24 04:07:49 2009 for NAMD by  doxygen 1.3.9.1