1
c===========================================================================
3
c This file is part of TISEAN
5
c Copyright (c) 1998-2007 Rainer Hegger, Holger Kantz, Thomas Schreiber
7
c TISEAN is free software; you can redistribute it and/or modify
8
c it under the terms of the GNU General Public License as published by
9
c the Free Software Foundation; either version 2 of the License, or
10
c (at your option) any later version.
12
c TISEAN is distributed in the hope that it will be useful,
13
c but WITHOUT ANY WARRANTY; without even the implied warranty of
14
c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
c GNU General Public License for more details.
17
c You should have received a copy of the GNU General Public License
18
c along with TISEAN; if not, write to the Free Software
19
c Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
c===========================================================================
22
c locate unstable periodic points
23
c author T. Schreiber (1998)
24
c===========================================================================
25
c modified Piotr Held (2015)
26
c===========================================================================
27
c==== NOTE MUST BE COMPILED WITH flag -freal-4-real-8 ======
28
subroutine ts_upo(m_in, eps_in, frac,teq,tdis,h,
30
$ lines_read, in_out1, olens, orbit_data, sizedat,
33
c -- input declarations --
34
integer*4 m_in, iper, icen, lines_read, sizedat
35
real*8 eps_in, frac, teq, tdis, h, tacc
36
c the *_in is used because they need to be converted from double to float
38
real*8 in_out1(lines_read), orbit_data(sizedat)
39
real*8 acc(icen), stability(icen), olens(icen)
43
parameter(nx=1000000,mper=20)
45
c -- variable declarations --
57
c from old findupo() -- might cause problems
58
integer*4 info, nfev, ndum, itry, ior
63
real xp(mper),fvec(mper),xor(mper,nx)
64
real w0(mper,mper),w1(mper),w2(mper),w3(mper)
65
real w4(mper),w5(mper),w6(mper)
67
external peri, enorm, r1mach, snls1
69
c new for creating an output
70
integer*4 orbit_no, data_pos
73
c -- global variables --
77
common /period/ x, nmax, m, eps
79
c -- Assign input variables to program variables --
88
c -- Prepare the data --
89
call rms(nmax,x,sc,sd)
90
if(frac.gt.0) eps=sd*frac
92
if(tdis.lt.0.) tdis=eps
93
if(tacc.lt.0.) tacc=eps
96
c -- Prepare iterators for output --
100
c -- Exectute main program --
101
c old call findupo(iper,icen,teq,tdis,tacc,h,iunit,iverb)
102
if(iper.gt.mper) then
103
call xstopx ("findupo: make mper larger.")
109
c if(iv_10(iverb).eq.1) then
110
c if(mod(n,10).eq.0) write(istderr(),'(i7)') n
111
c else if(iv_100(iverb).eq.1) then
112
c if(mod(n,100).eq.0) write(istderr(),'(i7)') n
113
c else if(iv_1000(iverb).eq.1) then
114
c if(mod(n,1000).eq.0) write(istderr(),'(i7)') n
116
if(known(n,iper,teq).eq.1) goto 10
118
if(itry.gt.icen) goto 999
121
call snls1(peri,1,iper,iper,xp,fvec,w0,mper,tol,tol,0.,
122
. 20*(iper+1),0.,w1,1,100.,0,info,nfev,ndum,iw,w2,w3,w4,w5,w6)
124
if(info.eq.-1.or.info.eq.5.or.err.gt.tacc) goto 10 ! unsuccessfull
125
if(isold(iper,xp,ior,xor,tdis).eq.1) goto 10 ! already found
126
ior=ior+1 ! a new orbit
129
ipor=iperiod(iper,xp,tdis)
130
sor=real(ipor)*stab(iper,xp,h)/real(iper)
132
c old call print(iper,xp,ipor,sor,err,iunit,iverb)
133
orbit_no = orbit_no+1
134
olens(orbit_no+1) = ipor
135
acc(orbit_no+1) = err
136
stability(orbit_no+1) = exp(sor)
138
data_pos = data_pos + 1
139
orbit_data(data_pos+1) = xp(i)
143
c -- write lengths input arrays --
144
999 olens(1) = orbit_no
145
orbit_data(1) = data_pos
147
stability(1) = orbit_no
152
integer function known(n,iper,tol)
153
c return 1 if equivalent starting point has been tried
154
parameter(nx=1000000)
156
common /period/ x, nmax, m, eps
162
20 dis=dis+(x(n-iper+i)-x(nn-iper+i))**2
163
10 if(sqrt(dis).lt.tol) return
167
integer function isold(iper,xp,ior,xor,toler)
168
c determine if orbit is in data base
170
dimension xp(iper), xor(mper,*)
177
30 dor=dor+(xp(i)-xor(i,io))**2
178
20 if(sqrt(dor).le.toler) return
179
10 call oshift(iper,xp)
183
subroutine oshift(iper,xp)
184
c leftshift orbit circularly by one position
193
integer*4 function iperiod(iper,xp,tol)
194
c determine shortest subperiod
201
if(il.le.0) il=il+iper
202
20 dis=dis+(xp(i)-xp(il))**2
203
10 if(sqrt(dis).le.tol) return
206
subroutine peri(iflag,mf,iper,xp,fvec)
207
c built discrepancy vector (as called by snls1)
208
dimension xp(iper),fvec(mf)
211
fvec(ip)=xp(1)-fc(iper,xp,iflag)
212
10 call oshift(iper,xp)
215
function fc(iper,xp,iflag)
216
c predict (cyclic) point 1, using iper,iper-1...
217
parameter(nx=1000000)
220
common /period/ x, nmax, m, eps
230
20 dis=dis+(x(n-i)-xp(mod(m*iper-i,iper)+1))**2
239
if(abs(sw).le.1e-312) return ! fc undefined, stop minimising
244
real function stab(ilen,xp,h)
245
c compute cycle stability by iteration of a tiny perturbation
246
parameter(nx=1000000,mper=20,maxit=1000)
247
dimension xp(*), xcop(mper)
249
common /period/ x, nmax, m, eps
251
if(mper.lt.ilen) then
252
call xstopx ("stability: make mper larger.")
257
10 xcop(i)=xp(mod(i-1,ilen)+1)
262
if(iflag.eq.-1) goto 1
267
40 dis=dis+(xcop(i)-xp(mod(i-1,ilen)+1))**2
271
20 xcop(i)=xp(mod(i-1,ilen)+1)*(1-h/dis) + xcop(i)*h/dis
272
1 stab=stab/max(it-1,1)