Contents Prev Manual

SUBROUTINE RADFUN(JAT,IEND)

Reads coefficients for the expansion of an atomic wave function.

Arguments:

On entry JAT indicates which atom (but is irrelevant if IEND=0)
IEND points to the first character position on the card to read,
unless IEND is -ve, when it is a request for initialisation. or IEND=0, which requests checking and printing.

Description:

The card has already been read as far as "W atom-name RADF".
Entry IEND +ve reads the coefficients in atomic units of IMAX Slater type functions, for the expansion of an atomic wave function as a sun of tems of the form: F(1,I)*R**N(I)*exp(-F(2,I)*R)
In mode 1 the F(1,I) are not normalised (Clementi) and in mode 2 they are (Watson).
The numbers given are MODE, N(I,IAT), F(1,I,IAT) AND F(2,I,IAT)
Entry IEND=0 converts the coefficients to Angstrom units, and checks for normalisation, for atom JAT.

Output:

Entry IEND=0 writes its findings to unit LPT.

Calls:

ERRCH2 ERRCHK ERRMES ERRRE2 FACT JGMZER MESS NFIND RDINTG RDREAL

Called by:

PFSET FORFAC

Common blocks used:

/IOUNIT/ to use LPT
/RADINT/ to use FF NTERMS IRADF NRADF
/SCRAT/ to use all members

*** RADFUN updated by C139 July-4-2005 ***

Classification:

Structure Factor Calculations . . . . . . . Setting Up

FUNCTION RADIAN(X)

Converts from degrees to radians.

Arguments:

On entry X is the value of an angle in degrees

Description:

On exit X has been converted to radians.

Notes:

The function DEGREE(X) does the radians to degrees conversion
In routines where time matters, it is quicker to declare the COMMON /CONSTA/ and multiply X by RAD.

Called by:

CELLMA FMCALC FMMPCA GEOMLS INPUTD LMCALC LMMPCA MAGDIR MATCEL RECIP SPHPOL MAG3D MAGPOW MG3DGL MVENTR POWDER

Common blocks used:

/CONSTA/ to use RAD

*** RADIAN by JCM ***

Classification:

Trigonometry . . . . . . . Utility

FUNCTION RANGE(X,A,B)

Puts a number into a given range.

Arguments:

On entry X is the current value of a real variable.
A and B are the limits between which RANGE is to be set.

Description:

X must be periodic in (A-B). A is included in the range, but B excluded.

Notes:

A is not necessarily > or < B.

Called by:

DOMAG DOMAG2 MAGCON

*** RANGE by JCM 23 Sep 87 ***

Classification:

Tests . . . . . . . Utility

SUBROUTINE RATFRC(F,I,J)

To make a rational fraction of the form F**2=I/J out of F

Description:

Trys to make a rational fraction of the form F**2=I/J out of F if it doesn't succeed returns I=J=0

*** RATFRC NEW BY by PJB April 03 ***

Classification:

Mathematical Functions . . . . . . . Utility

SUBROUTINE RCMPRD(A,B,C,I,J,K)

Performs the multiplication of a COMPLEX by a REAL matrix.

Arguments:

On entry A is a real IxJ matrix,
B is a complex JxK matrix,

On exit C is returned as the complex IxK matrix A*B

Called by:

CENTRO FCHALC FMCALC FMMPCA LMCALC LMMPCA ROTOSM LCHALC

*** RCMPRD by PJB Jun 87 ***

Classification:

Matrices and Vectors . . . . . . . Utility

SUBROUTINE RDANGL(IPT,N1,N2,N3,NCOM,IE)

Reads a specification of a bond angle, by reading the names of 2
intersecting bonds; makes the third bond involved.

Arguments:

On entry IPT is the position at which to start reading, and it is updated.
On exit N1, N2 and N3 specify the 3 bonds making up the triangle containing
the angle. The angle is opposite N1, enclosed by N2 and N3, with N2 < N3.
NCOM points to the common atom.
IE is an error indicator - IE=0 if OK, not 0 if error.

Description:

Reads and identifies 2 bond names; finds their common atom; makes the third bond of the triangle and adds it to the bond list.

Output:

Reports an error if bonds are not in list, or if bonds have no atom in common.

Calls:

BONTRI ERRCH2 NCFIND RDWORD

Called by:

GEOMIN

Common blocks used:

/SLKGEC/ to use BONNAM
/SLKGEO/ to use NUMBON

*** RDANGL by JCM 15 Oct 90 ***

Classification:

Crystal Geometry . . . . . . . Setting Up

SUBROUTINE RDATOM(IPT,IA,XACT,ISYMM,ILATT,
CS)

Reads the specification of an atom for slack constraint purposes

Arguments:

On entry IPT points to the first character to read
On exit IA holds which base atom the new one is related to
XACT holds the actual x,y,z coordinates
ISYMM, ILATT and CS hold the transformation which takes the
base atom into the actual coordinates

Prerequisite calls:

On entry ICARD in /SCRACH holds the card read

Description:

Reads an atom name, which must be the same as one on an A card .
This may be followed either by 3 coordinates, x,y,z or by a symmetry operator number, a lattice translation number, and 3 cell shifts.
In either case, the actual destination atom, related to that on the
A card , is identified.

Calls:

ERRATM ERRMES IATOM RDINTG RDREAL RDWORD XROOT XTRANS

Called by:

GEOMIN

Common blocks used:

/ATNAM/ to use ATNAME
/CARDRC/ to use IERR
/IOUNIT/ to use LPT ITO
/NSYM/ to use NOPC NLAT CENTRC

*** RDATOM updated by JCM 7 Sep 90 ***

Classification:

Crystal Geometry . . . . . . . Setting Up

SUBROUTINE RDBOND(IPT,NEND,IE)

Reads a specification of a bond, by reading the names of the atoms
at each end.

Arguments:

