given in the reference manual.
:issue:`3751`
+
+Fixed LJ Ewald exclusions when used with cut-off electrostatics
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+The exclusion forces in CUDA and OpenCL kernels were computed incorrectly
+if LJ Ewald was used together with cut-off electrostatics.
+
+:issue:`3840`
# define EL_EWALD_ANY
#endif
+#if defined LJ_EWALD_COMB_GEOM || defined LJ_EWALD_COMB_LB
+/* Note: convenience macro, needs to be undef-ed at the end of the file. */
+# define LJ_EWALD
+#endif
+
#if defined EL_EWALD_ANY || defined EL_RF || defined LJ_EWALD \
|| (defined EL_CUTOFF && defined CALC_ENERGIES)
/* Macro to control the calculation of exclusion forces in the kernel
# define EXCLUSION_FORCES
#endif
-#if defined LJ_EWALD_COMB_GEOM || defined LJ_EWALD_COMB_LB
-/* Note: convenience macro, needs to be undef-ed at the end of the file. */
-# define LJ_EWALD
-#endif
-
#if defined LJ_COMB_GEOM || defined LJ_COMB_LB
# define LJ_COMB
#endif
# define EL_EWALD_ANY
#endif
+#if defined LJ_EWALD_COMB_GEOM || defined LJ_EWALD_COMB_LB
+/* Note: convenience macro, needs to be undef-ed at the end of the file. */
+# define LJ_EWALD
+#endif
+
#if defined EL_EWALD_ANY || defined EL_RF || defined LJ_EWALD \
|| (defined EL_CUTOFF && defined CALC_ENERGIES)
/* Macro to control the calculation of exclusion forces in the kernel
# define EXCLUSION_FORCES
#endif
-#if defined LJ_EWALD_COMB_GEOM || defined LJ_EWALD_COMB_LB
-/* Note: convenience macro, needs to be undef-ed at the end of the file. */
-# define LJ_EWALD
-#endif
-
#if defined LJ_COMB_GEOM || defined LJ_COMB_LB
/* Note: convenience macro, needs to be undef-ed at the end of the file. */
# define LJ_COMB