-typedef struct nbnxn_atomdata_t { //NOLINT(clang-analyzer-optin.performance.Padding)
- nbnxn_alloc_t *alloc;
- nbnxn_free_t *free;
- int ntype; /* The number of different atom types */
- real *nbfp; /* Lennard-Jones 6*C6 and 12*C12 params, size ntype^2*2 */
- int comb_rule; /* Combination rule, see enum above */
- real *nbfp_comb; /* LJ parameter per atom type, size ntype*2 */
- real *nbfp_aligned; /* As nbfp, but with an alignment (stride) suitable
- * for the present SIMD architectures
- */
- int natoms; /* Number of atoms */
- int natoms_local; /* Number of local atoms */
- int *type; /* Atom types */
- real *lj_comb; /* LJ parameters per atom for combining for pairs */
- int XFormat; /* The format of x (and q), enum */
- int FFormat; /* The format of f, enum */
- real *q; /* Charges, can be NULL if incorporated in x */
- int na_c; /* The number of atoms per cluster */
- int nenergrp; /* The number of energy groups */
- int neg_2log; /* Log2 of nenergrp */
- int *energrp; /* The energy groups per cluster, can be NULL */
- gmx_bool bDynamicBox; /* Do we need to update shift_vec every step? */
- rvec *shift_vec; /* Shift vectors, copied from t_forcerec */
- int xstride; /* stride for a coordinate in x (usually 3 or 4) */
- int fstride; /* stride for a coordinate in f (usually 3 or 4) */
- real *x; /* x and possibly q, size natoms*xstride */
-
- /* j-atom minus i-atom index for generating self and Newton exclusions
- * cluster-cluster pairs of the diagonal, for 4xn and 2xnn kernels.
+/* Struct that stores atom related data for the nbnxn module
+ *
+ * Note: performance would improve slightly when all std::vector containers
+ * in this struct would not initialize during resize().
+ */
+struct nbnxn_atomdata_t
+{ //NOLINT(clang-analyzer-optin.performance.Padding)
+ struct Params
+ {
+ /* Constructor
+ *
+ * \param[in] pinningPolicy Sets the pinning policy for all data that might be transfered to a GPU
+ */
+ Params(gmx::PinningPolicy pinningPolicy);
+
+ // The number of different atom types
+ int numTypes;
+ // Lennard-Jone 6*C6 and 12*C12 parameters, size numTypes*2*2
+ gmx::HostVector<real> nbfp;
+ // Combination rule, see enum defined above
+ int comb_rule;
+ // LJ parameters per atom type, size numTypes*2
+ gmx::HostVector<real> nbfp_comb;
+ // As nbfp, but with a stride for the present SIMD architecture
+ AlignedVector<real> nbfp_aligned;
+ // Atom types per atom
+ gmx::HostVector<int> type;
+ // LJ parameters per atom for fast SIMD loading
+ gmx::HostVector<real> lj_comb;
+ // Charges per atom, not set with format nbatXYZQ
+ gmx::HostVector<real> q;
+ // The number of energy groups
+ int nenergrp;
+ // 2log(nenergrp)
+ int neg_2log;
+ // The energy groups, one int entry per cluster, only set when needed
+ gmx::HostVector<int> energrp;
+ };
+
+ // Diagonal and topology exclusion helper data for all SIMD kernels
+ struct SimdMasks
+ {
+ SimdMasks();
+
+ // Helper data for setting up diagonal exclusion masks in the SIMD 4xN kernels
+ AlignedVector<real> diagonal_4xn_j_minus_i;
+ // Helper data for setting up diaginal exclusion masks in the SIMD 2xNN kernels
+ AlignedVector<real> diagonal_2xnn_j_minus_i;
+ // Filters for topology exclusion masks for the SIMD kernels
+ AlignedVector<uint32_t> exclusion_filter;
+ // Filters for topology exclusion masks for double SIMD kernels without SIMD int32 logical support
+ AlignedVector<uint64_t> exclusion_filter64;
+ // Array of masks needed for exclusions
+ AlignedVector<real> interaction_array;
+ };
+
+ /* Constructor
+ *
+ * \param[in] pinningPolicy Sets the pinning policy for all data that might be transfered to a GPU