Skip to content

Commit 22e3692

Browse files
committed
deploy: c5a50dc
1 parent dff130c commit 22e3692

21 files changed

Lines changed: 3145 additions & 109 deletions

File tree

.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 73080f2f80c5c857268e5728fb5a359d
3+
config: ef272f409fa0d83ba87a930e5dc91fde
44
tags: 645f666f9bcd5a90fca523b33c5a78b7
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
title structure Ni FCC
2+
format pdffit
3+
scale 1.000000
4+
sharp 0.000000, 1.000000, 0.000000
5+
spcgr Fm-3m
6+
cell 3.520000, 3.520000, 3.520000, 90.000000, 90.000000, 90.000000
7+
dcell 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000
8+
ncell 1, 1, 1, 4
9+
atoms
10+
NI 0.00000000 0.00000000 0.00000000 1.0000
11+
0.00000000 0.00000000 0.00000000 0.0000
12+
0.00126651 0.00126651 0.00126651
13+
0.00000000 0.00000000 0.00000000
14+
0.00000000 0.00000000 0.00000000
15+
0.00000000 0.00000000 0.00000000
16+
NI 0.00000000 0.50000000 0.50000000 1.0000
17+
0.00000000 0.00000000 0.00000000 0.0000
18+
0.00126651 0.00126651 0.00126651
19+
0.00000000 0.00000000 0.00000000
20+
0.00000000 0.00000000 0.00000000
21+
0.00000000 0.00000000 0.00000000
22+
NI 0.50000000 0.00000000 0.50000000 1.0000
23+
0.00000000 0.00000000 0.00000000 0.0000
24+
0.00126651 0.00126651 0.00126651
25+
0.00000000 0.00000000 0.00000000
26+
0.00000000 0.00000000 0.00000000
27+
0.00000000 0.00000000 0.00000000
28+
NI 0.50000000 0.50000000 0.00000000 1.0000
29+
0.00000000 0.00000000 0.00000000 0.0000
30+
0.00126651 0.00126651 0.00126651
31+
0.00000000 0.00000000 0.00000000
32+
0.00000000 0.00000000 0.00000000
33+
0.00000000 0.00000000 0.00000000
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
"""Perform simple refinement of Ni structure to the experimental x-ray PDF.
5+
Save fitted curve, refined structure and results summary.
6+
"""
7+
8+
import matplotlib.pyplot as plt
9+
import numpy
10+
11+
from diffpy.pdffit2 import PdfFit
12+
13+
# Create new PDF calculator object.
14+
pf = PdfFit()
15+
16+
# Load data ------------------------------------------------------------------
17+
18+
# Load experimental x-ray PDF data
19+
qmax = 30.0 # Q-cutoff used in PDF calculation in 1/A
20+
qdamp = 0.01 # instrument Q-resolution factor, responsible for PDF decay
21+
pf.read_data("Ni-xray.gr", "X", qmax, qdamp)
22+
23+
# Load nickel structure, must be in PDFFIT or DISCUS format
24+
pf.read_struct("Ni.stru")
25+
26+
# Configure Refinement -------------------------------------------------------
27+
28+
# Refine lattice parameters a, b, c.
29+
# Make them all equal to parameter @1.
30+
pf.constrain(pf.lat(1), "@1")
31+
pf.constrain(pf.lat(2), "@1")
32+
pf.constrain(pf.lat(3), "@1")
33+
# set initial value of parameter @1
34+
pf.setpar(1, pf.lat(1))
35+
36+
# Refine phase scale factor. Right side can have formulas.
37+
pf.constrain("pscale", "@20 * 2")
38+
pf.setpar(20, pf.getvar(pf.pscale) / 2.0)
39+
40+
# Refine PDF damping due to instrument Q-resolution.
41+
# Left side can be also passed as a reference to PdfFit object
42+
pf.constrain(pf.qdamp, "@21")
43+
pf.setpar(21, 0.03)
44+
45+
# Refine sharpening factor for correlated motion of close atoms.
46+
pf.constrain(pf.delta2, 22)
47+
pf.setpar(22, 0.0003)
48+
49+
# Set all temperature factors isotropic and equal to @4
50+
for idx in range(1, 5):
51+
pf.constrain(pf.u11(idx), "@4")
52+
pf.constrain(pf.u22(idx), "@4")
53+
pf.constrain(pf.u33(idx), "@4")
54+
pf.setpar(4, pf.u11(1))
55+
56+
# Refine ---------------------------------------------------------------------
57+
58+
pf.pdfrange(1, 1.5, 19.99)
59+
pf.refine()
60+
61+
# Save results ---------------------------------------------------------------
62+
63+
pf.save_pdf(1, "Ni_refinement.fgr")
64+
pf.save_struct(1, "Ni_refinement.rstr")
65+
pf.save_res("Ni_refinement.res")
66+
67+
# Plot results ---------------------------------------------------------------
68+
69+
# obtain data from PdfFit calculator object
70+
r = pf.getR()
71+
Gobs = pf.getpdf_obs()
72+
Gfit = pf.getpdf_fit()
73+
74+
# calculate difference curve
75+
Gdiff = numpy.array(Gobs) - numpy.array(Gfit)
76+
Gdiff_baseline = -10
77+
78+
plt.plot(r, Gobs, "ko")
79+
plt.plot(r, Gfit, "b-")
80+
plt.plot(r, Gdiff + Gdiff_baseline, "r-")
81+
82+
plt.xlabel("r (Å)")
83+
plt.ylabel("G (Å$^{-2}$)")
84+
plt.title("Fit of nickel to x-ray experimental PDF")
85+
86+
# display plot window, this must be the last command in the script
87+
plt.show()

0 commit comments

Comments
 (0)