[Camino-users] How should I read a trajectory file in Python?

Sidsel Winther sidselbw at drcmr.dk
Mon Nov 27 08:11:24 PST 2017


How should I read a trajectory file (big-endian binary file containing 
mixed types) in Python?

I know that the file has this format:

Header:

|dynamics duration (double)number of spins (double)tmax (double)|

Data (one line per spin per update):

|time (double)spin index (int)spin x (double)spin y (double)spin z (double)|

(double refers to a signed double-precision 8-byte floating point 
number. int refers to a signed, 32bit (4 byte) integer.)

I am currently trying:

|fori inrange(15):printstruct.unpack('>f',file.read(4))[0]|

But the data I read out does not make sense...

How should I do instead?

Best,

Sidsel


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.nitrc.org/pipermail/camino-users/attachments/20171127/7001fcba/attachment-0001.html>


More information about the Camino-users mailing list