-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsp_psi.F
713 lines (636 loc) · 22.8 KB
/
sp_psi.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
!***********************************************************************
!
! AUSWERT subroutine sp_psi
!
! Converts a psi file from an MCTDH to an exact representation in a
! single point
! Emilio R.C. 11/2024
!***********************************************************************
program sp_psi
implicit none
#include "parameter.inc"
#include "global.inc"
#include "aglobal.inc"
#include "griddat.inc"
#include "psidef.inc"
#include "daten.inc"
#include "compdat.inc"
#include "compdat1.inc"
#include "channels.inc"
integer dynbytes(4),complexsize,realsize,integersize
integer ilbl,chkdvr,chkgrd,chkpsi,chkdat,chkprp,i
real*8 totmem,thrs
logical lerr,lascii,lrst,linwf,lwght
common /sp_psiin/ thrs,lascii,lrst,lwght
complex*16,allocatable :: mc(:)
complex*8 ,allocatable :: ms(:)
real*8 ,allocatable :: mr(:)
integer ,allocatable :: mi(:)
integer ,allocatable :: rint(:)
integer max_f, current_f, s,m,n,f
!-----------------------------------------------------------------------
! Initialize variables
!-----------------------------------------------------------------------
call default
call adefault
call alloc_ana(3,' ')
lascii=.false.
lwght=.false.
lrst=.false.
call sp_psiinput
!-----------------------------------------------------------------------
! Files to be read
!-----------------------------------------------------------------------
lrddvr=lpop2
!-----------------------------------------------------------------------
! Open log file channel
!-----------------------------------------------------------------------
open (ilog,file='sp_psi.log',form='formatted')
logisopen=.true.
!-----------------------------------------------------------------------
! set no. of comparison data sets
!-----------------------------------------------------------------------
ncomp=2
!-----------------------------------------------------------------------
! read data from psi file or rst
!-----------------------------------------------------------------------
chkdvr=1
chkgrd=1
chkpsi=1
chkdat=1
if (lrst) then
irst=ipsi
chkprp=0
call rstinfo(linwf,lerr,chkdvr,chkgrd,chkpsi,chkprp)
read(irst,err=998) tinit
else
read(ipsi) filever(ipsi)
call rdpsiinfo(ipsi,chkdvr,chkgrd,chkpsi,chkdat)
endif
if (psitype .eq. 1) then
routine='sp_psi'
message = 'Wavefunction already in exact representation'
call errormsg
endif
if (chkerr(1) .ne. 0) go to 999
!-----------------------------------------------------------------------
! read data from dvr file
!-----------------------------------------------------------------------
if(lort) then
open(idvr,file=dname(1:dlaenge)//'/dvr',form='unformatted',
+ status='old',err=997)
call dvrinfo(lerr,chkdvr)
if (lerr) then
write(6,*) ' Error reading: dvr'
stop
end if
close(idvr)
end if
!-----------------------------------------------------------------------
! save data as set 1
!-----------------------------------------------------------------------
call savecsys(1)
call savecpsi(1)
call savecdat(1)
!-----------------------------------------------------------------------
! set up and save exact psi information
!-----------------------------------------------------------------------
psitype=1
lpsiopt(1)=.false.
lpsiopt(2)=.false.
lpsiopt(3)=.false.
lpsiopt(4)=.false.
griddim=nstate
! Electronic basis: for exact, we always use multi-set (see
! EINSBAS). If the incoming WF is single-set, fix it.
if (feb.gt.0 .and. .not.lmult) then
lmult = .true.
leb = .false.
nstate = gdim(feb)
meb = dofspf(feb)
if (nspfdof(meb).eq.1) then
nmode = nmode-1
else
nspfdof(meb) = nspfdof(meb)-1
endif
endif
! call einexact
call griddat
call psidat
! complete spfdof information with koeff and eb dofs
fkoe=ndof+1
mkoe=nmode+1
if(feb.gt.0) then
meb=nmode+2 ! cf. HEINGABE
endif
dofspf(fkoe)=mkoe
spfdof(1,mkoe)=fkoe
if(feb.gt.0) then
dofspf(feb)=meb
spfdof(1,meb)=feb
nspfdof(meb)=1
endif
call savecsys(2)
call savecpsi(2)
call savecdat(2)
!-----------------------------------------------------------------------
! write exact psi information to new file
!-----------------------------------------------------------------------
if(.not.lascii) then
write(ipsi1) progver
call wrpsiinfo(ipsi1)
endif
!-----------------------------------------------------------------------
! assign pointers and sizes for required arrays
!-----------------------------------------------------------------------
lpsi=.true.
lpsigrd=.true.
ltrafo= lwght
lfft=.false.
! is any of the degrees of freedom of fft or expDVR type?
do f=1,ndof
if(basis(f).eq.4 .or. basis(f).eq.5) lfft=.true.
end do
call zeigausw
!-----------------------------------------------------------------------
! assign memory arrays
!-----------------------------------------------------------------------
call memausw
mrweight=mrdim
if(lwght) then
mrdim=mrweight+ortdim
else
mrdim=mrweight+1
endif
!-----------------------------------------------------------------------
! assign work arrays
!-----------------------------------------------------------------------
mrworkr = mrdim
mrdim = mrworkr+workrdim
miworki = midim
midim = miworki+workidim
msworks = msdim
msdim = msworks+worksdim
!-----------------------------------------------------------------------
! call conversion routine
!-----------------------------------------------------------------------
dynbytes(1) = complexsize()*(mcdim/8+1)
dynbytes(2) = realsize() *(mrdim/8+1)
dynbytes(3) = integersize()*(midim/8+1)
dynbytes(4) = (complexsize()/2)*(msdim/8+1)
ilbl=0
totmem=0.d0
do i=1,4
totmem=totmem+dynbytes(i)
if( dynbytes(i).lt.0 ) then
ilbl=1
totmem=totmem+4.294967296d+9
endif
enddo
totmem=totmem*8.d0
call wrversion(ilog)
write(ilog,'(a)') ' *** Memory allocated dynamically ***'
write(ilog,'(4(a,i12,/),a,f16.0,a,f11.2,a)')
+ ' complex*16 :', mcdim,
+ ' real*8 :', mrdim,
+ ' integer :', midim,
+ ' complex*8 :', msdim,
+ ' Total :',totmem,' Bytes ,',totmem/1048576.d0,' MB'
write(ilog,'(80a1,/)') ('-',i=1,80)
call myflush(ilog)
if(ilbl.gt.0) then
routine='sp_psi'
write(message,'(3a,f9.1,a)')
+ 'Integer overflow in memory assignment. ',
+ 'You are asking for too much memory. ',
+ 'Total Memory asked for =',totmem/1048576.d0,' MB'
call errormsg
endif
write(ilog,'(a,/25i4)') 'Order of DOFs in exact mode:',
+ (cspfdof(f,1,2),f=1,cnspfdof(1,2))
write(ilog,*)
allocate(mc(mcdim),ms(msdim),mr(mrdim),mi(midim))
c Read indexed from the CLI
c nmode is the number of mode combinations, but I want the
c number of primitive basis
! Count the number of DoFs without electronic DoFs
current_f = 0
max_f = 0
do s=1, nstate
do m=1, nmode
do n=1, nspfdof(m)
current_f = spfdof(n, m)
if (current_f > max_f) then
max_f = current_f
end if
enddo
enddo
enddo
write(6,*) "Enter the index/es for the ", max_f, "DOFs"
allocate(rint(max_f))
read(5,*) (rint(i), i=1,max_f)
do i=1, max_f
write(6,*) "Index for DOF", i, ":", rint(i)
enddo
!-----------------------------------------------------------------------
! recall psi data for length of arrays
!-----------------------------------------------------------------------
call getcpsi(1)
call subsp_psi(mc(mcpsi),ms(mspsi),rint,max_f,
+ mi(mijindx),cdgldim(2),mr(mrort),mr(mrweight),
+ mr(mrtrafo),mc(mcexphin),mc(mcrueck),mi(mifftfak))
stop
997 write(6,'(a,/a)') 'Cannot open dvr-file:',
+ dname(1:dlaenge)//'/dvr'
stop 1
998 continue
write(6,'(a)') 'Error reading time from restart-file.'
stop 1
999 continue
write(6,'(a)') 'Error reading psi-file.'
stop 1
end
!#######################################################################
!***********************************************************************
! calculates the exact wavefunction for a single point over time
!***********************************************************************
subroutine subsp_psi (psi,spsi,idxs,max_f,jindx,dgldim1,
+ ort,weight,trafo,exphin,rueck,fftfak)
implicit none
#include "parameter.inc"
#include "global.inc"
#include "aglobal.inc"
#include "griddat.inc"
#include "psidef.inc"
#include "daten.inc"
#include "channels.inc"
integer dgldim1,i,jindx(adim),d,iz,ndof1
integer fftfak(fftdim),idum(1),chkdvr,m,n,f,nmode1
integer igpoint(maxdim),findx(maxgdim)
integer max_f,s
integer idxs(max_f), state
real*8 rand_val
real*8 time,dt,trafo(dvrdim),rdum(1),ort(ortdim)
real*8 previous,now,spent,fcputime,fsystime,thrs
real*8 weight(ortdim)
complex*8 spsi(spsidim)
complex*16 psi(dgldim1)
complex*16 rueck(fftdim),exphin(expdim),zdum(1)
complex*16 psip(nstate) ! single point
character actual*80
external fcputime,fsystime
data previous /0.0d0/
save previous
logical lascii,lrst,lwght
common /sp_psiin/ thrs,lascii,lrst,lwght
!-----------------------------------------------------------------------
! read DVR data
!-----------------------------------------------------------------------
if(lort) then
chkdvr=1 ! dvrinfo read and stored in system data
dvrdata(1) = lort ! ort
dvrdata(2) = ltrafo ! trafo
dvrdata(11)= lfft ! exphin
dvrdata(6) = lfft ! rueck
dvrdata(7) = lfft ! fftfak
call rddvr(ort,trafo,rdum,rdum,zdum,rueck,fftfak,exphin,
+ zdum,idum,idum,rdum,chkdvr)
endif
call getcsys(1)
call getcpsi(1)
!-----------------------------------------------------------------------
! Determine DVR weights, if required. Note sqrt of weights is returned
!-----------------------------------------------------------------------
if(lwght) call getweight(trafo,weight,ort,.false.)
!-----------------------------------------------------------------------
! calculate time step for data
!-----------------------------------------------------------------------
iz = 0
dt = out2/fs*step
time = tinit/fs
! --- skip the first nskip WFs
do i=1,nskip
call rdpsi(ipsi,psi,spsi,jindx)
if (lend) goto 77
time=time + out2/fs
enddo
! --- Loop over wave functions
10 continue
!-------------------CALL PSI_P------------
call psi_sp(psip, spsi, idxs, max_f, lrst, ipsi)
!----------------------------------------
if (lend) goto 77
! determine actual time and CPU-time spent since last call
call fzeit(actual)
i = index(actual,':')
actual=actual(i-9:i+6)
now=fcputime(0)+fsystime(0)
spent=now-previous
previous=now
!----------------------------------------
write(ilog,'(a,f8.3,a,f15.1,f15.2,4x,a16)')
+ 'Writing WF : ',time,' fs, ',now,spent,actual
call myflush(ilog)
!----------------------------------------
write(6,*) ""
write(6,'(a,f8.3,a)') 'Time : ',time,' fs'
do s=1, nstate
write(6,*) 'The value of psi for state', s, "is", psip(s)
enddo
call getcsys(2)
call getcpsi(2)
! --- Handle multi-set electronic states
nmode1=nmode
if(nstate.gt.1 .and. lort) nmode1=nmode+1
! "coefficients"
if(lascii) then
write(ipsi1,'(1x/,a,f9.4,/)') '# Time =', time
write(ipsi1,'(a,8x,a,3x,a,4x,a,12x,55(a9,5x))')
+ '# Re(WF)','Im(WF)',' abs(WF)',' abs2(WF)',
+ (modelabel(i),i=1,max_f)
call initvxi(igpoint,maxdim) ! Set igpoint(i)=1
igpoint(1)=0
! --- determine set of grid-points
i=0
do m=1,nmode1
do n=1,nspfdof(m)
f=spfdof(n,m)
i=i+1
if (igpoint(i).lt.gdim(f)) then
igpoint(i)=igpoint(i)+1
goto 15
else
igpoint(i)=1
endif
enddo ! n=1,nspfdof(m)
enddo ! m=1,nmode1
15 continue
! --- remove weights from WF if required
if(lwght) then ! if(findx(i).ne.feb) then
do i=1,max_f
if(i .ne.feb) then
psip(2) = psip(2)/
+ weight(zort(i)+idxs(i)-1)
endif
enddo
endif
!-------------------------------------------------
! --- write WF and grid points
do state=1,nstate
write(ipsi1,996) psip(state),cdabs(psip(state)),
+ cdabs(psip(state))**2,
+ (ort(zort(i)+idxs(i)-1),i=1,max_f)
enddo
else ! not ascii
do state=1,nstate
write(ipsi1) psip(state),cdabs(psip(state)),
+ cdabs(psip(state))**2,
+ (ort(zort(i)+idxs(i)-1),i=1,max_f)
enddo
endif
time=time + dt
iz=iz+1
if(lrst) goto 77
if(iz.ge.ncut) goto 77
call getcsys(1)
call getcpsi(1)
!-----------------------------------------------------------------------
! if more data, go to beginning of loop
!-----------------------------------------------------------------------
do i=2,step
call rdpsi(ipsi,psi,spsi,jindx)
if (lend) goto 77
enddo
goto 10
77 continue
close(ipsi)
close(ipsi1)
return
991 format(6f13.8)
992 format(3(2f13.8,2x))
995 format(f17.12,1x,33f14.5)
996 format(2f14.8,2x,33f14.5)
end
!-----------------------------------------------------------------------
!***********************************************************************
!
! sp_psiINPUT
!
! get input parameters and file names for calculation
!
!-----------------------------------------------------------------------
subroutine sp_psiinput
implicit none
#include "parameter.inc"
#include "global.inc"
#include "aglobal.inc"
#include "griddat.inc"
#include "psidef.inc"
#include "daten.inc"
! #include "compdat.inc"
! #include "compdat1.inc"
#include "channels.inc"
integer iarg, myiargc, ierr,i
real*8 thrs
character*80 buf
character*(c5) filename
character*12 oformat
logical lfileout,lascii,lrst,lwght
common /sp_psiin/ thrs,lascii,lrst,lwght
!-----------------------------------------------------------------------
nskip=0
ncut = 999999
thrs=-1.d0
filein = './'
fileout = 'sp_psi.ex'
lfileout=.false.
iarg = myiargc()
if (iarg .lt. 1) goto 200
i = 0
100 i=i+1
call mygetarg(i,buf)
if( buf(1:1) .eq. '-' ) then
if( buf(1:3) .eq. '-f ' .or. buf(1:3) .eq. '-i ') then
i = i+1
call mygetarg(i,buf)
filein = buf
else if( buf(1:3) .eq. '-o ' ) then
i = i+1
call mygetarg(i,buf)
fileout = buf
lfileout=.true.
else if( buf(1:5) .eq. '-stp ' ) then
i = i+1
call mygetarg(i,buf)
read(buf,*,iostat=ierr) step
if (ierr .ne. 0 .or. step .le. 0) then
write(6,'(2a/,a)')
+ ' The argument following the option -n',
+ ' must be a positive integer. Not : ', buf
stop
end if
else if( buf(1:6) .eq. '-thrs ' ) then
i = i+1
call mygetarg(i,buf)
read(buf,*,iostat=ierr) thrs
if (ierr .ne. 0) then
write(6,'(2a/,a)')
+ ' The argument following the option -thrs',
+ ' must be a real number. Not : ', buf
stop
end if
else if( buf(1:3) .eq. '-n ') then
i = i+1
call mygetarg(i,buf)
read(buf,*,iostat=ierr) ncut
if (ierr .eq. 1) then
write(6,'(/a)') 'Cannot read argument of -n'
stop
endif
else if( buf(1:5) .eq. '-skip ') then
i = i+1
call mygetarg(i,buf)
read(buf,*,iostat=ierr) nskip
if (nskip .lt. 0) then
write(6,'(/a)')
+ 'Argument of -skip must be positive integer'
stop
endif
if (ierr .eq. 1) then
write(6,'(/a)') 'Cannot read argument of -skip'
stop
endif
else if( buf(1:3) .eq. '-w ' ) then
lovwr=.true.
else if( buf(1:4) .eq. '-W ' ) then
lwght=.true.
else if( buf(1:6) .eq. '-ort ' ) then
lort=.true.
lascii=.true.
else if( buf(1:6) .eq. '-ascii' ) then
lascii=.true.
else if( buf(1:6) .eq. '-rst ' ) then
lrst=.true.
else if( buf(1:3) .eq. '-h ' .or. buf(1:3) .eq. '-? ' ) then
write(6,'(78a1)') ('-',i=1,78)
write(6,'(1x,a,7(/10x,a))')
+ 'Purpose: Evaluates the wavefunction for a given set of ',
+ 'grid indices to numerically exact form. ',
+ 'To inspect the WF, the output may also be in ASCII format',
+ 'with or without printing coordinates (option -ort).',
+ 'Default is showing the "naked" DVR populations, but',
* 'DVR-weights can be removed from the WF by setting the ',
+ 'option -W (requires that -ort is also set). NB: -W does',
+ 'the opposite of -nw used in other analysis routines.'
write(6,'(/1x,2a,/19x,a)') 'Usage : sp_psi86 ',
+ '[-f -i -o -stp -n -skip -thrs -ort -ascii -W',
+ ' -rst -w -dp -ver -h -?]'
write(6,'(/,a)') 'Options : '
write(6,'(2a,/,9x,a)')
+ ' -f FILE : The wavefunction is read '
+ ,'from file FILE rather than from ./psi'
+ ,' The string FILE may be a relative or a full path-name.'
write(6,'(a)') ' -i FILE : Same as -f FILE.'
write(6,'(2a,/,11x,a)')
+ ' -o FILE : The output is written to file ',
+ 'FILE rather than to ./psi.ex',
+ 'The string FILE may be a relative or a full path-name.'
write(6,'(2a)')
+ ' -rst : A restart file rather than a psi file is read',
+ ' as input.'
write(6,'(2a)') ' -stp step: Compute the exact WF',
+ ' only every step-th output.'
write(6,'(2a)')
+ ' -n num : only the first num WFs are read '
+ ,' from psi-file.'
write(6,'(a)')
+ ' -skip m : the first m WFs are skipped.'
write(6,'(2a,/11x,a)')
+ ' -ort : The WF and their coordinates are written to',
+ ' output file.',
+ 'Note that -ort sets -ascii.'
write(6,'(a,/11x,a,/11x,a)')
+ ' -W : The DVR-weights are removed from the WF.',
+ 'Useful for plotting the WF.',
+ '-W requires that -ort is set, otherwise ignored.'
write(6,'(a,/11x,a)')
+ ' -thrs thrs : The WF and their coordinates are written',
+ 'only if(abs(WF).GT.thrs). Works only with -ort.'
write(6,'(2a,/11x,a,/11x,a)')
+ ' -ascii : The output file is in ascii rather than binary',
+ ' format.',
+ 'In this case the (dummy) A-vector and psiinfo',
+ 'are not written, i.e. the file contains the WF only.'
write(6,'(2a)')
+ ' -w : An existing output file is ',
+ 'overwritten.'
write(6,'(a)')
+ ' -ver : Version information about the program.'
write(6,'(a,/a)')
+ ' -h : Print this help text.',
+ ' -? : Print this help text.'
write(6,'(78a1)') ('-',i=1,78)
stop
else if( buf(1:4) .eq. '-ver' ) then
call wrversion(6)
stop
else
write(6,'(2a)') ' unknown option : ', buf
stop
end if
if (iarg .le. i) goto 200
goto 100
else
write(6,'(2a)') ' unknown argument : ', buf
stop
end if
200 continue
if(lwght.and. .not.lort) write(6,'(a)')
+ 'WARNING: Option -W is ignored because -ort is not set!'
lwght=lwght.and.lort
laein=index(filein,' ')-1
if(laein.gt.6) then
if (filein(laein-6:laein) .eq. 'restart' ) lrst = .true.
if (filein(laein-2:laein) .eq. 'psi' ) lrst = .false.
endif
if (filein(laein:laein) .eq. '/') then
if(lrst) then
irst = ipsi
filein = filein(1:laein)//'restart'
laein = laein + 7
else
filein = filein(1:laein)//'psi'
laein = laein + 3
endif
end if
call abspath(filein,laein)
laeout=index(fileout,' ')-1
call abspath(fileout,laeout)
!-----------------------------------------------------------------------
! Opening the files.
!-----------------------------------------------------------------------
write(6,'(80a)') ('*',i=1,80)
filename=filein(1:laein)
open(ipsi,file=filename,form='unformatted',status='old',
+ err=1000)
write(6,'(2a)') ' The inputfile is : ',filein(1:laein)
oformat='unformatted'
if(lascii) oformat='formatted'
filename=fileout(1:laeout)
if (lovwr) then
open (ipsi1,file=filename,form=oformat,status='unknown',
+ err=1000)
else
open (ipsi1,file=filename,form=oformat,status='new',
+ err=1010)
endif
write(6,'(2a)') ' The outputfile is : ',fileout(1:laeout)
write(6,'(2a)') ' The log file is : ./sp_psi.log'
return
1000 write(6,*)' Error opening file : '
write(6,*) filename
stop
1010 write(6,*)' File already exists: '
write(6,*) filename
stop
end