Exporting structure files for multiple fits simulatenously

110 views
Skip to first unread message

Robert Koch

unread,
May 14, 2018, 4:51:54 PM5/14/18
to diffpy-users
Hello,

My apologies if this topic already exists. I did a cursory search but could not find a relevant post here.

I am doing r-range fits for 36-atom structures. I can plot e.g. the lattice parameter, atomic position, or occupancy as a function of fit index easily. What I cannot seem to do is dump all the refined structures with a few clicks. As far as I can tell, I need to do this fit by fit, and with 6 data sets and 20 fits for each, this seems overly cumbersome.

Is there a way to do this easily? I tried reading the ddp file directly, but it appears to be a binary file (maybe a pickle?). Is there a python module that will allow me to read the data in this ddp file and parse out the structure information using a python terminal?

I ask because I'd like to quantify the tunnel volume in our hollandite phases as a function of fitting window, and do to this I need to be able to read in each structure. Accessing refined parameter uncertainties in a similar manner, even if their absolute value is meaningless, would also be useful, as I could propagate these relative values through a tunnel volume calculation to give some idea of reliability as a function of fitting window.

Thanks in advance for any tips!
Rob Koch

Pavol Juhas

unread,
May 15, 2018, 7:25:57 PM5/15/18
to diffpy...@googlegroups.com
On Mon, May 14, 2018 at 01:51:54PM -0700, Robert Koch wrote:
...
> I am doing r-range fits for 36-atom structures. I can plot e.g. the lattice
> parameter, atomic position, or occupancy as a function of fit index easily.
> What I cannot seem to do is dump all the refined structures with a few
> clicks. As far as I can tell, I need to do this fit by fit, and with 6 data
> sets and 20 fits for each, this seems overly cumbersome.

Hi Robert, This is possible with the diffpy.pdfgui.tui module
which has function to load and manipulate PDFgui project file.
See the short examples at
http://www.diffpy.org/doc/pdfgui/index.html#Advanced-post_002dprocessing-of-sequential-refinement
and
https://github.com/diffpy/diffpy.pdfgui/blob/master/doc/tutorial/tui_mno_bond_lengths.py
Assuming `phase` is one of the items in the `project.getPhases()`
list, you can export the refined structure using the
`phase.refined.write(filename, format)` function.

...
> Accessing refined parameter uncertainties in a similar manner, even
> if their absolute value is meaningless, would also be useful, as
> I could propagate these relative values through a tunnel volume
> calculation to give some idea of reliability as a function of
> fitting window.

Unfortunately, there is no Python interface to access parameter
uncertainties. The only workaround is to parse the results
summary text which is in the `res` attribute of each fit object.
Example:


import re
from diffpy.pdfgui import tui
project = tui.LoadProject("SomeProject.ddp")
restext = project.getFits()[0].res
idxuncpairs = re.findall(r'\b(\d+): \S+ [(](\S*\d\S*)[)]', restext)
uncertainties = dict((int(i), float(u)) for i, u in idxuncpairs)


Hope this helps,

Pavol

--
Dr. Pavol Juhas
Computational Science Initiative
Brookhaven National Laboratory
P.O. Box 5000
Upton, NY 11973-5000
tel: +1-631-344-3594
fax: +1-631-344-5751

Robert Koch

unread,
May 15, 2018, 7:28:39 PM5/15/18
to diffpy...@googlegroups.com
Thanks Pavol, I suspected there was an easy solution. I appreciate the quick response. I will try this tomorrow when I get in. 

Cheers,
Rob

--
You received this message because you are subscribed to a topic in the Google Groups "diffpy-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/diffpy-users/-4XZ37z3vc8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to diffpy-users...@googlegroups.com.
To post to this group, send email to diffpy...@googlegroups.com.
Visit this group at https://groups.google.com/group/diffpy-users.
For more options, visit https://groups.google.com/d/optout.

Robert Koch

unread,
May 16, 2018, 11:12:02 AM5/16/18
to diffpy...@googlegroups.com
Thanks Pavol, This worked perfectly. I need to fiddle a bit with the Reg Ex code, but I think I can get it.

Cheers!
Rob

To unsubscribe from this group and all its topics, send an email to diffpy-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages