NAMD
Classes | Macros | Enumerations | Functions
HomePatch.h File Reference
#include "charm++.h"
#include "NamdTypes.h"
#include "Patch.h"
#include "PatchMap.h"
#include "MigrateAtomsMsg.h"
#include "main.h"
#include "common.h"
#include "Migration.h"
#include "Settle.h"
#include <string>
#include <map>

Go to the source code of this file.

Classes

class  HomePatch
 
struct  HomePatch::RattleList
 
struct  HomePatch::checkpoint_t
 

Macros

#define TIMER_INIT(T, TYPE)   do { } while(0)
 
#define TIMER_INIT_WIDTH(T, TYPE, WIDTH)   do{ } while(0)
 
#define TIMER_START(T, TYPE)   do { } while(0)
 
#define TIMER_STOP(T, TYPE)   do { } while(0)
 
#define TIMER_DONE(T)   do { } while(0)
 
#define TIMER_REPORT(T)   do { } while(0)
 

Enumerations

enum  { MAXFACTOR = 32 }
 

Functions

void PatchDataSOA_initialize (PatchDataSOA *p)
 
size_t PatchDataSOA_set_size (PatchDataSOA *p, int natoms, int pad=MAXFACTOR)
 
void PatchDataSOA_set_buffer (PatchDataSOA *p, void *mybuffer)
 

Macro Definition Documentation

◆ TIMER_DONE

#define TIMER_DONE (   T)    do { } while(0)

Definition at line 266 of file HomePatch.h.

Referenced by Sequencer::integrate(), and Sequencer::integrate_SOA().

◆ TIMER_INIT

#define TIMER_INIT (   T,
  TYPE 
)    do { } while(0)

Definition at line 262 of file HomePatch.h.

◆ TIMER_INIT_WIDTH

#define TIMER_INIT_WIDTH (   T,
  TYPE,
  WIDTH 
)    do{ } while(0)

Definition at line 263 of file HomePatch.h.

Referenced by Sequencer::integrate(), and Sequencer::integrate_SOA().

◆ TIMER_REPORT

#define TIMER_REPORT (   T)    do { } while(0)

Definition at line 267 of file HomePatch.h.

Referenced by Sequencer::integrate(), and Sequencer::integrate_SOA().

◆ TIMER_START

#define TIMER_START (   T,
  TYPE 
)    do { } while(0)

◆ TIMER_STOP

#define TIMER_STOP (   T,
  TYPE 
)    do { } while(0)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MAXFACTOR 

pad length of arrays up to this next multiple

Definition at line 295 of file HomePatch.h.

295  {
296 #ifdef NAMD_CUDA
297  MAXFACTOR = 32
298 #else
299  //TODO:HIP verify
300  MAXFACTOR = 32
301 #endif
302 };
pad length of arrays up to this next multiple
Definition: HomePatch.h:297

Function Documentation

◆ PatchDataSOA_initialize()

void PatchDataSOA_initialize ( PatchDataSOA p)

Initialize fundamental parts of PatchDataSOA.

Definition at line 2366 of file HomePatch.C.

References PatchDataSOA::buffer, PatchDataSOA::maxAtoms, PatchDataSOA::numAtoms, and PatchDataSOA::numBytes.

2366  {
2367  p->buffer = NULL;
2368  p->numBytes = 0;
2369  p->numAtoms = 0;
2370  p->maxAtoms = 0;
2371 }
int32 maxAtoms
max number of atoms available, multiple of MAXFACTOR
Definition: NamdTypes.h:457
size_t numBytes
number of bytes allocated for soa_buffer
Definition: NamdTypes.h:455
unsigned char * buffer
Definition: NamdTypes.h:375
int32 numAtoms
number of atoms
Definition: NamdTypes.h:456

◆ PatchDataSOA_set_buffer()

void PatchDataSOA_set_buffer ( PatchDataSOA p,
void *  mybuffer 
)

Caller provides the buffer space to be used. Set all pointers relative to this provided address, pointing into the buffer space.

Definition at line 2397 of file HomePatch.C.

