Skip to content

Commit 1d0386d

Browse files
committed
Only add a j-particle when it has mass
j-particles are the particles that exert gravity. If they are massless, they should not become a j-particle. When deploying PH4 with a CPU backend, this is taken care of in line 207 of idata.cc in "get_partial_acc_and_jerk": " // Skip particles with zero mass. if (jdat->mass[j] > _TINY_){ " However, this is not the best place to do this, it would be better to not create the j-particle at all. For both the CPU and GPU backends this commit fixes this. This means that the conditional in line 208 of idata.cc has now become redundant.
1 parent ac1ecdf commit 1d0386d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/amuse_ph4/src/jdata.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,14 @@ int jdata::add_particle(real pmass, real pradius,
139139
real dt) // default = -1
140140
{
141141
const char *in_function = "jdata::add_particle";
142+
143+
if (pmass <= _TINY_) {
144+
if (mpi_rank == 0) {
145+
cerr << "Warning: ignoring particle with mass="
146+
<< pmass << endl;
147+
}
148+
return -1;
149+
}
142150
if (DEBUG > 2 && mpi_rank == 0) PRL(in_function);
143151

144152
if (nj >= njbuf) {

0 commit comments

Comments
 (0)