4.0

4.0 | 1 rating Rate this file 12 Downloads (last 30 days) File Size: 5.08 KB File ID: #46576

radialDistribution2D.m

by

 

11 May 2014 (Updated )

calculates radial Distribution in 2D

| Watch this File

File Information
Description

input:
% ~~~~~~
% switchVal - operation of the finction
% initialize=0;
% sample=1;
% results=2;
% plot = 3;
%
% gR - the output struct contaning the histogram
% (shuold be created with "gR = struct;" before initialization
%
% coords - x,y coordinates of partical centers
% first row x, second row y
%
% Lx - x size of area to calculate
% Ly - y size of area to calculate
%
% NumOfBins - number of bins in the final histogram
%
% output:
% ~~~~~~~
% gR is a histogram struct contaning:
% gR.count - total number of object counted
% gR.range - x axis range for the histogram
% gR.increment - increment of x axis
% gR.saveFileName - name of saved dat file
%
% method:
% ~~~~~~~
% the RDF is calculated by binnig all pair partical distances into
% a histogram, and normalizing each bin with it's Ideal gas number of
% particals.
% when binning the pair distances, we take into acount Periodic
% Boudary Conditions (PBC)
% finaly, to ansure that when r->infinity : RDF ->1 , we
% normalize by multiplying RDF*2/(N-1) where N is the number of
% particals.
% for more information http://www2.msm.ctw.utwente.nl/sluding/TEACHING/APiE_Script_v2011.pdf
% page 48 - "Radial distribution function"
      
      -------
    |important|
      -------
      this function uses the functions "histogram", "distPBC2D"
      "histogram" can be found here: http://www.cchem.berkeley.edu/chem195/histogram_8m.html#aedd379efd57ae78820ad8787bfab0cce
     "distPBC2D" can be found here: http://www.mathworks.com/matlabcentral/fileexchange/46575-distpbc2d-m

MATLAB release MATLAB 8.2 (R2013b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
16 Nov 2014 Cesar Garcia

Hi, thank you for the code. I have a question related with it. How can i make to plot the RDF gotten by the code, i´m having problems to run the code. I'll appreciate all your help.
Best Regards

Updates
12 May 2014

just changed the description

Contact us