References PatchDataSOA::atomFixed, PatchDataSOA::buffer, PatchDataSOA::charge, PatchDataSOA::exclId, PatchDataSOA::f_global_x, PatchDataSOA::f_global_y, PatchDataSOA::f_global_z, PatchDataSOA::f_nbond_x, PatchDataSOA::f_nbond_y, PatchDataSOA::f_nbond_z, PatchDataSOA::f_normal_x, PatchDataSOA::f_normal_y, PatchDataSOA::f_normal_z, PatchDataSOA::f_saved_nbond_x, PatchDataSOA::f_saved_nbond_y, PatchDataSOA::f_saved_nbond_z, PatchDataSOA::f_saved_slow_x, PatchDataSOA::f_saved_slow_y, PatchDataSOA::f_saved_slow_z, PatchDataSOA::f_slow_x, PatchDataSOA::f_slow_y, PatchDataSOA::f_slow_z, PatchDataSOA::fixedPosition_x, PatchDataSOA::fixedPosition_y, PatchDataSOA::fixedPosition_z, PatchDataSOA::gaussrand_x, PatchDataSOA::gaussrand_y, PatchDataSOA::gaussrand_z, PatchDataSOA::groupFixed, PatchDataSOA::hydrogenGroupSize, PatchDataSOA::id, PatchDataSOA::isWater, PatchDataSOA::langevinParam, PatchDataSOA::langScalRandBBK2, PatchDataSOA::langScalVelBBK2, PatchDataSOA::mass, PatchDataSOA::maxAtoms, PatchDataSOA::migrationGroupSize, PatchDataSOA::nonbondedGroupSize, Node::Object(), PatchDataSOA::partition, PatchDataSOA::pos_x, PatchDataSOA::pos_y, PatchDataSOA::pos_z, PatchDataSOA::posNew_x, PatchDataSOA::posNew_y, PatchDataSOA::posNew_z, PatchDataSOA::recipMass, PatchDataSOA::rigidBondLength, PatchDataSOA::sigId, Node::simParameters, simParams, PatchDataSOA::sortOrder, PatchDataSOA::status, PatchDataSOA::transform_i, PatchDataSOA::transform_j, PatchDataSOA::transform_k, PatchDataSOA::unsortOrder, PatchDataSOA::vdwType, PatchDataSOA::vel_x, PatchDataSOA::vel_y, PatchDataSOA::vel_z, PatchDataSOA::velNew_x, PatchDataSOA::velNew_y, and PatchDataSOA::velNew_z.

