Changeset 5306


Ignore:
Timestamp:
Jul 2, 2022 6:22:01 PM (3 months ago)
Author:
toby
Message:

collect atoms & fullrmc fixes

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r5297 r5306  
    44854485def AtomsCollect(data,Ind,Sel):
    44864486    '''Finds the symmetry set of atoms for those selected. Selects
    4487     the one closest to the selected part of the unit cell.
    4488     Works on the contents of data['Map Peaks']. Called from OnPeaksUnique in
    4489     GSASIIphsGUI.py,
     4487    the one closest to the selected part of the unit cell for the
     4488    selected atoms
    44904489
    44914490    :param data: the phase data structure
    4492     :param list Ind: list of selected peak indices
    4493     :param int Sel: selected part of unit to find atoms closest to
    4494 
    4495     :returns: the list of symmetry unique peaks from among those given in Ind
     4491    :param list Ind: list of selected atom indices
     4492    :param int Sel: an index with the selected plane or location in the
     4493      unit cell to find atoms closest to
     4494
     4495    :returns: the list of unique atoms where selected atoms may have been
     4496      replaced. Anisotropic Uij's are transformed
    44964497    '''       
    44974498    cx,ct,cs,ci = getAtomPtrs(data)
     
    45014502    SGData = generalData['SGData']
    45024503    Atoms = copy.deepcopy(data['Atoms'])
    4503     Indx = [True for ind in Ind]
    4504     # scan through peaks, finding all peaks equivalent to peak ind
    4505     for ind in Ind:
    4506         if Indx[ind]:
    4507             xyz = Atoms[ind][cx:cx+3]
    4508             uij = Atoms[ind][ci+2:ci+8]
    4509             if Atoms[ind][ci] == 'A':
    4510                 Equiv = list(G2spc.GenAtom(xyz,SGData,Uij=uij))
    4511                 Uijs = np.array([x[1] for x in Equiv])
    4512             else:
    4513                 Equiv = G2spc.GenAtom(xyz,SGData)
    4514             xyzs = np.array([x[0] for x in Equiv])
    4515             dzeros = np.sqrt(np.sum(np.inner(Amat,xyzs)**2,axis=0))
    4516             dcent = np.sqrt(np.sum(np.inner(Amat,xyzs-cent)**2,axis=0))
    4517             xyzs = np.hstack((xyzs,dzeros[:,nxs],dcent[:,nxs]))
    4518             cind = np.argmin(xyzs.T[Sel-1])
    4519             Atoms[ind][cx:cx+3] = xyzs[cind][:3]
    4520             if Atoms[ind][ci] == 'A':
    4521                 Atoms[ind][ci+2:ci+8] = Uijs[cind]
     4504    for ind in Ind:     # scan through selected atoms
     4505        xyz = Atoms[ind][cx:cx+3]
     4506        uij = Atoms[ind][ci+2:ci+8]
     4507        if Atoms[ind][ci] == 'A':
     4508            Equiv = list(G2spc.GenAtom(xyz,SGData,Uij=uij))
     4509            Uijs = np.array([x[1] for x in Equiv])
     4510        else:
     4511            Equiv = G2spc.GenAtom(xyz,SGData)
     4512        xyzs = np.array([x[0] for x in Equiv])
     4513        if Sel == 4:  # for origin, move atom to x, y &/or z closest to origin
     4514            xyzs -= 1*(xyzs > .5)
     4515        dzeros = np.sqrt(np.sum(np.inner(Amat,xyzs)**2,axis=0))
     4516        dcent = np.sqrt(np.sum(np.inner(Amat,xyzs-cent)**2,axis=0))
     4517        xyzs = np.hstack((xyzs,dzeros[:,nxs],dcent[:,nxs]))
     4518        cind = np.argmin(xyzs.T[Sel-1])
     4519        Atoms[ind][cx:cx+3] = xyzs[cind][:3]
     4520        if Atoms[ind][ci] == 'A':
     4521            Atoms[ind][ci+2:ci+8] = Uijs[cind]
    45224522    return Atoms
    45234523
  • trunk/GSASIIphsGUI.py

    r5288 r5306  
    47024702# fullrmc stuff TODO:
    47034703#  1) need to implement swapping in scripts
    4704 #  2) need fullrmc installation instructions
     4704#  2) fullrmc docs/installation in files
     4705#     file:///Users/toby/G2/trunk/help/gsasII-phase.html#Phase-RMC
     4706#     file:///Users/toby/G2/trunk/help/gsasII.html#fullrmc
     4707#     sources/packages.rst.txt
    47054708#  3) when GSASIIpwd.findfullrmc fails, should trigger message with link to above
    47064709#  4) fullrmc tutorials
    4707 #  5) better plotting when fullrmc in main Python image?
     4710#  5) G2pwd.findfullrmc: look at error msg & help link
    47084711
    47094712    def UpdateRMC():
     
    52375240''' "Fullrmc, a Rigid Body Reverse Monte Carlo Modeling Package Enabled with
    52385241Machine Learning and Artificial Intelligence", B. Aoun, Jour. Comp. Chem.
    5239 (2016), 37, 1102-1111. doi: https://doi.org/10.1002/jcc.24304
     5242(2016), 37, 1102-1111. doi: https://doi.org/10.1002/jcc.24304; www.fullrmc.com
    52405243 '''))
    52415244            # if G2pwd.findfullrmc() is None:
     
    66246627      and Artificial Intelligence",
    66256628      B. Aoun, Jour. Comp. Chem. 2016, 37, 1102-1111.
    6626       DOI: https://doi.org/10.1002/jcc.24304''','Please cite fullrmc')
     6629      DOI: https://doi.org/10.1002/jcc.24304
     6630
     6631      Note: A more advanced version of fullrmc can be found at www.fullrmc.com''',
     6632                             'Please cite fullrmc')
    66276633        ilog = 0
    66286634        while True:
  • trunk/GSASIIpwd.py

    r5296 r5306  
    31573157    '''Find where fullrmc is installed. Tries the following:
    31583158   
    3159          1. Returns the Config var 'fullrmc_exec', if defined. No check
    3160             is done that the interpreter has fullrmc
    3161          2. The current Python interpreter if fullrmc can be imported
    3162             and fullrmc is version 5+
    3163          3. The path is checked for a fullrmc image as named by Bachir
     3159         1. Returns the Config var 'fullrmc_exec', if defined. If an executable
     3160            is found at that location it is assumed to run and supply
     3161            fullrmc 5.0+
     3162         2. The path is checked for a fullrmc image as named by Bachir
    31643163
    31653164    :returns: the full path to a python executable that is assumed to
    31663165      have fullrmc installed or None, if it was not found.
    31673166    '''
    3168     if GSASIIpath.GetConfigValue('fullrmc_exec') is not None and is_exe(
    3169             GSASIIpath.GetConfigValue('fullrmc_exec')):
    3170         return GSASIIpath.GetConfigValue('fullrmc_exec')
    3171     try:
    3172         import fullrmc
    3173         if int(fullrmc.__version__.split('.')[0]) >= 5:
    3174             return sys.executable
    3175     except:
    3176         pass
     3167    fullrmc_exe = GSASIIpath.GetConfigValue('fullrmc_exec')
     3168    if fullrmc_exe is not None and is_exe(fullrmc_exe):
     3169        return fullrmc_exe
    31773170    pathlist = os.environ["PATH"].split(os.pathsep)
    31783171    for p in (GSASIIpath.path2GSAS2,GSASIIpath.binaryPath,os.getcwd(),
    31793172                  os.path.split(sys.executable)[0]):
    3180         if p not in pathlist: pathlist.insert(0,p)
     3173        if p not in pathlist: pathlist.append(p)
    31813174    import glob
    31823175    for p in pathlist:
    3183         if sys.platform == "darwin":
    3184             lookfor = "fullrmc*macOS*i386-64bit"
    3185         elif sys.platform == "win32":
    3186             lookfor = "fullrmc*.exe"
     3176        if sys.platform == "win32":
     3177            lookfor = "fullrmc5*.exe"
    31873178        else:
    3188             lookfor = "fullrmc*"
     3179            lookfor = "fullrmc5*64bit"
    31893180        fl = glob.glob(lookfor)
    31903181        if len(fl) > 0:
    3191             return os.path.abspath(sorted(fl)[0])
     3182            fullrmc_exe = os.path.abspath(sorted(fl)[0])
     3183            if GSASIIpath.GetConfigValue('debug'):
     3184                print('fullrmc found as',fullrmc_exe)
     3185            return fullrmc_exe
    31923186
    31933187def findPDFfit():
     
    36293623import types
    36303624import numpy as np
     3625import matplotlib as mpl
    36313626import fullrmc
    36323627from fullrmc.Core import Collection
     
    38253820    rundata += '''for c in ENGINE.constraints:
    38263821    if hasattr(c, '_ExperimentalConstraint__adjustScaleFactor'):
    3827         def _constraint_copy_needs_lut(self):
     3822        def _constraint_copy_needs_lut(self, *args, **kwargs):
    38283823            result =  super(self.__class__, self)._constraint_copy_needs_lut(*args, **kwargs)
    38293824            result['_ExperimentalConstraint__adjustScaleFactor'] = '_ExperimentalConstraint__adjustScaleFactor'
Note: See TracChangeset for help on using the changeset viewer.