Advanced

 

This section concerns the selection of particular classes of reflections by means of the COND card. Several special conditions for the selection are already implemented in the program (see the TABLE) however, the user can add other conditions by modifying the condout.f routine and recompiling equstat (see the README file).

Toward the end of the condout.f routine there are several commented lines which the user can modify looking at the code written for the routines already implemented as a template.

An example will clarify the situation: the routine works on the h k l indices which are called respectively jh, jk and jl; now, we want to introduce the condition for which only the reflections with h + k + l = 2n (the sum of the indices must be even) are selected (first case); the correspondent code is shown below:

 

c

c ***** h+k+l is even

c

if(jcn(i).eq.1) then

is=jh+jk+jl

imod=mod(is,2)

if(imod.eq.0.and.jcd.eq.1) iflag=iflag+1

if(imod.ne.0.and.jcd.eq.2) iflag=iflag+1

go to 1

end if

 

- The first 3 'commented' lines remember to us which is the condition;

- jcn(i) is the variable selecting which condition is to be considered (one of the 'in' numbers in the input COND card; see Keywords section); in this case, if jcn(i)=1 our condition is selected (successive conditions will require progressive jcn values);

- 'is' is the sum of the indices, then,

- with the fortran function 'mod' we evaluate if 'is' is even (imod = 0) or is odd (imod different from 0);

- 'imod.eq.0' and 'imod.ne.0' are respectively the 2 logical expressions 'xxxx' and 'yyyy' to be introduced in the 2 final 'if' instructions; 'jcd' has something to do with the condition being direct or complementary, so that if  'is'  is even, the reflection is selected ('iflag = iflag + 1') in case of a direct condition (jcd = 1), whereas if 'is' is odd, the reflection is selected in case of a complementary condition (jcd = 2).

In practice, what the user has to modify in the code below is (apart from removing the 'c' at the beginning of the lines and recalling that the code starts in the seventh column):

- place a suitable progressive number for 'jcn' (10, 11, 12 ...) for each new condition;

- write down the appropriate code for the condition, to be substituted for the dots ('is=jh+jk+jl' and 'imod=mod(is,2)', in the example above);

- define the variable that, at last, tells if the reflection is or not selectable and use it to build the logical expressions xxxx and yyyy;

- substitute, for the last dot, appropriate instructions, which depend upon the written code (closing cycles, 'end if', etc...).

c if(jcn(i).eq.10)then

c .

c .

c if((xxxx).and.jcd.eq.1) iflag=iflag+1

c if((yyyy).and.jcd.eq.1) iflag=iflag+1

c .

c go to 1

c end if

c

 

Good luck!