On Tue, Nov 03, 2015 at 08:53:27AM -0800, Maria Diaz Lopez wrote:
...
> Many thanks for your response. May I know what are the options for refining
> the atomic occupancies with and without the space gorup info?
Hi Maria, I am sorry about taking so long to respond. There is no
direct support for occupancy constraints in the constrainAsSpaceGroup
function. The diffpy Structure representation expands asymmetric
unit to a full unit cell, so you probably need to constrain all
equivalent sites to the same occupancy. This can be done by
checking the atom labels at the expanded sites. If NaCl.cif file has
"Na1" and "Cl1" sites in the asymmetric unit, the labels in the
diffpy.Structure object would be "Na1" for the original site and
"Na1_i" for its symmetry images:
from diffpy.Structure import loadStructure
nacl = loadStructure('NaCl.cif')
print(nacl.label)
# chararray(['Na1', 'Na1_2', 'Na1_3', 'Na1_4', 'Cl1', ...
When some structure is added to a PDF contribution, the srfit
generates a set of parameters for all of its structure values, which
can be then constrained or restrained. Most srfit objects have
a show() function to displays a hierarchy of their parameters:
salt = PDFContribution('salt')
salt.addStructure('nacl', nacl)
salt.show()
salt # the total PDF contribution
...
nacl # contribution from one phase
...
phase
Cl1m1 # parameters for the Cl1 site
...
occ 1.0 # occ is an alias for occupancy
occupancy 1.0
To refine atom occupancies we need to link the relevant structure
parameters to some variables in the top-level Fit recipe:
recipe = FitRecipe()
recipe.addContribution(salt)
# define 2 variables for site occupancies
oNa = recipe.newVar("oNa", value=1.0)
oCl = recipe.newVar("oCl", value=1.0)
# loop over atom-related structure parameters `ap`
for ap in salt.nacl.phase.atoms:
lb = ap.atom.label # recover the atom label
if lb.startswith('Na1'):
# constrain to oNa for the Na1 site and its symmetry images
recipe.constrain(ap.occupancy, oNa)
if lb.startswith('Cl1'):
# constrain to oCl for the Cl1 site and its images
recipe.constrain(ap.occupancy, oCl)
After this the FitRecipe variables oNa, oCl should control all sodium
and chlorine occupancies. The code above is untested and should just
illustrate one way of constraining the occupancies. I admit it is
quite steep to become familiar with the fit-parameter names and
hierarchy. A helpful approach is to start with a partial script and
explore the fit objects with IPython tab completion or with
"help(obj)" or "obj.show()".
Before spending a lot of time on fit scripts, I would recommend to
do a few quick PDF simulations to make sure there is a clear
response in the PDF signal to occupancy changes. In my experience
such response is usually limited to the first few PDF peaks and at
longer distances the peaks remain quite constant.
Good luck, I hope this helps,
Pavol