out_pdcif
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
out_pdcif [2022/12/06 15:23] – johnsoevans | out_pdcif [2023/04/01 12:29] (current) – rowlesmr3 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Powder CIF Output ====== | ||
+ | The macros below are from Matthew Rowles and should produce full powder cifs in a journal-friendly format. | ||
+ | |||
+ | The whole file needs to be saved as cif.inc in your main topas directory and the line "# | ||
+ | |||
+ | You can read the paper in [[https:// | ||
+ | |||
+ | You can download the windows version at [[https:// | ||
+ | |||
+ | Install the python version with: pip install pdCIFplotter. | ||
+ | |||
+ | On windows you may need to preinstall PyCifRW. | ||
+ | |||
+ | Run the python version with: python -m pdCIFplotter | ||
+ | |||
+ | Update the python version with: pip install --upgrade pdCIFplotter (2 minus signs in front of upgrade). | ||
+ | |||
+ | More details at the links above. | ||
+ | |||
+ | The minimum information you need to add to your topas INP file is: "local CIF_PHASE_ID 1" in each str section and " | ||
+ | |||
+ | <code topas> | ||
+ | #ifndef CIF_MACROS | ||
+ | #define CIF_MACROS | ||
+ | /* | ||
+ | Updated 1 Apr 23 | ||
+ | |||
+ | Written by Matthew Rowles. | ||
+ | Inspiration taken from topas.inc and http:// | ||
+ | |||
+ | Read the first sections for information only. Unless you want to build | ||
+ | your own CIF file output. Best head on to the end of this file for the | ||
+ | actual macros to use (and the comments immediately preceeding). | ||
+ | |||
+ | To get maximum benefit, copy this file to your TOPAS directory and add | ||
+ | the following line to your local.inc: | ||
+ | #include cif.inc | ||
+ | |||
+ | For updates, check http:// | ||
+ | |||
+ | ----------- | ||
+ | |||
+ | MIT License | ||
+ | |||
+ | Copyright (c) 2022 Matthew Rowles | ||
+ | |||
+ | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
+ | of this software and associated documentation files (the " | ||
+ | in the Software without restriction, | ||
+ | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
+ | copies of the Software, and to permit persons to whom the Software is | ||
+ | furnished to do so, subject to the following conditions: | ||
+ | |||
+ | The above copyright notice and this permission notice shall be included in all | ||
+ | copies or substantial portions of the Software. | ||
+ | |||
+ | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
+ | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
+ | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
+ | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
+ | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
+ | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
+ | SOFTWARE. | ||
+ | */ | ||
+ | |||
+ | '##############################################################' | ||
+ | ' | ||
+ | macro TOF_ED_CW(tof, | ||
+ | /* | ||
+ | This macro allows you to choose between three different things depending | ||
+ | on whether or not the data is TOF, EDXRD, or constant wavelength | ||
+ | */ | ||
+ | if And(Obj_There(neutron), | ||
+ | tof | ||
+ | } else if Obj_There(d_spacing_to_energy_in_eV_for_f1_f11) { ' | ||
+ | ed | ||
+ | } else { ' | ||
+ | cw | ||
+ | } | ||
+ | } | ||
+ | |||
+ | macro & d_spacing_from_TOF(& | ||
+ | ' This macro calculates d spacing from TOF' | ||
+ | (-t1 + Sqrt(t1^2 - 4 t2 (t0 - X))) / (2 t2) | ||
+ | } | ||
+ | |||
+ | macro & d_spacing_from_EDXRD(& | ||
+ | ' This macro calculates d spacing from EDXRD - th2 is the angle of the detector in degrees' | ||
+ | 12398.41974 / ( 2 X Sin(th2 Deg_on_2)) ' X is eV' | ||
+ | '= (h c / e) / (1x10^-10) -> eV per angstrom' | ||
+ | } | ||
+ | |||
+ | macro n_to_m(n,m) { | ||
+ | #m_ifarg n "" | ||
+ | 'do nothing' | ||
+ | #m_else | ||
+ | #m_ifarg m "" | ||
+ | ' | ||
+ | #m_else | ||
+ | n## to ##m | ||
+ | #m_endif | ||
+ | #m_endif | ||
+ | } | ||
+ | |||
+ | '##############################################################' | ||
+ | ' Macros common to diffraction data and crystal structures' | ||
+ | '##############################################################' | ||
+ | |||
+ | macro Out_CIF_newfile(ciffile) { | ||
+ | 'Opens a file for appending to.' | ||
+ | out ciffile append | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_section_break(comment) { | ||
+ | ' | ||
+ | Out_String(" | ||
+ | Out_String(comment) | ||
+ | Out_String(" | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_datablock(blocknamebase, | ||
+ | /* | ||
+ | Create the start of an entry in a CIF file. All CIF files must contain at least | ||
+ | one datablock. The name must be unique. | ||
+ | |||
+ | blocknamebase: | ||
+ | id: an identifier to be appended to the blocknamebase to ensure the | ||
+ | datablock name is unique. No spaces! | ||
+ | */ | ||
+ | Out_String(" | ||
+ | Out(blocknamebase, | ||
+ | Out(id, " | ||
+ | } | ||
+ | macro Out_CIF_datablock_dataname { | ||
+ | Out_String(" | ||
+ | } | ||
+ | |||
+ | macro Out_unique_phase_id(id) { | ||
+ | if Prm_There(CIF_PHASE_BLOCK_ID) { | ||
+ | Out(CIF_PHASE_BLOCK_ID, | ||
+ | } else { | ||
+ | Out(Get(phase_name), | ||
+ | Out(id, " | ||
+ | } | ||
+ | } | ||
+ | |||
+ | macro Out_unique_diffractogram_id(id) { | ||
+ | if Prm_There(CIF_DIFFRACTOGRAM_BLOCK_ID) { | ||
+ | Out(CIF_DIFFRACTOGRAM_BLOCK_ID, | ||
+ | } else { | ||
+ | Out(Get(xdd_path_name), | ||
+ | Out(id, " | ||
+ | } | ||
+ | } | ||
+ | |||
+ | macro Out_pdCIF_blockid(blockidbase, | ||
+ | /* | ||
+ | https:// | ||
+ | _pd_block_id | ||
+ | Used to assign a unique character string to a block. | ||
+ | Note that this code is not intended to be parsed; the | ||
+ | | ||
+ | | ||
+ | be unique. | ||
+ | |||
+ | Note: The pdCIF website for this dataname goes into extensive detail | ||
+ | as to how this block_id is to be constructed. The implementation | ||
+ | is this macro is extremely simplistic, and designed to be easily | ||
+ | automated. | ||
+ | */ | ||
+ | Out_pdCIF_blockid_dataname | ||
+ | Out(blockidbase, | ||
+ | Out(id, " | ||
+ | } | ||
+ | macro Out_pdCIF_blockid_dataname { | ||
+ | Out_String(" | ||
+ | } | ||
+ | |||
+ | |||
+ | macro Out_CIF_wavelength { | ||
+ | /* | ||
+ | https:// | ||
+ | _diffrn_radiation_wavelength | ||
+ | The radiation wavelength in angstroms. | ||
+ | */ | ||
+ | Out(Lam, " | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_free_text(text) { | ||
+ | ' | ||
+ | Out_String(text) | ||
+ | } | ||
+ | '##############################################################' | ||
+ | ' Macros for diffraction data ' | ||
+ | '##############################################################' | ||
+ | |||
+ | macro Out_pdCIF_scan_method(method) { | ||
+ | /* | ||
+ | https:// | ||
+ | _pd_meas_scan_method | ||
+ | Code identifying the method for scanning reciprocal space. | ||
+ | The designation ' | ||
+ | film, a stationary position-sensitive or area detector | ||
+ | or other non-moving detection mechanism is used to | ||
+ | | ||
+ | |||
+ | the value of " | ||
+ | step : step scan | ||
+ | cont : | ||
+ | tof : time of flight | ||
+ | disp : energy dispersive | ||
+ | fixed: | ||
+ | */ | ||
+ | #m_ifarg method "" | ||
+ | Out(method, | ||
+ | #m_endif | ||
+ | } | ||
+ | |||
+ | macro Out_pdCIF_instr_special_details(goniotype) { | ||
+ | /* | ||
+ | https:// | ||
+ | _pd_instr_special_details | ||
+ | A brief description of the instrument giving | ||
+ | | ||
+ | | ||
+ | */ | ||
+ | Out(goniotype, | ||
+ | } | ||
+ | |||
+ | macro Out_pdCIF_datetime_initiated(datetime) { | ||
+ | /* | ||
+ | https:// | ||
+ | _pd_meas_datetime_initiated | ||
+ | The date and time of the data-set measurement. Entries follow | ||
+ | the standard CIF format ' | ||
+ | of seconds and a time zone is optional, but use of hours | ||
+ | and minutes is strongly encouraged. Where possible, give the | ||
+ | time when the measurement was started rather than when | ||
+ | it was completed. | ||
+ | */ | ||
+ | Out(datetime, | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_temperature(temp) { | ||
+ | /* | ||
+ | https:// | ||
+ | _diffrn_ambient_temperature | ||
+ | The mean temperature in kelvins at which the intensities | ||
+ | were measured. | ||
+ | */ | ||
+ | Out(temp, " | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_pressure(pres) { | ||
+ | /* | ||
+ | https:// | ||
+ | _diffrn_ambient_pressure | ||
+ | The mean hydrostatic pressure in kilopascals at which the | ||
+ | | ||
+ | */ | ||
+ | Out(pres, " | ||
+ | } | ||
+ | |||
+ | macro Out_pdCIF_2theta_fixed(th2) { | ||
+ | /* | ||
+ | https:// | ||
+ | _pd_meas_2theta_fixed | ||
+ | The 2\q diffraction angle in degrees for measurements | ||
+ | in a white-beam fixed-angle experiment. | ||
+ | */ | ||
+ | Out(th2, " | ||
+ | } | ||
+ | |||
+ | macro Out_pdCIF_phase_block_id(phase_id, | ||
+ | /* | ||
+ | https:// | ||
+ | _pd_phase_block_id | ||
+ | A block ID code identifying the phase contributing to | ||
+ | the diffraction peak. The data block containing the | ||
+ | | ||
+ | | ||
+ | code in _pd_phase_block_id. | ||
+ | |||
+ | https:// | ||
+ | _pd_phase_id | ||
+ | A code for each crystal phase used to link with | ||
+ | | ||
+ | |||
+ | _pd_phase_mass_% | ||
+ | Per cent composition of the specified crystal phase | ||
+ | | ||
+ | with respect to the total mass of the specimen. | ||
+ | |||
+ | _pd_calib_std_internal_mass_% | ||
+ | Per cent presence of the internal standard specified by the | ||
+ | data item _pd_calib_std_internal_name expressed as 100 times | ||
+ | the ratio of the amount of standard added to the original | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _pd_calib_std_internal_name | ||
+ | Identity of material(s) used as an internal intensity standard. | ||
+ | **NOTE** the blockID is used here, rather than the phase name, for uniqueness. | ||
+ | */ | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | for strs { | ||
+ | Out_String(" | ||
+ | Out(phase_id, | ||
+ | Out_unique_phase_id(id) | ||
+ | if Obj_There(spiked_mwps) { | ||
+ | Out(Get(corrected_weight_percent), | ||
+ | } else { | ||
+ | Out(Get(weight_percent), | ||
+ | } | ||
+ | } | ||
+ | |||
+ | for strs { | ||
+ | if Obj_There(spiked_mwp) { | ||
+ | Out_String(" | ||
+ | Out(Get(corrected_weight_percent), | ||
+ | Out_String(" | ||
+ | Out_unique_phase_id(id) | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_Rfactors { | ||
+ | /* | ||
+ | https:// | ||
+ | _refine_ls_goodness_of_fit_all | ||
+ | The least-squares goodness-of-fit parameter S for all | ||
+ | | ||
+ | | ||
+ | in the least-squares refinement. See also | ||
+ | | ||
+ | |||
+ | | ||
+ | S = { ----------------------------------- } | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _pd_proc_ls_prof_R_factor | ||
+ | _pd_proc_ls_prof_wR_factor | ||
+ | _pd_proc_ls_prof_wR_expected | ||
+ | | ||
+ | |||
+ | Note that the R factor computed for Rietveld refinements | ||
+ | using the extracted reflection intensity values (often | ||
+ | | ||
+ | a profile R factor. This R factor may be specified using | ||
+ | | ||
+ | | ||
+ | as the Rietveld or Bragg R factor. While it is appropriate | ||
+ | to compute and report any or all of these R factors, | ||
+ | the names " | ||
+ | | ||
+ | |||
+ | _pd_proc_ls_prof_R_factor, | ||
+ | unweighted fitness metric for the agreement between the | ||
+ | observed and computed diffraction patterns. | ||
+ | R~p~ = sum~i~ | I~obs~(i) - I~calc~(i) | | ||
+ | / sum~i~ ( I~obs~(i) ) | ||
+ | _pd_proc_ls_prof_wR_factor, | ||
+ | weighted fitness metric for the agreement between the | ||
+ | observed and computed diffraction patterns. | ||
+ | R~wp~ = SQRT { | ||
+ | | ||
+ | / sum~i~ ( w(i) [I~obs~(i)]^2^ ) } | ||
+ | |||
+ | _pd_proc_ls_prof_wR_expected, | ||
+ | theoretical R~wp~ or R~exp~, is a weighted fitness metric for | ||
+ | the statistical precision of the data set. For an idealized fit, | ||
+ | where all deviations between the observed intensities and | ||
+ | those computed from the model are due to statistical | ||
+ | fluctuations, | ||
+ | R factor. In reality, R~wp~ will always be higher than | ||
+ | R~exp~. | ||
+ | R~exp~ = SQRT { | ||
+ | (n - p) / sum~i~ ( w(i) [I~obs~(i)]^2^ ) } | ||
+ | |||
+ | Note that in the above equations, | ||
+ | w(i) is the weight for the ith data point (see | ||
+ | _pd_proc_ls_weight). | ||
+ | | ||
+ | point, sometimes referred to as y~i~(obs) or | ||
+ | y~oi~. (See _pd_meas_counts_total, | ||
+ | _pd_meas_intensity_total or _pd_proc_intensity_total.) | ||
+ | | ||
+ | point with background and other corrections | ||
+ | applied to match the scale of the observed data set, | ||
+ | sometimes referred to as y~i~(calc) or | ||
+ | y~ci~. (See _pd_calc_intensity_total.) | ||
+ | n is the total number of data points (see | ||
+ | _pd_proc_number_of_points) less the number of | ||
+ | data points excluded from the refinement. | ||
+ | p is the total number of refined parameters. | ||
+ | */ | ||
+ | Out(Get(gof), | ||
+ | Out(Get(r_p)/ | ||
+ | Out(Get(r_wp)/ | ||
+ | Out(Get(r_exp)/ | ||
+ | } | ||
+ | |||
+ | /* | ||
+ | These next set of groups of three macros are for outputting constant-wavelength angle-dispersive data, | ||
+ | time-of-flight neutron data, and energy-dispersive X-ray data. | ||
+ | |||
+ | meas denotes intensity measurements at the measurement point | ||
+ | proc denotes intensity measurements that have been processed in some way at the measurement point | ||
+ | */ | ||
+ | macro Out_pdCIF_angle_dispersive_measured_data(ciffile) { | ||
+ | Out_pdCIF_angle_dispersive_data(ciffile, | ||
+ | } | ||
+ | macro Out_pdCIF_angle_dispersive_processed_data(ciffile) { | ||
+ | Out_pdCIF_angle_dispersive_data(ciffile, | ||
+ | } | ||
+ | macro Out_pdCIF_angle_dispersive_data(ciffile, | ||
+ | /* | ||
+ | https:// | ||
+ | _pd_meas_2theta_scan | ||
+ | 2\q diffraction angle (in degrees) for intensity | ||
+ | | ||
+ | (e.g. continuous or step scan) should be specified in | ||
+ | the item _pd_meas_scan_method. For fixed 2\q (white-beam) | ||
+ | | ||
+ | | ||
+ | value at the midpoint of the counting period. Associated | ||
+ | with each _pd_meas_2theta_scan value will be | ||
+ | | ||
+ | not be corrected for nonlinearity, | ||
+ | zero offset etc. Corrected values may be specified | ||
+ | using _pd_proc_2theta_corrected. | ||
+ | |||
+ | https:// | ||
+ | _pd_meas_intensity_total | ||
+ | | ||
+ | the definition of _pd_meas_2theta_). | ||
+ | |||
+ | Use this entry for measurements where intensity | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _pd_proc_intensity_total | ||
+ | This contains intensity values for the | ||
+ | | ||
+ | | ||
+ | been applied. | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _pd_proc_ls_weight | ||
+ | | ||
+ | may be omitted if the weights are 1/u^2^, where | ||
+ | u is the s.u. for the _pd_proc_intensity_net values. | ||
+ | |||
+ | A weight value of zero is used to indicate a data | ||
+ | point not used for refinement (see | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _pd_calc_intensity_total | ||
+ | | ||
+ | each angle setting. Values should be computed at the | ||
+ | same locations as the processed diffractogram, | ||
+ | the numbers of points will be defined by | ||
+ | | ||
+ | be defined using _pd_proc_2theta_range_ or | ||
+ | | ||
+ | |||
+ | Use _pd_calc_intensity_net if the computed diffractogram | ||
+ | does not contain background or normalization corrections | ||
+ | and thus is specified on the same scale as the | ||
+ | | ||
+ | |||
+ | Use _pd_calc_intensity_total if the computed diffraction | ||
+ | | ||
+ | (or both) and thus is specified on the same scale as the | ||
+ | | ||
+ | |||
+ | If an observed pattern is included, _pd_calc_intensity_ | ||
+ | | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _pd_proc_intensity_bkg_calc | ||
+ | This is intended to contain the | ||
+ | | ||
+ | | ||
+ | |||
+ | ciffile - string. The name of the cif file you want to write to. | ||
+ | bkg_eqn - topas equation. The equation you arre using for your background. | ||
+ | If you are using the built in bkg, then write " | ||
+ | */ | ||
+ | Out_CIF_newfile(ciffile) | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | #if type == " | ||
+ | Out_String(" | ||
+ | #else | ||
+ | Out_String(" | ||
+ | #endif | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | #m_ifarg bkg_eqn "" | ||
+ | xdd_out ciffile append | ||
+ | load out_record out_fmt out_eqn { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | #m_else | ||
+ | Out_String(" | ||
+ | xdd_out ciffile append | ||
+ | load out_record out_fmt out_eqn { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | #m_endif | ||
+ | } | ||
+ | |||
+ | macro Out_pdCIF_time_of_flight_measured_data(ciffile) { | ||
+ | Out_pdCIF_time_of_flight_data(ciffile, | ||
+ | } | ||
+ | macro Out_pdCIF_time_of_flight_processed_data(ciffile) { | ||
+ | Out_pdCIF_time_of_flight_data(ciffile, | ||
+ | } | ||
+ | macro Out_pdCIF_time_of_flight_data(ciffile, | ||
+ | /* | ||
+ | https:// | ||
+ | _pd_meas_time_of_flight | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _pd_proc_d_spacing | ||
+ | | ||
+ | from Braggs law, d = \l/(2 sin\q), in units of angstroms. | ||
+ | |||
+ | https:// | ||
+ | _pd_meas_intensity_total | ||
+ | | ||
+ | the definition of _pd_meas_2theta_). | ||
+ | |||
+ | Use this entry for measurements where intensity | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _pd_proc_intensity_total | ||
+ | This contains intensity values for the | ||
+ | | ||
+ | | ||
+ | been applied. | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _pd_proc_ls_weight | ||
+ | | ||
+ | may be omitted if the weights are 1/u^2^, where | ||
+ | u is the s.u. for the _pd_proc_intensity_net values. | ||
+ | |||
+ | A weight value of zero is used to indicate a data | ||
+ | point not used for refinement (see | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _pd_calc_intensity_total | ||
+ | | ||
+ | each angle setting. Values should be computed at the | ||
+ | same locations as the processed diffractogram, | ||
+ | the numbers of points will be defined by | ||
+ | | ||
+ | be defined using _pd_proc_2theta_range_ or | ||
+ | | ||
+ | |||
+ | Use _pd_calc_intensity_net if the computed diffractogram | ||
+ | does not contain background or normalization corrections | ||
+ | and thus is specified on the same scale as the | ||
+ | | ||
+ | |||
+ | Use _pd_calc_intensity_total if the computed diffraction | ||
+ | | ||
+ | (or both) and thus is specified on the same scale as the | ||
+ | | ||
+ | |||
+ | If an observed pattern is included, _pd_calc_intensity_ | ||
+ | | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _pd_proc_intensity_bkg_calc | ||
+ | This is intended to contain the | ||
+ | | ||
+ | | ||
+ | |||
+ | */ | ||
+ | Out_CIF_newfile(ciffile) | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | #if type == " | ||
+ | Out_String(" | ||
+ | #else | ||
+ | Out_String(" | ||
+ | #endif | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | #m_ifarg bkg_eqn "" | ||
+ | xdd_out ciffile append | ||
+ | load out_record out_fmt out_eqn { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | #m_else | ||
+ | Out_String(" | ||
+ | xdd_out ciffile append | ||
+ | load out_record out_fmt out_eqn { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | #m_endif | ||
+ | } | ||
+ | |||
+ | |||
+ | macro Out_pdCIF_energy_dispersive_measured_data { | ||
+ | Out_pdCIF_energy_dispersive_data(meas, | ||
+ | } | ||
+ | macro Out_pdCIF_energy_dispersive_processed_data { | ||
+ | Out_pdCIF_energy_dispersive_data(proc, | ||
+ | } | ||
+ | macro Out_pdCIF_energy_dispersive_data(ciffile, | ||
+ | /* | ||
+ | https:// | ||
+ | _pd_proc_energy_incident | ||
+ | | ||
+ | from secondary calibration information (time-of-flight | ||
+ | and synchrotron data). | ||
+ | |||
+ | | ||
+ | if not the same as the incident energy (triple-axis or | ||
+ | | ||
+ | vary for each data point (triple-axis and time-of-flight data). | ||
+ | |||
+ | https:// | ||
+ | _pd_proc_d_spacing | ||
+ | | ||
+ | from Braggs law, d = \l/(2 sin\q), in units of angstroms. | ||
+ | |||
+ | https:// | ||
+ | _pd_meas_intensity_total | ||
+ | | ||
+ | the definition of _pd_meas_2theta_). | ||
+ | |||
+ | Use this entry for measurements where intensity | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _pd_proc_intensity_total | ||
+ | This contains intensity values for the | ||
+ | | ||
+ | | ||
+ | been applied. | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _pd_proc_ls_weight | ||
+ | | ||
+ | may be omitted if the weights are 1/u^2^, where | ||
+ | u is the s.u. for the _pd_proc_intensity_net values. | ||
+ | |||
+ | A weight value of zero is used to indicate a data | ||
+ | point not used for refinement (see | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _pd_calc_intensity_total | ||
+ | | ||
+ | each angle setting. Values should be computed at the | ||
+ | same locations as the processed diffractogram, | ||
+ | the numbers of points will be defined by | ||
+ | | ||
+ | be defined using _pd_proc_2theta_range_ or | ||
+ | | ||
+ | |||
+ | Use _pd_calc_intensity_net if the computed diffractogram | ||
+ | does not contain background or normalization corrections | ||
+ | and thus is specified on the same scale as the | ||
+ | | ||
+ | |||
+ | Use _pd_calc_intensity_total if the computed diffraction | ||
+ | | ||
+ | (or both) and thus is specified on the same scale as the | ||
+ | | ||
+ | |||
+ | If an observed pattern is included, _pd_calc_intensity_ | ||
+ | | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _pd_proc_intensity_bkg_calc | ||
+ | This is intended to contain the | ||
+ | | ||
+ | | ||
+ | |||
+ | */ | ||
+ | Out_CIF_newfile(ciffile) | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | #if type == " | ||
+ | Out_String(" | ||
+ | #else | ||
+ | Out_String(" | ||
+ | #endif | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | #m_ifarg bkg_eqn "" | ||
+ | xdd_out ciffile append | ||
+ | load out_record out_fmt out_eqn { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | #m_else | ||
+ | Out_String(" | ||
+ | xdd_out ciffile append | ||
+ | load out_record out_fmt out_eqn { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | #m_endif | ||
+ | } | ||
+ | |||
+ | macro Out_pdCIF_hkls_header(ciffile) { | ||
+ | /* | ||
+ | https:// | ||
+ | _refln_index_h | ||
+ | _refln_index_k | ||
+ | _refln_index_l | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _refln_d_spacing | ||
+ | The d spacing in angstroms for this reflection. This is related | ||
+ | to the (sin theta)/ | ||
+ | _refln_d_spacing = 2/ | ||
+ | |||
+ | https:// | ||
+ | _refln_F_squared_calc | ||
+ | _refln_F_squared_meas | ||
+ | | ||
+ | from measurement) of the squared structure factors (in electrons | ||
+ | | ||
+ | */ | ||
+ | Out_CIF_newfile(ciffile) | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | } | ||
+ | macro Out_pdCIF_hkls(ciffile, | ||
+ | /* | ||
+ | https:// | ||
+ | _refln_index_h | ||
+ | _refln_index_k | ||
+ | _refln_index_l | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _refln_d_spacing | ||
+ | The d spacing in angstroms for this reflection. This is related | ||
+ | to the (sin theta)/ | ||
+ | _refln_d_spacing = 2/ | ||
+ | |||
+ | https:// | ||
+ | _refln_F_squared_calc | ||
+ | _refln_F_squared_meas | ||
+ | | ||
+ | from measurement) of the squared structure factors (in electrons | ||
+ | | ||
+ | */ | ||
+ | for strs { | ||
+ | Out_CIF_newfile(ciffile) | ||
+ | phase_out ciffile append | ||
+ | load out_record out_fmt out_eqn { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | |||
+ | '############################################################## | ||
+ | ' Macros for crystal structures | ||
+ | '############################################################## | ||
+ | |||
+ | |||
+ | macro Out_pdCIF_diffractogramid(diffractogramidbase, | ||
+ | /* | ||
+ | https:// | ||
+ | _pd_block_diffractogram_id | ||
+ | A block ID code (see _pd_block_id) that identifies | ||
+ | | ||
+ | than the current block. This will occur most frequently | ||
+ | when more than one set of diffraction data | ||
+ | is used for a structure determination. The data | ||
+ | block containing the diffraction data will contain | ||
+ | a _pd_block_id code matching the code in | ||
+ | | ||
+ | */ | ||
+ | Out_pdCIF_diffractogramid_dataname | ||
+ | Out(diffractogramidbase, | ||
+ | Out(id, " | ||
+ | } | ||
+ | macro Out_pdCIF_diffractogramid_dataname { | ||
+ | Out_String(" | ||
+ | } | ||
+ | macro Out_pdCIF_phase_name { | ||
+ | /* | ||
+ | https:// | ||
+ | _pd_phase_name | ||
+ | The name of the crystal phase. | ||
+ | */ | ||
+ | Out(Get(phase_name), | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_unit_cell_prms { | ||
+ | /* | ||
+ | https:// | ||
+ | _cell_length_a | ||
+ | _cell_length_b | ||
+ | _cell_length_c | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _cell_angle_alpha | ||
+ | _cell_angle_beta | ||
+ | _cell_angle_gamma | ||
+ | | ||
+ | The values of _refln_index_h, | ||
+ | cell defined by these values and _cell_length_a, | ||
+ | |||
+ | https:// | ||
+ | _cell_volume | ||
+ | Cell volume V in angstroms cubed | ||
+ | */ | ||
+ | Out(Get(a), | ||
+ | Out(Get(b), | ||
+ | Out(Get(c), | ||
+ | Out(Get(al), | ||
+ | Out(Get(be), | ||
+ | Out(Get(ga), | ||
+ | Out(Get(cell_volume), | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_Z_molecular_weight(Z) { | ||
+ | /* | ||
+ | https:// | ||
+ | _cell_formula_units_Z | ||
+ | The number of the formula units in the unit cell as specified | ||
+ | by _chemical_formula_structural, | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _chemical_formula_weight | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | */ | ||
+ | local #m_unique !formula_weight_for_CIF_output = Get(cell_mass) / Z; | ||
+ | Out(Z, " | ||
+ | Out(formula_weight_for_CIF_output, | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_chemical_formula(formula) { | ||
+ | /* | ||
+ | https:// | ||
+ | _chemical_formula_sum | ||
+ | See the _chemical_formula_[] category description for the rules | ||
+ | for writing chemical formulae in which all discrete bonded | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | ' | ||
+ | */ | ||
+ | Out(formula, | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_diffrn_measurement_device_type(goniotype) { | ||
+ | /* | ||
+ | https:// | ||
+ | _diffrn_measurement_device_type | ||
+ | The make, model or name of the measurement device | ||
+ | | ||
+ | */ | ||
+ | Out(goniotype, | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_space_group_crystal_system(system) { | ||
+ | /* | ||
+ | https:// | ||
+ | _space_group_crystal_system | ||
+ | The name of the system of geometric crystal classes of space | ||
+ | | ||
+ | Note that rhombohedral space groups belong to the | ||
+ | | ||
+ | |||
+ | triclinic | ||
+ | monoclinic | ||
+ | orthorhombic | ||
+ | tetragonal | ||
+ | trigonal | ||
+ | hexagonal | ||
+ | cubic | ||
+ | */ | ||
+ | Out(system, | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_minmax_theta { | ||
+ | /* | ||
+ | https:// | ||
+ | _cell_measurement_theta_min | ||
+ | _cell_measurement_theta_max | ||
+ | The maximum and minimum theta angles of reflections | ||
+ | used to measure the unit cell in degrees. | ||
+ | */ | ||
+ | Out((X1/ | ||
+ | Out((X2/ | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_density { | ||
+ | /* | ||
+ | https:// | ||
+ | _exptl_crystal_density_diffrn | ||
+ | | ||
+ | units are megagrams per cubic metre (grams per cubic centimetre). | ||
+ | */ | ||
+ | local #m_unique !density_only_for_CIF_output = (1.6605402 Get(cell_mass)) / Get(cell_volume); | ||
+ | Out(density_only_for_CIF_output, | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_absorption { | ||
+ | /* | ||
+ | https:// | ||
+ | _exptl_absorpt_coefficient_mu | ||
+ | The absorption coefficient mu in reciprocal millimetres | ||
+ | | ||
+ | the radiation wavelength. | ||
+ | */ | ||
+ | local #m_unique !density_for_CIF_output = ((1.6605402 Get(cell_mass)) / Get(cell_volume)); | ||
+ | local #m_unique !LAC_for_CIF_output = Get(phase_MAC) density_for_CIF_output / 10; | ||
+ | Out(LAC_for_CIF_output, | ||
+ | } | ||
+ | |||
+ | |||
+ | macro Out_CIF_cell_temperature(temp) { | ||
+ | /* | ||
+ | https:// | ||
+ | _cell_measurement_temperature\ | ||
+ | The temperature in kelvins at which the unit-cell parameters | ||
+ | were measured (not the temperature of synthesis). | ||
+ | */ | ||
+ | Out(temp, " | ||
+ | Out_CIF_temperature(temp) | ||
+ | } | ||
+ | macro Out_CIF_cell_pressure(pres) { | ||
+ | /* | ||
+ | https:// | ||
+ | _cell_measurement_pressure | ||
+ | The pressure in kilopascals at which the unit-cell parameters | ||
+ | were measured (not the pressure at which the sample was | ||
+ | | ||
+ | */ | ||
+ | Out(pres, " | ||
+ | Out_CIF_pressure(pres) | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_space_group_with_id { | ||
+ | /* | ||
+ | https:// | ||
+ | _space_group_name_H-M_alt | ||
+ | | ||
+ | to be given. The way in which this item is used is determined | ||
+ | by the user and in general is not intended to be interpreted by | ||
+ | | ||
+ | | ||
+ | | ||
+ | a Hermann-Mauguin symbol for a conventional or unconventional | ||
+ | | ||
+ | |||
+ | Each component of the space-group name is separated by a | ||
+ | space or an underscore. Subscripts should appear without special | ||
+ | | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _space_group_symop_id | ||
+ | An arbitrary identifier that uniquely labels each symmetry | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _space_group_symop_operation_xyz | ||
+ | A parsable string giving one of the symmetry operations of the | ||
+ | space group in algebraic form. | ||
+ | |||
+ | */ | ||
+ | Out(Get(sp_grp_char), | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out(Get(sp_xyzs_txt_with_id), | ||
+ | } | ||
+ | macro Out_CIF_space_group_without_id { | ||
+ | /* | ||
+ | https:// | ||
+ | _space_group_name_H-M_alt | ||
+ | | ||
+ | to be given. The way in which this item is used is determined | ||
+ | by the user and in general is not intended to be interpreted by | ||
+ | | ||
+ | | ||
+ | | ||
+ | a Hermann-Mauguin symbol for a conventional or unconventional | ||
+ | | ||
+ | |||
+ | Each component of the space-group name is separated by a | ||
+ | space or an underscore. Subscripts should appear without special | ||
+ | | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _space_group_symop_operation_xyz | ||
+ | A parsable string giving one of the symmetry operations of the | ||
+ | space group in algebraic form. | ||
+ | |||
+ | */ | ||
+ | Out(Get(sp_grp_char), | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out(Get(sp_xyzs_txt), | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_atom_coords(ciffile) { | ||
+ | /* | ||
+ | https:// | ||
+ | _atom_site_label | ||
+ | The _atom_site_label is a unique identifier for a particular site | ||
+ | in the crystal. This code is made up of a sequence of up to seven | ||
+ | | ||
+ | | ||
+ | of the specified _atom_type_symbol codes. This is not mandatory | ||
+ | if an _atom_site_type_symbol item is included in the atom-site | ||
+ | list. The _atom_site_type_symbol always takes precedence over | ||
+ | an _atom_site_label in the identification of the atom type. | ||
+ | |||
+ | https:// | ||
+ | _atom_site_type_symbol | ||
+ | A code to identify the atom species (singular or plural) | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _atom_site_site_symmetry_multiplicity | ||
+ | The number of different sites that are generated by the | ||
+ | | ||
+ | | ||
+ | | ||
+ | in International Tables for Crystallography Vol. A (2002). | ||
+ | |||
+ | https:// | ||
+ | _atom_site_fract_x | ||
+ | _atom_site_fract_y | ||
+ | _atom_site_fract_z | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _atom_site_occupancy | ||
+ | The fraction of the atom type present at this site. | ||
+ | The sum of the occupancies of all the atom types at this site | ||
+ | may not significantly exceed 1.0 unless it is a dummy site. | ||
+ | |||
+ | https:// | ||
+ | _atom_site_B_iso_or_equiv | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | B^ij^ = 8 pi^2^ U^ij^ | ||
+ | |||
+ | Ref: Fischer, R. X. & Tillmanns, E. (1988). Acta Cryst. C44, | ||
+ | 775-776. | ||
+ | */ | ||
+ | Out_CIF_newfile(ciffile) | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | atom_out ciffile append | ||
+ | load out_record out_fmt out_eqn { | ||
+ | " | ||
+ | " %s" = Get_From_String(Get(current_atom), | ||
+ | " %3.0f" = Get_From_String(Get(current_atom), | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | } | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_hkls(ciffile) { | ||
+ | /* | ||
+ | https:// | ||
+ | _refln_index_h | ||
+ | _refln_index_k | ||
+ | _refln_index_l | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _refln_d_spacing | ||
+ | The d spacing in angstroms for this reflection. This is related | ||
+ | to the (sin theta)/ | ||
+ | _refln_d_spacing = 2/ | ||
+ | |||
+ | https:// | ||
+ | _refln_F_squared_calc | ||
+ | _refln_F_squared_meas | ||
+ | | ||
+ | from measurement) of the squared structure factors (in electrons | ||
+ | | ||
+ | */ | ||
+ | Out_CIF_newfile(ciffile) | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | phase_out ciffile append | ||
+ | load out_record out_fmt out_eqn { | ||
+ | " | ||
+ | " %4.0f" = K; | ||
+ | " %4.0f" = L; | ||
+ | " %11.6f" | ||
+ | " %12.6f" | ||
+ | " %12.6f" | ||
+ | } | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_adps(ciffile) { | ||
+ | /* | ||
+ | https:// | ||
+ | _atom_site_aniso_label | ||
+ | | ||
+ | a separate list. If this is the case, this code must match the | ||
+ | | ||
+ | list and conform with the same rules described in | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _atom_site_aniso_U_11 | ||
+ | _atom_site_aniso_U_22 | ||
+ | _atom_site_aniso_U_33 | ||
+ | _atom_site_aniso_U_12 | ||
+ | _atom_site_aniso_U_13 | ||
+ | _atom_site_aniso_U_23 | ||
+ | These are the standard anisotropic atomic displacement | ||
+ | | ||
+ | | ||
+ | |||
+ | T = exp{-2pi^2^ sum~i~ [sum~j~ (U^ij^ h~i~ h~j~ a*~i~ a*~j~) ] } | ||
+ | |||
+ | h = the Miller indices | ||
+ | a* = the reciprocal-space cell lengths | ||
+ | |||
+ | The unique elements of the real symmetric matrix are | ||
+ | | ||
+ | */ | ||
+ | Out_CIF_newfile(ciffile) | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | atom_out ciffile append | ||
+ | load out_record out_fmt out_eqn { | ||
+ | " | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | " %V" = Get_From_String(Get(current_atom), | ||
+ | } | ||
+ | } | ||
+ | |||
+ | macro Out_CIF_bond_angles(ciffile) { | ||
+ | /* | ||
+ | https:// | ||
+ | _geom_bond_atom_site_label_1 | ||
+ | _geom_bond_atom_site_label_2 | ||
+ | The labels of two atom sites that form a bond. These must match | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _geom_bond_distance | ||
+ | The intramolecular bond distance in angstroms. | ||
+ | |||
+ | https:// | ||
+ | _geom_bond_site_symmetry_1 | ||
+ | _geom_bond_site_symmetry_2 | ||
+ | The symmetry code of each atom site as the symmetry-equivalent | ||
+ | | ||
+ | These numbers are combined to form the code 'n klm' or n_klm. | ||
+ | The character string n_klm is composed as follows: | ||
+ | |||
+ | n refers to the symmetry operation that is applied to the | ||
+ | | ||
+ | and _atom_site_fract_z. It must match a number given in | ||
+ | | ||
+ | |||
+ | k, l and m refer to the translations that are subsequently | ||
+ | | ||
+ | the atom used in calculating the bond. These translations | ||
+ | | ||
+ | k = 5 + x | ||
+ | l = 5 + y | ||
+ | m = 5 + z | ||
+ | By adding 5 to the translations, | ||
+ | is avoided. | ||
+ | |||
+ | https:// | ||
+ | _geom_angle_atom_site_label_1 | ||
+ | _geom_angle_atom_site_label_2 | ||
+ | _geom_angle_atom_site_label_3 | ||
+ | The labels of the three atom sites which define the angle | ||
+ | given by _geom_angle. These must match labels specified as | ||
+ | | ||
+ | the apex of the angle. | ||
+ | |||
+ | https:// | ||
+ | _geom_angle | ||
+ | Angle in degrees defined by the three sites | ||
+ | | ||
+ | is at the apex of the angle. | ||
+ | |||
+ | https:// | ||
+ | _geom_angle_site_symmetry_1 | ||
+ | _geom_angle_site_symmetry_2 | ||
+ | _geom_angle_site_symmetry_3 | ||
+ | The symmetry code of each atom site as the symmetry-equivalent | ||
+ | | ||
+ | These numbers are combined to form the code 'n klm' or n_klm. | ||
+ | The character string n_klm is composed as follows: | ||
+ | |||
+ | n refers to the symmetry operation that is applied to the | ||
+ | | ||
+ | and _atom_site_fract_z. It must match a number given in | ||
+ | | ||
+ | |||
+ | k, l and m refer to the translations that are subsequently | ||
+ | | ||
+ | the atom used in calculating the angle. These translations | ||
+ | | ||
+ | k = 5 + x | ||
+ | l = 5 + y | ||
+ | m = 5 + z | ||
+ | By adding 5 to the translations, | ||
+ | is avoided. | ||
+ | */ | ||
+ | Out_CIF_newfile(ciffile) | ||
+ | consider_lattice_parameters 'this propagates errors from lattice parameters to the bonds and angles' | ||
+ | Out(Get(cif_bonds_angles), | ||
+ | } | ||
+ | |||
+ | macro Out_magCIF_space_group_with_id { | ||
+ | /* | ||
+ | https:// | ||
+ | _space_group_magn.number_BNS | ||
+ | See _space_group_magn.number_OG for a description of magnetic | ||
+ | space groups (MSGs). The Belov-Neronova-Smirnova (BNS) number for | ||
+ | an MSG is composed of two positive integers separated by a | ||
+ | | ||
+ | the non-magnetic space group F for MSGs of types 1-3 or the | ||
+ | | ||
+ | | ||
+ | same crystal family. | ||
+ | There are 1651 distinct equivalence classes of MSGs, each of | ||
+ | which has a unique BNS number. These equivalence classes are most | ||
+ | | ||
+ | | ||
+ | But the word " | ||
+ | | ||
+ | To avoid confusion, the word " | ||
+ | sense here. | ||
+ | |||
+ | | ||
+ | |||
+ | Ref: ' | ||
+ | | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _space_group_symop_magn_operation.id | ||
+ | An arbitrary identifier that uniquely labels each symmetry | ||
+ | | ||
+ | | ||
+ | used for this identification. | ||
+ | The _space_group_symop_magn.id alias provides backwards | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _space_group_symop_magn_operation.xyz | ||
+ | A parsable string giving one of the symmetry operations of the | ||
+ | | ||
+ | | ||
+ | is perfect except for the fact that a magnetic symop label ends | ||
+ | with an additional piece of information (" | ||
+ | that the operation is or is not time-reversed, | ||
+ | This tag is intended for use with the BNS-supercell description | ||
+ | of a magnetic structure. | ||
+ | |||
+ | | ||
+ | |||
+ | Ref: ' | ||
+ | | ||
+ | | ||
+ | |||
+ | _space_group_symop.magn_operation.mxmymz | ||
+ | I cannot find a definition in the magCIF for this column. | ||
+ | |||
+ | _space_group_symop.magn_operation.timereversal | ||
+ | Topas does not include the time reversal in the xyz output. | ||
+ | It goes in its own column. | ||
+ | |||
+ | */ | ||
+ | Out(Get(sp_grp_char ), " | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out(Get(mag_sp_xyzs_txt_with_id), | ||
+ | } | ||
+ | |||
+ | macro Out_mag_CIF_atom_site_moment(ciffile) { | ||
+ | /* | ||
+ | https:// | ||
+ | _atom_site_moment.label | ||
+ | |||
+ | https:// | ||
+ | _atom_site_moment.crystalaxis_x | ||
+ | The component of the atom-site magnetic-moment vector parallel to the first | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _atom_site_moment.crystalaxis_y | ||
+ | The component of the atom-site magnetic-moment vector parallel to the second | ||
+ | | ||
+ | |||
+ | https:// | ||
+ | _atom_site_moment.crystalaxis_z | ||
+ | The component of the atom-site magnetic-moment vector parallel to the third | ||
+ | | ||
+ | */ | ||
+ | Out_CIF_newfile(ciffile) | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | Out_String(" | ||
+ | mag_atom_out ciffile append | ||
+ | load out_record out_fmt out_eqn { | ||
+ | " | ||
+ | " %11.5f" | ||
+ | " %11.5f" | ||
+ | " %11.5f" | ||
+ | } | ||
+ | } | ||
+ | |||
+ | '############################################################## | ||
+ | ' These are the consolidiated macros to report structures and patterns | ||
+ | '###################################################################### | ||
+ | |||
+ | |||
+ | macro Out_pdCIF_xdd_setup { | ||
+ | /* | ||
+ | This macro sets up a workaround in how pk_xo behaves differently between v5-6 and v7 | ||
+ | It also defines an ID prm, so you do not need to if there is only one xdd to worry about. | ||
+ | */ | ||
+ | if Or(Obj_There(pk_xo_prm), | ||
+ | if Prm_There(CIF_ID) { | ||
+ | 'do nothing' | ||
+ | } else { | ||
+ | if Prm_There(CIF_MULTI_DIFFRACTOGRAM_ID) { | ||
+ | if Obj_There(num_runs) { | ||
+ | local CIF_ID = Run_Number; | ||
+ | } else { | ||
+ | local CIF_ID 1 | ||
+ | } | ||
+ | } else { 'not a multi-pattern inp file' | ||
+ | if Obj_There(range) { | ||
+ | if Obj_There(num_runs) { | ||
+ | local CIF_ID = 10000 Get(range) + Run_Number; | ||
+ | } else { | ||
+ | local CIF_ID = Get(range); | ||
+ | } | ||
+ | } else if Obj_There(num_runs) { | ||
+ | local CIF_ID = Run_Number; | ||
+ | } else { | ||
+ | local CIF_ID 1 | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | macro Out_pdCIF_STR(ciffile, | ||
+ | Out_pdCIF_STR(ciffile, | ||
+ | } | ||
+ | macro Out_pdCIF_STR(ciffile, | ||
+ | /* | ||
+ | This macro constructs a crystal structure in CIF format that is likely | ||
+ | to pass checkCIF with minimal issues. Probably. | ||
+ | |||
+ | The construction of the block_id is simply the concatenation of the | ||
+ | phase_name and an identifier, most usually taken as the number of the xdd, | ||
+ | either defined through the use of " | ||
+ | using #list, or by setting a local variable in each xdd - local !id = 1; (and | ||
+ | copying it and incrementing it in each xdd) | ||
+ | |||
+ | The diffractogram_id of each diffraction pattern is simply the string " | ||
+ | with the id appended. This is also set to be the block id of the diffraction | ||
+ | pattern in the diffraction pattern macro. | ||
+ | |||
+ | The implementation of the block_id and diffractogram_id in is this macro is | ||
+ | extremely simplistic, and designed to be easily automated. If you change how | ||
+ | the _pd_block_id or _pd_diffractogram_id is implemented, | ||
+ | sure to change it in all the other places - see _pd_phase_block_id also. | ||
+ | |||
+ | This macro can be placed into every str that you have, or better, placed at the end | ||
+ | of the input file in a `for strs {}` construct. | ||
+ | |||
+ | |||
+ | ciffile: the name of the file you want to write to. The data is appended. | ||
+ | phase_id: a number uniquely identifying a str inside an xdd | ||
+ | id: a number uniquely identifying an xdd | ||
+ | |||
+ | If you want to report molecular weight for a str, you must define a | ||
+ | local parameter defining the number of formula units. ie: | ||
+ | local !CIF_Z = 6; | ||
+ | You must name it " | ||
+ | */ | ||
+ | Out_CIF_newfile(ciffile) | ||
+ | Out_String(" | ||
+ | Out_CIF_section_break(" | ||
+ | Out_CIF_datablock_dataname Out_unique_phase_id(id) | ||
+ | Out_pdCIF_blockid_dataname Out_unique_phase_id(id) | ||
+ | if Prm_There(CIF_MULTI_DIFFRACTOGRAM_ID) { | ||
+ | Out_String(" | ||
+ | } else { | ||
+ | Out_pdCIF_diffractogramid_dataname Out_unique_diffractogram_id(id) | ||
+ | } | ||
+ | if Prm_There(CIF_DIFFRACTOMETER_NAME) { Out_CIF_diffrn_measurement_device_type(CIF_DIFFRACTOMETER_NAME) } | ||
+ | Out_pdCIF_phase_name | ||
+ | Out_CIF_unit_cell_prms | ||
+ | if Prm_There(CIF_Z) { Out_CIF_Z_molecular_weight(CIF_Z) } | ||
+ | if Prm_There(CIF_SUM_FORMULA) { Out_CIF_chemical_formula(CIF_SUM_FORMULA) } | ||
+ | if Prm_There(CIF_TEMP) { Out_CIF_cell_temperature(CIF_TEMP) } | ||
+ | if Prm_There(CIF_PRES) { Out_CIF_cell_pressure(CIF_PRES) } | ||
+ | Out_CIF_density | ||
+ | TOF_ED_CW(,, | ||
+ | if Prm_There(CIF_CRYSTAL_SYSTEM) { Out_CIF_space_group_crystal_system(CIF_CRYSTAL_SYSTEM) } | ||
+ | if Prm_There(CIF_PHASE_TEXT) { Out_CIF_free_text(CIF_PHASE_TEXT) } | ||
+ | if Obj_There(mag_sg) { | ||
+ | Out_magCIF_space_group_with_id | ||
+ | } else { | ||
+ | Out_CIF_space_group_with_id | ||
+ | } | ||
+ | Out_CIF_atom_coords(ciffile) | ||
+ | if Obj_There(adps) { Out_CIF_adps(ciffile) } | ||
+ | if Obj_There(mag_sg) { Out_mag_CIF_atom_site_moment(ciffile) } | ||
+ | Out_CIF_bond_angles(ciffile) | ||
+ | Out_CIF_newfile(ciffile) | ||
+ | if Prm_There(CIF_MULTI_DIFFRACTOGRAM_ID) { | ||
+ | ' | ||
+ | Out_String(" | ||
+ | Out_pdCIF_diffractogramid_dataname | ||
+ | for xdds n_to_m(n,m) { | ||
+ | Out_String(" | ||
+ | Out_unique_diffractogram_id(id) | ||
+ | } | ||
+ | ' | ||
+ | } | ||
+ | Out_CIF_newfile(ciffile) | ||
+ | Out_CIF_section_break(" | ||
+ | Out_String(" | ||
+ | } | ||
+ | |||
+ | macro Out_pdCIF_diffraction_data(ciffile, | ||
+ | /* | ||
+ | This macro constructs a powder diffraction pattern in CIF format. | ||
+ | |||
+ | The construction of the block_id is simply the concatenation of the | ||
+ | string " | ||
+ | either defined through the use of " | ||
+ | using #list, or by setting a local variable in each xdd - local !id = 1; (and | ||
+ | copying it and incrementing it in each xdd) | ||
+ | |||
+ | The implementation of the block_id in this macro is extremely simplistic, and | ||
+ | designed to be easily automated. If you change how the _pd_block_id or | ||
+ | _pd_diffractogram_id is implemented, | ||
+ | places - see _pd_phase_block_id also. | ||
+ | |||
+ | This macro can be placed into every xdd that you have, or if you have more, placed | ||
+ | at the end of the input file in a `for xdds {}` construct. | ||
+ | |||
+ | ciffile: the name of the file you want to write to. The data is appended. | ||
+ | data_type: " | ||
+ | bkg_eqn: an equation with the bkg you want to record | ||
+ | phase_id: a number uniquely identifiying a str in an xdd | ||
+ | is: a number uniquely identifying an xdd, or group of xdds in the case of a multi-pattern refinement | ||
+ | */ | ||
+ | Out_CIF_newfile(ciffile) | ||
+ | Out_String(" | ||
+ | Out_CIF_section_break(" | ||
+ | Out_CIF_datablock_dataname Out_unique_diffractogram_id(id) | ||
+ | Out_pdCIF_blockid_dataname Out_unique_diffractogram_id(id) | ||
+ | if Prm_There(CIF_DATETIME) { Out_pdCIF_datetime_initiated(CIF_DATETIME) } | ||
+ | Out_String(" | ||
+ | if Obj_There(neutron) { | ||
+ | Out_String(" | ||
+ | } else { | ||
+ | Out_String(" | ||
+ | } | ||
+ | if Prm_There(CIF_DIFFRACTOMETER_NAME) { Out_pdCIF_instr_special_details(CIF_DIFFRACTOMETER_NAME) } | ||
+ | TOF_ED_CW(Out_pdCIF_scan_method(" | ||
+ | Out_pdCIF_scan_method(" | ||
+ | if Prm_There(CIF_SCAN_METHOD) { Out_pdCIF_scan_method(CIF_SCAN_METHOD) } | ||
+ | if Obj_There(lam) { Out_CIF_wavelength } ) | ||
+ | if Prm_There(CIF_TEMP) { Out_CIF_temperature(CIF_TEMP) } | ||
+ | if Prm_There(CIF_PRES) { Out_CIF_pressure(CIF_PRES) } | ||
+ | Out_CIF_Rfactors | ||
+ | if Prm_There(CIF_DIFFRACTOGRAM_TEXT) { Out_CIF_free_text(CIF_DIFFRACTOGRAM_TEXT) } | ||
+ | if Obj_There(str) { | ||
+ | Out_pdCIF_phase_block_id(phase_id, | ||
+ | Out_pdCIF_hkls_header(ciffile) | ||
+ | Out_pdCIF_hkls(ciffile, | ||
+ | } | ||
+ | TOF_ED_CW(Out_pdCIF_time_of_flight_data(ciffile, | ||
+ | Out_pdCIF_energy_dispersive_data(ciffile, | ||
+ | Out_pdCIF_angle_dispersive_data(ciffile, | ||
+ | Out_CIF_newfile(ciffile) | ||
+ | Out_CIF_section_break(" | ||
+ | Out_String(" | ||
+ | } | ||
+ | |||
+ | |||
+ | '############################################################## | ||
+ | '#################################################################################################### | ||
+ | '###################################################################################################### | ||
+ | '###################################################################################################### | ||
+ | '#################################################################################################### | ||
+ | '#################################################################################################### | ||
+ | |||
+ | /* The macros to use at the end of your input file (literally) | ||
+ | to report structures and patterns is just after this comment! | ||
+ | |||
+ | There are some helper macros that have fewer arguments, and make some | ||
+ | choices about what to write in the CIF file for you. | ||
+ | |||
+ | The use of these macros rely on you using some predefined parameters | ||
+ | for specific items. You can use whatever name you want in your own | ||
+ | calculations, | ||
+ | but they need to be defined somewhere with the following names: | ||
+ | |||
+ | -Must be defined (eg local CIF_PHASE_ID 2 ) | ||
+ | CIF_ID - (per xdd, or group of xdds) unique identifier to append to block ids to ensure everything is unique | ||
+ | CIF_PHASE_ID - (per str) unique identifier to append to block ids of strs to ensure everything is unique | ||
+ | t0, t1, t2 - (per xdd - only for tof) TOF calibration constants | ||
+ | CIF_TH2_FIXED - (per xdd - only for edxrd) Detector angle in energy-dispersive XRD | ||
+ | |||
+ | -Should be defined | ||
+ | CIF_SCAN_METHOD - (per xdd) " | ||
+ | This is only relevant for CW data. | ||
+ | |||
+ | -Can be defined | ||
+ | CIF_DATETIME xdd Date/ | ||
+ | CIF_TEMP - (per xdd) Temperature (K) at which data were acquired. | ||
+ | CIF_PRES - (per xdd) Pressure (kPa) at which data were acquired. | ||
+ | CIF_Z - (per str) formula units per unit cell | ||
+ | CIF_SUM_FORMULA - (per str) what is the chemical formula of the unit cell? | ||
+ | CIF_CRYSTAL_SYSTEM - (per str) the crystal system of the space group | ||
+ | CIF_DIFFRACTOMETER_NAME - (per xdd) short description of the diffractometer | ||
+ | (If you use these next two, you are on your own wrt maintaining uniqueness | ||
+ | CIF_DIFFRACTOGRAM_BLOCK_ID xdd Fully specified block ID for a diffraction pattern | ||
+ | CIF_PHASE_BLOCK_ID str Fully specified block ID for a crystal structure | ||
+ | CIF_DIFFRACTOGRAM_TEXT xdd Free-text entry that goes in the data block containing the diffraction data | ||
+ | CIF_PHASE_TEXT str Free-text entry that goes in the data block containing the structure | ||
+ | |||
+ | |||
+ | ciffile: the name of the file you want to write to. The data is appended. | ||
+ | data_type: " | ||
+ | bkg_eqn: an equation defining your background function so it can be ouput in the CIF | ||
+ | */ | ||
+ | '######################################################################' | ||
+ | |||
+ | macro Out_pdCIF_per_xdd(ciffile) | ||
+ | macro Out_pdCIF_per_xdd(ciffile, | ||
+ | macro Out_pdCIF_per_xdd(ciffile, | ||
+ | /* | ||
+ | If you wish to change the output on a per-xdd basis, use this macro in each xdd. | ||
+ | Otherwise, use Out_pdCIF() | ||
+ | */ | ||
+ | Out_pdCIF_xdd_setup | ||
+ | if Obj_There(str) { for strs { Out_pdCIF_STR(ciffile, | ||
+ | Out_pdCIF_diffraction_data(ciffile, | ||
+ | } | ||
+ | |||
+ | |||
+ | macro Out_pdCIF(ciffile) | ||
+ | macro Out_pdCIF(ciffile, | ||
+ | macro Out_pdCIF(ciffile, | ||
+ | macro Out_pdCIF(ciffile, | ||
+ | /* | ||
+ | This is the macro to use if the structures in each xdd are independent of each other | ||
+ | ie, they are not being co-refined on multiple datasets | ||
+ | |||
+ | Some examples on how to use the Out_pdCIF macro: | ||
+ | |||
+ | ----------------------------------------------- | ||
+ | # 1: single pattern, many strs | ||
+ | xdd | ||
+ | ... | ||
+ | str | ||
+ | local CIF_PHASE_ID 1 | ||
+ | local !CIF_Z = 2; | ||
+ | ... | ||
+ | str | ||
+ | local CIF_PHASE_ID 2 | ||
+ | ... | ||
+ | str | ||
+ | local CIF_PHASE_ID 3 | ||
+ | ... | ||
+ | macro CIF_OUTPUT_FILE { " | ||
+ | Out_pdCIF(CIF_OUTPUT_FILE) | ||
+ | ----------------------------------------------- | ||
+ | ----------------------------------------------- | ||
+ | # 2: many patterns, many strs | ||
+ | xdd | ||
+ | local CIF_ID 1 | ||
+ | local !CIF_SCAN_METHOD = " | ||
+ | local CIF_PRES 100 | ||
+ | ... | ||
+ | str | ||
+ | local CIF_PHASE_ID 1 | ||
+ | ... | ||
+ | xdd | ||
+ | local CIF_ID 2 | ||
+ | local !CIF_SCAN_METHOD = " | ||
+ | local CIF_PRES 400 | ||
+ | ... | ||
+ | str | ||
+ | local CIF_PHASE_ID 1 | ||
+ | ... | ||
+ | str | ||
+ | local CIF_PHASE_ID 2 | ||
+ | local !CIF_Z 6 | ||
+ | ... | ||
+ | str | ||
+ | local CIF_PHASE_ID 3 | ||
+ | ... | ||
+ | ... | ||
+ | Out_pdCIF(" | ||
+ | |||
+ | ----------------------------------------------- | ||
+ | ----------------------------------------------- | ||
+ | # 3: sequential refinement, multiple strs | ||
+ | |||
+ | macro CIF_OUTPUT_FILE { " | ||
+ | num_runs 30 | ||
+ | #list File_Name Temperature { | ||
+ | file_01.xye 30 | ||
+ | file_02.xye 45 | ||
+ | ... | ||
+ | } | ||
+ | prm CIF_ID = Run_Number; | ||
+ | prm CIF_TEMP = Temperature(Run_Number); | ||
+ | prm CIF_SCAN_METHOD = " | ||
+ | xdd | ||
+ | ... | ||
+ | str | ||
+ | local CIF_PHASE_ID 1 | ||
+ | local !CIF_Z = 6; | ||
+ | ... | ||
+ | str | ||
+ | local CIF_PHASE_ID 2 | ||
+ | local !CIF_Z = 8; | ||
+ | ... | ||
+ | str | ||
+ | local CIF_PHASE_ID 3 | ||
+ | ... | ||
+ | Out_pdCIF(CIF_OUTPUT_FILE, | ||
+ | ----------------------------------------------- | ||
+ | */ | ||
+ | for xdds n_to_m(n,m) { | ||
+ | Out_pdCIF_per_xdd(ciffile, | ||
+ | } | ||
+ | } | ||
+ | |||
+ | macro Out_pdCIF_multi(ciffile) | ||
+ | macro Out_pdCIF_multi(ciffile, | ||
+ | macro Out_pdCIF_multi(ciffile, | ||
+ | macro Out_pdCIF_multi(ciffile, | ||
+ | /* | ||
+ | This is the macro to use if the structures in each xdd are dependent of each other | ||
+ | ie, all structures are being co-refined on all xdds and all structures are present | ||
+ | in all xdds | ||
+ | |||
+ | eg multi-bank TOF data. | ||
+ | |||
+ | Some examples on how to use the Out_pdCIF_multi macro: | ||
+ | |||
+ | ----------------------------------------------- | ||
+ | # 1: multiple patterns, multiple strs | ||
+ | prm CIF_ID 1 | ||
+ | prm CIF_TEMP 5 | ||
+ | xdd 'eg bank 1 of a tof dataset' | ||
+ | ... | ||
+ | str | ||
+ | local CIF_PHASE_ID 1 | ||
+ | ... | ||
+ | str | ||
+ | local CIF_PHASE_ID 2 | ||
+ | ... | ||
+ | str | ||
+ | local CIF_PHASE_ID 3 | ||
+ | ... | ||
+ | xdd 'eg bank 2 of a tof dataset' | ||
+ | ... | ||
+ | str | ||
+ | local CIF_PHASE_ID 1 | ||
+ | ... | ||
+ | str | ||
+ | local CIF_PHASE_ID 2 | ||
+ | local !CIF_Z 6 | ||
+ | ... | ||
+ | str | ||
+ | local CIF_PHASE_ID 3 | ||
+ | ... | ||
+ | ... | ||
+ | Out_pdCIF_multi(" | ||
+ | |||
+ | ----------------------------------------------- | ||
+ | ----------------------------------------------- | ||
+ | # 2: sequential refinement, multiple strs, | ||
+ | |||
+ | macro CIF_OUTPUT_FILE { " | ||
+ | num_runs 30 | ||
+ | #list File_Name_b1 File_Name_b2 File_Name_b3 Temperature { | ||
+ | file_b1_01.xye file_b2_01.xye file_b3_01.xye 30 | ||
+ | file_b1_02.xye file_b2_02.xye file_b3_02.xye 35 | ||
+ | ... | ||
+ | } | ||
+ | prm CIF_ID = Run_Number; | ||
+ | prm CIF_TEMP = Temperature(Run_Number); | ||
+ | xdd File_Name_b1(Run_Number) | ||
+ | ... | ||
+ | str | ||
+ | ... | ||
+ | str | ||
+ | ... | ||
+ | xdd File_Name_b2(Run_Number) | ||
+ | ... | ||
+ | str | ||
+ | ... | ||
+ | str | ||
+ | ... | ||
+ | xdd File_Name_b3(Run_Number) | ||
+ | ... | ||
+ | str | ||
+ | ... | ||
+ | str | ||
+ | ... | ||
+ | for xdds { | ||
+ | local CIF_SCAN_METHOD = " | ||
+ | for strs 1 to 1 { | ||
+ | local CIF_PHASE_ID 1 | ||
+ | local CIF_Z = 6; | ||
+ | } | ||
+ | for strs 2 to 2 { | ||
+ | local CIF_PHASE_ID 2 | ||
+ | local CIF_Z = 8; | ||
+ | } | ||
+ | } | ||
+ | Out_pdCIF_multi(CIF_OUTPUT_FILE, | ||
+ | ----------------------------------------------- | ||
+ | */ | ||
+ | for xdds n_to_m(n,m) { | ||
+ | Out_pdCIF_xdd_setup | ||
+ | local CIF_MULTI_DIFFRACTOGRAM_ID | ||
+ | } | ||
+ | Out_CIF_newfile(ciffile) | ||
+ | for xdds n to n { if Obj_There(str) { for strs { Out_pdCIF_STR(ciffile, | ||
+ | for xdds n_to_m(n,m) { Out_pdCIF_diffraction_data(ciffile, | ||
+ | } | ||
+ | #endif | ||
+ | </ |