GromacsPairElem Class Reference

#include <ComputeGromacsPair.h>

List of all members.

Public Types

 size = 2
 gromacsPairEnergyIndex
 virialIndex
 reductionDataSize
 reductionChecksumLabel = REDUCTION_GRO_LJ_CHECKSUM
enum  { size = 2 }
enum  { gromacsPairEnergyIndex, virialIndex, reductionDataSize }
enum  { reductionChecksumLabel = REDUCTION_GRO_LJ_CHECKSUM }

Public Member Functions

int hash () const
 GromacsPairElem ()
 GromacsPairElem (AtomID atom0, const TupleSignature *sig, const GromacsPairValue *v)
 GromacsPairElem (const GromacsPair *a, const GromacsPairValue *v)
 GromacsPairElem (AtomID atom0, AtomID atom1)
 ~GromacsPairElem ()
int operator== (const GromacsPairElem &a) const
int operator< (const GromacsPairElem &a) const

Static Public Member Functions

static void computeForce (GromacsPairElem *, int, BigReal *, BigReal *)
static void getMoleculePointers (Molecule *, int *, int32 ***, GromacsPair **)
static void getParameterPointers (Parameters *, const GromacsPairValue **)
static void getTupleInfo (AtomSignature *sig, int *count, TupleSignature **t)
static void submitReductionData (BigReal *, SubmitReduction *)

Public Attributes

AtomID atomID [size]
int localIndex [size]
TuplePatchElemp [size]
Real scale
const GromacsPairValuevalue

Static Public Attributes

static int pressureProfileSlabs = 0
static int pressureProfileAtomTypes = 1
static BigReal pressureProfileThickness = 0
static BigReal pressureProfileMin = 0


Detailed Description

Definition at line 23 of file ComputeGromacsPair.h.


Member Enumeration Documentation

anonymous enum

Enumerator:
size 

Definition at line 26 of file ComputeGromacsPair.h.

00026 { size = 2 };

anonymous enum

Enumerator:
gromacsPairEnergyIndex 
virialIndex 
reductionDataSize 

Definition at line 53 of file ComputeGromacsPair.h.

anonymous enum

Enumerator:
reductionChecksumLabel 

Definition at line 55 of file ComputeGromacsPair.h.


Constructor & Destructor Documentation

GromacsPairElem::GromacsPairElem (  )  [inline]

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

Definition at line 12 of file ComputeGromacsPair.inl.

00012 { ; }

GromacsPairElem::GromacsPairElem ( AtomID  atom0,
const TupleSignature sig,
const GromacsPairValue v 
) [inline]

Definition at line 14 of file ComputeGromacsPair.inl.

References atomID, TupleSignature::offset, TupleSignature::tupleParamType, and value.

00014                                                                                                          {
00015     atomID[0] = atom0;
00016     atomID[1] = atom0 + sig->offset[0];
00017     value = &v[sig->tupleParamType];
00018 }

GromacsPairElem::GromacsPairElem ( const GromacsPair a,
const GromacsPairValue v 
) [inline]

Definition at line 20 of file ComputeGromacsPair.inl.

References gromacsPair::atom1, gromacsPair::atom2, atomID, gromacsPair::gromacsPair_type, and value.

00021   {
00022     atomID[0] = a->atom1;
00023     atomID[1] = a->atom2;
00024     value = &v[a->gromacsPair_type];
00025   }

GromacsPairElem::GromacsPairElem ( AtomID  atom0,
AtomID  atom1 
) [inline]

Definition at line 27 of file ComputeGromacsPair.inl.

References atomID.

00028   {
00029     if (atom0 > atom1) {  // Swap end atoms so lowest is first!
00030       AtomID tmp = atom1; atom1 = atom0; atom0 = tmp; 
00031     }
00032     atomID[0] = atom0;
00033     atomID[1] = atom1;
00034   }

GromacsPairElem::~GromacsPairElem (  )  [inline]

Definition at line 61 of file ComputeGromacsPair.h.

00061 {};


Member Function Documentation

void GromacsPairElem::computeForce ( GromacsPairElem ,
int  ,
BigReal ,
BigReal  
) [static]

Definition at line 44 of file ComputeGromacsPair.C.

References atomID, DebugM, Lattice::delta(), TuplePatchElem::f, gromacsPairEnergyIndex, Patch::lattice, Vector::length2(), localIndex, Node::Object(), TuplePatchElem::p, p, GromacsPairValue::pairC12, GromacsPairValue::pairC6, CompAtom::partition, CompAtom::position, pp_clamp(), pp_reduction(), pressureProfileAtomTypes, pressureProfileMin, pressureProfileSlabs, pressureProfileThickness, scale, Node::simParameters, simParams, size, value, TuplePatchElem::x, Vector::x, x, Vector::y, and Vector::z.

