peakref Free Variables

There are 10 Free Variables available, named fvar1 to fvar10.
Set a value with set.

Free variables can be used for specific constraints.

Example 1

In a tetragonal crystal system, the angles are fixed to 90 and the b-axis is constrained to the a-axis. Suppose the content of the rmatrix is in a nonstandard setting. We now want to constrain c to b. This can be done directly with
constraint c [b]

The indirect approach using free variables is:
set fvar1 [b]
shift fvar1 0.01
constraint b [fvar1]
constraint c [fvar1]
free fvar1

Example 2

We have a rmatrix with 4 q-vectors in a hexagonal system. The qvectors are:
qv1 = (-0.3  0.1  0.0)
qv2 = (-0.3  0.2  0.0)
qv3 = ( 0.1 -0.3  0.0)
qv4 = ( 0.2 -0.3  0.0)

And we know there is a relation between the elements: the value 0.3 depends on 0.1 and 0.2.
So the qvectors can be defined with only two variables:
qv1 = (-f1-f2   f1    0)
qv2 = (-f1-f2   f2    0)
qv3 = (  f1   -f1-f2  0)
qv4 = (  f2   -f1-f2  0)

The qvectors and qvector combinations are read from the rmat file. To setup the refinement with constraints do:
set fvar1 [qvy1]  ! load value of qvy1 into fvar1
set fvar2 [qvy2]  ! load value of qvy2 into fvar2
shift fvar1 0.01  ! set initial shift
shift fvar2 0.01  ! set initial shift

constraint qvx1 -[fvar1]-[fvar2]
constraint qvy1 [fvar1]

constraint qvx2 -[fvar1]-[fvar2]
constraint qvy2 [fvar2]

constraint qvx3 [fvar1]
constraint qvy3 -[fvar1]-[fvar2]

constraint qvx4 [fvar2]
constraint qvy4 -[fvar1]-[fvar2]

or even more elegant, using 3 free variables:
set fvar1 [qvy1]  ! load value of qvy1 into fvar1
set fvar2 [qvy2]  ! load value of qvy2 into fvar2
shift fvar1 0.01  ! set initial shift
shift fvar2 0.01  ! set initial shift

constraint fvar3 -[fvar1]-[fvar2]  ! new variable

constraint qvx1 [fvar3]
constraint qvy1 [fvar1]

constraint qvx2 [fvar3]
constraint qvy2 [fvar2]

constraint qvx3 [fvar1]
constraint qvy3 [fvar3]

constraint qvx4 [fvar2]
constraint qvy4 [fvar3]

Example 3

A protein dataset with a very very long axis. We are not sure what the length of the c-axis should be. This procedure will step fvar1 from -50 to +50, reindex the reflections and refines c.
First, fix all variables except the c-axis.
fix all
free c

Then copy the value of c to fvar1 and subtract 50 Å from fvar1.
set fvar1 [c]
set fvar1 [fvar1]-50

At the end the best solution (the lowest res) is expected to contain the correct value of c. So now set the value of the bestresidue to an absurd large value.
bestresidue 10

Then increment fvar1 101 times (ending at +50 Å), copy the value to c, reindex and refine.
\repeat 101 set fvar1 [fvar1]+1 set c [fvar1] reind go nop

And finally, restore the best solution and once more reindex.
restore best
reind
status

Peakref Main Page
variable names
commands
glossary
examples