Also forward declared t_nblist in nbnxm.h to reduce dependencies.
fscal = free_energy_evaluate_single(
r2, fr->sc_r_power, fr->sc_alphacoul, fr->sc_alphavdw, fr->pairsTable->scale,
- fr->pairsTable->data, fr->pairsTable->stride, qq, c6, c12, qqB, c6B, c12B, LFC,
- LFV, DLF, lfac_coul, lfac_vdw, dlfac_coul, dlfac_vdw, fr->sc_sigma6_def,
+ fr->pairsTable->data.data(), fr->pairsTable->stride, qq, c6, c12, qqB, c6B, c12B,
+ LFC, LFV, DLF, lfac_coul, lfac_vdw, dlfac_coul, dlfac_vdw, fr->sc_sigma6_def,
fr->sc_sigma6_min, sigma2_def, sigma2_min, &velec, &vvdw, dvdl);
}
else
{
/* Evaluate tabulated interaction without free energy */
- fscal = evaluate_single(r2, fr->pairsTable->scale, fr->pairsTable->data,
+ fscal = evaluate_single(r2, fr->pairsTable->scale, fr->pairsTable->data.data(),
fr->pairsTable->stride, qq, c6, c12, &velec, &vvdw);
}
"Dispersion-correction code needs a table with both repulsion and dispersion "
"terms");
const real scale = iParams->dispersionCorrectionTable_->scale;
- const real* vdwtab = iParams->dispersionCorrectionTable_->data;
+ const real* vdwtab = iParams->dispersionCorrectionTable_->data.data();
/* Round the cut-offs to exact table values for precision */
int ri0 = static_cast<int>(std::floor(ic.rvdw_switch * scale));
static void tableForce(real r, const t_forcetable& tab, real Cd, real Cr, real* V, real* F)
{
const real tabscale = tab.scale;
- const real* VFtab = tab.data;
+ const real* VFtab = tab.data.data();
real rt = r * tabscale;
int n0 = static_cast<int>(rt);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#ifndef GMX_MDTYPES_NBLIST_H
#define GMX_MDTYPES_NBLIST_H
+#include <vector>
+
+#include "gromacs/utility/alignedallocator.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/real.h"
{
t_forcetable(enum gmx_table_interaction interaction, enum gmx_table_format format);
- ~t_forcetable();
-
enum gmx_table_interaction interaction; /* Types of interactions stored in this table */
enum gmx_table_format format; /* Interpolation type and data format */
- real r; /* range of the table */
- int n; /* n+1 is the number of table points */
- real scale; /* distance (nm) between two table points */
- real* data; /* the actual table data */
+ real r; /* range of the table */
+ int n; /* n+1 is the number of table points */
+ real scale; /* distance (nm) between two table points */
+ std::vector<real, gmx::AlignedAllocator<real>> data; /* the actual table data */
/* Some information about the table layout. This can also be derived from the interpolation
* type and the table interactions, but it is convenient to have here for sanity checks, and it
int stride; /* Distance to next table point (number of fp variables per table point in total) */
};
-struct t_nblists
-{
- struct t_forcetable* table_elec;
- struct t_forcetable* table_vdw;
- struct t_forcetable* table_elec_vdw;
-
- /* The actual neighbor lists, short and long range, see enum above
- * for definition of neighborlist indices.
- */
- struct t_nblist nlist_sr[eNL_NR];
- struct t_nblist nlist_lr[eNL_NR];
-};
-
struct gmx_ns_t
{
gmx_bool bCGlist;
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdtypes/group.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/mdtypes/nblist.h"
#include "gromacs/nbnxm/atomdata.h"
#include "gromacs/nbnxm/gpu_data_mgmt.h"
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/gpu_utils/hostallocator.h"
#include "gromacs/math/vectypes.h"
#include "gromacs/mdtypes/locality.h"
-#include "gromacs/mdtypes/nblist.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/defaultinitializationallocator.h"
#include "gromacs/utility/enumerationhelpers.h"
struct NbnxnPairlistCpuWork;
struct NbnxnPairlistGpuWork;
+struct t_nblist;
//! Convenience type for vector with aligned memory
#include "pairlistset.h"
+#include "gromacs/mdtypes/nblist.h"
+
#include "pairlistwork.h"
PairlistSet::~PairlistSet() = default;
#include "pairsearch.h"
+#include "gromacs/mdtypes/nblist.h"
#include "gromacs/utility/smalloc.h"
#include "pairlist.h"
/* Each table type (e.g. coul,lj6,lj12) requires four
* numbers per table->n+1 data points. For performance reasons we want
- * the table data to be aligned to a 32-byte boundary.
+ * the table data to be aligned to (at least) a 32-byte boundary.
*/
- snew_aligned(table->data, table->stride * (table->n + 1) * sizeof(real), 32);
+ table->data.resize(table->stride * (table->n + 1) * sizeof(real));
for (int k = 0; (k < etiNR); k++)
{
}
copy2table(table->n, k * table->formatsize, table->stride, td[k].x, td[k].v, td[k].f,
- scalefactor, table->data);
+ scalefactor, table->data.data());
done_tabledata(&(td[k]));
}
dispersionCorrectionTable->ninteractions = 2;
dispersionCorrectionTable->stride =
dispersionCorrectionTable->formatsize * dispersionCorrectionTable->ninteractions;
- snew_aligned(dispersionCorrectionTable->data,
- dispersionCorrectionTable->stride * (dispersionCorrectionTable->n + 1), 32);
+ dispersionCorrectionTable->data.resize(dispersionCorrectionTable->stride
+ * (dispersionCorrectionTable->n + 1));
for (int i = 0; i <= fullTable->n; i++)
{
r(0),
n(0),
scale(0),
- data(nullptr),
formatsize(0),
ninteractions(0),
stride(0)
{
}
-
-t_forcetable::~t_forcetable()
-{
- sfree_aligned(data);
-}