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 ( 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 Parameters::get_num_vdw_params(), 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 
20  if (!soluteScalingOn) {
21  table_dim = Node::Object()->parameters->get_num_vdw_params();
22  } else {
23  int ss_dim = Node::Object()->molecule->ss_num_vdw_params;
24  table_dim = ss_dim + Node::Object()->parameters->get_num_vdw_params();
25  }
26  table_alloc = new char[2*table_dim*table_dim*sizeof(TableEntry) + 31];
27  char *table_align = table_alloc;
28  while ( (long)table_align % 32 ) table_align++;
29  table = (TableEntry *) table_align;
30 
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  compute_vdw_params(i,j,curij,curij+1);
37 
38  // Copy to transpose entry
39  *curji = *curij;
40  *(curji + 1) = *(curij + 1);
41  }
42 
43 }
static Node * Object()
Definition: Node.h:86
SimParameters * simParameters
Definition: Node.h:178
int Bool
Definition: common.h:131
int get_num_vdw_params(void)
Definition: Parameters.h:531
Parameters * parameters
Definition: Node.h:177
Molecule * molecule
Definition: Node.h:176
int ss_num_vdw_params
Definition: Molecule.h:456
LJTable::~LJTable ( void  )

Definition at line 46 of file LJTable.C.

47 {
48  delete [] table_alloc;
49 }

Member Function Documentation

const TableEntry* LJTable::get_table ( ) const
inline

Definition at line 43 of file LJTable.h.

Referenced by dumpbench().

43 { return table; }
int LJTable::get_table_dim ( ) const
inline

Definition at line 44 of file LJTable.h.

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

44 { return table_dim; }
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  }
const TableEntry* LJTable::table_val ( unsigned int  i,
unsigned int  j 
) const
inline

Definition at line 35 of file LJTable.h.

Referenced by ComputeNonbondedCUDA::build_lj_table().

35  {
36  return table + 2 * (i * table_dim + j);
37  }
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: