8. GSASIImapvars: Parameter constraints¶
Module to implements algebraic contraints, parameter redefinition and parameter simplification contraints.
8.1. Types of constraints¶
There are four ways to specify constraints, as listed below.
Note that parameters are initially stored in the
main section of the GSASII data tree under heading Constraints
.
This dict has four keys, ‘Hist’, ‘HAP’, ‘Global’, and ‘Phase’,
each containing a list of constraints. An additional set of constraints
are generated for each phase based on symmetry considerations by calling
GSASIIstrIO.GetPhaseData()
.
Note that in the constraints, as stored in the GSASII data tree, parameters
are stored as GSASIIobj.G2VarObj
objects, as these objects allow for
changes in numbering of phases, histograms and atoms.
When they are interpreted (in GSASIIstrIO.ProcessConstraints()
),
references
to numbered objects are resolved using the appropriate random ids and the
parameter object is converted to a string of form ph:hst:VARNAM:at
.
8.1.1. Alternate parameters (New Var)¶
Parameter redefinition (“New Var” constraints) is done by creating an expression that relates several parameters:
Mx1 * Px + My1 * Py +...
Mx2 * Px + Mz2 * Pz + ...
where Pj is a GSASII parameter name and Mjk is a constant (float) multiplier.
Alternately, multipliers Mjk can contain a formula (str) that will be evaluated prior
to the start of the refinement. In a formula, GSASII parameters will be replaced by the
value of the parameter before the formula is evaluated, so 'np.cos(0::Ax:2)'
is a valid
multiplier. At present, only phase (atom/cell) parameters are available for use in
a formula, but this can be expanded if needed.
This type of constraint describes an alternate degree of freedom where parameter Px and Py, etc. are varied to keep their ratio fixed according the expression. A new variable parameter is assigned to each degree of freedom when refined. An example where this can be valuable is when two parameters, P1 and P2, have similar values and are highly correlated. It is often better to create a new variable, Ps = P1 + P2, and refine Ps. In the later stages of refinement, a second variable, Pd = P1  P2, can be defined and it can be seen if refining Pd is supported by the data. Another use will be to define parameters that express “irrep modes” in terms of the fundamental structural parameters.
These “New Var” constraints are stored as described for type “f” in the constraint definitions table.
8.1.2. Constrained parameters (Const)¶
A constraint on a set of variables can be supplied in the form of a linear algebraic equation:
Nx1 * Px + Ny1 * Py +... = C1
where Cn is a constant (float), where Pj is a GSASII parameter name,
and where Njk is a constant multiplier (float) or a formula (str) that will be evaluated prior
to the start of the refinement. In a formula, GSASII parameters will be replaced by the
value of the parameter before the formula is evaluated, so 'np.cos(0::Ax:2)'
is a valid
multiplier. At present, only phase (atom/cell) parameters are available for use in
a formula, but this can be expanded if needed.
These equations set an interdependence between parameters. Common uses of parameter constraints are to set rules that decrease the number of parameters, such as restricting the sum of fractional occupancies for atoms that share a site to sum to unity, thus reducing the effective number of variables by one. Likewise, the Uiso value for a H atom “riding” on a C, N or O atom can be related by a fixed offset (the so called B+1 “rule”).
A “Const” constraint is stored as described for type “c” in the constraint definitions table.
8.1.3. Equivalenced parameters (Equiv)¶
A simplifed way to set up a constraint equation is to define an equivalence, which can be of form:
C1 * P1 = C2 * Py
or:
C1 * P1 = C2 * P2 = C3 * P3 = ...
where Cn is a constant (float), where Pj is a GSASII parameter name. This
means that parameters Py (or P2 and P3) are determined from (or “slaved” to)
parameter P1. Alternately, equivalences can be created with StoreEquivalence()
where the multipliers can be a formula (str) that will be evaluated prior to the start of
the refinement. In a formula, GSASII parameters will be replaced by the value of the
parameter before the formula is evaluate, so 'np.cos(0::Ax:2)'
is a valid multiplier.
At present, only phase (atom/cell) parameters are available for use in
a formula, but this can be expanded if needed.
Note that
the latter constraint expression is conceptually identical to
defining constraint equations. In practice, however,
equivalenced parameters are processed in a
different and more direct manner than constraint equations. The previous
set of equalities could also be written in this way as a set of constraint
equations:
C1 * P1  C2 * P2 = 0
C1 * P1  C3 * P3 = 0
...
The first parameter (P1 above) is considered the independent variable and the remaining parameters are dependent variables. The dependent variables are set from the independent variable. An example of how this may be used woul be if, for example, a material has a number of O atoms, all in fairly similar bonding environments and the diffraction data are sparse, one my reduce the complexity of the model by defining Uiso for the first O atoms to be identical to the remaining atoms. The results of this refinement will be simpler to understand than if a set of constraint equations is used because the refined parameter will be the independent variable, which will be as ph::Uiso:n, corresponding to the first O atom.
A parameter can be used in multiple
equivalences as independent variable,
but if parameter is used as both a dependent and independent variable or
a parameter is used in equivalences and in “New Var” or “Const” constraints,
this create conflicts that cannot be resolved within the equivalences implementation
but can be handled as constraint equations.
The equivalences that violate this are discovered in CheckEquivalences()
and then MoveConfEquiv()
is used to change these equivalences to “Const” equations.
Equivalenced parameters (“EQUIV” constraints), when defined by users,
are stored as described for type “e” in the
constraint definitions table.
Other equvalences are generated by symmetry prior
to display or refinement in GSASIIstrIO.GetPhaseData()
.
These are not stored.
8.1.4. Fixed parameters (Hold)¶
When parameters are refined where a single refinement flag determines that several variables are refined at the same time (examples are: cell parameters, atom positions, anisotropic displacement parameters, magnetic moments,…) it can be useful to specify that a specific parameter should not be varied. These will most commonly be generated due to symmetry, but under specific conditions, there may be other good reasons to constrain a parameter.
A “Hold” constraint is stored as described for type “h” in the constraint definitions table.
8.2. Constraint Processing¶
When constraints will be used or edited, they are processed using a series of calls:
 First all of the stored constraints are appended into a single list. They are initially stored in separate lists only to improve their creation and display in the GUI.
 Then