00046 {
00047  const Lattice & lattice = tuples[0].p[0]->p->lattice;
00048 
00049  for ( int ituple=0; ituple<ntuple; ++ituple ) {
00050   const GromacsPairElem &tup = tuples[ituple];
00051   enum { size = 2 };
00052   const AtomID (&atomID)[size](tup.atomID);
00053   const int    (&localIndex)[size](tup.localIndex);
00054   TuplePatchElem * const(&p)[size](tup.p);
00055   const Real (&scale)(tup.scale);
00056   const GromacsPairValue * const(&value)(tup.value);
00057 
00058     DebugM(1, "::computeforce() localIndex = " << localIndex [0] << " "
00059            << localIndex[1] << std::endl);
00060 
00061     // compute vectors between atoms and their distances
00062     const Vector r12 = lattice.delta(p[0]->x[localIndex[0]].position,
00063                                      p[1]->x[localIndex[1]].position);
00064 
00065     if ( p[0]->patchID == p[1]->patchID && localIndex[0] == localIndex[1] ) {
00066         continue;
00067     }
00068     SimParameters *simParams = Node::Object()->simParameters;
00069     BigReal cutoff = simParams->cutoff;
00070     BigReal r12_len = r12.length2();
00071     if ( r12_len == 0 ) continue;
00072     //if ( r12_len > cutoff) {
00073         //continue;
00074     //}
00075     BigReal ri2 = 1.0/r12_len;
00076     BigReal ri = sqrt(ri2);
00077     BigReal ri6 = ri2*ri2*ri2;
00078     BigReal ri7 = ri*ri6;
00079     BigReal ri8 = ri2*ri2*ri2*ri2;
00080     BigReal ri12 = ri6*ri6;
00081     BigReal ri13 = ri12*ri;
00082     BigReal ri14 = ri12*ri2;
00083 
00084     BigReal energy = 0;
00085     BigReal diff = 0;
00086     BigReal pairC12 = value->pairC12;
00087     BigReal pairC6 = value->pairC6;
00088 
00089     // Add the energy for the 12-6 LJ interaction to the total energy
00090     energy = (pairC12*ri12) - (pairC6*ri6);
00091     // This is a dirty hack; currently the code is looping over N^2 instead of N(N-1)/2 
00092     // This is happening because the LJ list is 2x long as it has to be
00093     //energy *= 0.5; 
00094 
00095     // Determine the magnitude of the force
00096     diff = ((12*pairC12*ri14) - (6*pairC6*ri8));
00097     // This is a dirty hack; currently the code is looping over N^2 instead of N(N-1)/2 
00098     // This is happening because the LJ list is 2x long as it has to be
00099     //diff *= 0.5; 
00100     //std::cout << "Force: " << diff << " " << pairC12 << " " << pairC6 << " " << r12.length() << "\n";
00101 
00102     //Scale the force vector accordingly
00103     const Force f12 = diff * r12;
00104     //std::cout << "Atoms: " << localIndex[0] << " " << localIndex[1] << " " << f12.length() << " " << f12 << "\n";
00105     //std::cout << "Force2: " << f12 << "\n";
00106 
00107     // Now add the forces to each force vector
00108     p[0]->f[localIndex[0]] += f12;
00109     p[1]->f[localIndex[1]] -= f12;
00110 
00111     DebugM(3, "::computeForce() -- ending with delta energy " << energy << std::endl);
00112     reduction[gromacsPairEnergyIndex] += energy;
00113     reduction[virialIndex_XX] += f12.x * r12.x;
00114     reduction[virialIndex_XY] += f12.x * r12.y;
00115     reduction[virialIndex_XZ] += f12.x * r12.z;
00116     reduction[virialIndex_YX] += f12.y * r12.x;
00117     reduction[virialIndex_YY] += f12.y * r12.y;
00118     reduction[virialIndex_YZ] += f12.y * r12.z;
00119     reduction[virialIndex_ZX] += f12.z * r12.x;
00120     reduction[virialIndex_ZY] += f12.z * r12.y;
00121     reduction[virialIndex_ZZ] += f12.z * r12.z;
00122 
00123     if (pressureProfileData) {
00124         BigReal z1 = p[0]->x[localIndex[0]].position.z;
00125         BigReal z2 = p[1]->x[localIndex[1]].position.z;
00126         int n1 = (int)floor((z1-pressureProfileMin)/pressureProfileThickness);
00127         int n2 = (int)floor((z2-pressureProfileMin)/pressureProfileThickness);
00128         pp_clamp(n1, pressureProfileSlabs);
00129         pp_clamp(n2, pressureProfileSlabs);
00130         int p1 = p[0]->x[localIndex[0]].partition;
00131         int p2 = p[1]->x[localIndex[1]].partition;
00132         int pn = pressureProfileAtomTypes;
00133         pp_reduction(pressureProfileSlabs,
00134                      n1, n2, 
00135                      p1, p2, pn, 
00136                      f12.x * r12.x, f12.y * r12.y, f12.z * r12.z,
00137                      pressureProfileData);
00138     } 
00139 
00140  }
00141 }

