Statistiques
| Révision :

root / src / Extrapol_cart.f90 @ 12

Historique | Voir | Annoter | Télécharger (12,03 ko)

1 1 pfleura2
SUBROUTINE Extrapol_cart(iopt,s,dist,x0,y0,z0,xgeom,Coef)
2 1 pfleura2
3 1 pfleura2
  ! This subroutine constructs the path, and if dist<>Infinity, it samples
4 1 pfleura2
  ! the path to obtain geometries.
5 1 pfleura2
  ! Basically, you call it twice: i) dist=infinity, it will calculate the length of the path
6 1 pfleura2
  ! ii) dist finite, it will give you the images you want along the path.
7 1 pfleura2
  !
8 1 pfleura2
  ! For now, it gives equidistant geometries
9 1 pfleura2
  !
10 1 pfleura2
11 12 pfleura2
!----------------------------------------------------------------------
12 12 pfleura2
!  Copyright 2003-2014 Ecole Normale Supérieure de Lyon,
13 12 pfleura2
!  Centre National de la Recherche Scientifique,
14 12 pfleura2
!  Université Claude Bernard Lyon 1. All rights reserved.
15 12 pfleura2
!
16 12 pfleura2
!  This work is registered with the Agency for the Protection of Programs
17 12 pfleura2
!  as IDDN.FR.001.100009.000.S.P.2014.000.30625
18 12 pfleura2
!
19 12 pfleura2
!  Authors: P. Fleurat-Lessard, P. Dayal
20 12 pfleura2
!  Contact: optnpath@gmail.com
21 12 pfleura2
!
22 12 pfleura2
! This file is part of "Opt'n Path".
23 12 pfleura2
!
24 12 pfleura2
!  "Opt'n Path" is free software: you can redistribute it and/or modify
25 12 pfleura2
!  it under the terms of the GNU Affero General Public License as
26 12 pfleura2
!  published by the Free Software Foundation, either version 3 of the License,
27 12 pfleura2
!  or (at your option) any later version.
28 12 pfleura2
!
29 12 pfleura2
!  "Opt'n Path" is distributed in the hope that it will be useful,
30 12 pfleura2
!  but WITHOUT ANY WARRANTY; without even the implied warranty of
31 12 pfleura2
!
32 12 pfleura2
!  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
33 12 pfleura2
!  GNU Affero General Public License for more details.
34 12 pfleura2
!
35 12 pfleura2
!  You should have received a copy of the GNU Affero General Public License
36 12 pfleura2
!  along with "Opt'n Path". If not, see <http://www.gnu.org/licenses/>.
37 12 pfleura2
!
38 12 pfleura2
! Contact The Office of Technology Licensing, valorisation@ens-lyon.fr,
39 12 pfleura2
! for commercial licensing opportunities.
40 12 pfleura2
!----------------------------------------------------------------------
41 12 pfleura2
42 1 pfleura2
  use Path_module
43 1 pfleura2
  use Io_module
44 1 pfleura2
45 1 pfleura2
46 1 pfleura2
  IMPLICIT NONE
47 1 pfleura2
48 1 pfleura2
49 1 pfleura2
  REAL(KREAL), INTENT(OUT) :: s
50 1 pfleura2
  ! X0(Nat),Y0(Nat),Z0(Nat): reference geometry.
51 1 pfleura2
  REAL(KREAL), INTENT(IN) :: dist,X0(Nat),Y0(Nat),Z0(Nat)
52 1 pfleura2
  REAL(KREAL), INTENT(IN) :: Xgeom(NGeomI),Coef(NGeomI,NCoord)
53 1 pfleura2
! Iopt: Number of the cycles for the optimization
54 1 pfleura2
  INTEGER(KINT), INTENT(IN) :: Iopt
55 2 pfleura2
  INTEGER(KINT) :: IdxGeom, I, J, K, Iat
56 1 pfleura2
! NSpline is the number of points along the interpolating path
57 1 pfleura2
  INTEGER(KINT) :: NSpline
58 1 pfleura2
! FileSpline: Filename to save the interpolating path coordinates
59 1 pfleura2
  CHARACTER(LCHARS) :: FileSpline,TmpChar
60 2 pfleura2
  REAL(KREAL) :: Rmsd, MRot(3, 3), ds, u
61 1 pfleura2
62 1 pfleura2
  REAL(KREAL), ALLOCATABLE :: XyzTmp(:,:), XyzTmp2(:,:) ! (Nat,3)
