The information that must be stored and handled in an MC program are
the particle positions. In 3D space, each particle has three
components of its position. The simplest way to represent this
information in a program is by using parallel arrays; that is,
three arrays, dimensioned from 1 to , one for each dimension. In
FORTRAN and C, we might declare these arrays for 1,000 particles as
In FORTRAN | In C | ||
|
|
This data can be stored in standard ASCII text files, or in
unformatted binary files. In fact, a large part of most molecular
simulation is producing and storing configurations which can be
processed ``offline'' (away from the simulation program) to perform
analyses. A code fragment to write a configuration of atoms appears
below:
In FORTRAN | In C | ||
|
|
It's quite easy to read ASCII data in:
In FORTRAN | In C | ||
|
|