Changeset 2858
- Timestamp:
- Jun 5, 2017 9:12:03 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIImath.py
r2854 r2858 101 101 s = np.where(s>cutoff,1./s,0.) 102 102 nzero = s.shape[0]-np.count_nonzero(s) 103 res = np.dot(np.transpose(vt), np.multiply(s[:, np.newaxis], np.transpose(u))) 103 # res = np.dot(np.transpose(vt), np.multiply(s[:, np.newaxis], np.transpose(u))) 104 res = np.dot(vt.T,s[:,nxs]*u.T) 104 105 return res,nzero 105 106 … … 224 225 try: 225 226 Bmat,Nzero = pinv(Amatlam,xtol) #Moore-Penrose inversion (via SVD) & count of zeros 226 print 'Found %d SVD zeros'%(Nzero) 227 if Print: 228 print 'Found %d SVD zeros'%(Nzero) 227 229 # Bmat = nl.inv(Amatlam); Nzeros = 0 228 230 Bmat = Bmat/Anorm … … 2570 2572 ############################################################################### 2571 2573 2572 def validProtein(Phase): 2573 resNames = ['ALA','ARG','ASN','ASP','CYS','GLN','GLU','GLY','HIS','ILE', 2574 'LEU','LYS','MET','PHE','PRO','SER','THR','TRP','TYR','VAL','MSE'] 2575 print 'Do VALIDPROTEIN analysis - TBD' 2576 General = Phase['General'] 2577 Amat,Bmat = G2lat.cell2AB(General['Cell'][1:7]) 2578 cx,ct,cs,cia = General['AtomPtrs'] 2579 Atoms = Phase['Atoms'] 2580 cartAtoms = [] 2581 chains = [] 2582 for atom in Atoms: 2583 if atom[2] in resNames: 2584 cartAtoms.append(atom[:cx+3]) 2585 if atom[2] not in chains: 2586 chains.append(atom[2]) 2587 cartAtoms[-1][cx:cx+3] = np.inner(Amat,cartAtoms[-1][cx:cx+3]) 2574 def validProtein(Phase): 2575 resNames = ['ALA','ARG','ASN','ASP','CYS','GLN','GLU','GLY','HIS','ILE', 2576 'LEU','LYS','MET','PHE','PRO','SER','THR','TRP','TYR','VAL','MSE'] 2577 # data taken from erratv2.ccp 2578 lmt = np.array([17.190823041860433,11.526684477428809]) 2579 b1 = np.array([ [0,0,0,0,0,0], 2580 [0, 5040.279078850848200, 3408.805141583649400, 4152.904423767300600, 4236.200004171890200, 5054.781210204625500], 2581 [0, 3408.805141583648900, 8491.906094010220800, 5958.881777877950300, 1521.387352718486200, 4304.078200827221700], 2582 [0, 4152.904423767301500, 5958.881777877952100, 7637.167089335050100, 6620.715738223072500, 5287.691183798410700], 2583 [0, 4236.200004171890200, 1521.387352718486200, 6620.715738223072500, 18368.343774298410000, 4050.797811118806700], 2584 [0, 5054.781210204625500, 4304.078200827220800, 5287.691183798409800, 4050.797811118806700, 6666.856740479164700]]) 2585 avg = np.array([0.192765509919262, 0.195575208778518, 0.275322406824210, 0.059102357035642, 0.233154192767480]) 2586 General = Phase['General'] 2587 Amat,Bmat = G2lat.cell2AB(General['Cell'][1:7]) 2588 cx,ct,cs,cia = General['AtomPtrs'] 2589 Atoms = Phase['Atoms'] 2590 cartAtoms = [] 2591 chains = [] 2592 chainBeg = [] 2593 xyzmin = 999.*np.ones(3) 2594 xyzmax = -999.*np.ones(3) 2595 for atom in Atoms: 2596 if atom[1] in resNames: 2597 cartAtoms.append(atom[:cx+3]) 2598 if atom[2] not in chains: 2599 chains.append(atom[2]) 2600 chainBeg.append(len(cartAtoms)-1) 2601 cartAtoms[-1][cx:cx+3] = np.inner(Amat,cartAtoms[-1][cx:cx+3]) 2602 XYZ = np.array([atom[cx:cx+3] for atom in cartAtoms]) 2603 xyzmin = np.array([np.min(XYZ.T[i]) for i in [0,1,2]]) 2604 xyzmax = np.array([np.max(XYZ.T[i]) for i in [0,1,2]]) 2605 nbox = list(np.array(np.ceil((xyzmax-xyzmin)/4.),dtype=int))+[15,] 2606 Boxes = np.zeros(nbox,dtype=int) 2607 iBox = np.array([np.trunc((XYZ.T[i]-xyzmin[i])/4.) for i in [0,1,2]],dtype=int).T 2608 for ib,box in enumerate(iBox): #put in a try for too many atoms in box (IndexError)? 2609 Boxes[box[0],box[1],box[2],0] += 1 2610 Boxes[box[0],box[1],box[2],Boxes[box[0],box[1],box[2],0]] = ib 2611 pstat = 0. 2612 stat = 0. 2613 mtrxstat = 0. 2614 for ia,atom in cartAtoms: 2615 if not i: #skip 1st atom 2616 continue 2617 if atom[0] != cartAtom[ia-1][0]: #new residue - start analysis 2618 c = np.zeros((3,3)) 2619 s = 1 2620 2621 print 'Do VALIDPROTEIN analysis - TBD' 2588 2622 2589 2623 -
trunk/GSASIIstrMath.py
r2838 r2858 437 437 pWnum[name] += 1 438 438 pWsum['PWLref'] = 0. 439 pWnum[ name] = 0439 pWnum['PWLref'] = 0 440 440 for item in varyList: 441 441 if 'PWLref' in item and parmDict[item] < 0.: … … 446 446 pWt.append(negWt[pId]) 447 447 pWsum['PWLref'] += negWt[pId]*(parmDict[item])**2 448 pWnum[ name] += 1448 pWnum['PWLref'] += 1 449 449 pVals = np.array(pVals) 450 450 pWt = np.array(pWt) #should this be np.sqrt? -
trunk/imports/G2phase.py
r2840 r2858 130 130 S[12:17].strip(),Type.strip().capitalize(),'',XYZ[0],XYZ[1],XYZ[2], 131 131 float(S[55:61]),SytSym,Mult,'I',Uiso,0,0,0,0,0,0] 132 Atom.append(ran.randint(0,sys.maxint)) 133 Atoms.append(Atom) 132 if S[16] in [' ','A']: #remove disorered residues - can't handle them just now 133 Atom[3] = Atom[3][:3] 134 Atom.append(ran.randint(0,sys.maxint)) 135 Atoms.append(Atom) 134 136 elif 'ANISOU' in S[:6]: 135 137 Uij = S[30:72].split()
Note: See TracChangeset
for help on using the changeset viewer.