Commit 1e16cc4d by cmaffeo2

### Sped up minimizeRMSD when no weight is used

parent 3268d1e7
 ... ... @@ -48,17 +48,23 @@ def _minimizeRmsd(coordsB, coordsA, weights=None): shapeA,shapeB = [np.shape(X) for X in (A,B)] assert( shapeA == shapeB ) for X,s in zip((A,B),(shapeA,shapeB)): assert( s[1] == 3 and s[0] >= s[1] ) assert( s[1] == 3 and s[0] >= s[1] ) if weights is None: weights = np.ones(len(A)) assert( len(weights[:]) == len(B) ) W = np.diag(weights) # if weights is None: weights = np.ones(len(A)) if weights is None: comA,comB = [np.mean( X, axis=0 ) for X in (A,B)] else: assert( len(weights[:]) == len(B) ) W = np.diag(weights) comA,comB = [np.sum( W.dot(X), axis=0 ) / np.sum(W) for X in (A,B)] comA,comB = [np.sum( W.dot(X), axis=0 ) / np.sum(W) for X in (A,B)] A = np.array( A-comA ) B = np.array( B-comB ) s = A.T.dot(W.dot(B)) if weights is None: s = A.T.dot(B) else: s = A.T.dot(W.dot(B)) sxx,sxy,sxz = s[0,:] syx,syy,syz = s[1,:] ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!