On entry IPT is a starting position on the card.
On exit NEND is an integer array of 2 elements which holds the numbers
of the ends so identified in the list of L ATOM cards .

IE is an error indicator - on exit IE=0 if OK, not 0 if error.

Description:

Given an L BOND card in /SCRACH/, reads the next 2 atom names. An atom may belong to the list already given on L ATOM cards , or it may be the name of an atom in the asymmetric unit, on an A card . In the latter case it is added to the L ATOM list.

Output:

Reports an error if the atom names occur in neither list.

Calls:

ADDATM ERRATM GMZER IATOM NCFIND RDWORD

Called by:

GEOMIN

Common blocks used:

/ATNAM/ to use ATNAME
/SLKGEC/ to use ATTNAM
/SLKGEO/ to use NTARNM

*** corrected by KS Sept-1995 ***

Classification:

Crystal Geometry . . . . . . . Setting Up

SUBROUTINE RDDATA(NUNIT,K,H,F,IN,IOU)

Reads in free format h,k,l (possibly floating) and a list of
values, allowing for a possible title.

Arguments:

On entry NUNIT is the unit from which to read
IN indicates other incoming information:
IN +ve means allow one line of text (recognised by containing
any letter other than E)

IN -ve means expect only numbers - this entry would be used for
reading lines of a files other than the first.

IN absolute value gives maximum number of numbers to read to F

On exit H(1:3) contains the first 3 numbers read, real
K(1:3) contains the same numbers, fixed to integers.
F() contains all the subsequent numbers on the line, reals.
(maximum abs(IN) of them)

IOU, absolute value, holds (as its units digit) the number of
numbers read to the array F. No array bound check is done on F at present.

IOU is -9999 if end of file reached, so nothing new read
IOU, sign, is +ve if no errors detected
-ve if some reading error occurred, or title
out of context.

IOU, absolute value, has 100 added if title read. In this case
the routine reads in the next line also.

Description:

Ignores empty lines. If IN > 0 and finds text line, adopts it as a title

Calls:

ERRMES INDFIX INPUTN LENGT LETTER RDREAL

Called by:

ERRMAP FOUINP

Common blocks used:

*** RDDATA by JCM 5 Apr 89 ***

Classification:

CCSL Input/Output Routines . . . . . . . Utility

SUBROUTINE RDFV(DOTHER)

Reads all the user's L FIX and
L VARY cards in sequence.

Arguments:

DOTHER is a logical function which with be called to try to interpret blanket blanket type words such as MPAR (all magnetic parameters) which are not already catered for in RDFV.

Description:

The cards read here start either L FIX or L VARY. Next come as many parameter specifications as the user wishes. A parameter specification in this context is one of:
ONLY
ALL <F> where <F> is a family name
ALL <G> where <G> is genus name
ALL <S> where <S> is species name.
ALL <W> where <W> is a word for a
number of species as set up by the main program, e.g. "XYZ".

Examples:
L FIX ONLY SCAL 1 TFAC
L VARY ALL SITE
L VARY NA1 X NA2 XYZ O1 ITF
L FIX ALL BIJ
L VARY ONLY C1 B11 C1 B22 C1 B33 C2 XYZT ALL C3
L VARY ALL FAM1
In identifying a parameter, RDFV then stores the instruction to fix or vary it accordingly. Such instructions are not actually certain to be used until the routine VARMAK is called, which surveys them all and may discard some in favour of others.

Input:

Reads in L FIX and L VARY cards .

Notes:

It should be noted that even in this "general" routine used by all
LSQ programs, family 1 genus 1 is special, in having no genus name (so that it includes items with single names, e.g. "TFAC"). Also family 2 is special, being the crystal structure parameters.
When an atom name is found, it is taken to be a genus name in family 2.

Calls:

CDSCAN ERRMES PARRD

Called by:

PARSDS PARSSF

Common blocks used:

/CELFIX/ to use NCELF NCELG NCELS
/IOUNIT/ to use LPT ITO
/LINKAG/ to use NUMCON KKCON KPTCON
/NEWOLD/ to use IGEN ISPC
/PHASE/ to use JPHASE KPHASE
/REFINE/ to use IONLY
/SOURCE/ to use KSOURC

*** RDFV updated by PJB C105 April-2001 ***

Classification:

General Least Squares Refinement . . . . . . . Setting Up

SUBROUTINE RDINTG(N,IPT1,IPT2,IPTEND,IER)

Reads an integer in free format from a character string.

Arguments:

On entry IPT1 points to the first character in the string to consider
IPTEND points to the last to be considered

On exit N is the integer which was read
IPT2 points to the first character after the terminating
character, unless there was an erroneous character, in which case IPT2 points to it.

Prerequisite calls:

Before entry the character string from which the integer is to be read is read into /SCRACH/

Description:


IER = 0 if no errors were found
= 100 if N=0 was derived from all spaces (so note IER
non-zero is not always indicative of a fatal error)
= number in range 1-52 if a letter was found (the value of
IER indicates which letter) = small -ve number (being an address in table ISMBOL in
COMMON /CHARS/) if a symbol was found out of context. =-100 if the character found did not occur in any table

The string is expected to contain only digits, a possible sign, and a space or a comma to terminate.(The number is also terminated after the character pointed to by IPTEND.)

Calls:

LETTER NDIGIT NSYMBL

Called by:

ARREAD DOMAG DOMAG1 GEOMIN INOBGR INPLSF INPUTD INPUTE INPUTF INPUTG INPUTM INPUTT MOLORB MPFORM PARRD RADFUN RDATOM RDREAL RDRELA RDWORD REJECT SETPOL D3OP99 INFILE GENREF GETMSF GETSFZ GRAFIC MADUBM

Common blocks used:

*** RDINTG by JCM 10 Oct 83 ***

Classification:

CCSL Input/Output Routines . . . . . . . Utility

