nemo icon indicating copy to clipboard operation
nemo copied to clipboard

Use falcON as a library - for vectors

Open krobsp opened this issue 3 years ago • 7 comments

Hi all I plan to use NEMO and falcON as a library, especially for estimating gravitational potentials with Dehnen algorithm. But my particles are not in NEMO snapshot format: they are rather stored in a N-vector of 6-vectors. Is there a way to use falcON tools directly on this array or should I have to convert it to a NEMO snapshot file then call falcON tools on it (which would be extremely exhausting:-)) Thanks

krobsp avatar Aug 26 '22 13:08 krobsp

It's going to depend what you need to do, do you just need the potentials and want to do other things in your own code? How many particles are we talking about? Here's an example using the unix command line to get the potentials of all particles, i'm using a NEMO plummer sphere as input, but you can also use tabtos to convert your ascii format so that gyrfalcON can read it:

      mkplummer - 1000 | gyrfalcON - p1k.out tstop=0 eps=0.05 kmax=8 give=mxvpa
      snapprint p1k.out  phi   > p1k.potentials.tab

sadly gyrfalcON cannot pipe the info into snapprint

teuben avatar Aug 26 '22 14:08 teuben

I do believe some people have been able to use falcON as a library, your main() will be in C++.

teuben avatar Aug 26 '22 14:08 teuben

Thank you for your answer Yes, I need the potentials (with falcON) and then I am computing stuff with them, in cpp. There is about one million halos of 1e3-1e4 particles

krobsp avatar Aug 26 '22 14:08 krobsp

Just a million is still "small enough", you could quite possibly use the ascii route to avoid having to build your potential getter.

tabtos took me 0.4sec to convert 1M partiles to snapshot format for gyrfalcON gyrfalcON took 1.4sec to compute the potentials snapprint took 0.2sec to dump 1M potentials to a table for you to read again.

teuben avatar Aug 26 '22 14:08 teuben

OK, I will try that. Thank you for the help ! If, in the future, there is a way to interface falcON (and NEMO) with usual std structures, it would be very useful I think

krobsp avatar Aug 26 '22 14:08 krobsp

Your note is a great way to catalog this idea. If I know a better example, I'll let you know. I know of one or two projects that use falcOn via python i believe.

teuben avatar Aug 26 '22 14:08 teuben

You can use also falcON from python program (python 3.9 max so far ) : see https://pypi.org/project/python-unsiotools/

jcldc avatar Aug 26 '22 14:08 jcldc