gem5/splash2/codes/apps/water-nsquared/syscons.C
Sanchayan Maity 2fcc51c2c1 Commit splash2 benchmark
While at it also add the libpthread static library amd m5op_x86
for matrix multiplication test code as well.

Note that the splash2 benchmark code does not comply with gem5
coding guidelines. Academic guys never seem to follow 80 columns
and no whitespace guideline :(.
2017-04-26 20:50:15 +05:30

66 lines
3 KiB
C

/*************************************************************************/
/* */
/* Copyright (c) 1994 Stanford University */
/* */
/* All rights reserved. */
/* */
/* Permission is given to use, copy, and modify this software for any */
/* non-commercial purpose as long as this copyright notice is not */
/* removed. All other uses, including redistribution in whole or in */
/* part, are forbidden without prior written permission. */
/* */
/* This software is provided with absolutely no warranty and no */
/* support. */
/* */
/*************************************************************************/
EXTERN_ENV
#include <cmath>
#include "cnst.h"
#include "global.h"
#include "mddata.h"
#include "mdvar.h"
#include "parameters.h"
#include "stdio.h"
#include "water.h"
#include "wwpot.h"
void SYSCNS() /* sets up some system constants */
{
TSTEP=TSTEP/UNITT; /* time between steps */
NATMO=NATOMS*NMOL; /* total number of atoms in system */
NATMO3=NATMO*3; /* number of atoms * number of spatial dimensions */
FPOT= UNITM * pow((UNITL/UNITT),2.0) / (BOLTZ*TEMP*NATMO);
FKIN=FPOT*0.50/(TSTEP*TSTEP);
BOXL= pow( (NMOL*WTMOL*UNITM/RHO),(1.00/3.00)); /* computed
length of the cubical "box". Note that box size is
computed as being large enough to handle the input
number of water molecules */
BOXL=BOXL/UNITL; /* normalized length of computational box */
BOXH=BOXL*0.50; /* half the box length, used in
computing cutoff radius */
if (CUTOFF == 0.0) {
CUTOFF=max(BOXH,CUTOFF); /* cutoff radius is max of BOXH
and default (= 0); i.e. CUTOFF
radius is set to half the normalized
box length */
}
if (CUTOFF > 11.0) CUTOFF = 11.0; /* cutoff never greater than 11
Angstrom*/
REF1= -QQ/(CUTOFF*CUTOFF*CUTOFF);
REF2=2.00*REF1;
REF4=2.00*REF2;
CUT2=CUTOFF*CUTOFF; /* square of cutoff radius, used
to actually decide whether an
interaction should be computed in
INTERF and POTENG */
FHM=(TSTEP*TSTEP*0.50)/HMAS;
FOM=(TSTEP*TSTEP*0.50)/OMAS;
NMOL1=NMOL-1;
} /* end of subroutine SYSCNS */