SUBROUTINE RDNUMS(A,IPT1,NBOUND,NUM,IER)

Reads all the numbers on a line in free format.

Arguments:

On entry IPT1 points to the first character in the string to be considered
On exit NUM is the number of numbers read
A(1:NBOUND) is an array into which NUM numbers have been read.
IER = 1 if any non-reals read, except "STEP", (and stops reading)
IER = 2 if more than NBOUND numbers were read
IER = 3 if a zero STEP length is requested
IER = 4 if a negative number of STEPS is requested

Prerequisite calls:

Before entry the character string (maximum 80 characters) from which the numbers are to be read must be in the character array in /SCRACH/.

Description:

The character string may contain just a simple string of numbers or may have anywhere the word STEP followed by 3 numbers. This is treated like a FORTRAN "DO" loop: the first number is an initial value
the second number is a final value the third number is a step length

All the values implied by the "STEP" function are put into array A
The "STEP" length may be negative so long as the final value is less than the initial one.
Stops when it has only blank card left, so it reads any non-blank numbers no matter where they are on the card. It cannot be used for the (little used) facility which allows fixed format in which blanks mean zeros.

Notes:

Beware rounding error in the use of "STEP".

Calls:

ERRIN2 JFIX RDREAL RDWORD TESTOV

Called by:

DOCHI1 DOMAG DOMAG1 DOTWN1 ICDFMT INPUTD INPUTE INPUTM LLSCAL PROPAG RECISD SPACE STLSFW ICDINC CALMSF CALQSF GETMSF GETSFZ GRAFIC ICDINC MAG3D MAG3DX MAGPOW MEANWT MG3DGL MVENTR MVENTX POWDER

Common blocks used:

/IOUNIT/ to use LPT ITO

*** RDNUMS corrected by JCM 23 Apr 92 ***

Classification:

CCSL Input/Output Routines . . . . . . . Utility

SUBROUTINE RDREAL(X,IPT1,IPT2,IPTEND,IER)

Reads a real number in free format from a character string.

Arguments:

On entry IPT1 points to the first character in the string to consider
IPTEND points to the last to be considered

On exit X is the real number read,
IPT2 points to the first character after the terminating character
unless there was an erroneous character, in which case
IPT2 points to it.

IER = 0 if no errors were found
= 100 if X=0 was derived from all spaces (so note IER
non-zero is not always indicative of a fatal error)
= number in range 1-52 if a letter was found (the value of
IER indicates which letter)
= small -ve number (being an address in table ISMBOL in
COMMON /CHARS/) if a symbol was found out of context.
=-100 if the character found did not occur in any table =-101 if number of form N/M but M=0 =-102 if more than 8 digits after decimal point

Prerequisite calls:

Before entry the character string (maximum 80 characters) from which the number is to be read must be in the character array ICARD in /SCRACH/.

Description:

The string is expected to contain only digits, a possible sign, a possible decimal point and a space or a comma to terminate.(The number is also terminated after the character pointed to by IPTEND.)
A comma by itself will be read as 0. (So, e.g., on C cards , tetragonal may come as 4.3,,4.5)
The routine will also read numbers in the form M/N (e.g. "2/3"), and integers without the decimal point.
It will now also read E format (number with exponent) eg 2.001E-5

Calls:

LETTER NDIGIT NSYMBL RDINTG

Called by:

DOMAG DOMAG1 FUDGET GEOMIN INOBGR INPUTA INPUTC INPUTD INPUTE INPUTG INPUTI INPUTM INPUTT INPUTU LLTFAC MOLORB NEXCON ONCARD OTPUTI PFSET RADFUN RDATOM RDDATA RDNUMS RDRELA READRT SETFOR SETPOL AVEXAR BONDS EXTCAL GENREF GETMSF GETSFZ GRAFIC MAG3DX MVENTX

Common blocks used:

*** RDREAL updated by JPW to read E format 3-May 2001

Classification:

CCSL Input/Output Routines . . . . . . . Utility

SUBROUTINE RDRELA

Reads and interprets all user-supplied
L RELA cards for constraints.

Description:

Deals with L RELA cards of type:
L RELA 1 : followed by <a1> <p1> <a2> <p2> where a1, a2 are
constants and p1, p2 are parameter specifications.
This is to be interpreted as: a1 x shift in p1 = a2 x shift in p2

L RELA 2 : followed by a string of <a1> <p1> <a2> <p2> ,a3> <p3> . .
for as many as are needed. This is to be interpreted as:
a1 x shift in p1 + a2 x shift in p2 + a3 x shift in p3 + etc = 0.

For each card the relation is read and stored. It is not actually absorbed until routine VARMAK is obeyed, when it may be modified in the light of other FIX, VARY or RELA instructions.

Notes:

Note that types 1 and 2 are not identical for a relation involving just two parameters.

Calls:

ERRIN2 FINDCD PARRD RDINTG RDREAL

Called by:

PARSDS PARSSF

*** RDRELA updated JCM 13 Jan 88 ***

Classification:

General Least Squares Refinement . . . . . . . Setting Up

SUBROUTINE RDWORD(WORD,IWDLEN,IPT1,IPT2,
IPTEND,IANY,IER)

Reads the next word from a character string.

Arguments:

WORD is *(*), and set on exit to contain the next readable word
IWDLEN integer, is set to the total number of characters read
On entry IPT1 points to the first character position to consider in ICARD
IPTEND points to the last character position to consider.
IANY indicates whether or not the "word" may start with a
a non-letter. If IANY is negative, any character may start the word, but if IANY = 0 it must start with a letter.
If IANY is positive, a special entry used by multi-source multiphase Profile Refinement is invoked. If *Sn or *Pn (n an integer) is read where a word is expected, n is transferred to KSOURC or KPHASE as appropriate, and the
NEXT word is read as normal.

On exit WORD contains the next readable word in ICARD terminated by
a space.

