Blame view

src/idl/dustem_plugin_stellar_population.pro 101 KB
cbf75ef0   Ilyes Choubani   dustem_init_plugi...
1
Function dustem_plugin_stellar_population, key=key, val=val, scope=scope, help=help 
4750086c   Ilyes Choubani   nouvelle philosph...
2
3
4

;+
; NAME:
cbf75ef0   Ilyes Choubani   dustem_init_plugi...
5
;    dustem_plugin_stellar_population
4750086c   Ilyes Choubani   nouvelle philosph...
6
7
8
9
10
; PURPOSE:
;    Produces a system variable called '!dustem_composite_stellar_population' in which a structure containing parameters pertaining to (a) stellar population(s) is placed
; CATEGORY:
;    DUSTEM Wrapper
; CALLING SEQUENCE:
cbf75ef0   Ilyes Choubani   dustem_init_plugi...
11
;    dustem_create_plugin_population(key=key,val=val)
4750086c   Ilyes Choubani   nouvelle philosph...
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
; INPUTS:
;    None
; OPTIONAL INPUT PARAMETERS:
;    key  = input parameter number
;    val  = input parameter value
; OUTPUTS:
;    None
; OPTIONAL OUTPUT PARAMETERS:
;    None
; ACCEPTED KEY-WORDS:
;    help                  = if set, print this help
; COMMON BLOCKS:
;    None
; SIDE EFFECTS:
;    None
; RESTRICTIONS:
;    The dustem fortran code must be installed
;    The dustem idl wrapper must be installed
; PROCEDURE:
;    This is a dustem plugin
;-

IF keyword_set(help) THEN BEGIN
cbf75ef0   Ilyes Choubani   dustem_init_plugi...
35
  doc_library,'dustem_plugin_stellar_population'
4750086c   Ilyes Choubani   nouvelle philosph...
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
  goto,the_end
ENDIF


scp='DEFINE_ISRF'

if keyword_set(scope) then begin
scp='DEFINE_ISRF'
goto, the_end
endif

; if keyword_set(scope) then begin 
; (*(*!dustem_scope).stellar_population)=scope
; endif

;===========Initializing the defaut stellar population structure===========
one_pop={radius:0.,temperature:0.,distance:0.,amplitude:0.,nstars:0.,popid:''} 

;===========Counters===========
popnumber = 0.
counto = 0.
countb = 0.
counta = 0.
countf = 0.
countg = 0.
;==============================


;===========Constants (in cgs)========== (except for the stellar population distance (in pc))
rsun2cm = 6.957e10 

;Stelar density constant to automate the computation of the number of stars. (It links the distance and the number of stars)
;The below stellar density will have to be modified as the density goes up towards the center, in globular clusters and goes down as we move out of the galactic plane
stellar_density = 0.14 ;stars/pc^3 stellar density in the SOLAR VICINITY     
;============================================================================================ 
 
;================NOTA BENE========================================================================== 
;KM are not included because I assumed that their UV part was not that important to excite the dust. 
;This will help ease and shorten the fitting procedure
;===================================================================================================

