examples

peakref (version 1.3 2016100600) started on celesta at 10-Nov-2016 18:18:55

Peakref> \journal off
The residue definition has been changed (july 2009). Use resfactor 1 0 0 0 0 1 to redefine to old residue.

Peakref> abort on
Peakref> show

Example 1

Simple run on ammonium bitartrate

KappaCCD phi/chi scan. You may inspect the contents of example1.rmat and example1.pk.

First load rmat and pk files
Peakref> example 1
RMAT 1 example1
               RMAT                                     DMAT
   0.0118442  -0.1077432   0.0472600        0.6958110   1.4883927  -7.4870992
   0.0253138   0.0675984   0.0743739       -6.6553798   4.1747489   0.2107125
  -0.1274301   0.0034251   0.0191772        5.8122458   9.1445618   2.3567824
Determinant:  0.1496973E-02                             668.0148
cell from rmat: 7.66525 7.85920 11.08872 90.0065 89.9936 89.9951 V= 668.01
pg constrained: 7.66525 7.85920 11.08872 90.0000 90.0000 90.0000 V= 668.01
Sigma 0.0003 0.0003 0.0003 0.003 0.002 0.002 Volume 0.04
Bravais=P pg=mmm
rmatcrit set to 0.11089 0.1 comparecrit set to 0.11089 1.0
orientation-axis -0.40028 0.75298 0.52229 orientation-angle 94.74374
initial orx and ory shift of matrix 1 set to 0.00104
ReadPkData: 710 lines from /global/evalccd/ccd/peakref/example1.pk 500 reflections.
5 experiments.


The cell parameters are extracted from the rmatrix. A new rmatrix (in a fixed standard orientation) is build from the cell parameters. Then a rotation axis with a corresponding angle is determined which will transform the standard rmatrix into the original rmatrix. (these are the initial values of the orientation parameters orx,ory and ora).

500 peak positions were read from the file. To calculate the initial residues the following actions have to be performed:

These actions will be automatically executed after go, list, residue, save, savermat and status.
Peakref> status
308 reflections with rotation angle. 192 reflections with rotation range.
resfactorvalue 0 all
resfactorvalue 1 mmang rotpartial
res = 1.0*mmAng + 1.0*rotpartial
Rmat 1 setting constraints to orthorhombic.
Reind: no reflections changed indices.
matrix 1: 500 reflections.
SetRot 1.0: 2 out of rot. 500 reflections (498 allowed)
nPg=8 (h,k,l) (-h,-k,l) (h,-k,-l) (-h,k,-l) (-h,-k,-l) (h,k,-l) (-h,k,l) (h,-k,l)
SetupRmatrices matrix 1 rotvec= -0.40028 0.75298 0.52229 AbsVec=1.0 rotang=94.74374 Stored rmat as 1
One matrix. 500 reflections. (forbidden rot:2 total:2)
Used: 498 mm 308 rot
          ref  current  initial  change accumulate   shift refl
===============================================================
a          No  7.66525  7.66525            7.66525 0.01533  498
b          No  7.85920  7.85920            7.85920 0.01572  498
c          No 11.08872 11.08872           11.08872 0.02218  498
alpha     Fix 90.00000 90.00000           90.00000 0.20000  498
beta      Fix 90.00000 90.00000           90.00000 0.20000  498
gamma     Fix 90.00000 90.00000           90.00000 0.20000  498
orx        No -0.40028 -0.40028           -0.40028 0.00104  498
ory        No  0.75298  0.75298            0.75298 0.00104  498
ora        No 94.74374 94.74374           94.74374 0.20000  498
xtalx      No  0.00000  0.00000            0.00000 0.10000  498
xtaly      No  0.00000  0.00000            0.00000 0.10000  498
xtalz      No  0.00000  0.00000            0.00000 0.10000  498
zerodist   No  0.00000  0.00000            0.00000 0.10000  498
zerohor   Yes  0.00000  0.00000 0.00000    0.75980 0.10000  498
zerover   Yes  0.00000  0.00000 0.00000    0.83320 0.10000  498
detrotx    No  0.00000  0.00000           -0.01280 0.20000  498
detroty    No  0.00000  0.00000           -0.15910 0.20000  498
detrotz    No  0.00000  0.00000            0.05170 0.20000  498
===============================================================
Vol             668.01   668.01    0.00     668.01          498
===============================================================
mm             0.04199  0.04199 0.00000    0.04199          498
mmAng       +  0.04556  0.04556 0.00000    0.04556          498
rotpartial  +  0.04806  0.04806 0.00000    0.04806          308
rotoutside     0.13998  0.13998 0.00000    0.13998           18
rotinside      0.00000  0.00000 0.00000    0.00000          172
rotall         0.03478  0.03478 0.00000    0.03478          498
res            0.09362  0.09362 0.00000    0.09362

====


Start the refinement of the detector positon:
Peakref> go3
go(1) starting CalcRes: res=0.09362
Refining 2 parameters: Simplex stopped: range/shift (0.06654) < simplexsize (0.1) (rtol=0.00705).
18 evaluations in 9 iterations. residue 0.09296 ====
go(2)
Refining 2 parameters: Simplex stopped: range/shift (0.0907) < simplexsize (0.1) (rtol=0.00141).
16 evaluations in 8 iterations. residue 0.09277 ====
go(3)
Refining 2 parameters: 14 evaluations in 7 iterations. residue 0.09268 ====
starting 0.09362 bestintermediate 0.09268 final 0.09268 diff -0.00093 relative -0.01006 status 1
final residue is best.
One matrix. 500 reflections. (forbidden rot:2 total:2)
Used: 498 mm 308 rot
          ref  current  initial   change accumulate   shift refl
================================================================
a          No  7.66525  7.66525             7.66525 0.01533  498
b          No  7.85920  7.85920             7.85920 0.01572  498
c          No 11.08872 11.08872            11.08872 0.02218  498
alpha     Fix 90.00000 90.00000            90.00000 0.20000  498
beta      Fix 90.00000 90.00000            90.00000 0.20000  498
gamma     Fix 90.00000 90.00000            90.00000 0.20000  498
orx        No -0.40028 -0.40028            -0.40028 0.00104  498
ory        No  0.75298  0.75298             0.75298 0.00104  498
ora        No 94.74374 94.74374            94.74374 0.20000  498
xtalx      No  0.00000  0.00000             0.00000 0.10000  498
xtaly      No  0.00000  0.00000             0.00000 0.10000  498
xtalz      No  0.00000  0.00000             0.00000 0.10000  498
zerodist   No  0.00000  0.00000             0.00000 0.10000  498
zerohor   Yes  0.00533  0.00000  0.00533    0.76513 0.10000  498
zerover   Yes -0.00386  0.00000 -0.00386    0.82934 0.10000  498
detrotx    No  0.00000  0.00000            -0.01280 0.20000  498
detroty    No  0.00000  0.00000            -0.15910 0.20000  498
detrotz    No  0.00000  0.00000             0.05170 0.20000  498
================================================================
Vol             668.01   668.01     0.00     668.01          498
================================================================
mm             0.04138  0.04199 -0.00062    0.04138          498
mmAng       +  0.04462  0.04556 -0.00093    0.04462          498
rotpartial  +  0.04806  0.04806  0.00000    0.04806          308
rotoutside     0.13998  0.13998  0.00000    0.13998           18
rotinside      0.00000  0.00000  0.00000    0.00000          172
rotall         0.03478  0.03478  0.00000    0.03478          498
res            0.09268  0.09362 -0.00093    0.09268


Release the cell parameters and orientation:
Peakref> free rmat
alpha remains fixed. beta remains fixed. gamma remains fixed.


The angles are constrained to 90°

Another refinement cycle:
Peakref> go3
go(1) starting CalcRes: res=0.09268
Refining 8 parameters: Simplex stopped: range/shift (0.05005) < simplexsize (0.1) (rtol=0.00286).
108 evaluations in 56 iterations. residue 0.09076 ====
go(2)
Refining 8 parameters: 79 evaluations in 45 iterations. residue 0.09053 ====
go(3)
Refining 8 parameters: 70 evaluations in 36 iterations. residue 0.09049 ====
starting 0.09268 bestintermediate 0.09049 final 0.09049 diff -0.0022 relative -0.02427 status 1
final residue is best.
One matrix. 500 reflections. (forbidden rot:2 total:2)
Used: 498 mm 308 rot
          ref  current  initial   change accumulate   shift refl
================================================================
a         Yes  7.66384  7.66525 -0.00142    7.66384 0.01533  498
b         Yes  7.85530  7.85920 -0.00390    7.85530 0.01572  498
c         Yes 11.08525 11.08872 -0.00347   11.08525 0.02218  498
alpha     Fix 90.00000 90.00000            90.00000 0.20000  498
beta      Fix 90.00000 90.00000            90.00000 0.20000  498
gamma     Fix 90.00000 90.00000            90.00000 0.20000  498
orx       Yes -0.40025 -0.40028  0.00003   -0.40025 0.00104  498
ory       Yes  0.75298  0.75298 -0.00001    0.75298 0.00104  498
ora       Yes 94.73434 94.74374 -0.00939   94.73434 0.20000  498
xtalx      No  0.00000  0.00000             0.00000 0.10000  498
xtaly      No  0.00000  0.00000             0.00000 0.10000  498
xtalz      No  0.00000  0.00000             0.00000 0.10000  498
zerodist   No  0.00000  0.00000             0.00000 0.10000  498
zerohor   Yes  0.00742  0.00000  0.00742    0.76722 0.10000  498
zerover   Yes -0.00360  0.00000 -0.00360    0.82960 0.10000  498
detrotx    No  0.00000  0.00000            -0.01280 0.20000  498
detroty    No  0.00000  0.00000            -0.15910 0.20000  498
detrotz    No  0.00000  0.00000             0.05170 0.20000  498
================================================================
Vol             667.35   668.01    -0.66     667.35          498
================================================================
mm             0.04141  0.04199 -0.00058    0.04141          498
mmAng       +  0.04450  0.04556 -0.00105    0.04450          498
rotpartial  +  0.04598  0.04806 -0.00208    0.04598          308
rotoutside     0.16136  0.13998  0.02139    0.16136           16
rotinside      0.00000  0.00000  0.00000    0.00000          174
rotall         0.03362  0.03478 -0.00116    0.03362          498
res            0.09049  0.09362 -0.00313    0.09049


And again, almost no changes. The initial data are almost perfect. (as a matter of fact, these results are to be expected on good quality crystals, good quality hardware and good quality software (the phichi method)).

Save the results (actually, in this case, saving the detector parameters is not necessary):
Peakref> save detalign.vic
Created peakref.log
Adding refined zerohor to initial value(0.7598). Adding refined zerover to initial value(0.8332).
Adding refined detrotx to initial value(-0.0128). Adding refined detroty to initial value(-0.1591).
Adding refined detrotz to initial value(0.0517).
Created detalign.vic detzero 0.0 0.76722 0.8296 detrot -0.0128 -0.1591 0.0517

You may want to save the cell parameters. The angles are now fixed to 90° and probably this is the cell you are going to use:
Peakref> savermat 1r.rmat
             initial                                    new
   0.0118442  -0.1077432   0.0472600        0.0118595  -0.1077995   0.0472784
   0.0253138   0.0675984   0.0743739        0.0253508   0.0676277   0.0743913
  -0.1274301   0.0034251   0.0191772       -0.1274460   0.0034208   0.0191969
Determinant:  0.1496973E-02                            0.1498461E-02
SameRmat=false
Created 1r.rmat


