* the research papers on the package. Check out http://www.gromacs.org.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
+
+#include "nbnxn_search.h"
+#include <assert.h>
#include <math.h>
#include <string.h>
-#include <assert.h>
-#include "sysstuff.h"
-#include "gromacs/utility/smalloc.h"
-#include "types/commrec.h"
-#include "macros.h"
+#include "gromacs/legacyheaders/gmx_omp_nthreads.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/legacyheaders/nrnb.h"
+#include "gromacs/legacyheaders/ns.h"
+#include "gromacs/legacyheaders/types/commrec.h"
#include "gromacs/math/utilities.h"
-#include "vec.h"
-#include "pbc.h"
-#include "nbnxn_consts.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/mdlib/nb_verlet.h"
+#include "gromacs/mdlib/nbnxn_atomdata.h"
+#include "gromacs/mdlib/nbnxn_consts.h"
+#include "gromacs/pbcutil/ishift.h"
+#include "gromacs/pbcutil/pbc.h"
+#include "gromacs/utility/smalloc.h"
+
/* nbnxn_internal.h included gromacs/simd/macros.h */
-#include "nbnxn_internal.h"
-#ifdef GMX_NBNXN_SIMD
+#include "gromacs/mdlib/nbnxn_internal.h"
+#ifdef GMX_SIMD
#include "gromacs/simd/vector_operations.h"
#endif
-#include "nbnxn_atomdata.h"
-#include "nbnxn_search.h"
-#include "gmx_omp_nthreads.h"
-#include "nrnb.h"
-#include "ns.h"
-
-#include "gromacs/fileio/gmxfio.h"
#ifdef NBNXN_SEARCH_BB_SIMD4
/* Always use 4-wide SIMD for bounding box calculations */
int cxy_start, int cxy_end,
int *sort_work)
{
- int cxy;
- int cx, cy, cz = -1, c = -1, ncz;
- int na, ash, na_c, ind, a;
- int subdiv_z, sub_z, na_z, ash_z;
- int subdiv_y, sub_y, na_y, ash_y;
- int subdiv_x, sub_x, na_x, ash_x;
+ int cxy;
+ int cx, cy, cz = -1, c = -1, ncz;
+ int na, ash, na_c, ind, a;
+ int subdiv_z, sub_z, na_z, ash_z;
+ int subdiv_y, sub_y, na_y, ash_y;
+ int subdiv_x, sub_x, na_x, ash_x;
- /* cppcheck-suppress unassignedVariable */
nbnxn_bb_t bb_work_array[2], *bb_work_aligned;
bb_work_aligned = (nbnxn_bb_t *)(((size_t)(bb_work_array+1)) & (~((size_t)15)));
}
for (b = 0; b < flags->nflag; b++)
{
- flags->flag[b] = 0;
+ bitmask_clear(&(flags->flag[b]));
}
}
}
#ifdef GMX_NBNXN_SIMD_4XN
-#include "nbnxn_search_simd_4xn.h"
+#include "gromacs/mdlib/nbnxn_search_simd_4xn.h"
#endif
#ifdef GMX_NBNXN_SIMD_2XNN
-#include "nbnxn_search_simd_2xnn.h"
+#include "gromacs/mdlib/nbnxn_search_simd_2xnn.h"
#endif
/* Plain C or SIMD4 code for making a pair list of super-cell sci vs scj.
int ndistc;
int ncpcheck;
int gridi_flag_shift = 0, gridj_flag_shift = 0;
- unsigned int *gridj_flag = NULL;
+ gmx_bitmask_t *gridj_flag = NULL;
int ncj_old_i, ncj_old_j;
nbs_cycle_start(&work->cc[enbsCCsearch]);
cbl = nbl->cj[nbl->ncj-1].cj >> gridj_flag_shift;
for (cb = cbf; cb <= cbl; cb++)
{
- gridj_flag[cb] = 1U<<th;
+ bitmask_init_bit(&gridj_flag[cb], th);
}
}
}
if (bFBufferFlag && nbl->ncj > ncj_old_i)
{
- work->buffer_flags.flag[(gridi->cell0+ci)>>gridi_flag_shift] = 1U<<th;
+ bitmask_init_bit(&(work->buffer_flags.flag[(gridi->cell0+ci)>>gridi_flag_shift]), th);
}
}
int nsrc,
const nbnxn_buffer_flags_t *dest)
{
- int s, b;
- const unsigned int *flag;
+ int s, b;
+ gmx_bitmask_t *flag;
for (s = 0; s < nsrc; s++)
{
for (b = 0; b < dest->nflag; b++)
{
- dest->flag[b] |= flag[b];
+ bitmask_union(&(dest->flag[b]), flag[b]);
}
}
}
static void print_reduction_cost(const nbnxn_buffer_flags_t *flags, int nout)
{
- int nelem, nkeep, ncopy, nred, b, c, out;
+ int nelem, nkeep, ncopy, nred, b, c, out;
+ gmx_bitmask_t mask_0;
nelem = 0;
nkeep = 0;
ncopy = 0;
nred = 0;
+ bitmask_init_bit(&mask_0, 0);
for (b = 0; b < flags->nflag; b++)
{
- if (flags->flag[b] == 1)
+ if (bitmask_is_equal(flags->flag[b], mask_0))
{
/* Only flag 0 is set, no copy of reduction required */
nelem++;
nkeep++;
}
- else if (flags->flag[b] > 0)
+ else if (!bitmask_is_zero(flags->flag[b]))
{
c = 0;
for (out = 0; out < nout; out++)
{
- if (flags->flag[b] & (1U<<out))
+ if (bitmask_is_set(flags->flag[b], out))
{
c++;
}