Hello everybody! A pleasure to be on this board.

My problem is as follows: As part of a molecular dynamics simulation on a simple system, I already have a basic open source MD-program. Thing is though, I need to edit it to be able to do one more thing. The experiment itself is carried out in a cubic box, where atoms float around happily. For the experiment, I need the density function in one single coordinate, which is akin to placing two sheets of paper inside the box, and counting how many atoms are in between.

Now, I am aware that the problem will probably go into the differential region, and that I will probably have to integrate something (that much mathematics even a chemist like me knows ), but I lack the knowledge of how I could do this, or how I could implement it.

My idea so far was to simply let the computer literally "count" how many of the atoms have an x-coordinate between two numbers (say: 3 and 3.1), but this is a computational disaster and absolutely inadequate to do statistics.

(For those who are interested: The experiment I am trying to reproduce is "Surface structure of a liquid film", M. Rao and D. Levesque, 1976. The paper is very nice and fluid to read, but they unfortunately don't mention the formula by which they calculated the surface density profile, or I have overlooked it.)

I hope somebody can help me out.

Thanks very much in advance.