[Numpy-discussion] Even Sphere Volume

Markus Rosenstihl markus.rosenstihl@physik.tu-darmstadt...
Fri Jul 10 03:04:29 CDT 2009


Here is a different one, based on the ZCW  (Zaremba, Conroy,  
Wolfsberg) algorithm used for powder spectra to equally distribute  
points over a sphere surface:
This paper gives an nice overview (I think I took the actual algorithm  
from there):

Computer simulations in solid-state NMR. III. Powder averaging
M. Edén
Concepts in Magnetic Resonance Part A  18A  24-55  (2003)
http://dx.doi.org/10.1002/cmr.a.10065



############# Fibonacci number generator ##################    	
def fib(n):
	"""
	From http://en.literateprograms.org/Fibonacci_numbers_(Python)
	Returns (n+2)-th and n-th fibonacci number
	"""
	if n > 90:
		raise ValueError,"Can't represent higher numbers!"
	start = N.array([[1,1],[1,0]],dtype='int64')
	temp = start[:]
	for i in xrange(n):
		temp = N.dot(start,temp)
	return temp[0,0],temp[0,1],temp[1,1]
		


############# ZCW Angles ##########
def zcw_angles(m):
	"""
	Getting N=fibonacchi(m) numbers of ZCW angles
	
	"""

	samples, fib_1, fib_2 = fib(m)
	#fib_2 = fib_1
	print "Using %i Samples"%samples
	
	js = N.arange(samples, dtype='Float64')/samples
	
	c_full = (1.,2.,1.)
	c_hemi = (-1.,1.,1.)
	c_oct  = (2.,1.,8.)

	c = c_full
	
	j_samples = fib_2*js
	# alpha
	phi = 2*N.pi/c[2] * N.mod(j_samples,1.0)
	# beta
	theta = N.arccos(c[0]*(c[1]*N.mod(js,1.0) - 1))
	# weights
	weight = N.ones(samples)/samples
	return phi,theta,weight



Here is a interesting one, REPULSION:

REPULSION, A Novel Approach to Efficient Powder Averaging in Solid- 
State NMR
M. Bak and N. C. Nielsen
Journal of Magnetic Resonance  125  132--139  (1997)
http://www.sciencedirect.com/science/article/B6WJX-45N4XS2-J/1/58bb5f6971e8a76ab01a17e2794f98b7
A novel approach to efficient powder averaging in magnetic resonance  
is presented. The method relies on a simple numerical procedure which  
based on a random set of crystallite orientations through simulation  
of fictive intercrystallite repulsive forces iteratively determines a  
set of orientations uniformly distributed over the unit sphere. The so- 
called REPULSION partition scheme is compared to earlier methods with  
respect to the distribution of crystallite orientations, solid angles,  
and powder averaging efficiency. It is demonstrated that powder  
averaging using REPULSION converges faster than previous methods with  
respect to the number of crystallite orientations involved in the  
averaging. This feature renders REPULSION particularly attractive for  
calculation of magic-angle-spinning solid-state NMR spectra using a  
minimum of crystallite orientations. For numerical simulation of  
powder spectra, the reduced number of required crystallite  
orientations translates into shorter computation times and simulations  
less prone to systematic errors induced by finite sets of nonuniformly  
distributed crystallite orientations.


--
"A program that produces incorrect results twice as fast is infinitely  
slower." -- John Osterhout



More information about the NumPy-Discussion mailing list