        PROGRAM LJ7sc1 
C CCC for LJ potential  CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C (alte Vorlage: Stacho / Ban ... DDRP                 c
C  Computers Chem 17, No1 (1993) 21-25 )               c
C cccccccccccccccccccccccccccccccccccccccccccccccccccccc
C*********************************************************
C   for 7*3-dimensional version Lennard-Johns-Potential
C    --  the LJ routine is from D. Wales  
C   output in file lj7gs.weg, usable for Mathematica input
C   to visualize the calculated path 
C*********************************************************
C W.Quapp  30.06.2004  for RGF=Newton Trajectory       c 
C GS nach: Baron Peters et al. JCP 120 (2004)7877-7886 c 
c script version - modular structure of program        c
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C    eta:  Steplength or damping for projector
C    eps:  tolerance
C    L :   chain length, maximum 52 
C          are to defined by the user
C          nodes: L-2
C    N :   dimension of the problem
C          here N=21 given by the problem  
C    Y(L,N) are the chain nodes 
cccccccccccccccccccccccccccccccccccccccccccccccccccccccc
      REAL*8  Y(52,21),Yb(21),Ye(21)
      Integer L,N,J,I,LA,ITall
c 7: all points of chain for Mma output
       OPEN(7,FILE='lj7gs.weg')
       OPEN(17,FILE='lj7start.weg')        
c 77: all energy points  for Mma input
ccc       OPEN(77,FILE='lj7keten.weg')    
c 8,81: minima input
c min1, min2 
       OPEN(8,FILE='startLJ7.dat') 
       OPEN(81,FILE='endeLJ7.dat') 
cccccccccccccccccccccccccccccccccccccccc
c 9: all points of chain
       OPEN(9,FILE='lj7chain.dat') 
       OPEN(11,FILE='lj7param.dat') 
c        OPEN(12,FILE='lj7proj.dat') 
c 13 actual point X of GS iteration
       OPEN(13,FILE='lj7point.dat') 
c        OPEN(14,FILE='lj7ener.dat') 
c        OPEN(15,FILE='lj7grad.dat') 
       OPEN(44,FILE='protocol.txt',status='unknown',access='append')
C Constants           
        N=21 
        ETA=0.05d0
        eps=0.025d0
        L= 25
        ITall=0
c       PRINT*,'Give L where Nodes=L-2, Steplengt ETA, Threshold eps:'
c       READ(5,*) L, ETA, eps          
c
cccc      WRITE(77,*) ITall 
      PRINT*,' Chain from Min1 to Min2 for LJ7 ' 
c  Start - Kette  zwischen den Minima
      
      READ(8,*)  (Yb(I),I=1,21)
c      WRITE(6,22)(Yb(I),I=1,21)
      READ(81,*) (Ye(I),I=1,21)

      Do 1 J=1,L
      Do 1 I=1,N
c   first straigt chain between 2 Minima
      Y(J,I)= ((L-J)*Yb(I)+(J-1)*Ye(I))/(L-1)
 1    continue
      rewind 9
      WRITE(44,*) ' first point'      
      WRITE(44,*) (Y(1,I),I=1,N)
      Do 2, J=1,L
 2     WRITE(9,*) (Y(J,I),I=1,N)
c actual node is LA, node number is LA-1
c so, min1=Y_1, min_fin=Y_L 

      Do 6, J=1,L-1
      WRITE(17,22)(Y(J,I),I=1,21)
 6    continue        
      WRITE(17,21)(Y(L,I),I=1,21)

      LA=1
      rewind 13 
      WRITE(13,*)(Y(LA,I),I=1,N)
      WRITE(6,*)  L, LA, ETA, EPS, ITall, N 
      WRITE(44,*) L, LA, ETA, EPS, ITall, N
      rewind 11
      WRITE(11,*) L, LA, ETA, EPS, ITall, ITall
      close(44)

 22   FORMAT(3H { , 20(F13.9, 3H , ), F13.9, 3H }, )    
 21   FORMAT(3H { , 20(F13.9, 3H , ), F13.9, 3H }} )

      Stop
      End 
