Changeset 936 for trunk/GSASIImath.py
- Timestamp:
- May 30, 2013 9:05:36 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIImath.py
r934 r936 283 283 return XYZ,Cart 284 284 285 def UpdateMCSAxyz(Bmat, mcsaModels,RBData):285 def UpdateMCSAxyz(Bmat,MCSA): 286 286 xyz = [] 287 287 atTypes = [] 288 288 iatm = 0 289 for model in mcsaModels[1:]: #skip the MD model289 for model in MCSA['Models'][1:]: #skip the MD model 290 290 if model['Type'] == 'Atom': 291 291 xyz.append(model['Pos'][0]) … … 293 293 iatm += 1 294 294 else: 295 rideList = [] 296 RBRes = RBData[model['Type']][model['RBId']] 295 RBRes = MCSA['rbData'][model['Type']][model['RBId']] 297 296 Pos = np.array(model['Pos'][0]) 298 297 Qori = np.array(model['Ori'][0]) … … 309 308 for ride in seq[3]: 310 309 Cart[ride] = prodQVQ(QuatA,Cart[ride]-Cart[seq[1]])+Cart[seq[1]] 311 rideList += seq[3] 312 centList = set(range(len(Cart)))-set(rideList) 313 if model['MolCent']: 314 cent = np.zeros(3) 315 for i in centList: 316 cent += Cart[i] 317 Cart -= cent/len(centList) 310 if model['MolCent'][1]: 311 Cart -= model['MolCent'][0] 318 312 for i,x in enumerate(Cart): 319 313 xyz.append(np.inner(Bmat,prodQVQ(Qori,x))+Pos) … … 322 316 iatm += 1 323 317 return np.array(xyz),atTypes 318 319 def SetMolCent(model,RBData): 320 rideList = [] 321 RBRes = RBData[model['Type']][model['RBId']] 322 if model['Type'] == 'Vector': 323 vecs = RBRes['rbVect'] 324 mags = RBRes['VectMag'] 325 Cart = np.zeros_like(vecs[0]) 326 for vec,mag in zip(vecs,mags): 327 Cart += vec*mag 328 elif model['Type'] == 'Residue': 329 Cart = np.array(RBRes['rbXYZ']) 330 for seq in RBRes['rbSeq']: 331 rideList += seq[3] 332 centList = set(range(len(Cart)))-set(rideList) 333 cent = np.zeros(3) 334 for i in centList: 335 cent += Cart[i] 336 model['MolCent'][0] = cent/len(centList) 324 337 325 338 def UpdateRBUIJ(Bmat,Cart,RBObj):
Note: See TracChangeset
for help on using the changeset viewer.