|
3 | 3 | { |
4 | 4 | "cell_type": "code", |
5 | 5 | "execution_count": null, |
6 | | - "id": "b1e6b328", |
| 6 | + "id": "ab0fa7f5", |
7 | 7 | "metadata": { |
8 | 8 | "tags": [ |
9 | 9 | "hide-in-docs" |
|
26 | 26 | "source": [ |
27 | 27 | "# Structure Refinement: LBCO, HRPT\n", |
28 | 28 | "\n", |
29 | | - "This minimalistic example is designed to show how Rietveld refinement\n", |
30 | | - "can be performed when both the crystal structure and experiment\n", |
31 | | - "parameters are defined using CIF files.\n", |
| 29 | + "This basic example is designed to show how Rietveld refinement can be\n", |
| 30 | + "performed when both the crystal structure and experiment parameters\n", |
| 31 | + "are defined using CIF files.\n", |
32 | 32 | "\n", |
33 | 33 | "For this example, constant-wavelength neutron powder diffraction data\n", |
34 | 34 | "for La0.5Ba0.5CoO3 from HRPT at PSI is used.\n", |
35 | 35 | "\n", |
36 | | - "It does not contain any advanced features or options, and includes no\n", |
37 | | - "comments or explanations—these can be found in the other tutorials.\n", |
38 | | - "Default values are used for all parameters if not specified. Only\n", |
39 | | - "essential and self-explanatory code is provided.\n", |
40 | | - "\n", |
41 | 36 | "The example is intended for users who are already familiar with the\n", |
42 | | - "EasyDiffraction library and want to quickly get started with a simple\n", |
43 | | - "refinement. It is also useful for those who want to see what a\n", |
44 | | - "refinement might look like in code. For a more detailed explanation of\n", |
45 | | - "the code, please refer to the other tutorials." |
| 37 | + "EasyDiffraction library and want to quickly get started with a basic\n", |
| 38 | + "refinement.\n", |
| 39 | + "\n", |
| 40 | + "It is also useful for those who want to see how constraints can be\n", |
| 41 | + "applied to highly correlated parameters. For a more detailed\n", |
| 42 | + "explanation of the code, please refer to the other tutorials." |
46 | 43 | ] |
47 | 44 | }, |
48 | 45 | { |
|
147 | 144 | "id": "11", |
148 | 145 | "metadata": {}, |
149 | 146 | "source": [ |
150 | | - "## Step 4: Perform Analysis (cryspy)" |
| 147 | + "## Step 4: Perform Analysis (no constraints)" |
151 | 148 | ] |
152 | 149 | }, |
153 | 150 | { |
|
157 | 154 | "metadata": {}, |
158 | 155 | "outputs": [], |
159 | 156 | "source": [ |
160 | | - "# Define aliases and constraints for refinement. This is necessary to\n", |
161 | | - "# properly refine the isotropic displacement parameters of La and Ba,\n", |
162 | | - "# which are correlated due to their shared Wyckoff position.\n", |
163 | | - "project.analysis.aliases.create(\n", |
164 | | - " label='biso_La',\n", |
165 | | - " param=project.structures['lbco'].atom_sites['La'].b_iso,\n", |
166 | | - ")\n", |
167 | | - "project.analysis.aliases.create(\n", |
168 | | - " label='biso_Ba',\n", |
169 | | - " param=project.structures['lbco'].atom_sites['Ba'].b_iso,\n", |
170 | | - ")\n", |
171 | | - "project.analysis.constraints.create(expression='biso_Ba = biso_La')" |
| 157 | + "# Start refinement. All parameters, which have standard uncertainties\n", |
| 158 | + "# in the input CIF files, are refined by default.\n", |
| 159 | + "project.analysis.fit()" |
172 | 160 | ] |
173 | 161 | }, |
174 | 162 | { |
|
178 | 166 | "metadata": {}, |
179 | 167 | "outputs": [], |
180 | 168 | "source": [ |
181 | | - "# Start refinement. All parameters, which have standard uncertainties\n", |
182 | | - "# in the input CIF files, are refined by default.\n", |
183 | | - "project.analysis.fit()" |
| 169 | + "# Show fit results summary\n", |
| 170 | + "project.analysis.display.fit_results()" |
184 | 171 | ] |
185 | 172 | }, |
186 | 173 | { |
|
190 | 177 | "metadata": {}, |
191 | 178 | "outputs": [], |
192 | 179 | "source": [ |
193 | | - "# Show fit results summary\n", |
194 | | - "project.analysis.display.fit_results()" |
| 180 | + "# Show parameter correlations\n", |
| 181 | + "project.plotter.plot_param_correlations()" |
195 | 182 | ] |
196 | 183 | }, |
197 | 184 | { |
198 | | - "cell_type": "code", |
199 | | - "execution_count": null, |
| 185 | + "cell_type": "markdown", |
200 | 186 | "id": "15", |
201 | 187 | "metadata": {}, |
202 | | - "outputs": [], |
203 | 188 | "source": [ |
204 | | - "# Show defined experiment names\n", |
205 | | - "project.experiments.show_names()" |
| 189 | + "## Step 5: Perform Analysis (with constraints)" |
206 | 190 | ] |
207 | 191 | }, |
208 | 192 | { |
|
212 | 196 | "metadata": {}, |
213 | 197 | "outputs": [], |
214 | 198 | "source": [ |
215 | | - "# Plot measured vs. calculated diffraction patterns\n", |
216 | | - "project.plotter.plot_meas_vs_calc(expt_name='hrpt', show_residual=True)" |
| 199 | + "# As can be seen from the parameter-correlation plot, the isotropic\n", |
| 200 | + "# displacement parameters of La and Ba are highly correlated. Because\n", |
| 201 | + "# La and Ba share the same mixed-occupancy site, their contributions to\n", |
| 202 | + "# the neutron diffraction pattern are difficult to separate, especially\n", |
| 203 | + "# since their coherent scattering lengths are not very different.\n", |
| 204 | + "# Therefore, it is necessary to constrain them to be equal. First we\n", |
| 205 | + "# define aliases and then use them to create a constraint.\n", |
| 206 | + "project.analysis.aliases.create(\n", |
| 207 | + " label='biso_La',\n", |
| 208 | + " param=project.structures['lbco'].atom_sites['La'].b_iso,\n", |
| 209 | + ")\n", |
| 210 | + "project.analysis.aliases.create(\n", |
| 211 | + " label='biso_Ba',\n", |
| 212 | + " param=project.structures['lbco'].atom_sites['Ba'].b_iso,\n", |
| 213 | + ")\n", |
| 214 | + "project.analysis.constraints.create(expression='biso_Ba = biso_La')" |
217 | 215 | ] |
218 | 216 | }, |
219 | 217 | { |
220 | | - "cell_type": "markdown", |
| 218 | + "cell_type": "code", |
| 219 | + "execution_count": null, |
221 | 220 | "id": "17", |
222 | 221 | "metadata": {}, |
| 222 | + "outputs": [], |
223 | 223 | "source": [ |
224 | | - "## Step 5: Perform Analysis (crysfml)" |
| 224 | + "# Start refinement. All parameters, which have standard uncertainties\n", |
| 225 | + "# in the input CIF files, are refined by default.\n", |
| 226 | + "project.analysis.fit()" |
225 | 227 | ] |
226 | 228 | }, |
227 | 229 | { |
|
231 | 233 | "metadata": {}, |
232 | 234 | "outputs": [], |
233 | 235 | "source": [ |
234 | | - "# Change calculation engine from 'cryspy' to 'crysfml'\n", |
235 | | - "project.experiments['hrpt'].show_supported_calculator_types()\n", |
236 | | - "project.experiments['hrpt'].calculator_type = 'crysfml'" |
| 236 | + "# Show fit results summary\n", |
| 237 | + "project.analysis.display.fit_results()" |
237 | 238 | ] |
238 | 239 | }, |
239 | 240 | { |
|
243 | 244 | "metadata": {}, |
244 | 245 | "outputs": [], |
245 | 246 | "source": [ |
246 | | - "# Start refinement\n", |
247 | | - "project.analysis.fit()" |
| 247 | + "# Show parameter correlations\n", |
| 248 | + "project.plotter.plot_param_correlations()" |
248 | 249 | ] |
249 | 250 | }, |
250 | 251 | { |
|
254 | 255 | "metadata": {}, |
255 | 256 | "outputs": [], |
256 | 257 | "source": [ |
257 | | - "# Show fit results summary\n", |
258 | | - "project.analysis.display.fit_results()" |
| 258 | + "# Show defined experiment names\n", |
| 259 | + "project.experiments.show_names()" |
259 | 260 | ] |
260 | 261 | }, |
261 | 262 | { |
|
0 commit comments