diff --git a/src/nbody/nbody.cpp b/src/nbody/nbody.cpp index fab69a4..56b0e05 100644 --- a/src/nbody/nbody.cpp +++ b/src/nbody/nbody.cpp @@ -163,6 +163,25 @@ std::shared_ptr Initialize(ParameterInput *pin) { pl.vy = particles_v[i].vel[1]; pl.vz = particles_v[i].vel[2]; reb_simulation_add(reb_sim, pl); + + // Verify that what we added still lives + struct reb_particle *pl2 = reb_simulation_particle_by_hash(reb_sim, i + 1); + PARTHENON_REQUIRE(pl2->r == particles_v[i].radius, + "Particle radius is inconsistent at setup!"); + PARTHENON_REQUIRE(pl2->m == particles_v[i].GM, + "Particle mass is inconsistent at setup!"); + PARTHENON_REQUIRE(pl2->x == particles_v[i].pos[0], + "Particle x is inconsistent at setup!"); + PARTHENON_REQUIRE(pl2->y == particles_v[i].pos[1], + "Particle y is inconsistent at setup!"); + PARTHENON_REQUIRE(pl2->z == particles_v[i].pos[2], + "Particle z is inconsistent at setup!"); + PARTHENON_REQUIRE(pl2->vx == particles_v[i].vel[0], + "Particle vx is inconsistent at setup!"); + PARTHENON_REQUIRE(pl2->vy == particles_v[i].vel[1], + "Particle vy is inconsistent at setup!"); + PARTHENON_REQUIRE(pl2->vz == particles_v[i].vel[2], + "Particle vz is inconsistent at setup!"); } reb_simulation_configure_box(reb_sim, box_size, 1, 1, 1);