Models of other programs’ files#
This page gives the fields of the model each reader of another program’s refinement returns: TopasModel, FullProfModel, GsasModel and Gsas2Model, with the parts each one is built from.
read_project_model hands one of these on as ProjectModel.stated (Refinement files from other programs).
A model is what the file said, seeded with nothing.
A value the file omitted arrives as None and never as a default.
The models differ from each other because the formats do, and each one changes as its reader’s coverage grows (Provisional by declaration).
TOPAS input files#
read_topas_inp returns a TopasModel.
Field |
Holds |
|---|---|
|
the file it was read from |
|
the phases the file states, with their sites and refine flags |
|
the run’s own figures, stated at top level above every block. |
|
every such value in file order, since a multi-dataset file states one per dataset |
|
how many |
|
the pattern files it points at |
|
every emission line in file order, and the macro that named the profile ( |
|
the profile’s reference wavelength: the |
|
|
|
the goniometer radius, where the file states one |
|
how many coefficients the |
|
|
|
what the reader met and did not carry (TOPAS constructs and their stances) |
|
the datasets that are neutron time of flight, each with the constructs that said so. |
|
every parameter the file declares, by name, with its value and refine flag: what a name in an equation refers to |
|
whether the file states |
|
the angle of the file’s |
FullProf input files#
read_fullprof_pcr returns a FullProfModel.
Field |
Holds |
|---|---|
|
the file, and its |
|
the |
|
every phase, nuclear and magnetic |
|
the same, split. A magnetic phase always reads, and builds only as the moments of the nuclear phase it restates (Structure files) |
|
the converged figure, from the comment FullProf rewrites each cycle |
|
the |
|
the experiment the file declares: 0 for X-ray and 1 for neutron constant wavelength. A time-of-flight file ( |
|
the wavelengths the refinement used |
|
the refinable-wavelength slot of the zero-shift line, read for provenance. It can hold a stale value FullProf never used, so |
|
the zero correction and the sample-displacement terms, with their codewords decoded |
|
the background points the file declares, as (2θ, value) with their codewords |
|
what the run left out, and the range it fitted |
|
a neutron file’s LINE-12 user scattering lengths, each read as the isotope it is the Sears b of. A name that is not an element and a mass number with that b is refused at read |
|
an X-ray file’s LINE-12 f′ and f″ per element, as stated. A pair differing from rietx’s Cromer-Liberman value at the file’s wavelength is refused at read |
|
the data file the header comment names, and the pattern block’s settings. The name is reported and never followed, since it is often stale |
|
the |
|
the count of refined parameters the file declares, and every parameter number its codewords reference. Compare the two: they disagree in at least one real file |
|
the output options the file sets |
GSAS experiment files#
read_gsas_exp returns a GsasModel.
A GSAS experiment file holds the whole experiment rather than one phase, so the model is a tree: phases, histograms, and one entry per phase-and-histogram pair, which is where GSAS keeps the profile coefficients.
Field |
Holds |
|---|---|
|
the file, its |
|
every phase the file states |
|
every histogram, with its machine and the pattern it points at |
|
the phase-and-histogram entries, keyed |
|
the run’s own agreement indices |
|
GSAS’s |
|
how many parameters the run refined, and over how many channels |
|
one line per thing the read could not carry, kept whether or not you passed a list |
|
pick one histogram, or one pair’s refined profile. Both refuse to choose when the file carries several and you named none |
A phase is a GsasPhase.
Field |
Holds |
|---|---|
|
its |
|
the symbol, as written |
|
the lattice, its esds and its one refine flag |
|
the sites |
|
GSAS’s phase type, and whether it is one of the two magnetic ones |
|
the |
Its lattice is a GsasCell.
Field |
Holds |
|---|---|
|
the lattice parameters |
|
their esds, where the run produced them |
|
the cell volume and its esd |
|
the one refine flag and its damping. GSAS refines the cell as metric-tensor elements under one flag |
Each of its sites is a GsasAtom.
Field |
Holds |
|---|---|
|
the site’s name and its scattering species, in the file’s own upper case |
|
the site |
|
the isotropic displacement in Ų, or |
|
the six anisotropic values, or |
|
the |
|
the damping codes per group |
A histogram is a GsasHistogram.
Field |
Holds |
|---|---|
|
its ordinal and GSAS’s |
|
that type, read for you |
|
the pattern and |
|
the detector bank, and the anode |
|
the emission lines, Kα1 first |
|
the zero correction and its flag |
|
the polarisation fraction and its type code |
|
the Kα2/Kα1 ratio, or |
|
what the run left out, without GSAS’s spacer pair |
|
the range the data cover |
|
how many points were fitted, of how many recorded |
|
the histogram scale and its flag |
|
the background function and its coefficients |
|
the profile sets the instrument file supplied, which is where the histogram started |
|
this histogram’s own agreement indices |
A phase-and-histogram pair is a GsasHap.
Field |
Holds |
|---|---|
|
which pair this is |
|
the phase fraction and its flag |
|
the refined profile for this pair |
|
the March-Dollase rows, each with its axis and flag |
|
the powder extinction coefficient and its flag |
Its profile is a GsasProfile of GsasProfileTerm rows.
Field |
Holds |
|---|---|
|
which GSAS profile function, over how many coefficients |
|
the coefficients, named |
|
the same, keyed by GSAS’s name for each |
|
the ones the run was free to move, which is the protocol |
|
GSAS’s name for the coefficient and its 1-based position |
|
the file’s own number, and its flag |
|
the same quantity in degrees, or |
The background is a GsasBackground.
Field |
Holds |
|---|---|
|
which of GSAS’s background functions, over how many terms |
|
the terms themselves |
|
whether the run refined them, and the damping |
Profile coefficient names#
The names come from the profile function the file declares.
GSAS’s constant-wavelength function 2 has LX fourth, and function 3 has GP fourth.
A function this build cannot name is refused rather than read by position, because a width assigned to the wrong coefficient gives a plausible wrong answer and no error.
Profile units#
GSAS states the profile coefficients in centidegrees, and GsasProfileTerm.degrees converts them.
It is None for the anisotropic terms L11 to L23, whose unit also involves d².
None there means no conversion was made, and the value need not be zero.
Blank and unreadable fields#
A blank field is not a zero.
The polarisation fraction and the Kα2/Kα1 ratio are both conventionally 0.5, and they sit in adjacent fields of one record.
Where the file leaves the ratio blank, GsasHistogram.ka2_ratio is None, and choosing a ratio is then yours to do explicitly.
A field that is written but is not a number is refused, and the read does not return None for it.
The message names the file, the record key, the card columns and the text.
A record like that is misaligned or corrupt, so nothing on it can be trusted by column.
The .prm reader shares the record grammar and refuses the same way.
A field of nothing but asterisks is Fortran’s output for a value too wide for its field: the writer had the number and ran out of columns.
In a required field, such as a cell edge or a .prm’s LAM1, the read is refused with a message that says overflow.
In an optional one, such as an esd or the history Rwp, the field reads as None, and GSAS_FIELD_OVERFLOW names the record and the columns.
One case no rule for a single field can catch: a number that spills across a field boundary and leaves two readable halves, such as a left-aligned 46.60 read as 46 and .60.
GSAS-II project files#
read_gsas2_gpx returns a Gsas2Model.
A GSAS-II project has the same tree shape as a .EXP: phases, histograms, and one entry per phase-and-histogram pair.
It carries two things the older format has no room for: the constraints the refinement ran under, and the list of variables it actually refined.
Field |
Holds |
|---|---|
|
the file you opened, where GSAS-II last saved it, and the revision that wrote it |
|
every phase, and every powder histogram |
|
the phase-and-histogram entries, keyed |
|
the variables the last refinement refined, in GSAS-II’s |
|
the equivalences, holds and constraint equations, with their variables resolved into names |
|
the run’s own agreement indices. |
|
how many channels, how many parameters, and whether GSAS-II called the run converged. |
|
one line per thing the read could not carry, kept whether or not you passed a list |
|
pick one by name or by number. Both refuse to choose when the file carries several and you named none |
A phase is a Gsas2Phase.
Field |
Holds |
|---|---|
|
the name GSAS-II gives it, and its |
|
the symbol, as written |
|
the setting the project’s own operators describe, and the symbol to build under: the first where the file settled one, and |
|
the six lattice parameters and the cell volume |
|
the one refine flag GSAS-II keeps for the whole cell |
|
the sites |
|
the isotope chosen per atom type, GSAS-II’s |
|
GSAS-II’s phase type, and whether it is a magnetic one |
|
GSAS-II’s |
|
whether the phase was fitted by Pawley extraction, in which case its refined quantities are intensities rather than sites |
GSAS-II writes the symmetry operations themselves, so a symbol such as F d d d, which the tables hold in two settings, is read from the operators rather than assumed.
to_structure builds under Gsas2Phase.resolved_space_group, and GSAS2_GPX_SETTING_FROM_OPERATORS says when it differs from the symbol.
GSAS-II keeps an isotope in Gsas2Phase.isotope rather than in the atom type.
to_structure builds a site whose type has a mass-number choice as that isotope, so H with 2 is 2H.
GSAS-II does not document magPhases, so Gsas2Phase.magnetic_partner is not evidence of magnetic scattering.
On the public projects that carry it, it names one of the project’s own histograms, and the project holds no magnetic phase.
A phase GSAS-II types magnetic is what makes the file’s figures include magnetic scattering, and GSAS2_GPX_PHASE_MAGNETIC reports it.
Each of its sites is a Gsas2Atom.
Field |
Holds |
|---|---|
|
the site’s name and its scattering species, in the file’s own spelling. GSAS-II writes an ionic charge sign first, as |
|
the site |
|
what GSAS-II worked out about the position |
|
|
|
the isotropic displacement in Ų, and the six anisotropic values |
|
the letters the file carries, such as |
|
those letters read one at a time |
A histogram is a Gsas2Histogram.
Field |
Holds |
|---|---|
|
its |
|
GSAS-II’s type code, such as |
|
the instrument coefficients, and the same keyed by GSAS-II’s name for each |
|
the emission lines, primary first |
|
the range the refinement used, and the range the file was loaded with. The pair shows a narrowed range |
|
ranges masked out of the fit |
|
the background function and its coefficients |
|
the refinable sample parameters with their flags, keyed by GSAS-II’s own names ( |
|
|
|
how many channels the file carries |
An instrument coefficient is a Gsas2Term.
Field |
Holds |
|---|---|
|
GSAS-II’s own name, such as |
|
the refined number and the one it started from, which the format keeps side by side |
|
whether the run was free to move it |
|
the same quantity in degrees for the six centidegree coefficients, and |
The background is a Gsas2Background.
Field |
Holds |
|---|---|
|
GSAS-II’s own name for it, such as |
|
the terms, and whether the run refined them |
|
how many diffuse terms and fitted background peaks sat beside them |
A phase-and-histogram pair is a Gsas2Hap.
Field |
Holds |
|---|---|
|
which pair this is |
|
the phase’s scale in this histogram, and whether the pair was in the fit at all |
|
the sample broadening, which GSAS-II refines per pair |
|
the hydrostatic-strain terms |
|
a March-Dollase entry: the model, its value, its flag and its axis. |
|
a spherical-harmonics entry, as a |
|
the extinction coefficient |
|
whether this pair’s intensities were extracted rather than calculated |
Size and microstrain are each a Gsas2Broadening.
Field |
Holds |
|---|---|
|
|
|
the direct numbers with their flags: a size in µm, a microstrain in units of 10⁻⁶ |
|
the unique axis a uniaxial model uses |
|
the hkl-dependent coefficients. The format writes this row whatever the model, so on an isotropic one it is the unused default |
A spherical-harmonics texture is a Gsas2Texture, in GSAS-II’s own numbers.
Field |
Holds |
|---|---|
|
the highest even degree. Below 2 there is no term |
|
each coefficient under GSAS-II’s own name, such as |
|
the one refine flag GSAS-II keeps for all of them |
A constraint is a Gsas2Constraint.
Field |
Holds |
|---|---|
|
the format’s own letter: |
|
which variables it constrains: |
|
|
|
the right-hand side of a constraint equation, and whether a new variable is refined |
|
whether it is an equivalence, the one shape |
Anything with a flag beside it is a Gsas2Value, which holds Gsas2Value.value and Gsas2Value.refined and nothing else.
The pickle allow-list#
A .gpx is a sequence of Python pickles, and loading a pickle runs whatever it names.
So this reader resolves an allow-list and refuses every other name, naming it, without loading the file.
GSAS-II’s own two classes are admitted as inert stand-ins that hold data and do nothing, which is why a project with constraints reads at all.
So a .gpx from a source you do not trust either opens, having named nothing outside the list, or is refused with a message naming the global.
Instrument coefficient units#
Gsas2Term.degrees converts U, V, W, X, Y and Z from centidegrees, and no other coefficient.
For U, V and W it changes the unit and nothing else.
The result is still a Gaussian variance in degrees², which is what GSAS-II states, so rietx’s profile.u, profile.v and profile.w are 8 ln 2 times it.
Setting profile.u = terms["U"].degrees gives a Gaussian 2.35 times too narrow.
instprm_factor (in rietx.io.projects.gsas2) carries the whole factor, and Instrument files gives the .instprm conversion.
Zero is already in degrees, which is where the two GSAS generations differ: GSAS writes that field in centidegrees and GSAS-II does not.
So Gsas2Term.degrees is None for Zero, meaning no conversion was needed.
Refused phases#
to_structure refuses these by name, naming the phase and leaving the numbers on the model:
a magnetic phase, since the reader does not read a
.gpxmagnetic block yet (a magCIF of the same structure reads throughStructure.from_cif);a macromolecular phase, whose atom records carry residue and chain columns this reader does not read;
a Pawley phase, whose refined quantities are the reflection intensities;
a phase with anisotropic sites, since no file here settles which off-diagonal convention GSAS-II wrote the anisotropic values in, and a wrong factor of 2 is a silently wrong Debye-Waller factor at high Q;
a phase with no sites, which GSAS-II fits by extracting its intensities;
a phase with no space-group symbol, or one this build does not resolve;
an isotope choice that is not a mass number, or names a nucleus the Sears table rietx scatters from does not carry, since reading it as natural abundance would change the site’s scattering length without saying so.
A file with no phases at all is refused too.
A negative Uiso is read as the file states it, and becomes a negative Biso.
A converged refinement can end there, and a fit that keeps it reports BISO_NEGATIVE.
Texture conversion#
GSAS-II refines a spherical-harmonics texture per phase and histogram.
to_structure carries it onto Phase.texture where one conversion holds at every reflection, and reports GSAS2_GPX_TEXTURE_CONVERTED.
GSAS-II puts a Bragg-Brentano histogram’s sample angle at 90°, and rietx puts it on the plate normal.
So each coefficient is multiplied by the Legendre polynomial Pl(0), which is −1/2 at l = 2.
The warning under (5.17) gives the whole conversion.
In Laue classes 4/m, −3 and 6/m the n ≠ 0 terms take a further √2.
Fitted under the bragg_brentano geometry, the carried texture gives GSAS-II’s own multipliers to GSAS-II’s single precision.
The phase builds without the texture in four cases, and GSAS2_GPX_TEXTURE_NOT_CARRIED says why:
a Debye-Scherrer histogram, where GSAS-II’s sample angle follows θ, so no constant converts it;
histograms that disagree, including a histogram where the phase has no texture. A phase here has one texture, which a joint fit shares. Histograms that differ only in the refine flag agree, and the texture is freed;
a term GSAS-II 5.8.4 evaluates wrongly. Its function takes two values on one set of equivalent reflections, so its coefficient matches no invariant function. This happens for every n ≠ 0 term in −1 and 2/m, for every term on rhombohedral axes, and for the n = 3 terms of −31m. A zero coefficient there is dropped, since nothing is lost;
a name no term of the class matches.
A cubic phase at order 2 has no term, so nothing is lost, and the report says so at info.
A March-Dollase entry stays on Gsas2Hap.preferred_orientation and is not carried.