InitVars()
is used to initialize the global variables in this module (GSASIImapvars
).  Then
GSASIIstrIO.ProcessConstraints()
is used to initially process the constraints, as described below.  Symmetrygenerated equivalences are then created in
GSASIIstrIO.GetPhaseData()
, which also callsGSASIIstrIO.cellVary()
and for Pawley refinementsGSASIIstrIO.GetPawleyConstr()
. These are entered directly into this module’s globals usingStoreEquivalence()
.  Constraints/equivalences are then checked for possible conflicts with
CheckConstraints()
, this requires grouping the constraints, as described below.  In refinements,
GenerateConstraints()
is then called to create the constraints that will be used, see below for  For debugging constraints,
VarRemapShow()
can be called afterGenerateConstraints()
to display the generated constraints.
8.2.1. Constraint Reorganization (ProcessConstraints()
)¶
GSASIIstrIO.ProcessConstraints()
is used to initially process the
constraints. This does these things:
The “Hold”, “Const” and “New Var” expressions are split between two paired lists,
constDictList
andfixedList
which are set: For “Hold” entries a dict with a single entry is placed in constDictList where the key is the parameter name (associated value is 0.0) and fixedList gets a value of 0.0.
 For “Const” entries, a dict with multiple entries is placed in constDictList where the key is the parameter name and the value is the multiplier for the parameter, while fixedList gets a string value corresponding to the constant value for the expression.
 For “New Var” entries, a dict with multiple entries is placed in constDictList where the key is the parameter name and the value is the multiplier for the parameter; an additional key “_vary” is given the value of True or False depending on the refinement flag setting. The corresponding entry in fixedList is None
The output from this will have this form where the first entry is a “Const”, the second is a “New Var” and the final is a “Hold”.
constrDict = [ {'0:12:Scale': 2.0, '0:14:Scale': 4.0, '0:13:Scale': 3.0, '0:0:Scale': 0.5}, {'2::C(10,6,1)': 1.0, '1::C(10,6,1)': 1.0, '_vary':True}, {'0::A0': 0.0}] fixedList = ['5.0', None, '0']
 Equivalences are stored using
StoreEquivalence()
into this module’s globals (arrayList
,invarrayList
,indParmList
,dependentParmList
andsymGenList
)
8.2.2. Parameter Grouping (GenerateConstraints()
)¶
Functions CheckConstraints()
and GenerateConstraints()
are used to
process the parameter equivalences and constraint lists created in
ProcessConstraints()
. The former is used to generate
error messages and the latter to generate the internal information used to
apply the constraints.
Initially, in both a list of parameters that are fixed and those used in
constraint relations are tabulated in CheckEquivalences()
. The equivalence
relations are the scanned for the following potential problems:
 a parameter is used as a dependent variable in more than one equivalence relation
 a parameter is fixed and used in in an equivalence relation either as a dependent or independent variable
 a parameter is used as a dependent variable in one equivalence relation and as a independent variable in another
 a parameter is used in in an equivalence relation (either as a dependent or independent variable) and is used in a constraint expression
 a parameter is not defined in a particular refinement, but is used in an equivalence relation
 a parameter uses a wildcard for the histogram number (sequential refinements)
