Constraining sublattices with different space groups in diffpy-cmi

55 views
Skip to first unread message

Sandra Skjærvø

unread,
Aug 17, 2021, 6:51:44 PM8/17/21
to diffpy-users
Hi,

I have a structure that can be divided into two sublattices (oxygens in one and cations in another), and I want to give those two sublattices different spacegroup constraints using ConstrainAsSpacegroup. I know this is possible in PDFgui by simply marking the atoms of the sublattices separately and adding contraints. How can I do this in CMI? Do I need to define the sublattices as separate structures, or can I use the methods in class DiffpyStructureParSet directly?

I hope I have provided enough info, but if not, let me know.
Thanks in advance!

Sandra

Mikkel Juelsholt

unread,
Sep 13, 2021, 7:14:44 AM9/13/21
to diffpy-users
Hi Sandra

If you have not figured this out yet, I know a slow and dirty way to do it. 

If you load in your structure in a P1 space group, then you can manually write the symmetry constraints. 

For example I have this code with a hexagonal structure where I want to break the symmetry of some atoms and not of others. I have written something like this: 

# Add the structural paramters using space group constaints for the crystal
# Ignore the ADP-s which will be set later.

phase_crystal = pdfgenerator_crystal.phase
sgpars_crystal = phase_crystal.sgpars


#Set unit cell parameters
for par in sgpars_crystal.latpars:
    recipe.addVar(par, name=par.name+'_s', tag='cell')

# Constrain a and b so we keep the hexagonal unit cell
recipe.constrain('a_s','b_s')
    
#Load in the atomif postions and name them
for par in sgpars_crystal.xyzpars:
    lclabel = par.par.obj.GetName().lower()
    lcsymbol = lclabel.rstrip(string.digits)

    # name the variables
    name="{}_{}".format(par.par.name, lclabel)
    tags = ['xyz', 'xyz_' + lclabel, 'xyz_' + lcsymbol]
    recipe.addVar(par, name=name, tags=tags)
    
#  Manually add the symmetry relations between the 6 W atoms that is generated from expanding the structure into P1. 
recipe.newVar('xw1')
recipe.constrain('x_w1','xw1')
recipe.constrain('y_w1','xw1')
recipe.constrain('x_w2','-xw1+1')
recipe.constrain('y_w3','-xw1+1')
recipe.constrain('x_w4','-xw1+1')
recipe.constrain('y_w4','-xw1+1')
recipe.constrain('x_w5','xw1')
recipe.constrain('y_w6','xw1')

I hope this makes sense. 

Mikkel
Reply all
Reply to author
Forward
0 new messages