# UNEX Tutorial

Yury V. Vishnevskiy
yu.v.vishnevskiy@gmail.com
version 2.2, 2026-01-09

## Introduction

In this document you will find basic examples on how to prepare UNEX inputs for some typical jobs, run them and analyse respective outputs. In the various examples below I have tried to utilize real experimental data as much as possible, so you can see realistic use cases. Some theoretical values, mostly from quantum chemical calculations, occasionally can appear. They also correspond to modern state of the art in this field.

## Rotational spectroscopy

In context of rotational spectroscopy UNEX can be used for refinement of molecular structure from rotational constants.

### A simple example of structure refinement

As a simple example we take sulfur dichloride SCl2, for which rotational constants have been experimentally determined in the work of Bizzocchi et al. [1]. Below you will find a step-by-step tutorial on how to refine the structure of this molecule using UNEX.

#### First steps

In the C2v symmetry SCl2 molecule has only two independent geometrical parameters, so we can refine them even from three experimental rotational constants of only single parent isotopologue. Lets create UNEX input file and as the very first lines we add the following minimal set of commands:

    BASE: READ <BASE>,</BASE>
    ZMATRIX: READ mol <ZMAT>,</ZMAT>
    LSQFUNC: MINIMIZE ROTCON
    STOP:

UNEX will interpret these commands line by line:

1. `BASE:READ`— reading of basic information, including definition of the molecule name, which is located between tags `<BASE>` and `</BASE>`.

2. `ZMATRIX:READ`— for the molecule `mol` reading of Z-matrix located between tags `<ZMAT>` and `</ZMAT>`.

3. `LSQFUNC:MINIMIZE`— minimization of the least squares functional consisting of rotational constants, i.e. refinement of the molecular structure.

4. `STOP:`— termination of UNEX execution.

Now we need to provide the field of data expected by the `BASE:READ` command. Add to the input file the following block:

    <BASE>
     Molecules=mol
    </BASE>

which contains the only single keyword `Molecules`. We use it to define the identifier `mol` for our molecule. This identifier is required in the following commands. When interpreting the `Molecules` keyword UNEX expects a molecule-specific data field between tags constructed on the basis of the molecule identifier, in this case as `<mol>` and `</mol>`. Lets create and fill in this field with required for our purposes data:

    <mol>
     Formula=SCl2
     RotConModel=rrpam
     # Experimental constants from Bizzocchi et. al, J. Mol. Spectr., 204 (2000) 275.
     RotAExpVal=14613.57789
     RotAExpStdev=0.00057
     RotBExpVal=2920.86641
     RotBExpStdev=0.00013
     RotCExpVal=2430.69088
     RotCExpStdev=0.00012
    </mol>

Here we define:

- the formula of the molecule as `Formula=SCl2`;

- the model for rotational constants as `rrpam`;

- experimental values for rotational constants using the `RotAExpVal`, `RotBExpVal` and `RotCExpVal` keywords. Note, the input units are MHz, which is the default option in UNEX;

- respective standard deviations with the keywords `RotAExpStdev`, `RotBExpStdev` and `RotCExpStdev`.

Now for the `ZMATRIX:READ` command we need to provide the actual Z-matrix of our molecule. Add to the file the following block:

    <ZMAT>
    Cl
    S  1 Rscl
    Cl 2 Rscl 1 Aclcl

    Rscl      2.0   1
    Aclcl   103.0   2
    </ZMAT>

This Z-matrix defines two internal geometrical parameters, the bond length `Rscl` (one parameter for both bonds) and the angle `Aclcl`, with respective initial values. We want to refine both parameters, so next to their values we also define refinement group numbers as `1` and `2`. Note, here we use two different groups, thus the parameters will be refined independently from each other.

Now your input file is ready, its content must be similar to that of the file `SCl2_1.inp` coming with this tutorial. We can run UNEX with this file and inspect the produced output file. The part of the output from the refinement goes after the line `LSQ functional processing …​`. There you can see some information on experimental data, parameters to be refined, the convergence of the iterative procedure and various statistics. In the latter we may be particularly interested in the line `Rotational constants: ESD=3.279e+00 MaxD=2.29e+00 RMSD=1.89e+00 WRMSD=2.09e+00 MHz`, which gives us maximal, root-mean-square and weighted root-mean-square deviations of rotational constants in MHz. In particular the weighted root-mean-square deviation is equal to 2.09 MHz. Also after the convergence a table with parameters is printed, in this case:

    Refined parameters:
    Errors are 1.00 times LSQ standard deviations.
    -----------------------------------------------------------------------------------------
     Group   Type             Old value        Refined value     Error   RelErr    d(X^2)/dP
    -----------------------------------------------------------------------------------------
         1  ZmR            2.0000000000e+00   2.0129185079e+00  6.2e-04  3.1e-04    1.2e+04
         2  ZmAng          1.0300000000e+02   1.0282286064e+02  3.7e-02  3.6e-04    1.1e+04
    -----------------------------------------------------------------------------------------

