Converting LIGGGHTS file to csv/matlab matrices directly

Submitted by siddharth.kanungo93 on Thu, 08/20/2015 - 16:18

I am interested in using matlab matrices for post processing the data. Right now, I am converting the LIGGGHTS documents to VTK, using paraview I am exporting to CSV and using a numpy script I am converting to matlab matrices. I was wondering there was a way to directly convert the Liggghts file into CSV/Matlab Matrices.

Thanks
SIddharth

aaigner's picture

aaigner | Wed, 09/02/2015 - 14:09

You can write a Matlab script (or better a function) to read dump-files and return the matrix. I did something similar years ago, but don't ask me for the code. This one I may not share.

Happy coding ... ;-)
Andreas

Vu Viet Dung's picture

Vu Viet Dung | Wed, 12/02/2015 - 00:23

You can write code matlab to begin from Liggghts extract to .txt format ---> matrice by Matlab. Code Matlab can be "fopen -- fread---fclose--strrep---str2num"
Best regards
Vu

Vu Viet Dung

zumack | Wed, 01/02/2019 - 12:35

Do you know Matlab could read binary txt file?

It seems LIGGGHTS dump files in binary, and Matlab needs the txt file should be in ACSII

mschramm | Tue, 02/19/2019 - 19:45

Hello,
LIGGGHTS can dump as a binary but it normally dumps as a text file.
What command are you using for your dumps?
It should be similar to
dump dmp all custom 1000 post/dump*.liggghts id mol type x y z vx vy vz fx fy fz omegax omegay omegaz radius

Matlab could read a binary file but you would need to know the format of the binary file.
As far as I know, no one has made a script for MATLAB/Octave that reads liggght binary dump files.