Cases 1 & 2 above cannot be corrected, and result in errors. Cases 3 & 4 are
potentially corrected with MoveConfEquiv()
, as described below.
Case 5 causes the equivalence to
be dropped. Case 6 causes the current histogram number to be substituted for
the wildcard.
For cases 3 & 4, MoveConfEquiv()
is used to change these equivalences
into “Const” equations. This can potentially mean that additional
equivalences will be problematic, so if there are changes made by
MoveConfEquiv()
, CheckEquivalences()
is repeated. If any problem
cases are noted, the refinement cannot be performed.
Constraint expressions (“Const” and “New Var”) are sorted into
groups so that each group contains the minimum number of entries that
ensures each parameter is referenced in only one group in
GroupConstraints()
. This is done by scanning the
list of dicts in constDictList
one by one and making a list
of parameters used in that constraint expression. Any expression that contains
a parameter in is in that list is added to the current group and those
parameters are added to this list of parameters. The list of ungrouped
expressions is then scanned again until no more expressions are added to the
current group. This process is repeated until every expression has been
placed in a group. Function GroupConstraints()
returns two lists of lists.
The first has, for each group, a list of the indices in constDictList
that comprise the group (there can be only one). The second list contains,
for each group, the unique parameter names in that group.
Each constraint group is then processed. First, wildcard parameters are renamed (in a sequential refinement). Any fixed parameters that are used in constraints are noted as errors. The number of refined parameters and the number of parameters that are not defined in the current refinement are also noted. It is fine if all parameters in a group are not defined or all are not varied, but if some are defined and others not or some are varied and others not, this constitutes an error.
The contents of each group is then examined. Groups with a single parameter (holds) are ignored. Then for each group, the number of parameters in the group (Np) and the number of expressions in the group (Nc) are counted and for each expression. If Nc > Np, then the constraint is overdetermined, which also constitutes an error.
The parameter multipliers for each expression are then assembled:
M1a * P1 + M2a * P2 +... Mka * Pk
M1b * P1 + M2b * P2 +... Mkb * Pk
...
M1j * P1 + M2j * P2 +... Mkj * Pk
From this it becomes possible to create a Nc x Np matrix, which is called the constraint matrix:
\[\begin{split}\left( \begin{matrix} M_{1a} & M_{2a} &... & M_{ka} \\ M_{1b} & M_{2b} &... & M_{kb} \\ ... \\ M_{1j} & M_{2j} &... & M_{kj} \end{matrix}\right)\end{split}\]
When Nc<Np, then additional rows need to be added to the matrix and to
the vector that contains the value for each row (fixedList
) where
values are None
for New Vars and a constant for fixed values.
This then can describe a system of Np simultaneous equations:
\[\begin{split}\left( \begin{matrix} M_{1a} & M_{2a} &... & M_{ka} \\ M_{1b} & M_{2b} &... & M_{kb} \\ ... \\ M_{1j} & M_{2j} &... & M_{kj} \end{matrix}\right) \left( \begin{matrix} P_{1} \\ P_{2} \\ ... \\ P_{k} \end{matrix}\right) = \left( \begin{matrix} C_{1} & C_{2} & ... & C_{k} \end{matrix}\right)\end{split}\]
This is done by creating a square matrix from the group using
_FillArray()
with parameter FillDiagonals=False
(the default). Any
unspecified rows are left as all zero. The first Nc rows in the
array are then coverted to rowechelon form using _RowEchelon()
. This
will create an Exception if any two rows are linearly dependent (which means
that no matter what values are used for the remaining rows, that the matrix
will be singular). _FillArray()
is then called with parameter
FillDiagonals=True
, which again creates a square matrix but where
unspecified rows are zero except for the diagonal elements. The
GramSchmidt process,
implemented in GramSchmidtOrtho()
, is used to find orthonormal unit
vectors for the remaining NpNc rows of the matrix. This will fail with
a ConstraintException
if this is not possible (singular matrix) or
the result is placed in constrArr
as a numpy array.
Rows in the matrix corresponding to “New Var” constraints and those that
were generated by the GramSchmidt process are provided with parameter names
(this can be specified if a “New Var” entry by using a "_name"
element
in the constraint dict, but at present this is not implemented.) Names are
generated using paramPrefix
which is set to "::constr"
, plus a
number to make the new parameter name unique. Global dict genVarLookup
provides a lookup table, where the names of the parameters related to this new
parameter can be looked up easily.
Finally the parameters used as input to the constraint are placed in
this module’s globals
dependentParmList
and the constraint matrix is
placed in into arrayList
. This can be used to compute
the initial values for “New Var” parameters. The inverse of the
constraint matrix is placed in invarrayList
and a list
of the “New Var” parameters and a list of the fixed values (as str’s)
is placed in indParmList
. A lookup table for
fixed values as floats is placed in fixedDict
.
Finally the appropriate entry in symGenList
is set to
False to indicate that this is not a symmetry generated constraint.
8.3. ExternallyAccessible Routines¶
To define a set of constrained and unconstrained relations, one
defines a list of dictionary defining constraint parameters and their
values, a list of fixed values for each constraint and a list of
parameters to be varied. In addition, one uses
StoreEquivalence()
to define parameters that are equivalent.
Use EvaluateMultipliers()
to convert formulabased constraint/equivalence
multipliers to numbers and then
use CheckConstraints()
to check that the input is
internally consistent and finally GroupConstraints()
and
GenerateConstraints()
to generate the internally used
tables. Routine Map2Dict()
is used to initialize the parameter
dictionary and routine Dict2Map()
, Dict2Deriv()
, and
ComputeDepESD()
are used to apply constraints. Routine
VarRemapShow()
is used to print out the constraint information,
as stored by GenerateConstraints()
. Further information on each routine
is below:
InitVars()
 This is optionally used to clear out all defined previously defined constraint information
StoreEquivalence()
To implement parameter redefinition, one calls StoreEquivalence. This should be called for every set of equivalence relationships. There is no harm in using StoreEquivalence with the same independent variable:
StoreEquivalence('x',('y',)) StoreEquivalence('x',('z',))
or equivalently
StoreEquivalence('x',('y','z'))
The latter will run more efficiently. Note that mixing independent and dependent variables would require assignments, such as
StoreEquivalence('x',('y',)) StoreEquivalence('y',('z',))
would require that equivalences be applied in a particular order and thus is implemented as a constraint equation rather than an equivalence.
Use StoreEquivalence before calling GenerateConstraints or CheckConstraints
CheckConstraints()
 check that input in internally consistent
GenerateConstraints()
 generate the internally used tables from constraints and equivalences