IWDLEN is set to the total number of characters read
IPT2 points to the character position in ICARD after
the one which terminated the word.

IER is an error indicator:

IER = 0 no errors found
IER = 100 word contained all spaces (ie nothing left in field to consider)
IER = number in range 1-10: initial character of word is a digit (IANY>=0)
IER = small negative number: initial symbol out of context (the
number is an address in the table ISMBOL in /CHARS/)

IER = -100: initial symbol out of context, not found in any table

Prerequisite calls:

Expects ICARD in /SCRACH/ to contain enough characters.

Description:

Ignores spaces till a non-space; then absorbs word until it finds
either a space, or the end of the permitted field as given in IPTEND, or
WORD is full (in which case it reads characters and counts them in IWDLEN, but does not store them

Calls:

LETTER NDIGIT NSYMBL RDINTG SAID

Called by:

CDFIN CDSCAN DOCHI1 DOMAG DOMAG1 DOMPL2 FUDGET GEOMCO GEOMIN INPLSF INPUTA INPUTD INPUTF INPUTG INPUTI INPUTJ INPUTM INPUTQ INPUTT INPUTW MAJUST MOLORB MPFORM NWINFW NWINSF NWINT2 ONCARD OTPUTI PARRD PFSET RDANGL RDATOM RDBOND RDNUMS RDWRDS READRT RECISD SETPOL AVEXAR BONDS INFILE EXTCAL GENREF GRAFIC MAG3DX MVENTX

Common blocks used:

/PHASE/ to use KPHASE
/SOURCE/ to use KSOURC

*** RDWORD updated by JCM 28 Apr 90 ***

Classification:

CCSL Input/Output Routines . . . . . . . Utility

SUBROUTINE RDWRDS(WD,IPT1,NBOUND,NUM,IER)

Reads all the words on a line from column 3 onwards.

Arguments:

On entry IPT1 points to the first character in ICARD to read
NBOUND is the dimension of the array WD

On exit WD is an A4 array which holds all the words read.
NUM is the number of words read (it stops at a non-word)

IER = 1 on exit if a non-word read (starting with a non-letter)
IER = 2 on exit if the array is overfilled

Prerequisite calls:

The card must have already been read into ICARD in /SCRACH/, usually by CARDIN

Calls:

ERRIN2 RDWORD

Called by:

BONDS

*** RDWRDS by JCM 1 Oct 86 ***

Classification:

CCSL Input/Output Routines . . . . . . . Utility

SUBROUTINE READMP

Reads into the array DENS a map previously written to file,
unformatted.

Prerequisite calls:

Assumes simply that NX by NY numbers have been written to unit IDUMPR

Common blocks used:

/MAPDA/ to use NX NY DENS
/MAPRD/ to use IDUMPR

*** READMP updated by JCM 22 Aug 86 ***

Classification:

Fourier Calculations . . . . . . . Crystallographic

SUBROUTINE READRT(IAT,IEND,NAME)

Reads whatever follows on a "W atom-name
ROT N" card .

Arguments:

On entry IAT indicates which is the atom (or the total number, if IEND
is -ve.

IEND points in ICARD to the next character to read
unless IEND is -ve, when it requests initialisation

IEND=-1 initialises the first IAT rotations
IEND=-2 initialises the IATth rotation to be a unit matrix
IEND=0 prints what has been read.
NAME is the name of the atom to which this rotation applies

Output:

If IAT=0 writes its finding on unit LPT.

Notes:

Now (C118) assumes a unit rotation matrix if none is given and one is required

Calls:

ERRCHK ERRMES GMEQ GMPRD GMUNI JGMZER NCFIND RDREAL RDWORD TRANSQ

Common blocks used:

/CELPAR/ to use ORTH
/IOUNIT/ to use LPT
/QROT/ to use all members
/SCRAT/ to use all members

*** READRT updated by PJB C118 Sept 2002 ***

Classification:

Magnetic Structure Factors . . . . . . . Setting Up

SUBROUTINE REAORB(CORB,ORB,KMAX)

To change the orbital basis from Ylm and Yl-m to (Ylm +- Yl-m).

Notes:

The basis functions Ylm+ and Ylm- are defined by 1/sqrt(2){Ylm +/- Y*lm]
Thus Ylm+ = 1/sqrt(2)[Ylm + (-1)**m(Yl-m)]
The matrices are stored with the lowest index corresponding to positive maximum m

Calls:

CGMPRD CGMZER MESS TRANSC

Called by:

MPCON

Common blocks used:

/IOUNIT/ to use LPT ITO IOUT

*** REAORB updated by PJB Apr 2003 ***

Classification:

Multipole Form Factors . . . . . . . Setting Up

LOGICAL FUNCTION REAPOL(H,POL,DPOL,MTYP,TEMP,
TITLE,LUNI)

Reads polarisations from the .pol file written by CRYPAD

Arguments:

On Entry LUNI is the logical unit to read from
On exit the components of input and output polarisation vectors are in POL
the esd's of the measured vector are in DPOL
MTYP = 1 fpr API: analyse input polarisation
MTYP = 2 fpr APO: analyse ioutput polarisation
TEMP is an ASCI string containing the measurement temperature
TITLE is an descriptive ASCI string

Description:

Returns TRUE if data were read, FALSE if end of file encountered.

Calls:

LENGT

Called by:

PALSQ

Common blocks used:

*** REAPOL put into LIB by PJB 18-Mar-1997 ***

Classification:

Data Collection and Reduction . . . . . . . Utility

SUBROUTINE RECELL(N,M)

Makes real or reciprocal space cell parameters from the others.

Arguments:

On entry:
N=1 means make real space parameters; N=2 reciprocal
M=1 means start from the 6 quadratic products in CPARS, A,B,C,D,E,F
if real or A*,B*,C*,D*,E*,F* if reciprocal. ( A=a squared, B=b squared, D=b c cos alpha, etc., and A*=a* squared, B*=b* squared, D*=b* c* cos alpha*, etc., where a,b,c, etc are the cell parameters in real space, a*,b*,c* etc are in reciprocal.

M=2 means start from cell parameters.

Description:

The remaining annotation assumes, for the sake of clarity, that N=1 and M=1.
Accepts in /CELPAR/ the 6 quadratic products A* B* C* D* E* F*;
Makes first the usual cell parameters a* b* c* alpa* beta* gamma*, then cos alpha*, cos beta*, cos gamma*. (join here if on entry M=2)
Makes sin alpha*, sin beta*, sin gamma*:
Then makes the 9 corresponding quantities in real space, a,b,c, cos alpha, cos beta, cos gamma, sin alpha, sin beta, sin gamma.
Makes the volumes of both real &$1;reciprocal cells in V(1) and V(2).
Now for entry M=1, we already have one set of quadratic products; make the other set, and for entry M=2, make both sets.
Finally forms the orthogonal matrices used in transformation of axes, by a call of ORTHG.
Called at end of RECIP (N=2,M=2), and at the end of a LSQ cycle which refines cell parameters (N=1,M=1)

Output:

Writes its findings on unit LPT.

Calls:

DEGREE ERRIN2 ERRMES ORTHG RECISD SINCOS

Called by:

APSHDS APSHSF APSHT2 RECIP

Common blocks used:

/CELFIX/ to use IPTCEL
/CELPAR/ to use CELL CPARS CELESD CELLSD SDCELL LSQCEL PRODSD
/IOUNIT/ to use LPT

*** RECELL updated by PJB 26-Aug-1998 ***

Classification:

Basic Crystallography . . . . . . . Crystallographic

SUBROUTINE RECIP

Reads the lattice parameters and forms the reciprocal cell.

Description:

The real cell parameters are read from the "C" card in the order a, b, c (in Angstroms) alpha, beta, gamma (in degrees).
The reciprocal cell parameters,cell volume and othogonal transformations are calculated.
Cell edges and angles which are fixed by symmetry need not be given on the "C" card . Redundant parameters at the right hand end of a card may be omitted. Those not at the end may be omitted, but a comma should be present to show that something was there.
E.g for a cubic cell: C 3.456
for a tetragonal cell: C 1.234 , 2.345 for a monoclinic cell: C 1.234 2.345 3.456 , 88.43

Redundant values may of course be present in the ordinary way, e.g. C 3.456 3.456 3.456 90 90 90
On exit, CELL() in COMMON /CELPAR/ contains a,b,c,cos(alpha,beta,gamma), sin(same),a*,b*,c*,cos(alpha*,beta*,gamma*), sin(same)
RECELL has been called to set up symmetry relations and orthogonal matrices and fill in CPARS

Output:

Write to unit LPT any constraints which the symmetry places on the real space cell parameters.

Calls:

ERRCH2 ERRMES INPUTC MESS RADIAN RECELL RECISD SYMOP

Called by:

SETDC SETFC SETFCM SETFOU ABSMSF AVEXAR BONDS EXTCAL FORFIG FOURPL INCMSF MMPLSQ MPLSQ

Common blocks used:

/CARDRC/ to use NYZ SDREAD
/CELFIX/ to use IPTCEL AMCELL
/CELPAR/ to use CELL SDCELL
/IOUNIT/ to use LPT

*** RECIP updated by PJB 26-Aug-1998 ***

Classification:

Basic Crystallography . . . . . . . Setting Up

SUBROUTINE RECISD(MODE)

Interprets a "C
S D" card and calculates ESD's in both the cell parameters and their quadratic products

Arguments:

On entry if MODE is 0 interprets a "C S D" card already read into
ICARD
if MODE is 1 expects RECIP to have finished stting up the
cell parameters, which are used to calculate the ESD's in both the cell parameters and their quadratic products.

Prerequisite calls:

SYMOP and RECIP before the call with MODE 1

Description:

The cell ESDs are placed in the diagonal elements of the matrices, CELLSD for the sides and angles, and CELESD(I,I,1) for the real space quadratic products
The locical SDCELL is set to true to indicate that cell esd's are available
PRODSD is true if the ESD's were given in the quadratic procucts
ie on a "C SD PROD ....." card

LSQCEL is true if the ESDs's have been inserted directly from a
least squares refinement.

Calls:

CELLMA ERRMES GMINV GMZER RDNUMS RDWORD

Called by:

RECELL RECIP

Common blocks used:

/CELFIX/ to use IPTCEL AMCELL
/CELPAR/ to use CELL CELESD CELLSD SDCELL LSQCEL PRODSD

*** RECISD new by PJB 26-Aug-1998 ***

Classification:

Basic Crystallography . . . . . . . Setting Up

SUBROUTINE REINDX(DPROP)

To reindex a set of reflections after a least squares cycle in
which the propagation vector changes

Arguments:

On entry DPROP(3) is the change in propagation vector

Calls:

GMADD GMSUB

Called by:

APSHDS

Common blocks used:

/REFLNS/ to use REFH KNOW ISMAG

*** REINDX updated by PJB 1 Feb 1994 ***

Classification:

General Least Squares Refinement . . . . . . . Crystallographic

SUBROUTINE REJECT(N,NEXT,LREJ,USE)

Decides for ARRNGE-type main programs whether the record number of
a reflection occurs in a list of those to be rejected.

Arguments:

On entry N is normally the number of the reflection to be tested.
but if negative indicates the setting up entry which opens the rejection list and reads the first entry.

NEXT should initially be set to zero; it should then be
preserved between entries.

LREJ is the number of the unit from which to read rejection
numbers.

On exit LOGICAL USE is TRUE if reflection number N is to be used.

Description:

Reads one integer at a time from unit LREJ. Takes a -ve integer to imply "all the numbers between the previous number and this one".

Notes:

N must be monotonic increasing.

Calls:

NOPFIL RDINTG

Called by:

ARRINC ARRNGE

Common blocks used:

/IOUNIT/ to use LPT
/SCRACH/ to use all members

*** REJECT corrected by PJB 22-June-95 ***

Classification:

Tests . . . . . . . Utility

SUBROUTINE RELATE

In LSQ programs, converts a vector of derivatives wrt variables
into the vector of derivatives wrt basic variables.

Prerequisite calls:

/DERVAR/ must hold NVARV derivatives of some calculated function wrt all variables, in DERIVV.
The constraint information must be set up in /CONSTR/ by a call of
VARMAK.

Description:

Applies the (strict) constraints to the vector DERIVV to convert it into a vector DERIVB in /DERBAS/, of LVARB derivatives of the same calculated function wrt basic variables.

Called by:

GEOMLS CHILSQ MAGLSQ MMPLSQ MPLSQ PALSQ SFLSQ SFTLSQ

Common blocks used:

/CONSTR/ to use JCONST JROWPT JCMAT AMOUNT
/DERBAS/ to use all members
/DERVAR/ to use all members
/POINTS/ to use LBSVR LRDVR
/REFINE/ to use SIMUL

*** RELATE updated by JCM 11 Aug 88 ***

Classification:

General Least Squares Refinement . . . . . . . Utility

SUBROUTINE RELCL6

Determines the constraint matrix for the cell quadratic products
needed for determining esd's of bond lengths and angles

Prerequisite calls:

RECIP to read the cell cards

Description:

On exit RCLMAT(I,J) in common CELFIX is a 6x6 matrix giving the projection of the parameters (I) on the basic variables (J). The rows of the matrix corresponding to redundant parameters should be zero

Calls:

GMZER JGMZER

Called by:

BONDS

Common blocks used:

/CELFIX/ to use IPTCEL AMCELL RCLMAT

*** RELCL6 new by PJB 26-Aug-1998 ***

Classification:

Crystal Geometry . . . . . . . Setting Up

SUBROUTINE RELMT3(IPFIX,APFIX,IOP,RLMAT)

Determines symmetry constraints in the calculation of the esd's of
bond lengths and angles

Arguments:

On entry IPFIX and APFIX are the relation and amount vectors for
an atomic position as used in LSQ.

IOP is the number of the symmetry operator which has been
applied to the atomic coordinates

On exit RLMAT(I,J) is a 3x3 matrix giving the projection of the coordinates

Prerequisite calls:

SYMOP to set up the symmetry operators

Description:

(I) on the parameters (J).

Notes:

The rows of the matrix corresponding to redundant parameters should be zero

Calls:

GMPRD GMREV GMZER JGMZER TRANSQ

Called by:

ANGERS BONERR

Common blocks used:

/SYMDA/ to use SYM

*** RELMT3 new by PJB 26-Aug-1998 ***

Classification:

Crystal Geometry . . . . . . . Crystallographic

SUBROUTINE RELMTX(RELMT1,RELMT2,IATS,NA)

Makes the matrix relating the coordinates of NA atoms, which may
or may not be equivalent to one-another, to a set of basic variables

Arguments:

On Entry RELMT1 contains the 3x3 matrices relating the coordinates
of each atom amongst themselves

IATS(NA) contins the numbers labelling the NA atoms

On exit RELMT2 is a 3NA x 3NA matrix relating the coordinates to the
variables

Notes:

There will be zero rows in RELMT2 corresponding to the redundant variables

Calls:

GMEQ GMZER

Called by:

ANGERS BONERR

*** RELMTX new by PJB 26-Aug-1998 ***

Classification:

Crystal Geometry . . . . . . . Crystallographic

SUBROUTINE RELPAR(N1,A1,N2,A2,NFIX,FIX)

In the setting up of LSQ applications, relates two parameters by
a simple linear relationship.

Arguments:

On entry N1 = the serial number of parameter 1 in the array NFIX
N2 = the serial number of parameter 2 in the array NFIX
A1 = a constant multiplier for parameter 1
A2 = a constant multiplier for parameter 2 the arrays NFIX and AFIX hold a (temporary) structure for chained parameters including the two given here. They could refer, e.g., to 3 atom position coordinates, or to 6 cell quadratic products.

Description:

RELPAR absorbs into NFIX and FIX the relation:
A1 x shift in parameter N1 = A2 x shift in parameter N2
dealing, if necessary, with any other similar relationships already present, by setting up chains.

Calls:

FIXPAR SCLCHN

Called by:

RELSM3 RELSM6

*** RELPAR by JCM 13 Jul 83 ***

Classification:

General Least Squares Refinement . . . . . . . Setting Up

SUBROUTINE RELPOS(IAT,NFIX3,FIX3)

Gets the constraints imposed by the symmetry on a set of atomic
positions.

Description:

Space group symmetry generated constraints are each between 2 parameters only, and refer to x, y, z coordinates

Calls:

FIXPAR GMEQ GMREV RELSM3

Called by:

ANGERS ATOPOS BONERR

Common blocks used:

/POSNS/ to use ISGEN
/SYMDA/ to use SYM

*** RELPOS by PJB 26-Aug-1998 ***

Classification:

Crystal Geometry . . . . . . . Crystallographic

SUBROUTINE RELSM3(R,NFIX,FIX)

Forms a complete set of relations imposed by symmetry on the given
3 parameters of a LSQ application.

Arguments:

On entry R holds a generalised symmetry rotation operator.
On exit arrays NFIX and FIX hold the relationships found.

Description:

Adds any found relationships to the general collection which will eventually be used by routine VARMAK.

Calls:

FIXPAR RELPAR

Called by:

F2RELA MAGCON PROPAG RELPOS XYZREL

Common blocks used:

/IOUNIT/ to use LPT ITO

*** RELSM3 updated by JCM 13 Feb 90 ***

Classification:

General Least Squares Refinement . . . . . . . Setting Up

SUBROUTINE RELSM6(R,NFIX,FIX)

Forms a complete set of relations imposed by symmetry on the given
6 parameters of a LSQ application.

Arguments:

On entry R holds a generalised symmetry rotation operator.
On exit arrays NFIX and FIX hold the relationships found.

Description:

Adds any found relationships to the general collection which will eventually be used by routine VARMAK.

Calls:

FIXPAR JFIX RELPAR

Called by:

DOCHI1 F2RELA SYMTID

Common blocks used:

/IOUNIT/ to use LPT ITO

*** RELSM6 updated by JCM 13 Feb 90 ***

Classification:

General Least Squares Refinement . . . . . . . Setting Up

SUBROUTINE RESHUF(A,IPT,N)

Reorders a real array, given a parallel pointer array out of
SORTX.

Arguments:

On entry A is a real array, of dimension at least N, of numbers
whose pointers have been sorted using SORTX.

IPT is an integer array, of dimension at least N, of pointers
within A, probably just produced by sorting with SORTX.

N is the number of entries in each of A and IPT.

On exit A contains the same numbers reordered according to the
pointers in IPT.

Called by:

SETFOU

Common blocks used:

/SCRAT/ to use all members

*** RESHUF by JCM 22 Aug 86 ***

Classification:

Miscellaneous . . . . . . . Utility

FUNCTION RESOL(H,D)

Calculates a resolution function for use with Fourier inversion.

Arguments:

On entry H(1:3) contains the indices h,k,l of a reflection.
D is the resolution length in Angstroms.

Prerequisite calls:

RECIP to set up the metric

Description:

The function value returned in RESOL multiplies the amplitude of the term corresponding to H in the Fourier sum. The result corresponds to averaging the density over a cube of edge 2D.

Calls:

ORTHO

Called by:

ERRMAP FOUR1D FOUR1Z FOURGP

Common blocks used:

/CONSTA/ to use TWOPI

*** RESOL by JCM 17 Apr 84 ***

Classification:

Fourier Calculations . . . . . . . Crystallographic

SUBROUTINE RFACS(IN)

A multiple entry routine to deal with all aspects of R Factor
calculations and statistics for single crystal observations, and

Arguments:

On entry, IN indicates the calculation required:
IN=1 Set up all quantities, clearing to zero
IN=2 Add in contributions for conventional Obs R Factors
IN=3 Print out for conventional Obs R Factors
IN=4 Add in contributions for slack constraint type ISLKTP in /SLAKDA/
IN=5 Print out for slack constraint, type ISLKTP
IN=6 Print out for both obs and slack constraints

Description:

If IWGHT=1 we expect that the weights are unity: we try to avoid unnecessary R factors in this case.
The R Factors are:
R1=simple R factor, 100*sum[ABS(diffs)]/sum[obs]
R2=squared R factor, 100*sum[ABS(obs sqrd - calc sqrd)]/sum[sqrd obs]
R3=simple weighted R factor,
1OO*sum[ABS(weighted(diffs))]/sum[weighted(obs)]

R4=Squared weighted R factor

Output:

For entries 3,5 and 6 prints R factors on unit LPT.

Calls:

ERRIN2 GMZER MESS TESTOV

Called by:

GEOMLS CHILSQ MAGLSQ MMPLSQ MPLSQ PALSQ SFLSQ SFTLSQ

Common blocks used:

/DERBAS/ to use LVARB
/IOUNIT/ to use LPT ITO
/OBSCAL/ to use OBS GCALC DIFF SUMWD NOBS WT CSQTOT
/REFINE/ to use IREF
/RSTATS/ to use RNUM RDEN RSNUM RSDEN RWNUM RWDEN RWSNUM RWSDEN
/SLAKDA/ to use NSLAK SLKSWD SLAKWT ISLKTP NSKTOT
/SLKGEO/ to use SLONLY

*** RFACS corrected by PJB 1-March-2001 ***

Classification:

General Least Squares Refinement . . . . . . . Crystallographic

FUNCTION RGAUSS(SIGMA)

Returns a value random number with a gaussian distribution.

Arguments:

On entry SIGMA gives the width if the dsitribution such that
p(x)=exp-(x/SIGMA)**2 if SIGMA=0 sets the seed for random number generation

Notes:

Uses the subprogram NB01A from the Harwell library.

Calls:

ERFNC ERRMES NB01A

Common blocks used:

/LENINT/ to use all members
/SEEDIT/ to use all members

*** RGAUSS by PJB 27-Sept-93 ***

Classification:

Mathematical Functions . . . . . . . Utility

SUBROUTINE ROTOSM(H,RH,IOP,ISS)

Calculates the effect of the rotation matrix of a symmetry
operator, on a vector given on orthogonal axes.

Arguments:

On entry H(1:3)is a real vector in standard orthogonal coordinates
IOP is the number of a symmetry operator, negative for one
related by a centre of symmetry to the stored one

ISS defines the mode of operation:

ISS = 0 Set-up by calculating the whole set of symmetry operations in
orthogonal co-ordinates

ISS > 0 Calculate the effect of the symmetry operator IOP.
ISS < 0 Calculate the effect of the inverse of the symmetry operator IOP.
On exit RH(1:3) is the vector obtained by operating with the
rotation matrix of the element IOP on H.

Prerequisite calls:

SYMOP and RECIP must have set up the symmetry and cell parameters.
ROTOSM must be called with ISS=0 before any other use is made of it

Description:

The call with ISS=0 sets the orthogonal symmetry elements into
COMMON /ORTSYM/

Notes:

ENTRY CROTO(CH,CRH,IOP,ISS) does the rotation for the complex vectors CH and CRH.
Note that in orthogonal coordinates there is no distinction between real and reciprocal space

Entries:

CROTO called by: FMCALC FMMPCA LMCALC LMMPCA

Calls:

CGMREV GMEQ GMPRD GMREV GMUNI RCMPRD TRANSQ

Called by:

FMCALC FMMPCA LMCALC LMMPCA CALQSF PALSQ

Common blocks used:

/CELPAR/ to use ORTH
/ORTSYM/ to use all members
/NSYM/ to use NOPC
/SYMDA/ to use SYM
/SYMTAB/ to use INVERS

*** ROTOSM corrected by PJB 2-Jan-96 ***

Classification:

Basic Crystallography . . . . . . . Crystallographic

SUBROUTINE ROTSYM(H,RH,IOP,ISS)

Rotates the vector H into RH by the given symmetry operator.

Arguments:

On entry H(1:3) is a 1x3 vector (in either space)
IOP is the serial number of a symmetry rotation matrix
ISS is positive for pre-multiplication by rotation matrix,
negative for post-multiplication the absolute value of ISS is 1 for real and 2 for reciprocal space

On exit RH(1:3) is the 1x3 vector resulting from multiplying H by
the rotation matrix as specified by ISS

Prerequisite calls:

SYMOP to set the symmetry matrices

Calls:

GMPRD

Called by:

ASUNIT ATOGEN ATOPOS BNDLST BONDER ERRMAP FCALC FCHALC FMCALC FMMPCA FMPCAL ISPABS KSTARS LFCALC LMCALC LMMPCA LMPCAL MAGCON MAGDOM MUCALC PROPER SATFND SATGEN SYMEQU SYMREF SYMUNI TRYUNI UNITID XROOT XTRANS ARRINC ARRNGE LCHALC GETMSF GETSFZ INCMSF MAG3D MG3DGL MVENTR

Common blocks used:

/SYMDA/ to use SYM
/SYMTAB/ to use INVERS

*** ROTSYM by JCM 11 Apr 83 ***

Classification:

Basic Crystallography . . . . . . . Crystallographic

SUBROUTINE RREFSF(LUNR,H,K,IEND)

A common interface for reading reflection data in structure factor
LSQ

Arguments:

On entry LUNR is the unit from which to read on exit H and K contain the reflection indices (floating and fixed)
IEND is true if EOF was encountered

Description:

The data read: OBS and possibly DOBS or WT, ISCALE,ICODE are placed in the common /OBSCAL/
The OBS stored is F if the refinement is on structure factors (IREF = 1) and Fsqr if it is on their squares (IREF = 2).
THE EXISTING OPTIONS FOR MOD(MODER,100) ARE:
MODER = 1 h,k,l,OBS,(SCALE GROUP), (CODE)
MODER = 2. h,k,l,OBS,WEIGHT, (SCALE GROUP), (CODE)
MODER = 3. h,k,l,OBS,STANDARD DEVIATION OF OBS, (SCALE GROUP),(CODE)
MODER = 4 h,k,l,GCAL,OBS,STANDARD DEVN.
MODER = 5 h,k,l,OBS,STD DEVN,C1 C2 C3 C4, where C1-C4 are the
constants involved in extinction corrections)

MODER = 6 h,k,l,ACALC,BCALC,OBS,STANDARD DEVN., (SCALE GROUP) (CODE)
MODER = 7 h,k,l (FLOATING) OBS,STD DEVN,(SCALE GROUP), (CODE)
MODER = 8 h,k,l(FLOATING),OBS,STD DEVN,C1 C2 C3 C4,(SCALE GROUP) where
C1-C4 are the constants involved in the extinction correction

MODER = 9 h,k,l,OBS,STD DEVN,CSQTOT,(SCALE GROUP), CSQTOT for flipping
ratio data is cossqr(rho).

MODER = 10 h,k,l,OBS,STD DEVN,CSQTOT,C1 C2 C3 C4,
where C1-C4 are the constants involved in the extinction correction

MODER = 11 h,k,l (floating), OBS,STD DEVN,CSQTOT, SCALE GROUP.
CSQTOT for flipping ratio data is cossqr(rho).

MODER = 12 h,k,l(floating),OBS,STD DEVN,CSQTOT,C1 C2 C3 C4,SCALE GROUP
where C1-C4 are the constants involved in the extinction correction

Both the scale group and code are optional. if the scale group is read as zero, it will be set = 1.
The code is not at present used; it is envisaged that it may be useful in rejecting selected observations.
If MODER > 100 then OBS and DOBS read are Intensities (Fsqr) otherwise they are structure amplitudes (F). The exception is when IREF is 5 in which case OBS and DOBS are flipping ratios.

Calls:

ERRIN2 INDFLO MESS QLSQIN

Called by:

INPLSF CHILSQ MAGLSQ MMPLSQ MPLSQ SFLSQ SFTLSQ

Common blocks used:

/EXTN/ to use CEXT
/IOUNIT/ to use LPT
/OBSCAL/ to use OBS ICODE WT CSQTOT
/REFINE/ to use IREF
/SCLDAT/ to use ISCALE NSCALE

*** RREFSF updated by PJB C134 5-Nov-2004 ***

Classification:

General Least Squares Refinement . . . . . . . Crystallographic

FUNCTION RSCALP(A,B)

Forms the scalar product of two COMPLEX vectors.

Arguments:

On entry A and B are complex vectors of dimension 3

Description:

The function value is the real product (A.Conjg(B) + Conjg(A).B)/2

Called by:

CALCMG CALPOL FCHALC FMCALC FMMPCA LMCALC LMMPCA LCHALC

*** RSCALP by PJB Jun 87 ***

Classification:

Matrices and Vectors . . . . . . . Utility


Contents Manual

P. Jane Brown e-mail: brown@ill.fr
Institut Laue Langevin,
Grenoble, FRANCE