-
Notifications
You must be signed in to change notification settings - Fork 0
/
Service.for
2093 lines (1797 loc) · 58.8 KB
/
Service.for
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
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
!-----------------------------------------------------------------------
! Normal Coordinate Analysis.
! General Library for All Programs.
!
! File : Service.for
! Date : 24 Jan 2020
! Size : 2069 Lines
!
! Copyright (C) 1983-2020 by Sergey V. Krasnoshchekov
! All rights reserved.
!-----------------------------------------------------------------------
!-----------------------------------------------------------------------
! Function: 'REALEX' FIRST: 22 Jan 2020 LAST EDIT: 18 Feb 2020
! +1.00*10^(-00)
! 1234567890123456
!-----------------------------------------------------------------------
CHARACTER*16 FUNCTION REALEX (RENU)
IMPLICIT REAL*16 (A-H,O-Z), INTEGER*4 (I-N)
CHARACTER* 1 IS
CHARACTER*16 OUTPUT
CHARACTER* 4 POWER
A0 = RENU
IF (A0 .EQ. 0.0D0) THEN
REALEX = ' 0.0 '
RETURN
ENDIF
A1 = ABS (RENU)
A2 = LOG10 (A1)
IX = INT (A2)
IF (A2 .LT. 0.0D0 .AND. A2 .NE. REAL(IX)) IX = IX - 1
IS = ' '; IF (A0 .LT. 0.0D0) IS = '-'
AM = A1 / (10.0D0 ** IX)
WRITE (FMT = 1100, UNIT = OUTPUT) RENU
IF (OUTPUT(13:13) .EQ. 'E') THEN
READ (FMT = "(I3)", UNIT = OUTPUT(14:16), ERR = 100) IX
ELSE
READ (FMT = "(I4)", UNIT = OUTPUT(13:16), ERR = 100) IX
ENDIF
IF (IX .EQ. 0) THEN
REALEX = ' ' // OUTPUT(1:5)
ELSE
WRITE (FMT = "(I4)", UNIT = POWER) IX
REALEX = ' ' // OUTPUT(1:5) // '*10^(' // POWER // ')'
ENDIF
GO TO 900
100 CONTINUE
!---- Possible Error Case: 9.999 >> 10.00
IF (IX .EQ. 0) THEN
WRITE (FMT = 1000, UNIT = REALEX) IS,AM
ELSE
WRITE (FMT = 1010, UNIT = REALEX) IS,AM,IX
ENDIF
1000 FORMAT (' ',A1,F4.2)
1010 FORMAT (' ',A1,F4.2,'*10^(',I4,')')
1100 FORMAT (ES16.9)
900 RETURN
END
SUBROUTINE TYPECONT
IMPLICIT REAL*16 (A-H,O-Z), INTEGER*4 (I-N)
CHARACTER* 1 LETTER
WRITE (*,1000)
1000 FORMAT (/'Type letter ''c'' to acknowledge and continue: '\)
READ (*,"(A1)") LETTER
IF (LETTER .EQ. 'c' .OR. LETTER .EQ. 'C') RETURN
STOP 'Fatal error.'
RETURN
END
!-----------------------------------------------------------------------
! Subroutine: 'TXPROC' FIRST: 28 Sep 2010 LAST EDIT: 15 Mar 2018
!
! PURPOSE:
! ...
!
! CALLED: MAIN (ANCO.for)
!
! CALLS: LENSTR ();
!
! INPUT:
! MODRUN -- >
! FILE_DAT >
!
! OUTPUT:
! FILE_DAT >
!
! NOTE(S):
! 1. 22-Dec-2015 : A list of file options from history added
!-----------------------------------------------------------------------
SUBROUTINE TXPROC (MODRUN,FILE_DAT)
IMPLICIT REAL*16 (A-H,O-Z), INTEGER*4 (I-N)
COMMON /IOLUN/ LOUT,NLOG,NINP,NOUT,NAUX,NSCR
COMMON /PATHS/ PATH_EXE,PATH_PRO,PATH_OUT,PATH_BIN
CHARACTER*64 PATH_EXE,PATH_PRO,PATH_OUT,PATH_BIN
CHARACTER*64 FILE_CFG,FILE_INP,FILE_DAT,FILE_LST,FILE_LOG
CHARACTER*64 FILE,FILE_DEF(0:8)
CHARACTER*80 LINE,INPUT
CHARACTER*32 SIGNATUR
CHARACTER* 4 EXTDAT,EXTLST,EXTLOG
CHARACTER* 4 CTRL
CHARACTER* 8 ANCO_def
LOGICAL AVAIL,DEFINED
DATA EXTDAT /'.DAT'/, EXTLST/'.TXT'/, EXTLOG/'.LOG'/
DATA ANCO_def /'ANCO.def'/ ! Located in PATH_EXE directory
DATA SIGNATUR /'// ANCO.def file, do not edit !'/
IF (MODRUN .EQ. 0) THEN
!---- Batch Mode
FILE = FILE_DAT
ELSE
!---- Console Mode
FILE_CFG = PATH_EXE(1 : LENSTR(PATH_EXE,64)) // ANCO_def
INQUIRE (FILE = FILE_CFG, EXIST = AVAIL)
DO 100 K = 0, 8
100 FILE_DEF(K) = ' '
IF (AVAIL) THEN
OPEN (UNIT = NAUX, FILE = FILE_CFG)
WRITE (*,1100)
M = 0
READ (NAUX, 2010, END = 120) LINE
IF (LINE(1:32) .NE. SIGNATUR) THEN
CLOSE (NAUX)
GO TO 140
ENDIF
DO 110 K = 1, 8
IF (EOF (NAUX)) EXIT
READ (NAUX, 2020, END = 120) FILE_DEF(K)
IF (FILE_DEF(K) .EQ. ' ') EXIT
WRITE (*,1110) K,FILE_DEF(K)
M = M + 1
110 CONTINUE
120 CLOSE (NAUX)
IOPTION = 0 ! User can enter text by mistake
WRITE (*,1120)
READ (*,"(A80)") INPUT
READ (UNIT = INPUT, FMT = "(I4)", ERR = 140) IOPTION
IF (IOPTION .EQ. 0) IOPTION = 1
DEFINED = .FALSE.
IF (IOPTION .GT. 0 .AND. IOPTION .LE. M) THEN
FILE = FILE_DEF(IOPTION)
WRITE (*,1140) FILE
DEFINED = .TRUE.
ENDIF
ELSE
WRITE (*,1150)
INPUT = ' '
DEFINED = .FALSE.
ENDIF
140 IF (.NOT. DEFINED) THEN
IF (INPUT .EQ. ' ' .OR. INPUT .EQ. '/') THEN
WRITE (*,1130)
READ (*,2020) FILE
ELSE
FILE = INPUT
ENDIF
IF (FILE .EQ. ' ') STOP 'Input data file must be specified.'
ENDIF
FILE_DEF(0) = FILE
OPEN (UNIT = NAUX, FILE = FILE_CFG)
WRITE (NAUX,"(A32)") SIGNATUR
WRITE (NAUX,2020) FILE_DEF(0)
M = 0
DO 160 K = 1, 8
DO 150 L = 0, K - 1
IF (FILE_DEF(K) .EQ. FILE_DEF(L)) GO TO 160
150 CONTINUE
WRITE (NAUX,2020) FILE_DEF(K)
M = M + 1
IF (M .EQ. 8) EXIT
160 CONTINUE ! GO TO
CLOSE (NAUX)
INQUIRE (FILE = FILE(1 : LENSTR(FILE,64)) // EXTDAT,
& EXIST = AVAIL)
IF (.NOT. AVAIL) STOP 'ANCO: Input data file does not exist.'
ENDIF
1100 FORMAT (/'The list of recently used input files (*.DAT):'/)
1110 FORMAT ('Option (',I1,') : ',A64)
1120 FORMAT (/'Enter option number or "/" to choose another file: '\)
1130 FORMAT (/'Type filename without extension *.DAT: '\)
1140 FORMAT (/'You have chosen the following input file: ',A64)
1150 FORMAT (/'Warning: ANCO.def does not exist, create a new one.')
!
!-----------------------------------------------------------------------
! Open input file 'FILE' and process it (remove ! and blanc lines):
!-----------------------------------------------------------------------
FILE_DAT = FILE
FILE_INP = PATH_EXE(1 : LENSTR(PATH_EXE,64)) //
& FILE(1 : LENSTR(FILE,64)) // EXTDAT
INQUIRE (FILE = FILE_INP, EXIST = AVAIL)
IF (AVAIL) THEN
OPEN (UNIT = NAUX, ACTION = 'READ', FILE = FILE_INP)
ELSE
WRITE (*,'(/2A)') 'File *.DAT does not exist: ', FILE_INP
STOP
END IF
FILE_LST = PATH_EXE(1 : LENSTR(PATH_EXE,64)) //
& FILE(1 : LENSTR(FILE,64)) // EXTLST
OPEN (UNIT = NOUT, ACTION = 'WRITE', FILE = FILE_LST)
DO WHILE (.NOT. EOF (NAUX))
READ (NAUX,2000) CTRL
IF (CTRL .EQ. 'ANCO') EXIT
ENDDO
FILE_LOG = PATH_EXE(1 : LENSTR(PATH_EXE,64)) //
& FILE(1 : LENSTR(FILE,64)) // EXTLOG
OPEN (UNIT = NLOG, ACTION = 'WRITE', STATUS = 'REPLACE',
& FILE = FILE_LOG)
WRITE (NLOG,1000)
IF (CTRL .NE. 'ANCO') CALL ERRMSG ('11',0)
OPEN (UNIT = NINP, STATUS = 'SCRATCH', FORM = 'FORMATTED')
WRITE (NLOG,1010)
DO WHILE (.NOT. EOF (NAUX))
READ (NAUX,2010) LINE
IF (.NOT. (LINE .EQ. ' ' .OR. LINE(1:1) .EQ. '!' .OR.
& LINE(1:1) .EQ. '*')) THEN
WRITE (NINP,2010) LINE
WRITE (NLOG,2010) LINE
ENDIF
IF (LINE(1:4) .EQ. 'STOP') EXIT
ENDDO
WRITE (NLOG,1020)
IF (LINE(1:4) .NE. 'STOP') CALL ERRMSG ('12',0)
CLOSE (NAUX)
ENDFILE (NINP)
REWIND (NINP)
RETURN
1000 FORMAT (/'ESSENTIAL DIAGNOSTICS EVENTS LOGFILE:--')
1010 FORMAT (/'[TXPROC]'//
& 'INPUT DATA FILE (WITH REMOVED COMMENT LINES):'//80('='))
1020 FORMAT (80('='))
2000 FORMAT (A4)
2010 FORMAT (A80)
2020 FORMAT (A64)
END
!-----------------------------------------------------------------------
! Subroutine: 'COUNTER' FIRST: 06 Sep 2011 LAST EDIT: 06 Sep 2011
!
! PURPOSE:
! Output to console the file number (four digits) or percentage of
! accomplished jobs (six characters: " 100 %").
!
! CALLED: COLLECT4 (Commute.for) ...
!
! INPUT:
! IERASE -- = 1, Erases previous data
! ICOUNT -- File number or percent of accomplished job
! IPERCENT = 1, percent sign printed
!
! NOTE(S):
! 1.
!-----------------------------------------------------------------------
SUBROUTINE COUNTER (IERASE,ICOUNT,IPERCENT)
IMPLICIT REAL*16 (A-H,O-Z), INTEGER*4 (I-N)
COMMON /ENVIRO/ IOPSYS,ISYST,MODRUN,IGAUS,IPROG
CHARACTER*8 DEL
DATA DEL /''/
IF (MODRUN .EQ. 0) RETURN
IF (IERASE .GT. 0) THEN
IF (IPERCENT .EQ. 0) THEN
WRITE (*,"(A4\)") DEL(1:4)
ELSE
WRITE (*,"(A6\)") DEL(1:6)
ENDIF
ENDIF
IF (ICOUNT .GE. 0) THEN
WRITE (*,"(I4\)") ICOUNT
IF (IPERCENT .GT. 0) WRITE (*,"(' %'\)")
ENDIF
RETURN
END
!-----------------------------------------------------------------------
! Subroutine: 'TIMDAT' PREV.: 15 Jul 2009 LAST EDIT: 20 Mar 2015
!
! PURPOSE:
! Prints current date and time to logical unit number LUNIT.
!
! CALLED: MAIN (ANCO.for), ??
!
! CALLS: GETTIM (), GETDAT (), FLTX ().
!
! INPUT:
! LUNIT -- Logical unit number for output device.
! = 0, Console output
!
! OUTPUT:
! No output variables.
!
! PRINTS:
! One line with current date and time.
!
! NOTE(S):
! 1. Uses platform-dependent routines GETTIM, GETDAT.
!-----------------------------------------------------------------------
SUBROUTINE TIMDAT (LUNIT)
IMPLICIT REAL*16 (A-H,O-Z), INTEGER*4 (I-N)
CHARACTER*1 HOUR(2),MINU(2),SECO(2),CENT(2)
CHARACTER*3 MONTH(12)
DATA MONTH/'Jan','Feb','Mar','Apr','May','Jun',
& 'Jul','Aug','Sep','Oct','Nov','Dec'/
CALL GETTIM (IHOUR,IMIN,ISEC,I100TH)
CALL GETDAT (IYEAR,IMON,IDAY)
CALL FLTX (IHOUR, HOUR)
CALL FLTX (IMIN, MINU)
CALL FLTX (ISEC, SECO)
CALL FLTX (I100TH,CENT)
IF (LUNIT .EQ. 0) THEN
WRITE (* ,1000) IDAY,MONTH(IMON),IYEAR,HOUR,MINU,SECO,CENT
ELSE
WRITE (LUNIT,1000) IDAY,MONTH(IMON),IYEAR,HOUR,MINU,SECO,CENT
ENDIF
RETURN
1000 FORMAT ('Date: ',I2,1X,A3,1X,I4,4X,'Time: ',
& 2(2A1,':'),2A1,'.',2A1)
END
!-----------------------------------------------------------------------
! Subroutine: 'WATCH' LAST EDIT: 14 Jun 2011
!
! PURPOSE:
! Returns current split time in 100th of second (from 00:00 a.m.)
!
! CALLED: MAIN (ANCO.for), ??
!
! CALLS: GETTIM (), GETDAT ();
!
! INPUT:
! No input variables.
!
! OUTPUT:
! ISPLIT -- Current split time in 100th of second (from 00:00 a.m.)
!
! NOTE(S):
! 1.
!-----------------------------------------------------------------------
SUBROUTINE WATCH (ISPLIT)
IMPLICIT REAL*16 (A-H,O-Z), INTEGER*4 (I-N)
CALL GETTIM (IHOUR,IMIN,ISEC,I100TH)
CALL GETDAT (IYEAR,IMON,IDAY)
ISPLIT = I100TH + 100 * (ISEC + 60 * (IMIN + 60 * IHOUR))
RETURN
END
!-----------------------------------------------------------------------
! Subroutine: 'WATCH1' LAST EDIT: 14 Jun 2011
!
! PURPOSE:
! Returns time passed from the previous call of WATCH (), broken
! down to hours, minutes, seconds and 100th parts of the second.
!
! CALLED: MAIN (ANCO.for), ??
!
! INPUT:
! ISPLIT0 -- The moment in the past, measured in 100th of a second
! since 00:00:00.00 of a day;
!
! OUTPUT:
! IThour -- The number of hours elapsed since ISPLIT0;
! ITmin -- The number of hours elapsed since ISPLIT0;
! ITsec -- The number of hours elapsed since ISPLIT0;
! IT100th -- The number of hours elapsed since ISPLIT0;
!
! NOTE(S):
!-----------------------------------------------------------------------
SUBROUTINE WATCH1 (ISPLIT0,IThour,ITmin,ITsec,IT100th)
IMPLICIT REAL*16 (A-H,O-Z), INTEGER*4 (I-N)
CALL GETTIM (IHOUR,IMIN,ISEC,I100TH)
CALL GETDAT (IYEAR,IMON,IDAY)
ISPLIT1 = I100TH + 100 * (ISEC + 60 * (IMIN + 60 * IHOUR))
IDIFF = ISPLIT1 - ISPLIT0
IF (IDIFF .LT. 0) IDIFF = IDIFF + 24 * 60 * 60 * 100
IT100th = MOD (IDIFF, 100)
ITsec = MOD (IDIFF / (100), 60)
ITmin = MOD (IDIFF / (60 * 100), 60)
IThour = IDIFF / (60 * 60 * 100)
RETURN
END
!-----------------------------------------------------------------------
! Subroutine: 'WATCH2' LAST EDIT: 14 Jun 2011
!
! PURPOSE:
! Outputs to console the time passed from the previous call of
! WATCH (), in format " done: 00:00:00.00".
!
! CALLED: MAIN (ANCO.for), ??
!
! INPUT:
! ISPLIT0--
!
! OUTPUT:
! No output variables.
!
! NOTE(S):
!-----------------------------------------------------------------------
SUBROUTINE WATCH2 (ISPLIT0)
IMPLICIT REAL*16 (A-H,O-Z), INTEGER*4 (I-N)
COMMON /IOLUN/ LOUT,NLOG,NINP,NOUT,NAUX,NSCR
CALL GETTIM (IHOUR,IMIN,ISEC,I100TH)
CALL GETDAT (IYEAR,IMON,IDAY)
ISPLIT1 = I100TH + 100 * (ISEC + 60 * (IMIN + 60 * IHOUR))
IDIFF = ISPLIT1 - ISPLIT0
IF (IDIFF .LT. 0) IDIFF = IDIFF + 24 * 60 * 60 * 100
IT100th = MOD (IDIFF, 100)
ITsec = MOD (IDIFF / 100 , 60)
ITmin = MOD (IDIFF / (60 * 100), 60)
IThour = IDIFF / (60 * 60 * 100)
WRITE (*,1000) IThour,ITmin,ITsec,IT100th
RETURN
1000 FORMAT (' done:',I3,':',I2.2,':',I2.2,'.',I2.2)
END
!-----------------------------------------------------------------------
! Subroutine: 'LWATCH' LAST EDIT: 28 Jun 2011
!
! PURPOSE:
! Returns current split time in 100th of second (from 00:00 a.m. of
! 1 January 2000)
!
! THEORY:
! There are 24h * 60min * 60sec * 100th = 8,640,000 units in 1 day
! Max INTEGER*4 Value = 2,147,483,647 units, = 248 days
! One year = 3,153,600,000
! Max INTEGER*8 Value = 9,223,372,036,854,775,807
!
! CALLED: MAIN (ANCO.for), ??
!
! CALLS: GETTIM ();
!
! INPUT:
! No input variables.
!
! OUTPUT:
! LSPLIT -- Current split time in 100th of second,
! (from 00:00 a.m. 1 January 2000)
!
! NOTE(S):
! 1.
!-----------------------------------------------------------------------
SUBROUTINE LWATCH (LSPLIT)
IMPLICIT REAL*16 (A-H,O-Z), INTEGER*4 (I-N)
COMMON /IOLUN/ IOUT,NLOG,NINP,NOUT,NAUX,NSCR
INTEGER*8 LSPLIT,LONGDAY
INTEGER*4 MONTHS(12)
DATA LONGDAY /8640000/
DATA MONTHS /31,28,31,30,31,30,31,31,30,31,30,31/
CALL GETDAT (IYEAR,MONTH,IDAY)
LSPLIT = 0
DO 110 I = 2011, IYEAR - 1
LSPLIT = LSPLIT + LONGDAY * 365
110 CONTINUE
DO 120 I = 1, MONTH - 1
LSPLIT = LSPLIT + LONGDAY * MONTHS(I)
120 CONTINUE
DO 130 I = 1, IDAY - 1
LSPLIT = LSPLIT + LONGDAY
130 CONTINUE
CALL GETTIM (IHOUR,IMIN,ISEC,I100TH)
LSPLIT = LSPLIT + I100TH + 100 * (ISEC + 60 * (IMIN + 60 * IHOUR))
I100 = MOD (LSPLIT, 100)
Isec = MOD (LSPLIT / 100, 60)
Imin = MOD (LSPLIT / (60 * 100), 60)
Ihour = MOD (LSPLIT / (60 * 60 * 100), 24)
Idays = LSPLIT / (24 * 60 * 60 * 100)
! WRITE (NOUT,1000) Idays,Ihour,Imin,Isec,I100
!1000 FORMAT (I8,'d',I2.2,'h',I2.2,'m',I2.2,'.',I2.2,'sec')
RETURN
END
!-----------------------------------------------------------------------
! Subroutine: 'LWATCHTX' LAST EDIT: 28 Jun 2011
!
! PURPOSE:
! Returns time passed from the previous call of WATCH (), broken
! down to hours, minutes, seconds and 100th parts of the second.
!
! NOTES:
! CHAR*16 1d00h00m00.00sec
!
! CALLED: MAIN (ANCO.for), ??
!
! INPUT:
! ISPLIT0--
!
! OUTPUT:
! TEXT -- "1d00h00m00.00sec" CHAR*16
!
! NOTE(S):
!-----------------------------------------------------------------------
SUBROUTINE LWATCHTX (LSPLIT0,TEXT)
IMPLICIT REAL*16 (A-H,O-Z), INTEGER*4 (I-N)
INTEGER*8 LSPLIT0,LSPLIT,LDIFF,LONGDAY
INTEGER*4 MONTHS(12)
CHARACTER*16 TEXT
DATA LONGDAY /8640000/
DATA MONTHS /31,28,31,30,31,30,31,31,30,31,30,31/
CALL GETDAT (IYEAR,MONTH,IDAY)
CALL GETTIM (IHOUR,IMIN,ISEC,I100TH)
LSPLIT = 0
DO 110 I = 2011, IYEAR - 1
LSPLIT = LSPLIT + LONGDAY * 365
110 CONTINUE
DO 120 I = 1, MONTH - 1
LSPLIT = LSPLIT + LONGDAY * MONTHS(I)
120 CONTINUE
DO 130 I = 1, IDAY - 1
LSPLIT = LSPLIT + LONGDAY
130 CONTINUE
LSPLIT = LSPLIT + I100TH + 100 * (ISEC + 60 * (IMIN + 60 * IHOUR))
LDIFF = LSPLIT - LSPLIT0
I100 = MOD (LDIFF, 100)
Isec = MOD (LDIFF / (100), 60)
Imin = MOD (LDIFF / (60 * 100), 60)
Ihour = MOD (LDIFF / (60 * 60 * 100), 24)
Idays = LDIFF / (24 * 60 * 60 * 100)
IF (Idays .GT. 0) THEN
WRITE (FMT = "(I1,'d',I2.2,'h',I2.2,1H',I2.2,'.',I2.2,'sec')",
& UNIT = TEXT, IOSTAT = IOS) Idays,Ihour,Imin,Isec,I100
ELSE
WRITE (FMT = "(I4,'h',I2.2,1H',I2.2,'.',I2.2,'sec')",
& UNIT = TEXT, IOSTAT = IOS) Ihour,Imin,Isec,I100
ENDIF
RETURN
END
!-----------------------------------------------------------------------
! Subroutine: 'NUMSTR' FIRST: 12 Mar 2010 LAST EDIT: 12 Mar 2010
!
! PURPOSE:
! ...
!
! CALLED: COMMUTE (Commute.for)
!
! INPUT:
! NUMBER --
!
! OUTPUT:
! NUMSTR --
!
! NOTE(S):
!-----------------------------------------------------------------------
CHARACTER*12 FUNCTION NUMSTR (NUMBER)
IMPLICIT REAL*16 (A-H,O-Z), INTEGER*4 (I-N)
IF (NUMBER .LT. 10**3) THEN
WRITE (FMT = "(I12)", UNIT = NUMSTR, IOSTAT = IOS) NUMBER
RETURN
ENDIF
I10E3 = MOD (NUMBER, 10**3)
I10E6 = MOD (NUMBER / 10**3, 1000)
IF (NUMBER .LT. 10**6) THEN
WRITE (FMT = "(I8,',',I3.03)", UNIT = NUMSTR, IOSTAT = IOS)
& I10E6,I10E3
RETURN
ENDIF
I10E9 = MOD (NUMBER / 10**6, 1000)
!---- Max INT*4 = 2147,483,647
WRITE (FMT = "(I4,2(',',I3.03))", UNIT = NUMSTR, IOSTAT = IOS)
& I10E9,I10E6,I10E3
RETURN
END
!-----------------------------------------------------------------------
! Subroutine: 'LNUMSTR' FIRST: 12 Mar 2010 LAST EDIT: 18 Mar 2014
!
! PURPOSE:
! CHARACTER*16 FUNCTION LNUMSTR (LONG)
! Original Terms
! 0001,000,000,000
!
! CALLED: COMMUTE (Commute.for)
!
! INPUT:
! NUMBER --
!
! OUTPUT:
! NUMSTR --
!
! NOTE(S):
!-----------------------------------------------------------------------
CHARACTER*16 FUNCTION LNUMSTR (LONG)
IMPLICIT REAL*16 (A-H,O-Z), INTEGER*4 (I-N)
INTEGER*8 LONG,L10E3,L10E6,L10E9,L10E12
IF (LONG .LT. 10 ** 3) THEN
WRITE (FMT = "(I16)", UNIT = LNUMSTR, IOSTAT = IOS) LONG
RETURN
ENDIF
L10E3 = MOD (LONG, 10**3)
L10E6 = MOD (LONG / 10**3, 1000)
L10E9 = MOD (LONG / 10**6, 1000)
L10E12 = MOD (LONG / 10**9, 1000)
IF (LONG .LT. 10 ** 6) THEN
WRITE (FMT = "(I12,',',I3.03)", UNIT = LNUMSTR, IOSTAT = IOS)
& L10E6,L10E3
RETURN
ENDIF
IF (LONG .LT. 10 ** 9) THEN
WRITE (FMT = "(I8,2(',',I3.03))", UNIT = LNUMSTR, IOSTAT = IOS)
& L10E9,L10E6,L10E3
RETURN
ENDIF
WRITE (FMT = "(I4,3(',',I3.03))", UNIT = LNUMSTR, IOSTAT = IOS)
& L10E12,L10E9,L10E6,L10E3
RETURN
END
!-----------------------------------------------------------------------
! Subroutine: 'INFORM' PREV.: 10 Sep 2007 LAST EDIT: 13 Jul 2009
!
! PURPOSE:
! Save information about the molecule in a file for inverse problem.
!
! CALLED: MAIN (ANCO.for)
!
! INPUT:
! MR --
! NS --
! NAT --
! ISA --
! ISOT --
! ATW --
! COR --
! T --
! F --
! ICR --
! ICLS --
! NINF -- Logical Unit Number (LUN) for formatted file output
! NAME -- Char*64 Text Identifier of the Molecule (Comment)
!
! OUTPUT:
! No output variables.
!
! FILE I/O:
! The only purpose of this routine is to write to LUN formatted
! data for subsequent solution of the inverse problem (SCAL).
!
! PRINTS:
! No information is printed.
!
! NOTE(S):
! 1.
!-----------------------------------------------------------------------
SUBROUTINE INFORM (MR,NS,NAT,ISA,ISOT,ATW,COR,T,F,
& ICR,ICLS,NINF,NAME)
IMPLICIT REAL*16 (A-H,O-Z), INTEGER*4 (I-N)
COMMON /IOLUN/ IOUT,NLOG,NINP,NOUT,NAUX,NSCR
COMMON /COOR/ NC1,NC2,NC3,NC4,NC5,IAC1,IAC2,IAC3,IAC4,IAC5
CHARACTER*64 NAME
CHARACTER*12 ICR(MR),ICLS(MR)
CHARACTER* 2 ISA(NAT)
DIMENSION IAC1(300,2),IAC2(300,3),IAC3(300,4),
& IAC4(300,4),IAC5(300,8)
DIMENSION ISOT(NAT),ATW(NAT),COR(3,NAT)
DIMENSION T(MR,MR),F(MR,MR)
DIMENSION C(300),IC(300)
DATA KEY /'INFO'/
WRITE (NINF,1000) KEY
WRITE (NINF,1010) NAME
WRITE (NINF,1020) NAT
DO 100 I = 1, NAT
100 WRITE (NINF,1030) I,ISA(I),ISOT(I),ATW(I),(COR(J,I),J=1,3)
WRITE (NINF,1040) NC1,NC2,NC3,NC4,NC5
K = 0
DO 110 I = 1, NC1
K = K + 1
WRITE (NINF,1100) K,ICR(K),(IAC1(I,J),J=1,2)
110 CONTINUE
DO 120 I = 1, NC2
K = K + 1
WRITE (NINF,1100) K,ICR(K),(IAC2(I,J),J=1,3)
120 CONTINUE
DO 130 I = 1, NC3
K = K + 1
WRITE (NINF,1100) K,ICR(K),(IAC3(I,J),J=1,4)
130 CONTINUE
DO 140 I = 1, NC4
K = K + 1
WRITE (NINF,1100) K,ICR(K),(IAC4(I,J),J=1,4)
140 CONTINUE
DO 150 I = 1, NC5
K = K + 1
WRITE (NINF,1100) K,ICR(K),(IAC5(I,J),J=1,8)
150 CONTINUE
WRITE (NINF,1200)
NRR = NC1 + NC2 + NC3 + NC4 + NC5
DO 210 J = 1, NS
K = 0
DO 200 I = 1, NRR
IF (T(I,J) .EQ. 0.0D0) CYCLE
K = K + 1
IC(K) = I
C(K) = T(I,J)
200 CONTINUE
K1 = MIN(K,3)
WRITE (NINF,1210) J,ICLS(J),(IC(I),C(I),I=1,K1)
IF (K .GT. 3) WRITE (NINF,1220) J,(IC(I),C(I),I=4,K)
210 CONTINUE
WRITE (NINF,1210) 0
WRITE (NINF,1300)
DO 300 I = 1, NS
300 WRITE (NINF,1310) I,(F(I,J),J=1,I)
RETURN
1000 FORMAT (A4,2X,'Generated file. Do not edit!')
1010 FORMAT (A64)
1020 FORMAT ('ATOM'/I4/'CART')
1030 FORMAT (I4,2X,A2,I4,4F16.8)
1040 FORMAT ('INTE'/5I4)
1100 FORMAT (I4,2X,A12,8I4)
1200 FORMAT ('TRAN')
1210 FORMAT (I4,2X,A12,2X,3(I4,F14.8))
1220 FORMAT (I4,15X,'X',3(I4,F14.8))
1300 FORMAT ('FORC')
1310 FORMAT (I4,6F12.8:/(4X,6F12.8))
END
!-----------------------------------------------------------------------
! Subroutine: 'OPTION' PREV.: 16 Aug 2009 LAST EDIT: 05 May 2013
!
! PURPOSE:
! Reads the sections of input file header concerning keys with
! integer values, (printing) options, parameters with real values.
!
! CALLED: MAIN (ANCO.for)
!
! INPUT:
! NOPT --
! NFLAG --
! KOPT --
! KFLAG --
! IDEFAU -- Default values for PARameters;
!
! OUTPUT:
! IOPT -- Array of options (integer values);
! IFLAG -- Array or flags (0, 1);
! IERR -- = 0 if successful, = 1, keyword was illegal.
!
! NOTE(S):
! 1.
!-----------------------------------------------------------------------
SUBROUTINE OPTION (NOPT,NFLAG,KOPT,KFLAG,IDEFAU,IOPT,IFLAG,IERR)
IMPLICIT REAL*16 (A-H,O-Z), INTEGER*4 (I-N)
COMMON /IOLUN/ IOUT,NLOG,NINP,NOUT,NAUX,NSCR
DIMENSION IOPT(9),IDEFAU(9),IFLAG(12)
CHARACTER* 4 KOPT(9),KFLAG(12)
CHARACTER* 4 WORD(12)
CHARACTER*80 LINE
DIMENSION IVALUE(9)
DO 100 I = 1, NOPT
100 IOPT(I) = IDEFAU(I)
READ (NINP,1000,ERR=810) (WORD(I),IVALUE(I),I=1,NOPT)
DO 130 I = 1, NOPT
IF (WORD(I) .EQ. ' ') EXIT
DO 110 J = 1, NOPT
IF (WORD(I) .EQ. KOPT(J)) GO TO 120
110 CONTINUE
GO TO 820
120 CONTINUE
IOPT(J) = IVALUE(I)
130 CONTINUE
DO 200 I = 1, NFLAG
200 IFLAG(I) = 0
READ (NINP,1010) (WORD(I),I=1,NFLAG)
DO 230 I = 1, NFLAG
IF (WORD(I) .EQ. ' ') EXIT
DO 210 J = 1, NFLAG
IF (WORD(I) .EQ. KFLAG(J)) GO TO 220
210 CONTINUE
GO TO 830
220 CONTINUE
IFLAG(J) = 1
230 CONTINUE
800 IERR = 0
GO TO 900
810 BACKSPACE (NINP)
READ (NINP,1100) LINE
WRITE (NOUT,1110) LINE
IERR = 1
GO TO 900
820 IERR = 2
GO TO 900
830 IERR = 3
900 RETURN
1000 FORMAT (9(A4,1X,I2,1X))
1010 FORMAT (12(A4,1X))
1100 FORMAT (A80)
1110 FORMAT (/'[OPTION] Erroneous Input Data Line:/'
& 'FORMAT (9(A4,1X,I2,1X)):'//A80)
END
!-----------------------------------------------------------------------
! Subroutine: 'MATOUT' PREV.: 20 May 2006 LAST EDIT: 12 Oct 2017
!
! PURPOSE:
! Prints lower triangle of a square symmetric matrix with 6 digits
! after decimal point.
!
! CALLED: MAIN (ANCO.for), UNIVERSAL.
!
! INPUT:
! MARR -- declared vertical dimension of a square matrix;
! NDIM -- actual dimension of a square matrix;
! A -- matrix to be printed;
! MODE -- = 0, print all-zero strings too;
! IACC -- Accracy: 1 = F12.4, 2 = F12.6, 3 = F12.8.
!
! NOTE(S):
! 1. 29/01/2010 --
! NCOL = 5, and 1100 FORMAT (I4,2X,5F14.8), same as MATOUTRE.
! 2. 05/10/2017 --
! Accuracy of float numbers added.
!-----------------------------------------------------------------------
SUBROUTINE MATOUT (MARR,NDIM,A,MODE,IACC)
IMPLICIT REAL*16 (A-H,O-Z), INTEGER*4 (I-N)
COMMON /IOLUN/ IOUT,NLOG,NINP,NOUT,NAUX,NSCR
DIMENSION A(MARR,NDIM)
CHARACTER*80 SPECI(3),SPECF(3)
LOGICAL OUTPUT
DATA NCOL /5/
DATA TOL /5.0D-9/
DATA SPECI /'(4X,5(I12,2X))','(4X,5(I12,2X))','(4X,5(I12,2X))'/
DATA SPECF /'(I4,2X,5F14.4)','(I4,2X,5F14.6)','(I4,2X,5F14.8)'/
N = (NDIM - 1) / NCOL + 1
DO 120 M = 1, N
K = NCOL * (M - 1) + 1
L = MIN0 (NCOL * M, NDIM)
WRITE (NOUT,SPECI(IACC)) (J, J = K, L)
DO 110 I = K, NDIM
OUTPUT = .FALSE.
IF (MODE .EQ. 0) OUTPUT = .TRUE.
DO 100 J = K, MIN0(I,L)
IF (ABS (A(I,J)) .GT. TOL) OUTPUT = .TRUE.
100 CONTINUE
IF (OUTPUT)
& WRITE (NOUT,SPECF(IACC)) I,(A(I,J),J=K,MIN0(I,L))
110 CONTINUE
120 CONTINUE
RETURN
END
!-----------------------------------------------------------------------
! Subroutine: 'MATOUTID' PREV.: 18 Feb 2003 LAST EDIT: 19 Oct 2017
!
! PURPOSE:
! Print square symmetric matrix with identifiers (CHAR*12).
!
! CALLED: MAIN (ANCO.for), ??
!
! INPUT:
! MARR -- Declared vertical dimension of a square array (A);
! A -- Square matrix to be printed;
! NR -- Actual dimension of a square matrix (A);
! NC -- Actual dimension of a square matrix (A);
! ID -- Char*12 Identifiers;
!
! NOTE(S):
! 1. The number of columns (NCOL) is an adjustable parameter.
!-----------------------------------------------------------------------
SUBROUTINE MATOUTID (MARR,NR,NC,A,ID)
IMPLICIT REAL*16 (A-H,O-Z), INTEGER*4 (I-N)
COMMON /IOLUN/ IOUT,NLOG,NINP,NOUT,NAUX,NSCR
DIMENSION A(MARR,NC)
CHARACTER*12 ID(NR)
DATA NCOL /5/
N = (NC - 1) / NCOL + 1
DO 110 M = 1, N
K = NCOL * (M - 1) + 1
L = MIN0 (NCOL * M, NC)
WRITE (NOUT,1000) (J,J=K,L)
DO 100 I = K, NR
WRITE (NOUT,1100) I,ID(I),(A(I,J),J=K,MIN0(I,L))
100 CONTINUE