Why do you need the output files in “txt” format? I assume you want the output files in a format that is easy to read.
Instead, I recommend you to use “SPLASH", which is a visualization package that can read Gadget2 binary files and create plots (you can learn a little bit about SPLASH here
https://astrobites.org/2011/06/11/running-your-first-sph-simulation/ <
https://astrobites.org/2011/06/11/running-your-first-sph-simulation/>)
Alternatively, you can use “yt”, which is also a visualization package, but this one is written in Python (
https://yt-project.org/doc/index.html <
https://yt-project.org/doc/index.html>)
I also have a script written in IDL and another one in C that read Gadget2 files and you can manipulate the data anyway you want. I can share them with you if you want. Of course, you need to know IDL or C.
Let me know if this helps.
Jesus
> On Sep 6, 2019, at 2:05 AM, Apashanka Das <a.das.cosmo_at_gmail.com> wrote:
>
> Sir as a newcomer to C programming language I find it very difficult to understand what modifications needs to be done ....sir for your kind assistance will you please suggest these modifications of write_file function in io.c file ,I have only halo particles (e.g type 2) and want 6 columns which contains x,y,z and vx,vy,vz respectively in .txt format...as I need it for immediate nature....
> Thanks,
> Apashanka
>
> On Fri 6 Sep, 2019, 1:20 PM Antonio Bibiano, <antbbn_at_gmail.com <mailto:antbbn_at_gmail.com>> wrote:
> There is a write_file function in the io.c source file, you might modify this one, but I think you might be better off saving the snapshot in the original format
> (just in case you might want to use some other tools on your simulations) and use some python library to read the particle position and velocities and save them in the format you prefer.
> Just search for something like "read gadget2 snapshot python" should return a bunch of libraries/repo of people doing that in python.
>
> Cheers,
> Antonio
>
> Il giorno ven 6 set 2019 alle ore 09:38 Apashanka Das <a.das.cosmo_at_gmail.com <mailto:a.das.cosmo_at_gmail.com>> ha scritto:
> Hello,
> After running Gadget-2 the snapshot files are in binary format ,but if it has to be converted into .txt format containing 6 columns (x,y,z,vx,vy,vz) then what are the modifications that needs to be done in the file read_snapshot.c ,can anyone please suggest......
> Thanks,
> Apashanka
>
> -----------------------------------------------------------
>
> 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:
> http://www.mpa-garching.mpg.de/gadget/gadget-list
Received on 2019-09-08 09:37:29