The meaning of the table content is essentially self-explaining. The refined values of the parameters are now r(S—​Cl) = 2.0129(6) Å and α(Cl—​S—​Cl) = 102.82(4) degrees, with least-squares standard deviations in parentheses. Note, we used rotational constants A0, B0 and C0 without any vibrational corrections. Thus, the refined structure is in fact of the r0 type.

After the table with parameters you can find the matrix of correlations printed as

    Matrix of correlations:
    -----------------------------------------------------------------------------
     1.0000
     0.1553 1.0000
    -----------------------------------------------------------------------------

Fortunately, in our example this matrix is very compact. It shows that the refined parameters have correlation coefficient equal to 15.5 %.

#### Adding isotopologues

Bizzocchi et al. [1] determined rotational constants not only for the parent molecule of sulfur dichloride but also for its three isotopologues. We can utilize these data in our structural refinement. First of all, in the input UNEX file we need to define additional molecules corresponding to the three additional isotopologues. For this, we use the keyword `IsotopMols` in the field of the parent molecule:

    # Parent isotopologue
    <mol>
     Formula=SCl2
     IsotopMols=iso1;iso2;iso3
     # Bizzocchi et al., J. Mol. Spectr., 204 (2000) 275.
     # The values for the parent molecule:
     RotAExpVal=14613.57789
     RotAExpStdev=0.00057
     RotBExpVal=2920.86641
     RotBExpStdev=0.00013
     RotCExpVal=2430.69088
     RotCExpStdev=0.00012
    </mol>

Accordingly, we add three molecule-specific fields with data for `iso1`, `iso2` and `iso3`:

    # [32]S[35]Cl[37]Cl
    <iso1>
     Formula=SCl2
     # Bizzocchi et al., J. Mol. Spectr., 204 (2000) 275.
     RotAExpVal=14490.19459
     RotAExpStdev=0.00058
     RotBExpVal=2841.19803
     RotBExpStdev=0.00013
     RotCExpVal=2371.96585
     RotCExpStdev=0.00013
    </iso1>

    # [32]S[37]Cl2
    <iso2>
     Formula=SCl2
     # Bizzocchi et al., J. Mol. Spectr., 204 (2000) 275.
     RotAExpVal=14365.1421
     RotAExpStdev=0.0026
     RotBExpVal=2763.20280
     RotBExpStdev=0.00024
     RotCExpVal=2314.12120
     RotCExpStdev=0.00019
    </iso2>

    # [34]S[35]Cl2
    <iso3>
     Formula=SCl2
     # Bizzocchi et al., J. Mol. Spectr., 204 (2000) 275.
     RotAExpVal=14024.5853
     RotAExpStdev=0.0068
     RotBExpVal=2921.00225
     RotBExpStdev=0.00056
     RotCExpVal=2413.85131
     RotCExpStdev=0.00034
    </iso3>

Just like for the parent molecule, we must define Z-matrices also for the additional isotopologues using the `ZMATRIX:READ` command:

    ZMATRIX: READ iso1 <ZMAT>,</ZMAT>
    ZMATRIX: READ iso2 <ZMAT>,</ZMAT>
    ZMATRIX: READ iso3 <ZMAT>,</ZMAT>

Note, all isotopologues share the same geometry so we read the same Z-matrix between tags `<ZMAT>` and `</ZMAT>`. However, now we need to indicate the particular isotope masses, which is done by the commands

    MOLATOM: SET iso1 Atoms=1   Mass=36.96590260
    MOLATOM: SET iso2 Atoms=1;3 Mass=36.96590260
    MOLATOM: SET iso3 Atoms=2   Mass=33.96786700

In this way we indicate only non-standard isotopes. For the other atoms UNEX automatically assigns built-in atomic masses of the most abundant isotopes, in this case 32S and 35Cl.

Now your input file must be similar to the file `SCl2_2.inp` of this tutorial and it is ready to be processed by UNEX. The least squares refinement converges very quickly and takes less than a second on modern hardware. Note that we have now in total 12 experimental constants:

    Statistics:
     Number of refined parameters: 2
     Number of data: 12
     Degrees of freedom: v=10

Interestingly, the overall agreement of model with data is now even slightly better, `WRMSD=2.03e+00 MHz`, than in the previous case of only one isotopologue with three experimental constants in total. Due to the increased number of statistically independent experimental data the refined parameters are now more precise, r(S—​Cl) = 2.0129(2) Å and α(Cl—​S—​Cl) = 102.82(1) degrees, and the correlation coefficient has lowered to about 10 %.

We can also print Cartesian coordinates of atoms in all or selected isotopologues. After the `LSQFUC` command add the line

    PRINT: MOLXYZ mol