EvaluateMultipliers()
 Convert any stringspecified (formulabased) multipliers to numbers. Call this before
using
CheckConstraints()
orGenerateConstraints()
. At present, the code may pass only the dict for phase (atom/cell) parameters, but this could be expanded if needed. Map2Dict()
 To determine values for the parameters created in this module, one calls Map2Dict. This will not apply contraints.
Dict2Map()
 To take values from the new independent parameters and constraints, one calls Dict2Map and set the parameter array, thus appling contraints.
Dict2Deriv()
 Use Dict2Deriv to determine derivatives on independent parameters from those on dependent ones.
ComputeDepESD()
 Use ComputeDepESD to compute uncertainties on dependent variables.
VarRemapShow()
 To show a summary of the parameter remapping, one calls VarRemapShow.
8.4. Global Variables¶
 dependentParmList:
 a list containing group of lists of parameters used in the group. Note that parameters listed in dependentParmList should not be refined as they will not affect the model
 indParmList:
 a list containing groups of Independent parameters defined in each group. This contains both parameters used in parameter redefinitions as well as names of generated new parameters.
 arrayList:
 a list containing group of relationship matrices to relate parameters in dependentParmList to those in indParmList. Unlikely to be used externally.
 invarrayList:
 a list containing group of relationship matrices to relate parameters in indParmList to those in dependentParmList. Unlikely to be used externally.
 fixedVarList:
 a list of parameters that have been ‘fixed’ by defining them as equal to a constant (::var: = 0). Note that the constant value is ignored at present. These parameters are later removed from varyList which prevents them from being refined. Unlikely to be used externally.
 fixedDict:
 a dictionary containing the fixed values corresponding to parameter equations. The dict key is an ascii string, but the dict value is a float. Unlikely to be used externally.
 symGenList:
 a list of boolean values that will be True to indicate that a constraint (only equivalences) is generated by symmetry (or Pawley overlap)
 problemVars:
 a list containing parameters that show up in constraints producing errors
8.5. Routines/variables¶
Note that parameter names in GSASII are strings of form <ph#>:<hst#>:<nam>
or <ph#>::<nam>:<at#>
.

GSASIImapvars.
CheckConstraints
(varyList, constrDict, fixedList)[source]¶ Takes a list of relationship entries comprising a group of constraints and checks for inconsistencies such as conflicts in parameter/variable definitions and or inconsistently varied parameters.
Parameters:  varyList (list) – a list of parameters names that will be varied
 constrDict (dict) – a list of dicts defining relationships/constraints
(as created in
GSASIIstrIO.ProcessConstraints()
and documented inGroupConstraints()
)  fixedList (list) – a list of values specifying a fixed value for each
dict in constrDict. Values are either strings that can be converted to
floats or
None
if the constraint defines a new parameter rather than a constant.
Returns: two strings:
 the first lists conflicts internal to the specified constraints
 the second lists conflicts where the varyList specifies some parameters in a constraint, but not all
If there are no errors, both strings will be empty

GSASIImapvars.
CheckEquivalences
(constrDict, varyList, parmDict=None, SeqHist=None)[source]¶ Process equivalence constraints, looking for conflicts such as where a parameter is used in both an equivalence and a constraint expression or where chaining is done (A>B and B>C). When called during refinements, parmDict is defined, and for sequential refinement SeqHist ia also defined.
 parmDict is used to remove equivalences where a parameter is not present in a refinement
 SeqHist is used to rename wildcard parameter names in sequential refinements to use the current histogram.

GSASIImapvars.
ComputeDepESD
(covMatrix, varyList, parmDict)[source]¶ Compute uncertainties for dependent parameters from independent ones returns a dictionary containing the esd values for dependent parameters

exception
GSASIImapvars.
ConstraintException
[source]¶ Defines an Exception that is used when an exception is raised processing constraints