Example 2

Two fragments with independent orientation

KappaCCD phi/chi scan. Two rough matrices were found using Dirax.

You may inspect the contents of example2a.rmat and example2b.rmat and example2.pk.

The initial orientation matrices are not that well defined. Be tolerant in comparing axes (1 Å) and angles (1 degree):
Peakref> rmatcrit 1 1
Peakref> example 2
removed rmat 1
RMAT 1 example2a
               RMAT                                     DMAT
  -0.1206187  -0.0361241   0.0165107       -6.8659439   1.8184443  -2.2652709
   0.0227663   0.0234710   0.0529414       -2.8333085   1.8326609   6.6595616
  -0.0575823   0.1283320  -0.0075446        4.2086668  17.2943363  -1.9783144
Determinant:  0.1015324E-02                             984.9076
cell from rmat: 7.45516 7.46566 17.90868 87.1724 86.9801 82.0476 V= 984.91
pg constrained: 7.45516 7.46566 17.90868 87.1724 86.9801 82.0476 V= 984.91
Sigma 0.0023 0.0025 0.0086 0.023 0.033 0.023 Volume 0.48
Bravais=P pg=-1
orientation-axis -0.0036 0.76859 0.63973 orientation-angle 157.0713
initial orx and ory shift of matrix 1 set to 0.00128
RMAT 2 example2b
               RMAT                                     DMAT
  -0.1170824  -0.0393798   0.0193636       -6.7014790   2.3521936  -2.3192086
   0.0323157   0.0138668   0.0526894       -3.0530415   1.4427842   6.7245798
  -0.0600903   0.1278541  -0.0025134        4.9136810  17.1567802  -0.3473478
Determinant:  0.1010435E-02                             989.6729
cell from rmat: 7.47137 7.52480 17.84993 86.8349 86.4608 81.5536 V= 989.67
pg constrained: 7.47137 7.52480 17.84993 86.8349 86.4608 81.5536 V= 989.67
Sigma 0.0137 0.0104 0.0193 0.147 0.256 0.173 Volume 2.43
Bravais=P pg=-1
cell 1   7.4552   7.4657  17.9087   87.172   86.980   82.048
cell 2   7.4714   7.5248  17.8499   86.835   86.461   81.554
diff     0.0162   0.0591   0.0587    0.338    0.519    0.494
parent=1
orientation-axis 0.01005 0.74182 0.67053 orientation-angle 153.80048
initial orx and ory shift of matrix 1 set to 0.00128
initial orx and ory shift of matrix 2 set to 0.00134
ReadPkData: 448 lines from /global/evalccd/ccd/peakref/example2.pk 280 reflections.
4 experiments.

The output is similar to example1. But now there are two matrices.

The cell parameters of the second matrix are compared to the first one. These cell parameters are equal (within the limits set by rmatcrit) and will be constrained to the first matrix. The orientation of the second matrix will be independent.
Peakref> status
164 reflections with rotation angle. 116 reflections with rotation range.
resfactorvalue 0 all
resfactorvalue 1 mmang rotpartial
res = 1.0*mmAng + 1.0*rotpartial
Reind: no reflections changed indices. no reflections changed rmat.
matrix 1: 168 reflections. matrix 2: 112 reflections.
SetupRmatrices matrix 1 rotvec= -0.0036 0.76859 0.63974 AbsVec=1.0 rotang=157.0713 Stored rmat as 1
SetupRmatrices matrix 2 rotvec= 0.01005 0.74182 0.67053 AbsVec=1.0 rotang=153.80048 Stored rmat as 2
2 matrices.
rmat 1 168 reflections.
rmat 2 112 reflections.
Used: 280 mm 164 rot
          ref   current   initial  change accumulate   shift refl
=================================================================
a          No   7.45516   7.45516            7.45516 0.01491  280
b          No   7.46566   7.46566            7.46566 0.01493  280
c          No  17.90868  17.90868           17.90868 0.03582  280
alpha      No  87.17242  87.17242           87.17242 0.20000  280
beta       No  86.98012  86.98012           86.98012 0.20000  280
gamma      No  82.04764  82.04764           82.04764 0.20000  280
orx        No  -0.00360  -0.00360           -0.00360 0.00128  168
ory        No   0.76859   0.76859            0.76859 0.00128  168
ora        No 157.07130 157.07130          157.07130 0.20000  168
orx2       No   0.01005   0.01005            0.01005 0.00134  112
ory2       No   0.74182   0.74182            0.74182 0.00134  112
ora2       No 153.80048 153.80048          153.80048 0.20000  112
xtalx      No   0.00000   0.00000            0.00000 0.10000  280
xtaly      No   0.00000   0.00000            0.00000 0.10000  280
xtalz      No   0.00000   0.00000            0.00000 0.10000  280
zerodist   No   0.00000   0.00000            0.00000 0.10000  280
zerohor   Yes   0.00000   0.00000 0.00000   -1.45530 0.10000  280
zerover   Yes   0.00000   0.00000 0.00000   -0.42040 0.10000  280
detrotx    No   0.00000   0.00000            0.62960 0.20000  280
detroty    No   0.00000   0.00000            0.18030 0.20000  280
detrotz    No   0.00000   0.00000           -0.37160 0.20000  280
=================================================================
Vol              984.91    984.91    0.00     984.91          168
Vol2             984.91    984.91    0.00     984.91          112
=================================================================
mm              0.19264   0.04199 0.15065    0.19264          280
mmAng       +   0.24851   0.04556 0.20295    0.24851          280
rotpartial  +   0.62295   0.04806 0.57489    0.62295          164
rotoutside      7.13813   0.13998 6.99816    7.13813           37
rotinside       0.00000   0.00000 0.00000    0.00000           79
rotall          1.30812   0.03478 1.27334    1.30812          280
res             0.87146   0.09362 0.77784    0.87146

====

Start the refinement of the detector positon:
Peakref> go3
go(1) starting CalcRes: res=0.87146
Refining 2 parameters: 16 evaluations in 8 iterations. residue 0.83319 ====
go(2)
Refining 2 parameters: 6 evaluations in 3 iterations. residue 0.83315 ====
go(3)
Refining 2 parameters: no evaluations in no iterations. residue 0.83315
starting 0.87146 bestintermediate 0.83315 final 0.83315 diff -0.03831 relative -0.04598 status 1
final residue is best.
2 matrices.
rmat 1 168 reflections.
rmat 2 112 reflections.
Used: 280 mm 164 rot
          ref   current   initial  change accumulate   shift refl
=================================================================
a          No   7.45516   7.45516            7.45516 0.01491  280
b          No   7.46566   7.46566            7.46566 0.01493  280
c          No  17.90868  17.90868           17.90868 0.03582  280
alpha      No  87.17242  87.17242           87.17242 0.20000  280
beta       No  86.98012  86.98012           86.98012 0.20000  280
gamma      No  82.04764  82.04764           82.04764 0.20000  280
orx        No  -0.00360  -0.00360           -0.00360 0.00128  168
ory        No   0.76859   0.76859            0.76859 0.00128  168
ora        No 157.07130 157.07130          157.07130 0.20000  168
orx2       No   0.01005   0.01005            0.01005 0.00134  112
ory2       No   0.74182   0.74182            0.74182 0.00134  112
ora2       No 153.80048 153.80048          153.80048 0.20000  112
xtalx      No   0.00000   0.00000            0.00000 0.10000  280
xtaly      No   0.00000   0.00000            0.00000 0.10000  280
xtalz      No   0.00000   0.00000            0.00000 0.10000  280
zerodist   No   0.00000   0.00000            0.00000 0.10000  280
zerohor   Yes   0.05379   0.00000 0.05379   -1.40151 0.10000  280
zerover   Yes   0.07162   0.00000 0.07162   -0.34878 0.10000  280
detrotx    No   0.00000   0.00000            0.62960 0.20000  280
detroty    No   0.00000   0.00000            0.18030 0.20000  280
detrotz    No   0.00000   0.00000           -0.37160 0.20000  280
=================================================================
Vol              984.91    984.91    0.00     984.91          168
Vol2             984.91    984.91    0.00     984.91          112
=================================================================
mm              0.16357   0.04199 0.12158    0.16357          280
mmAng       +   0.21020   0.04556 0.16464    0.21020          280
rotpartial  +   0.62295   0.04806 0.57489    0.62295          164
rotoutside      7.13813   0.13998 6.99816    7.13813           37
rotinside       0.00000   0.00000 0.00000    0.00000           79
rotall          1.30812   0.03478 1.27334    1.30812          280
res             0.83315   0.09362 0.73953    0.83315


Detector has moved. The residue is lowered.

Release the cell parameters and orientation:
Peakref> free rmat
Peakref> go3
go(1) starting CalcRes: res=0.83315
Refining 11 parameters: 147 evaluations in 99 iterations. residue 0.78959 ====
go(2)
Refining 11 parameters: 44 evaluations in 28 iterations. residue 0.78916 ====
go(3)
Refining 11 parameters: no evaluations in no iterations. residue 0.78916
starting 0.83315 bestintermediate 0.78916 final 0.78916 diff -0.04399 relative -0.05574 status 1
final residue is best.
2 matrices.
rmat 1 168 reflections.
rmat 2 112 reflections.
Used: 280 mm 164 rot
          ref   current   initial   change accumulate   shift refl
==================================================================
a         Yes   7.44294   7.45516 -0.01222    7.44294 0.01491  280
b         Yes   7.46841   7.46566  0.00276    7.46841 0.01493  280
c         Yes  17.88783  17.90868 -0.02085   17.88783 0.03582  280
alpha     Yes  87.18228  87.17242  0.00986   87.18228 0.20000  280
beta      Yes  87.30386  86.98012  0.32374   87.30386 0.20000  280
gamma     Yes  82.16424  82.04764  0.11660   82.16424 0.20000  280
orx       Yes  -0.00383  -0.00360 -0.00023   -0.00383 0.00128  168
ory       Yes   0.76798   0.76859 -0.00060    0.76798 0.00128  168
ora       Yes 157.12982 157.07130  0.05851  157.12982 0.20000  168
orx2       No   0.01005   0.01005             0.01005 0.00134  112
ory2       No   0.74182   0.74182             0.74182 0.00134  112
ora2       No 153.80048 153.80048           153.80048 0.20000  112
xtalx      No   0.00000   0.00000             0.00000 0.10000  280
xtaly      No   0.00000   0.00000             0.00000 0.10000  280
xtalz      No   0.00000   0.00000             0.00000 0.10000  280
zerodist   No   0.00000   0.00000             0.00000 0.10000  280
zerohor   Yes   0.05880   0.00000  0.05880   -1.39650 0.10000  280
zerover   Yes   0.07502   0.00000  0.07502   -0.34538 0.10000  280
detrotx    No   0.00000   0.00000             0.62960 0.20000  280
detroty    No   0.00000   0.00000             0.18030 0.20000  280
detrotz    No   0.00000   0.00000            -0.37160 0.20000  280
==================================================================
Vol              983.04    984.91    -1.87     983.04          168
Vol2             983.04    984.91    -1.87     983.04          112
==================================================================
mm              0.16797   0.04199  0.12598    0.16797          280
mmAng       +   0.21517   0.04556  0.16961    0.21517          280
rotpartial  +   0.57400   0.04806  0.52593    0.57400          164
rotoutside      7.27819   0.13998  7.13821    7.27819           36
rotinside       0.00000   0.00000  0.00000    0.00000           80
rotall          1.27196   0.03478  1.23718    1.27196          280
res             0.78916   0.09362  0.69555    0.78916


No big changes. Let's release the second matrix:
Peakref> free orient2
Peakref> go3
go(1) starting CalcRes: res=0.78916
Refining 14 parameters: 326 evaluations in 230 iterations. residue 0.71112 ====
go(2)
Refining 14 parameters: 92 evaluations in 63 iterations. residue 0.70918 ====
go(3)
Refining 14 parameters: 6 evaluations in 4 iterations. residue 0.70898 ====
starting 0.78916 bestintermediate 0.70898 final 0.70898 diff -0.08018 relative -0.11309 status 1
final residue is best.
2 matrices.
rmat 1 168 reflections.
rmat 2 112 reflections.
Used: 280 mm 164 rot
          ref   current   initial   change accumulate   shift refl
==================================================================
a         Yes   7.45188   7.45516 -0.00328    7.45188 0.01491  280
b         Yes   7.46961   7.46566  0.00395    7.46961 0.01493  280
c         Yes  17.89259  17.90868 -0.01609   17.89259 0.03582  280
alpha     Yes  87.12978  87.17242 -0.04264   87.12978 0.20000  280
beta      Yes  87.16370  86.98012  0.18359   87.16370 0.20000  280
gamma     Yes  82.06363  82.04764  0.01600   82.06363 0.20000  280
orx       Yes  -0.00343  -0.00360  0.00017   -0.00343 0.00128  168
ory       Yes   0.76812   0.76859 -0.00047    0.76812 0.00128  168
ora       Yes 157.11543 157.07130  0.04412  157.11543 0.20000  168
orx2      Yes   0.01391   0.01005  0.00386    0.01391 0.00134  112
ory2      Yes   0.74227   0.74182  0.00045    0.74227 0.00134  112
ora2      Yes 153.79279 153.80048 -0.00769  153.79279 0.20000  112
xtalx      No   0.00000   0.00000             0.00000 0.10000  280
xtaly      No   0.00000   0.00000             0.00000 0.10000  280
xtalz      No   0.00000   0.00000             0.00000 0.10000  280
zerodist   No   0.00000   0.00000             0.00000 0.10000  280
zerohor   Yes   0.06215   0.00000  0.06215   -1.39315 0.10000  280
zerover   Yes   0.07820   0.00000  0.07820   -0.34220 0.10000  280
detrotx    No   0.00000   0.00000             0.62960 0.20000  280
detroty    No   0.00000   0.00000             0.18030 0.20000  280
detrotz    No   0.00000   0.00000            -0.37160 0.20000  280
==================================================================
Vol              984.26    984.91    -0.65     984.26          168
Vol2             984.26    984.91    -0.65     984.26          112
==================================================================
mm              0.15685   0.04199  0.11485    0.15685          280
mmAng       +   0.20145   0.04556  0.15589    0.20145          280
rotpartial  +   0.50754   0.04806  0.45947    0.50754          164
rotoutside      6.84007   0.13998  6.70009    6.84007           38
rotinside       0.00000   0.00000  0.00000    0.00000           78
rotall          1.22557   0.03478  1.19078    1.22557          280
res             0.70898   0.09362  0.61537    0.70898


This helps, but the final residue is still large. Note the values of zerohor and zerover. They should be approximately zero. A value of 0.1 for zerover implies a vertical shift of 1 pixel. So let's save the detector position
Peakref> save detalign.vic
Adding refined zerohor to initial value(-1.4553). Adding refined zerover to initial value(-0.4204).
Adding refined detrotx to initial value(0.6296). Adding refined detroty to initial value(0.1803).
Adding refined detrotz to initial value(-0.3716).
WARNING: renaming existing file detalign.vic into detalign.vic.~1~
Created detalign.vic detzero 0.0 -1.39315 -0.3422 detrot 0.6296 0.1803 -0.3716

Examine the relation between the two fragments:

The tolerances have been set earlier to 1 Å and 1 degree.

Select the lowest Fom.
Peakref> comparefomtype
0=smallestangle 1=bestfom 2=unitmatrix[0] 1
and then compare the cells
Peakref> comparecrit 1 1
Peakref> compare
2 matrices
           a       b       c      alpha    beta   gamma    volume
dmat1 :   7.452   7.470  17.893   87.13   87.16   82.06      984.3
dmat2 :   7.452   7.470  17.893   87.13   87.16   82.06      984.3
Volume ratio = 1.0 Trying 96 solutions
Nr Rotangle       Rotvec(xyz)           RotVec(hkl)    ( angle)     RotVec(uvw)    ( angle)     Fom
 1  179.283  0.3973 -0.0480  0.9164 -10.96 11.00 -2.02 (  0.09)  -1.00  1.00 -0.03 (  2.91)   0.670
 2    5.849  0.8034 -0.3248 -0.4990  -4.02 -5.00 -1.01 (  0.16)  -3.01 -4.00 -0.01 (  0.25)   0.000 U
Selected Solution 2
           a       b       c      alpha    beta   gamma    volume
dmat1 :   7.452   7.470  17.893   87.13   87.16   82.06      984.3 <
dmat2 :   7.452   7.470  17.893   87.13   87.16   82.06      984.3 <
H'= +0.994*H -0.001*K +0.032*L
K'= +0.005*H +1.000*K -0.024*L
L'= -0.204*H +0.165*K +0.996*L
Nr Rotangle       Rotvec(xyz)           RotVec(hkl)    ( angle)     RotVec(uvw)    ( angle)     Fom
 2    5.849  0.8034 -0.3248 -0.4990  -4.02 -5.00 -1.01 (  0.16)  -3.01 -4.00 -0.01 (  0.25)   0.000 U<

Two solutions. Matrix 2 can be found by a rotation around (0.82 -0.36 -0.45) over almost 6°.
The interpretation of the rotation axis in reciprocal space (RotVec(hkl)) and direct space (RotVec(uvw)) does not resemble a nice axis. The two fragments have indeed a independent orientation.

Save both matrices:
Peakref> savermat1 2ar
             initial                                    new
  -0.1206187  -0.0361241   0.0165107       -0.1205947  -0.0360826   0.0164944
   0.0227663   0.0234710   0.0529414        0.0232413   0.0230969   0.0530018
  -0.0575823   0.1283320  -0.0075446       -0.0575231   0.1283379  -0.0074825
Determinant:  0.1015324E-02                            0.1015993E-02
SameRmat=false
Created 2ar.rmat

Peakref> savermat2 2br
             initial                                    new
  -0.1170824  -0.0393798   0.0193636       -0.1171980  -0.0393879   0.0193507
   0.0323157   0.0138668   0.0526894        0.0340909   0.0144742   0.0525001
  -0.0600903   0.1278541  -0.0025134       -0.0591151   0.1286279  -0.0025577
Determinant:  0.1010435E-02                            0.1015993E-02
SameRmat=false
Created 2br.rmat


A final note about the cell parameters. The rmat files in this example describe a primitive lattice. The unit cells could be transformed into c-centered monoclinic lattices (use rmatrix example2a.rmat), and the refinement could be repeated with the angles of alpha and gamma fixed to 90°

Example 3

Two fragments with dependent orientation

You may inspect the contents of example3a.rmat and example3b.rmat and example3.pk.

The initial orientation matrices are not that well defined. Be tolerant in comparing axes (1 Å) and angles (1 degree):
Peakref> pgcrit 1 1
use pgauto to use these values to set pg for existing rmats.

Peakref> example 3
removed rmat 1 removed rmat 2
RMAT 1 example3a
               RMAT                                     DMAT
   0.0459509   0.0196275   0.0784559        3.0803876   4.9386539  10.4288425
   0.0393564  -0.0572818   0.0156385        4.7773743 -13.9043932   5.1462545
   0.0636778   0.0213288  -0.0305794        9.7466917   0.5859708  -7.3955278
Determinant:  0.4603617E-03                             2172.205
cell from rmat: 11.94319 15.57689 12.24889 89.8929 107.5899 90.0873 V= 2172.20
pg constrained: 11.94319 15.57689 12.24889 90.0000 107.5899 90.0000 V= 2172.21
Sigma 0.0024 0.0049 0.0059 0.023 0.021 0.021 Volume 1.24
Bravais=P pg=2/m
orientation-axis 0.79255 0.22781 0.56566 orientation-angle 174.60219
initial orx and ory shift of matrix 1 set to 0.00113
RMAT 2 example3b
               RMAT                                     DMAT
  -0.0024319  -0.0198125  -0.0785923        3.0858576   4.9300828  10.4241095
   0.0298162   0.0572270  -0.0157280       -4.7985392  13.9006023  -5.1621284
   0.0825498  -0.0212004   0.0307043      -11.6097050  -3.6567850   0.9787763
Determinant:  0.4613548E-03                             2167.529
cell from rmat: 11.93693 15.58526 12.21128 90.0525 107.4253 90.0268 V= 2167.53
pg constrained: 11.93693 15.58526 12.21128 90.0000 107.4253 90.0000 V= 2167.53
Sigma 0.0028 0.0057 0.0073 0.040 0.027 0.025 Volume 1.48
Bravais=P pg=2/m
cell 1  11.9432  15.5769  12.2489   89.893  107.590   90.087
cell 2  11.9369  15.5853  12.2113   90.053  107.425   90.027
diff     0.0063   0.0084   0.0376    0.160    0.165    0.060
parent=1
orientation-axis -0.07565 -0.92462 0.3733 orientation-angle 75.16096
initial orx and ory shift of matrix 1 set to 0.00113
initial orx and ory shift of matrix 2 set to 0.00075
ReadPkData: 728 lines from /global/evalccd/ccd/peakref/example3.pk 560 reflections.
4 experiments.

Peakref> status
209 reflections with rotation angle. 351 reflections with rotation range.
resfactorvalue 0 all
resfactorvalue 1 mmang rotpartial
res = 1.0*mmAng + 1.0*rotpartial
Reind: no reflections changed indices. no reflections changed rmat.
matrix 1: 347 reflections. matrix 2: 213 reflections.
SetupRmatrices matrix 1 rotvec= 0.79255 0.22781 0.56566 AbsVec=1.0 rotang=174.60219 Stored rmat as 1
SetupRmatrices matrix 2 rotvec= -0.07565 -0.92462 0.3733 AbsVec=1.0 rotang=75.16096 Stored rmat as 2
2 matrices.
rmat 1 347 reflections.
rmat 2 213 reflections.
Used: 560 mm 209 rot
          ref   current   initial  change accumulate   shift refl