63 1 pfleura2
  REAL(KREAL), ALLOCATABLE :: DerXyz(:,:) ! Nat,3
64 1 pfleura2
65 1 pfleura2
66 1 pfleura2
  LOGICAL ::  debug, print, printspline
67 1 pfleura2
  LOGICAL, EXTERNAL :: valid
68 1 pfleura2
69 1 pfleura2
  !We will calculate the length of the path, in MW coordinates...
70 1 pfleura2
  ! this is done is a stupid way: we interpolate the zmatrix values,
71 1 pfleura2
  ! convert them into cartesian, weight the cartesian
72 1 pfleura2
  ! and calculate the evolution of the distance !
73 1 pfleura2
  ! We have to follow the same procedure for every geometry
74 1 pfleura2
  ! so even for the first one, we have to convert it from zmat
75 1 pfleura2
  ! to cartesian !
76 1 pfleura2
77 1 pfleura2
  debug=valid("pathcreate")
78 1 pfleura2
  print=valid("printgeom")
79 1 pfleura2
80 1 pfleura2
  printspline=(valid("printspline").AND.(dist<=1e30))
81 1 pfleura2
82 1 pfleura2
  if (debug) Call Header("Entering Extrapol_cart")
83 1 pfleura2
84 1 pfleura2
! We want 100 points along the interpolating path
85 1 pfleura2
  NSpline=int(NMaxPtPath/100)
86 1 pfleura2
87 1 pfleura2
  if (printspline) THEN
88 1 pfleura2
     WRITE(TmpChar,'(I5)') Iopt
89 1 pfleura2
     FileSpline=Trim(adjustL(PathName)) // '_spline.' // AdjustL(TRIM(TmpChar))
90 1 pfleura2
     OPEN(IOTMP,FILE=FileSpline)
91 1 pfleura2
92 1 pfleura2
  END IF
93 1 pfleura2
94 1 pfleura2
95 1 pfleura2
  ALLOCATE(XyzTmp(Nat,3),XyzTmp2(Nat,3),DerXyz(Nat,3))
96 1 pfleura2
97 1 pfleura2
! PFL 2011 June 22
98 1 pfleura2
! There was an alignment procedure there.
99 1 pfleura2
! It has been moved to PathCreate before the
100 1 pfleura2
! computation of the Spline coefficient.
101 1 pfleura2
102 5 pfleura2
     if (debug) THEN
103 5 pfleura2
        WRITE(*,*) "Extrapol_cart- L72 - geometries "
104 5 pfleura2
        DO I=1,NGeomI
105 5 pfleura2
           WRITE(*,*) "Geom  ",I
106 5 pfleura2
           DO J=1,Nat
107 5 pfleura2
              If (renum) THEN
108 5 pfleura2
                 Iat=Order(J)
109 5 pfleura2
                 WRITE(*,'(1X,A10,3(1X,F15.8),A)') Trim(AtName(J)),XyzGeomI(I,1:3,Iat)
110 5 pfleura2
              ELSE
111 5 pfleura2
                 Iat=OrderInv(J)
112 5 pfleura2
                 WRITE(*,'(1X,A10,3(1X,F15.8),A)') Trim(AtName(Iat)),XyzGeomI(I,1:3,J)
113 5 pfleura2
              END IF
114 5 pfleura2
           END DO
115 5 pfleura2
        END DO
116 5 pfleura2
     END IF
117 5 pfleura2
118 5 pfleura2
119 1 pfleura2
  XyzGeomF(1,:,:)=XyzGeomI(1,:,:)
120 1 pfleura2
121 1 pfleura2
122 1 pfleura2
  ! We initialize the first geometry
123 1 pfleura2
124 1 pfleura2
  XyzTmp=Reshape(XyzGeomI(1,:,:),(/Nat,3/),ORDER=(/2,1/))
125 1 pfleura2
126 1 pfleura2
127 1 pfleura2
128 1 pfleura2
  s=0.d0
129 1 pfleura2
  SGeom(1)=0.d0
130 1 pfleura2
131 1 pfleura2
  if (printspline) THEN
132 1 pfleura2
     u=0.d0
133 1 pfleura2
     DO Iat=1,Nat
134 1 pfleura2
        ! We generate the interpolated coordinates
135 1 pfleura2
        if (Linear) THEN
