NAMD
Classes | Public Member Functions | List of all members
LJTable Class Reference

#include <LJTable.h>

Classes

struct  TableEntry
 

Public Member Functions

 LJTable (void)
 
 ~LJTable (void)
 
const TableEntrytable_row (unsigned int i) const
 
const TableEntrytable_val (unsigned int i, unsigned int j) const
 
const TableEntrytable_val_scale14 (unsigned int i, unsigned int j) const
 
const TableEntryget_table () const
 
int get_table_dim () const
 

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 LJTable.h.

Constructor & Destructor Documentation

◆ LJTable()

LJTable::LJTable ( void  )

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

Definition at line 16 of file LJTable.C.

References LJTable::TableEntry::A, LJTable::TableEntry::B, Parameters::get_num_vdw_params(), SimParameters::LJPMEOn, Node::molecule, Node::Object(), Node::parameters, Node::simParameters, SimParameters::soluteScalingOn, and Molecule::ss_num_vdw_params.

17 {
18  Bool soluteScalingOn = Node::Object()->simParameters->soluteScalingOn;
19  Bool useLJPME = Node::Object()->simParameters->LJPMEOn;
20 
21  if (!soluteScalingOn) {
22  table_dim = Node::Object()->parameters->get_num_vdw_params();
23  } else {
24  int ss_dim = Node::Object()->molecule->ss_num_vdw_params;
25  table_dim = ss_dim + Node::Object()->parameters->get_num_vdw_params();
26  }
27  table_alloc = new char[2*table_dim*table_dim*sizeof(TableEntry) + 31];
28  char *table_align = table_alloc;
29  while ( (long)table_align % 32 ) table_align++;
30  table = (TableEntry *) table_align;
31  for (register int i=0; i < table_dim; i++)
32  for (register int j=i; j < table_dim; j++)
33  {
34  TableEntry *curij = &(table[2*(i*table_dim+j)]);
35  TableEntry *curji = &(table[2*(j*table_dim+i)]);
36  // Set the repulsion and dispersion to zero if we do LJ-PME
37  if (!useLJPME) {
38  compute_vdw_params(i,j,curij,curij+1);
39  } else {
40  curij->A = curij->B = 0.0;
41  curji->A = curji->B = 0.0;
42  }
43 
44  // Copy to transpose entry
45  *curji = *curij;
46  *(curji + 1) = *(curij + 1);
47  }
48 
49 }
static Node * Object()
Definition: Node.h:86
SimParameters * simParameters
Definition: Node.h:181
int Bool
Definition: common.h:142
int get_num_vdw_params(void)
Definition: Parameters.h:604
Parameters * parameters
Definition: Node.h:180
Molecule * molecule
Definition: Node.h:179
int ss_num_vdw_params
Definition: Molecule.h:484

◆ ~LJTable()

LJTable::~LJTable ( void  )

Definition at line 52 of file LJTable.C.

53 {
54  delete [] table_alloc;
55 }

Member Function Documentation

◆ get_table()

const TableEntry* LJTable::get_table ( ) const
inline

Definition at line 43 of file LJTable.h.

Referenced by dumpbench().

43 { return table; }

◆ get_table_dim()

int LJTable::get_table_dim ( ) const
inline

Definition at line 44 of file LJTable.h.

Referenced by dumpbench(), and ComputeNonbondedUtil::select().

44 { return table_dim; }

◆ table_row()

const TableEntry* LJTable::table_row ( unsigned int  i) const
inline

Definition at line 31 of file LJTable.h.

Referenced by ExclElem::computeForce().

31  {
32  return table + 2 * (i * table_dim);
33  }

◆ table_val()

const TableEntry* LJTable::table_val ( unsigned int  i,
unsigned int  j 
) const
inline

Definition at line 35 of file LJTable.h.

35  {
36  return table + 2 * (i * table_dim + j);
37  }

◆ table_val_scale14()

const TableEntry* LJTable::table_val_scale14 ( unsigned int  i,
unsigned int  j 
) const
inline

Definition at line 39 of file LJTable.h.

39  {
40  return table + 2 * (i * table_dim + j) + 1;
41  }

The documentation for this class was generated from the following files: