Changeset 411
- Timestamp:
- Nov 11, 2011 2:14:35 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASII.py
r406 r411 639 639 name = wx.TextCtrl(panel,-1,item[1],size=wx.Size(200,20)) 640 640 name.SetEditable(False) 641 scale = wx.TextCtrl(panel,id, str(item[0]),style=wx.TE_PROCESS_ENTER)641 scale = wx.TextCtrl(panel,id,'%.3f'%(item[0]),style=wx.TE_PROCESS_ENTER) 642 642 scale.Bind(wx.EVT_TEXT_ENTER,self.OnScaleChange) 643 643 scale.Bind(wx.EVT_KILL_FOCUS,self.OnScaleChange) … … 680 680 if value and '-' not in value[0]: 681 681 print 'bad input - numbers only' 682 self.FindWindowById(id).SetValue('0.0 ')682 self.FindWindowById(id).SetValue('0.000') 683 683 684 684 def OnOk(self,event): … … 1479 1479 parmDict = {} 1480 1480 Histograms,Phases = self.GetUsedHistogramsAndPhasesfromTree() 1481 Natoms,phaseVary,phaseDict,pawleyLookup,FFtable = G2str.GetPhaseData(Phases,Print=False)1481 Natoms,phaseVary,phaseDict,pawleyLookup,FFtable,BLtable = G2str.GetPhaseData(Phases,Print=False) 1482 1482 hapVary,hapDict,controlDict = G2str.GetHistogramPhaseData(Phases,Histograms,Print=False) 1483 1483 histVary,histDict,controlDict = G2str.GetHistogramData(Histograms,Print=False) -
trunk/GSASIIElem.py
r409 r411 252 252 def ScatFac(El, SQ): 253 253 """compute value of form factor 254 @param El: element dictionary 254 @param El: element dictionary defined in GetFormFactorCoeff 255 255 @param SQ: (sin-theta/lambda)**2 256 256 @return: real part of form factor … … 261 261 return np.sum(fa[:,np.newaxis]*np.exp(t)[:],axis=0)+El['fc'] 262 262 263 def BlenFac(El,wave): 264 pass 265 266 # F(I) = BLEN(I) 267 # IF ( BFAN(1,I).NE.0.0 ) THEN 268 # EMEV = 81.80703/XRAY**2 269 # GAM2 = BFAN(4,I)**2 270 # T1 = EMEV-BFAN(3,I) 271 # D1 = T1**2+GAM2 272 # T2 = EMEV-BFAN(6,I) 273 # D2 = T2**2+GAM2 274 # T3 = EMEV-BFAN(8,I) 275 # D3 = T3**2+GAM2 276 # FP(I) = BFAN(1,I)*(T1/D1+BFAN(5,I)*T2/D2+BFAN(7,I)*T3/D3) 277 # FPP(I) = -BFAN(2,I)*(1.0/D1+BFAN(5,I)/D2+BFAN(7,I)/D3) 278 # ELSE 279 # FP(I) = 0.0 280 # FPP(I) = 0.0 281 # END IF 282 263 def BlenRes(BLdata,wave): 264 FP = [] 265 FPP = [] 266 Emev = 81.80703/wave**2 267 for BL in BLdata: 268 if len(BL) >= 6: 269 Emev = 81.80703/wave**2 270 G2 = BL[5]**2 271 T = [Emev-BL[4],0,0] 272 D = [T**2+G2,0,0] 273 fp = T/D 274 fpp = 1.0/D 275 if len(BL) == 8: 276 T = Emev-BL[7] 277 D = T**2+G2 278 fp += BL[6]*T/D 279 fpp += BL[6]/D 280 if len(BL) == 10: 281 T = Emev-BL[9] 282 D = T**2+G2 283 fp += BL[8]*T/D 284 fpp += BL[8]/D 285 FP.append(BL[2]*fp) 286 FPP.append(-BL[3]*fpp) 287 else: 288 FP.append(0.0) 289 FPP.append(0.0) 290 return np.array(FP),np.array(FPP) 283 291 284 292 def ComptonFac(El,SQ): -
trunk/GSASIIgrid.py
r408 r411 783 783 Histograms,Phases = self.GetUsedHistogramsAndPhasesfromTree() 784 784 AtomDict = dict([Phases[phase]['pId'],Phases[phase]['Atoms']] for phase in Phases) 785 Natoms,phaseVary,phaseDict,pawleyLookup,FFtable = G2str.GetPhaseData(Phases,Print=False)785 Natoms,phaseVary,phaseDict,pawleyLookup,FFtable,BLtable = G2str.GetPhaseData(Phases,Print=False) 786 786 phaseList = [] 787 787 for item in phaseDict: … … 852 852 constr = [] 853 853 for item in varbs[1:]: 854 # constr += [[{FrstVarb:1.0},{item:-1.0},None,None],]855 854 constr += [[[1.0,FrstVarb],[-1.0,item],None,None],] 856 855 return constr #multiple constraints 857 856 elif 'function' in constType: 858 # constr = map(dict,zip(varbs,[1.0 for i in range(len(varbs))]))859 857 constr = map(list,zip([1.0 for i in range(len(varbs))],varbs)) 860 858 return [constr+[0.0,False]] #just one constraint 861 859 else: #'constraint' 862 860 constr = map(list,zip([1.0 for i in range(len(varbs))],varbs)) 863 # constr = map(dict,zip(varbs,[1.0 for i in range(len(varbs))]))864 861 return [constr+[0.0,None]] #just one constraint 865 862 return [] … … 951 948 constSizer.Add(constDel) 952 949 eqString = ' FIXED '+item[0][1]+' ' 953 constSizer.Add((5,0),0)954 950 else: 955 951 constEdit = wx.Button(pageDisplay,-1,'Edit',style=wx.BU_EXACTFIT) … … 959 955 constSizer.Add(constDel) 960 956 if isinstance(item[-1],bool): 961 constRef = wx.CheckBox(pageDisplay,-1,label=' Refine?')962 constRef.SetValue(item[-1])963 constRef.Bind(wx.EVT_CHECKBOX,OnConstRef)964 Indx[constRef.GetId()] = item965 constSizer.Add(constRef,0,wx.ALIGN_CENTER_VERTICAL)966 957 eqString = ' FUNCT ' 967 958 elif isinstance(item[-2],float): 968 constSizer.Add((5,5),0)969 959 eqString = ' CONSTR ' 970 960 else: 971 constSizer.Add((5,5),0)972 961 eqString = ' EQUIV ' 973 962 for term in item[:-2]: … … 978 967 eqString += ' = 0 ' 979 968 constSizer.Add(wx.StaticText(pageDisplay,-1,eqString),0,wx.ALIGN_CENTER_VERTICAL) 969 if isinstance(item[-1],bool): 970 constRef = wx.CheckBox(pageDisplay,-1,label=' Refine?') 971 constRef.SetValue(item[-1]) 972 constRef.Bind(wx.EVT_CHECKBOX,OnConstRef) 973 Indx[constRef.GetId()] = item 974 constSizer.Add(constRef,0,wx.ALIGN_CENTER_VERTICAL) 975 else: 976 constSizer.Add((5,5),0) 980 977 return constSizer 981 978 -
trunk/GSASIImapvars.py
r407 r411 90 90 each group. This contains both parameters used in parameter 91 91 redefinitions as well as names of generated new parameters. 92 varyList: a list of parameters that have been flagged to be varied.93 92 94 93 arrayList: a list by group of relationship matrices to relate … … 116 115 fixedDict = {} # a dictionary containing the fixed values corresponding to defined parameter equations 117 116 # key is original ascii string, value is float 118 varyList = [] # a list of varied constraints119 117 120 118 # compile regular expressions used for parsing input … … 132 130 def InitVars(): 133 131 '''Initializes all constraint information''' 134 global dependentParmList,arrayList,invarrayList,indParmList,fixedDict, varyList,consNum132 global dependentParmList,arrayList,invarrayList,indParmList,fixedDict,consNum 135 133 dependentParmList = [] # contains a list of parameters in each group 136 134 arrayList = [] # a list of of relationship matrices … … 138 136 indParmList = [] # a list of names for the new parameters 139 137 fixedDict = {} # a dictionary containing the fixed values corresponding to defined parameter equations 140 varyList = [] # a list of varied constraints141 138 consNum = 0 # number of the next constraint to be created 142 139 … … 301 298 return groups,ParmList 302 299 303 def GenerateConstraints(groups,parmlist, constrDict,constrFlag,fixedList):300 def GenerateConstraints(groups,parmlist,varyList,constrDict,constrFlag,fixedList): 304 301 '''Takes a list of relationship entries comprising a group of constraints and 305 302 builds the relationship lists and their inverse and stores them in global variables 306 303 ''' 307 global dependentParmList,arrayList,invarrayList,indParmList, varyList,consNum304 global dependentParmList,arrayList,invarrayList,indParmList,consNum 308 305 for group,varlist in zip(groups,parmlist): 309 306 VaryFree = False … … 337 334 # key is original ascii string, value is float 338 335 for fixedval in fixedList: 339 if fixedval is not None:336 if fixedval: 340 337 fixedDict[fixedval] = float(fixedval) 341 338 … … 385 382 return 386 383 387 def VarRemapShow( ):384 def VarRemapShow(varyList): 388 385 '''List out the saved relationships. 389 386 Returns a string containing the details. 390 387 ''' 391 388 s = 'Mapping relations:\n' 392 global dependentParmList,arrayList,invarrayList,indParmList,fixedDict ,varyList389 global dependentParmList,arrayList,invarrayList,indParmList,fixedDict 393 390 for varlist,mapvars,multarr in zip(dependentParmList,indParmList,arrayList): 394 391 i = 0 … … 443 440 pass 444 441 if multarr is None: continue 445 valuelist = [parm dict[var] for var in varlist]442 valuelist = [parmDict[var] for var in varlist] 446 443 parmDict.update(zip(mapvars, 447 444 np.dot(multarr,np.array(valuelist))) … … 450 447 parmDict.update(fixedDict) 451 448 452 def Dict2Map(parmDict): 449 def Dict2Map(parmDict,varyList): 450 #I think this needs fixing to update parmDict with new values 451 # from the constraints based on what is in varyList - RVD 453 452 '''Convert the remapped values back to the original parameters 454 453 … … 458 457 ''' 459 458 global dependentParmList,arrayList,invarrayList,indParmList,fixedDict 460 # reset fixed values (should not be needed, but very quick) 459 # reset fixed values (should not be needed, but very quick) 460 # - this seems to update parmDict with {'0':0.0} & {'1.0':1.0} - probably not what was intended 461 461 parmDict.update(fixedDict) 462 462 for varlist,mapvars,invmultarr in zip(dependentParmList,indParmList,invarrayList): … … 675 675 676 676 before = parmdict.copy() 677 Dict2Map(parmdict )677 Dict2Map(parmdict,[]) 678 678 print 'after Dict2Map' 679 679 print ' key / before / after' -
trunk/GSASIIphsGUI.py
r409 r411 173 173 generalData['AngleRadii'].append(Info['Arad']) 174 174 generalData['vdWRadii'].append(Info['Vdrad']) 175 generalData['AtomMass'].append(Info['Mass']) 175 if atom[ct] in generalData['Isotope']: 176 generalData['AtomMass'].append(Info['Isotopes'][generalData['Isotope'][atom[ct]]][0]) 177 else: 178 generalData['AtomMass'].append(Info['Mass']) 176 179 generalData['NoAtoms'][atom[ct]] = atom[cs-1]*float(atom[cs+1]) 177 180 generalData['Color'].append(Info['Color']) … … 328 331 def OnIsotope(event): 329 332 Obj = event.GetEventObject() 330 generalData['Isotope'][Indx[Obj.GetId()]] = Obj.GetValue() #mass too 333 item = Indx[Obj.GetId()] 334 isotope = Obj.GetValue() 335 generalData['Isotope'][item] = isotope 336 indx = generalData['AtomTypes'].index(item) 337 data['General']['AtomMass'][indx] = generalData['Isotopes'][item][isotope][0] 338 UpdateGeneral() 331 339 332 340 cellGUIlist = [[['m3','m3m'],4,zip([" Unit cell: a = "," Vol = "],["%.5f","%.3f"],[True,False],[0,0])], -
trunk/GSASIIpwd.py
r376 r411 698 698 699 699 Df = pyd.pypsvfcj(len(xdata),xdata-pos,pos,sig,gam,shl) 700 # Df = pyd.pypsvfcjo(len(xdata),xdata-pos,pos,sig,gam,shl) 700 701 Df /= np.sum(Df) 701 702 return Df … … 704 705 705 706 Df,dFdp,dFds,dFdg,dFdsh = pyd.pydpsvfcj(len(xdata),xdata-pos,pos,sig,gam,shl) 707 # Df,dFdp,dFds,dFdg,dFdsh = pyd.pydpsvfcjo(len(xdata),xdata-pos,pos,sig,gam,shl) 706 708 sumDf = np.sum(Df) 707 709 return Df,dFdp,dFds,dFdg,dFdsh -
trunk/GSASIIstruct.py
r409 r411 65 65 66 66 def GetConstraints(GPXfile): 67 const rList = []67 constList = [] 68 68 file = open(GPXfile,'rb') 69 69 while True: … … 76 76 constDict = datum[1] 77 77 for item in constDict: 78 const rList += constDict[item]78 constList += constDict[item] 79 79 file.close() 80 return constrList 80 constDict = [] 81 constFlag = [] 82 fixedList = [] 83 for item in constList: 84 if item[-2]: 85 fixedList.append(str(item[-2])) 86 else: 87 fixedList.append('0') 88 if item[-1]: 89 constFlag.append(['VARY']) 90 else: 91 constFlag.append([]) 92 itemDict = {} 93 for term in item[:-2]: 94 itemDict[term[1]] = term[0] 95 constDict.append(itemDict) 96 return constDict,constFlag,fixedList 81 97 82 98 def GetPhaseNames(GPXfile): … … 392 408 isotope = General['Isotope'] 393 409 for El in atomTypes: 394 BLtable[El] = isotopes[El][isotope[El]]410 BLtable[El] = [isotope[El],isotopes[El][isotope[El]]] 395 411 return BLtable 396 412 … … 452 468 453 469 def PrintFFtable(FFtable): 454 print '\n Scattering factors:'470 print '\n X-ray scattering factors:' 455 471 print ' Symbol fa fb fc' 456 472 print 99*'-' … … 461 477 print ' %8s %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f %9.5f' % \ 462 478 (Ename.ljust(8),fa[0],fa[1],fa[2],fa[3],fb[0],fb[1],fb[2],fb[3],ffdata['fc']) 479 480 def PrintBLtable(BLtable): 481 print '\n Neutron scattering factors:' 482 print ' Symbol isotope mass b resonant terms' 483 print 99*'-' 484 for Ename in BLtable: 485 bldata = BLtable[Ename] 486 isotope = bldata[0] 487 mass = bldata[1][0] 488 blen = bldata[1][1] 489 bres = [] 490 if len(bldata[1]) > 2: 491 bres = bldata[1][2:] 492 line = ' %8s%11s %10.3f %8.3f'%(Ename.ljust(8),isotope.center(11),mass,blen) 493 for item in bres: 494 line += '%10.5g'%(item) 495 print line 463 496 464 497 def PrintAtoms(General,Atoms): … … 485 518 486 519 def PrintTexture(textureData): 487 print '\n Spherical harmonics texture: Order:' + \ 488 str(textureData['Order'])+' Refine? '+str(textureData['SH Coeff'][0]) 520 topstr = '\n Spherical harmonics texture: Order:' + \ 521 str(textureData['Order']) 522 if textureData['Order']: 523 print topstr+' Refine? '+str(textureData['SH Coeff'][0]) 524 else: 525 print topstr 526 return 489 527 names = ['omega','chi','phi'] 490 528 line = '\n' … … 527 565 except KeyError: 528 566 PawleyRef = [] 529 if Print: print '\n Phase name: ',General['Name']530 567 SGData = General['SGData'] 531 568 SGtext = G2spc.SGPrint(SGData) 532 if Print:533 for line in SGtext: print line534 569 cell = General['Cell'] 535 570 A = G2lat.cell2A(cell[1:7]) … … 537 572 if cell[0]: 538 573 phaseVary += cellVary(pfx,SGData) 539 if Print: print '\n Unit cell: a =','%.5f'%(cell[1]),' b =','%.5f'%(cell[2]),' c =','%.5f'%(cell[3]), \540 ' alpha =','%.3f'%(cell[4]),' beta =','%.3f'%(cell[5]),' gamma =', \541 '%.3f'%(cell[6]),' volume =','%.3f'%(cell[7]),' Refine?',cell[0]542 if Print and FFtable:543 PrintFFtable(FFtable)544 574 Natoms[pfx] = 0 545 575 if Atoms: … … 583 613 # elif General['Type'] == 'macromolecular': 584 614 615 585 616 if 'SH Texture' in General: 586 617 textureData = General['SH Texture'] … … 597 628 598 629 if Print: 630 print '\n Phase name: ',General['Name'] 631 print 135*'-' 632 PrintFFtable(FFtable) 633 PrintBLtable(BLtable) 634 print '' 635 for line in SGtext: print line 599 636 PrintAtoms(General,Atoms) 637 print '\n Unit cell: a =','%.5f'%(cell[1]),' b =','%.5f'%(cell[2]),' c =','%.5f'%(cell[3]), \ 638 ' alpha =','%.3f'%(cell[4]),' beta =','%.3f'%(cell[5]),' gamma =', \ 639 '%.3f'%(cell[6]),' volume =','%.3f'%(cell[7]),' Refine?',cell[0] 600 640 if 'SH Texture' in General: 601 641 PrintTexture(textureData) … … 1522 1562 keys[key][iatm] = parmDict[parm] 1523 1563 FFdata.append(FFtables[Tdata[iatm]]) 1524 BLdata.append(BLtables[Tdata[iatm]] )1564 BLdata.append(BLtables[Tdata[iatm]][1]) 1525 1565 return FFdata,BLdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata 1526 1566 … … 1544 1584 FFdata,BLdata,Mdata,Fdata,Xdata,dXdata,IAdata,Uisodata,Uijdata = GetAtomFXU(pfx,FFtables,BLtables,calcControls,parmDict) 1545 1585 if 'N' in parmDict[hfx+'Type']: 1546 FP = 0. 1547 FPP = 0. 1586 FP,FPP = G2el.BlenRes(BLdata,parmDict[hfx+'Lam']) 1548 1587 else: 1549 1588 FP = np.array([El[hfx+'FP'] for El in FFdata]) … … 1647 1686 dFdua[iref] = 2.*(fas[0]*dfadua[0]+fas[1]*dfadua[1]) 1648 1687 if not SGData['SGInv']: 1649 dfbdfr = np.sum(fb/occ[:,np.newaxis],axis=2) 1688 dfbdfr = np.sum(fb/occ[:,np.newaxis],axis=2) #problem here if occ=0 for some atom 1650 1689 dfbdx = np.sum(twopi*Uniq*fbx[:,:,:,np.newaxis],axis=2) 1651 1690 dfbdui = np.sum(-SQfactor*fb,axis=2) … … 2330 2369 def dervRefine(values,HistoPhases,parmdict,varylist,calcControls,pawleyLookup,dlg): 2331 2370 parmdict.update(zip(varylist,values)) 2332 G2mv.Dict2Map(parmdict )2371 G2mv.Dict2Map(parmdict,varylist) 2333 2372 Histograms,Phases = HistoPhases 2334 2373 dMdv = np.empty(0) … … 2353 2392 parmdict.update(zip(varylist,values)) 2354 2393 Values2Dict(parmdict, varylist, values) 2355 G2mv.Dict2Map(parmdict )2394 G2mv.Dict2Map(parmdict,varylist) 2356 2395 Histograms,Phases = HistoPhases 2357 2396 M = np.empty(0) … … 2405 2444 Controls = GetControls(GPXfile) 2406 2445 ShowControls(Controls) 2407 constr List = GetConstraints(GPXfile)2446 constrDict,constrFlag,fixedList = GetConstraints(GPXfile) 2408 2447 Histograms,Phases = GetUsedHistogramsAndPhases(GPXfile) 2409 2448 if not Phases: … … 2428 2467 parmDict.update(histDict) 2429 2468 GetFprime(calcControls,Histograms) 2430 for item in constrList: print item2431 constrDict,constrFlag,fixedList = G2mv.InputParse([]) #constraints go here?2432 2469 groups,parmlist = G2mv.GroupConstraints(constrDict) 2433 G2mv.GenerateConstraints(groups,parmlist,constrDict,constrFlag,fixedList) 2470 G2mv.GenerateConstraints(groups,parmlist,varyList,constrDict,constrFlag,fixedList) 2471 print G2mv.VarRemapShow(varyList) 2434 2472 G2mv.Map2Dict(parmDict,varyList) 2435 2473 … … 2453 2491 chisq = np.sum(result[2]['fvec']**2) 2454 2492 Values2Dict(parmDict, varyList, result[0]) 2455 G2mv.Dict2Map(parmDict )2493 G2mv.Dict2Map(parmDict,varyList) 2456 2494 newAtomDict = ApplyXYZshifts(parmDict,varyList) 2457 2495 … … 2480 2518 break 2481 2519 2482 # print 'dependentParmList: ',G2mv.dependentParmList 2483 # print 'arrayList: ',G2mv.arrayList 2484 # print 'invarrayList: ',G2mv.invarrayList 2485 # print 'indParmList: ',G2mv.indParmList 2486 # print 'fixedDict: ',G2mv.fixedDict 2520 print 'dependentParmList: ',G2mv.dependentParmList 2521 print 'arrayList: ',G2mv.arrayList 2522 print 'invarrayList: ',G2mv.invarrayList 2523 print 'indParmList: ',G2mv.indParmList 2524 print 'fixedDict: ',G2mv.fixedDict 2525 print 'test1' 2487 2526 GetFobsSq(Histograms,Phases,parmDict,calcControls) 2527 print 'test2' 2488 2528 sigDict = dict(zip(varyList,sig)) 2489 2529 covData = {'variables':result[0],'varyList':varyList,'sig':sig, … … 2494 2534 SetUsedHistogramsAndPhases(GPXfile,Histograms,Phases,covData) 2495 2535 #for testing purposes!!! 2496 #file = open('structTestdata.dat','wb')2497 #cPickle.dump(parmDict,file,1)2498 #cPickle.dump(varyList,file,1)2499 #for histogram in Histograms:2500 #if 'PWDR' in histogram[:4]:2501 #Histogram = Histograms[histogram]2502 #cPickle.dump(Histogram,file,1)2503 #cPickle.dump(Phases,file,1)2504 #cPickle.dump(calcControls,file,1)2505 #cPickle.dump(pawleyLookup,file,1)2506 #file.close()2536 file = open('structTestdata.dat','wb') 2537 cPickle.dump(parmDict,file,1) 2538 cPickle.dump(varyList,file,1) 2539 for histogram in Histograms: 2540 if 'PWDR' in histogram[:4]: 2541 Histogram = Histograms[histogram] 2542 cPickle.dump(Histogram,file,1) 2543 cPickle.dump(Phases,file,1) 2544 cPickle.dump(calcControls,file,1) 2545 cPickle.dump(pawleyLookup,file,1) 2546 file.close() 2507 2547 2508 2548 def SeqRefine(GPXfile,dlg): … … 2516 2556 Controls = GetControls(GPXfile) 2517 2557 ShowControls(Controls) 2518 constr List = GetConstraints(GPXfile)2558 constrDict,constrFlag,fixedList = GetConstraints(GPXfile) 2519 2559 Histograms,Phases = GetUsedHistogramsAndPhases(GPXfile) 2520 2560 if not Phases: … … 2580 2620 constrDict,constrFlag,fixedList = G2mv.InputParse([]) #constraints go here? 2581 2621 groups,parmlist = G2mv.GroupConstraints(constrDict) 2582 G2mv.GenerateConstraints(groups,parmlist, constrDict,constrFlag,fixedList)2622 G2mv.GenerateConstraints(groups,parmlist,varyList,constrDict,constrFlag,fixedList) 2583 2623 G2mv.Map2Dict(parmDict,varyList) 2584 2624 … … 2600 2640 chisq = np.sum(result[2]['fvec']**2) 2601 2641 Values2Dict(parmDict, varyList, result[0]) 2602 G2mv.Dict2Map(parmDict )2642 G2mv.Dict2Map(parmDict,varyList) 2603 2643 newAtomDict = ApplyXYZshifts(parmDict,varyList) 2604 2644 -
trunk/fsource/powsubs/psvfcj.for
r353 r411 126 126 c 127 127 IF (A .ne. 0.0) then 128 Einfl = Acosd(cos2THETA) ! 2phi(infl) FCJ eq 5 (degrees)128 Einfl = Acosd(cos2THETA) 129 129 tmp2 = 1.0 + ApB2 130 130 tmp = SQRT(tmp2)*cos2THETA 131 c132 C Treat case where A is zero - Set Einfl = 2theta133 c134 if (A.eq.0.0) Einfl = Acosd(cos2THETA)135 131 if (abs(tmp) .le. 1.0) then 136 Emin = Acosd(tmp) ! 2phi(min) FCJ eq 4 (degrees)132 Emin = Acosd(tmp) 137 133 tmp1 = tmp2*(1.0 - tmp2*(1.0-sin2THETA2)) 138 134 else 135 print *,'tmp > 1.0' 139 136 tmp1 = 0.0 140 137 if (tmp .gt. 0.0) then … … 213 210 tanDELTA = tand(Delta) 214 211 cosDELTA2 = cosDELTA*cosDELTA 215 tmp1 = cosDELTA2 - cos2THETA2 216 tmp2 = sin2THETA2 - sinDelta * sinDELTA 217 tmp = tmp2 218 if ( ttheta.gt.4500.0 ) tmp = tmp1 212 if ( ttheta.le.4500.0 .or. ttheta.gt.13500.0 ) then 213 tmp = sin2THETA2-sinDelta**2 214 else 215 tmp = cosDELTA2-cos2THETA2 216 end if 219 217 if (tmp .gt. 0) then 220 218 tmp1 = 1.0/SQRT(tmp) 221 219 F = abs(cos2THETA) * tmp1 222 dFdA = cosDELTA*cos2THETA*sinDELTA*dDELTAdA * 223 1 (tmp1*tmp1*tmp1) 220 dFdA = cosDELTA*cos2THETA*sinDELTA*dDELTAdA*tmp1**3 224 221 else 225 222 F = 1.0 … … 228 225 c 229 226 c Calculate G(Delta,2theta) [G = W /(h cos(delta) ] [ FCJ eq. 7(a) and 7(b) ] 230 c 231 if(abs(delta-emin) .gt. abs(einfl-emin))then 232 c 233 C N.B. this is the only place where d()/dA <> d()/dB 234 c 227 c 228 if ( ttheta.gt.9000.0 ) then !are you kidding!! this worked 229 ! if(abs(delta-emin) .gt. abs(einfl-emin))then 235 230 G = 2.0*A*F*RcosDELTA 236 231 dGdA = 2.0*A*RcosDELTA*(dFdA + F*tanDELTA*dDELTAdA) 237 else ! delta .le. einfl .or. min(A,B) .eq. 0232 else 238 233 G = (-1.0 + ApB*F) * RcosDELTA 239 234 dGdA = RcosDELTA*(F - tanDELTA*dDELTAdA
Note: See TracChangeset
for help on using the changeset viewer.