136 1 pfleura2
           call LinearInt(u,XyzTmp2(Iat,1),DerXyz(Iat,1),NGeomI,xgeom(1),XyzGeomI(1,1,Iat))
137 1 pfleura2
           call LinearInt(u,XyzTmp2(Iat,2),DerXyz(Iat,2),NGeomI,xgeom(1),XyzGeomI(1,2,Iat))
138 1 pfleura2
           call LinearInt(u,XyzTmp2(Iat,3),DerXyz(Iat,3),NGeomI,xgeom(1),XyzGeomI(1,3,Iat))
139 1 pfleura2
140 1 pfleura2
        ELSE
141 1 pfleura2
           call splintder(u,XyzTmp2(Iat,1),DerXyz(Iat,1),NGeomI,xgeom(1),XyzGeomI(1,1,Iat),Coef(1,3*Iat-2))
142 1 pfleura2
           call splintder(u,XyzTmp2(Iat,2),DerXyz(Iat,2),NGeomI,xgeom(1),XyzGeomI(1,2,Iat),Coef(1,3*Iat-1))
143 1 pfleura2
           call splintder(u,XyzTmp2(Iat,3),DerXyz(Iat,3),NGeomI,xgeom(1),XyzGeomI(1,3,Iat),Coef(1,3*Iat))
144 1 pfleura2
        END IF
145 1 pfleura2
     END DO
146 1 pfleura2
147 1 pfleura2
     WRITE(IOTMP,*) Nat
148 1 pfleura2
     WRITE(IOTMP,'(1X,A,1X,F15.6)') "Debug Spline - Coord=Cart,s=",s
149 1 pfleura2
     DO Iat=1,Nat
150 1 pfleura2
        WRITE(IOTMP,'(1X,A2,3(1X,F15.6))') Nom(Atome(Iat)),    &
151 1 pfleura2
                   (XyzTmp2(Iat,1:3))
152 1 pfleura2
     END DO
153 1 pfleura2
  END IF
154 1 pfleura2
155 1 pfleura2
 IdxGeom=1
156 1 pfleura2
157 1 pfleura2
  DO K=1,NMaxPtPath
158 1 pfleura2
     u=real(K)/NMaxPtPath*(NGeomI-1.)
159 1 pfleura2
160 1 pfleura2
     DO Iat=1,Nat
161 1 pfleura2
        ! We generate the interpolated coordinates
162 1 pfleura2
        if (Linear) THEN
163 1 pfleura2
           call LinearInt(u,XyzTmp2(Iat,1),DerXyz(Iat,1),NGeomI,xgeom(1),XyzGeomI(1,1,Iat))
164 1 pfleura2
           call LinearInt(u,XyzTmp2(Iat,2),DerXyz(Iat,2),NGeomI,xgeom(1),XyzGeomI(1,2,Iat))
165 1 pfleura2
           call LinearInt(u,XyzTmp2(Iat,3),DerXyz(Iat,3),NGeomI,xgeom(1),XyzGeomI(1,3,Iat))
166 1 pfleura2
167 1 pfleura2
        ELSE
168 1 pfleura2
           call splintder(u,XyzTmp2(Iat,1),DerXyz(Iat,1),NGeomI,xgeom(1),XyzGeomI(1,1,Iat),Coef(1,3*Iat-2))
169 1 pfleura2
           call splintder(u,XyzTmp2(Iat,2),DerXyz(Iat,2),NGeomI,xgeom(1),XyzGeomI(1,2,Iat),Coef(1,3*Iat-1))
170 1 pfleura2
           call splintder(u,XyzTmp2(Iat,3),DerXyz(Iat,3),NGeomI,xgeom(1),XyzGeomI(1,3,Iat),Coef(1,3*Iat))
171 1 pfleura2
        END IF
172 1 pfleura2
     END DO
173 1 pfleura2
174 1 pfleura2
175 1 pfleura2
! PFL 2011 June 22: We now align on the previous one
176 1 pfleura2
! as we do for internal coord interpolation
177 1 pfleura2
178 1 pfleura2
! We align this geometry with the previous one
179 1 pfleura2
180 1 pfleura2
  ! PFL 17/July/2006: only if we have more than 4 atoms.
