Editing Random vector on a sphere

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 2: Line 2:
or molecular systems.
or molecular systems.
==Marsaglia algorithm==  
==Marsaglia algorithm==  
This is the algorithm proposed by George Marsaglia <ref name="Marsaglia">[http://dx.doi.org/10.1214/aoms/1177692644 George Marsaglia "Choosing a Point from the Surface of a Sphere", The Annals of Mathematical Statistics '''43''' pp. 645-646 (1972)]</ref>
This is the algorithm proposed by George Marsaglia (Ref. 1):
*Independently generate V<sub>1</sub> and V<sub>2</sub>, taken from a uniform distribution on (-1,1) such that  
*Independently generate V<sub>1</sub> and V<sub>2</sub>, taken from a uniform distribution on (-1,1) such that  
:<math>S=(V_1^2+V_2^2) < 1</math>
:<math>S=(V_1^2+V_2^2) < 1</math>
*The random vector is then (Eq. 4 in <ref name="Marsaglia"> </ref> ):
*The random vector is then (Ref. 1 Eq. 4):
:<math>\left(2V_1 \sqrt{1-S},~ 2V_2 \sqrt{1-S},~ 1-2S\right)</math>
:<math>\left(2V_1 \sqrt{1-S},~ 2V_2 \sqrt{1-S},~ 1-2S\right)</math>
==Fortran 90 implementation==
==Fortran 90 implementation==
This Fortran 90 implementation is adapted from Refs. <ref>[http://molsim.chem.uva.nl/frenkel_smit Daan Frenkel and Berend Smit "Understanding Molecular Simulation: From Algorithms to Applications", Second Edition (2002)] Algorithm 42 (p. 578)</ref> and <ref>[http://www.oup.com/uk/catalogue/?ci=9780198556459 M. P. Allen and D. J. Tildesley "Computer Simulation of Liquids", Oxford University Press (1989)] Appendix G.5 (p. 349) </ref>. The function '''ran()''' calls a  [[Random_numbers | randon number generator]]:
This Fortran 90 implementation is adapted from Ref. 2. The function '''ran()''' calls a  [[Random_numbers | randon number generator]]:
<small><pre>
<small><pre>
!    The following is taken from Allen & Tildesley, p. 349
!    The following is taken from Allen & Tildesley, p. 349
Line 40: Line 40:


==References==
==References==
<references/>
#[http://links.jstor.org/sici?sici=0003-4851%28197204%2943%3A2%3C645%3ACAPFTS%3E2.0.CO%3B2-%23 George Marsaglia "Choosing a Point from the Surface of a Sphere", The Annals of Mathematical Statistics '''43''' pp. 645-646 (1972)]
==External links==
#Daan Frenkel and Berend Smit "Understanding Molecular Simulation: From Algorithms to Applications" p. 410 Academic Press (1996)
*[http://mathworld.wolfram.com/SpherePointPicking.html Sphere Point Picking] from Wolfram MathWorld
# M. P. Allen  and D. J. Tildesley "Computer Simulation of Liquids", p. 349 Clarendon Press (1989)
{{Source}}
 
[[category: random numbers]]
[[category: random numbers]]
[[category: computer simulation techniques]]
[[category: computer simulation techniques]]
Please note that all contributions to SklogWiki are considered to be released under the Creative Commons Attribution Non-Commercial Share Alike (see SklogWiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Template used on this page: