FREE_R set
Pietro Roversi
pietro at mrc-lmb.cam.ac.uk
Fri Nov 13 04:46:37 EST 1998
This is a multi-part message in MIME format.
--------------7A7939828CC
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hongmin Li wrote:
>
> *** For details on how to be removed from this list visit the ***
> *** CCP4 home page http://www.dl.ac.uk/CCP/CCP4/main.html ***
>
> Experts,
>
> I am curious about generating Free_R flag for reflection files. I found that
> when I used X-PLOR setup_free_r.inp to generate free set, it seemed that the
> freeflag assignment was not random. Because when I run the script several times
> for the same beginning reflection file, the generated free sets were the same.
> I also use CCP4, and got the same results (get the same set for each run). Then
> my question is: is it really random to generate free set? I am thinking if it
> was really random, ench run should get different free set. Am I wrong?
>
> Thanks.
>
> Hongmin
Dear Hongmin,
I attach here a small fortran program and csh script that will move
around your FreeR_flags in an mtz file. Try:
1. f77 -L$CLIB FreeRjuggler.f -o ~/bin/FreeRjuggler -lccp4 -lm
2. chmod u+x FreeRjuggler.csh
Then if you have filename.mtz and p is the fraction used to generate
the FreeR_flags (0 < p < 1), go:
3. FreeRjuggler.csh filename p
If you repeat this 100*p times you will get back to your original set
of FreeR_flags.
Best wishes,
Pietro
--------------7A7939828CC
Content-Type: application/x-csh; name="FreeRjuggler.csh"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="FreeRjuggler.csh"
#!/bin/csh
#
# FreeRjuggler
# Move around FreeR_flags in an mtzfile
#
# $1 file name
# $2 <P> fraction used to generate Rfree_flags
#
ln -s $1.mtz FILEIN
if (-e $1.mtz ) then
~/bin/FreeRjuggler $2
mv -f FILEOUT $1.newRfree.mtz
rm -f FILEIN
else
echo 'Usage: FreeRjuggler.csh <file>.mtz <p>'
endif
exit
--------------7A7939828CC
Content-Type: text/plain; charset=us-ascii; name="FreeRjuggler.f"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="FreeRjuggler.f"
C ======================================================================--------
C
PROGRAM FREE R JUGGLER
C
C Small program to change all FreeR flags in an mtz file
C by just moving them one forward (and moving the n-th set into the 0th one).
C
C Accepts one argument, which is the percentage of data in free set
C as in rfreeflag and/or uniqueify
C
C E.g. 0.1 would mean that FreeR_flag is between 0 and 9
C
LOGICAL EOF ,
. FOUND
C
CHARACTER*30 LABELS ( 100 )
C
CHARACTER*1 TYPES ( 100 )
C
REAL CELL ( 6 ) ,
. ADATA ( 100 )
C
REAL SYM ( 4 , 4 , 96 )
REAL PERCENT
INTEGER MX RFREE, RFREE COL, IARGC
C
CHARACTER*80 EXTRA HIST
CHARACTER*5 PERCENT STRING
CHARACTER*10 SPGNAM ,
. PGNAME
CHARACTER*1 LATTICE
CHARACTER*100 ARG
C
C Initialize MTZ system
C
CALL MTZINI
EOF = .FALSE.
C
C Open MTZ file, for read
C
CALL LROPEN ( 1 , 'FILEIN' , 0 , IFAIL )
IF ( IFAIL .EQ. -1 ) THEN
WRITE (6,*) ' Problem with MTZ file : FILEIN '
STOP
END IF
C
C The command line argument governs the number of FreeR flags
C
if (iargc().eq.0) then
WRITE (6,*) ('usage: FreeRjuggler <p> ')
WRITE (6,*) ('Use default: <p>=0.1 ')
percent=0.1
MX RFREE = 10
else
C
C How many FreeR_flags?
C
call getarg(1,arg)
read(arg,*) percent
if ( (percent .ge. 1.0) .OR.
. (percent .le. 0.0) ) THEN
WRITE (6,*) 'nonsense: <p> >= 1'
else
MX RFREE = INT ( 100. * percent )
end if
end if
C
C Get the column labels from the file header
C
CALL LRCLAB ( 1 , LABELS , TYPES , NCOL IN )
C
C Which column are FreeRflags in?
C
R FREE COL = 0
DO I = 1, N COL IN
IF ( LABELS ( I )(1:10) .EQ. 'FreeR_flag' ) RFREE COL = I
END DO
IF ( R FREE COL .EQ. 0 ) WRITE (6,*) 'No FreeR flags found '
C
C Get cell and symmetry info from the file header
C
CALL LRCELL ( 1 , CELL )
CALL LRSYMI ( 1 , NSYMP , LATTICE , NUMSPG , SPGNAM , PGNAME )
CALL LRSYMM ( 1 , NSYM , SYM )
C
C Open MTZ file, for write
C
CALL LWOPEN ( 1 , 'FILEOUT' )
C
CALL LWCLAB ( 1 , LABELS , NCOL IN , TYPES , 0 )
C
C Write cell and symmetry info - same as input file.
C
CALL LWCELL ( 1 , CELL )
CALL LWSYMM ( 1 , NSYM , NSYMP , SYM , LATTICE ,
. NUMSPG , SPGNAM , PGNAME )
C
C Loop on reflexions: juggle around the FreeR_flag values
C
DO WHILE ( .NOT. EOF )
CALL LRREFL ( 1 , RESOL , ADATA , EOF )
ADATA (RFREE COL) =
. INT (AMOD ( ADATA (RFREE COL) + 1 , FLOAT ( MX RFREE ) ) )
IF ( .NOT. EOF ) CALL LWREFL ( 1 , ADATA )
END DO
C
C Keep track of this pass
C
WRITE ( EXTRA HIST , '(A)' )
. ' Program FreeRjuggler moved FreeR_flags around'
CALL LWHSTL (1, EXTRA HIST )
C
C Close MTZ files
C
CALL LRCLOS ( 1 )
CALL LWCLOS ( 1 , 0 )
C
STOP
END
--------------7A7939828CC--
More information about the X-plor
mailing list