181 1 pfleura2
!  IF (Nat.GT.4) THEN
182 1 pfleura2
! PFL 24 Nov 2008 ->
183 1 pfleura2
! If we have frozen atoms we align only those ones.
184 1 pfleura2
! PFL 8 Feb 2011 ->
185 1 pfleura2
! I add a flag to see if we should align or not.
186 1 pfleura2
! For small systems, it might be better to let the user align himself
187 1 pfleura2
      IF (Align) THEN
188 1 pfleura2
         if (NFroz.GT.0) THEN
189 1 pfleura2
            Call AlignPartial(Nat,                     &
190 1 pfleura2
                 xyzTmp(1,1),xyzTmp(1,2),xyzTMP(1,3),       &
191 1 pfleura2
                 xyzTmp2(1,1),xyzTmp2(1,2),xyzTMP2(1,3),       &
192 1 pfleura2
                 FrozAtoms,MRot)
193 1 pfleura2
         ELSE
194 1 pfleura2
            Call  CalcRmsd(Nat,                              &
195 1 pfleura2
                 xyzTmp(1,1),xyzTmp(1,2),xyzTMP(1,3),       &
196 1 pfleura2
                 xyzTmp2(1,1),xyzTmp2(1,2),xyzTMP2(1,3),       &
197 1 pfleura2
                 MRot,rmsd,.TRUE.,.TRUE.)
198 1 pfleura2
         END IF
199 1 pfleura2
! <- PFL 24 Nov 2008
200 1 pfleura2
      END IF
201 1 pfleura2
! -> PFL 8 Feb 2011
202 1 pfleura2
!  END IF
203 1 pfleura2
204 1 pfleura2
205 1 pfleura2
206 1 pfleura2
     ds=0.
207 1 pfleura2
     DO I=1,Nat
208 1 pfleura2
        DO J=1,3
209 1 pfleura2
           ds=ds+MassAt(I)*(XYZTMp2(I,J)-XYZTmp(I,J))**2
210 1 pfleura2
           XYZTmp(I,J)=XyzTMP2(I,J)
211 1 pfleura2
        ENDDO
212 1 pfleura2
     ENDDO
213 1 pfleura2
     s=s+sqrt(ds)
214 1 pfleura2
215 1 pfleura2
     !         if (debug) WRITE(*,*) "Debug u,s,dist",u,s,dist
216 1 pfleura2
217 1 pfleura2
  if ((printspline).AND.(MOD(K,NSpline).EQ.0)) THEN
218 1 pfleura2
     WRITE(IOTMP,*) Nat
219 1 pfleura2
     WRITE(IOTMP,'(1X,A,1X,F15.6)') "Debug Spline - Coord=Cart,s=",s
220 1 pfleura2
     DO Iat=1,Nat
221 1 pfleura2
        WRITE(IOTMP,'(1X,A2,3(1X,F15.6))') Nom(Atome(Iat)),    &
222 1 pfleura2
                   (XyzTmp2(Iat,1:3))
223 1 pfleura2
     END DO
224 1 pfleura2
  END IF
225 1 pfleura2
226 1 pfleura2
227 1 pfleura2
     if (s>=dist) THEN
228 1 pfleura2
229 1 pfleura2
        if (debug) THEN
230 1 pfleura2
           WRITE(*,*) "DBG Interpol_cart",s
231 1 pfleura2
           DO i=1,Nat
232 1 pfleura2
              WRITE(IOOUT,'(1X,A2,3(1X,F15.6))') Nom(Atome(I)),    &
233 1 pfleura2
                   (XyzTmp2(I,J),J=1,3)
234 1 pfleura2
           END DO
235 1 pfleura2
        END IF
236 1 pfleura2
237 1 pfleura2
        s=s-dist
238 1 pfleura2
        IdxGeom=IdxGeom+1
239 1 pfleura2
        SGeom(IdxGeom)=s+dist*(IdxGeom-1)
240 1 pfleura2
241 1 pfleura2
  ! We align this geometry with the original one
242 1 pfleura2
  ! PFL 17/July/2006: only if we have more than 4 atoms.
243 1 pfleura2
!  IF (Nat.GT.4) THEN
244 1 pfleura2
! PFL 24 Nov 2008 ->
245 1 pfleura2
! If we have frozen atoms we align only those ones.
246 1 pfleura2
! PFL 8 Feb 2011 ->
247 1 pfleura2
! I add a flag to see if we should align or not.
248 1 pfleura2
! For small systems, it might be better to let the user align himself
249 1 pfleura2
      IF (Align) THEN
