                           KMATSUB_Cs/C2v



 KMATSUB deletes unwanted elements of K-matrices: its primary use 
 is to convert K-matrices calculated in Cs/C2v symmetry to C3v where 
 the latter is the natural symmetry of the system.
 This program works only for targets with an A1 ground state.

     !!! The current version is adapted to lmax=4 !!!

 It is intended to be a self contained module which can be
 run independantly from the main scattering calculation.
 On exit, IFAIL=0 indicates succesful termination, else IFAIL=1
     
      Input files:
        Channel and target data          (on unit LUCHNI)
        K-matrices                       (on unit LUKMTI)

      Output files:
        K-matrices                       (on unit LUKMTO)
        Channel and target data          (on unit LUCHNO)

      Namelist input /subKIN/

        NAME     C   60     
           ! title for any output  

        IEUNIT   I   1          1    [1,2]  
           ! units in which input scattering energies are input
                 1= Ryd, 2= eV

        ICFORM   C   1         'U'   ['U'|'F']
           ! format flag for channel dataset, 'F' for formatted, 'U' for
             unformatted

        IKFORM   C   1         'U'   ['U'|'F']
           ! Formatted/unformatted switch for unit LUKMT

        IPRNT    I   6          0    [0|1]
           ! Debug print switches :
             In each case -1 gives less than the default output and +1
             more than the default

        IWRITE   I   1          6    [1:]        
           ! logical unit for printed output

        LUCHNI   I   1         10    [1:]        
           ! logical units for input channel and target datasets
             as LUCHN1, LUCHN2, etc.

        LUCHNO   I   1         11    [1:]        
           ! logical unit for output channel and target datasets

        LUKMTI    I   1        19    [1:]
           ! logical units holding input K-matrices
             as LUKMT1, LUKMT2, etc.

        LUKMTO    I   1        13    [1:]
           ! logical units holding output K-matrices
             as LUKMT1, LUKMT2, etc. 

        LUCHANV   I  nsym         [nsym*10, nsym*19]
           ! vector containing the logical units for channel input 
             files            

        LUKMTV    I  nsym         [nsym*10, nsym*19]
           ! vector containing the logical units for channel input 
             files

        MAXI      I  1          1   [1,0]       
           ! label of highest initial state for which K-matrices
             are required
  
        MAXF      I  1          0   [1,0]
           ! label of highest final state for which K-matrices
             are required (it is assumed that MAXF.ge.MAXI)

        MAXVT     I  1
           ! size of the final C3v k-matrix 
           the default values are correct for l=4

        MREQ 
           ! required irreducible represenation of the C3v symmetry 
           =0 gives A1; =1 gives A2; =2 gives E (doubly degenerate)

        NCSETi   I  1           1  [1:] 
           ! set number of input channel data 


        NKSETi   I  1           1  [1:] 
           ! set number for K-matrix input 

        R        R  
           ! bond lengths of geometries to be used in adiabatic averaging

        EMIN
           ! minimum scattering energy required
 
        EMAX
           ! maximum scattering energy required
 
        EREQ     R   1         0.    [0.:MAXE]     
           ! required scattering energy 


  CHA1, NCHA2, NCHE are the number of C3v channels for each symmetry.
       

####################################################
Input example 1.

#...........................................    
# OUTER REGION BLOCK  1A"
#.........................................
cat > outer.f << EOF
      PROGRAM RMAT
      parameter (mwords=2)
      DATA IFAIL/0/
C
      CALL KMATSUB_Cs(IFAIL)
C
      STOP
      END
EOF
set +x
cat > outer.data << EOF
 &subKIN
  NAME='e-CF3:  A1 C3v K-matrices',
  ICFORM='F', IKFORM='F',
  luchanv=60,61,
  lukmtv=50,51,
  mreq=0, /
EOF
#
set -x
f95 -o outer outer.f /homes/iryna/DOC.progr/DCS-polyatom/K-matrix/kmatsub.cs.f /homes/iryna/DOC.progr/DCS-polyatom/K-matrix/kmatsub.c2v.f  -L/home/rmat/test/lib -louter -lnag || exit
#
cp 1Ap-kmatrix.dat fort.50  || exit
cp 1Adp-kmatrix.dat fort.51 || exit
cp 1Ap-channel.dat fort.60  || exit
cp 1Adp-channel.dat fort.61 || exit
#
outer < outer.data 
#
mv fort.13 1A1-kmatC3v.dat
#
exit  

####################################################



        