[CCP14 Home: (Frames | No Frames)]
CCP14 Mirrors: [UK] | [CA] | [US] | [AU]

(This Webpage Page in No Frames Mode)

CCP14

Methods, Problems and Solutions

TOF (Time of Flight) Neutron Diffraction Resources and Code

The CCP14 Homepage is at http://www.ccp14.ac.uk

[Back to Problems and Solutions]
[Neutron Scattering Lengths] | [Combined X-ray / Neutron Refinement] | [TOF (Time of Flight) Neutron Diffraction Resources and Code]

Index and Other Resource Pages


Coding in TOF Neutron Diffraction Code

Date: Mon, 20 Sep 1999 17:49:28 +0100 (BST)
From: Jon Wright [[email protected]]
To: RIETVELD_L Distribution List [[email protected]]
Subject: Re: RIET: TOF Neutron Web based programming resources?

Lachlan,

You can get hold of the freely available CCSL code from your site and
compile programs tf112m etc for doing TOF neutron Reitveld fits with
magnetism too! Compiles with the free g77 compiler after some minor
changes. All code is there, I have compiled and run it on a PC and
presented the ensuing results at IUCR and ECNS, although only one person
seemed to notice.

It is the old ral code from about 1995. Does pattern simulation as well as
refinement.

Cheers,

Jon


Refer Manual at POWDER DIFFRACTION AT ISIS:

Date: Tue, 21 Sep 1999 16:11:30 +0100 (BST)
From: Jon Wright [[email protected]]
To: Lachlan Cranswick 
cc: [email protected]
Subject: Re: RIET: TOF Neutron Web based programming resources?

On Tue, 21 Sep 1999, Lachlan Cranswick wrote:

> Hi Jon,
>
> Am starting a draft page on this at:
>     http://www.ccp14.ac.uk/solution/tofneutron/
>
> Would you be able to go into more detail on the location of the files
> and programs and the changes you made to get it to work on g77?
>
> Lachlan.
>

Here goes....  (procedure to compile tf12ls program for Reitveld
refinement of TOF data).

So.. Go to the ccp14 mirror page find "ccsl" and go to the ftp site:

Cambridge Crystallography Subroutine Library Documentation (CCSL)
   Original Site: ftp://ftp.ill.fr/pub/dif/CCSL/
   CCP14 Mirror:  http://www.ccp14.ac.uk/ccp/ccp14/ftp-mirror/ill-hewat/pub/dif/CCSL/

The files needed are ccsl.f, and
mistre.ss (and probably README and manual.tex) The mistre.ss file
contains all of the subroutines, and the ccsl program can extract the
routines from the library with whatever parameters a user wishes. This
allows you to redimension arrays across a large number of subroutines. It
also ensures all common blocks are identical across the library. I'm using
the egcs-1.1.2 release for mingw32, from Mumit Khans site on the PC I am
using today, although I think GCC-2.95 works too.


REFER:


To compile the ccsl program you need to edit it slightly, as described in
the source. Subroutine OPFILE (lines 976-1002) wants to end up only
containing: (Note this means losing the RECL and ACCESS statements.)       
      OPEN (N,FILE=FILNAM,STATUS=STAT)
      RETURN
      END
Also line 699 appears to need an alteration... from:
      IF ((LINE80(1:9) .NE. '      END') .OR. (LINEND(LINE80,1,80)
to:
      IF ((LINE80(1:9) .NE. 'C LEVEL') .OR. (LINEND(LINE80,1,80)
in order for the split part of the program to work? 

(eg: g77 ccsl.f -o ccsl)
Ignore the warnings. Then create a file ccslda.dat, as described in the
readme file. Using the ccsl mode of the program (so the first line of
ccslda.dat is CCSLA) you need to extract the lib, pr, pf and pma parts of
the code. Assuming the file mistre.ss sits in your current directory then
run ccsl and give the following responses:
l,ill,lib,mk4,mistre.ss,return,n,return

A file called libmk4.f should have been created. Repeat the above but
substituting pr etc for lib. This will get you the files prmk4, pfmk4 and
pmamk4.f

You then need to split these into individual subroutines (otherwise the
compiler gets really upset). I do this by creating a directory called lib
and putting a file in it called ccslda.dat containing:
SPLIT
..
MK4
LIB

Then cd into the lib directory and type ..\ccsl. Give the extension as
"for" and you will receive lots of fortran files. They can be compiled
with the following:
g77 -c -fno-globals -Wno-globals -finit-local-zero -fno-automatic *.for

The globals flags suppress warnings, the others suppress bugs, I think. It
will choke on nopfil.for - comment out lines 200-249 except for 242 and
243, the only open you want is:
      OPEN (UNIT=LUN,FILE=NAMFIL,ACCESS=FILACC(IA),FORM=FILFOR(IF),
     & STATUS=FILSTA(IS),ERR=52,IOSTAT=IOE)
Also initil.for needs changes. Either get rid of the call to time (line
239) or alter the mistre.ss file so that TIM is declared as an 8 member
array instead of 5 (you'll need to extract everything from the mistre.ss
again if you do this).
Also IPOPE.FOR needs a change. I use the following data statement to sort
out file opening errors (you can leave it alone and never overwrite old
files):
      DATA NERR,NSWI,IOS/3, 1,2,0,0, 2,128,126,127/

Repeat the process for the pr and pf sections of the library. eg.
directories pr and pf and change LIB to PR or PF in ccslda.dat. Changes
needed in order to compile are:
pr/rfacpr.for: Add declaration LOGICAL LATABS
pr/inrfpr.for: Alter to format statements on lines 396 and 397 as the
               compiler error message suggests.
pr/calprm.for: Add declaration LOGICAL LATABS

A library can then be created with: 
C:\ccp14>ar -ru libccsl.a lib\*.o pr\*.o pf\*.o
C:\ccp14>ranlib libccsl.a

Now alter ccslda.dat to contain: "GET,.,MK4,PMA" and run ccsl. Type tf12ls
then return and you should have a file tf12ls.got which contains the
source for this program. Rename it to tf12ls.f and edit it to avoid a g77
bug. It needs to contain....
      DIMENSION ALSQ(3000)
      CHARACTER *6 G77NAM
C%
C      MATSZ=%MATS%
      MATSZ=3000
      G77NAM='TF12LS'
      CALL FORTY(G77NAM,ALSQ,MATSZ,PCTF01,PFTF02,DUMMY,CALPR)

Essentially you can't pass 'TF12LS' as a literal into FORTY, although
you should be able to (Ken Shankland got me past this problem). Then
compile with the same flags as above and link with:
C:\ccp14>g77 -fno-globals -Wno-globals -finit-local-zero -fno-automatic 
tf12ls.o libccsl.a -o tf12ls

That's it!

I ran through this as I typed it and just tested it on some files from the
RAL vax cluster:
hrpd$disk0:[hrpd.calib]si_197.ccl
hrpd$disk0:[hrpd.calib]si_197.dat

It appears to work:
C:\ccp14>tf12ls
 Give name of Crystal data file si_197
 Give name of Observations file si_197
 >>> Starting cycle   1
 Chi squared =    1.1867 for  7093 observations and  16 basic variables
 >>> Starting cycle   2
 Chi squared =    1.1866 for  7093 observations and  16 basic variables
 >>> Starting cycle   3
 Chi squared =    1.1866 for  7093 observations and  16 basic variables
 Give name for New Crystal Data file si_197
 >>> Starting cycle   4
 Give name for File to output Profiles si_197
 Chi squared =    1.1866 for  7093 observations and  16 basic variables
 

Look at the manual which is linked to the hrpd web page for information on
running the program. Note that by extracting the library with the 'ill'
option it will always prefer files with extensions .cry for crystal data
files and new files will overwrite old ones. (The ral option chooses to
read .ccl files and write .ccn files). 

Using the GDB debugger is problematic - to get anywhere at all you cannot
open scratch files, so just remove the STATUS='SCRATCH' specifier in
NOPFIL. It's a bug in g77/gdb/windows - dunno which. Debugging is a pain
in general but adding -fdebug-kludge helps. 

Peak shapes and peakcentres are in the pf section, which is probably what
you are after. It's called pfcn03 and it gives an alternative chunk of 
source code the low angle asymetry described by Finger et al. Some of 
the programs also do Pawley fits. 

  TI: POWDER NEUTRON-DIFFRACTION STUDY OF ZEOLITE NA-ZK-4 - AN APPLICATION
      OF NEW FUNCTIONS FOR PEAK SHAPE AND ASYMMETRY
  AU: EDDY_MM, CHEETHAM_AK, DAVID_WIF
  NA: UNIV OXFORD,CHEM CRYSTALL LAB,9 PARKS RD,OXFORD OX1 3PD,ENGLAND
      RUTHERFORD APPLETON LAB,SCI & ENGN RES COUNCIL,DIDCOT OX11
      0QX,OXON,ENGLAND
  JN: ZEOLITES, 1986, Vol.6, No.6, pp.449-454
  IS: 0144-2449
  DT: Article

Best wishes,

Jon

============================================================================
         Dept. of Chemistry, Lensfield Road, Cambridge, CB2 1EW
   Phone-Office 01223 (3)36396; Lab 01223 (3)36305; Home 01223 740198

Available Software that can use/calculate TOF Neutron data.


Fullprof Rietveld - Juan Rodriguez-Carvajal and WinPlotr Interface - Thierry Roisnel

Fullprof 2000 download - CNRS, France (Fullprof 2k for Windows comes with a version of Winplotr, etc)


GSAS Rietveld/Structure Analysis System - Bob Von Dreele

ANSTO GUI LHPM-Rietica for Win32 Rietveld and Related Software - Brett Hunter

Prodd Rietveld - Jon Wright and Bruce Forsyth

Rietan Rietveld - Fujio Izumi's Web Site

F. J. Rotella, R. von Dreele et al. TOFLS - TOF Rietveld Code


[Back to Problems and Solutions]
[Neutron Scattering Lengths] | [Combined X-ray / Neutron Refinement] | [TOF (Time of Flight) Neutron Diffraction Resources and Code]

[CCP14 Home: (Frames | No Frames)]
CCP14 Mirrors: [UK] | [CA] | [US] | [AU]

(This Webpage Page in No Frames Mode)

If you have any queries or comments, please feel free to contact the CCP14