IF keyword_set(key) THEN BEGIN 
    
    ; Locating the O3 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 3,countindo3) 
    
    IF countindo3 NE 0 THEN BEGIN 
    popnumber+=1
    counto+=1
    indo3_1 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 1, countindo3_1); index of radius of this stellar population in the val array
    indo3_2 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 2, countindo3_2); index of temperature of this stellar population in the val array
    indo3_3 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 3, countindo3_3); index of distance of this stellar population in the val array
    indo3_4 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 4, countindo3_4); index of the amplitude of this stellar population in the val array (Q: does it make sense to have an amplitude>1.? If not upper limiting it in the general fitting procedure might be handy)
    indo3_5 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 5, countindo3_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the O4 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 4,countindo4)
    IF countindo4 NE 0 THEN BEGIN 
    popnumber+=1
    counto+=1
    indo4_1 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 1, countindo4_1); index of radius of this stellar population in the val array
    indo4_2 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 2, countindo4_2); index of temperature of this stellar population in the val array
    indo4_3 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 3, countindo4_3); index of distance of this stellar population in the val array
    indo4_4 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 4, countindo4_4); index of the amplitude of this stellar population in the val array
    indo4_5 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 5, countindo4_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the O5 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 5,countindo5)
    IF countindo5 NE 0 THEN BEGIN
    popnumber+=1
    counto+=1
    indo5_1 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 1, countindo5_1); index of radius of this stellar population in the val array
    indo5_2 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 2, countindo5_2); index of temperature of this stellar population in the val array
    indo5_3 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 3, countindo5_3); index of distance of this stellar population in the val array
    indo5_4 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 4, countindo5_4); index of the amplitude of this stellar population in the val array
    indo5_5 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 5, countindo5_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the O6 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 6,countindo6)
    IF countindo6 NE 0 THEN BEGIN
    popnumber+=1
    counto+=1
    indo6_1 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 1, countindo6_1); index of radius of this stellar population in the val array
    indo6_2 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 2, countindo6_2); index of temperature of this stellar population in the val array
    indo6_3 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 3, countindo6_3); index of distance of this stellar population in the val array
    indo6_4 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 4, countindo6_4); index of the amplitude of this stellar population in the val array
    indo6_5 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 5, countindo6_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the O7 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 7,countindo7)
    IF countindo7 NE 0 THEN BEGIN
    popnumber+=1
    counto+=1
    indo7_1 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 1, countindo7_1); index of radius of this stellar population in the val array
    indo7_2 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 2, countindo7_2); index of temperature of this stellar population in the val array
    indo7_3 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 3, countindo7_3); index of distance of this stellar population in the val array
    indo7_4 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 4, countindo7_4); index of the amplitude of this stellar population in the val array
    indo7_5 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 5, countindo7_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the O8 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 8,countindo8)
    IF countindo8 NE 0 THEN BEGIN
    popnumber+=1
    counto+=1
    indo8_1 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 1, countindo8_1); index of radius of this stellar population in the val array
    indo8_2 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 2, countindo8_2); index of temperature of this stellar population in the val array
    indo8_3 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 3, countindo8_3); index of distance of this stellar population in the val array
    indo8_4 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 4, countindo8_4); index of the amplitude of this stellar population in the val array
    indo8_5 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 5, countindo8_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the O9 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 9,countindo9)
    IF countindo9 NE 0 THEN BEGIN
    popnumber+=1
    counto+=1
    indo9_1 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 1, countindo9_1); index of radius of this stellar population in the val array
    indo9_2 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 2, countindo9_2); index of temperature of this stellar population in the val array
    indo9_3 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 3, countindo9_3); index of distance of this stellar population in the val array
    indo9_4 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 4, countindo9_4); index of the amplitude of this stellar population in the val array
    indo9_5 =  where(strupcase(strmid(key,0,1)) EQ 'O' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 5, countindo9_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ;======================================================
    
    ; Locating the B0 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 0,countindb0)
    IF countindb0 NE 0 THEN BEGIN
    popnumber+=1
    countb+=1
    indb0_1 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 0 and strmid(key,2,1) EQ 1, countindb0_1); index of radius of this stellar population in the val array
    indb0_2 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 0 and strmid(key,2,1) EQ 2, countindb0_2); index of temperature of this stellar population in the val array
    indb0_3 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 0 and strmid(key,2,1) EQ 3, countindb0_3); index of distance of this stellar population in the val array
    indb0_4 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 0 and strmid(key,2,1) EQ 4, countindb0_4); index of the amplitude of this stellar population in the val array
    indb0_5 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 0 and strmid(key,2,1) EQ 5, countindb0_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the B1 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 1,countindb1)
    IF countindb1 NE 0 THEN BEGIN
    popnumber+=1
    countb+=1
    indb1_1 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 1 and strmid(key,2,1) EQ 1, countindb1_1); index of radius of this stellar population in the val array
    indb1_2 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 1 and strmid(key,2,1) EQ 2, countindb1_2); index of temperature of this stellar population in the val array
    indb1_3 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 1 and strmid(key,2,1) EQ 3, countindb1_3); index of distance of this stellar population in the val array
    indb1_4 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 1 and strmid(key,2,1) EQ 4, countindb1_4); index of the amplitude of this stellar population in the val array
    indb1_5 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 1 and strmid(key,2,1) EQ 5, countindb1_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the B2 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 2,countindb2)
    IF countindb2 NE 0 THEN BEGIN
    popnumber+=1
    countb+=1
    indb2_1 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 2 and strmid(key,2,1) EQ 1, countindb2_1); index of radius of this stellar population in the val array
    indb2_2 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 2 and strmid(key,2,1) EQ 2, countindb2_2); index of temperature of this stellar population in the val array
    indb2_3 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 2 and strmid(key,2,1) EQ 3, countindb2_3); index of distance of this stellar population in the val array
    indb2_4 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 2 and strmid(key,2,1) EQ 4, countindb2_4); index of the amplitude of this stellar population in the val array
    indb2_5 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 2 and strmid(key,2,1) EQ 5, countindb2_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the B3 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 3,countindb3)
    IF countindb3 NE 0 THEN BEGIN
    popnumber+=1
    countb+=1
    indb3_1 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 1, countindb3_1); index of radius of this stellar population in the val array
    indb3_2 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 2, countindb3_2); index of temperature of this stellar population in the val array
    indb3_3 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 3, countindb3_3); index of distance of this stellar population in the val array
    indb3_4 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 4, countindb3_4); index of the amplitude of this stellar population in the val array
    indb3_5 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 5, countindb3_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the B4 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 4,countindb4)
    IF countindb4 NE 0 THEN BEGIN
    popnumber+=1
    countb+=1
    indb4_1 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 1, countindb4_1); index of radius of this stellar population in the val array
    indb4_2 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 2, countindb4_2); index of temperature of this stellar population in the val array
    indb4_3 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 3, countindb4_3); index of distance of this stellar population in the val array
    indb4_4 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 4, countindb4_4); index of the amplitude of this stellar population in the val array
    indb4_5 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 5, countindb4_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the B5 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 5,countindb5)
    IF countindb5 NE 0 THEN BEGIN
    popnumber+=1
    countb+=1
    indb5_1 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 1, countindb5_1); index of radius of this stellar population in the val array
    indb5_2 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 2, countindb5_2); index of temperature of this stellar population in the val array
    indb5_3 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 3, countindb5_3); index of distance of this stellar population in the val array
    indb5_4 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 4, countindb5_4); index of the amplitude of this stellar population in the val array
    indb5_5 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 5, countindb5_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the B6 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 6,countindb6)
    IF countindb6 NE 0 THEN BEGIN
    popnumber+=1
    countb+=1
    indb6_1 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 1, countindb6_1); index of radius of this stellar population in the val array
    indb6_2 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 2, countindb6_2); index of temperature of this stellar population in the val array
    indb6_3 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 3, countindb6_3); index of distance of this stellar population in the val array
    indb6_4 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 4, countindb6_4); index of the amplitude of this stellar population in the val array
    indb6_5 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 5, countindb6_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the B7 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 7,countindb7)
    IF countindb7 NE 0 THEN BEGIN
    popnumber+=1
    countb+=1
    indb7_1 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 1, countindb7_1); index of radius of this stellar population in the val array
    indb7_2 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 2, countindb7_2); index of temperature of this stellar population in the val array
    indb7_3 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 3, countindb7_3); index of distance of this stellar population in the val array
    indb7_4 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 4, countindb7_4); index of the amplitude of this stellar population in the val array
    indb7_5 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 5, countindb7_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the B8 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 8,countindb8)
    IF countindb8 NE 0 THEN BEGIN
    popnumber+=1
    countb+=1
    indb8_1 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 1, countindb8_1); index of radius of this stellar population in the val array
    indb8_2 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 2, countindb8_2); index of temperature of this stellar population in the val array
    indb8_3 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 3, countindb8_3); index of distance of this stellar population in the val array
    indb8_4 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 4, countindb8_4); index of the amplitude of this stellar population in the val array
    indb8_5 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 5, countindb8_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the B9 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 9,countindb9)
    IF countindb9 NE 0 THEN BEGIN
    popnumber+=1
    countb+=1
    indb9_1 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 1, countindb9_1); index of radius of this stellar population in the val array
    indb9_2 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 2, countindb9_2); index of temperature of this stellar population in the val array
    indb9_3 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 3, countindb9_3); index of distance of this stellar population in the val array
    indb9_4 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 4, countindb9_4); index of the amplitude of this stellar population in the val array
    indb9_5 =  where(strupcase(strmid(key,0,1)) EQ 'B' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 5, countindb9_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    
    ;======================================================
    
    ; Locating the A0 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 0,countinda0)
    IF countinda0 NE 0 THEN BEGIN
    popnumber+=1
    counta+=1
    inda0_1 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 0 and strmid(key,2,1) EQ 1, countinda0_1); index of radius of this stellar population in the val array
    inda0_2 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 0 and strmid(key,2,1) EQ 2, countinda0_2); index of temperature of this stellar population in the val array
    inda0_3 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 0 and strmid(key,2,1) EQ 3, countinda0_3); index of distance of this stellar population in the val array
    inda0_4 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 0 and strmid(key,2,1) EQ 4, countinda0_4); index of the amplitude of this stellar population in the val array
    inda0_5 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 0 and strmid(key,2,1) EQ 5, countinda0_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the A1 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 1,countinda1)
    IF countinda1 NE 0 THEN BEGIN
    popnumber+=1
    counta+=1
    inda1_1 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 1 and strmid(key,2,1) EQ 1, countinda1_1); index of radius of this stellar population in the val array
    inda1_2 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 1 and strmid(key,2,1) EQ 2, countinda1_2); index of temperature of this stellar population in the val array
    inda1_3 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 1 and strmid(key,2,1) EQ 3, countinda1_3); index of distance of this stellar population in the val array
    inda1_4 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 1 and strmid(key,2,1) EQ 4, countinda1_4); index of the amplitude of this stellar population in the val array
    inda1_5 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 1 and strmid(key,2,1) EQ 5, countinda1_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the A2 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 2,countinda2)
    IF countinda2 NE 0 THEN BEGIN
    popnumber+=1
    counta+=1
    inda2_1 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 2 and strmid(key,2,1) EQ 1, countinda2_1); index of radius of this stellar population in the val array
    inda2_2 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 2 and strmid(key,2,1) EQ 2, countinda2_2); index of temperature of this stellar population in the val array
    inda2_3 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 2 and strmid(key,2,1) EQ 3, countinda2_3); index of distance of this stellar population in the val array
    inda2_4 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 2 and strmid(key,2,1) EQ 4, countinda2_4); index of the amplitude of this stellar population in the val array
    inda2_5 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 2 and strmid(key,2,1) EQ 5, countinda2_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the A3 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 3,countinda3)
    IF countinda3 NE 0 THEN BEGIN
    popnumber+=1
    counta+=1
    inda3_1 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 1, countinda3_1); index of radius of this stellar population in the val array
    inda3_2 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 2, countinda3_2); index of temperature of this stellar population in the val array
    inda3_3 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 3, countinda3_3); index of distance of this stellar population in the val array
    inda3_4 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 4, countinda3_4); index of the amplitude of this stellar population in the val array
    inda3_5 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 5, countinda3_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the A4 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 4,countinda4)
    IF countinda4 NE 0 THEN BEGIN
    popnumber+=1
    counta+=1
    inda4_1 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 1, countinda4_1); index of radius of this stellar population in the val array
    inda4_2 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 2, countinda4_2); index of temperature of this stellar population in the val array
    inda4_3 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 3, countinda4_3); index of distance of this stellar population in the val array
    inda4_4 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 4, countinda4_4); index of the amplitude of this stellar population in the val array
    inda4_5 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 5, countinda4_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the A5 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 5,countinda5)
    IF countinda5 NE 0 THEN BEGIN
    popnumber+=1
    counta+=1
    inda5_1 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 1, countinda5_1); index of radius of this stellar population in the val array
    inda5_2 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 2, countinda5_2); index of temperature of this stellar population in the val array
    inda5_3 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 3, countinda5_3); index of distance of this stellar population in the val array
    inda5_4 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 4, countinda5_4); index of the amplitude of this stellar population in the val array
    inda5_5 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 5, countinda5_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the A6 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 6,countinda6)
    IF countinda6 NE 0 THEN BEGIN
    popnumber+=1
    counta+=1
    inda6_1 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 1, countinda6_1); index of radius of this stellar population in the val array
    inda6_2 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 2, countinda6_2); index of temperature of this stellar population in the val array
    inda6_3 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 3, countinda6_3); index of distance of this stellar population in the val array
    inda6_4 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 4, countinda6_4); index of the amplitude of this stellar population in the val array
    inda6_5 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 5, countinda6_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the A7 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 7,countinda7)
    IF countinda7 NE 0 THEN BEGIN
    popnumber+=1
    counta+=1
    inda7_1 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 1, countinda7_1); index of radius of this stellar population in the val array
    inda7_2 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 2, countinda7_2); index of temperature of this stellar population in the val array
    inda7_3 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 3, countinda7_3); index of distance of this stellar population in the val array
    inda7_4 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 4, countinda7_4); index of the amplitude of this stellar population in the val array
    inda7_5 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 5, countinda7_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the A8 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 8,countinda8)
    IF countinda8 NE 0 THEN BEGIN
    popnumber+=1
    counta+=1
    inda8_1 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 1, countinda8_1); index of radius of this stellar population in the val array
    inda8_2 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 2, countinda8_2); index of temperature of this stellar population in the val array
    inda8_3 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 3, countinda8_3); index of distance of this stellar population in the val array
    inda8_4 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 4, countinda8_4); index of the amplitude of this stellar population in the val array
    inda8_5 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 5, countinda8_5); index of the number of stars of this stellar population in the val array
    ENDIF
   
    ; Locating the A9 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 9,countinda9)
    IF countinda9 NE 0 THEN BEGIN
    popnumber+=1  
    counta+=1
    inda9_1 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 1, countinda9_1); index of radius of this stellar population in the val array
    inda9_2 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 2, countinda9_2); index of temperature of this stellar population in the val array
    inda9_3 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 3, countinda9_3); index of distance of this stellar population in the val array
    inda9_4 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 4, countinda9_4); index of the amplitude of this stellar population in the val array
    inda9_5 =  where(strupcase(strmid(key,0,1)) EQ 'A' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 5, countinda9_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    
    ;====================================================== 
     
    ; Locating the F0 stellar population parameters 
    ind = where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 0,countindf0)
    IF countindf0 NE 0 THEN BEGIN
    popnumber+=1
    countf+=1
    indf0_1 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 0 and strmid(key,2,1) EQ 1, countindf0_1); index of radius of this stellar population in the val array
    indf0_2 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 0 and strmid(key,2,1) EQ 2, countindf0_2); index of temperature of this stellar population in the val array
    indf0_3 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 0 and strmid(key,2,1) EQ 3, countindf0_3); index of distance of this stellar population in the val array
    indf0_4 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 0 and strmid(key,2,1) EQ 4, countindf0_4); index of the amplitude of this stellar population in the val array
    indf0_5 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 0 and strmid(key,2,1) EQ 5, countindf0_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the F1 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 1,countindf1)
    IF countindf1 NE 0 THEN BEGIN
    popnumber+=1
    countf+=1
    indf1_1 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 1 and strmid(key,2,1) EQ 1, countindf1_1); index of radius of this stellar population in the val array
    indf1_2 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 1 and strmid(key,2,1) EQ 2, countindf1_2); index of temperature of this stellar population in the val array
    indf1_3 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 1 and strmid(key,2,1) EQ 3, countindf1_3); index of distance of this stellar population in the val array
    indf1_4 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 1 and strmid(key,2,1) EQ 4, countindf1_4); index of the amplitude of this stellar population in the val array
    indf1_5 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 1 and strmid(key,2,1) EQ 5, countindf1_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the F2 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 2,countindf2)
    IF countindf2 NE 0 THEN BEGIN
    popnumber+=1
    countf+=1
    indf2_1 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 2 and strmid(key,2,1) EQ 1, countindf2_1); index of radius of this stellar population in the val array
    indf2_2 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 2 and strmid(key,2,1) EQ 2, countindf2_2); index of temperature of this stellar population in the val array
    indf2_3 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 2 and strmid(key,2,1) EQ 3, countindf2_3); index of distance of this stellar population in the val array
    indf2_4 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 2 and strmid(key,2,1) EQ 4, countindf2_4); index of the amplitude of this stellar population in the val array
    indf2_5 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 2 and strmid(key,2,1) EQ 5, countindf2_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the F3 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 3,countindf3)
    IF countindf3 NE 0 THEN BEGIN
    popnumber+=1
    countf+=1
    indf3_1 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 1, countindf3_1); index of radius of this stellar population in the val array
    indf3_2 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 2, countindf3_2); index of temperature of this stellar population in the val array
    indf3_3 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 3, countindf3_3); index of distance of this stellar population in the val array
    indf3_4 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 4, countindf3_4); index of the amplitude of this stellar population in the val array
    indf3_5 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 5, countindf3_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the F4 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 4,countindf4)
    IF countindf4 NE 0 THEN BEGIN
    popnumber+=1
    countf+=1
    indf4_1 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 1, countindf4_1); index of radius of this stellar population in the val array
    indf4_2 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 2, countindf4_2); index of temperature of this stellar population in the val array
    indf4_3 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 3, countindf4_3); index of distance of this stellar population in the val array
    indf4_4 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 4, countindf4_4); index of the amplitude of this stellar population in the val array
    indf4_5 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 5, countindf4_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the F5 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 5,countindf5)
    IF countindf5 NE 0 THEN BEGIN
    popnumber+=1
    countf+=1
    indf5_1 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 1, countindf5_1); index of radius of this stellar population in the val array
    indf5_2 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 2, countindf5_2); index of temperature of this stellar population in the val array
    indf5_3 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 3, countindf5_3); index of distance of this stellar population in the val array
    indf5_4 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 4, countindf5_4); index of the amplitude of this stellar population in the val array
    indf5_5 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 5, countindf5_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the F6 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 6,countindf6)
    IF countindf6 NE 0 THEN BEGIN
    popnumber+=1
    countf+=1
    indf6_1 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 1, countindf6_1); index of radius of this stellar population in the val array
    indf6_2 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 2, countindf6_2); index of temperature of this stellar population in the val array
    indf6_3 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 3, countindf6_3); index of distance of this stellar population in the val array
    indf6_4 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 4, countindf6_4); index of the amplitude of this stellar population in the val array
    indf6_5 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 5, countindf6_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the F7 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 7,countindf7)
    IF countindf7 NE 0 THEN BEGIN
    popnumber+=1
    countf+=1
    indf7_1 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 1, countindf7_1); index of radius of this stellar population in the val array
    indf7_2 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 2, countindf7_2); index of temperature of this stellar population in the val array
    indf7_3 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 3, countindf7_3); index of distance of this stellar population in the val array
    indf7_4 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 4, countindf7_4); index of the amplitude of this stellar population in the val array
    indf7_5 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 5, countindf7_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the F8 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 8,countindf8)
    IF countindf8 NE 0 THEN BEGIN
    popnumber+=1
    countf+=1
    indf8_1 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 1, countindf8_1); index of radius of this stellar population in the val array
    indf8_2 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 2, countindf8_2); index of temperature of this stellar population in the val array
    indf8_3 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 3, countindf8_3); index of distance of this stellar population in the val array
    indf8_4 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 4, countindf8_4); index of the amplitude of this stellar population in the val array
    indf8_5 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 5, countindf8_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the F9 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 9,countindf9)
    IF countindf9 NE 0 THEN BEGIN
    popnumber+=1  
    countf+=1
    indf9_1 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 1, countindf9_1); index of radius of this stellar population in the val array
    indf9_2 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 2, countindf9_2); index of temperature of this stellar population in the val array
    indf9_3 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 3, countindf9_3); index of distance of this stellar population in the val array
    indf9_4 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 4, countindf9_4); index of the amplitude of this stellar population in the val array
    indf9_5 =  where(strupcase(strmid(key,0,1)) EQ 'F' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 5, countindf9_5); index of the number of stars of this stellar population in the val array 
    ENDIF
    
    
    ;======================================================
    
    ; Locating the G0 stellar population parameters   
    ind = where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 0,countindg0)
    IF countindg0 NE 0 THEN BEGIN
    popnumber+=1
    countg+=1
    indg0_1 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 0 and strmid(key,2,1) EQ 1, countindg0_1); index of radius of this stellar population in the val array
    indg0_2 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 0 and strmid(key,2,1) EQ 2, countindg0_2); index of temperature of this stellar population in the val array
    indg0_3 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 0 and strmid(key,2,1) EQ 3, countindg0_3); index of distance of this stellar population in the val array
    indg0_4 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 0 and strmid(key,2,1) EQ 4, countindg0_4); index of the amplitude of this stellar population in the val array
    indg0_5 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 0 and strmid(key,2,1) EQ 5, countindg0_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the G1 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 1,countindg1)
    IF countindg1 NE 0 THEN BEGIN
    popnumber+=1
    countg+=1
    indg1_1 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 1 and strmid(key,2,1) EQ 1, countindg1_1); index of radius of this stellar population in the val array
    indg1_2 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 1 and strmid(key,2,1) EQ 2, countindg1_2); index of temperature of this stellar population in the val array
    indg1_3 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 1 and strmid(key,2,1) EQ 3, countindg1_3); index of distance of this stellar population in the val array
    indg1_4 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 1 and strmid(key,2,1) EQ 4, countindg1_4); index of the amplitude of this stellar population in the val array
    indg1_5 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 1 and strmid(key,2,1) EQ 5, countindg1_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the G2 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 2,countindg2) ;sun-like star
    IF countindg2 NE 0 THEN BEGIN
    popnumber+=1
    countg+=1
    indg2_1 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 2 and strmid(key,2,1) EQ 1, countindg2_1); index of radius of this stellar population in the val array
    indg2_2 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 2 and strmid(key,2,1) EQ 2, countindg2_2); index of temperature of this stellar population in the val array
    indg2_3 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 2 and strmid(key,2,1) EQ 3, countindg2_3); index of distance of this stellar population in the val array
    indg2_4 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 2 and strmid(key,2,1) EQ 4, countindg2_4); index of the amplitude of this stellar population in the val array
    indg2_5 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 2 and strmid(key,2,1) EQ 5, countindg2_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the G3 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 3,countindg3)
    IF countindg3 NE 0 THEN BEGIN
    popnumber+=1
    countg+=1
    indg3_1 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 1, countindg3_1); index of radius of this stellar population in the val array
    indg3_2 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 2, countindg3_2); index of temperature of this stellar population in the val array
    indg3_3 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 3, countindg3_3); index of distance of this stellar population in the val array
    indg3_4 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 4, countindg3_4); index of the amplitude of this stellar population in the val array
    indg3_5 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 3 and strmid(key,2,1) EQ 5, countindg3_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the G4 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 4,countindg4)
    IF countindg4 NE 0 THEN BEGIN
    popnumber+=1
    countg+=1
    indg4_1 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 1, countindg4_1); index of radius of this stellar population in the val array
    indg4_2 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 2, countindg4_2); index of temperature of this stellar population in the val array
    indg4_3 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 3, countindg4_3); index of distance of this stellar population in the val array
    indg4_4 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 4, countindg4_4); index of the amplitude of this stellar population in the val array
    indg4_5 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 4 and strmid(key,2,1) EQ 5, countindg4_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the G5 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 5,countindg5)
    IF countindg5 NE 0 THEN BEGIN
    popnumber+=1
    countg+=1
    indg5_1 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 1, countindg5_1); index of radius of this stellar population in the val array
    indg5_2 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 2, countindg5_2); index of temperature of this stellar population in the val array
    indg5_3 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 3, countindg5_3); index of distance of this stellar population in the val array
    indg5_4 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 4, countindg5_4); index of the amplitude of this stellar population in the val array
    indg5_5 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 5 and strmid(key,2,1) EQ 5, countindg5_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the G6 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 6,countindg6)
    IF countindg6 NE 0 THEN BEGIN
    popnumber+=1
    countg+=1
    indg6_1 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 1, countindg6_1); index of radius of this stellar population in the val array
    indg6_2 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 2, countindg6_2); index of temperature of this stellar population in the val array
    indg6_3 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 3, countindg6_3); index of distance of this stellar population in the val array
    indg6_4 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 4, countindg6_4); index of the amplitude of this stellar population in the val array
    indg6_5 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 6 and strmid(key,2,1) EQ 5, countindg6_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the G7 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 7,countindg7)
    IF countindg7 NE 0 THEN BEGIN
    popnumber+=1
    countg+=1
    indg7_1 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 1, countindg7_1); index of radius of this stellar population in the val array
    indg7_2 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 2, countindg7_2); index of temperature of this stellar population in the val array
    indg7_3 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 3, countindg7_3); index of distance of this stellar population in the val array
    indg7_4 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 4, countindg7_4); index of the amplitude of this stellar population in the val array
    indg7_5 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 7 and strmid(key,2,1) EQ 5, countindg7_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the G8 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 8,countindg8)
    IF countindg8 NE 0 THEN BEGIN
    popnumber+=1
    countg+=1
    indg8_1 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 1, countindg8_1); index of radius of this stellar population in the val array
    indg8_2 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 2, countindg8_2); index of temperature of this stellar population in the val array
    indg8_3 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 3, countindg8_3); index of distance of this stellar population in the val array
    indg8_4 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 4, countindg8_4); index of the amplitude of this stellar population in the val array
    indg8_5 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 8 and strmid(key,2,1) EQ 5, countindg8_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    ; Locating the G9 stellar population parameters
    ind = where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 9,countindg9)       
    IF countindg9 NE 0 THEN BEGIN
    popnumber+=1   
    countg+=1
    indg9_1 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 1, countindg9_1); index of radius of this stellar population in the val array
    indg9_2 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 2, countindg9_2); index of temperature of this stellar population in the val array
    indg9_3 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 3, countindg9_3); index of distance of this stellar population in the val array
    indg9_4 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 4, countindg9_4); index of the amplitude of this stellar population in the val array
    indg9_5 =  where(strupcase(strmid(key,0,1)) EQ 'G' and strmid(key,1,1) EQ 9 and strmid(key,2,1) EQ 5, countindg9_5); index of the number of stars of this stellar population in the val array
    ENDIF
    
    
    comp_pop=replicate(one_pop,popnumber) ; Replication of the default and initialized stellar population structure to create the composite stellar population structure. All the tag values are by default set to te null value
    
    
    
    ;Filling the tags of the compsite stellar population structure using the indices defined above
    
    FOR i=0L,popnumber-1 DO BEGIN ; Looping over all the structure fields 
   
        IF counto NE 0 THEN BEGIN ; Filling the structure of the O STELLAR POPULATION(S)
        
                    
            FOR k=0L,counto-1 DO BEGIN 
                
                IF countindo3 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'O3V_stellar_population'
                    IF countindo3_1 NE 0 THEN comp_pop(k+i).radius = (val(indo3_1))(0) ELSE comp_pop(k+i).radius = 15.0*rsun2cm ;(cm,cgs)
                    IF countindo3_2 NE 0 THEN comp_pop(k+i).temperature = (val(indo3_2))(0) ELSE comp_pop(k+i).temperature = 44.9e3 ;(K)
                    IF countindo3_3 NE 0 THEN comp_pop(k+i).distance = (val(indo3_3))(0) ELSE comp_pop(k+i).distance = 10.0 ; should be lower limited in the general procedure because this is the average distance between two stars
                    IF countindo3_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indo3_4))(0) ELSE comp_pop(k+i).amplitude = 1.0 ; is this a dilution factor?
                    IF countindo3_5 NE 0 THEN comp_pop(k+i).nstars = (val(indo3_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1 
                ENDIF
            
                IF countindo4 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'O4V_stellar_population'
                    IF countindo4_1 NE 0 THEN comp_pop(k+i).radius = (val(indo4_1))(0) ELSE comp_pop(k+i).radius = 13.43*rsun2cm
                    IF countindo4_2 NE 0 THEN comp_pop(k+i).temperature = (val(indo4_2))(0) ELSE comp_pop(k+i).temperature = 42.9e3
                    IF countindo4_3 NE 0 THEN comp_pop(k+i).distance = (val(indo4_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindo4_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indo4_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindo4_5 NE 0 THEN comp_pop(k+i).nstars = (val(indo4_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1      
                ENDIF
                
                
                IF countindo5 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'O5V_stellar_population'
                    IF countindo5_1 NE 0 THEN comp_pop(k+i).radius = (val(indo5_1))(0) ELSE comp_pop(k+i).radius = 12*rsun2cm
                    IF countindo5_2 NE 0 THEN comp_pop(k+i).temperature = (val(indo5_2))(0) ELSE comp_pop(k+i).temperature = 41.4e3
                    IF countindo5_3 NE 0 THEN comp_pop(k+i).distance = (val(indo5_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindo5_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indo5_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindo5_5 NE 0 THEN comp_pop(k+i).nstars = (val(indo5_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1          
                ENDIF
        
                
                
                IF countindo6 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'O6V_stellar_population'
                    IF countindo6_1 NE 0 THEN comp_pop(k+i).radius = (val(indo6_1))(0) ELSE comp_pop(k+i).radius = 10.71*rsun2cm
                    IF countindo6_2 NE 0 THEN comp_pop(k+i).temperature = (val(indo6_2))(0) ELSE comp_pop(k+i).temperature = 39.5e3
                    IF countindo6_3 NE 0 THEN comp_pop(k+i).distance = (val(indo6_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindo6_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indo6_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindo6_5 NE 0 THEN comp_pop(k+i).nstars = (val(indo6_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1        
                ENDIF
        
                
                IF countindo7 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'O7V_stellar_population'
                    IF countindo7_1 NE 0 THEN comp_pop(k+i).radius = (val(indo7_1))(0) ELSE comp_pop(k+i).radius = 9.52*rsun2cm
                    IF countindo7_2 NE 0 THEN comp_pop(k+i).temperature = (val(indo7_2))(0) ELSE comp_pop(k+i).temperature = 37.1e3
                    IF countindo7_3 NE 0 THEN comp_pop(k+i).distance = (val(indo7_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindo7_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indo7_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindo7_5 NE 0 THEN comp_pop(k+i).nstars = (val(indo7_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1          
                ENDIF
                    
                
                IF countindo8 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'O8V_stellar_population'
                    IF countindo8_1 NE 0 THEN comp_pop(k+i).radius = (val(indo8_1))(0) ELSE comp_pop(k+i).radius = 8.5*rsun2cm
                    IF countindo8_2 NE 0 THEN comp_pop(k+i).temperature = (val(indo8_2))(0) ELSE comp_pop(k+i).temperature = 35.1e3
                    IF countindo8_3 NE 0 THEN comp_pop(k+i).distance = (val(indo8_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindo8_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indo8_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindo8_5 NE 0 THEN comp_pop(k+i).nstars = (val(indo8_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1         
                ENDIF
        
                
                IF countindo9 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'O9V_stellar_population'
                    IF countindo9_1 NE 0 THEN comp_pop(k+i).radius = (val(indo9_1))(0) ELSE comp_pop(k+i).radius = 7.51*rsun2cm
                    IF countindo9_2 NE 0 THEN comp_pop(k+i).temperature = (val(indo9_2))(0) ELSE comp_pop(k+i).temperature = 33.3e3
                    IF countindo9_3 NE 0 THEN comp_pop(k+i).distance = (val(indo9_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindo9_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indo9_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindo9_5 NE 0 THEN comp_pop(k+i).nstars = (val(indo9_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1         
                ENDIF
                        
                    
            ENDFOR
                    
            counto=0. 
        i+=k-1
        ENDIF
        ;i+=k-1

                    
    ;==============================================================================================
                
                        
        IF countb NE 0 THEN BEGIN ; Filling the structure of the B STELLAR POPULATION(S)
                    
            FOR k=0L,countb-1 DO BEGIN
                
                IF countindb0 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'B0V_stellar_population'
                    IF countindb0_1 NE 0 THEN comp_pop(k+i).radius = (val(indb0_1))(0) ELSE comp_pop(k+i).radius = 7.16*rsun2cm
                    IF countindb0_2 NE 0 THEN comp_pop(k+i).temperature = (val(indb0_2))(0) ELSE comp_pop(k+i).temperature = 31.4e3
                    IF countindb0_3 NE 0 THEN comp_pop(k+i).distance = (val(indb0_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindb0_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indb0_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindb0_5 NE 0 THEN comp_pop(k+i).nstars = (val(indb0_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1         
                ENDIF
                
                
                
                IF countindb1 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'B1V_stellar_population'
                    IF countindb1_1 NE 0 THEN comp_pop(k+i).radius = (val(indb1_1))(0) ELSE comp_pop(k+i).radius = 5.71*rsun2cm
                    IF countindb1_2 NE 0 THEN comp_pop(k+i).temperature = (val(indb1_2))(0) ELSE comp_pop(k+i).temperature = 26.0e3 
                    IF countindb1_3 NE 0 THEN comp_pop(k+i).distance = (val(indb1_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindb1_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indb1_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindb1_5 NE 0 THEN comp_pop(k+i).nstars = (val(indb1_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1         
                ENDIF
                
                
                
                IF countindb2 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'B2V_stellar_population'
                    IF countindb2_1 NE 0 THEN comp_pop(k+i).radius = (val(indb2_1))(0) ELSE comp_pop(k+i).radius = 4.06*rsun2cm
                    IF countindb2_2 NE 0 THEN comp_pop(k+i).temperature = (val(indb2_2))(0) ELSE comp_pop(k+i).temperature = 20.6e3 
                    IF countindb2_3 NE 0 THEN comp_pop(k+i).distance = (val(indb2_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindb2_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indb2_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindb2_5 NE 0 THEN comp_pop(k+i).nstars = (val(indb2_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1          
                ENDIF
                
                
                
                IF countindb3 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'B3V_stellar_population'
                    IF countindb3_1 NE 0 THEN comp_pop(k+i).radius = (val(indb3_1))(0) ELSE comp_pop(k+i).radius = 3.61*rsun2cm
                    IF countindb3_2 NE 0 THEN comp_pop(k+i).temperature = (val(indb3_2))(0) ELSE comp_pop(k+i).temperature = 17.0e3
                    IF countindb3_3 NE 0 THEN comp_pop(k+i).distance = (val(indb3_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindb3_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indb3_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindb3_5 NE 0 THEN comp_pop(k+i).nstars = (val(indb3_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1         
                ENDIF
            
                IF countindb4 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'B4V_stellar_population'
                    IF countindb4_1 NE 0 THEN comp_pop(k+i).radius = (val(indb4_1))(0) ELSE comp_pop(k+i).radius = 3.46*rsun2cm
                    IF countindb4_2 NE 0 THEN comp_pop(k+i).temperature = (val(indb4_2))(0) ELSE comp_pop(k+i).temperature = 16.4e3 
                    IF countindb4_3 NE 0 THEN comp_pop(k+i).distance = (val(indb4_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindb4_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indb4_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindb4_5 NE 0 THEN comp_pop(k+i).nstars = (val(indb4_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1       
                ENDIF
                
                
                IF countindb5 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'B5V_stellar_population'
                    IF countindb5_1 NE 0 THEN comp_pop(k+i).radius = (val(indb5_1))(0) ELSE comp_pop(k+i).radius = 3.36*rsun2cm
                    IF countindb5_2 NE 0 THEN comp_pop(k+i).temperature = (val(indb5_2))(0) ELSE comp_pop(k+i).temperature = 15.7e3 
                    IF countindb5_3 NE 0 THEN comp_pop(k+i).distance = (val(indb5_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindb5_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indb5_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindb5_5 NE 0 THEN comp_pop(k+i).nstars = (val(indb5_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1         
                ENDIF
        
                
                IF countindb6 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'B6V_stellar_population'
                    IF countindb6_1 NE 0 THEN comp_pop(k+i).radius = (val(indb6_1))(0) ELSE comp_pop(k+i).radius = 3.27*rsun2cm
                    IF countindb6_2 NE 0 THEN comp_pop(k+i).temperature = (val(indb6_2))(0) ELSE comp_pop(k+i).temperature = 14.5e3 
                    IF countindb6_3 NE 0 THEN comp_pop(k+i).distance = (val(indb6_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindb6_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indb6_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindb6_5 NE 0 THEN comp_pop(k+i).nstars = (val(indb6_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1        
                ENDIF
        
                
                IF countindb7 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'B7V_stellar_population'
                    IF countindb7_1 NE 0 THEN comp_pop(k+i).radius = (val(indb7_1))(0) ELSE comp_pop(k+i).radius = 2.94*rsun2cm
                    IF countindb7_2 NE 0 THEN comp_pop(k+i).temperature = (val(indb7_2))(0) ELSE comp_pop(k+i).temperature = 14.0e3 
                    IF countindb7_3 NE 0 THEN comp_pop(k+i).distance = (val(indb7_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindb7_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indb7_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindb7_5 NE 0 THEN comp_pop(k+i).nstars = (val(indb7_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1          
                ENDIF
                    
                
                IF countindb8 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'B8V_stellar_population'
                    IF countindb8_1 NE 0 THEN comp_pop(k+i).radius = (val(indb8_1))(0) ELSE comp_pop(k+i).radius = 2.86*rsun2cm
                    IF countindb8_2 NE 0 THEN comp_pop(k+i).temperature = (val(indb8_2))(0) ELSE comp_pop(k+i).temperature = 12.3e3 
                    IF countindb8_3 NE 0 THEN comp_pop(k+i).distance = (val(indb8_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindb8_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indb8_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindb8_5 NE 0 THEN comp_pop(k+i).nstars = (val(indb8_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1         
                ENDIF
        
                
                IF countindb9 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'B9V_stellar_population'
                    IF countindb9_1 NE 0 THEN comp_pop(k+i).radius = (val(indb9_1))(0) ELSE comp_pop(k+i).radius = 2.49*rsun2cm
                    IF countindb9_2 NE 0 THEN comp_pop(k+i).temperature = (val(indb9_2))(0) ELSE comp_pop(k+i).temperature = 10.7e3 
                    IF countindb9_3 NE 0 THEN comp_pop(k+i).distance = (val(indb9_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindb9_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indb9_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindb9_5 NE 0 THEN comp_pop(k+i).nstars = (val(indb9_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1          
                ENDIF
                        
                    
            ENDFOR
                    
            countb=0. 
  
        i+=k-1
        ENDIF 
        ;i+=k-1                                       
    ;==============================================================================================
                        
        IF counta NE 0 THEN BEGIN ; Filling the structure of the A STELLAR POPULATION(S)
                    
            FOR k=0L+i,counta-1+i DO BEGIN
                
                IF countinda0 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'A0V_stellar_population'
                    IF countinda0_1 NE 0 THEN comp_pop(k+i).radius = (val(inda0_1))(0) ELSE comp_pop(k+i).radius = 2.193*rsun2cm
                    IF countinda0_2 NE 0 THEN comp_pop(k+i).temperature = (val(inda0_2))(0) ELSE comp_pop(k+i).temperature = 9.7e3
                    IF countinda0_3 NE 0 THEN comp_pop(k+i).distance = (val(inda0_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countinda0_4 NE 0 THEN comp_pop(k+i).amplitude = (val(inda0_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countinda0_5 NE 0 THEN comp_pop(k+i).nstars = (val(inda0_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1          
                ENDIF
                
                
                
                IF countinda1 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'A1V_stellar_population'
                    IF countinda1_1 NE 0 THEN comp_pop(k+i).radius = (val(inda1_1))(0) ELSE comp_pop(k+i).radius = 2.136*rsun2cm
                    IF countinda1_2 NE 0 THEN comp_pop(k+i).temperature = (val(inda1_2))(0) ELSE comp_pop(k+i).temperature = 9.3e3
                    IF countinda1_3 NE 0 THEN comp_pop(k+i).distance = (val(inda1_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countinda1_4 NE 0 THEN comp_pop(k+i).amplitude = (val(inda1_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countinda1_5 NE 0 THEN comp_pop(k+i).nstars = (val(inda1_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1        
                ENDIF
                
                
                
                IF countinda2 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'A2V_stellar_population'
                    IF countinda2_1 NE 0 THEN comp_pop(k+i).radius = (val(inda2_1))(0) ELSE comp_pop(k+i).radius = 2.117*rsun2cm
                    IF countinda2_2 NE 0 THEN comp_pop(k+i).temperature = (val(inda2_2))(0) ELSE comp_pop(k+i).temperature = 8.8e3
                    IF countinda2_3 NE 0 THEN comp_pop(k+i).distance = (val(inda2_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countinda2_4 NE 0 THEN comp_pop(k+i).amplitude = (val(inda2_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countinda2_5 NE 0 THEN comp_pop(k+i).nstars = (val(inda2_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1        
                ENDIF
                
                
                
                IF countinda3 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'A3V_stellar_population'
                    IF countinda3_1 NE 0 THEN comp_pop(k+i).radius = (val(inda3_1))(0) ELSE comp_pop(k+i).radius = 1.861*rsun2cm
                    IF countinda3_2 NE 0 THEN comp_pop(k+i).temperature = (val(inda3_2))(0) ELSE comp_pop(k+i).temperature = 8.6e3
                    IF countinda3_3 NE 0 THEN comp_pop(k+i).distance = (val(inda3_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countinda3_4 NE 0 THEN comp_pop(k+i).amplitude = (val(inda3_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countinda3_5 NE 0 THEN comp_pop(k+i).nstars = (val(inda3_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1          
                ENDIF
            
                IF countinda4 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'A4V_stellar_population'
                    IF countinda4_1 NE 0 THEN comp_pop(k+i).radius = (val(inda4_1))(0) ELSE comp_pop(k+i).radius = 1.794*rsun2cm
                    IF countinda4_2 NE 0 THEN comp_pop(k+i).temperature = (val(inda4_2))(0) ELSE comp_pop(k+i).temperature = 8.25e3
                    IF countinda4_3 NE 0 THEN comp_pop(k+i).distance = (val(inda4_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countinda4_4 NE 0 THEN comp_pop(k+i).amplitude = (val(inda4_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countinda4_5 NE 0 THEN comp_pop(k+i).nstars = (val(inda4_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1         
                ENDIF
                
                
                IF countinda5 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'A5V_stellar_population'
                    IF countinda5_1 NE 0 THEN comp_pop(k+i).radius = (val(inda5_1))(0) ELSE comp_pop(k+i).radius = 1.785*rsun2cm
                    IF countinda5_2 NE 0 THEN comp_pop(k+i).temperature = (val(inda5_2))(0) ELSE comp_pop(k+i).temperature = 8.1e3
                    IF countinda5_3 NE 0 THEN comp_pop(k+i).distance = (val(inda5_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countinda5_4 NE 0 THEN comp_pop(k+i).amplitude = (val(inda5_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countinda5_5 NE 0 THEN comp_pop(k+i).nstars = (val(inda5_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1          
                ENDIF
        
                
                IF countinda6 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'A6V_stellar_population'
                    IF countinda6_1 NE 0 THEN comp_pop(k+i).radius = (val(inda6_1))(0) ELSE comp_pop(k+i).radius = 1.775*rsun2cm
                    IF countinda6_2 NE 0 THEN comp_pop(k+i).temperature = (val(inda6_2))(0) ELSE comp_pop(k+i).temperature = 7.91e3 
                    IF countinda6_3 NE 0 THEN comp_pop(k+i).distance = (val(inda6_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countinda6_4 NE 0 THEN comp_pop(k+i).amplitude = (val(inda6_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countinda6_5 NE 0 THEN comp_pop(k+i).nstars = (val(inda6_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1        
                ENDIF
        
                
                IF countinda7 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'A7V_stellar_population'
                    IF countinda7_1 NE 0 THEN comp_pop(k+i).radius = (val(inda7_1))(0) ELSE comp_pop(k+i).radius = 1.75*rsun2cm
                    IF countinda7_2 NE 0 THEN comp_pop(k+i).temperature = (val(inda7_2))(0) ELSE comp_pop(k+i).temperature = 7.76e3 
                    IF countinda7_3 NE 0 THEN comp_pop(k+i).distance = (val(inda7_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countinda7_4 NE 0 THEN comp_pop(k+i).amplitude = (val(inda7_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countinda7_5 NE 0 THEN comp_pop(k+i).nstars = (val(inda7_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1         
                ENDIF
                    
                
                IF countinda8 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'A8V_stellar_population'
                    IF countinda8_1 NE 0 THEN comp_pop(k+i).radius = (val(inda8_1))(0) ELSE comp_pop(k+i).radius = 1.747*rsun2cm
                    IF countinda8_2 NE 0 THEN comp_pop(k+i).temperature = (val(inda8_2))(0) ELSE comp_pop(k+i).temperature = 7.590e3
                    IF countinda8_3 NE 0 THEN comp_pop(k+i).distance = (val(inda8_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countinda8_4 NE 0 THEN comp_pop(k+i).amplitude = (val(inda8_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countinda8_5 NE 0 THEN comp_pop(k+i).nstars = (val(inda8_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1        
                ENDIF
        
                
                IF countinda9 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'A9V_stellar_population'
                    IF countinda9_1 NE 0 THEN comp_pop(k+i).radius = (val(inda9_1))(0) ELSE comp_pop(k+i).radius = 1.747*rsun2cm
                    IF countinda9_2 NE 0 THEN comp_pop(k+i).temperature = (val(inda9_2))(0) ELSE comp_pop(k+i).temperature = 7.4e3 
                    IF countinda9_3 NE 0 THEN comp_pop(k+i).distance = (val(inda9_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countinda9_4 NE 0 THEN comp_pop(k+i).amplitude = (val(inda9_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countinda9_5 NE 0 THEN comp_pop(k+i).nstars = (val(inda9_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1       
                ENDIF
                        
                        
            ENDFOR
                        
            counta=0. 
        i+=k-1
        ENDIF
        ;i+=k-1  
                            
    ;==============================================================================================    
                        
                    
        IF countf NE 0 THEN BEGIN ; Filling the structure of the F STELLAR POPULATION(S)
                 
            FOR k=0L+i,countf-1+i DO BEGIN
                
                IF countindf0 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'F0V_stellar_population'
                    IF countindf0_1 NE 0 THEN comp_pop(k+i).radius = (val(indf0_1))(0) ELSE comp_pop(k+i).radius = 1.728*rsun2cm
                    IF countindf0_2 NE 0 THEN comp_pop(k+i).temperature = (val(indf0_2))(0) ELSE comp_pop(k+i).temperature = 7.22e3
                    IF countindf0_3 NE 0 THEN comp_pop(k+i).distance = (val(indf0_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindf0_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indf0_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindf0_5 NE 0 THEN comp_pop(k+i).nstars = (val(indf0_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1        
                ENDIF
                
                
                
                IF countindf1 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'F1V_stellar_population'
                    IF countindf1_1 NE 0 THEN comp_pop(k+i).radius = (val(indf1_1))(0) ELSE comp_pop(k+i).radius = 1.679*rsun2cm
                    IF countindf1_2 NE 0 THEN comp_pop(k+i).temperature = (val(indf1_2))(0) ELSE comp_pop(k+i).temperature = 7.02e3
                    IF countindf1_3 NE 0 THEN comp_pop(k+i).distance = (val(indf1_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindf1_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indf1_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindf1_5 NE 0 THEN comp_pop(k+i).nstars = (val(indf1_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1          
                ENDIF
                
                
                
                IF countindf2 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'F2V_stellar_population'
                    IF countindf2_1 NE 0 THEN comp_pop(k+i).radius = (val(indf2_1))(0) ELSE comp_pop(k+i).radius = 1.622*rsun2cm
                    IF countindf2_2 NE 0 THEN comp_pop(k+i).temperature = (val(indf2_2))(0) ELSE comp_pop(k+i).temperature = 6.820e3
                    IF countindf2_3 NE 0 THEN comp_pop(k+i).distance = (val(indf2_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindf2_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indf2_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindf2_5 NE 0 THEN comp_pop(k+i).nstars = (val(indf2_5))(0) ELSE comp_pop(k+i).nstars =  stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1          
                ENDIF
                
                
                
                IF countindf3 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'F3V_stellar_population'
                    IF countindf3_1 NE 0 THEN comp_pop(k+i).radius = (val(indf3_1))(0) ELSE comp_pop(k+i).radius = 1.578*rsun2cm
                    IF countindf3_2 NE 0 THEN comp_pop(k+i).temperature = (val(indf3_2))(0) ELSE comp_pop(k+i).temperature = 6.75e3
                    IF countindf3_3 NE 0 THEN comp_pop(k+i).distance = (val(indf3_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindf3_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indf3_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindf3_5 NE 0 THEN comp_pop(k+i).nstars = (val(indf3_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1          
                ENDIF
            
                IF countindf4 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'F4V_stellar_population'
                    IF countindf4_1 NE 0 THEN comp_pop(k+i).radius = (val(indf4_1))(0) ELSE comp_pop(k+i).radius = 1.533*rsun2cm
                    IF countindf4_2 NE 0 THEN comp_pop(k+i).temperature = (val(indf4_2))(0) ELSE comp_pop(k+i).temperature = 6.67e3
                    IF countindf4_3 NE 0 THEN comp_pop(k+i).distance = (val(indf4_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindf4_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indf4_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindf4_5 NE 0 THEN comp_pop(k+i).nstars = (val(indf4_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1          
                ENDIF
                
                
                IF countindf5 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'F5V_stellar_population'
                    IF countindf5_1 NE 0 THEN comp_pop(k+i).radius = (val(indf5_1))(0) ELSE comp_pop(k+i).radius = 1.473*rsun2cm
                    IF countindf5_2 NE 0 THEN comp_pop(k+i).temperature = (val(indf5_2))(0) ELSE comp_pop(k+i).temperature = 6.55e3
                    IF countindf5_3 NE 0 THEN comp_pop(k+i).distance = (val(indf5_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindf5_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indf5_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindf5_5 NE 0 THEN comp_pop(k+i).nstars = (val(indf5_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1          
                ENDIF
        
                
                IF countindf6 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'F6V_stellar_population'
                    IF countindf6_1 NE 0 THEN comp_pop(k+i).radius = (val(indf6_1))(0) ELSE comp_pop(k+i).radius = 1.359*rsun2cm
                    IF countindf6_2 NE 0 THEN comp_pop(k+i).temperature = (val(indf6_2))(0) ELSE comp_pop(k+i).temperature = 6.35e3
                    IF countindf6_3 NE 0 THEN comp_pop(k+i).distance = (val(indf6_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindf6_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indf6_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindf6_5 NE 0 THEN comp_pop(k+i).nstars = (val(indf6_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1           
                ENDIF
        
                
                IF countindf7 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'F7V_stellar_population'
                    IF countindf7_1 NE 0 THEN comp_pop(k+i).radius = (val(indf7_1))(0) ELSE comp_pop(k+i).radius = 1.324*rsun2cm
                    IF countindf7_2 NE 0 THEN comp_pop(k+i).temperature = (val(indf7_2))(0) ELSE comp_pop(k+i).temperature = 6.28e3
                    IF countindf7_3 NE 0 THEN comp_pop(k+i).distance = (val(indf7_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindf7_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indf7_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindf7_5 NE 0 THEN comp_pop(k+i).nstars = (val(indf7_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1           
                ENDIF
                    
                
                IF countindf8 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'F8V_stellar_population'
                    IF countindf8_1 NE 0 THEN comp_pop(k+i).radius = (val(indf8_1))(0) ELSE comp_pop(k+i).radius = 1.221*rsun2cm
                    IF countindf8_2 NE 0 THEN comp_pop(k+i).temperature = (val(indf8_2))(0) ELSE comp_pop(k+i).temperature = 6.18e3
                    IF countindf8_3 NE 0 THEN comp_pop(k+i).distance = (val(indf8_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindf8_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indf8_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindf8_5 NE 0 THEN comp_pop(k+i).nstars = (val(indf8_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1           
                ENDIF
        
                
                IF countindf9 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'F9V_stellar_population'
                    IF countindf9_1 NE 0 THEN comp_pop(k+i).radius = (val(indf9_1))(0) ELSE comp_pop(k+i).radius = 1.167*rsun2cm
                    IF countindf9_2 NE 0 THEN comp_pop(k+i).temperature = (val(indf9_2))(0) ELSE comp_pop(k+i).temperature = 6.05e3
                    IF countindf9_3 NE 0 THEN comp_pop(k+i).distance = (val(indf9_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindf9_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indf9_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindf9_5 NE 0 THEN comp_pop(k+i).nstars = (val(indf9_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1           
                ENDIF
                                    
                                        
            ENDFOR
                                                        
            countf=0.  
        i+=k-1
        ENDIF
        ;i+=k-1  
                                                                    
    ;============================================================================================== 
                            
        IF countg NE 0 THEN BEGIN ; Filling the structure of the G STELLAR POPULATION(S)
                    
            FOR k=0L+i,countg-1+i DO BEGIN
                
                IF countindg0 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'G0V_stellar_population'
                    IF countindg0_1 NE 0 THEN comp_pop(k+i).radius = (val(indg0_1))(0) ELSE comp_pop(k+i).radius = 1.1*rsun2cm
                    IF countindg0_2 NE 0 THEN comp_pop(k+i).temperature = (val(indg0_2))(0) ELSE comp_pop(k+i).temperature = 5.93e3
                    IF countindg0_3 NE 0 THEN comp_pop(k+i).distance = (val(indg0_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindg0_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indg0_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindg0_5 NE 0 THEN comp_pop(k+i).nstars = (val(indg0_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1         
                ENDIF
                
                
                
                IF countindg1 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'G1V_stellar_population'
                    IF countindg1_1 NE 0 THEN comp_pop(k+i).radius = (val(indg1_1))(0) ELSE comp_pop(k+i).radius = 1.06*rsun2cm
                    IF countindg1_2 NE 0 THEN comp_pop(k+i).temperature = (val(indg1_2))(0) ELSE comp_pop(k+i).temperature = 5.86e3 
                    IF countindg1_3 NE 0 THEN comp_pop(k+i).distance = (val(indg1_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindg1_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indg1_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindg1_5 NE 0 THEN comp_pop(k+i).nstars = (val(indg1_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1 
                ENDIF
                
                
                
                IF countindg2 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'G2V_stellar_population'
                    IF countindg2_1 NE 0 THEN comp_pop(k+i).radius = (val(indg2_1))(0) ELSE comp_pop(k+i).radius = 1.012*rsun2cm
                    IF countindg2_2 NE 0 THEN comp_pop(k+i).temperature = (val(indg2_2))(0) ELSE comp_pop(k+i).temperature = 5.77e3
                    IF countindg2_3 NE 0 THEN comp_pop(k+i).distance = (val(indg2_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindg2_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indg2_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindg2_5 NE 0 THEN comp_pop(k+i).nstars = (val(indg2_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1          
                ENDIF
                
                
                
                IF countindg3 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'G3V_stellar_population'
                    IF countindg3_1 NE 0 THEN comp_pop(k+i).radius = (val(indg3_1))(0) ELSE comp_pop(k+i).radius = 1.002*rsun2cm
                    IF countindg3_2 NE 0 THEN comp_pop(k+i).temperature = (val(indg3_2))(0) ELSE comp_pop(k+i).temperature = 5.72e3
                    IF countindg3_3 NE 0 THEN comp_pop(k+i).distance = (val(indg3_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindg3_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indg3_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindg3_5 NE 0 THEN comp_pop(k+i).nstars = (val(indg3_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1  
                ENDIF
            
                IF countindg4 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'G4V_stellar_population'
                    IF countindg4_1 NE 0 THEN comp_pop(k+i).radius = (val(indg4_1))(0) ELSE comp_pop(k+i).radius = 0.991*rsun2cm
                    IF countindg4_2 NE 0 THEN comp_pop(k+i).temperature = (val(indg4_2))(0) ELSE comp_pop(k+i).temperature = 5.68e3
                    IF countindg4_3 NE 0 THEN comp_pop(k+i).distance = (val(indg4_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindg4_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indg4_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindg4_5 NE 0 THEN comp_pop(k+i).nstars = (val(indg4_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1 
                ENDIF
                
                
                IF countindg5 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'G5V_stellar_population'
                    IF countindg5_1 NE 0 THEN comp_pop(k+i).radius = (val(indg5_1))(0) ELSE comp_pop(k+i).radius = 0.977*rsun2cm
                    IF countindg5_2 NE 0 THEN comp_pop(k+i).temperature = (val(indg5_2))(0) ELSE comp_pop(k+i).temperature = 5.66e3
                    IF countindg5_3 NE 0 THEN comp_pop(k+i).distance = (val(indg5_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindg5_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indg5_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindg5_5 NE 0 THEN comp_pop(k+i).nstars = (val(indg5_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1         
                ENDIF
        
                
                IF countindg6 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'G6V_stellar_population'
                    IF countindg6_1 NE 0 THEN comp_pop(k+i).radius = (val(indg6_1))(0) ELSE comp_pop(k+i).radius = 0.949*rsun2cm
                    IF countindg6_2 NE 0 THEN comp_pop(k+i).temperature = (val(indg6_2))(0) ELSE comp_pop(k+i).temperature = 5.6e3
                    IF countindg6_3 NE 0 THEN comp_pop(k+i).distance = (val(indg6_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindg6_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indg6_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindg6_5 NE 0 THEN comp_pop(k+i).nstars = (val(indg6_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1          
                ENDIF
        
                
                IF countindg7 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'G7V_stellar_population'
                    IF countindg7_1 NE 0 THEN comp_pop(k+i).radius = (val(indg7_1))(0) ELSE comp_pop(k+i).radius = 0.927*rsun2cm
                    IF countindg7_2 NE 0 THEN comp_pop(k+i).temperature = (val(indg7_2))(0) ELSE comp_pop(k+i).temperature = 5.55e3
                    IF countindg7_3 NE 0 THEN comp_pop(k+i).distance = (val(indg7_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindg7_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indg7_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindg7_5 NE 0 THEN comp_pop(k+i).nstars = (val(indg7_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1       
                ENDIF
                    
                
                IF countindg8 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'G8V_stellar_population'
                    IF countindg8_1 NE 0 THEN comp_pop(k+i).radius = (val(indg8_1))(0) ELSE comp_pop(k+i).radius = 0.914*rsun2cm
                    IF countindg8_2 NE 0 THEN comp_pop(k+i).temperature = (val(indg8_2))(0) ELSE comp_pop(k+i).temperature = 5.48e3
                    IF countindg8_3 NE 0 THEN comp_pop(k+i).distance = (val(indg8_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindg8_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indg8_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindg8_5 NE 0 THEN comp_pop(k+i).nstars = (val(indg8_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance
                    K+=1   
                ENDIF
        
                
                IF countindg9 NE 0 THEN BEGIN
                    comp_pop(k+i).popid = 'G9V_stellar_population'
                    IF countindg9_1 NE 0 THEN comp_pop(k+i).radius = (val(indg9_1))(0) ELSE comp_pop(k+i).radius = 0.853*rsun2cm
                    IF countindg9_2 NE 0 THEN comp_pop(k+i).temperature = (val(indg9_2))(0) ELSE comp_pop(k+i).temperature = 5.38e3
                    IF countindg9_3 NE 0 THEN comp_pop(k+i).distance = (val(indg9_3))(0) ELSE comp_pop(k+i).distance = 10.0
                    IF countindg9_4 NE 0 THEN comp_pop(k+i).amplitude = (val(indg9_4))(0) ELSE comp_pop(k+i).amplitude = 1.0
                    IF countindg9_5 NE 0 THEN comp_pop(k+i).nstars = (val(indg9_5))(0) ELSE comp_pop(k+i).nstars = stellar_density*(4.*!pi/3)*comp_pop(k+i).distance 
                    K+=1   
                ENDIF
           
            ENDFOR
    
            countg=0.  
        i+=k-1
        ENDIF 
        ;i+=k-1 
    
    ;==============================================================================================    
    
    ENDFOR
      
;============This block creates a composite (9V) stellar population structure for when the function isn't used as a plugin=================== 
ENDIF ELSE BEGIN 

IF NOT keyword_set(scope) AND NOT keyword_set(val) THEN BEGIN 

    
    popnumber = 5.
    comp_pop = replicate(one_pop,popnumber)

    ;BECAUSE LESS MASSIVE (COLDER) STARS ARE MORE ABUNDANT, THEY WILL BE CHOSEN TO BUILD THE COMPOSITE STELLAR STRUCTURE
    ;THIS MEANS THAT THE CHOSEN SPECTRAL TYPE IS 9V (MAIN SEQUENCE)

    ;CHOSEN STELLAR POPULATIONS
    ;O9V
    ;B9V
    ;A9V
    ;F9V
    ;G9V
    
    comp_pop(0).popid = 'O9V_stellar_population'
    comp_pop(0).radius = 7.51*rsun2cm 
    comp_pop(0).temperature = 33.3e3
    comp_pop(0).distance = 10.0
    comp_pop(0).amplitude = 1.0
    comp_pop(0).nstars = stellar_density*(4.*!pi/3)*comp_pop(0).distance
    
    comp_pop(1).popid = 'B9V_stellar_population'
    comp_pop(1).radius = 2.49*rsun2cm  
    comp_pop(1).temperature = 10.7e3 
    comp_pop(1).distance = 10.0
    comp_pop(1).amplitude = 1.0
    comp_pop(1).nstars = stellar_density*(4.*!pi/3)*comp_pop(1).distance
    
    comp_pop(2).popid = 'A9V_stellar_population'
    comp_pop(2).radius = 1.747*rsun2cm
    comp_pop(2).temperature = 7.4e3
    comp_pop(2).distance = 10.0
    comp_pop(2).amplitude = 1.0
    comp_pop(2).nstars = stellar_density*(4.*!pi/3)*comp_pop(2).distance
    
    comp_pop(3).popid = 'F9V_stellar_population'
    comp_pop(3).radius = 1.167*rsun2cm
    comp_pop(3).temperature = 6.05e3
    comp_pop(3).distance = 10.0
    comp_pop(3).amplitude = 1.0
    comp_pop(3).nstars = stellar_density*(4.*!pi/3)*comp_pop(3).distance
    
    comp_pop(4).popid = 'G9V_stellar_population'
    comp_pop(4).radius = 0.853*rsun2cm 
    comp_pop(4).temperature = 5.38e3
    comp_pop(4).distance = 10.0
    comp_pop(4).amplitude = 1.0
    comp_pop(4).nstars = stellar_density*(4.*!pi/3)*comp_pop(4).distance
    
    
ENDIF 

ENDELSE

print, 'comp_pop is:'
print, comp_pop


if keyword_set(key) then defsysv,'!dustem_composite_stellar_population',comp_pop

the_end:
return, scp
end