=================================================================
a          No  11.94319  11.94319           11.94319 0.02389  560
b          No  15.57689  15.57689           15.57689 0.03115  560
c          No  12.24889  12.24889           12.24889 0.02450  560
alpha      No  89.89287  89.89287           89.89287 0.20000  560
beta       No 107.58987 107.58987          107.58987 0.20000  560
gamma      No  90.08726  90.08726           90.08726 0.20000  560
orx        No   0.79255   0.79255            0.79255 0.00113  347
ory        No   0.22781   0.22781            0.22781 0.00113  347
ora        No 174.60219 174.60219          174.60219 0.20000  347
orx2       No  -0.07565  -0.07565           -0.07565 0.00075  213
ory2       No  -0.92462  -0.92462           -0.92462 0.00075  213
ora2       No  75.16096  75.16096           75.16096 0.20000  213
xtalx      No   0.00000   0.00000            0.00000 0.10000  560
xtaly      No   0.00000   0.00000            0.00000 0.10000  560
xtalz      No   0.00000   0.00000            0.00000 0.10000  560
zerodist   No   0.00000   0.00000            0.00000 0.10000  560
zerohor   Yes   0.00000   0.00000 0.00000   -1.45530 0.10000  560
zerover   Yes   0.00000   0.00000 0.00000   -0.42040 0.10000  560
detrotx    No   0.00000   0.00000            0.62960 0.20000  560
detroty    No   0.00000   0.00000            0.18030 0.20000  560
detrotz    No   0.00000   0.00000           -0.37160 0.20000  560
=================================================================
Vol             2172.21   2172.21    0.00    2172.21          347
Vol2            2172.20   2172.20    0.00    2172.20          213
=================================================================
mm              0.14318   0.04199 0.10118    0.14318          560
mmAng       +   0.12246   0.04556 0.07690    0.12246          560
rotpartial  +   0.28712   0.04806 0.23905    0.28712          209
rotoutside      1.79988   0.13998 1.65990    1.79988           85
rotinside       0.00000   0.00000 0.00000    0.00000          266
rotall          0.38035   0.03478 0.34557    0.38035          560
res             0.40957   0.09362 0.31596    0.40957

====

Similar to example 2. Start the refinement of the detector positon:
Peakref> go3
go(1) starting CalcRes: res=0.40957
Refining 2 parameters: 12 evaluations in 7 iterations. residue 0.39253 ====
go(2)
Refining 2 parameters: 6 evaluations in 3 iterations. residue 0.39241 ====
go(3)
Refining 2 parameters: no evaluations in no iterations. residue 0.39241
starting 0.40957 bestintermediate 0.39241 final 0.39241 diff -0.01716 relative -0.04374 status 1
final residue is best.
2 matrices.
rmat 1 347 reflections.
rmat 2 213 reflections.
Used: 560 mm 209 rot
          ref   current   initial   change accumulate   shift refl
==================================================================
a          No  11.94319  11.94319            11.94319 0.02389  560
b          No  15.57689  15.57689            15.57689 0.03115  560
c          No  12.24889  12.24889            12.24889 0.02450  560
alpha      No  89.89287  89.89287            89.89287 0.20000  560
beta       No 107.58987 107.58987           107.58987 0.20000  560
gamma      No  90.08726  90.08726            90.08726 0.20000  560
orx        No   0.79255   0.79255             0.79255 0.00113  347
ory        No   0.22781   0.22781             0.22781 0.00113  347
ora        No 174.60219 174.60219           174.60219 0.20000  347
orx2       No  -0.07565  -0.07565            -0.07565 0.00075  213
ory2       No  -0.92462  -0.92462            -0.92462 0.00075  213
ora2       No  75.16096  75.16096            75.16096 0.20000  213
xtalx      No   0.00000   0.00000             0.00000 0.10000  560
xtaly      No   0.00000   0.00000             0.00000 0.10000  560
xtalz      No   0.00000   0.00000             0.00000 0.10000  560
zerodist   No   0.00000   0.00000             0.00000 0.10000  560
zerohor   Yes  -0.00907   0.00000 -0.00907   -1.46437 0.10000  560
zerover   Yes   0.06717   0.00000  0.06717   -0.35323 0.10000  560
detrotx    No   0.00000   0.00000             0.62960 0.20000  560
detroty    No   0.00000   0.00000             0.18030 0.20000  560
detrotz    No   0.00000   0.00000            -0.37160 0.20000  560
==================================================================
Vol             2172.21   2172.21     0.00    2172.21          347
Vol2            2172.20   2172.20     0.00    2172.20          213
==================================================================
mm              0.12338   0.04199  0.08139    0.12338          560
mmAng       +   0.10529   0.04556  0.05974    0.10529          560
rotpartial  +   0.28712   0.04806  0.23905    0.28712          209
rotoutside      1.79988   0.13998  1.65990    1.79988           85
rotinside       0.00000   0.00000  0.00000    0.00000          266
rotall          0.38035   0.03478  0.34557    0.38035          560
res             0.39241   0.09362  0.29879    0.39241


Detector has moved. The residue is lowered.

Release the cell parameters and orientation:
Peakref> free rmat orient2
Peakref> go3
go(1) starting CalcRes: res=0.39241
Refining 14 parameters: 202 evaluations in 133 iterations. residue 0.37588 ====
go(2)
Refining 14 parameters: 55 evaluations in 31 iterations. residue 0.37563 ====
go(3)
Refining 14 parameters: 22 evaluations in 12 iterations. residue 0.37553 ====
starting 0.39241 bestintermediate 0.37553 final 0.37553 diff -0.01688 relative -0.04495 status 1
final residue is best.
2 matrices.
rmat 1 347 reflections.
rmat 2 213 reflections.
Used: 560 mm 209 rot
          ref   current   initial   change accumulate   shift refl
==================================================================
a         Yes  11.94549  11.94319  0.00229   11.94549 0.02389  560
b         Yes  15.57989  15.57689  0.00301   15.57989 0.03115  560
c         Yes  12.24212  12.24889 -0.00676   12.24212 0.02450  560
alpha     Yes  89.99294  89.89287  0.10007   89.99294 0.20000  560
beta      Yes 107.56322 107.58987 -0.02665  107.56322 0.20000  560
gamma     Yes  90.01319  90.08726 -0.07407   90.01319 0.20000  560
orx       Yes   0.79291   0.79255  0.00036    0.79291 0.00113  347
ory       Yes   0.22742   0.22781 -0.00039    0.22742 0.00113  347
ora       Yes 174.62660 174.60219  0.02441  174.62660 0.20000  347
orx2      Yes  -0.07598  -0.07565 -0.00034   -0.07598 0.00075  213
ory2      Yes  -0.92500  -0.92462 -0.00038   -0.92500 0.00075  213
ora2      Yes  75.27427  75.16096  0.11330   75.27427 0.20000  213
xtalx      No   0.00000   0.00000             0.00000 0.10000  560
xtaly      No   0.00000   0.00000             0.00000 0.10000  560
xtalz      No   0.00000   0.00000             0.00000 0.10000  560
zerodist   No   0.00000   0.00000             0.00000 0.10000  560
zerohor   Yes  -0.00886   0.00000 -0.00886   -1.46416 0.10000  560
zerover   Yes   0.07540   0.00000  0.07540   -0.34500 0.10000  560
detrotx    No   0.00000   0.00000             0.62960 0.20000  560
detroty    No   0.00000   0.00000             0.18030 0.20000  560
detrotz    No   0.00000   0.00000            -0.37160 0.20000  560
==================================================================
Vol             2172.17   2172.21    -0.04    2172.17          347
Vol2            2172.17   2172.20    -0.04    2172.17          213
==================================================================
mm              0.12158   0.04199  0.07959    0.12158          560
mmAng       +   0.10369   0.04556  0.05814    0.10369          560
rotpartial  +   0.27184   0.04806  0.22378    0.27184          209
rotoutside      1.91335   0.13998  1.77337    1.91335           80
rotinside       0.00000   0.00000  0.00000    0.00000          271
rotall          0.37479   0.03478  0.34000    0.37479          560
res             0.37553   0.09362  0.28191    0.37553


Almost no changes, and the final residue is still large. Note the almost 90° values for alpha and gamma. There are two ways to fix the angles: Peakref> pgcrit 0.1 0.1 pgauto
use pgauto to use these values to set pg for existing rmats. laue group set to 2/m
laue group set to 2/m
Rmat 1 setting constraints to monoclinic.
No internal constraints for dependent matrix 2
SetupRmatrices matrix 1 rotvec= 0.79291 0.22742 0.56531 AbsVec=1.0 rotang=174.6266 Stored rmat as 1
SetupRmatrices matrix 2 rotvec= -0.07598 -0.925 0.37229 AbsVec=1.0 rotang=75.27427 Stored rmat as 2

Refine with the new constraints
Peakref> go3
go(1) starting CalcRes: res=0.37615
Refining 12 parameters: 96 evaluations in 54 iterations. residue 0.37528 ====
go(2)
Refining 12 parameters: 44 evaluations in 24 iterations. residue 0.37513 ====
go(3)
Refining 12 parameters: 16 evaluations in 8 iterations. residue 0.3751 ====
starting 0.37615 bestintermediate 0.3751 final 0.3751 diff -0.00105 relative -0.00281 status 3
final residue is best.
2 matrices.
rmat 1 347 reflections.
rmat 2 213 reflections.
Used: 560 mm 209 rot
          ref   current   initial   change accumulate   shift refl
==================================================================
a         Yes  11.94520  11.94319  0.00200   11.94520 0.02389  560
b         Yes  15.57883  15.57689  0.00194   15.57883 0.03115  560
c         Yes  12.24159  12.24889 -0.00729   12.24159 0.02450  560
alpha     Fix  90.00000  89.89287            90.00000 0.20000  560
beta      Yes 107.55914 107.58987 -0.03073  107.55914 0.20000  560
gamma     Fix  90.00000  90.08726            90.00000 0.20000  560
orx       Yes   0.79295   0.79255  0.00040    0.79295 0.00113  347
ory       Yes   0.22733   0.22781 -0.00048    0.22733 0.00113  347
ora       Yes 174.63429 174.60219  0.03210  174.63429 0.20000  347
orx2      Yes  -0.07614  -0.07565 -0.00049   -0.07614 0.00075  213
ory2      Yes  -0.92496  -0.92462 -0.00034   -0.92496 0.00075  213
ora2      Yes  75.27990  75.16096  0.11893   75.27990 0.20000  213
xtalx      No   0.00000   0.00000             0.00000 0.10000  560
xtaly      No   0.00000   0.00000             0.00000 0.10000  560
xtalz      No   0.00000   0.00000             0.00000 0.10000  560
zerodist   No   0.00000   0.00000             0.00000 0.10000  560
zerohor   Yes  -0.00896   0.00000 -0.00896   -1.46426 0.10000  560
zerover   Yes   0.07526   0.00000  0.07526   -0.34514 0.10000  560
detrotx    No   0.00000   0.00000             0.62960 0.20000  560
detroty    No   0.00000   0.00000             0.18030 0.20000  560
detrotz    No   0.00000   0.00000            -0.37160 0.20000  560
==================================================================
Vol             2171.92   2172.21    -0.29    2171.92          347
Vol2            2171.92   2172.20    -0.29    2171.92          213
==================================================================
mm              0.12191   0.04199  0.07992    0.12191          560
mmAng       +   0.10396   0.04556  0.05840    0.10396          560
rotpartial  +   0.27114   0.04806  0.22308    0.27114          209
rotoutside      1.86661   0.13998  1.72663    1.86661           82
rotinside       0.00000   0.00000  0.00000    0.00000          269
rotall          0.37452   0.03478  0.33973    0.37452          560
res             0.37510   0.09362  0.28148    0.37510


Examine the relation between the two fragments: Select the lowest Fom.
Peakref> comparefomtype
0=smallestangle 1=bestfom 2=unitmatrix[1] 1
Peakref> comparecrit 1 1
Peakref> compare
2 matrices
           a       b       c      alpha    beta   gamma    volume
