-
Notifications
You must be signed in to change notification settings - Fork 0
/
LCModel.f
15485 lines (15429 loc) · 611 KB
/
LCModel.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
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
c To Do:
c Check for '<<<<<<<<<<<<<<<'
C
C
C ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
PROGRAM LCMODL
C
Cvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv For user vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
C
C LCMODL. Automatic estimation of metabolite concentrations from in vivo NMR
C spectra.
C The data spectrum is analyzed as a linear combination from a basis
C set of model in vitro spectra, with automatic corrections for
C phase, field inhomogeneity, eddy currents, background, and
C differences in 1/T2.
C
C Author and Copyright: Stephen Provencher
C 48 Chancery Lane East
C Oakville, Ontario L6J 5P6
C Canada
C
C To use this program, you need the following references:
C S.W. Provencher (1993) Magn. Reson. Med. 30, 672-679.
C (1993--2012) LCModel Users Manual.
C
C The first reference above is referred to as simply "MRM" in the comment
C statements here.
C In general, the comment statements are mainly for my use. You need the
C User's Manual and MRM.
C Comment statements for you are set off by 2 comment lines, the top with a
C string of "v" characters and the bottom with a string of "^", both with
C "For user" in the middle (as these comments are). Comments for you occur
C only in subprograms MYCONT, MYDATA, and MYBASI.
C
C^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ For user ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
C
C Input:
C
C On unit LCONTR (must be standard input):
C NAMELIST LCMODL.
C
C On unit LBASIS (file FILBAS) (in subprogram MYBASI):
C NAMELIST BASIS1
C NAMELIST BASIS
C Frequency-domain basis spectra from zero-filling
C (2*NUNFIL=NDATA COMPLEX values).
C
C On unit LRAW (file FILRAW) (in subprogram MYDATA):
C NAMELIST NMID
C Time-domain data (NUNFIL COMPLEX values)
C
C If DOECC or DOWS or UNSUPR, on unit LH2O (file FILH2O) (in subprogram
c MYDATA):
C NAMELIST NMID
C Time-domain non-H2O-suppressed data
C
C
C Output:
C
C If LPRINT>0, on unit LPRINT (file FILPRI):
C Detailed output for printing.
C
C If LCOORD>0, on unit LCOORD (file FILCOO):
C Output for possible subsequent external plot program.
C
C If LCOraw>0, on unit LCoraw (file FILCOr):
C Output of RAW data, after ECC, *FCALIB*TRAMP/VOLUME, correction for
C BRUKER=T or SEQACQ=T; corrections for phase & referencing shift.
C
C If LPS>0, on unit LPS (file FILPS):
C .PS file for PostScript printer.
C
C If LTABLE>0, on unit LTABLE (file FILTAB):
C short .TABLE file, containing only the 4 tables from 1-page output.
C
C
C The fit is to the real part of the spectrum obtained with zero filling.
C The spectra are rearranged; therefore, the analysis also works for
C PPM>PPMCEN.
c Old grid positions + NUNFIL.
c Rearrangement in CFFT_r and DCFFT_r, but not in CFFT or CFFTIN (since
c BASISF is not rearranged)
c SEQACC = T not tested.
c Had to redefine INCDIM, DELPPM, and test for INITIA 3.
C
C Fortran 77 extensions: COMPLEX*16, INCLUDE, NAMELIST,
C (Obsolete) Sun version (marked ! followed directly by Sun): Time, date
C IRIX Version (marked ! followed directly by IRIX): READONLY, TIME, DATE,
C UNKNOWN, ZEXP
c ***************************************************************************
C markers preceded by a !
c =======================
C Cyg: (formerly Cygwin g77 version) Intel version for MS Windows. License
c tests are skipped. It is assumed that a HASP envelope protects it.
c sun: g77 Sun cross-compiler (important to only leave this not commented out;
C its preparation will only comment out Linux preceded by ! and could
c otherwise produce the statement twice. The others comment out all
C lines with ! string, except its own).
c IRIX: IRIX
c OSF: DEC Fortran
c Linux: g77 PC Linux
c ***************************************************************************
C Version-dependent parts are marked with C!!!!...
C
C Extra tests (COMMENTed out):
C !CT1: Checks (quadratic) convergence with exact data from previous fit
C when ISTAGE=1.
C !CT2: As !CT1, but for ISTAGE=2.
C
c LDUMP(1) = T to dump weights, etc, for phased-array averaging in AVERAGE.
c (2) = T to dump details of gaps and baseline regions on ppm-axis.
c (3) = T to dump compacted lines of CONTROL file.
c (4) = T & SUBBAS=T & NEACH=99 to dump ratios of peak areas to Concs to
c check normalization and scaling of simulated basis spectra.
c (5) = T to dump the real part of basis around WSPPM in AREABA.
c
INCLUDE 'lcmodel.inc'
external ilen
logical iok
data nanalyses_done/0/, nvoxels_done/0/, nvoxels_done_in/0/
chsubp = 'MAIN'
version_lcm = '6.3-1N'
lversion_lcm = ilen(version_lcm)
VERSIO='LCModel (Version ' // version_lcm(:lversion_lcm) //
1 ') Copyright: S.W. Provencher.' //
2 ' Ref.: Magn. Reson. Med. 30:672-679 (1993).'
C -------------------------------------------------------------------------
C Get changes to Control Variables.
C -------------------------------------------------------------------------
CALL MYCONT ()
C!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
c Uncomment the following to initialize license KEYs and other Control
c Parameters for Frahm.
c
c include 'frahm.inc'
c
C!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
C
C -------------------------------------------------------------------------
c Load ZERO_VOXEL array, which has values of T for zero voxels.
c Skip this if BASCAL=T.
C -------------------------------------------------------------------------
if (.not.bascal) then
call check_zero_voxels ()
C ----------------------------------------------------------------------
c IAVERG >= 1 to call AVERAGE to average series of "voxels" in CSI
c format in DATAT (as in phased-array or Philips or Elscint
c series of scans) and then set control parameters for
c single-voxel analysis.
C ----------------------------------------------------------------------
if (iaverg .ge. 1) call average ()
end if
if (lcsi_sav_1 .eq. 12) then
if (lcsi_sav_2 .ne. 13) go to 801
open (12, file=filcsi_sav_1, status='old', err=801)
open (13, file=filcsi_sav_2, status='old', err=801)
read (12, 5030, err=801, end=801) nvoxels_done, nanalyses_done,
1 ioffset_current
5030 format (3i5)
nvoxels_done_in = nvoxels_done
ioffset_current_in = ioffset_current
if (nanalyses_done .gt. 0) read (12, 5040, err=801, end=40)
1 degppm, degzer, dgppmn, dgppmx,
2 sddegp, sddegz, shifmn, shifmx
5040 format (1p5e16.6)
else
nxoxels_done_in = 0
nanalyses_done = 0
ioffset_current_in = 0
end if
40 IF (Lcsv .GT. 0 .and. FILcsv .NE. ' ') then
if (nanalyses_done .le. 0) then
OPEN (Lcsv, FILE=FILcsv, STATUS='UNKNOWN', err=802)
else
OPEN (Lcsv, FILE=FILcsv, STATUS='OLD', err=802)
do 30 jline = 1, 9999
5020 format (a)
read (lcsv, 5020, err=803, end=35) chline
30 continue
35 backspace lcsv
go to 50
end if
end if
C -------------------------------------------------------------------------
C Main loop for all analyses of all voxels.
c Dimensions ND* I* have been checked and ordered in MYCONT
c Round up or down to put i*_center closest to the overall center.
C -------------------------------------------------------------------------
50 center_whole = float(ndrows + 1) / 2.
i1 = (irowst + irowen) / 2
i2 = (irowst + irowen + 1) / 2
if (abs(float(i1) - center_whole) .lt.
1 abs(float(i2) - center_whole)) then
irow_center = i1
else
irow_center = i2
end if
center_whole = float(ndcols + 1) / 2.
i1 = (icolst + icolen) / 2
i2 = (icolst + icolen + 1) / 2
if (abs(float(i1) - center_whole) .lt.
1 abs(float(i2) - center_whole)) then
icol_center = i1
else
icol_center = i2
end if
single_voxel = max0(ndslic, ndrows, ndcols) .eq. 1
noffset = max0(irowen - irow_center, irow_center - irowst,
1 icolen - icol_center, icol_center - icolst)
C -------------------------------------------------------------------------
c If there is only one voxel (NOFFSET=0), then force an analysis by
c setting ZERO_VOXEL(1)=F (and let LCModel abort if only voxel really
c is zero).
C -------------------------------------------------------------------------
if (noffset .le. 0) zero_voxel(1) = .false.
voxel1 = .true.
do 100 ioffset = ioffset_current_in, noffset
if (.not. voxel1) then
rewind lraw
lraw_at_top = .true.
IF (filh2o .ne. ' ') rewind lh2o
end if
if (ioffset .gt. ioffset_current_in) nvoxels_done_in = 0
ivoxel = 0
do 110 idslic = 1, ndslic
do 120 idrow = 1, ndrows
do 130 idcol = 1, ndcols
ivoxel = ivoxel + 1
ir = iabs(idrow - irow_center)
ic = iabs(idcol - icol_center)
iok = (ir .eq. ioffset .and. ic .le. ioffset) .or.
1 (ir .le. ioffset .and. ic .eq. ioffset)
skip_voxel = .not.iok .or.
1 idrow .lt. irowst .or.
2 idrow .gt. irowen .or.
3 idcol .lt. icolst .or.
4 idcol .gt. icolen .or.
5 idslic .ne. islice .or.
6 zero_voxel(ivoxel) .or.
7 ivoxel .le. nvoxels_done_in
do 140 j = 1, nvoxsk
skip_voxel = skip_voxel .or.
1 (idrow .eq. irowsk(j) .and.
2 idcol .eq. icolsk(j))
140 continue
call restore_settings ()
C
C -------------------------------------------------------------
c Open output files.
C -------------------------------------------------------------
call open_output ()
c
C -------------------------------------------------------------
if (.not.skip_voxel) then
c ----------------------------------------------------------
C Load changes to Control Variables in array CHANGE for
c later output.
C ----------------------------------------------------------
CALL LOADCH ()
c
C ----------------------------------------------------------
C Initialize global quantities for later use.
C DELPPM(JY) = PPM - PPMCEN on the frequency grid.
C ----------------------------------------------------------
CALL INITIA ()
c
end if
C -------------------------------------------------------------
C Get DATAT = raw time-domain data.
C -------------------------------------------------------------
if (.not.bascal) CALL DATAIN ()
voxel1 = .false.
lraw_at_top = .false.
if (skip_voxel) go to 130
if (lcsi_sav_1 .eq. 12) then
nanalyses_done = nanalyses_done + 1
nvoxels_done = ivoxel
ioffset_current = ioffset
rewind 12
write (12, 5030, err= 143)
1 nvoxels_done, nanalyses_done, ioffset_current
go to 145
143 call errmes (1, 4, chsubp)
end if
145 initialize_solve = .true.
C -------------------------------------------------------------
C BASIST(JDATA,JMETAB) = time-domain basis vectors (COMPLEX).
C -------------------------------------------------------------
CALL MYBASI (1)
c
C -------------------------------------------------------------
C Compute NCOMPO and LCOMPO for combinations of metabolites.
C -------------------------------------------------------------
CALL COMBIS ()
C
C -------------------------------------------------------------
C Preliminary analysis to get starting estimates for the phase
C corrections and the referencing shift in the
c frequency-domain data.
C -------------------------------------------------------------
CALL STARTV (1)
C -------------------------------------------------------------
C Repeat Prel with fewer metabolites. Typically, L20 & L09
c are omitted in CHECK_CHLESS. This is skipped when
c NCHLES <= 0 (default in Block Data).
C -------------------------------------------------------------
call check_chless ()
if (omit_chless) then
CALL MYBASI (1)
CALL COMBIS ()
CALL STARTV (2)
end if
C
C -------------------------------------------------------------
C Analyses with Regula Falsi searches for ALPHAB and ALPHAS
C with PROB1 between PRMNMX(1,1) and PRMNMX(2,1).
C -------------------------------------------------------------
IF (DOFULL) THEN
CALL MYBASI (2)
CALL COMBIS ()
CALL TWOREG ()
END IF
C
C -------------------------------------------------------------
C Final output.
C -------------------------------------------------------------
CALL FINOUT ()
if (.not.single_voxel) call update_priors ()
130 continue
120 continue
110 continue
100 continue
if (lcsv .gt. 0) close (lcsv)
if (lcsi_sav_1 .eq. 12) then
rewind 12
nanalyses_done = 0
write (12, 5030) nvoxels_done, nanalyses_done, ioffset_current
close (12)
close (13)
end if
stop
801 call errmes(1, -4, chsubp)
802 call errmes(2, -4, chsubp)
803 call errmes(3, -4, chsubp)
END
C
C
C ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
BLOCK DATA
INCLUDE 'lcmodel.inc'
C
C!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
DATA RRANGE/1.E37/
c -----------------------------------------------------------------------
c DRANGE = SQRT(big number), because it can be squared.
c -----------------------------------------------------------------------
DATA DRANGE/1.D153/
DATA CCNTRL/.FALSE./
C!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
C
c ------------------------------------------------------------------------
c The ordering of the Metabolite Names for the Cho & Cr families in
c CHCOMB below must be that in COMBIS and in the tests for NAMREL in
c FINOUT.
c ------------------------------------------------------------------------
DATA change/mlines*' ', mlines*' '/,
1 chbcal/' '/, chcali/mmetab*' '/, chcol/'-'/,
1 CHCOMB/'GPC+PCh', 'GPC+Cho', 'PCh+Cho', 'Cho+GPC+PCh',
1 'NAA+NAAG', 'Ins+Glyc', 'mI+Glyc', 'Ins+Gly',
1 'mI+Gly', 'Cr+PCr', 'Cre+PCr', 'Glu+Gln',
1 'Lip13a+Lip13b', 'MM14+Lip13a+Lip13b+MM12',
1 'MM09+Lip09', 'MM20+Lip20', MPMET16*' '/,
1 chcom2/mpmet*' '/, chdate/' '/,
1 CHEXT2/MMETAB*' '/, chgam/'gamma'/, chgrsh/mgroup_shift*' '/,
1 CHKEEP/MMETAB_extra*' '/, chless/'L09', 'L20', mmeta2*' '/,
1 chlsha/mmetab*' '/, chmore/'L13'/,
1 chnols/'Lac', 'Ala', mmet_ex2*' '/,
1 chnot1/'Acn', 'Act', 'Bet', 'bHb', 'Car',
2 'Cit', '-CrCH2','Eth', 'Fuc', 'GABA',
3 'Gcn', 'Gcr', 'Glc', 'Gly', 'Glyc',
4 'Gua', 'Ilc', 'Leu', 'Lip20', 'MM12',
5 'MM14', 'MM17', 'MM20', 'NAAG', 'Pal',
6 'Pgc', 'Pyr', 'Scyllo','Suc', 'notTau',
7 'Thr', 'TMPO', 'Val', mmet_ex33*' '/,
1 chnot2/'Lip13c', 'Lip13d', 'Lip13e', mmet_ex3*' '/
1 CHOMIT/MPMET*' '/
DATA CHPMET/
1 'Acn', 'Act', 'Ala',
2 'Asp', 'Bet', 'bHb',
3 'Car', 'Cho', 'Cit',
4 'Cr', 'Cys', 'Eth',
5 'Fuc', 'GABA', 'Gcn',
6 'Gcr', 'Glc', 'Gln',
7 'Glu', 'Glyc', 'GPC',
8 'Gua', 'ILc', 'Ins',
9 'Lac', 'Leu', 'NAA',
T 'NAAG', 'PAl', 'PCh',
1 'Pgc', 'Pyr', 'Scyllo',
2 'Suc', 'Tau', 'Thr',
3 'TMPO', 'Val', 'PCr',
4 'Cre', 'Gly', 'mI',
5 '-CrCH2', 'Lip20', 'MM12',
6 'MM14', 'MM17', 'MM20',
7 'Lip13a', 'Lip13b', 'Lip13c',
8 'Lip13d', 'Lip13e', 'MM09',
9 'Lip09', MPME55*' '/
c -------------------------------------------------------------------------
c If CHRATO is changed below, then NORATO, NRATIO, etc, may have to be
c adjusted in assignments according to SPTYPE in MYCONT and liver-1.inc
c and lipid-1.inc.
c .286+-.126 below corresponds to GSH/Gln=.4+-.3
c -------------------------------------------------------------------------
DATA chrati/mmetab*' '/,
1 chrato/
1 'Lip09/Lip13* = .267 +- .1 +WT= MM12',
1 'Lip20/Lip13* = .15 +- .07 +WT= MM12',
1 'MM20/MM09* = 1.5 +- .375 +WT= Lip09*',
1 'MM12/MM09* = .3 +- .1 +WT= Lip09*',
1 'MM14/MM09* = .75 +- .45 +WT= Lip09*',
1 'MM17/MM09* = .375 +- .3 +WT= Lip09*',
1 '-CrCH2/totCr = .1 +- .25',
1 'Asp/Big3 = .05 +- .05',
1 'GABA/Big3 = .03 +- .03',
1 'Glc/Big3 = .03 +- .03',
1 'Scyllo/Big3 = .01 +- .01',
1 'Tau/Big3 = .05 +- .05',
1 'GSH/Gln+GSH = .286 +- .126',
1 mmet13*' '/,
1 chratw/mmetab*' '/,
1 chrow/'_'/, CHSDSH/'NAA', 'NAAG', 'Cho', MMETA3*' '/,
1 CHSDT2/MMETAB*' '/, chsim/mmetab*' '/
data chsimu/
1 'Lip13a @ 1.28 +- .01 FWHM= .15 < .2 +- .035 AMP= 2.',
1 'Lip13b @ 1.28 +- .01 FWHM= .089 < .09 +- .035 AMP= 2.',
1 'Lip13c @ 1.30 +- .01 FWHM= .089 < .09 +- .035 AMP= 2.',
1 'Lip13d @ 1.26 +- .01 FWHM= .089 < .09 +- .035 AMP= 2.',
1 'Lip09 @ .89 +- .02 FWHM= .14 < .19 +- .035 AMP= 3.',
1 'MM09 @ .91 +- .02 FWHM= .14 < .17 +- .015 AMP= 3.',
1 'Lip20 @ 2.04 +- .005 FWHM=.15 < .2 +- .025 AMP=1.33
1 @ 2.25 FWHM=.15 AMP=.67 @ 2.8 FWHM=.2 AMP=.87',
1 'MM20 @ 2.08 +- .005 FWHM=.15 < .18 +- .01 AMP=1.33
1 @ 2.25 FWHM=.2 AMP=.33 @1.95 FWHM=.15 AMP=.33
1 @ 3. FWHM=.2 AMP=.4',
1 'MM12 @ 1.21 +- .01 FWHM= .15 < .2 +- .02 AMP= 2.',
1 'MM14 @ 1.43 +- .02 FWHM= .17 < .2 +- .02 AMP= 2.',
1 'MM17 @ 1.67 +- .03 FWHM= .15 < .17 +- .02 AMP= 2.',
1 '-CrCH2 @ 3.93 +- 0. FWHM= -9. < 0. +- 0. AMP= -2.',
1 'Gua @ 3.78 +- 0. FWHM=-9.<0. +- 0. AMP=2.',
1 'Glyc @ 3.55 +- 0. FWHM=-9.<0. +- 0. AMP=2.',
1 mmet14*' '/,
1 chslic/'sl'/,
1 CHUSE1/'NAA', 'Cr', 'GPC', 'Glu', 'Ins', 'Lac', 'Glc',
1 'Gln', 'NAAG', 'Tau', 'Asp', 'Ala', 'GABA', 'Scyllo',
1 MMET_ex14*' '/,
1 FILBAS/' '/, FILCOO/' '/, filcor/' '/,
1 filcsi_sav_1/' '/, filcsi_sav_2/' '/, filcsv/' '/,
1 FILH2O/' '/, FILPS/' '/, FILPRI/' '/, FILRAW/' '/,
1 FILTAB/' '/, NAMEAC/MMETAB*' '/, NAMREL/'Cr'/,
1 norato/mmetab*' '/,
1 OWNER/' '/, ownout/' '/, PGNORM/' '/, savdir/' '/,
1 sptype/' '/, srch2o/' '/, srcraw/' '/,
1 SYNUS1/'GPC','PCh', 'GPC','Cho', 'PCh','Cho',
1 'Ins','mI', 'Glyc','Gly', 'Cr','Cre',
1 MPMET6*' ', MPMET6*' '/
1 TITLE/' '/, title_line/2*' '/, wsmet/'Cr'/
data power/2.d0, 1.d0, 1.5d0/
DATA iareaw/2/,
3 iauto/1/, iaverg/0/, icolen/1/, icolsk/mvoxsk*0/, icolst/1/,
3 idgppm/-1/, IDUMP/MSTAGE*1/,
3 IETCOU/3/, imethd/0/, INCSID/1/, INCSMX/15/,
3 ioffset_current_in/0/,
3 IPAGE2/1/, ipdump/0/, ipowph/6/, ipowrg/0/, irowen/1/,
3 irowsk/mvoxsk*0/, irowst/1/, ISDBOL/15/,
3 ISHIFW/0/, islice/1/,
3 ISTAGO/0/, iter_dump/-1/,
3 KEY/MKEY*0/, LBASIS/3/, LCONTR/5/, lcontr_scratch/29/,
3 LCOORD/0/, lcoraw/0/, lcsi_sav_1/0/, lcsi_sav_2/0/, lcsv/0/,
3 LDWFFT/0/, lett/0/, LH2O/2/, LINCHG/2*0/, LINERR/0/,
3 linerr_mycont/0/,
3 LINETC/0/, LINTBL/0/, LPRINT/0/, LPS/8/, LRAW/1/,
3 LTABLE/0/, LWFFT/0/,
3 MDALPB/12/, mdegp3/41/,
3 MERMES/9000/, MFNDAL/25/, MINTER/3*1/,
3 MITER/20, 40, 30/, mnsamp/9/, mpower/1/,
3 MREPHA/3, 0/, n1hmet/3/, nback/75, 50/, nbas_ccf/10/,
3 nbckmn/6/, ncalib/0/, nchgam/5/, nchles/0/, nchlin/35, 49/,
3 NCOMBI/16/, ndcols/1/, NDEGZ/36, 4/,
3 NDGPPM/21, 3/, ndrows/1/, ndslic/1/,
3 NEACH/0/, nermes/0/, NERROR/MMERM9*0/,
3 nextr/2*0/, NEXT2/0/, ngau/mmetab*1/, ngrsh/0/,
3 ninfl/2*0/, NKEEP/0/, nlin/0/,
3 nlshap/0/, nnolsh/0/,
3 nnot1/33/, nnot2/3/, nnorat/0/, NOMIT/0/,
3 npar/0/, npower/mmetab*0/, nratio/13/,
3 nratio_used/0/, NREFPK/1, 3/,
3 NRF2MN/2/, NSDSH/3/, NSDT2/0/, NSHIFT/8/, NSIDMN/5/,
3 NSIDMX/11/, nsimul/13/, NSUBTK/2/, ntitle/2/,
3 NUNFIL/2048/, NUSE1/5/, nvoxsk/0/,
3 nwsend/50/, nwsst/10/
DATA absval/.false./, accept_alpbmn/.false./,
4 accept_step2/.false./,
4 areaba_orig_basisf/.true./, asymlp/.false./,
4 badref/.false./, bascal/.false./,
4 basout/.false./, biglip/.false./,
4 chksim/.true./, conc3f/.true./,
4 DOECC/.FALSE./, DOFULL/.TRUE./,
4 DOREFS/.FALSE., .TRUE./,
4 dowatr/.true./, dows/.false./,
4 DOZERO/2*.FALSE., .TRUE./, eccdon/.false./, endpha/.false./,
4 fixshf/.false./, forecc/.false./,
4 gauss_rt2/.true./, gshgua/.true./, LANDSC/.TRUE./,
4 ldump/10*.false./, lcy_skip/my*.false./,
4 nobase/.false./, nobasi/.false./,
4 onlyco/.false./, QUICK/.FALSE./,
4 reflac/.FALSE./, roomt/.false./, scafwh/.false./,
4 scasim/.true./, sidump/mmetab*.false./,
4 sitayl/mmetab*.false./, skip_step3/.false./,
4 solgrd/.true./, smtail/.true./,
4 SUBBAS/.FALSE./, unsupr/.false./,
4 useany/.FALSE./, useglc/.FALSE./, usemxb/.true./,
4 USINFL/.TRUE./, VITRO/.FALSE./, wsdone/.false./,
4 year4d/.true./
DATA ALEXT2/MMETAB*0./, ALPBMN/1.7D-3/, ALPBMX/.84D0/,
5 ALPBPN/.0021/,
5 ALPBST/.0025/, alphab_dump/-1./, alphas_dump/-1./,
5 ALPSMN/.1D0/, ALPSMX/2.D3/, ALPSST/10.0001/,
5 ALSDSH/2*.002, .008, MMETA3*0./, ALSDT2/MMETAB*0./,
5 area_met_norm/0./,
5 atth2o/.7/, attmet/1./, black/3*0./, bwtolr/.001/,
5 conc_expect/mmetab*0./,
5 CONREL/1./, COSMIN/3*1.E-2/, ddegp3/5./, DDGPMQ/1., 1./,
5 DDGZMQ/3., 3./, DEEXT2/2./, DEGMAX/12.5, 13./,
5 DEGPPM/0./, DEGZER/0./, DELTAT/5.E-4/, DESDSH/.004/,
5 DESDT2/.4/, DFLDMQ/.1/, DGPPMN/-30./, DGPPMX/30./,
5 dkngam/.35/, DKNTMN/.15, .6/, dkntmn_standard/.075/,
5 DSHPAT/.05,.1, 2*0./, echot/-1./, exrati/mmetab*-1./,
5 EXRT2/MMETAB*2./, fcalib/1./, fcsum/1.e-3/, FH2OMX/.25/,
5 fmain_power/.6/, fother_power/.1/,
5 frepha/.5/, FSTPMQ/5./, FWHH2O/.4/, FWHMBA/.013/,
5 fwhmmn/.1/, fwhmmx/.15/,
5 fwhmsm/-1./, FWHMST/.04/, hifmm/190./,
5 hwdwat/1., 2./, hzpgam/90., 210./,
5 HZPPPM/84.47/, HZREF/MREFPK*0., MREFPk*0./,
5 PAGEHT/27.9/, PAGEWD/21./, PHITOT/2*0./,
5 PMQST/3*1./, PMQSTL/3*.6/, PNALPB/9./, ppmbas/.1, .2/,
5 PPMCEN/4.65/, PPMEND/9999./, ppmend_phalip/-1./,
5 ppmgap/mgap*1.e37, mgap*1.e37/, ppmh2o/4.65/
c -------------------------------------------------------------------------
c With PPMMET below:
c -CrCH2 is omitted if the CH3 peak around 3ppm is not included.
c MM12 MM14 MM17 MM20 MM09 require MM09 and baseline down to 0.61.
c However, these are relaxed as much as possible in MYBASI if
c TE <= TEMM (typically 99.99), with error message if PPMEND > .6, so
c that they (especially MM20) can fit under NAA peak, etc.
c
c Lip* are not excluded if PPMEND>0.6, since (especially mobile) lipids
c can still be present, even at long TE.
c Changes below must be also made in MYBASI.
c -------------------------------------------------------------------------
DATA PPMMET/
1 2.27,2.17,2.27,2.17, 1.97,1.87,1.97,1.87, 1.57,1.29,1.57,1.29,
2 2.91,2.59,2.91,2.59, 3.31,3.21,3.31,3.21, 1.26,1.09,1.26,1.09,
3 3.71,2.35,3.71,2.35, 3.25,3.22,3.22,3.19, 2.71,2.49,2.71,2.49,
4 3.92,3.89,3.03,3.00, 3.71,3.05,3.71,3.05, 1.29,1.01,1.29,1.01,
5 1.31,1.09,1.31,1.09, 3.17,2.10,3.17,2.10, 3.81,3.59,3.81,3.59,
6 3.99,3.09,3.99,3.09, 3.84,2.99,3.84,2.99, 3.91,3.59,2.65,2.01,
7 3.84,3.59,2.51,2.26, 3.84,3.49,3.84,3.49, 3.25,3.22,3.22,3.19,
8 3.83,3.73,3.83,3.73, 1.09,0.79,1.09,0.79, 3.59,3.56,3.56,3.51,
9 1.41,1.21,1.41,1.21, 1.81,0.79,1.01,0.79, 2.63,2.55,2.01,2.01,
T 2.81,2.45,2.31,2.01, 3.99,2.99,3.99,2.99, 3.25,3.22,3.22,3.19,
1 1.31,1.01,1.31,1.01, 2.43,2.33,2.43,2.33, 3.40,3.30,3.40,3.30,
2 2.45,2.35,2.45,2.35, 3.61,3.06,3.61,3.06, 1.41,1.19,1.41,1.19,
3 3.95,3.85,3.78,3.68, 1.21,0.79,1.21,0.79, 3.92,3.89,3.03,3.00,
4 3.92,3.89,3.03,3.00, 3.84,3.49,3.84,3.49, 3.59,3.56,3.56,3.51,
5 3.03,3.00,3.03,3.00, 2.31,1.11,2.31,1.11, 1.25,0.61,1.25,0.61,
6 1.50,0.61,1.50,0.61, 1.75,0.61,1.75,0.61, 2.31,0.61,2.31,0.61,
7 1.50,1.11,1.50,1.11, 1.50,1.11,1.50,1.11, 1.50,1.11,1.50,1.11,
8 1.50,1.11,1.50,1.11, 1.50,1.11,1.50,1.11, 1.20,0.61,1.20,0.61,
9 1.20,0.61,1.20,0.61,
T MPME55*0., MPME55*0., MPME55*0., MPME55*0./
DATA PPMPOS/-1.E6, 1.E6/,
5 PPMREF/4.65, MREFP1*0.,
5 2.01, 3.03, 3.22, 3.56, MREFP4*0./,
5 ppmsep/mgap*1.e37/,
5 PPMSHF/1.E37/, ppmsig/1.e9, -1.e9/, PPMST/-9999./,
5 ppmst_phalip/7./,
5 ppm_truncate_max/-999./, ppm_truncate_min/999./,
5 ppm_water_range/1./, ppm_water_tol/.08/,
5 PRMNMX/.02,.08, .2,.5, .02,.08/, PTLABL/7.8/,
5 PTOUTP/7.8/, PTTITL/11./, PTVERS/9./, RALIMN/1.02/,
5 RALINC/2./, r_areaba/20./, ratipm/4./, RBACKG/6., 2.5/,
5 rbasmx/2*.25/, RCONVR/3*1.E-3/,
5 RDALPB/2./, rfwbas/10./, RFWHCC/.5/, RFWHM/1.8/,
5 rfwhmst_ccf/1.5/, RFWHST/.5/,
5 RGBBOL/2*0., .999/, rgberr/.999, 2*0./,
5 RGBLIN/.999, 17*0./, rgbrat/.999, 2*0./,
5 RHLABL/1.2/, RHOUTP/1.3/, RHTITL/1.5/, RHVERS/2./,
5 RINCRS/3*1.E-5/, rincsh/.5/, rlesmo/.35/, rlrntz/1./,
5 RMQDEC/3*.5/, RMQINC/6*4./, RPENMX/1.00001/,
5 RPMQMN/3*1./, rpowmq/.1/, RRT2MQ/.1/, rsdgp3/1.3/,
5 rsdsam/2.5, 1.5, 3./, rsdsmq/.125/,
5 RSHFMQ/.025/, RSTPMN/3*0./,
5 RSTPMX/3*1./, rt2min/mmetab*0./,
5 RWFONT/.62/, SDDEGP/20./, SDDEGZ/999./,
5 sdgrsh/mgroup_shift*0./, SDMSHF/.02/, sdrati/mmetab*0./,
5 sdshmn/.002/, sdshmx/.004/, SDSMOO/.01, .02, .03, .01/,
5 SHIFMN/-.3, -.1/, SHIFMX/.3, .3/, siamp/mmet_mgau*0./,
5 sifwex/mmetab*0./, sifwmn/mmet_mgau*0./, sifwsd/mmetab*0./,
5 sippm/mmet_mgau*999./, sisdsh/mmetab*-1./,
5 temm/99.99/, THRLIN/.1/,
5 wconc/35880./, WDLINE/.06, .01, .005, .01, .04, .005/,
5 wsppm/3.027/, XLEFT/1.3/,
5 XRIGHT/1.3/, XSTEP/.2/, XTRPMX/2./, YBOTT/1.3/, YTOP/1.5/
END
C
C
C ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C subroutine y2k !OSF
C INCLUDE 'lcmodel.inc' !OSF
C character chstr*40 !OSF
c
C CALL IDATE (KNUM(2), KNUM(1), KNUM(3)) !OSF
C CALL DATE (CHSTR) !OSF
C if (year4d) then !OSF
C chdate(1:7) = chstr !OSF
C if (knum(3) .lt. 99) then !OSF
C knum(3) = knum(3) + 2000 !OSF
C end if !OSF
C write (chstr, 5100) knum(3) !OSF
C 5100 format (i4) !OSF
C chdate(8:11) = chstr !OSF
C CALL TIME (CHSTR) !OSF
C CHDATE(15:19)=CHSTR !OSF
C else !OSF
C CHDATE(1:9)=CHSTR !OSF
C CALL TIME (CHSTR) !OSF
C CHDATE(13:17)=CHSTR !OSF
C end if !OSF
C end !OSF
C
C
C ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
C subroutine y2k !IRIX
C INCLUDE 'lcmodel.inc' !IRIX
C character chstr*40 !IRIX
c
C CALL IDATE (KNUM(2), KNUM(1), KNUM(3)) !IRIX
C CALL DATE (CHSTR) !IRIX
C if (year4d) then !IRIX
C chdate(1:7) = chstr !IRIX
C if (knum(3) .lt. 99) then !IRIX
C knum(3) = knum(3) + 2000 !IRIX
C end if !IRIX
C write (chstr, 5100) knum(3) !IRIX
C 5100 format (i4) !IRIX
C chdate(8:11) = chstr !IRIX
C CALL TIME (CHSTR) !IRIX
C CHDATE(15:19)=CHSTR !IRIX
C else !IRIX
C CHDATE(1:9)=CHSTR !IRIX
C CALL TIME (CHSTR) !IRIX
C CHDATE(13:17)=CHSTR !IRIX
C end if !IRIX
C end !IRIX
C
C
C ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SUBROUTINE MYCONT ()
C
Cvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv For user vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
C
C Inputs changes to Control Variables.
C If your compiler doesn't accept NAMELIST, then you will have to modify this
C subprogram to use only standard I/O statements.
C Below is illustrated how you can make your own special-purpose
c modifications to input data. In the example below, if QUICK has been
C input .TRUE., then other Control Variables are changed to force the
C fastest possible (but crude) analysis.
C
C^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ For user ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
C
INCLUDE 'lcmodel.inc'
external ilen
parameter (mch_line_long=mchsimul+12)
CHARACTER LINE*(mch_line_long)
logical is_sptype, standard_refs
include 'nml_lcmodl.inc'
include 'nml_lcmodel.inc'
CHSUBP='MYCONT'
C -------------------------------------------------------------------------
c Preliminary default settings based on preliminary reading of Namelist.
c SPTYPE = 'version5 will be used after 2nd Namelist read (to overwrite
c earlier settings)
c These settings are dependent on the Block data
c settings of CHRATO, NRATIO, etc.
c Copy LCONTR to LCONTR_SCRATCH, since Cygwin g77 (& NAG90) cannot rewind
c STDIN.
C -------------------------------------------------------------------------
open(lcontr_scratch, status='scratch')
5104 format(a)
do 104 jline = 1, 9999
read(lcontr, 5104, end=105) line
llen = ilen(line)
write(lcontr_scratch, 5104) line(1:llen)
104 continue
105 rewind lcontr_scratch
READ (LCONTR_SCRATCH, NML=LCMODL, end=801, err=802)
c -------------------------------------------------------------------------
c At long TE, delete ratio prior for GSH/(Gln+GSH), which can get larger
c than normal.
c -------------------------------------------------------------------------
if (echot .gt. 49.) nratio = 12
c -------------------------------------------------------------------------
c For high fields, reset Lip* & MM* to sharper values.
c Also remove ratio constraint on Tau (assuming rodent).
c This assumes that HZPPPM or HIFMM will not be set in any of the *.inc
c files below.
c -------------------------------------------------------------------------
if (hzpppm .gt. hifmm) then
chsimu(1)= 'Lip13a @ 1.28 +- .01 FWHM= .05 < .07 +- .02
1 AMP= 2.'
chsimu(2)= 'Lip13b @ 1.28 +- .01 FWHM= .029 < .03 +- .02
1 AMP= 2.'
chsimu(3)= 'Lip13c @ 1.30 +- .01 FWHM= .029 < .03 +- .02
1 AMP= 2.'
chsimu(4)= 'Lip13d @ 1.26 +- .01 FWHM= .029 < .03 +- .02
1 AMP= 2.'
chsimu(5)= 'Lip09 @ .89 +- .02 FWHM= .05 < .07 +- .02
1 AMP= 3.'
chsimu(6)= 'MM09 @ .91 +- .02 FWHM= .05 < .06 +- .01
1 AMP= 3.'
chsimu(7)= 'Lip20 @ 2.04 +- .005 FWHM=.05 < .07 +- .02
1 AMP=1.33 @ 2.25 FWHM=.05 AMP=.67
2 @ 2.8 FWHM=.07 AMP=.87'
chsimu(8)= 'MM20 @ 2.08 +- .005 FWHM=.05 < .06 +- .01
1 AMP=1.33 @ 2.25 FWHM=.07 AMP=.33
2 @1.95 FWHM=.05 AMP=.33 @ 3. FWHM=.07 AMP=.4'
chsimu(9)= 'MM12 @ 1.21 +- .01 FWHM= .05 < .07 +- .02 AMP= 2.'
chsimu(10)= 'MM14 @ 1.43 +- .02 FWHM= .06 < .07 +- .02 AMP= 2.'
chsimu(11)= 'MM17 @ 1.67 +- .03 FWHM= .05 < .06 +- .02 AMP= 2.'
nnorat= 1
norato(1)= 'Tau'
end if
if (nunfil .lt. 64) call errmes (12, 4, chsubp)
call remove_blank_start (sptype)
if (nchgam .gt. 0 .and. chgam .ne. ' ' .and.
1 dkngam .gt. 0. .and. nchgam .le. mchgam .and.
2 sptype .eq. ' ') then
if (index(filbas, chgam(1:nchgam)) .gt. 0 .and.
1 hzpppm .ge. hzpgam(1) .and. hzpppm .le. hzpgam(2))
2 dkntmn(1) = dkngam
end if
call toupper_lower (.false., sptype)
is_sptype= .false.
if (sptype(:3) .eq. 'csf') then
is_sptype= .true.
nnorat = 5
norato(1) = 'Asp'
norato(2) = 'GABA'
norato(3) = 'Glc'
norato(4) = 'Scyllo'
norato(5) = 'Tau'
nratio = 13
reflac = .true.
useglc = .true.
end if
if (sptype(:6) .eq. 'nulled') then
is_sptype= .true.
badref = .true.
incsmx = 1
namrel = 'Lip13a+Lip13b'
nobasi = .true.
nratio = 6
nrefpk(2) = 2
nsidmn = 1
nsidmx = 1
nsimul = 11
ppmref(1,2) = 1.28
ppmref(2,2) = 0.90
vitro = .true.
end if
if (sptype(:5) .eq. 'tumor') then
c ----------------------------------------------------------------------
c BADREF=T will use every metabloite in Prel, but only those with
c NUSE1 & CHUSE1 will be used to determine Prel FWHMST, which
c determines NSIDES. Must have NUSE1>0 to determine NSIDES. Can
c only have NUSE1=0 when lineshape is not used, as with liver, etc.,
c where NOBASI=T.
c CHRATO & NRATIO must be adjusted below if there is any change of
c these in BLOCK DATA.
c ----------------------------------------------------------------------
is_sptype= .true.
badref = .true.
chrato(13) = 'NAAG/NAA = .15 +- .15'
chuse1(1) = 'GPC'
chuse1(2) = 'Cr'
dkntmn(1) = .35
namrel = 'GPC'
nrefpk(2) = 4
nratio = 13
nuse1 = 2
ppmend = .2
ppmref(1,2) = 3.03
ppmref(2,2) = 3.22
ppmref(3,2) = 1.28
ppmref(4,2) = 0.90
rbackg(1) = 12.
shifmn(2) = -.07
shifmx(2) = .07
end if
include 'muscle-1.inc'
include 'liver-1.inc'
include 'lipid-1.inc'
if (sptype(:7) .eq. 'muscle-' .or.
1 sptype(:6) .eq. 'liver-' .or.
2 sptype(:7) .eq. 'breast-' .or.
3 sptype(:6) .eq. 'lipid-') then
biglip = .true.
ppm_truncate_max = 3.5
ppm_truncate_min = 2.2
end if
if (.not.(is_sptype .or.
1 sptype(:8) .eq. 'version5' .or.
2 sptype(:9) .eq. 'version-5' .or.
3 sptype(:1) .eq. ' ')) call errmes (8, 4, chsubp)
c -------------------------------------------------------------------------
c Overwrite above defaults by rereading Namelist
c -------------------------------------------------------------------------
REWIND LCONTR_SCRATCH
fwhmba_sav = fwhmba
fwhmba = -.1
READ (LCONTR_SCRATCH, NML=LCMODL, end=801, err=802)
c -------------------------------------------------------------------------
c Red herring; nothing will be done here.
if (ldwfft .gt. 0) nlin = nlin + 1024
c -------------------------------------------------------------------------
c DOECC must be set before call to AVERAGE
c -------------------------------------------------------------------------
doecc_active = doecc
if (biglip) doecc = forecc
call remove_blank_start (sptype)
call toupper_lower (.false., sptype)
if (sptype(:8) .eq. 'version5' .or.
1 sptype(:9) .eq. 'version-5') then
nratio = 0
nsimul = 0
ppmend = 1.0
ppmst = 3.85
end if
if (iauto .eq. 1 .and. ppmend .gt. 9998.) then
if (echot .ge. 100.) then
ppmend = 1.
nuse1 = 4
end if
c ---------------------------------------------------------------------
c No longer truncate CSI analyses with PPMEND.
c if (max0(ndslic, ndrows, ndcols) .gt. 1) ppmend = 1.8
c ---------------------------------------------------------------------
end if
if (ppmst .lt. -9998.) ppmst= 4.
if (ppmend .gt. 9998.) ppmend= .2
fwhmba_in_control = fwhmba .gt. 0.
if (.not.fwhmba_in_control) then
fwhmba = fwhmba_sav
end if
if (sptype(:7) .eq. 'muscle-' .or.
1 sptype(:6) .eq. 'liver-' .or.
2 sptype(:7) .eq. 'breast-' .or.
3 sptype(:6) .eq. 'lipid-') then
if (ppmend .ge. -0.9) call errmes(17, 2, chsubp)
if (ppmst .ge. 5.) then
if (ppmst .le. 7.9) call errmes(18, 2, chsubp)
else
if ((sptype(:6) .eq. 'liver-') .and.
3 (ppmst .ge. 4.01 .or. ppmst .le. 3.59))
4 call errmes(19, 2, chsubp)
if ((sptype(:7) .eq. 'breast-') .and.
3 (ppmst .le. 3.79 .or. ppmst .ge. 4.01))
4 call errmes(20, 2, chsubp)
if ((sptype(:6) .eq. 'lipid-') .and.
2 (ppmst .le. 3.39 .or. ppmst .ge. 4.01))
3 call errmes(21, 2, chsubp)
end if
end if
if ((sptype(:10) .eq. 'only-cho-1' .or.
1 sptype(:10) .eq. 'only-cho-2') .and.
2 (ppmst .le. 3.79 .or. ppmst .ge. 4.01 .or.
3 ppmend .ge. 2.81 .or. ppmend .le. 2.59))
4 call errmes(22, 2, chsubp)
c -------------------------------------------------------------------------
c Setup for no baseline.
c -------------------------------------------------------------------------
if (nobase) then
alpbmx = alpbmn
alpbst = alpbmn
alpbpn = 1.0001 * alpbmn
idgppm = -1
nbackg = 0
usemxb = .false.
end if
c -------------------------------------------------------------------------
c Reset RBASMX & RSDGP3.
c IDGPPM = -1 (default in Block Data) to skip fixed-DEGPPM series and only
c do free analysis.
c = 0 (default in lipid-2 & PPMST<5) for analyses stressing flat
c baselines (by allowing medium SSQ/SSQMIN), where there is no
c small peak that can be lost by incorrect DEGPPM. This can
c also be used to input any values for RBASMX & RSDGP3; only
c differences between IDGPPM=0 & >0 are settings below.
c = 1 (default in breast-2, only-cho-1 & liver-2) for analyses
c stressing good phasing and fit (at expense of flat
c baselines), to find small peaks (like Cho). Forces
c fixed-DEGPPM series, even if baseline in unconstrained
c solution is flat.
c = 2 (default in muscle-2) (actually between 0 and 1) stresses
c good fit, but does not force fixed-DEGPPM series if
c unconstrained solution has flat baseline.
c -------------------------------------------------------------------------
if (idgppm .gt. 0) rsdgp3 = amin1(rsdgp3, 1.1)
if (idgppm .eq. 1) rbasmx(1) = 0.
c -------------------------------------------------------------------------
c With dongle, omit "Data of:" allowing blank line if nothing is input (by
c Hitachi).
c -------------------------------------------------------------------------
OWNOUT='Data of: ' // OWNER
ownout = owner!Cyg
fwhmst = amin1(fwhmst, fwhmmx)
c -------------------------------------------------------------------------
c USEGLC = T to add Glc to Preliminary Analysis
c -------------------------------------------------------------------------
if (useglc .and. max0(nuse1, nkeep) .lt. mmetab_extra) then
nkeep = max0(1, nkeep + 1)
chkeep(nkeep) = 'Glc'
do 110 juse1 = 1, nuse1
if (chuse1(juse1) .eq. 'Glc') go to 115
110 continue
nuse1 = nuse1 + 1
chuse1(nuse1) = 'Glc'
115 continue
end if
c -------------------------------------------------------------------------
c REFLAC = T to use Lac for referencing and for the Preliminary
c Analysis, provided PPMEND < 1.33.
c -------------------------------------------------------------------------
if (reflac .and. ppmend .lt. 1.33 .and.
1 nuse1 .lt. mmetab_extra) then
do 120 juse1 = 1, nuse1
if (chuse1(juse1) .eq. 'Lac') go to 125
120 continue
nuse1 = nuse1 + 1
chuse1(nuse1) = 'Lac'
125 dorefs(2) = .true.
do 130 j = 1, nrefpk(2)
if (abs(ppmref(j,2) - 1.33) .le. .01 .and.
1 abs(hzref(j,2) - 3.6) .le. .1) go to 140
130 continue
nrefpk(2) = min0(mrefpk, max0(2, nrefpk(2) + 2))
do 135 j = nrefpk(2), 3, -1
ppmref(j,2) = ppmref(j-2,2)
hzref(j,2) = hzref(j-2,2)
135 continue
ppmref(1,2) = 1.33
ppmref(2,2) = 1.33
hzref(1,2) = -3.6
hzref(2,2) = 3.6
140 continue
end if
IF (QUICK) THEN
NDEGZ(2)=3
NDGPPM(2)=1
NSHIFT=1
DOREFS(1)=.FALSE.
NREFPK(2)=3
PPMREF(1,2)=2.01
PPMREF(2,2)=3.03
PPMREF(3,2)=3.22
HZREF(1,2)=0.
HZREF(2,2)=0.
HZREF(3,2)=0.
DOFULL=.FALSE.
END IF
c -------------------------------------------------------------------------
c Change CV's for calibration.
c -------------------------------------------------------------------------
if (ncalib .gt. 0) then
nratio = 0
dorefs(2) = .true.
ncalib = min0(ncalib, mmetab)
nuse1 = ncalib
vitro = .true.
dkntmn(2) = 99.
standard_refs = .true.
do 210 j = 1, ncalib
chuse1(j) = chcali(j)
standard_refs = standard_refs .and.