Hello all,
I am performing simulations to measure the osmotic pressure of a system of hard spheres. The setup looks like:
where the red planes represent semipermeable walls that act only on the red particles. Blue particles are free to move in all of the simulation cell. Both particle types have the same size (range of hard-core repulsion) but red ones are pictured larger for clarity.
I use compute stress/cartesian
to get the pressure profile in the x-direction. However, I noticed that the density profile calculated by it shows an anomalous behaviour near the periodic boundaries. As an example, the density profile of the above pictured system, with lx=120
and a bin size of 5 for the compute stress/cartesian
gives:
The “bump” in the middle of the plot is the expected consequence of osmotic pressure. The problem is encountered near the system boundary, where you can see that on the left side there is a sudden increase in density, balanced out by a sudden decrease on the right. It looks like some particles belonging to the right-most bin are considered a part of the left-most one, leading to this imbalance.
This behavior is consistently present in all the examples I run. I made sure that the bin center positions are placed correctly, in the sense that the left-most and right-most bins start and finish at the edge of the simulation box respectively.
Any ideas are welcome,
Christos