250 1 pfleura2
         if (NFroz.GT.0) THEN
251 1 pfleura2
            Call AlignPartial(Nat,x0,y0,z0,                     &
252 1 pfleura2
                 xyzTmp2(1,1),xyzTmp2(1,2),xyzTMP2(1,3),       &
253 1 pfleura2
                 FrozAtoms,MRot)
254 1 pfleura2
         ELSE
255 1 pfleura2
            Call  CalcRmsd(Nat, x0,y0,z0,                              &
256 1 pfleura2
                 xyzTmp2(1,1),xyzTmp2(1,2),xyzTMP2(1,3),       &
257 1 pfleura2
                 MRot,rmsd,.TRUE.,.TRUE.)
258 1 pfleura2
         END IF
259 1 pfleura2
! <- PFL 24 Nov 2008
260 1 pfleura2
      END IF
261 1 pfleura2
! -> PFL 8 Feb 2011
262 1 pfleura2
!  END IF
263 1 pfleura2
264 1 pfleura2
        XyzGeomF(IdxGeom,:,:)=Reshape(XyzTmp2(:,:),(/3,Nat/),ORDER=(/2,1/))
265 1 pfleura2
        XyzTangent(IdxGeom,:)=Reshape(DerXyz(:,:),(/3*Nat/))
266 1 pfleura2
267 1 pfleura2
        if (print) THEN
268 1 pfleura2
           WRITE(IOOUT,'(1X,I5)') Nat
269 1 pfleura2
           WRITE(IOOUT,*) "# Cartesian coord for Geometry ",IdxGeom,K
270 1 pfleura2
271 1 pfleura2
           DO i=1,Nat
272 1 pfleura2
              WRITE(IOOUT,'(1X,A2,3(1X,F15.6))') Nom(Atome(I)),    &
273 1 pfleura2
                   (XyzTmp2(I,J),J=1,3)
274 1 pfleura2
           END DO
275 1 pfleura2
276 1 pfleura2
        END IF
277 1 pfleura2
     END IF  ! s>= dist
278 1 pfleura2
  ENDDO  ! K
279 1 pfleura2
280 1 pfleura2
281 1 pfleura2
  if (s>=0.9*dist) THEN
282 1 pfleura2
     s=s-dist
283 1 pfleura2
     XyzTmp2=Reshape(XyzGeomI(NGeomI,:,:),(/Nat,3/),ORDER=(/2,1/))
284 1 pfleura2
285 1 pfleura2
  if (printspline) THEN
286 1 pfleura2
     WRITE(IOTMP,*) Nat
287 1 pfleura2
     WRITE(IOTMP,*) "Debug Spline - Coord=Cart,s=",s
288 1 pfleura2
     DO Iat=1,Nat
289 1 pfleura2
        WRITE(IOTMP,'(1X,A2,3(1X,F15.6))') Nom(Atome(Iat)),    &
290 1 pfleura2
                   (XyzTmp2(Iat,1:3))
291 1 pfleura2
     END DO
292 1 pfleura2
  END IF
293 1 pfleura2
294 1 pfleura2
295 1 pfleura2
  ! We align this geometry with the original one
296 1 pfleura2
  ! PFL 17/July/2006: only if we have more than 4 atoms.
297 1 pfleura2
!  IF (Nat.GT.4) THEN
298 1 pfleura2
! PFL 24 Nov 2008 ->
299 1 pfleura2
! If we have frozen atoms we align only those ones.
300 1 pfleura2
! PFL 8 Feb 2011 ->
301 1 pfleura2
! I add a flag to see if we should align or not.
302 1 pfleura2
! For small systems, it might be better to let the user align himself
303 1 pfleura2
      IF (Align) THEN
304 1 pfleura2
         if (NFroz.GT.0) THEN
305 1 pfleura2
            Call AlignPartial(Nat,x0,y0,z0,                     &
306 1 pfleura2
                 xyzTmp2(1,1),xyzTmp2(1,2),xyzTMP2(1,3),       &
307 1 pfleura2
                 FrozAtoms,MRot)
308 1 pfleura2
         ELSE
309 1 pfleura2
            Call  CalcRmsd(Nat, x0,y0,z0,                              &
310 1 pfleura2
                 xyzTmp2(1,1),xyzTmp2(1,2),xyzTMP2(1,3),       &
311 1 pfleura2
                 MRot,rmsd,.TRUE.,.TRUE.)