void GromacsPairElem::getMoleculePointers ( Molecule ,
int *  ,
int32 ***  ,
GromacsPair **   
) [static]

Definition at line 27 of file ComputeGromacsPair.C.

References Molecule::gromacsPair, Molecule::gromacsPairByAtom, NAMD_die(), and Molecule::numLJPair.

00028 {
00029 #ifdef MEM_OPT_VERSION
00030     NAMD_die("Should not be called in GromacsPairElem::getMoleculePointers in memory optimized version!");
00031 #else
00032     *count = mol->numLJPair;
00033     *byatom = mol->gromacsPairByAtom;
00034     *structarray = mol->gromacsPair;
00035 #endif
00036 }

void GromacsPairElem::getParameterPointers ( Parameters ,
const GromacsPairValue **   
) [static]

Definition at line 39 of file ComputeGromacsPair.C.

References p.

00039                                                                                     {
00040     // JLai
00041     *v=p->gromacsPair_array;
00042 }

static void GromacsPairElem::getTupleInfo ( AtomSignature sig,
int *  count,
TupleSignature **  t 
) [inline, static]

Definition at line 37 of file ComputeGromacsPair.h.

References AtomSignature::gromacsPairCnt, and AtomSignature::gromacsPairSigs.

00037                                                                                  {
00038         *count = sig->gromacsPairCnt;
00039         *t = sig->gromacsPairSigs;
00040     }

int GromacsPairElem::hash ( void   )  const [inline]

Definition at line 48 of file ComputeGromacsPair.h.

References atomID.

00048 { return 0x7FFFFFFF & ( (atomID[0]<<16) + (atomID[1])); }

int GromacsPairElem::operator< ( const GromacsPairElem a  )  const [inline]

Definition at line 41 of file ComputeGromacsPair.inl.

References atomID.

00042   {
00043     return (atomID[0] < a.atomID[0] ||
00044             (atomID[0] == a.atomID[0] &&
00045             (atomID[1] < a.atomID[1]) ));
00046   }

int GromacsPairElem::operator== ( const GromacsPairElem a  )  const [inline]

Definition at line 36 of file ComputeGromacsPair.inl.

References atomID.

00037   {
00038     return (a.atomID[0] == atomID[0] && a.atomID[1] == atomID[1]);
00039   }

void GromacsPairElem::submitReductionData ( BigReal ,
SubmitReduction  
) [static]

Definition at line 143 of file ComputeGromacsPair.C.

References ADD_TENSOR, gromacsPairEnergyIndex, SubmitReduction::item(), REDUCTION_GRO_LJ_ENERGY, REDUCTION_VIRIAL_NBOND, and virialIndex.

00144 {
00145     // JLai
00146     reduction->item(REDUCTION_GRO_LJ_ENERGY) += data[gromacsPairEnergyIndex];
00147     ADD_TENSOR(reduction,REDUCTION_VIRIAL_NBOND,data,virialIndex);
00148     return;
00149 }


Member Data Documentation

AtomID GromacsPairElem::atomID[size]

Definition at line 27 of file ComputeGromacsPair.h.

Referenced by computeForce(), GromacsPairElem(), hash(), operator<(), and operator==().

int GromacsPairElem::localIndex[size]

Definition at line 28 of file ComputeGromacsPair.h.

Referenced by computeForce().

TuplePatchElem* GromacsPairElem::p[size]

Definition at line 29 of file ComputeGromacsPair.h.

Referenced by computeForce(), and getParameterPointers().

int GromacsPairElem::pressureProfileAtomTypes = 1 [static]

Definition at line 44 of file ComputeGromacsPair.h.

Referenced by computeForce().

BigReal GromacsPairElem::pressureProfileMin = 0 [static]

Definition at line 46 of file ComputeGromacsPair.h.

Referenced by computeForce().

int GromacsPairElem::pressureProfileSlabs = 0 [static]

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

Definition at line 43 of file ComputeGromacsPair.h.

Referenced by computeForce().

BigReal GromacsPairElem::pressureProfileThickness = 0 [static]

Definition at line 45 of file ComputeGromacsPair.h.

Referenced by computeForce().

Real GromacsPairElem::scale

Definition at line 30 of file ComputeGromacsPair.h.

Referenced by computeForce().

const GromacsPairValue* GromacsPairElem::value

Definition at line 51 of file ComputeGromacsPair.h.

Referenced by computeForce(), and GromacsPairElem().


The documentation for this class was generated from the following files:
Generated on Mon Nov 20 01:17:18 2017 for NAMD by  doxygen 1.4.7