dmat1 :  11.945  15.579  12.242   90.00  107.56   90.00     2171.9
dmat2 :  11.945  15.579  12.242   90.00  107.56   90.00     2171.9
Volume ratio = 1.0 Trying 32 solutions
Nr Rotangle       Rotvec(xyz)           RotVec(hkl)    ( angle)     RotVec(uvw)    ( angle)     Fom
 1  179.987  0.9158  0.1828 -0.3577   0.00 -0.00  1.00 (  0.03)   4.02 -0.00 13.00 (  0.11)   0.000
 2   71.955 -0.3072  0.8926 -0.3301   0.00 -1.00 -0.00 (  0.03)   0.00 -1.00 -0.00 (  0.03)   4.460
 3  108.045  0.3072 -0.8923  0.3308   0.00  1.00  0.00 (  0.03)   0.00  1.00  0.00 (  0.03)   4.460
 4  179.958 -0.2588 -0.4126 -0.8734 -13.00  0.00  4.02 (  0.11)  -1.00  0.00  0.00 (  0.02)   0.000 U
Selected Solution 4
           a       b       c      alpha    beta   gamma    volume
dmat1 :  11.945  15.579  12.242   90.00  107.56   90.00     2171.9 <
dmat2 :  11.945  15.579  12.242   90.00  107.56   90.00     2171.9 <
H'= +1.000*H -0.000*K -0.001*L
K'= -0.001*H -1.000*K -0.001*L
L'= -0.619*H +0.001*K -1.000*L
Nr Rotangle       Rotvec(xyz)           RotVec(hkl)    ( angle)     RotVec(uvw)    ( angle)     Fom
 4  179.958 -0.2588 -0.4126 -0.8734 -13.00  0.00  4.02 (  0.11)  -1.00  0.00  0.00 (  0.02)   0.000 U<

Four solutions. Matrix 2 can be found by a rotation around (-0.259 -0.413 -0.873) over 179.958°
The interpretation of the rotation axis in direct space (RotVec(uvw)) does look promising: a 180° rotation around a, or in recprocal space (RotVec(hkl)): a 180° rotation around c*.

Set this constraint by:
Peakref> twin2
removed rmat 2

parent matrix [1] <Enter>
xyz/hkl/uvw [hkl] uvw
uvw indices 1 0 0
v1 1.0 0.0 0.0

Enter angle 180
SetupRmatrices matrix 1 rotvec= 0.79295 0.22733 0.5653 AbsVec=1.0 rotang=174.63429 Stored rmat as 1
SetupRmatrices twin 2 axis(uvw) 1.0 0.0 0.0 axis(lab) 0.25915 0.41259 0.87328 angle 180.0
Stored rmat as 2
RMAT 2 example3a
               RMAT                                     DMAT
  -0.0025646  -0.0196976  -0.0784659        3.0956275   4.9284592  10.4314451
   0.0297109   0.0572886  -0.0156198       -4.7806010  13.9039297  -5.1503892
   0.0825878  -0.0212212   0.0306652      -11.6454830  -3.6514418   0.9519727
Determinant:  0.4604222E-03                             2171.920
cell from rmat: 11.94519 15.57883 12.24159 90.0000 107.5591 90.0000 V= 2171.92
pg constrained: 11.94519 15.57883 12.24159 90.0000 107.5591 90.0000 V= 2171.92
Sigma 0.0024 0.0049 0.0059 0.023 0.021 0.021 Volume 1.24
Bravais=P pg=2/m

Matrix 2 is now calculated from matrix 1 and the twin relation.
Peakref> status
Reind:
 refl rmat    h    k    l  qvp      mm ==> rmat    h    k    l  qvp      mm
   22    2    0    5   -2       0.1525        1    0   -5    2       0.1525
   52    1   -5    4    3       0.1006        2   -5   -4    0       0.0364
   64    1   -5    5    3       0.1077        2   -5   -5    0       0.0341
   95    1   -5    7    3       0.1116        2   -5   -7    0       0.0465
  102    2    5    7   -4       0.1232        1    5   -7    1       0.0942
  105    1    6   -6    0       0.3902        2    6    6   -4       0.3093
  110    2    0    9   -4       0.1411        1    0   -9    4       0.1411
  113    2    2    9   -4       0.3036        1    2   -9    3       0.2688
  120    1    8   -2   -2       0.1238        2    8    2   -3       0.0494
  123    1    8   -3   -2       0.2927        2    8    3   -3       0.2645
  164    2    0    2    4       0.0410        1    0   -2   -4       0.0410
  190    2    0    3    5       0.0436        1    0   -3   -5       0.0436
  205    1    0    0    6       0.0337        2    0    0   -6       0.0337
  216    1    0   -3   -6       0.2180        2    0    3    6       0.2180
  221    2    0    4    6       0.0302        1    0   -4   -6       0.0302
  263    1    8    2   -2       0.1251        2    8   -2   -3       0.1191
  289    1    0    3   -1       0.0157        2    0   -3    1       0.0157
  298    1   -1   -5    1       0.5700        2   -1    5   -1       0.5586
  310    2    0    6   -1       0.0815        1    0   -6    1       0.0814
  340    2    0    8   -1       0.0908        1    0   -8    1       0.0908
  360    2    5    6    0       0.1377        1    5   -6   -3       0.0552
  371    1    0    8   -4       0.1040        2    0   -8    4       0.1040
  373    1    3    7   -5       0.2347        2    3   -7    3       0.2075
  429    2    0   -1   -3       0.1573        1    0    1    3       0.1573
  493    2    0   -3   -6       0.1668        1    0    3    6       0.1668
  497    1    0    4    6       0.1299        2    0   -4   -6       0.1299
  539    1    0    5    7       0.1305        2    0   -5   -7       0.1305
  544    2   -8    2    3       0.1246        1   -8   -2    2       0.1187
  547    2    0   -1    8       0.0920        1    0    1   -8       0.0920
29 reflections changed indices. 29 reflections changed rmat.
matrix 1: 346 reflections. matrix 2: 214 reflections.
SetMM 1.0: 3 out of position. SetRot 1.0: 26 out of rot. 560 reflections (533 allowed)
SetupRmatrices matrix 1 rotvec= 0.79295 0.22733 0.5653 AbsVec=1.0 rotang=174.63429 Stored rmat as 1
SetupRmatrices twin 2 axis(uvw) 1.0 0.0 0.0 axis(lab) 0.25915 0.41259 0.87328 angle 180.0
Stored rmat as 2
RMAT 2 example3a
               RMAT                                     DMAT
  -0.0025646  -0.0196976  -0.0784659        3.0956275   4.9284592  10.4314451
   0.0297109   0.0572886  -0.0156198       -4.7806010  13.9039297  -5.1503892
   0.0825878  -0.0212212   0.0306652      -11.6454830  -3.6514418   0.9519727
Determinant:  0.4604222E-03                             2171.920
cell from rmat: 11.94519 15.57883 12.24159 90.0000 107.5591 90.0000 V= 2171.92
pg constrained: 11.94519 15.57883 12.24159 90.0000 107.5591 90.0000 V= 2171.92
Sigma 0.0024 0.0049 0.0059 0.023 0.021 0.021 Volume 1.24
Bravais=P pg=2/m
2 matrices.
rmat 1 346 reflections. (forbidden mm:3 rot:14 total:15)
rmat 2 214 reflections. (forbidden rot:12 total:12)
Used: 533 mm 198 rot
          ref   current   initial   change accumulate   shift refl
==================================================================
a         Yes  11.94520  11.94319  0.00200   11.94520 0.02389  533
b         Yes  15.57883  15.57689  0.00194   15.57883 0.03115  533
c         Yes  12.24159  12.24889 -0.00729   12.24159 0.02450  533
alpha     Fix  90.00000  89.89287            90.00000 0.20000  533
beta      Yes 107.55914 107.58987 -0.03073  107.55914 0.20000  533
gamma     Fix  90.00000  90.08726            90.00000 0.20000  533
orx       Yes   0.79295   0.79255  0.00040    0.79295 0.00113  533
ory       Yes   0.22733   0.22781 -0.00048    0.22733 0.00113  533
ora       Yes 174.63429 174.60219  0.03210  174.63429 0.20000  533
xtalx      No   0.00000   0.00000             0.00000 0.10000  533
xtaly      No   0.00000   0.00000             0.00000 0.10000  533
xtalz      No   0.00000   0.00000             0.00000 0.10000  533
zerodist   No   0.00000   0.00000             0.00000 0.10000  533
zerohor   Yes  -0.00896   0.00000 -0.00896   -1.46426 0.10000  533
zerover   Yes   0.07526   0.00000  0.07526   -0.34514 0.10000  533
detrotx    No   0.00000   0.00000             0.62960 0.20000  533
detroty    No   0.00000   0.00000             0.18030 0.20000  533
detrotz    No   0.00000   0.00000            -0.37160 0.20000  533
==================================================================
Vol             2171.92   2172.21    -0.29    2171.92          331
Vol2            2171.92   2172.21    -0.29    2171.92          202
==================================================================
mm              0.10204   0.12944 -0.02739    0.10204          533
mmAng       +   0.08513   0.10898 -0.02385    0.08513          533
rotpartial  +   0.19523   0.21526 -0.02003    0.19523          198
rotoutside      0.34006   0.33639  0.00367    0.34006           66
rotinside       0.00000   0.00000  0.00000    0.00000          269
rotall          0.11463   0.12162 -0.00698    0.11463          533
res             0.28036   0.32424 -0.04388    0.28036

====

Due to the twin command, the reflections are reindexed. The rejections are different compared to before.
Peakref> go3
go(1) starting CalcRes: res=0.28036
Refining 9 parameters: 79 evaluations in 48 iterations. residue 0.27727 ====
go(2)
Refining 9 parameters: 37 evaluations in 19 iterations. residue 0.27706 ====
go(3)
Refining 9 parameters: 10 evaluations in 5 iterations. residue 0.27702 ====
starting 0.28036 bestintermediate 0.27702 final 0.27702 diff -0.00334 relative -0.01205 status 1
final residue is best.
2 matrices.
rmat 1 346 reflections. (forbidden mm:3 rot:14 total:15)
rmat 2 214 reflections. (forbidden rot:12 total:12)
Used: 533 mm 198 rot
          ref   current   initial   change accumulate   shift refl
==================================================================
a         Yes  11.94204  11.94319 -0.00115   11.94204 0.02389  533
b         Yes  15.57360  15.57689 -0.00329   15.57360 0.03115  533
c         Yes  12.23942  12.24889 -0.00947   12.23942 0.02450  533
alpha     Fix  90.00000  89.89287            90.00000 0.20000  533
beta      Yes 107.58274 107.58987 -0.00713  107.58274 0.20000  533
gamma     Fix  90.00000  90.08726            90.00000 0.20000  533
orx       Yes   0.79280   0.79255  0.00025    0.79280 0.00113  533
ory       Yes   0.22750   0.22781 -0.00031    0.22750 0.00113  533
ora       Yes 174.65965 174.60219  0.05746  174.65965 0.20000  533
xtalx      No   0.00000   0.00000             0.00000 0.10000  533
xtaly      No   0.00000   0.00000             0.00000 0.10000  533
xtalz      No   0.00000   0.00000             0.00000 0.10000  533
zerodist   No   0.00000   0.00000             0.00000 0.10000  533
zerohor   Yes  -0.01053   0.00000 -0.01053   -1.46583 0.10000  533
zerover   Yes   0.07709   0.00000  0.07709   -0.34331 0.10000  533
detrotx    No   0.00000   0.00000             0.62960 0.20000  533
detroty    No   0.00000   0.00000             0.18030 0.20000  533
detrotz    No   0.00000   0.00000            -0.37160 0.20000  533
==================================================================
Vol             2169.95   2172.21    -2.26    2169.95          331
Vol2            2169.95   2172.21    -2.26    2169.95          202
==================================================================
mm              0.10332   0.12944 -0.02612    0.10332          533
mmAng       +   0.08609   0.10898 -0.02289    0.08609          533
rotpartial  +   0.19094   0.21526 -0.02432    0.19094          198
rotoutside      0.35096   0.33639  0.01457    0.35096           63
rotinside       0.00000   0.00000  0.00000    0.00000          272
rotall          0.11241   0.12162 -0.00921    0.11241          533
res             0.27702   0.32424 -0.04722    0.27702


