Author: bugman Date: Wed Feb 13 17:05:13 2008 New Revision: 4983 URL: http://svn.gna.org/viewcvs/relax?rev=4983&view=rev Log: The reduced CoM vector is now calculated. Modified: branches/N_state_model/specific_fns/n_state_model.py Modified: branches/N_state_model/specific_fns/n_state_model.py URL: http://svn.gna.org/viewcvs/relax/branches/N_state_model/specific_fns/n_state_model.py?rev=4983&r1=4982&r2=4983&view=diff ============================================================================== --- branches/N_state_model/specific_fns/n_state_model.py (original) +++ branches/N_state_model/specific_fns/n_state_model.py Wed Feb 13 17:05:13 2008 @@ -22,7 +22,7 @@ # Python module imports. from math import pi -from numpy import array, float64, zeros +from numpy import array, dot, float64, zeros from numpy.linalg import norm from re import search @@ -127,10 +127,24 @@ unit_vect = unit_vect / norm(unit_vect) print "The unit vector between the pivot and CoM is:\n" + `unit_vect` + "\n" - # Generate the rotation matrices. - self.R = zeros((cdp.N,3,3), float64) + # Initilise some data structures. + R = zeros((3,3), float64) + vectors = zeros((cdp.N,3), float64) + + # Loop over the N states. for c in xrange(cdp.N): - rotation_matrix_zyz(self.R[c], cdp.alpha[c], cdp.beta[c], cdp.gamma[c]) + # Generate the rotation matrix. + rotation_matrix_zyz(R, cdp.alpha[c], cdp.beta[c], cdp.gamma[c]) + + # Rotate the unit vector. + vectors[c] = dot(R, unit_vect) + + # Multiply by the probability. + vectors[c] = vectors[c] * cdp.probs[c] + + # Total weighted vector. + vect = sum(vectors) + print "The reduced CoM vector is:\n" + `vect` + "\n" raise NameError, "hello"