        PROGRAM lj7sc2
C CCC for LJ_7 potential N=21  CCCCCCCCCCCCCCCCCCCCCCCC
C
C W.Quapp  30.06.2004  for RGF=Newton Trajectory
C GS nach: Baron Peters et al. JCP 120 (2004) 7877-7886
c script version - modular structure 
c Projector
c
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
      REAL*8 Y(52,21),RsN,ProMat(21,21),Rs(21) 
      Integer N,J,L,JJ,LA,Lha,Lnum,I
       OPEN(9,FILE='lj7chain.dat') 
       OPEN(11,FILE='lj7param.dat',status='old') 
       OPEN(12,FILE='lj7proj.dat') 
       OPEN(44,FILE='protocol.txt',status='unknown',access='append')
c
c  Rs: search direction, first direction between minima
CC   2.version: new at every step, however: 
CC   only after L/2 steps, moderate ! adaption ! 
       N=21
       read(11,*) L, LA
       rewind 9
       Do 31, J=1,L
31     read(9,*) (Y(J,I),I=1,N)
c  projector direction: 
CC       Lha= L/2
       Lnum= 1
CC       IF(LA .gt. Lha) Lnum=LA-Lha
       Do 28 J=1,N
28     Rs(J)=Y(Lnum,J) - Y(L,J) 
c   Normierung
      RsN=0.0d0
      Do 32 J=1,N
32    RsN= RsN+ Rs(J)*Rs(J)
      RsN=DSQRT(RsN)
      Do 33 J=1,N    
33    Rs(J)=Rs(J)/RsN
C   Projektionsoperator
      Do 34 J=1,N
      Do 34 JJ=1,N
      ProMat(J,JJ)=0.0d0
34    Continue
      Do 35 J=1,N  
35    ProMat(J,J)=1.0d0  
      Do 36 J=1,N  
      Do 361 JJ=1,N  
      ProMat(J,JJ)= ProMat(J,JJ) - Rs(J)*Rs(JJ)
361   continue
36    continue
      rewind 12
      WRITE(44,*) ' projector '
      Do 37, J=1,N
      WRITE(44,*)(ProMat(J,I),I=1,N)
37    WRITE(12,*)(ProMat(J,I),I=1,N)
      close(44)
      Stop
      End
