Re: different particles

From: Juan Carlos Muñoz Cuartas <>
Date: Wed, 27 May 2009 02:52:21 -0700 (PDT)

Hi all,

Instead of touching the code (which could be dangerous if you do not know in detail how to do it!) I would recomend to enable the posibility of using individual softening lenghts by enabling this in the makefile (UNEQUALSOFTENINGS), and recompile. 

Then, in the file with the initial conditions you can write the mass of every indivudual particle in the snapshot just after the ID of the particles (and making Massarr[] equal to zero in all the sets of particles with individual masses in the header).

I think, is going to work better that modifying the code!

I hope it helps.

Juan Carlos


--- El mié 27-may-09, Sander Valcke <> escribió:

De: Sander Valcke <>
Asunto: Re: [gadget-list] different particles
A: "Gadget General Discussion" <gadget-list_at_MPA-Garching.MPG.DE>
Fecha: miércoles, 27 mayo, 2009, 3:41 am

Hi all,

I don't know if it would be possible to just add a softening variable to the P struct in this case: allvars.h (523):

FLOAT Softening;

I'm not very familiar with the gravity code but it seems that setting UNEQUALSOFTENINGS and ADAPTIVE_GRAVSOFT_FORGAS allows varying softening lengths when some code is modified to extend this beyond the sph particles.

the following code is found in forcetree.c (line 585):

if(All.ForceSoftening[pa->Type] > maxsoft)
 maxsoft = All.ForceSoftening[pa->Type];

if this would be encapsulated in an extra ADAPTIVE_GRAVSOFT flag:

<insert code above>
if (pa->Softening > maxsoft)
 maxsoft = pa->Softening;

(or something similar and more general)

a similar change in potential.c lines 108/109, gravtree.c lines 132/133, forcetree.c lines 585/586, 1158/1159, 1174/1175, 1230/1244, 1455/1456, 1514/1528, 2070/2071, 2140/2154, 2334/2335, 2416/2430 (note: the two-line pieces of code are identical, as are the 15 line pieces), timestep.c around 477. Basically at every place where ADAPTIVE_GRAVSOFT_FORGAS is found.

Then there would just need to be 2 more small additions, for reading and writing the softening length from and to snapshots in the case ADAPTIVE_GRAVSOFT is set.

Anyway that's what I make of it : )

kind regards,


Yves Revaz wrote:
> Hi Florian,
> One possibility could be simply to extend the number of type to a value
> higher than 6.
> Unfortunately in the code the number of type is not coded by a constant
> but by
> the number 6, so you will have to change this value in a lot of places
> in the code :-( .
> Then of course, you will have to add new parameters in the gadget param
> file,
> corresponding to the new types (and read them correctly in begrun.c and
> set_softenings in gravtree.c).
> SofteningGas
> SofteningHalo
> SofteningDisk
> SofteningBulge
> SofteningStars
> SofteningBndry
> SofteningXxxx
> etc...
> SofteningGasMaxPhys
> SofteningHaloMaxPhys
> SofteningDiskMaxPhys
> SofteningBulgeMaxPhys
> SofteningStarsMaxPhys
> SofteningBndryMaxPhys
> SofteningXxxxMaxPhys
> etc...
> Be also carefull to the way the snapshot header will be written, as
> npart (and npartTotal)
> will have a larger size.
> I hope it will help,
> yves
> Florian Beutler wrote:
>> hello
>> I am working with a DM halo containing particles with different mass (shell model). I would like to have different softening values for particles with different mass. The softening value is connected to the particle type therefore I am using particle types 1-5 for halo particles (I think these particle types are all collisionless and I can use them all as halo type particles... or am I wrong?). Is there any possibility to extend the particle types to more then 5?
>> thanks and regards
>> Florian Beutler

-- Eagles may soar, but weasels don't get sucked into jet engines.

If you wish to unsubscribe from this mailing, send mail to with a subject of:  unsubscribe gadget-list
A web-archive of this mailing list is available here:
Received on 2009-05-27 12:19:07

This archive was generated by hypermail 2.3.0 : 2023-01-10 10:01:31 CET