subroutine aptsciz (au, av, aw) ccbeg. cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c SUBROUTINE APTSCIZ c c call aptsciz (au, av, aw) c c Version: aptsciz Updated 1991 July 26 11:40. c aptsciz Originated 1991 July 26 11:40. c c Author: Arthur L. Edwards, LLNL, L-298, Telephone (925) 422-4123. c c c Purpose: To randomly sample a unit direction vector a = (au, av, aw), c isotropically in 3-D space. c This is a simplified scalar version of aptscat. c c Input: None. c c Output: au, av, aw. c c Glossary: c c au,av,aw Output The u, v and w components of a unit vector randomly c sampled isotropically in 3-D space, where u, v and w c may be any three orthogonal directions. c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc ccend. c.... Local variables. c---- Normalization factor, 3-D. common /laptsciz/ fact c---- Normalization factor, 2-D. common /laptsciz/ sumsq cbugc***DEBUG begins. cbug common /laptsciz/ sumsqs cbug 9901 format (/ 'aptsciz scattering isotropically.') cbug write (3, 9901) cbugc***DEBUG ends. c.... Randomly sample a unit vector "a" isotropically in 3-D space. 100 au = 1.0 - 2.0 * ranf( ) av = 1.0 - 2.0 * ranf( ) c---- Another random number. sumsq = au**2 + av**2 if (sumsq .gt. 1.0) go to 100 fact = 2.0 * sqrt (1.0 - sumsq) au = au * fact av = av * fact aw = 1.0 - 2.0 * sumsq cbugc***DEBUG begins. cbug 9902 format (/ 'aptsciz results:' / cbug & ' au,av,aw=',1p3e22.14 / cbug & ' sumsq= ',1pe22.14) cbug sumsqs = au**2 + av**2 + aw**2 cbug write ( 3, 9902) au, av, aw, sumsqs cbugc***DEBUG ends. return c.... End of subroutine aptsciz. (+1 line.) end UCRL-WEB-209832