Changeset 3056 for trunk/GSASIImapvars.py
 Timestamp:
 Sep 8, 2017 2:17:29 PM (5 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIImapvars.py
r3046 r3056 202 202 to parameter equations. The dict key is an ascii string, but the 203 203 dict value is a float. Unlikely to be used externally. 204 205 symGenList: 206 a list of boolean values that will be True to indicate that a constraint 207 (only equivalences) is generated by symmetry (or Pawley overlap) 208 209 problemVars: 210 a list containing variables that show up in constraints producing errors 204 211 205 212 *Routines* … … 227 234 fixedVarList = [] # List of variables that should not be refined 228 235 symGenList = [] # Flag if constraint is generated by symmetry 236 problemVars = [] # variables causing errors 229 237 230 238 # prefix for parameter names … … 329 337 errmsg = '' 330 338 warnmsg = '' 339 global problemVars 340 problemVars = [] 331 341 fixVlist = [] 332 342 # process fixed variables (holds) … … 358 368 if v in indepVarList: 359 369 errmsg += '\nVariable '+v+' is used to set values in a constraint before its value is set in another constraint\n' 370 if v not in problemVars: problemVars.append(v) 360 371 if m == 0: zeromult = True 361 372 if v in varyList: … … 389 400 s = '' 390 401 for var in sorted(set(multdepVarList)): 402 if v not in problemVars: problemVars.append(v) 391 403 if s != "": s+= ", " 392 404 s += str(var) … … 399 411 s = '' 400 412 for var in sorted(inboth): 413 if var not in problemVars: problemVars.append(var) 401 414 if s != "": s+= ", " 402 415 s += str(var) … … 422 435 if var in fixVlist: 423 436 errmsg += '\nParameter '+var+" is Fixed and used in a constraint:\n\t" 437 if var not in problemVars: problemVars.append(var) 424 438 errmsg += _FormatConstraint(constrDict[rel],fixedList[rel])+"\n" 425 439 if varied > 0 and varied != len(VarKeys(constrDict[rel])): … … 921 935 for v in fixedVarList: 922 936 s += ' ' + v + '\n' 923 s += ' Variable mapping relations:\n'937 s += 'Usersupplied variable mapping relations:\n' 924 938 symout = '' 925 939 global dependentParmList,arrayList,invarrayList,indParmList,fixedDict,symGenList … … 929 943 for i,mv in enumerate(mapvars): 930 944 if multarr is None: 931 s1 = ' ' + str(mv) + ' is equivalent to parameter(s): ' 945 # s1 = ' ' + str(mv) + ' is equivalent to parameter(s): ' 946 if len(varlist) == 1: 947 s1 = ' ' + str(mv) + ' is equivalent to ' 948 else: 949 s1 = ' ' + str(mv) + ' is equivalent to parameters: ' 932 950 j = 0 933 951 for v,m in zip(varlist,invmultarr): … … 968 986 s += '\n' 969 987 return s 988 989 def GetSymEquiv(): 990 '''Return the automatically generated (equivalence) relationships. 991 992 :returns: a list of strings containing the details of the contraint relationships 993 ''' 994 symout = [] 995 global dependentParmList,arrayList,invarrayList,indParmList,fixedDict,symGenList 996 997 for varlist,mapvars,multarr,invmultarr,symFlag in zip( 998 dependentParmList,indParmList,arrayList,invarrayList,symGenList): 999 for i,mv in enumerate(mapvars): 1000 if not symFlag: continue 1001 if multarr is None: 1002 s1 = str(mv) + ' = ' 1003 j = 0 1004 for v,m in zip(varlist,invmultarr): 1005 if debug: print 'v,m[0]: ',v,m[0] 1006 if len(s1.split('\n')[1]) > 75: s1 += '\n ' 1007 if j > 0: s1 += ' = ' 1008 j += 1 1009 s1 += str(v) 1010 if m != 1: 1011 s1 += " / " + str(m[0]) 1012 symout.append(s1) 1013 continue 1014 else: 1015 s = ' %s = ' % mv 1016 j = 0 1017 for m,v in zip(multarr[i,:],varlist): 1018 if m == 0: continue 1019 if j > 0: s += ' + ' 1020 j += 1 1021 s += '(%s * %s)' % (m,v) 1022 print 'unexpected sym op=',s 1023 return symout 970 1024 971 1025 def Dict2Deriv(varyList,derivDict,dMdv):
Note: See TracChangeset
for help on using the changeset viewer.