312 1 pfleura2
         END IF
313 1 pfleura2
! <- PFL 24 Nov 2008
314 1 pfleura2
      END IF
315 1 pfleura2
! -> PFL 8 Feb 2011
316 1 pfleura2
!  END IF
317 1 pfleura2
318 1 pfleura2
     IdxGeom=IdxGeom+1
319 1 pfleura2
     SGeom(IdxGeom)=s+dist*(IdxGeom-1)
320 1 pfleura2
321 1 pfleura2
    IF (IdxGeom.GT.NGeomF) THEN
322 1 pfleura2
        WRITE(IOOUT,*) "!!! ERROR in Extrapol_cart !!!!"
323 1 pfleura2
        WRITE(IOOUT,*) "Too many structures. Increase NMaxPath"
324 1 pfleura2
        WRITE(*,*) "** PathCreate ***"
325 1 pfleura2
        WRITE(*,*) "Distribution of points along the path is wrong."
326 1 pfleura2
        WRITE(*,*) "Increase value of NMaxPtPath in the input file"
327 1 pfleura2
        WRITE(*,*) "Present value is:", NMaxPtPath
328 1 pfleura2
        STOP
329 1 pfleura2
     END IF
330 1 pfleura2
331 1 pfleura2
332 1 pfleura2
  ! We align this geometry with the original one
333 1 pfleura2
  ! PFL 17/July/2006: only if we have more than 4 atoms.
334 1 pfleura2
!  IF (Nat.GT.4) THEN
335 1 pfleura2
! PFL 24 Nov 2008 ->
336 1 pfleura2
! If we have frozen atoms we align only those ones.
337 1 pfleura2
! PFL 8 Feb 2011 ->
338 1 pfleura2
! I add a flag to see if we should align or not.
339 1 pfleura2
! For small systems, it might be better to let the user align himself
340 1 pfleura2
      IF (Align) THEN
341 1 pfleura2
         if (NFroz.GT.0) THEN
342 1 pfleura2
            Call AlignPartial(Nat,x0,y0,z0,                     &
343 1 pfleura2
                 xyzTmp2(1,1),xyzTmp2(1,2),xyzTMP2(1,3),       &
344 1 pfleura2
                 FrozAtoms,MRot)
345 1 pfleura2
         ELSE
346 1 pfleura2
            Call  CalcRmsd(Nat, x0,y0,z0,                              &
347 1 pfleura2
                 xyzTmp2(1,1),xyzTmp2(1,2),xyzTMP2(1,3),       &
348 1 pfleura2
                 MRot,rmsd,.TRUE.,.TRUE.)
349 1 pfleura2
         END IF
350 1 pfleura2
! <- PFL 24 Nov 2008
351 1 pfleura2
      END IF
352 1 pfleura2
! -> PFL 8 Feb 2011
353 1 pfleura2
!  END IF
354 1 pfleura2
355 1 pfleura2
     XyzGeomF(IdxGeom,:,:)=Reshape(XyzTmp2(:,:),(/3,Nat/),ORDER=(/2,1/))
356 1 pfleura2
     XyzTangent(IdxGeom,:)=Reshape(DerXyz(:,:),(/3*Nat/))
357 1 pfleura2
358 1 pfleura2
     if (print) THEN
359 1 pfleura2
        WRITE(IOOUT,'(1X,I5)') Nat
360 1 pfleura2
        WRITE(IOOUT,*) "# Cartesian coord for Geometry ",IdxGeom,K
361 1 pfleura2
362 1 pfleura2
        DO i=1,Nat
363 1 pfleura2
           WRITE(IOOUT,'(1X,A2,3(1X,F15.6))') Nom(Atome(I)),     &
364 1 pfleura2
                (XyzTmp2(I,J),J=1,3)
365 1 pfleura2
        END DO
366 1 pfleura2
     END IF
367 1 pfleura2
  END IF
368 1 pfleura2
369 1 pfleura2
  DEALLOCATE(XyzTmp,XyzTmp2)
370 1 pfleura2
371 1 pfleura2
  if (debug) WRITE(*,*) 's final =',s
372 1 pfleura2
373 1 pfleura2
  if (printspline) CLOSE(IOTMP)
374 1 pfleura2
375 1 pfleura2
  if (debug) Call Header("Extrapol_cart over")
376 1 pfleura2
377 1 pfleura2
END SUBROUTINE EXTRAPOL_CART