And now remove 'bad' reflections. Use reject 5 to reject reflections with a delmm>5*resmm and delrot>5*resrot.
Peakref> reject 5
using mm residue mm and rotation residue rotpartial

Peakref> go3
SetMM 0.51659: 14 out of position. SetRot 0.95468: 31 out of rot. 560 reflections (525 allowed)
SetupRmatrices matrix 1 rotvec= 0.7928 0.2275 0.56543 AbsVec=1.0 rotang=174.65965 Stored rmat as 1
SetupRmatrices twin 2 axis(uvw) 1.0 0.0 0.0 axis(lab) 0.25868 0.41257 0.87342 angle 180.0
Stored rmat as 2
RMAT 2 example3a
               RMAT                                     DMAT
  -0.0026389  -0.0197332  -0.0784884        3.0892019   4.9269004  10.4304724
   0.0296936   0.0573003  -0.0156779       -4.7860379  13.8974333  -5.1470590
   0.0826286  -0.0212217   0.0306516      -11.6413116  -3.6596839   0.9433658
Determinant:  0.4608403E-03                             2169.949
cell from rmat: 11.94204 15.57360 12.23942 90.0000 107.5827 90.0000 V= 2169.95
pg constrained: 11.94204 15.57360 12.23942 90.0000 107.5827 90.0000 V= 2169.95
Sigma 0.0024 0.0049 0.0059 0.023 0.021 0.021 Volume 1.24
Bravais=P pg=2/m
go(1) starting CalcRes: res=0.25155
Refining 9 parameters: 76 evaluations in 42 iterations. residue 0.25161 ====
go(2)
Refining 9 parameters: 50 evaluations in 27 iterations. residue 0.25146 ====
go(3)
Refining 9 parameters: 21 evaluations in 11 iterations. residue 0.25144 ====
starting 0.25155 bestintermediate 0.25144 final 0.25144 diff -0.00012 relative -0.00046 status 3
final residue is best.
2 matrices.
rmat 1 346 reflections. (forbidden mm:9 rot:15 total:19)
rmat 2 214 reflections. (forbidden mm:5 rot:16 total:16)
Used: 525 mm 192 rot
          ref   current   initial   change accumulate   shift refl
==================================================================
a         Yes  11.94068  11.94319 -0.00251   11.94068 0.02389  525
b         Yes  15.57093  15.57689 -0.00595   15.57093 0.03115  525
c         Yes  12.23948  12.24889 -0.00941   12.23948 0.02450  525
alpha     Fix  90.00000  89.89287            90.00000 0.20000  525
beta      Yes 107.58369 107.58987 -0.00617  107.58369 0.20000  525
gamma     Fix  90.00000  90.08726            90.00000 0.20000  525
orx       Yes   0.79277   0.79255  0.00022    0.79277 0.00113  525
ory       Yes   0.22754   0.22781 -0.00027    0.22754 0.00113  525
ora       Yes 174.66228 174.60219  0.06008  174.66228 0.20000  525
xtalx      No   0.00000   0.00000             0.00000 0.10000  525
xtaly      No   0.00000   0.00000             0.00000 0.10000  525
xtalz      No   0.00000   0.00000             0.00000 0.10000  525
zerodist   No   0.00000   0.00000             0.00000 0.10000  525
zerohor   Yes  -0.00971   0.00000 -0.00971   -1.46501 0.10000  525
zerover   Yes   0.07735   0.00000  0.07735   -0.34305 0.10000  525
detrotx    No   0.00000   0.00000             0.62960 0.20000  525
detroty    No   0.00000   0.00000             0.18030 0.20000  525
detrotz    No   0.00000   0.00000            -0.37160 0.20000  525
==================================================================
Vol             2169.33   2172.21    -2.88    2169.33          327
Vol2            2169.33   2172.21    -2.88    2169.33          198
==================================================================
mm              0.09926   0.12565 -0.02638    0.09926          525
mmAng       +   0.08228   0.10544 -0.02316    0.08228          525
rotpartial  +   0.16916   0.19585 -0.02670    0.16916          192
rotoutside      0.34209   0.32934  0.01275    0.34209           62
rotinside       0.00000   0.00000  0.00000    0.00000          271
rotall          0.10226   0.11240 -0.01014    0.10226          525
res             0.25144   0.30129 -0.04986    0.25144


detector position and matrices can now be saved using save, savermat1 and savermat2,

Example 4

Incomensurate structure

You may inspect the contents of example4.rmat and example4.pk.

example4.rmat constains four qvectors (QVEC) with a user defined set of qvector combinations (QVC)

first, reset the reject parameters
Peakref> maxmismm 1
Peakref> maxmisrot 1
get the data
Peakref> example 4
removed rmat 1 removed rmat 2
RMAT 1 example4
               RMAT                                     DMAT
   0.1372836   0.2920939   0.0116994       -0.1319185  -3.8726881   0.1954563
  -0.2636430  -0.0127565   0.0026720        3.3636947   1.7923243  -0.7255700
  -0.0148209  -0.0556102   0.0608381        3.0425107   0.6948735  15.8214626
Determinant:  0.4756656E-02                             210.2317
cell from rmat: 3.87986 3.87986 16.12633 90.0001 90.0000 120.0000 V= 210.23
pg constrained: 3.87986 3.87986 16.12633 90.0000 90.0000 120.0000 V= 210.23
Bravais=P pg=-3
Qvectype=2 MODULATED
ActiveQvecRadius=0.36056
QVEC    dh      dk      dl   Order
   1  0.3000 -0.1000  0.0000   1
   2  0.3000 -0.2000  0.0000   1
   3 -0.1000  0.3000  0.0000   1
   4 -0.2000  0.3000  0.0000   1
13 explicit QV Combinations
orientation-axis 0.1151 -0.06923 0.99094 orientation-angle -92.7446
initial orx and ory shift of matrix 1 set to 0.00198
ReadPkData: 2763 lines from /global/evalccd/ccd/peakref/example4.pk 2399 reflections.
47 experiments.

Peakref> status
no reflections with rotation angle. 2399 reflections with rotation range.
resfactorvalue 0 all
resfactorvalue 1 mmang rotall
res = 1.0*mmAng + 1.0*rotall
Reind: 2 not-indexed reflections. no reflections changed indices.
matrix 1: 2397 reflections. 0 main 2397 satellite.
SetMM 1.0: 777 out of position. SetRot 1.0: 1070 out of rot. 2399 reflections (1106 allowed)
SetupRmatrices matrix 1 rotvec= 0.1151 -0.06923 0.99094 AbsVec=1.0 rotang=-92.7446 Stored rmat as 1
Saving 4 qvecs Stored rmat as 1
One matrix. 2399 reflections. (forbidden index:2 mm:777 rot:1070 total:1293)
Used: 1106 mm 1106 rot
          ref   current   initial  change accumulate   shift refl
=================================================================
a          No   3.87986   3.87986            3.87986 0.00776 1106
b          No   3.87986   3.87986            3.87986 0.00776 1106
c          No  16.12633  16.12633           16.12633 0.03225 1106
alpha      No  90.00005  90.00005           90.00005 0.20000 1106
beta       No  89.99998  89.99998           89.99998 0.20000 1106
gamma      No 120.00001 120.00001          120.00001 0.20000 1106
orx        No   0.11510   0.11510            0.11510 0.00198 1106
ory        No  -0.06923  -0.06923           -0.06923 0.00198 1106
ora        No -92.74460 -92.74460          -92.74460 0.20000 1106
xtalx      No   0.00000   0.00000            0.00000 0.10000 1106
xtaly      No   0.00000   0.00000            0.00000 0.10000 1106
xtalz      No   0.00000   0.00000            0.00000 0.10000 1106
zerodist   No   0.00000   0.00000            0.00000 0.10000 1106
zerohor   Yes   0.00000   0.00000 0.00000    0.51200 0.10000 1106
zerover   Yes   0.00000   0.00000 0.00000   -0.80210 0.10000 1106
detrotx    No   0.00000   0.00000           -0.10280 0.20000 1106
detroty    No   0.00000   0.00000            0.09980 0.20000 1106
detrotz    No   0.00000   0.00000            0.06290 0.20000 1106
qvx1       No   0.30000   0.30000            0.30000 0.01000  290
qvy1       No  -0.10000  -0.10000           -0.10000 0.01000  290
qvz1       No   0.00000   0.00000            0.00000 0.01000  290
qvx2       No   0.30000   0.30000            0.30000 0.01000  282
qvy2       No  -0.20000  -0.20000           -0.20000 0.01000  282
qvz2       No   0.00000   0.00000            0.00000 0.01000  282
qvx3       No  -0.10000  -0.10000           -0.10000 0.01000  271
qvy3       No   0.30000   0.30000            0.30000 0.01000  271
qvz3       No   0.00000   0.00000            0.00000 0.01000  271
qvx4       No  -0.20000  -0.20000           -0.20000 0.01000  312
qvy4       No   0.30000   0.30000            0.30000 0.01000  312
qvz4       No   0.00000   0.00000            0.00000 0.01000  312
=================================================================
Vol              210.23    210.23    0.00     210.23         1106
=================================================================
mm              0.17963   0.17963 0.00000    0.17963         1106
mmAng       +   0.27032   0.27032 0.00000    0.27032         1106
rotoutside      0.33424   0.33424 0.00000    0.33424          324
rotinside       0.00000   0.00000 0.00000    0.00000          782
rotall      +   0.09792   0.09792 0.00000    0.09792         1106
res             0.36823   0.36823 0.00000    0.36823

====

Peakref> go3
go(1) starting CalcRes: res=0.36823
Refining 2 parameters: 18 evaluations in 9 iterations. residue 0.31737 ====
go(2)
Refining 2 parameters: 6 evaluations in 3 iterations. residue 0.31735 ====
go(3)
Refining 2 parameters: no evaluations in no iterations. residue 0.31735
starting 0.36823 bestintermediate 0.31735 final 0.31735 diff -0.05088 relative -0.16033 status 1
final residue is best.
One matrix. 2399 reflections. (forbidden index:2 mm:777 rot:1070 total:1293)
Used: 1106 mm 1106 rot
          ref   current   initial   change accumulate   shift refl