GSASIImapvars.
Dict2Deriv
(varyList, derivDict, dMdv)[source]¶ Compute derivatives for Independent Parameters from the derivatives for the original parameters
Parameters:  varyList (list) – a list of parameters names that will be varied
 derivDict (dict) – a dict containing derivatives for parameter values keyed by the parameter names.
 dMdv (list) – a Jacobian, as a list of np.array containing derivatives for dependent parameter computed from derivDict

GSASIImapvars.
Dict2Map
(parmDict, varyList)[source]¶ Applies the constraints defined using
StoreEquivalence()
,GroupConstraints()
andGenerateConstraints()
by changing values in a dict containing the parameters. This should be done before the parameters are used for any computationsParameters:  parmDict (dict) – a dict containing parameter values keyed by the parameter names. This will contain updated values for both dependent and independent parameters after Dict2Map is called. It will also contain some unexpected entries of every constant value {‘0’:0.0} & {‘1.0’:1.0}, which do not cause any problems.
 varyList (list) – a list of parameters names that will be varied

GSASIImapvars.
EvaluateMultipliers
(constList, *dicts)[source]¶ Convert multipliers for constraints and equivalences that are specified as strings into values. The strings can specify values in the parameter dicts as well as normal Python functions, such as “2*np.cos(0::Ax:2/2.)”
Parameters:  constList (list) – a list of dicts containing constraint expressions
 *dicts – one or more dicts containing GSASII parameters and their values can be specified
Returns: an empty string if there were no errors, or an error message listing the strings that could not be converted.