This will give you the coordinates of atoms in the parent molecule `mol`. In the default format you can also see the atomic masses actually used by UNEX. In context of rotational spectroscopy it makes sense to print Cartesian coordinates in the system of principal axes of inertia tensor. For this, add the keyword `PrintXYZPAS=true` to the field of basic information. On the output you should get

    Cartesian coordinates (Angstroms) of atoms in mol
    Format: UNEX
    Orientation: PAS (III^r)
    --------------------------------------------------------------------------------------------------
     N | At | An |       Mass      |          a          |          b          |          c
    --------------------------------------------------------------------------------------------------
     1  Cl   17    34.968852690000 -1.57337179879261e+00  3.93893392440875e-01  0.00000000000000e+00
     2  S    16    31.972071173500  0.00000000000000e+00 -8.61627008214962e-01  0.00000000000000e+00
     3  Cl   17    34.968852690000  1.57337179879261e+00  3.93893392440875e-01  0.00000000000000e+00
    --------------------------------------------------------------------------------------------------
    Rot. const. (RRPAM, MHz): 1.46117876060391e+04 2.91906050564133e+03 2.43300790959393e+03

The coordinates can be visualized producing a structure like in the figure below.

Figure 1. SCl2 in the principal axes system.

#### Using vibrational corrections

Until now we refined the r0 structure directly from experimental rotational constants A0, B0 and C0. Omitting a discussion of disadvantages related to this type of structure, we can proceed directly to the example on how to refine structures corrected for vibrational effects. For this, next to experimental rotational constants we need to define respective vibrational corrections. Nowadays in many cases they can be routinely calculated with reasonable confidence by applying an appropriate theoretical method. Even better is when you have them refined from experimental ro-vibrational spectra. In any case they must be introduced in UNEX using the keywords `RotAVibCorVal`, `RotBVibCorVal` and `RotCVibCorVal`. Taking your previous input file you can add the following data to the field of the parent molecule:

    RotAVibCorVal=-19.2076
    RotBVibCorVal=9.4715
    RotCVibCorVal=9.5976

to the first isotopologue `iso1`:

    RotAVibCorVal=-18.6655
    RotBVibCorVal=9.1457
    RotCVibCorVal=9.2892

to `iso2`:

    RotAVibCorVal=-18.1413
    RotBVibCorVal=8.8313
    RotCVibCorVal=8.9889

and finally to `iso3`:

    RotAVibCorVal=-18.6646
    RotBVibCorVal=9.3391
    RotCVibCorVal=9.4141

All these values are quantum-chemically calculated corrections to equilibrium structure. As a reference this tutorial provides a file `SCl2_3.inp`, which contains all the required information. Running UNEX with the prepared input leads to a much better fit with WRMSD equal to 3.50e-02 MHz. This may be compared with the previous value (2.03e+00 MHz) from the example above without any vibrational corrections. Thus we are getting here more consistent model. The refined parameters, rese(S—​Cl) = 2.011023(3) Å and αese(Cl—​S—​Cl) = 102.6808(2) degrees, are now much more precise, at least nominally. Also, in comparison to the previous values, r0(S—​Cl) = 2.0129(2) Å and α0(Cl—​S—​Cl) = 102.82(1), we see significant deviations due to the different types of structures. Note, we use the rese designation to underline that the structure is in fact semi-experimental (also known as semi-empirical) due to using theoretical vibrational corrections. Please keep in mind that obtained in this example very small standard deviations manifest only the contribution of random noise from experimental data. Of course, the total errors must be larger at least due to uncertainties in vibrational corrections. This is, however, a different topic.

What we can also do in this example is to print details about rotational constants. For this, you can add the following line after the `LSQFUNC` command:

    PRINT: ROTCON mol

On the output you get the following data for the parent molecule `mol`:

    Model rotational constants for mol
    Units: MHz
    Model: rrpam-vibc-elc1
    -------------------------------------------------------------------------------------
             RRPAM       |      El. Cor.      |      Vib. Cor.     |     Total Model
    -------------------------------------------------------------------------------------
    A  1.459434063286e+04   0.000000000000e+00  -1.920760000000e+01   1.461354823286e+04
    B  2.930307872201e+03   0.000000000000e+00   9.471500000000e+00   2.920836372201e+03
    C  2.440329187413e+03   0.000000000000e+00   9.597600000000e+00   2.430731587413e+03
    -------------------------------------------------------------------------------------

    Experimental and model rotational constants for mol
    Units: MHz
    Model: rrpam-vibc-elc1
    Errors are 1.00 times standard deviations.
    ------------------------------------------------------------------------------
          Experimental    |   Error   |        Model       |   Error  |   Delta
    ------------------------------------------------------------------------------
    A  1.461357789000e+04   5.70e-04    1.461354823286e+04   7.80e-02    2.97e-02
    B  2.920866410000e+03   1.30e-04    2.920836372201e+03   1.35e-02    3.00e-02
    C  2.430690880000e+03   1.20e-04    2.430731587413e+03   9.41e-03   -4.07e-02
    ------------------------------------------------------------------------------
    For the defined values: RMSD=3.39e-02   WRMSD=3.61e-02 MHz
    Asymmetry kappa: -0.92 (RRPAM model), -0.92 (experimental)