2400  {
2402  p->buffer = (unsigned char *) mybuffer;
2403  unsigned char *t = p->buffer;
2404  p->pos_x = (double *) t;
2405  t += p->maxAtoms * sizeof(double);
2406  p->pos_y = (double *) t;
2407  t += p->maxAtoms * sizeof(double);
2408  p->pos_z = (double *) t;
2409  t += p->maxAtoms * sizeof(double);
2410  p->charge = (float *) t;
2411  t += p->maxAtoms * sizeof(float);
2412  p->vdwType = (int *) t;
2413  t += p->maxAtoms * sizeof(int);
2414  p->partition = (int *) t;
2415  t += p->maxAtoms * sizeof(int);
2416  p->nonbondedGroupSize = (int *) t;
2417  t += p->maxAtoms * sizeof(int);
2418  p->hydrogenGroupSize = (int *) t;
2419  t += p->maxAtoms * sizeof(int);
2420  p->isWater = (int *) t;
2421  t += p->maxAtoms * sizeof(int);
2422  p->sortOrder = (int *) t;
2423  t += p->maxAtoms * sizeof(int);
2424  p->unsortOrder = (int *) t;
2425  t += p->maxAtoms * sizeof(int);
2426  p->id = (int *) t;
2427  t += p->maxAtoms * sizeof(int);
2428  p->exclId = (int *) t;
2429  t += p->maxAtoms * sizeof(int);
2430  p->sigId = (int *) t;
2431  t += p->maxAtoms * sizeof(int);
2432  p->atomFixed = (int *) t;
2433  t += p->maxAtoms * sizeof(int);
2434  p->groupFixed = (int *) t;
2435  t += p->maxAtoms * sizeof(int);
2436  p->vel_x = (double *) t;
2437  t += p->maxAtoms * sizeof(double);
2438  p->vel_y = (double *) t;
2439  t += p->maxAtoms * sizeof(double);
2440  p->vel_z = (double *) t;
2441  t += p->maxAtoms * sizeof(double);
2442  p->fixedPosition_x = (double *) t;
2443  t += p->maxAtoms * sizeof(double);
2444  p->fixedPosition_y = (double *) t;
2445  t += p->maxAtoms * sizeof(double);
2446  p->fixedPosition_z = (double *) t;
2447  t += p->maxAtoms * sizeof(double);
2448  p->recipMass = (double *) t;
2449  t += p->maxAtoms * sizeof(double);
2450  p->mass = (float *) t;
2451  t += p->maxAtoms * sizeof(float);
2452  p->langevinParam = (float *) t;
2453  t += p->maxAtoms * sizeof(float);
2454  p->status = (int *) t;
2455  t += p->maxAtoms * sizeof(int);
2456  p->transform_i = (int *) t;
2457  t += p->maxAtoms * sizeof(int);
2458  p->transform_j = (int *) t;
2459  t += p->maxAtoms * sizeof(int);
2460  p->transform_k = (int *) t;
2461  t += p->maxAtoms * sizeof(int);
2462  p->migrationGroupSize = (int *) t;
2463  t += p->maxAtoms * sizeof(int);
2464  p->rigidBondLength = (float *) t;
2465  t += p->maxAtoms * sizeof(float);
2466  p->langScalVelBBK2 = (float *) t;
2467  t += p->maxAtoms * sizeof(float);
2468  p->langScalRandBBK2 = (float *) t;
2469  t += p->maxAtoms * sizeof(float);
2470  p->gaussrand_x = (float *) t;
2471  t += p->maxAtoms * sizeof(float);
2472  p->gaussrand_y = (float *) t;
2473  t += p->maxAtoms * sizeof(float);
2474  p->gaussrand_z = (float *) t;
2475  t += p->maxAtoms * sizeof(float);
2476  p->f_normal_x = (double *) t;
2477  t += p->maxAtoms * sizeof(double);
2478  p->f_normal_y = (double *) t;
2479  t += p->maxAtoms * sizeof(double);
2480  p->f_normal_z = (double *) t;
2481  t += p->maxAtoms * sizeof(double);
2482  p->f_nbond_x = (double *) t;
2483  t += p->maxAtoms * sizeof(double);
2484  p->f_nbond_y = (double *) t;
2485  t += p->maxAtoms * sizeof(double);
2486  p->f_nbond_z = (double *) t;
2487  t += p->maxAtoms * sizeof(double);
2488  p->f_slow_x = (double *) t;
2489  t += p->maxAtoms * sizeof(double);
2490  p->f_slow_y = (double *) t;
2491  t += p->maxAtoms * sizeof(double);
2492  p->f_slow_z = (double *) t;
2493  t += p->maxAtoms * sizeof(float);
2494  if (simParams->colvarsOn || simParams->tclForcesOn || (simParams->IMDon && ! (simParams->IMDignore || simParams->IMDignoreForces))){
2495  p->f_global_x = (double *) t;
2496  t += p->maxAtoms * sizeof(double);
2497  p->f_global_y = (double *) t;
2498  t += p->maxAtoms * sizeof(double);
2499  p->f_global_z = (double *) t;
2500  t += p->maxAtoms * sizeof(double);
2501  }
2502  p->f_saved_nbond_x = (double *) t;
2503  t += p->maxAtoms * sizeof(double);
2504  p->f_saved_nbond_y = (double *) t;
2505  t += p->maxAtoms * sizeof(double);
2506  p->f_saved_nbond_z = (double *) t;
2507  t += p->maxAtoms * sizeof(double);
2508  p->f_saved_slow_x = (double *) t;
2509  t += p->maxAtoms * sizeof(double);
2510  p->f_saved_slow_y = (double *) t;
2511  t += p->maxAtoms * sizeof(double);
2512  p->f_saved_slow_z = (double *) t;
2513  t += p->maxAtoms * sizeof(double);
2514  p->velNew_x = (double *) t;
2515  t += p->maxAtoms * sizeof(double);
2516  p->velNew_y = (double *) t;
2517  t += p->maxAtoms * sizeof(double);
2518  p->velNew_z = (double *) t;
2519  t += p->maxAtoms * sizeof(double);
2520  p->posNew_x = (double *) t;
2521  t += p->maxAtoms * sizeof(double);
2522  p->posNew_y = (double *) t;
2523  t += p->maxAtoms * sizeof(double);
2524  p->posNew_z = (double *) t;
2525 }
static Node * Object()
Definition: Node.h:86
double * vel_y
Definition: NamdTypes.h:397
int32 * isWater
Definition: NamdTypes.h:386
double * f_normal_z
Definition: NamdTypes.h:430
int32 * groupFixed
Definition: NamdTypes.h:394
double * f_normal_y
Definition: NamdTypes.h:429
double * posNew_z
Definition: NamdTypes.h:453
int32 * exclId
Definition: NamdTypes.h:391
int32 * unsortOrder
Definition: NamdTypes.h:389
double * f_saved_slow_z
Definition: NamdTypes.h:445
double * f_slow_y
Definition: NamdTypes.h:435
SimParameters * simParameters
Definition: Node.h:181
double * f_global_z
Definition: NamdTypes.h:439
int32 maxAtoms
max number of atoms available, multiple of MAXFACTOR
Definition: NamdTypes.h:457
double * f_saved_slow_y
Definition: NamdTypes.h:444
float * langScalVelBBK2
derived from langevinParam
Definition: NamdTypes.h:419
double * f_saved_slow_x
Definition: NamdTypes.h:443
float * gaussrand_y
Definition: NamdTypes.h:424
double * pos_y
Definition: NamdTypes.h:378
double * velNew_z
Definition: NamdTypes.h:450
double * fixedPosition_y
Definition: NamdTypes.h:401
int32 * migrationGroupSize
Definition: NamdTypes.h:414
float * mass
Definition: NamdTypes.h:405
double * f_global_y
Definition: NamdTypes.h:438
double * f_nbond_y
Definition: NamdTypes.h:432
double * f_nbond_z
Definition: NamdTypes.h:433
int32 * hydrogenGroupSize
Definition: NamdTypes.h:385
double * f_normal_x
Definition: NamdTypes.h:428
float * langevinParam
Definition: NamdTypes.h:406
float * gaussrand_x
fill with Gaussian distributed random numbers
Definition: NamdTypes.h:423
int32 * vdwType
Definition: NamdTypes.h:382
int32 * sortOrder
Definition: NamdTypes.h:388
float * gaussrand_z
Definition: NamdTypes.h:425
double * vel_x
Jim recommends double precision velocity.
Definition: NamdTypes.h:396
int32 * id
Definition: NamdTypes.h:390
float * charge
Definition: NamdTypes.h:381
int32 * transform_i
Definition: NamdTypes.h:410
double * f_saved_nbond_x
Definition: NamdTypes.h:440
int32 * partition
Definition: NamdTypes.h:383
double * f_saved_nbond_z
Definition: NamdTypes.h:442
double * posNew_y
Definition: NamdTypes.h:452
float * rigidBondLength
Definition: NamdTypes.h:416
int32 * transform_k
Definition: NamdTypes.h:412
double * recipMass
derived from mass
Definition: NamdTypes.h:404
#define simParams
Definition: Output.C:131
double * velNew_y
Definition: NamdTypes.h:449
double * fixedPosition_x
Definition: NamdTypes.h:400
double * pos_z
Definition: NamdTypes.h:379
double * f_slow_x
Definition: NamdTypes.h:434
double * pos_x
Definition: NamdTypes.h:377
int32 * transform_j
Definition: NamdTypes.h:411
double * vel_z
Definition: NamdTypes.h:398
int32 * sigId
Definition: NamdTypes.h:392
double * f_saved_nbond_y
Definition: NamdTypes.h:441
double * f_nbond_x
Definition: NamdTypes.h:431
unsigned char * buffer
Definition: NamdTypes.h:375
double * f_global_x
Definition: NamdTypes.h:437
double * fixedPosition_z
Definition: NamdTypes.h:402
int32 * status
Definition: NamdTypes.h:408
float * langScalRandBBK2
from langevinParam and recipMass
Definition: NamdTypes.h:420
double * posNew_x
Definition: NamdTypes.h:451
int32 * atomFixed
Definition: NamdTypes.h:393
int32 * nonbondedGroupSize
Definition: NamdTypes.h:384
double * f_slow_z
Definition: NamdTypes.h:436
double * velNew_x
temp storage for rigid bond constraints
Definition: NamdTypes.h:448

