Hello!
I'm interested in computer simulation of molecular systems, especially liquids. Maybe some would say Haskell is far from best choice in the case, but I really like the ease of writing programs in Haskell.
So I wonder of existing projects of such type, both Molecular dynamics and Monte Carlo methods. I've got also some technical questions. Now I'm using 2D DiffUArray to represent particle positions during the simulation (when there are lots of array updates). Is this reasonably fast (I want to use pure external interface of DiffArray)?
During the simulation each nth cycle the current position is stored for further processing. I haven't done this stage yet. To store the position I'm going to turn DiffUArray to UArray and write it in the file using tools of Data.Binary. Unfortunately I failed to produce the working code to write lots of 2D UArrays and then to read them. I know how to write several arrays in a file, but not how to read them back. Could someone please help me? Just to show how I've thought of storing several arrays in one file:
import Data.Array.Unboxed
import Data.Binary
import qualified Data.ByteString.Lazy as BL
a = listArray ((1,1),(3,2)) [3,4,5,6,7,8] :: UArray (Int, Int) Float
b = listArray ((1,1),(3,2)) [9,10,11,12,13,14] :: UArray (Int, Int) Float
encodeFile2 f = BL.appendFile f . encode
run = do encodeFile "Results.txt" a
ššš šencodeFile2 "Results.txt" b