Here in the first table you can see the particular components of the model values, including the vibrational corrections. Note, in sulfur dichloride these corrections constitute about 0.1 — 0.5 % of the total rotational constants. The default model `rrpam-vibc-elc1` also involves electronic correction, which is not yet used in this example and will be introduced later. In the second table are provided experimental and model values and respective deviations for the rotational constants separately.

#### Applying electronic corrections

In addition to vibrational correction our model for rotational constants contains also an electronic correction (consult UNEX manual for details). Usually they are negligibly small but in investigations of some molecules they can play significant role. In UNEX these corrections are internally calculated from diagonal `aa`, `bb` and `cc` components of molecular rotational g-tensor. The latter can be determined experimentally or, most usually, calculated theoretically. In the input file we define the diagonal components with the keywords `RotGTaaVal`, `RotGTbbVal` and `RotGTccVal` for each molecule. In this example we add the following theoretically precalculated values for the parent isotopologue `mol` (the calculation protocol is not in the scope of this tutorial):

    RotGTaaVal=-0.0361
    RotGTbbVal=-0.0147
    RotGTccVal=-0.0232

for `iso1`:

    RotGTaaVal=-0.0358
    RotGTbbVal=-0.0143
    RotGTccVal=-0.0226

for `iso2`:

    RotGTaaVal=-0.0355
    RotGTbbVal=-0.0139
    RotGTccVal=-0.0221

and for `iso3`:

    RotGTaaVal=-0.0348
    RotGTbbVal=-0.0147
    RotGTccVal=-0.0231

Now the file is ready for running and must be similar to `SCl2_4.inp` from this tutorial. After the least-squares refinement with `LSQFUNC:MINIMIZE` you can see that the overall agreement is now even better, `WRMSD=3.13e-02 MHz`, although to a very small extent. Thus, the vibrational corrections do the major job and the electronic corrections lead to only slight improvement. The latter can sometimes even slightly worsen the agreement due to inaccuracy and inconsistency with other data. Looking at the refined parameters, rese(S—​Cl) = 2.011010(3) Å and αese(Cl—​S—​Cl) = 102.6811(2) degrees, we can see some notable shift in the bond length compared to the previous refinement without electronic corrections, i.e. rese(S—​Cl) = 2.011023(3) Å and αese(Cl—​S—​Cl) = 102.6808(2) degrees. Formally, if we consider only the provided in parentheses standard deviations, this effect could be accepted as significant. However, we keep in mind that the other sources of uncertainties are not taken into account and thus the seeming effect is rather unreliable in this particular case. After the refinement we can get lots of interesting information by executing `PRINT: ROTCON all`. This variant of the command prints rotational constants for all defined molecules, so that you do not need to call `PRINT` for each molecule individually.

In particular, for `mol` we get

    Model rotational constants for mol
    Units: MHz
    Model: rrpam-vibc-elc1
    -------------------------------------------------------------------------------------
             RRPAM       |      El. Cor.      |      Vib. Cor.     |     Total Model
    -------------------------------------------------------------------------------------
    A  1.459462922084e+04  -2.870183433458e-01  -1.920760000000e+01   1.461354980250e+04
    B  2.930334240812e+03  -2.346613381449e-02   9.471500000000e+00   2.920839274678e+03
    C  2.440355543757e+03  -3.084242581278e-02   9.597600000000e+00   2.430727101331e+03
    -------------------------------------------------------------------------------------

    Experimental and model rotational constants for mol
    Units: MHz
    Model: rrpam-vibc-elc1
    Errors are 1.00 times standard deviations.
    ------------------------------------------------------------------------------
          Experimental    |   Error   |        Model       |   Error  |   Delta
    ------------------------------------------------------------------------------
    A  1.461357789000e+04   5.70e-04    1.461354980250e+04   6.98e-02    2.81e-02
    B  2.920866410000e+03   1.30e-04    2.920839274678e+03   1.21e-02    2.71e-02
    C  2.430690880000e+03   1.20e-04    2.430727101331e+03   8.43e-03   -3.62e-02
    ------------------------------------------------------------------------------
    For the defined values: RMSD=3.08e-02   WRMSD=3.23e-02 MHz
    Asymmetry kappa: -0.92 (RRPAM model), -0.92 (full model), -0.92 (experimental)

Now you can see how large are the absolute values of electronic corrections in sulfur dichloride. For the parent molecule, as well as for other isotopologues, they are of the order -3×10-1 MHz for A and -3×10-2 MHz for B and C, which is 0.5 — 1.5 % of the corresponding vibrational correction or 0.001 — 0.002 % of the total rotational constant.

At this point we can consider our refinement as complete.

## Gas electron diffraction

Historically UNEX has been designed as a full-featured software for comprehensive support of experimental gas-phase electron diffraction (GED) studies. Below are presented some use cases with typically appearing scenarios.

### Structure refinement

One of the most important stages in a typical GED investigation is the structure refinement. In this chapter you can learn how to solve this problem using UNEX.

#### A simple example

As an example we take a portion of experimental diffraction data measured for carbon tetrachloride CCl4 in the work of Vishnevskiy et al. [2]. The molecules of CCl4 are small and highly symmetric (Td point group) and thus are very convenient for a GED structural analysis. It is also handy from the experimental point of view, since diffraction patterns can be easily measured for this compound.

In this simple example we assume that the data reduction and electron wavelength calibration have already been done and we take for the analysis only one experimental total intensity curve. Our next steps are briefly as follows:

1. We define the complete initial model of our molecule with all parameters required for the calculation of the model molecular intensity,

2. introduce the experimental total diffraction intensity,

3. extract molecular part from the total intensity,

4. refine the molecular parameters using the least-squares method,

5. print and analyze the results.

So lets start from the very beginning. Below are described commands, which should be added line-by-line to a newly created UNEX input file.

First, we must introduce some basic information

    BASE: READ <BASE>,</BASE>
    STOP:

    <BASE>
     Molecules=mol
    </BASE>

    <mol>
     Formula=CCl4
    </mol>

Next we define a geometrical model for the molecule. In this example we use geometrically-consistent GED model, so the structure must be defined as a Z-matrix with the command (right after `BASE:`)

    ZMATRIX: READ mol <ZMAT>,</ZMAT>

and providing the required field

    <ZMAT>
    Cl
    C  1 R1
    Cl 2 R1 1 A1
    Cl 2 R1 1 A1 3 A1 -1
    Cl 2 R1 1 A1 3 A1  1

    R1      1.763                  2
    A1    109.4712206344907
    </ZMAT>

Note, to the `R1` parameter we already assigned the group number `2`. This is not required now, but will be used below in the actual refinement procedure. When introducing Z-matrices it is advised to check their correctness by printing calculated Cartesian coordinates. This can be done with the command

    PRINT: MOLXYZ mol

and visualizing the printed coordinates by any suitable software.

Figure 2. Molecular structure of CCl4.

Note, you can print Cartesian coordinates in different formats, see the manual for details. You may also want to check the symmetry of your input structure by using

    PRINT: MOLSYM mol

For our example this command must produce some information on symmetry elements and also the line

    Point group: Td [4C3,3C2,3S4,6P,E]

which is what we expect for CCl4.

Next we introduce information on GED terms (interatomic pairs) for the molecule with the `EDTERMS` command:

    EDTERMS: READ mol <TERMS>,</TERMS> Format=unex

Add the corresponding data field to the input file with precalculated values:

    <TERMS>
    #At1 At2      r_a        l         cor      G
    C2   Cl1    1.7609     0.0521    -0.0066    3
    C2   Cl3    1.7609     0.0521    -0.0066    3
    C2   Cl4    1.7609     0.0521    -0.0066    3
    C2   Cl5    1.7609     0.0521    -0.0066    3
    Cl1  Cl3    2.8755     0.0676    -0.0090    4
    Cl1  Cl4    2.8755     0.0676    -0.0090    4
    Cl1  Cl5    2.8755     0.0676    -0.0090    4
    Cl3  Cl4    2.8755     0.0676    -0.0090    4
    Cl3  Cl5    2.8755     0.0676    -0.0090    4
    Cl4  Cl5    2.8755     0.0676    -0.0090    4
    </TERMS>

Here we are tying together amplitudes for the bonded distances C—​Cl in the refinement group number `3`, and the amplitudes for the non-bonded distances Cl…​Cl in the group `4`.

At this point the molecular model is defined completely and we can introduce the diffraction data. With the command `EDDATA` UNEX will read-in the experimental total diffraction intensity:

    EDDATA: READ <EDINT>,</EDINT>

The initial part of the respective data field looks like:

    <EDINT>
    Set=ed1  Data=s;iTotExp  ImolSf=1.0  ImolSfRefGrp=1
     6.20  11.7659129739
     6.40  11.9934137749
     6.60  12.3881941876

For the complete data see the file `CCl4_1.inp` supplemented to this tutorial. For the refinement we assign the group number `1` to the scale factor of the molecular intensity. The initial value for this factor is also explicitly defined as `ImolSf=1.0`. Now the ED data set `ed1` is defined and we can use this identifier later in other commands.

For the calculation of model intensities we must introduce ED scattering factors. In UNEX they can be calculated simply by calling the `EDSCATFAC` command. Add the following line after the `EDDATA:READ` call:

    EDSCATFAC: CALC mol Lambda=0.048707

With the keyword `Lambda` we indicate the calibrated electron wavelength.

For the least-squares refinement we need experimental molecular intensity function. It must be extracted from the total intensity, which is in the ED data set `ed1`. For this use the command `EDIMOL`:

    EDIMOL: GETEXP ed1  BgrSplNInflMax=3  ItotModel=mbgr

In this procedure the total intensity is decomposed into molecular and background components. As the model we choose `mbgr`, i.e. containing multiplicative background. The background will be approximated with a cubic spline and as a smoothness criterion we allow no more than `3` inflection points. Note, the actual number of inflection points may be smaller. UNEX prints this information on output. In this example you should get

     Number of inflection points 2, requested 3

Finally we have both model and data ready for the refinement. For the least-squares determination of parameters we must use the `LSQFUNC` command. Add the following line for minimization of the LSQ functional built on ED sM(s) function from the `ed1` data set:

    LSQFUNC: MINIMIZE EDSMS ed1

From this command UNEX prints lots of important information to the output file, including the initial values of parameters and LSQ functional, convergence during the iterations and at the end, statistics of the refinement, a table with refined parameters and correlation matrix. After the convergence we have the best (minimal) achieved R-factor

      Total sM(s) Rf=6.157  wRd=6.157

Initial and refined parameters, as well as corresponding least-squares standard deviations, are printed in the table:

    Refined parameters:
    Errors are 1.00 times LSQ standard deviations.
    -----------------------------------------------------------------------------------------
     Group   Type             Old value        Refined value     Error   RelErr    d(X^2)/dP
    -----------------------------------------------------------------------------------------
         1  EDImolSf       1.0000000000e+00   8.8210443905e-01  7.6e-03  8.6e-03   -2.8e-14
         2  ZmR            1.7630000000e+00   1.7604005167e+00  2.6e-04  1.5e-04    3.5e-07
         3  EDTrmAmpl+     5.2100000000e-02   4.7047497358e-02  8.9e-04  1.9e-02   -6.5e-08
         4  EDTrmAmpl+     6.7600000000e-02   6.9215439794e-02  5.4e-04  7.8e-03   -3.4e-07
    -----------------------------------------------------------------------------------------

Next are printed the correlation coefficients:

    Matrix of correlations:
    -----------------------------------------------------------------------------
     1.0000
     0.0498 1.0000
     0.4876 0.0026 1.0000
     0.7298 0.0264 0.3702 1.0000
    -----------------------------------------------------------------------------

As you can see, the refinement procedure has changed the values of parameters substantially. We need to keep in mind that the `EDIMOL:GETEXP` procedure used model-dependent background (see UNEX manual for details). Thus, if the model has significantly changed, it makes sense to repeat again the combination of molecular intensity extraction and parameter refinement. Add these two lines (same as before) to the input file:

    EDIMOL: GETEXP ed1  BgrSplNInflMax=3  ItotModel=mbgr
    LSQFUNC: MINIMIZE EDSMS ed1

After the second LSQ functional minimization you should get a better (lower) R-factor

      Total sM(s) Rf=5.054  wRd=5.054

and the refined parameters

    Errors are 1.00 times LSQ standard deviations.
    -----------------------------------------------------------------------------------------
     Group   Type             Old value        Refined value     Error   RelErr    d(X^2)/dP
    -----------------------------------------------------------------------------------------
         1  EDImolSf       8.8210443905e-01   8.6731619200e-01  6.1e-03  7.0e-03   -5.6e-14
         2  ZmR            1.7604005167e+00   1.7601265599e+00  2.1e-04  1.2e-04    4.6e-07
         3  EDTrmAmpl+     4.7047497358e-02   4.6372855337e-02  7.3e-04  1.6e-02    1.6e-08
         4  EDTrmAmpl+     6.9215439794e-02   6.9282520045e-02  4.4e-04  6.4e-03   -3.3e-08
    -----------------------------------------------------------------------------------------

The changes between the old (before this last refinement) and new (after the refinement) values are now much smaller. The correlation matrix remained nearly the same

    1.0000
    0.0498 1.0000
    0.4906 0.0026 1.0000
    0.7293 0.0265 0.3721 1.0000

and shows that the largest correlation (72.93 %) is between the molecular intensity scale factor `EDImolSf` (group `1`) and the vibrational amplitudes l(Cl…​Cl) tied together in group `4`.

We may want to check the electron diffraction data and plot various functions for better analysis. Add the following command after the last LSQ minimization:

    PRINT: EDDATA ed1  Data=iTotExp;iBgr;iMolExp;iMolMod;iMolDif

With the keyword `Data` is indicated that the following data types from the set `ed1` are printed together:

1. experimental total intensity,

2. background intensity,

3. experimental molecular intensity,

4. model molecular intensity,

5. difference between experimental and model molecular intensities.

These data can be visualized by any suitable software. We can use the UIntPlot program bundled together with UNEX. Starting it in the command line as

    uintplot --data tot,bgr --curves ed1 CCl4_1.log

will produce a plot of the experimental total intensity with the respective background line. Note, UIntPlot requires that the Gnuplot program [3] is already installed and can be started simply as `gnuplot` from you working directory. Also make sure that last command line argument to `uintplot` is the actual name of your UNEX output file.

Figure 3. Experimental total ED intensity and background line of CCl4.

Visual inspection of molecular intensity functions is also very important. We plot them running `uintplot` as

    uintplot --data mol,mmol,dmol --curves ed1 CCl4_1.log

which produces the following image.

Figure 4. Model (red line) and experimental (dots) ED molecular sM(s) intensity functions of CCl4. Below is the difference curve.

As we can see, the difference curve is rather small and shows mostly random deviations between experimental data and model. Thus the fit is acceptable.

Usually electron diffraction data are also represented in the form of radial distribution functions (RDF). UNEX will calculate them, if you add the following command:

    EDRDF: CALC ed1

Also, for the visualization it is convenient to print the ED terms as

    PRINT: EDTERMS mol  Format=urdfplot

Now after processing of all commands your UNEX output file must contain all the data required by the URDFPlot program (also bundled together with UNEX), which is useful for plotting RDFs. Start it simply as (provide the actual name of your output file as the argument):

    urdfplot CCl4_1.log

and you will get the following image.

Figure 5. Model (red line) and experimental (dots) radial distribution functions of CCl4. Vertical lines show positions and estimated contributions of interatomic pairs into diffraction patterns. Below is the difference curve between the experimental and model data.

As we can see, in the RDF representation the difference between the experimental data and model is also small.

On the basis of the R-factor value of 5.05 % and visual inspection of deviations between experimental data and best refined model, we may now summarize the main results of our investigation of CCl4 as rese(C—​Cl) = 1.7601(2) Å, l(C—​Cl) = 0.0464(4) Å and l(Cl…​Cl) = 0.0693(4) Å, where values in parentheses are least-squares standard deviations. Note, because of the used theoretical vibrational corrections (we introduced them with `EDTERMS:READ`) to the equilibrium geometry, the determined structural parameter is semi-experimental rese.

| The obtained here least-squares standard deviations of the refined parameters may in no case be considered as total uncertainties. In addition to random noise in experimental data, there are other various sources of errors. Their consideration is an another, a more difficult topic.

#### Direct refinement of ED terms

In principle, for calculation of model molecular intensity it is enough to define only ED terms, i.e. interatomic distances and vibrational amplitudes for the full set of atom pairs of a molecule. In the example above this has been done using `EDTERMS:READ`. However, in that case also the consistent molecular geometry has been defined using a Z-matrix. Thus we refined the `R1` parameter of the Z-matrix and the distances in the ED terms were in fact dependent parameters. Alternatively it is also possible to refine term distances directly and independently. For this, the respective group number(s) must be indicated in the data field for the `EDTERMS:READ` command, like in the example:

    <TERMS>
    #At1 At2      r_a         l      Gl   Gr
    C2   Cl1    1.7609     0.0521    3    5
    C2   Cl3    1.7609     0.0521    3    5
    C2   Cl4    1.7609     0.0521    3    5
    C2   Cl5    1.7609     0.0521    3    5
    Cl1  Cl3    2.8755     0.0676    4    6
    Cl1  Cl4    2.8755     0.0676    4    6
    Cl1  Cl5    2.8755     0.0676    4    6
    Cl3  Cl4    2.8755     0.0676    4    6
    Cl3  Cl5    2.8755     0.0676    4    6
    Cl4  Cl5    2.8755     0.0676    4    6
    </TERMS>

Here as before we tie the amplitudes in groups `3` and `4` and in addition also introduce groups `5` and `6` for the respective distances C—​Cl and Cl…​Cl. In this mode it does not make sense to use vibrational corrections, so the column with their values has been removed. Note, we do not use any Z-matrix. The initial model `r_a` values must be reasonable in input. Also, we are going now to refine two sorts of distances, C—​Cl and Cl…​Cl, in two indepedent groups. Therefore this can lead to geometrically inconsistent values. The rest of the model and data may be taken from the previous example. The ready to process file `CCl4_2.inp` is provided with this tutorial. The final step of the refinement should give the following output

    Refined parameters:
    Errors are 1.00 times LSQ standard deviations.
    -----------------------------------------------------------------------------------------
     Group   Type             Old value        Refined value     Error   RelErr    d(X^2)/dP
    -----------------------------------------------------------------------------------------
         1  EDImolSf       8.9019259791e-01   8.6785216702e-01  6.6e-03  7.6e-03   -6.6e-13
         3  EDTrmAmpl+     4.8156464509e-02   4.7321489126e-02  7.8e-04  1.6e-02   -2.1e-08
         4  EDTrmAmpl+     7.0143148860e-02   6.9933355394e-02  4.8e-04  6.8e-03    4.2e-07
         5  EDTrmRa+       1.7616514954e+00   1.7620690740e+00  6.6e-04  3.7e-04   -7.6e-08
         6  EDTrmRa+       2.8807127785e+00   2.8819184403e+00  4.0e-04  1.4e-04   -1.2e-06
    -----------------------------------------------------------------------------------------

Now the main results of our refinement for CCl4 are ra(C—​Cl) = 1.7621(7) Å, ra(Cl…​Cl) = 2.8819(4) Å, l(C—​Cl) = 0.0473(8) Å and l(Cl…​Cl) = 0.0699(5) Å.

You can (well, normally must) inspect all involved ED intensities and RDF just like in the previous example. In this particular case they should not change significantly, though. The complete set of ED terms can be printed simply by using the command `PRINT: EDTERMS mol`.

#### Automatic levelling of experimental intensity

In processing of experimental ED intensity curves a very important role plays background elimination procedure. It is required for extracting the molecular part from the total intensity. In the examples above for this purpose we applied the `EDIMOL:GETEXP` command to original total intensity data. However, the result of the background calculation procedure crucially depends on how well is the total intensity levelled. In particular, the smoothness criteria, in our case it is the number of inflection points, work well only for appropriately levelled background. Now, the used here experimental total diffraction intensity for CCl4 does not really fulfil this requirement, as can be seen on the image above. Accordingly, it must be levelled, if one wants to minimize possible systematic errors in refined molecular parameters. In UNEX is implemented a procedure for automatic levelling of total intensities using atomic scattering and sector functions [2]. The levelled in this way intensity and background are termed as reduced. This is demonstrated here on the CCl4 data. We take the previous input example and modify it accordingly.

First, in the base data field we add information on the sector function using keywords starting with `EDSec` prefix:

    EDSecModelType=sinpn
    EDSecPrmN=2.15
    EDSecPrmRmax=75.0
    EDSecPrmA=8.873635

This defines the model of the sector used in experiment. We also add two more keywords

    EDBgrSmoothReduced=true
    EDBgrRefScaleIterMax=30

The first one is required to turn on the levelling in the procedure of background smoothing. Note, this happens internally as an intermediate step so that the original input data are not modified. Importantly, the smoothness criteria are now applied to the reduced background line! The other keyword is not strictly necessary but recommended, since it allows to adjust the molecular intensity scale factor before it is refined in least-squares method. This helps to obtain a more accurate background in the very initial stage.

Next, to the definition of our ED data we add information on the nozzle-to-detector distance and electron wavelength with the keywords `NtoD` and `Lambda`, respectively.

    Set=ed1  Data=s;iTotExp  NtoD=250.0  Lambda=0.048707  ImolSf=1.0  ImolSfRefGrp=1

They are required for calculation of `r`-values from the introduced `s`-values.

| If your sector is not smooth enough, you may need to introduce also the numeric part of the sector function. In this case it is also highly recommended to define the sector-to-detector distance with the `StoD` keyword.

The background elimination procedure can now be started as before:

    EDIMOL: GETEXP ed1  BgrSplNInflMax=3  ItotModel=mbgr

For printing the reduced ED data in numeric form we utilize `iTotExpRed` and `iBgrRed` options:

    PRINT: EDDATA ed1  Data=iTotExp;iTotExpRed;iBgr;iBgrRed;iMolExp;iMolMod;iMolDif

Your final input file must be similar to that of `CCl4_3.inp` from this tutorial. Running it you can observe that the final R-factor (6.6 % after two cycles background-refine) is larger than in the examples above. This is due to the more smooth background line in the present case, whereas earlier we could not control the smoothness that well because of unlevelled data. In turn, less smooth background lines effectively lower the R-factor, masking possible systematic deviations of the refined model from experimental data. This can be observed by inspecting the refined here parameters

    Refined parameters:
    Errors are 1.00 times LSQ standard deviations.
    -----------------------------------------------------------------------------------------
     Group   Type             Old value        Refined value     Error   RelErr    d(X^2)/dP
    -----------------------------------------------------------------------------------------
         1  EDImolSf       8.5605901984e-01   8.5559677206e-01  7.9e-03  9.3e-03   -2.7e-14
         3  EDTrmAmpl+     4.8095185295e-02   4.7353886840e-02  9.6e-04  2.0e-02    1.1e-07
         4  EDTrmAmpl+     6.9403354976e-02   6.9505068659e-02  5.9e-04  8.4e-03    4.0e-08
         5  EDTrmRa+       1.7660407961e+00   1.7666118166e+00  8.1e-04  4.6e-04   -2.9e-08
         6  EDTrmRa+       2.8831003693e+00   2.8833209824e+00  4.9e-04  1.7e-04   -3.2e-07
    -----------------------------------------------------------------------------------------

and comparing them with those from the previous example. The deviations can be easily seen considering the ra(C—​Cl) parameter.

Finally, the reduced intensity and background can be plotted and inspected.

Figure 6. Reduced form of experimental total ED intensity and background line of CCl4.

In this form even visually can be assessed the good smoothness of the background line relative to the oscillations of the total intensity. Compare it with the image of the unlevelled intensity provided above.

## References

[1] L. Bizzocchi, L. Cludi, C. Degli Esposti, & A. Giorgi, Millimeter-Wave Spectroscopy of Sulfur Dichloride. J. Mol. Spectr., 204 (2000) 275–280. https://doi.org/10.1006/jmsp.2000.8223.

[2] Y. V. Vishnevskiy, S. Blomeyer, & C. G. Reuter, Gas standards in gas electron diffraction: accurate molecular structures of CO2 and CCl4. Struct. Chem., 31 (2020) 667–677. https://doi.org/10.1007/s11224-019-01443-5.

[3] T. Williams, C. Kelley, & many others, Version 6.0, http://www.gnuplot.info/. (2025).

This document has been generated on 2026-07-03 12:17:43 +0300