==================================================================
a          No   3.87986   3.87986             3.87986 0.00776 1106
b          No   3.87986   3.87986             3.87986 0.00776 1106
c          No  16.12633  16.12633            16.12633 0.03225 1106
alpha      No  90.00005  90.00005            90.00005 0.20000 1106
beta       No  89.99998  89.99998            89.99998 0.20000 1106
gamma      No 120.00001 120.00001           120.00001 0.20000 1106
orx        No   0.11510   0.11510             0.11510 0.00198 1106
ory        No  -0.06923  -0.06923            -0.06923 0.00198 1106
ora        No -92.74460 -92.74460           -92.74460 0.20000 1106
xtalx      No   0.00000   0.00000             0.00000 0.10000 1106
xtaly      No   0.00000   0.00000             0.00000 0.10000 1106
xtalz      No   0.00000   0.00000             0.00000 0.10000 1106
zerodist   No   0.00000   0.00000             0.00000 0.10000 1106
zerohor   Yes   0.09457   0.00000  0.09457    0.60657 0.10000 1106
zerover   Yes   0.02311   0.00000  0.02311   -0.77899 0.10000 1106
detrotx    No   0.00000   0.00000            -0.10280 0.20000 1106
detroty    No   0.00000   0.00000             0.09980 0.20000 1106
detrotz    No   0.00000   0.00000             0.06290 0.20000 1106
qvx1       No   0.30000   0.30000             0.30000 0.01000  290
qvy1       No  -0.10000  -0.10000            -0.10000 0.01000  290
qvz1       No   0.00000   0.00000             0.00000 0.01000  290
qvx2       No   0.30000   0.30000             0.30000 0.01000  282
qvy2       No  -0.20000  -0.20000            -0.20000 0.01000  282
qvz2       No   0.00000   0.00000             0.00000 0.01000  282
qvx3       No  -0.10000  -0.10000            -0.10000 0.01000  271
qvy3       No   0.30000   0.30000             0.30000 0.01000  271
qvz3       No   0.00000   0.00000             0.00000 0.01000  271
qvx4       No  -0.20000  -0.20000            -0.20000 0.01000  312
qvy4       No   0.30000   0.30000             0.30000 0.01000  312
qvz4       No   0.00000   0.00000             0.00000 0.01000  312
==================================================================
Vol              210.23    210.23     0.00     210.23         1106
==================================================================
mm              0.14875   0.17963 -0.03088    0.14875         1106
mmAng       +   0.21944   0.27032 -0.05088    0.21944         1106
rotoutside      0.33424   0.33424  0.00000    0.33424          324
rotinside       0.00000   0.00000  0.00000    0.00000          782
rotall      +   0.09792   0.09792  0.00000    0.09792         1106
res             0.31735   0.36823 -0.05088    0.31735


Peakref> free rmat
Peakref> go3
go(1) starting CalcRes: res=0.31735
Refining 11 parameters: 92 evaluations in 55 iterations. residue 0.31651 ====
go(2)
Refining 11 parameters: 42 evaluations in 25 iterations. residue 0.31652
go(3)
Refining 11 parameters: 5 evaluations in 3 iterations. residue 0.31646 ====
starting 0.31735 bestintermediate 0.31646 final 0.31646 diff -0.00089 relative -0.0028 status 3
final residue is best.
One matrix. 2399 reflections. (forbidden index:2 mm:777 rot:1070 total:1293)
Used: 1106 mm 1106 rot
          ref   current   initial   change accumulate   shift refl
==================================================================
a         Yes   3.87870   3.87986 -0.00116    3.87870 0.00776 1106
b         Yes   3.87920   3.87986 -0.00066    3.87920 0.00776 1106
c         Yes  16.12652  16.12633  0.00019   16.12652 0.03225 1106
alpha     Yes  90.00749  90.00005  0.00744   90.00749 0.20000 1106
beta      Yes  89.97677  89.99998 -0.02322   89.97677 0.20000 1106
gamma     Yes 120.02465 120.00001  0.02464  120.02465 0.20000 1106
orx       Yes   0.11525   0.11510  0.00015    0.11525 0.00198 1106
ory       Yes  -0.06902  -0.06923  0.00020   -0.06902 0.00198 1106
ora       Yes -92.73322 -92.74460  0.01139  -92.73322 0.20000 1106
xtalx      No   0.00000   0.00000             0.00000 0.10000 1106
xtaly      No   0.00000   0.00000             0.00000 0.10000 1106
xtalz      No   0.00000   0.00000             0.00000 0.10000 1106
zerodist   No   0.00000   0.00000             0.00000 0.10000 1106
zerohor   Yes   0.08564   0.00000  0.08564    0.59764 0.10000 1106
zerover   Yes   0.02215   0.00000  0.02215   -0.77995 0.10000 1106
detrotx    No   0.00000   0.00000            -0.10280 0.20000 1106
detroty    No   0.00000   0.00000             0.09980 0.20000 1106
detrotz    No   0.00000   0.00000             0.06290 0.20000 1106
qvx1       No   0.30000   0.30000             0.30000 0.01000  290
qvy1       No  -0.10000  -0.10000            -0.10000 0.01000  290
qvz1       No   0.00000   0.00000             0.00000 0.01000  290
qvx2       No   0.30000   0.30000             0.30000 0.01000  282
qvy2       No  -0.20000  -0.20000            -0.20000 0.01000  282
qvz2       No   0.00000   0.00000             0.00000 0.01000  282
qvx3       No  -0.10000  -0.10000            -0.10000 0.01000  271
qvy3       No   0.30000   0.30000             0.30000 0.01000  271
qvz3       No   0.00000   0.00000             0.00000 0.01000  271
qvx4       No  -0.20000  -0.20000            -0.20000 0.01000  312
qvy4       No   0.30000   0.30000             0.30000 0.01000  312
qvz4       No   0.00000   0.00000             0.00000 0.01000  312
==================================================================
Vol              210.08    210.23    -0.15     210.08         1106
==================================================================
mm              0.14838   0.17963 -0.03125    0.14838         1106
mmAng       +   0.21922   0.27032 -0.05110    0.21922         1106
rotoutside      0.33717   0.33424  0.00293    0.33717          319
rotinside       0.00000   0.00000  0.00000    0.00000          787
rotall      +   0.09725   0.09792 -0.00067    0.09725         1106
res             0.31646   0.36823 -0.05177    0.31646


Now release the qvector variables.
Peakref> free qvx* qvy*
Peakref> go3
go(1) starting CalcRes: res=0.31646
Refining 19 parameters: 297 evaluations in 206 iterations. residue 0.23266 ====
go(2)
Refining 19 parameters: 106 evaluations in 65 iterations. residue 0.23253 ====
go(3)
Refining 19 parameters: 16 evaluations in 9 iterations. residue 0.23258
starting 0.31646 bestintermediate 0.23253 final 0.23258 diff -0.08393 relative -0.36096 status 2
intermediate residue is best.
One matrix. 2399 reflections. (forbidden index:2 mm:777 rot:1070 total:1293)
Used: 1106 mm 1106 rot
          ref   current   initial   change accumulate   shift refl
==================================================================
a         Yes   3.88080   3.87986  0.00094    3.88080 0.00776 1106
b         Yes   3.87954   3.87986 -0.00032    3.87954 0.00776 1106
c         Yes  16.12758  16.12633  0.00126   16.12758 0.03225 1106
alpha     Yes  89.98964  90.00005 -0.01042   89.98964 0.20000 1106
beta      Yes  89.98232  89.99998 -0.01767   89.98232 0.20000 1106
gamma     Yes 119.99731 120.00001 -0.00270  119.99731 0.20000 1106
orx       Yes   0.11517   0.11510  0.00006    0.11517 0.00198 1106
ory       Yes  -0.06893  -0.06923  0.00030   -0.06893 0.00198 1106
ora       Yes -92.73539 -92.74460  0.00921  -92.73539 0.20000 1106
xtalx      No   0.00000   0.00000             0.00000 0.10000 1106
xtaly      No   0.00000   0.00000             0.00000 0.10000 1106
xtalz      No   0.00000   0.00000             0.00000 0.10000 1106
zerodist   No   0.00000   0.00000             0.00000 0.10000 1106
zerohor   Yes   0.08799   0.00000  0.08799    0.59999 0.10000 1106
zerover   Yes   0.02001   0.00000  0.02001   -0.78209 0.10000 1106
detrotx    No   0.00000   0.00000            -0.10280 0.20000 1106
detroty    No   0.00000   0.00000             0.09980 0.20000 1106
detrotz    No   0.00000   0.00000             0.06290 0.20000 1106
qvx1      Yes   0.30096   0.30000  0.00096    0.30096 0.01000  290
qvy1      Yes  -0.11441  -0.10000 -0.01441   -0.11441 0.01000  290
qvz1       No   0.00000   0.00000             0.00000 0.01000  290
qvx2      Yes   0.30349   0.30000  0.00349    0.30349 0.01000  282
qvy2      Yes  -0.18593  -0.20000  0.01407   -0.18593 0.01000  282
qvz2       No   0.00000   0.00000             0.00000 0.01000  282
qvx3      Yes  -0.11422  -0.10000 -0.01422   -0.11422 0.01000  271
qvy3      Yes   0.29957   0.30000 -0.00043    0.29957 0.01000  271
qvz3       No   0.00000   0.00000             0.00000 0.01000  271
qvx4      Yes  -0.18767  -0.20000  0.01233   -0.18767 0.01000  312
qvy4      Yes   0.30436   0.30000  0.00436    0.30436 0.01000  312
qvz4       No   0.00000   0.00000             0.00000 0.01000  312
==================================================================
Vol              210.29    210.23     0.06     210.29         1106
==================================================================
mm              0.11509   0.17963 -0.06454    0.11509         1106
mmAng       +   0.17026   0.27032 -0.10006    0.17026         1106
rotoutside      0.41242   0.33424  0.07818    0.41242          167
rotinside       0.00000   0.00000  0.00000    0.00000          939
rotall      +   0.06227   0.09792 -0.03564    0.06227         1106
res             0.23253   0.36823 -0.13570    0.23253


The qvector variables are refined independently. The final values suggest a possible relation between the numbers. Let's define these constraints using free variables. Peakref> set fvar1 -0.1
Peakref> set fvar2 -0.2
Peakref> shift fvar1 0.01
Peakref> shift fvar2 0.01
Peakref> constraint fvar3 -[fvar1]-[fvar2]
Note the use of the square brackets.

Now the relations between the qvector variables and these free variables:
Peakref> constraint qvx1 [fvar3]
Peakref> constraint qvy1 [fvar1]
Peakref> constraint qvx2 [fvar3]
Peakref> constraint qvy2 [fvar2]
Peakref> constraint qvx3 [fvar1]
Peakref> constraint qvy3 [fvar3]
Peakref> constraint qvx4 [fvar2]
Peakref> constraint qvy4 [fvar3]
Peakref> status
One matrix. 2399 reflections. (forbidden index:2 mm:777 rot:1070 total:1293)
Used: 1106 mm 1106 rot
          ref   current   initial   change accumulate   shift refl
