Changeset 4196 for trunk/GSASIIpwd.py


Ignore:
Timestamp:
Dec 6, 2019 4:50:36 AM (23 months ago)
Author:
vondreele
Message:

ad fullrmc dialog for set up
comment out & skip W plot update for d-plots & q-plots (they crash for TOF data)
put lower bounds on background single peak coefficients - avoids crash if refine negative
add MakePDB routine for fullrmc setup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwd.py

    r4195 r4196  
    929929        try:
    930930            pkP = parmDict[pfx+'BkPkpos;'+str(iD)]
    931             pkI = parmDict[pfx+'BkPkint;'+str(iD)]
    932             pkS = parmDict[pfx+'BkPksig;'+str(iD)]
    933             pkG = parmDict[pfx+'BkPkgam;'+str(iD)]
     931            pkI = max(parmDict[pfx+'BkPkint;'+str(iD)],0.1)
     932            pkS = max(parmDict[pfx+'BkPksig;'+str(iD)],1.)
     933            pkG = max(parmDict[pfx+'BkPkgam;'+str(iD)],0.1)
    934934            if 'C' in dataType:
    935935                Wd,fmin,fmax = getWidthsCW(pkP,pkS,pkG,.002)
     
    10621062        try:
    10631063            pkP = parmDict[hfx+'BkPkpos;'+str(iD)]
    1064             pkI = parmDict[hfx+'BkPkint;'+str(iD)]
    1065             pkS = parmDict[hfx+'BkPksig;'+str(iD)]
    1066             pkG = parmDict[hfx+'BkPkgam;'+str(iD)]
     1064            pkI = max(parmDict[hfx+'BkPkint;'+str(iD)],0.1)
     1065            pkS = max(parmDict[hfx+'BkPksig;'+str(iD)],1.0)
     1066            pkG = max(parmDict[hfx+'BkPkgam;'+str(iD)],0.1)
    10671067            if 'C' in dataType:
    10681068                Wd,fmin,fmax = getWidthsCW(pkP,pkS,pkG,.002)
     
    22062206    fl.close()
    22072207    return fname
     2208
     2209def MakePDB(G2frame,Name,Phase,Atseq,Supercell):
     2210    generalData = Phase['General']
     2211    Cell = generalData['Cell'][1:7]
     2212    Trans = np.eye(3)*np.array(Supercell)
     2213    newPhase = copy.deepcopy(Phase)
     2214    newPhase['General']['SGData'] = G2spc.SpcGroup('P 1')[1]
     2215    newPhase['General']['Cell'][1:] = G2lat.TransformCell(Cell,Trans.T)
     2216    newPhase,Atcodes = G2lat.TransformPhase(Phase,newPhase,Trans,np.zeros(3),np.zeros(3),ifMag=False)
     2217    Atoms = newPhase['Atoms']
     2218    Cell = newPhase['General']['Cell'][1:7]
     2219    A,B = G2lat. cell2AB(Cell)
     2220    fname = Name+'.pdb'
     2221    fl = open(fname,'w')
     2222    fl.write('REMARK    this file is generated using GSASII\n')
     2223    fl.write('CRYST1%9.3f%9.3f%9.3f%7.2f%7.2f%7.2f P 1           1\n'%(
     2224            Cell[0],Cell[1],Cell[2],Cell[3],Cell[4],Cell[5]))
     2225    fl.write('ORIGX1      1.000000  0.000000  0.000000        0.00000\n')
     2226    fl.write('ORIGX2      0.000000  1.000000  0.000000        0.00000\n')
     2227    fl.write('ORIGX3      0.000000  0.000000  1.000000        0.00000\n')
     2228
     2229    Natm = np.core.defchararray.count(np.array(Atcodes),'+')
     2230    Natm = np.count_nonzero(Natm-1)
     2231    nat = 0
     2232    for atm in Atseq:
     2233        for iat,atom in enumerate(Atoms):
     2234            if atom[1] == atm:
     2235                nat += 1
     2236                XYZ = np.inner(A,np.array(atom[3:6])-0.5)    #shift origin to middle & make Cartesian
     2237#ATOM      1 Ni   RMC     1     -22.113 -22.113 -22.113  1.00  0.00          ni                     
     2238                fl.write('ATOM  %5d %-4s RMC%6d%12.3f%8.3f%8.3f  1.00  0.00          %-2s\n'%(       
     2239                        nat,atom[0],nat,XYZ[0],XYZ[1],XYZ[2],atom[1]))
     2240    fl.close()
     2241    return fname
    22082242   
    22092243################################################################################
Note: See TracChangeset for help on using the changeset viewer.