Skip to content
Snippets Groups Projects
Commit a264c94c authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Correctly define the Ewald factor also when reading the table from a file.

parent 326102a4
No related branches found
No related tags found
No related merge requests found
......@@ -81,7 +81,10 @@ plt.figure()
count = 0
# Get the Gadget-2 data if existing
gadget2_file_list = glob.glob("forcetest_gadget2.txt")
if periodic:
gadget2_file_list = glob.glob("forcetest_gadget2_periodic.txt")
else:
gadget2_file_list = glob.glob("forcetest_gadget2.txt")
if len(gadget2_file_list) != 0:
gadget2_data = np.loadtxt(gadget2_file_list[0])
......
......@@ -145,9 +145,6 @@ void gravity_exact_force_ewald_init(double boxSize) {
const float factor_cos = 2.f * M_PI;
const float factor_pot = M_PI / alpha2;
/* Ewald factor to access the table */
ewald_fac = (double)(2 * Newald) / boxSize;
/* Zero everything */
bzero(fewald_x, (Newald + 1) * (Newald + 1) * (Newald + 1) * sizeof(float));
bzero(fewald_y, (Newald + 1) * (Newald + 1) * (Newald + 1) * sizeof(float));
......@@ -295,6 +292,9 @@ void gravity_exact_force_ewald_init(double boxSize) {
clocks_from_ticks(getticks() - tic), clocks_getunit());
}
/* Ewald factor to access the table */
ewald_fac = (double)(2 * Newald) / boxSize;
/* Apply the box-size correction */
for (int i = 0; i <= Newald; ++i) {
for (int j = 0; j <= Newald; ++j) {
......@@ -508,7 +508,7 @@ void gravity_exact_force_compute_mapper(void *map_data, int nr_gparts,
/* Interact it with all other particles in the space.*/
for (int j = 0; j < (int)s->nr_gparts; ++j) {
struct gpart *gpj = &s->gparts[j];
const struct gpart *gpj = &s->gparts[j];
/* No self interaction */
if (gpi == gpj) continue;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment