Changeset 4952 for trunk/GSASIIpwd.py


Ignore:
Timestamp:
Jun 11, 2021 3:43:57 PM (5 months ago)
Author:
toby
Message:

switch to native fullrmc input modes rather than convert files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwd.py

    r4951 r4952  
    30173017# otherwise build it
    30183018ENGINE = Engine(path=None)
     3019Ebc = ENGINE.boundaryConditions
    30193020if not ENGINE.is_engine(engineFileName) or FRESH_START:
    30203021    ## create structure
     
    30243025                                 unitcellBC = cell,
    30253026                                 supercell  = supercell)
    3026     rmax = min( [ENGINE.boundaryConditions.get_a(), ENGINE.boundaryConditions.get_b(), ENGINE.boundaryConditions.get_c()] ) /2.
     3027    rmax = min( [Ebc.get_a(), Ebc.get_b(), Ebc.get_c()] ) /2.
    30273028'''   
    30283029    import atmdata
    3029     rundata += '# conversion factors (may be needed)\n'
    3030     rundata += '    sumCiBi2 = 0.\n'
    3031     for elem in Phase['General']['AtomTypes']:
    3032         rundata += '    Ci = ENGINE.numberOfAtomsPerElement["{}"]/len(ENGINE.allElements)\n'.format(elem)
    3033         rundata += '    sumCiBi2 += (Ci*{})**2\n'.format(atmdata.AtmBlens[elem+'_']['SL'][0])
     3030    # rundata += '    # conversion factors (may be needed)\n'
     3031    # rundata += '    sumCiBi2 = 0.\n'
     3032    # for elem in Phase['General']['AtomTypes']:
     3033    #     rundata += '    Ci = ENGINE.numberOfAtomsPerElement["{}"]/len(ENGINE.allElements)\n'.format(elem)
     3034    #     rundata += '    sumCiBi2 += (Ci*{})**2\n'.format(atmdata.AtmBlens[elem+'_']['SL'][0])
    30343035    rundata += '    rho0 = len(ENGINE.allNames)/ENGINE.volume\n'
    30353036    # settings that require a new Engine
     
    30433044            rundata += '    GR = np.loadtxt(os.path.join(dirName,"%s")).T\n'%filDat[0]
    30443045            if filDat[3] == 0:
    3045                 rundata += '''    # read and xform G(r) as defined in RMCProfile
     3046                #rundata += '''    # read and xform G(r) as defined in RMCProfile
    30463047    # see eq. 44 in Keen, J. Appl. Cryst. (2001) 34 172-177\n'''
    3047                 rundata += '    GR[1] *= 4 * np.pi * GR[0] * rho0 / sumCiBi2\n'
    3048                 rundata += '    GofR = fPDF.PairDistributionConstraint(experimentalData=GR.T, weighting="%s")\n'%sfwt
     3048                #rundata += '    GR[1] *= 4 * np.pi * GR[0] * rho0 / sumCiBi2\n'
     3049                #rundata += '    GofR = fPDF.PairDistributionConstraint(experimentalData=GR.T, weighting="%s")\n'%sfwt
     3050                rundata += '    # G(r) as defined in RMCProfile\n'
     3051                rundata += '    GofR = fullrmc.Constraints.RadialDistributionConstraints.RadialDistributionConstraint(experimentalData=GR.T, weighting="%s")\n'%sfwt
    30493052            elif filDat[3] == 1:
    30503053                rundata += '    # This is G(r) as defined in PDFFIT\n'
     
    30603063            rundata += '    SOQ = np.loadtxt(os.path.join(dirName,"%s")).T\n'%filDat[0]
    30613064            if filDat[3] == 0:
    3062                 rundata += '    # Read & xform F(Q) as defined in RMCProfile to S(Q)-1\n'
    3063                 rundata += '    SOQ[1] *= 1 / sumCiBi2\n'
     3065                rundata += '    # F(Q) as defined in RMCProfile\n'
     3066                #rundata += '    SOQ[1] *= 1 / sumCiBi2\n'
     3067                if filDat[4]:
     3068                    rundata += '    SOQ[1] = Collection.sinc_convolution(q=SOQ[0],sq=SOQ[1],rmax=rmax)\n'
     3069                rundata += '    SofQ = fullrmc.Constraints.StructureFactorConstraints.NormalizedStructureFactorConstraint(experimentalData=SOQ.T, weighting="%s")\n'%sfwt
    30643070            elif filDat[3] == 1:
    3065                 rundata += '    # This is S(Q) as defined in PDFFIT\n'
     3071                rundata += '    # S(Q) as defined in PDFFIT\n'
    30663072                rundata += '    SOQ[1] -= 1\n'
    3067             if filDat[4]:
    3068                 rundata += '    SOQ[1] = Collection.sinc_convolution(q=SOQ[0],sq=SOQ[1],rmax=rmax)\n'
    3069             rundata += '    SofQ = ReducedStructureFactorConstraint(experimentalData=SOQ.T, weighting="%s")\n'%sfwt
     3073                if filDat[4]:
     3074                    rundata += '    SOQ[1] = Collection.sinc_convolution(q=SOQ[0],sq=SOQ[1],rmax=rmax)\n'
     3075                rundata += '    SofQ = ReducedStructureFactorConstraint(experimentalData=SOQ.T, weighting="%s")\n'%sfwt
     3076            else:
     3077                raise ValueError('Invalid S(Q) type: '+str(filDat[3]))
    30703078            rundata += '    ENGINE.add_constraints([SofQ])\n'
    30713079        else:
     
    30963104else:
    30973105    ENGINE = ENGINE.load(path=engineFileName)
    3098     rmax = min( [ENGINE.boundaryConditions.get_a(), ENGINE.boundaryConditions.get_b(), ENGINE.boundaryConditions.get_c()] ) /2.
     3106    rmax = min( [Ebc.get_a(), Ebc.get_b(), Ebc.get_c()] ) /2.
    30993107
    31003108ENGINE.set_log_file(os.path.join(dirName,prefix))
Note: See TracChangeset for help on using the changeset viewer.