Monte Carlo Simulation of a liquid - Need help computing g(r)

In summary, the author is trying to compute the radial distribution function, but is having trouble because the function is very non-smooth. He is using an algorithm similar to the one described in the literature, but with a different approach for dealing with unbalanced g(r) values.
  • #1
JRPB
22
0
EDIT: I'm not in my sharpest moment. I just found a bunch of posts that discuss this. I'll read them and update this post if I find an answer.

I'm working on a hard-sphere MC simulation (for a class). I want to compute the radial distribution function [itex]g(r)[/itex]. To put you in context, as to my non-expertise in statistical mechanics, I'm a physics senior undergrad taking the last couple of courses.

My program generates valid states for a non-periodic square box. States are computed with a restricted random walker: particles stay inside the box and do not overlap each other. I want to compute thermodynamic quantities. My ignorance led me to believe (taking equiprobability of micro-states for granted) that sampling such states is equivalent to working with an NVE ensemble. I asked one of my professors about this connection and realized that it's not that simple.

I learned that you can use the RDF to compute some of these quantities. This leads me to my current predicament. How do I compute this function? I tried the literature and couldn't make heads or tails of the definition. As a stab-in-the-dark I tried my own method to see if I could reproduce some of the good looking RDFs around. I came up with an RDFesque function. Far from smooth.

My algorithm:

1) Surround the box with 8 replicas (same particle state, just displaced)
2) Pick a random particle from the original set
3) Compute the maximum circumference (centered at the particle) that fits inside the 9 boxes.
4) Create a circular shell of radii: r, r+dr and count all the particles' centers that lie within this shell.
5) Divide this number by the shell's area
6) Repeat from step 2 and average over N calculations

Attached is an image of my result. The labels are in spanish (it's still pretty clear what is what). The top right chart is a time series of the accept-rate of my random walker. Ignore the x-scale on the g(r). I'm plotting distance from particle v.s. g(r). I tested different shell widths [itex]dr[/itex]. [itex]\frac{\sigma}{10}[/itex] seems ok. Anything smaller gets noisy very fast.

Any suggestions or pointers to references on how to correctly implement this will be greatly appreciated.
 
Physics news on Phys.org
  • #2
I don't know that this will help, but the radial distribution function is just simply a tally of the number of particles surrounding each of the particles in a system, from right next to particle to a large distance off it.

For a liquid, like a Lennard-Jones model fluid or something like it, what is typically done is the create the tally for each of the particles and average the tallies. This gives more smoother RDF.

Your statement will be something like this, if a particle center is within r and r+dr to the particle you are computing the radial distribution function for, tally = tally + 1 . There are some averaging schemes were you can perform the averaging as you go, otherwise you can you just add all the tallies together and divide by N-number of particles.

This is roughly what the RDF is.
 
  • #3
klawlor419 said:
I don't know that this will help, but the radial distribution ...
This is roughly what the RDF is.

Thanks for the explanation. I'll post the solution for anyone interested (as soon as I finish it, I have some school work I have to catch up to first)
 
  • #4
Update

This is an update on my progress. I found an undergrad thesis work on hard disks, I read it and got a much better looking g(r). It still needs improvement. I'm calculating shells+neighbors for the entire set of disks. Which obviously leaves me with some very unbalanced g(r)'s to average over (those disks near the edges of the box will have half-empty shells -or half-full, aha!-).

I thought about adding clones of the simulation box and surround the orginal one. And THEN survey the one box. However, I'm afraid it'll induce bogus results because of the noticeable structure that border effects create. Any stats. mechs. with useful suggestions?

Attachment: an example run of my simulator.
 

Attachments

  • gdr.png
    gdr.png
    5.7 KB · Views: 408
  • tablero.png
    tablero.png
    30.4 KB · Views: 420
  • aceptacion.png
    aceptacion.png
    6.6 KB · Views: 404
  • #5
Alright. What I was trying to do won't work well on a non-periodic box. I got a suggestion (from an experienced Stat. Mech.) to calculate a density profile instead of the g(r). Something along the lines of: count how many particles are in your grid's cells, add up over entire simulation, normalize and fit a polynomial whose "contact value" (at x = 0) is a decent estimate of the pressure in the bulk.

Repeating over different volume fractions one could, in principle, sample points from the equation of state of the "hard disk fluid". That's it for me, I won't be posting more updates (I'm taking a different path).
 

Related to Monte Carlo Simulation of a liquid - Need help computing g(r)

What is Monte Carlo simulation?

Monte Carlo simulation is a computational technique used to model and simulate complex systems or processes that involve randomness or uncertainty. It involves running multiple simulations with random inputs to generate a probability distribution of possible outcomes.

How does Monte Carlo simulation work?

In Monte Carlo simulation, a large number of random samples are generated for the variables in the system being studied. These samples are used to calculate the probability of different outcomes and determine the most likely or expected result.

What is the purpose of Monte Carlo simulation in the study of liquids?

In the study of liquids, Monte Carlo simulation can be used to calculate the pair correlation function (g(r)), which describes the probability of finding two particles at a certain distance from each other. This can provide valuable insights into the structure and behavior of liquids.

What is the significance of computing g(r) in a liquid?

Computing g(r) in a liquid allows for the analysis of the spatial arrangement of particles and the identification of any ordering or clustering behaviors. This information can be used to understand the physical properties of the liquid and make predictions about its behavior under different conditions.

What are the challenges in computing g(r) using Monte Carlo simulation?

Some challenges in computing g(r) using Monte Carlo simulation include choosing the appropriate simulation parameters, ensuring accurate sampling of the system, and dealing with any computational limitations. It is also important to properly analyze and interpret the results to draw meaningful conclusions.

Similar threads

Replies
0
Views
2K
  • Atomic and Condensed Matter
Replies
3
Views
1K
  • Programming and Computer Science
Replies
1
Views
817
  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • Mechanics
Replies
2
Views
1K
  • High Energy, Nuclear, Particle Physics
Replies
9
Views
2K
  • Calculus and Beyond Homework Help
Replies
1
Views
4K
  • Advanced Physics Homework Help
Replies
1
Views
1K
  • Programming and Computer Science
Replies
4
Views
1K
Back
Top