# Re: Simulating Negative mass particles.

From: Volker Springel <volker_at_MPA-Garching.MPG.DE>
Date: Fri, 4 Sep 2015 12:46:08 +0200

Hi Cassandra,

I'm not precisely sure what you're printing out below, but it seems your r2 value is gigantic and unrealistic, i.e. far larger than the boxsize squared. Note that when you have particles of negative mass, the center-of-mass can become ill-defined (and end up lying outside of the tree-node for which it is calculated). For example, if you have two particles in a node with masses of opposite sign, the code will likely return bizarre coordinates for the center of mass of the node (0/0 situation). So I think you should check whether your c.o.m. calculations in the tree make sense with negative mass particles...

tabindex presumably then gets negative due to an integer overflow. Even if r is positive, the product asmthfac * r may become larger than 2^31, then tabindex (still a variable of type int I presume) will overflow and turn negative. casting the product asmthfac*r to a long long before should not change this unless you change the variable type of tabindex as well.

Volker

On 03 Sep 2015, at 14:08, Cassandra Hall <cxh_at_roe.ac.uk> wrote:

>
> Hi All.
>
> I am having a problem when trying to simulate negative mass particles (the fact that I have a problem isn't unsurprising) and was wondering if anyone could shed some light.
>
> When I try to simulate positive and negative mass particles with periodic boundaries, in forcetreeevaluate_shortrange the tabindex goes negative, resulting in a seg fault.
>
> This trivially appears to be due to the boxsize being too small, however I don't quite understand what's happening.
>
> If I make the periodic box larger, I end up with a timestep of size zero error (possibly a seperate problem that is fixed by multiplying by the right sign during timestep evaluation).
>
> The variables are below - since tabindex = (long long)((asmthfac * r)+0.5);
>
> i: 2059, r2: 133688530459941255774208.000000, 229950405312.035156 109523914353.468750 262327760142.662109
> pos_x 15183.964844 pos_y 92062.531250 pos_z 16641.337891
> mass 0.000122
> nop 38989024
> no 27353
> All.MaxPart 26214
> i:2059 tabindex:-1348600960
> 0.113778 365634421875.103638
> Segmentation fault
>
> Does anybody have any suggestions as to why this may be happening? I have no doubt it's me being an idiot.....
>
> Thanks a lot
>
> Cassandra
>
>
>
>
> -----------------------------------------------------------
>
> If you wish to unsubscribe from this mailing, send mail to
> minimalist_at_MPA-Garching.MPG.de with a subject of: unsubscribe gadget-list
> A web-archive of this mailing list is available here: