VasiliBaranov / packing-generation

Hard-sphere packing generation in C++ with the Lubachevsky–Stillinger, Jodrey–Tory, and force-biased algorithms and packing post-processing.
MIT License
106 stars 43 forks source link

read the output file #31

Closed sajadmhmzd closed 2 years ago

sajadmhmzd commented 2 years ago

Hi, how can i read the output file (.xyzd file)? it seem in binary format and i dont know how read it as a x y z coordinate.

VasiliBaranov commented 2 years ago

Hi,

It depends on the language you are most comfortable with.

Please see this discussion: https://github.com/VasiliBaranov/packing-generation/issues/16

One option from this link is:

hexdump -v -e '4 "%f "' -e '"\n"' < packing.xyzd > centers_in_ascii.txt

Someone posted a python code here: https://github.com/VasiliBaranov/packing-generation/issues/30

Just reading the file as it is in python is:

import numpy as np packing = np.fromfile('packing.xyzd').reshape(-1, 4)

Hope this helps!

Best Regards, Vasili