GSASIImapvars.
GenerateConstraints
(varyList, constrDict, fixedList, parmDict=None, SeqHist=None)[source]¶ Takes a list of relationship entries comprising a group of constraints and builds the relationship lists and their inverse and stores them in global parameters Also checks for internal conflicts or inconsistencies in parameter/variable definitions.
Parameters:  varyList (list) – a list of parameters names (strings of form
<ph>:<hst>:<nam>
) that will be varied. Note that this is changed here.  constrDict (dict) – a list of dicts defining relationships/constraints
(as defined in
GroupConstraints()
)  fixedList (list) – a list of values specifying a fixed value for each dict in constrDict. Values are either strings that can be converted to floats, float values or None if the constraint defines a new parameter.
 parmDict (dict) – a dict containing all parameters defined in current refinement.
 SeqHist (int) – number of current histogram, when used in a sequential refinement. None (default) otherwise. Wildcard parameter names are set to the current histogram, when found if not None.
 varyList (list) – a list of parameters names (strings of form

GSASIImapvars.
GetDependentVars
()[source]¶ Return a list of dependent variables: e.g. parameters that are constrained in terms of other parameters
Returns: a list of parameter names

GSASIImapvars.
GetIndependentVars
()[source]¶ Return a list of independent variables: e.g. parameters that are slaved to other parameters by constraints
Returns: a list of parameter names

GSASIImapvars.
GetSymEquiv
()[source]¶ Return the automatically generated (equivalence) relationships.
Returns: a list of strings containing the details of the contraint relationships

GSASIImapvars.
GramSchmidtOrtho
(a, nkeep=0)[source]¶ Use the GramSchmidt process (http://en.wikipedia.org/wiki/GramSchmidt) to find orthonormal unit vectors relative to first row.
If nkeep is nonzero, the first nkeep rows in the array are not changed
 input:
 arrayin: a 2D nonsingular square array
 returns:
 a orthonormal set of unit vectors as a square array

GSASIImapvars.
GroupConstraints
(constrDict)[source]¶ divide the constraints into groups that share no parameters.
Parameters: constrDict (dict) – a list of dicts defining relationships/constraints constrDict = [{<constr1>}, {<constr2>}, ...]
where {<constr1>} is {‘var1’: mult1, ‘var2’: mult2,… }
Returns: two lists of lists:  a list of grouped contraints where each constraint grouped containts a list of indices for constraint constrDict entries
 a list containing lists of parameter names contained in each group

GSASIImapvars.
Map2Dict
(parmDict, varyList)[source]¶ Create (or update) the Independent Parameters from the original set of Parameters
Removes dependent variables from the varyList
This should be done once, after the constraints have been defined using
StoreEquivalence()
,GroupConstraints()
andGenerateConstraints()
and before any parameter refinement is done. This completes the parameter dictionary by defining independent parameters and it satisfies the constraint equations in the initial parametersParameters:  parmDict (dict) – a dict containing parameter values keyed by the parameter names. This will contain updated values for both dependent and independent parameters after Dict2Map is called. It will also contain some unexpected entries of every constant value {‘0’:0.0} & {‘1.0’:1.0}, which do not cause any problems.
 varyList (list) – a list of parameters names that will be varied

GSASIImapvars.
MoveConfEquiv
(constrDict, fixedList)[source]¶ Address conflicts in Equivalence constraints by creating an constraint equation that has the same action as the equivalence and removing the Equivalence

GSASIImapvars.
PrintIndependentVars
(parmDict, varyList, sigDict, PrintAll=False, pFile=None)[source]¶ Print the values and uncertainties on the independent parameters

GSASIImapvars.
StoreEquivalence
(independentVar, dependentList, symGen=True)[source]¶ Takes a list of dependent parameter(s) and stores their relationship to a single independent parameter (independentVar).
Called with usersupplied constraints by
GSASIIstrIO.ProcessConstraints, with Pawley constraints from :func:`GSASIIstrIO.GetPawleyConstr()
, with Unit Cell constraints fromGSASIIstrIO.cellVary()
with symmetrygenerated atom constraints fromGSASIIstrIO.GetPhaseData()
Parameters:  independentVar (str) – name of master parameter that will be used to determine the value to set the dependent variables
 dependentList (list) – a list of parameters that will set from
independentVar. Each item in the list can be a string with the parameter
name or a tuple containing a name and multiplier:
['::parm1',('::parm2',.5),]

GSASIImapvars.
VarKeys
(constr)[source]¶ Finds the keys in a constraint that represent parameters e.g. eliminates any that start with ‘_’
Parameters: constr (dict) – a single constraint entry of form:
{'var1': mult1, 'var2': mult2,... '_notVar': val,...}
(see
GroupConstraints()
)Returns: a list of keys where any keys beginning with ‘_’ are removed.

GSASIImapvars.
VarRemapShow
(varyList, inputOnly=False)[source]¶ List out the saved relationships. This should be done after the constraints have been defined using
StoreEquivalence()
,GroupConstraints()
andGenerateConstraints()
.Returns: a string containing the details of the contraint relationships

GSASIImapvars.
arrayList
= []¶ a list of of relationship matrices that map model parameters in each constraint group (in
dependentParmList
) to generated (New Var) parameters.

GSASIImapvars.
consNum
= 0¶ The number to be assigned to the next constraint to be created

GSASIImapvars.
dependentParmList
= []¶ a list of lists where each item contains a list of parameters in each constraint group. note that parameters listed in dependentParmList should not be refined directly.

GSASIImapvars.
dependentVars
= []¶ A list of dependent variables, taken from (
dependentParmList
).

GSASIImapvars.
fixedDict
= {}¶ A dict lookuptable containing the fixed values corresponding to defined parameter equations. Note the key is the original ascii string and the value in the dict is a float.

GSASIImapvars.
fixedVarList
= []¶ List of parameters that should not be refined.

GSASIImapvars.
genVarLookup
= {}¶ provides a list of parameters that are related to each generated parameter

GSASIImapvars.
indParmList
= []¶ a list of lists where each item contains a list for each constraint group with fixed values for constraint equations and names of generated (New Var) parameters.

GSASIImapvars.
independentVars
= []¶ A list of dependent variables, taken from (
indParmList
).

GSASIImapvars.
invarrayList
= []¶ a list of of inverserelationship matrices that map constrained values and generated (New Var) parameters (in
indParmList
) to model parameters (independentParmList
).

GSASIImapvars.
paramPrefix
= '::constr'¶ A prefix for generated parameter names

GSASIImapvars.
problemVars
= []¶ a list of parameters causing errors

GSASIImapvars.
symGenList
= []¶ A list of flags that if True indicates a constraint was generated by symmetry