Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Peter W. Draper
SWIFTsim
Commits
a264c94c
Commit
a264c94c
authored
May 16, 2018
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/plot_gravity_checks.py
+4
-1
4 additions, 1 deletion
examples/plot_gravity_checks.py
src/gravity.c
+4
-4
4 additions, 4 deletions
src/gravity.c
with
8 additions
and
5 deletions
examples/plot_gravity_checks.py
+
4
−
1
View file @
a264c94c
...
@@ -81,6 +81,9 @@ plt.figure()
...
@@ -81,6 +81,9 @@ plt.figure()
count
=
0
count
=
0
# Get the Gadget-2 data if existing
# Get the Gadget-2 data if existing
if
periodic
:
gadget2_file_list
=
glob
.
glob
(
"
forcetest_gadget2_periodic.txt
"
)
else
:
gadget2_file_list
=
glob
.
glob
(
"
forcetest_gadget2.txt
"
)
gadget2_file_list
=
glob
.
glob
(
"
forcetest_gadget2.txt
"
)
if
len
(
gadget2_file_list
)
!=
0
:
if
len
(
gadget2_file_list
)
!=
0
:
...
...
This diff is collapsed.
Click to expand it.
src/gravity.c
+
4
−
4
View file @
a264c94c
...
@@ -145,9 +145,6 @@ void gravity_exact_force_ewald_init(double boxSize) {
...
@@ -145,9 +145,6 @@ void gravity_exact_force_ewald_init(double boxSize) {
const
float
factor_cos
=
2
.
f
*
M_PI
;
const
float
factor_cos
=
2
.
f
*
M_PI
;
const
float
factor_pot
=
M_PI
/
alpha2
;
const
float
factor_pot
=
M_PI
/
alpha2
;
/* Ewald factor to access the table */
ewald_fac
=
(
double
)(
2
*
Newald
)
/
boxSize
;
/* Zero everything */
/* Zero everything */
bzero
(
fewald_x
,
(
Newald
+
1
)
*
(
Newald
+
1
)
*
(
Newald
+
1
)
*
sizeof
(
float
));
bzero
(
fewald_x
,
(
Newald
+
1
)
*
(
Newald
+
1
)
*
(
Newald
+
1
)
*
sizeof
(
float
));
bzero
(
fewald_y
,
(
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) {
...
@@ -295,6 +292,9 @@ void gravity_exact_force_ewald_init(double boxSize) {
clocks_from_ticks
(
getticks
()
-
tic
),
clocks_getunit
());
clocks_from_ticks
(
getticks
()
-
tic
),
clocks_getunit
());
}
}
/* Ewald factor to access the table */
ewald_fac
=
(
double
)(
2
*
Newald
)
/
boxSize
;
/* Apply the box-size correction */
/* Apply the box-size correction */
for
(
int
i
=
0
;
i
<=
Newald
;
++
i
)
{
for
(
int
i
=
0
;
i
<=
Newald
;
++
i
)
{
for
(
int
j
=
0
;
j
<=
Newald
;
++
j
)
{
for
(
int
j
=
0
;
j
<=
Newald
;
++
j
)
{
...
@@ -508,7 +508,7 @@ void gravity_exact_force_compute_mapper(void *map_data, int nr_gparts,
...
@@ -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.*/
/* Interact it with all other particles in the space.*/
for
(
int
j
=
0
;
j
<
(
int
)
s
->
nr_gparts
;
++
j
)
{
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 */
/* No self interaction */
if
(
gpi
==
gpj
)
continue
;
if
(
gpi
==
gpj
)
continue
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment