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:447
size_t numBytes
number of bytes allocated for soa_buffer
Definition: NamdTypes.h:445
unsigned char * buffer
Definition: NamdTypes.h:365
int32 numAtoms
number of atoms
Definition: NamdTypes.h:446

◆ 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 2393 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.

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

◆ 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  int numdoubles = (simParams->colvarsOn || simParams->tclForcesOn) ? 34: 31;
2386  p->numBytes = p->maxAtoms *
2387  (numdoubles * sizeof(double) + 9*sizeof(float) + 17*sizeof(int));
2388  }
2389  p->numAtoms = natoms;
2390  return p->numBytes;
2391 }
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:447
size_t numBytes
number of bytes allocated for soa_buffer
Definition: NamdTypes.h:445
#define simParams
Definition: Output.C:129
int32 numAtoms
number of atoms
Definition: NamdTypes.h:446