==================================================================
a         Yes   3.88080   3.87986  0.00094    3.88080 0.00776 1106
b         Yes   3.87954   3.87986 -0.00032    3.87954 0.00776 1106
c         Yes  16.12758  16.12633  0.00126   16.12758 0.03225 1106
alpha     Yes  89.98964  90.00005 -0.01042   89.98964 0.20000 1106
beta      Yes  89.98232  89.99998 -0.01767   89.98232 0.20000 1106
gamma     Yes 119.99731 120.00001 -0.00270  119.99731 0.20000 1106
orx       Yes   0.11517   0.11510  0.00006    0.11517 0.00198 1106
ory       Yes  -0.06893  -0.06923  0.00030   -0.06893 0.00198 1106
ora       Yes -92.73539 -92.74460  0.00921  -92.73539 0.20000 1106
xtalx      No   0.00000   0.00000             0.00000 0.10000 1106
xtaly      No   0.00000   0.00000             0.00000 0.10000 1106
xtalz      No   0.00000   0.00000             0.00000 0.10000 1106
zerodist   No   0.00000   0.00000             0.00000 0.10000 1106
zerohor   Yes   0.08799   0.00000  0.08799    0.59999 0.10000 1106
zerover   Yes   0.02001   0.00000  0.02001   -0.78209 0.10000 1106
detrotx    No   0.00000   0.00000            -0.10280 0.20000 1106
detroty    No   0.00000   0.00000             0.09980 0.20000 1106
detrotz    No   0.00000   0.00000             0.06290 0.20000 1106
fvar1      No  -0.10000   0.00000            -0.10000 0.01000 1106
fvar2      No  -0.20000   0.00000            -0.20000 0.01000 1106
fvar3     Con   0.30000   0.00000             0.30000 0.10000 1106
qvx1      Con   0.30000   0.30000             0.30000 0.01000  290
qvy1      Con  -0.10000  -0.10000            -0.10000 0.01000  290
qvz1       No   0.00000   0.00000             0.00000 0.01000  290
qvx2      Con   0.30000   0.30000             0.30000 0.01000  282
qvy2      Con  -0.20000  -0.20000            -0.20000 0.01000  282
qvz2       No   0.00000   0.00000             0.00000 0.01000  282
qvx3      Con  -0.10000  -0.10000            -0.10000 0.01000  271
qvy3      Con   0.30000   0.30000             0.30000 0.01000  271
qvz3       No   0.00000   0.00000             0.00000 0.01000  271
qvx4      Con  -0.20000  -0.20000            -0.20000 0.01000  312
qvy4      Con   0.30000   0.30000             0.30000 0.01000  312
qvz4       No   0.00000   0.00000             0.00000 0.01000  312
==================================================================
Vol              210.29    210.23     0.06     210.29         1106
==================================================================
mm              0.14916   0.17963 -0.03047    0.14916         1106
mmAng       +   0.22003   0.27032 -0.05029    0.22003         1106
rotoutside      0.33407   0.33424 -0.00017    0.33407          323
rotinside       0.00000   0.00000  0.00000    0.00000          783
rotall      +   0.09756   0.09792 -0.00035    0.09756         1106
res             0.31759   0.36823 -0.05064    0.31759


fvar3 depends on fvar1 and fvar2. Every time fvar1 and or fvar2 change, fvar3 will be re-evaluated. And every time the free variables fvar1, fvar2 and/or fvar3 change, the constraint variables qvx1, qvy1, qvx2, qvy2, qvx3, qvy3, qvx4 and qvy4 will be updated.
Let's examine all constraints
Peakref> list constraint
fvar3 constrained to -[fvar1]-[fvar2]
qvx1 constrained to [fvar3]
qvy1 constrained to [fvar1]
qvx2 constrained to [fvar3]
qvy2 constrained to [fvar2]
qvx3 constrained to [fvar1]
qvy3 constrained to [fvar3]
qvx4 constrained to [fvar2]
qvy4 constrained to [fvar3]
9 constraints

First refine detector and rmat to accomodate to these new (not refined) qvectors.
Peakref> go3
go(1) starting CalcRes: res=0.31759
Refining 11 parameters: 85 evaluations in 47 iterations. residue 0.31667
go(2)
Refining 11 parameters: 53 evaluations in 31 iterations. residue 0.31656
go(3)
Refining 11 parameters: 6 evaluations in 3 iterations. residue 0.31649
starting 0.31759 bestintermediate 0.31649 final 0.31649 diff -0.0011 relative -0.00349 status 3
final residue is best.
One matrix. 2399 reflections. (forbidden index:2 mm:777 rot:1070 total:1293)
Used: 1106 mm 1106 rot
          ref   current   initial   change accumulate   shift refl
==================================================================
a         Yes   3.87890   3.87986 -0.00097    3.87890 0.00776 1106
b         Yes   3.87919   3.87986 -0.00067    3.87919 0.00776 1106
c         Yes  16.12687  16.12633  0.00054   16.12687 0.03225 1106
alpha     Yes  90.00150  90.00005  0.00145   90.00150 0.20000 1106
beta      Yes  89.96806  89.99998 -0.03192   89.96806 0.20000 1106
gamma     Yes 120.02273 120.00001  0.02272  120.02273 0.20000 1106
orx       Yes   0.11528   0.11510  0.00017    0.11528 0.00198 1106
ory       Yes  -0.06896  -0.06923  0.00027   -0.06896 0.00198 1106
ora       Yes -92.72638 -92.74460  0.01822  -92.72638 0.20000 1106
xtalx      No   0.00000   0.00000             0.00000 0.10000 1106
xtaly      No   0.00000   0.00000             0.00000 0.10000 1106
xtalz      No   0.00000   0.00000             0.00000 0.10000 1106
zerodist   No   0.00000   0.00000             0.00000 0.10000 1106
zerohor   Yes   0.08786   0.00000  0.08786    0.59986 0.10000 1106
zerover   Yes   0.01873   0.00000  0.01873   -0.78337 0.10000 1106
detrotx    No   0.00000   0.00000            -0.10280 0.20000 1106
detroty    No   0.00000   0.00000             0.09980 0.20000 1106
detrotz    No   0.00000   0.00000             0.06290 0.20000 1106
fvar1      No  -0.10000   0.00000            -0.10000 0.01000 1106
fvar2      No  -0.20000   0.00000            -0.20000 0.01000 1106
fvar3     Con   0.30000   0.00000             0.30000 0.10000 1106
qvx1      Con   0.30000   0.30000             0.30000 0.01000  290
qvy1      Con  -0.10000  -0.10000            -0.10000 0.01000  290
qvz1       No   0.00000   0.00000             0.00000 0.01000  290
qvx2      Con   0.30000   0.30000             0.30000 0.01000  282
qvy2      Con  -0.20000  -0.20000            -0.20000 0.01000  282
qvz2       No   0.00000   0.00000             0.00000 0.01000  282
qvx3      Con  -0.10000  -0.10000            -0.10000 0.01000  271
qvy3      Con   0.30000   0.30000             0.30000 0.01000  271
qvz3       No   0.00000   0.00000             0.00000 0.01000  271
qvx4      Con  -0.20000  -0.20000            -0.20000 0.01000  312
qvy4      Con   0.30000   0.30000             0.30000 0.01000  312
qvz4       No   0.00000   0.00000             0.00000 0.01000  312
==================================================================
Vol              210.10    210.23    -0.13     210.10         1106
==================================================================
mm              0.14847   0.17963 -0.03116    0.14847         1106
mmAng       +   0.21928   0.27032 -0.05104    0.21928         1106
rotoutside      0.33917   0.33424  0.00493    0.33917          317
rotinside       0.00000   0.00000  0.00000    0.00000          789
rotall      +   0.09721   0.09792 -0.00070    0.09721         1106
res             0.31649   0.36823 -0.05174    0.31649


And now release the 2 free variables.
Peakref> free fvar1 fvar2
Peakref> go3
go(1) starting CalcRes: res=0.31649
Refining 13 parameters: 194 evaluations in 124 iterations. residue 0.23466
go(2)
Refining 13 parameters: 74 evaluations in 43 iterations. residue 0.23453
go(3)
Refining 13 parameters: 25 evaluations in 14 iterations. residue 0.23448
starting 0.31649 bestintermediate 0.23448 final 0.23448 diff -0.08201 relative -0.34974 status 1
final residue is best.
One matrix. 2399 reflections. (forbidden index:2 mm:777 rot:1070 total:1293)
Used: 1106 mm 1106 rot
          ref   current   initial   change accumulate   shift refl
==================================================================
a         Yes   3.88088   3.87986  0.00102    3.88088 0.00776 1106
b         Yes   3.87946   3.87986 -0.00040    3.87946 0.00776 1106
c         Yes  16.12747  16.12633  0.00114   16.12747 0.03225 1106
alpha     Yes  89.95480  90.00005 -0.04525   89.95480 0.20000 1106
beta      Yes  90.02059  89.99998  0.02061   90.02059 0.20000 1106
gamma     Yes 119.99596 120.00001 -0.00406  119.99596 0.20000 1106
orx       Yes   0.11499   0.11510 -0.00011    0.11499 0.00198 1106
ory       Yes  -0.06899  -0.06923  0.00023   -0.06899 0.00198 1106
ora       Yes -92.74393 -92.74460  0.00066  -92.74393 0.20000 1106
xtalx      No   0.00000   0.00000             0.00000 0.10000 1106
xtaly      No   0.00000   0.00000             0.00000 0.10000 1106
xtalz      No   0.00000   0.00000             0.00000 0.10000 1106
zerodist   No   0.00000   0.00000             0.00000 0.10000 1106
zerohor   Yes   0.09047   0.00000  0.09047    0.60247 0.10000 1106
zerover   Yes   0.02139   0.00000  0.02139   -0.78071 0.10000 1106
detrotx    No   0.00000   0.00000            -0.10280 0.20000 1106
detroty    No   0.00000   0.00000             0.09980 0.20000 1106
detrotz    No   0.00000   0.00000             0.06290 0.20000 1106
fvar1     Yes  -0.11522   0.00000 -0.11522   -0.11522 0.01000 1106
fvar2     Yes  -0.18756   0.00000 -0.18756   -0.18756 0.01000 1106
fvar3     Con   0.30278   0.00000             0.30278 0.10000 1106
qvx1      Con   0.30278   0.30000             0.30278 0.01000  290
qvy1      Con  -0.11522  -0.10000            -0.11522 0.01000  290
qvz1       No   0.00000   0.00000             0.00000 0.01000  290
qvx2      Con   0.30278   0.30000             0.30278 0.01000  282
qvy2      Con  -0.18756  -0.20000            -0.18756 0.01000  282
qvz2       No   0.00000   0.00000             0.00000 0.01000  282
qvx3      Con  -0.11522  -0.10000            -0.11522 0.01000  271
qvy3      Con   0.30278   0.30000             0.30278 0.01000  271
qvz3       No   0.00000   0.00000             0.00000 0.01000  271
qvx4      Con  -0.18756  -0.20000            -0.18756 0.01000  312
qvy4      Con   0.30278   0.30000             0.30278 0.01000  312
qvz4       No   0.00000   0.00000             0.00000 0.01000  312
==================================================================
Vol              210.29    210.23     0.06     210.29         1106
==================================================================
mm              0.11535   0.17963 -0.06428    0.11535         1106
mmAng       +   0.17081   0.27032 -0.09951    0.17081         1106
rotoutside      0.46027   0.33424  0.12603    0.46027          153
rotinside       0.00000   0.00000  0.00000    0.00000          953
rotall      +   0.06367   0.09792 -0.03424    0.06367         1106
res             0.23448   0.36823 -0.13375    0.23448


show the cell results
Peakref> list rmat

independent matrix 1
RMAT 1 example4
               RMAT                                     DMAT
   0.1372270   0.2920920   0.0116771       -0.1320145  -3.8736854   0.1959534
  -0.2635745  -0.0127728   0.0026796        3.3637283   1.7918119  -0.7245525
  -0.0147425  -0.0557148   0.0608376        3.0484982   0.7022412  15.8211489
Determinant:  0.4755359E-02                             210.2891
cell from rmat: 3.88088 3.87946 16.12747 89.9548 90.0206 119.9960 V= 210.29
pg constrained: 3.88017 3.88017 16.12747 90.0000 90.0000 120.0000 V= 210.28
Bravais=P pg=-3
Qvectype=2 MODULATED
ActiveQvecRadius=0.36056
QVEC    dh      dk      dl   Order
   1  0.3028 -0.1152  0.0000   1
   2  0.3028 -0.1876  0.0000   1
   3 -0.1152  0.3028  0.0000   1
   4 -0.1876  0.3028  0.0000   1
13 explicit QV Combinations

Peakref> exit
peakref ended at 10-Nov-2016 18:19:07 CPU time used 00:00:11


10-Nov-2016 18:19:07