◆ PatchDataSOA_set_size()

size_t PatchDataSOA_set_size ( PatchDataSOA p,
int  natoms,
int  pad = MAXFACTOR 
)

Set sizes based on number of atoms and padding factor. Sets internally numAtoms, maxAtoms, and numBytes. Returns numBytes.

Definition at line 2373 of file HomePatch.C.

References PatchDataSOA::maxAtoms, PatchDataSOA::numAtoms, PatchDataSOA::numBytes, Node::Object(), Node::simParameters, and simParams.

2377  {
2378  if (natoms > p->maxAtoms) {
2379  // maxAtoms extends numAtoms to next multiple of padding
2380  p->maxAtoms = ((natoms + padding - 1) / padding) * padding;
2381  // set numBytes to allow each array to have maxAtoms space
2382  // count up total number of double, float, and int arrays
2383  // XXX TODO : these magic numbers are bad for maintability
2385  // XXX TODO: For Colvars, tclForces, IMD or any GlobalMaster
2386  // client that requires the global forces, we need extra 3 buffers
2387  // to save the x, y and z components of the forces, and therefore
2388  // the number of double fields should be increased by 3 (from 31 to 34).
2389  int numdoubles = (simParams->colvarsOn || simParams->tclForcesOn || simParams->IMDon) ? 34: 31;
2390  p->numBytes = p->maxAtoms *
2391  (numdoubles * sizeof(double) + 9*sizeof(float) + 17*sizeof(int));
2392  }
2393  p->numAtoms = natoms;
2394  return p->numBytes;
2395 }
static Node * Object()
Definition: Node.h:86
SimParameters * simParameters
Definition: Node.h:181
int32 maxAtoms
max number of atoms available, multiple of MAXFACTOR
Definition: NamdTypes.h:457
size_t numBytes
number of bytes allocated for soa_buffer
Definition: NamdTypes.h:455
#define simParams
Definition: Output.C:131
int32 numAtoms
number of atoms
Definition: NamdTypes.h:456