-
Notifications
You must be signed in to change notification settings - Fork 0
/
parseHFODDoutput.py
1248 lines (1109 loc) · 51.2 KB
/
parseHFODDoutput.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Keep this copy around as a backup, and to show you what modifications you had to
# make to get it to work in one particular case. You had to eliminate a file where
# the classical energy surface(?) was not formatted correctly, you had to reindex
# the lines that the energies were found on, and you had to comment out the inertia-
# related quantities because you didn't use the inertia package when you ran that
# particular calculation.
# I just commented out almost every line with the word 'dispersion' or 'dis_Q'
# because that was giving me trouble.
# If your files seem to be processed correctly but they still don't appear in the XML
# tree, it's probably because they fail the Estability < convergenceCriterion test at
# the end. Look for "#TEST #FILTER" to see the tests that have most commonly failed
# you or given you problems so far.
# Making useful modules available for the script
import sys
import os # operating system module
import subprocess # fine-grain control of processes
import shutil # import shell functions
import re # string manipulation
import math # math library
import time
import difflib
import glob
from numpy import * # Array functions
from collections import deque
from lxml import etree as ET
#---------------------------------------------------------------#
# CUSTOMIZATION #
#---------------------------------------------------------------#
current_directory = os.getcwd()
root_name = current_directory.rpartition('/')
versionXML = '1.1'
collective_variables = ["q20","q30"]
lipkin = 0
lambda_max = 4
#number_constraints = 2
convergenceCriterion = 1.e100
verbose = False
outputFiles_directory = current_directory + '/out/'
fichier_PES = root_name[2] + '_PES.xml'
#---------------------------------------------------------------#
# INITIALIZATIONS #
#---------------------------------------------------------------#
coll_vars = ",".join(collective_variables)
number_constraints = len(collective_variables)
size_inertia = number_constraints*(number_constraints+1)/2
dico_i = [ i for i in range(0,number_constraints) for j in range(i,number_constraints)]
dico_j = [ j for i in range(0,number_constraints) for j in range(i,number_constraints)]
dico_units = { 0: '', 1: 'b-1/2', 2: 'b-1', 3: 'b-3/2', 4: 'b-2', 5: 'b-5/2', 6: 'b-3', \
7: 'b-7/2', 8: 'b-4', 9: 'b-9/2', 10: 'b-5', 11: 'b-11/2', 12: 'b-6'}
dico_inertia = {}
dico_inertia['-3_0'] = ('xi', 'xi', 0)
dico_inertia['-2_0'] = ('D', 'D', 1)
for l in range(0,9):
for m in range(0,9):
key = str(l)+'_'+str(m)
dico_inertia[key] = l
multipole = [ m for m in ["q20","q22","q30","q40","q50","q60","q70","q80","D","xi"] if m not in collective_variables ]
nucleus = []
force, Vn_pair, Vp_pair, cut_off = [], [], [], []
beta2, omega, basis_HFODD = [], [], []
Gauss, shells, states = [], [], []
l_value, m_value, q_value = [], [], []
Ekin_n, Ekin_p, Ekin_t = [], [], []
Esin_n, Esin_p, Esin_t = [], [], []
Epai_n, Epai_p, Epai_t = [], [], []
Erea_n, Erea_p, Erea_t = [], [], []
Efer_n, Efer_p, delta_n, delta_p = [], [], [], []
ECouDir, ECouExc = [], []
EskyrmeEven, EskyrmeOdd, EsoEven, EsoOdd, Erear, Etotal = [], [], [], [], [], []
Estability = []
interaction_skyrme, interaction_Coulomb, interaction_CoulDirExact, interaction_CoulExcExact = [], [], [], []
Etot_1, Tkin_1, Vnuc_1, Vpai_1, CouD_1, CouE_1, PCM_1 = [], [], [], [], [], [], []
Etot_2, Tkin_2, Vnuc_2, Vpai_2, CouD_2, CouE_2, PCM_2 = [], [], [], [], [], [], []
Temperature, Entropy, fluctuations_quantum, fluctuations_statistical, dispersion = [], [], [], [], []
neck_position, neck_size, neck_distance, neck_protons, CM_positions = [], [], [], [], []
Z_1, A_1, Z_2, A_2 = [], [], [], []
Q20_1, Q22_1, Q30_1, Q40_1, Q50_1, Q60_1, Q70_1, Q80_1 = [], [], [], [], [], [], [], []
Q20_2, Q22_2, Q30_2, Q40_2, Q50_2, Q60_2, Q70_2, Q80_2 = [], [], [], [], [], [], [], []
liste_Bij, liste_Gij, liste_zpe = [], [], []
# Rename all append calls to lists
append_nucleus = nucleus.append
append_force, append_Vn_pair, append_Vp_pair, append_cut_off = force.append, Vn_pair.append, Vp_pair.append, cut_off.append
append_beta2, append_omega, append_basis_HFODD = beta2.append, omega.append, basis_HFODD.append
append_Gauss, append_shells, append_states = Gauss.append, shells.append, states.append
append_qlm_l, append_qlm_m, append_qlm_q = l_value.append, m_value.append, q_value.append
append_energy_kinN, append_energy_kinP, append_energy_kinT = Ekin_n.append, Ekin_p.append, Ekin_t.append
append_energy_sinN, append_energy_sinP, append_energy_sinT = Esin_n.append, Esin_p.append, Esin_t.append
append_energy_paiN, append_energy_paiP, append_energy_paiT = Epai_n.append, Epai_p.append, Epai_t.append
append_energy_reaN, append_energy_reaP, append_energy_reaT = Erea_n.append, Erea_p.append, Erea_t.append
append_energy_ferN, append_energy_ferP = Efer_n.append, Efer_p.append
append_deltaN, append_deltaP = delta_n.append, delta_p.append
append_energy_CouD, append_energy_CouE = ECouDir.append, ECouExc.append
append_energy_skyE, append_energy_skyO = EskyrmeEven.append, EskyrmeOdd.append
append_energy_spoE, append_energy_spoO = EsoEven.append, EsoOdd.append
append_energy_rear, energy_append_stab, energy_append_tota = Erear.append, Estability.append, Etotal.append
append_fthfb_temp, append_fthfb_entr = Temperature.append, Entropy.append
append_fthfb_quan, append_fthfb_stat = fluctuations_quantum.append, fluctuations_statistical.append
append_dispersion = dispersion.append
append_frag_couP, append_frag_couS, append_frag_couD, append_frag_couZ, append_frag_CM = neck_position.append, neck_size.append, neck_distance.append, neck_protons.append, CM_positions.append
append_frag_intS, append_frag_intC = interaction_skyrme.append, interaction_Coulomb.append
append_frag_intCDex, append_frag_intCXex = interaction_CoulDirExact.append, interaction_CoulExcExact.append
append_frag_lefA, append_frag_lefZ, append_frag_rigA, append_frag_rigZ = A_1.append, Z_1.append, A_2.append, Z_2.append
append_frag_lefEtot, append_frag_rigEtot = Etot_1.append, Etot_2.append
append_frag_lefEkin, append_frag_rigEkin = Tkin_1.append, Tkin_2.append
append_frag_lefVnuc, append_frag_rigVnuc = Vnuc_1.append, Vnuc_2.append
append_frag_lefVpai, append_frag_rigVpai = Vpai_1.append, Vpai_2.append
append_frag_lefVcoD, append_frag_rigVcoD = CouD_1.append, CouD_2.append
append_frag_lefVcoE, append_frag_rigVcoE = CouE_1.append, CouE_2.append
append_frag_lefCOM, append_frag_rigCOM = PCM_1.append, PCM_2.append
append_frag_lQ20, append_frag_lQ22 = Q20_1.append, Q22_1.append
append_frag_lQ30, append_frag_lQ40 = Q30_1.append, Q40_1.append
append_frag_lQ50, append_frag_lQ60 = Q50_1.append, Q60_1.append
append_frag_lQ70, append_frag_lQ80 = Q70_1.append, Q80_1.append
append_frag_rQ20, append_frag_rQ22 = Q20_2.append, Q22_2.append
append_frag_rQ30, append_frag_rQ40 = Q30_2.append, Q40_2.append
append_frag_rQ50, append_frag_rQ60 = Q50_2.append, Q60_2.append
append_frag_rQ70, append_frag_rQ80 = Q70_2.append, Q80_2.append
append_col_mass, append_metric, append_zpe = liste_Bij.append, liste_Gij.append, liste_zpe.append
#---------------------------------------------------------------#
# USER-DEFINED FUNCTIONS #
#---------------------------------------------------------------#
# Function used to strip a line from its blank spaces
def not_empty(chaine): return chaine != ''
def kineticEnergy():
append_energy_kinN(ligneFormattee[3])
append_energy_kinP(ligneFormattee[5])
append_energy_kinT(ligneFormattee[7])
def spEnergy():
if len(ligneFormattee)>8:
append_energy_sinN(ligneFormattee[4])
append_energy_sinP(ligneFormattee[6])
append_energy_sinT(ligneFormattee[8])
else:
append_energy_sinN(9999.99)
append_energy_sinP(9999.99)
append_energy_sinT(9999.99)
def pairingEnergy():
append_energy_paiN(ligneFormattee[3])
append_energy_paiP(ligneFormattee[5])
append_energy_paiT(ligneFormattee[7])
def pairingRearrangementEnergy():
append_energy_reaN(ligneFormattee[3])
append_energy_reaP(ligneFormattee[5])
append_energy_reaT(ligneFormattee[7])
def pairingGap():
append_deltaN(ligneFormattee[3])
append_deltaP(ligneFormattee[5])
def fermiEnergy():
append_energy_ferN(ligneFormattee[3])
append_energy_ferP(ligneFormattee[5])
def CoulombEnergy():
append_energy_CouD(ligneFormattee[3])
append_energy_CouE(ligneFormattee[5])
def rearrangementEnergy():
append_energy_rear(ligneFormattee[7]) ##OPTION Should be 8?
def soEnergy():
append_energy_spoE(ligneFormattee[3])
append_energy_spoO(ligneFormattee[5])
def skyrmeEnergy():
append_energy_skyE(ligneFormattee[3])
append_energy_skyO(ligneFormattee[5])
def stability():
if len(ligneFormattee) == 9:
energy_append_stab(ligneFormattee[3])
energy_append_tota(ligneFormattee[7])
else:
energy_append_stab(9999.99)
energy_append_tota(9999.99)
def getStringFromList_safe(liste, position):
try:
string_value = str(liste[position])
except IndexError:
string_value = '9999.99'
return string_value
def getTupleFromList_safe(liste, position, format_output):
def conversion(number, f):
if f.find('d') > -1:
func = int
if f.find('f') > -1 or f.find('e') > -1:
func = float
return func(number)
try:
l = [ format_output.format( conversion(i,format_output) ) for i in list(liste[position]) ]
tuple_value = tuple(l)
except IndexError:
tuple_value = ( '9999.99' )
return tuple_value
def getNumberFromList_safe(liste, position, format_output):
def conversion(number, f):
if f.find('d') > -1:
func = int
if f.find('f') > -1 or f.find('e') > -1:
func = float
return func(number)
try:
string_value = format_output.format(conversion(liste[position],format_output))
except IndexError:
string_value = format_output.format(9999.9)
return string_value
def getNumberFromList_1_safe(liste, position, new_index, format_output):
def conversion(number, f):
if f.find('d') > -1:
func = int
if f.find('f') > -1 or f.find('e') > -1:
func = float
return func(number)
try:
string_value = format_output.format(conversion(liste[position][new_index],format_output))
except IndexError:
string_value = format_output.format(9999.9)
return string_value
def extractValues(input_ligne, position_in_line):
ligneFormattee = breakLine(input_ligne)
try:
number_value = float(ligneFormattee[position_in_line])
except Exception as ex:
template = "In extractValues, an exception of type {0} occured. Arguments:\n{1!r}"
message = template.format(type(ex).__name__, ex.args)
print message
number_value = 0.0
return number_value
def formatValues(input_ligne, liste_append, position_in_line):
total_value = extractValues(input_ligne, position_in_line)
value = "{0:> 9.3e}".format(total_value)
liste_append(total_value)
def temperatureValues(input_ligne, liste_append, pos1, pos2):
proton_value = extractValues(input_ligne, pos1)
neutron_value = extractValues(input_ligne, pos2)
total_value = proton_value + neutron_value
value = "{0:> 9.3e}".format(total_value)
liste_append(total_value)
def dispersionQ(input_ligne, liste_append, pos, number_constraints):
l_l, l_m, l_QF, l_SF = [], [], [], []
dic = { "xi_A": (-3,0), "D": (-2,0), "Q_10": (1,0), "Q_20": (2,0), "Q_30": (3,0), \
"Q_40": (4,0), "Q_50": (5,0),"Q_60": (6,0), "Q_70": (7,0), "Q_80": (8,0)}
for n in range(0,number_constraints):
ligneFormattee = breakLine(input_ligne[n])
try:
(l,m) = dic[ligneFormattee[1]]
except Exception as ex:
template = "In dispersionQ, an exception of type {0} occured. Arguments:\n{1!r}"
message = template.format(type(ex).__name__, ex.args)
print message
l, m = '0', '0'
l_l.append(str(l)), l_m.append(str(m))
Q_QF_proton_value = extractValues(input_ligne[n], pos[0])
Q_QF_neutron_value = extractValues(input_ligne[n], pos[1])
QF_value = Q_QF_proton_value + Q_QF_neutron_value
Q_SF_proton_value = extractValues(input_ligne[n], pos[2])
Q_SF_neutron_value = extractValues(input_ligne[n], pos[3])
SF_value = Q_SF_proton_value + Q_SF_neutron_value
QF, SF = "{0:> 8.3f}".format(QF_value), "{0:> 8.3}".format(SF_value)
l_QF.append(QF), l_SF.append(SF)
liste_append( (l_l, l_m, l_QF, l_SF) )
def collectiveInertia(debut, liste_1_append, liste_2_append, liste_3_append):
# Position cursor where data begins
position = debut + 3
ligne = allLines[position]
# Get the components of the inertia tensor
collective = []
while ligne.find('MeV') > -1:
[ l, m, lp, mp, m_ATDHF, m_GCM] = [ extractValues(ligne, i) for i in range(1,7) ]
key_bra, key_ket, m_ATDHF, m_GCM = str(int(l))+'_'+str(int(m)), str(int(lp))+'_'+str(int(mp)), \
float(m_ATDHF), float(m_GCM)
collective.append( { 'units' : dico_inertia[key_bra]+dico_inertia[key_ket], \
'mass' : (m_ATDHF, m_GCM) } )
position = position + 1
ligne = allLines[position]
liste_1_append(collective)
n = position - debut - 3
# Get the components of the metric tensor
position = position + 4
ligne = allLines[position]
collective = []
for k in range(0,n):
[ l, m, lp, mp, G_GCM ] = [ extractValues(ligne, i) for i in range(1,6) ]
key_bra, key_ket, G_GCM = str(int(l))+'_'+str(int(m)), str(int(lp))+'_'+str(int(mp)), \
float(G_GCM)
collective.append( { 'units' : dico_inertia[key_bra]+dico_inertia[key_ket], \
'G': G_GCM } )
position = position + 1
ligne = allLines[position]
liste_2_append(collective)
# Get ZPE
position = position + 1
ligne = allLines[position]
zpe_atdhf = extractValues(ligne, 6)
position = position + 1
ligne = allLines[position]
zpe_gcm = extractValues(ligne, 7)
liste_3_append( (zpe_atdhf, zpe_gcm ) )
def breakLine(element):
currentLine = re.split("\n",element)
brokenLine = re.split(" ",currentLine[0])
strippedLine = filter(not_empty, brokenLine)
return strippedLine
def removeZEROS(chaine):
new_chaine = chaine.replace("ZERO"," 0.0")
return new_chaine
# Function adding a point to the PES XML file
def point_xml(dictionnaire, number_constraints):
point = ET.SubElement(PES, "point")
point.attrib["id"] = dictionnaire["id"]
neighbor = ET.SubElement(point, "neighbors")
voisin = ET.SubElement(neighbor, "neighbor")
voisin.attrib['id'] = "0"
stability = ET.SubElement(point, "convergence")
stability.attrib["dE"] = dictionnaire["dE"]
fichier = ET.SubElement(point, "file")
fichier.attrib["name"] = dictionnaire["nom"]
fichier.attrib["dir"] = dictionnaire["dir"]
# Basis characteristics
basis = ET.SubElement(point, "basis")
basis.attrib["type"] = "triaxial"
base = ET.SubElement(basis, "centers")
base.attrib["n"] = "1"
base.attrib["d"] = "0.0"
base = ET.SubElement(basis, "HOfrequencies")
base.attrib["omega_x"] = dictionnaire["omega_x"]
base.attrib["omega_y"] = dictionnaire["omega_y"]
base.attrib["omega_z"] = dictionnaire["omega_z"]
base = ET.SubElement(basis, "deformation")
base.attrib["beta2"] = dictionnaire["beta2"]
base.attrib["omega0"] = dictionnaire["omega0"]
base.attrib["FCHOM0"] = dictionnaire["FCHOM0"]
base = ET.SubElement(basis, "number_of_shells")
base.attrib["Nx"] = dictionnaire["Nx_HO"]
base.attrib["Ny"] = dictionnaire["Ny_HO"]
base.attrib["Nz"] = dictionnaire["Nz_HO"]
base = ET.SubElement(basis, "Gauss-Hermite")
base.attrib["Ng_x"] = dictionnaire["Ng_x"]
base.attrib["Ng_y"] = dictionnaire["Ng_y"]
base.attrib["Ng_z"] = dictionnaire["Ng_z"]
base = ET.SubElement(basis, "number_of_states")
base.attrib["LDBASE"] = dictionnaire["LDBASE"]
# Constraints
constraints = ET.SubElement(point, "constraints")
for c in collective_variables:
constraint = ET.SubElement(constraints, "constraint")
constraint.attrib["type"] = c
constraint.attrib["val"] = dictionnaire[c]
# Global properties of the HFB solution
energies = ET.SubElement(point, "energies")
energies.attrib["iso"] = "both"
energies.attrib["EHFB"] = dictionnaire["EHFB"]
pairing = ET.SubElement(point, "pairing")
pair = ET.SubElement(pairing, "gaps")
pair.attrib["deltaN"] = dictionnaire["deltaN"]
pair.attrib["deltaP"] = dictionnaire["deltaP"]
pair = ET.SubElement(pairing, "energies")
pair.attrib["EpairN"] = dictionnaire["EpairN"]
pair.attrib["EpairP"] = dictionnaire["EpairP"]
pair = ET.SubElement(pairing, "Fermi")
pair.attrib["lambdaN"] = dictionnaire["lambdaN"]
pair.attrib["lambdaP"] = dictionnaire["lambdaP"]
corrections = ET.SubElement(point, "corrections")
corrections.attrib["type"] = "ATDHF"
zpe = ET.SubElement(corrections, "goaZpe")
zpe.attrib["val"] = dictionnaire["E0_ATDHF"] + " MeV"
corrections = ET.SubElement(point, "corrections")
corrections.attrib["type"] = "GCM"
zpe = ET.SubElement(corrections, "goaZpe")
zpe.attrib["val"] = dictionnaire["E0_GCM"] + " MeV"
neck = ET.SubElement(point, "neck")
neck.attrib["zN"] = dictionnaire["zN"]
neck.attrib["qN"] = dictionnaire["qN"]
neck.attrib["Nz"] = dictionnaire["Nz"]
# Fission fragment properties
fragments = ET.SubElement(point, "fragments")
identity = ET.SubElement(fragments, "identity")
identity.attrib["Z1"] = dictionnaire["Z1"]
identity.attrib["A1"] = dictionnaire["A1"]
identity.attrib["Z2"] = dictionnaire["Z2"]
identity.attrib["A2"] = dictionnaire["A2"]
interaction = ET.SubElement(fragments, "interaction")
interaction.attrib["Enuc"] = dictionnaire["Enuc"]
interaction.attrib["ECou"] = dictionnaire["ECou"]
interaction.attrib["ECouDir_exact"] = dictionnaire["ECouDir_exact"]
interaction.attrib["ECouExc_exact"] = dictionnaire["ECouExc_exact"]
deformation1 = ET.SubElement(fragments, "deformation1")
deformation1.attrib["q20_1"] = dictionnaire["q20_1"]
deformation1.attrib["q22_1"] = dictionnaire["q22_1"]
deformation1.attrib["q30_1"] = dictionnaire["q30_1"]
deformation1.attrib["q40_1"] = dictionnaire["q40_1"]
deformation1.attrib["q50_1"] = dictionnaire["q50_1"]
deformation1.attrib["q60_1"] = dictionnaire["q60_1"]
deformation1.attrib["q70_1"] = dictionnaire["q70_1"]
deformation1.attrib["q80_1"] = dictionnaire["q80_1"]
deformation2 = ET.SubElement(fragments, "deformation2")
deformation2.attrib["q20_2"] = dictionnaire["q20_2"]
deformation2.attrib["q22_2"] = dictionnaire["q22_2"]
deformation2.attrib["q30_2"] = dictionnaire["q30_2"]
deformation2.attrib["q40_2"] = dictionnaire["q40_2"]
deformation2.attrib["q50_2"] = dictionnaire["q50_2"]
deformation2.attrib["q60_2"] = dictionnaire["q60_2"]
deformation2.attrib["q70_2"] = dictionnaire["q70_2"]
deformation2.attrib["q80_2"] = dictionnaire["q80_2"]
properties1 = ET.SubElement(fragments, "properties1")
properties1.attrib["Ekin_1"] = dictionnaire["Ekin_1"]
properties1.attrib["Enuc_1"] = dictionnaire["Enuc_1"]
properties1.attrib["Epair_1"] = dictionnaire["Epair_1"]
properties1.attrib["ECouD_1"] = dictionnaire["ECouD_1"]
properties1.attrib["ECouE_1"] = dictionnaire["ECouE_1"]
properties1.attrib["ECM_1"] = dictionnaire["ECM_1"]
properties2 = ET.SubElement(fragments, "properties2")
properties2.attrib["Ekin_2"] = dictionnaire["Ekin_2"]
properties2.attrib["Enuc_2"] = dictionnaire["Enuc_2"]
properties2.attrib["Epair_2"] = dictionnaire["Epair_2"]
properties2.attrib["ECouD_2"] = dictionnaire["ECouD_2"]
properties2.attrib["ECouE_2"] = dictionnaire["ECouE_2"]
properties2.attrib["ECM_2"] = dictionnaire["ECM_2"]
## # Collective inertia
## inertia = ET.SubElement(point, "inertia")
## inertia.attrib["type"] = "ATDHF"
## inertia.attrib["obs"] = coll_vars
## for i in range(0,size_inertia):
## element = ET.SubElement(inertia, "elem")
## element.attrib["i"] = str(dico_i[i])
## element.attrib["j"] = str(dico_j[i])
## element.attrib["val"] = str(dictionnaire["M_ATDHF"][i]) + " MeV-1." + dico_units[dictionnaire["units"][i]]
## inertia = ET.SubElement(point, "inertia")
## inertia.attrib["type"] = "GCM"
## inertia.attrib["obs"] = coll_vars
## for i in range(0,size_inertia):
## element = ET.SubElement(inertia, "elem")
## element.attrib["i"] = str(dico_i[i])
## element.attrib["j"] = str(dico_j[i])
## element.attrib["val"] = str(dictionnaire["M_GCM"][i]) + " MeV-1." + dico_units[dictionnaire["units"][i]]
## # GCM metric tensor
## metric = ET.SubElement(point, "metric")
## metric.attrib["type"] = "G"
## metric.attrib["obs"] = coll_vars
## for i in range(0,size_inertia):
## element = ET.SubElement(metric, "val")
## element.attrib["i"] = str(dico_i[i])
## element.attrib["j"] = str(dico_j[i])
## element.attrib["val"] = str(dictionnaire["G"][i]) + dico_units[dictionnaire["units"][i]]
# Multipole moments
observables = ET.SubElement(point, "observables")
for c in multipole:
obser = ET.SubElement(observables, "obs")
obser.attrib["name"] = c
obser.attrib["val"] = dictionnaire[c]
# Finite temperature calculations
excitation = ET.SubElement(point, "excitation")
excitation.attrib["S"] = dictionnaire["S"]
excit = ET.SubElement(excitation, "dispersion_N")
excit.attrib["quantum"] = dictionnaire["N_QF"]
excit.attrib["statistical"] = dictionnaire["N_SF"]
for i in range(0,number_constraints):
excit = ET.SubElement(excitation, "dispersion_Q")
excit.attrib["l"] = dictionnaire["lambda"][i]
excit.attrib["m"] = dictionnaire["mu"][i]
excit.attrib["quantum"] = dictionnaire["Q_QF"][i]
excit.attrib["statistical"] = dictionnaire["Q_SF"][i]
return 0
#---------------------------------------------------------------#
# READING THE FILES #
#---------------------------------------------------------------#
line_max = { 0: 0, 1: 2, 2: 4, 3: 6, 4: 8, 5: 12, 6: 16, 7: 20, 8: 24, 9: 28}
liste_beg = [ 8, 23, 38, 53, 68 ]
liste_end = [ 16, 31, 46, 61, 77 ]
dict_qlm = { 0: (liste_beg[0:1],liste_end[0:1]), 2: (liste_beg[0:2],liste_end[0:2]), 4: (liste_beg[0:3],liste_end[0:3]), \
6: (liste_beg[0:4],liste_end[0:4]), 8: (liste_beg[0:5],liste_end[0:5]), 10: (liste_beg[0:5],liste_end[0:5]), \
12: (liste_beg[4:5],liste_end[4:5]), 14: (liste_beg[0:5],liste_end[0:5]), 16: (liste_beg[3:5],liste_end[3:5]), \
18: (liste_beg[0:5],liste_end[0:5]), 20: (liste_beg[2:5],liste_end[2:5]), 22: (liste_beg[0:5],liste_end[0:5]), \
24: (liste_beg[1:5],liste_end[1:5]), 26: (liste_beg[0:5],liste_end[0:5]), 28: (liste_beg[0:5],liste_end[0:5]) }
dict_lm = { 2: 0, 2: 1, 4: 2, 6: 3, 8: 4, 12: 5, 16: 6, 20: 7, 24: 8, 28: 9}
# Starting the clock
time_all = []
start_total = time.time()
# Listing all files to be processed, sorting the list and creating a dictionary to store bad files
os.chdir(outputFiles_directory)
listeFichier = sorted(glob.glob('hfodd_0*.out'))
listeFlags = [ 1 for i in range(0,len(listeFichier)) ]
dico_fichier = dict(zip(listeFichier,listeFlags))
# Looping over all files
count_fichier = -1
for fichier in listeFichier:
count_fichier = count_fichier + 1
if verbose:
print 'fichier: ', fichier
# Read the file and store all lines in a list
fread = open(fichier,'r')
allLines = fread.readlines()
fread.close()
# Sometimes a calculation may time out or be terminated before it finishes running. #TEST #FILTER
# This will determine if the file formatted correctly or if it was interrupted.
chaine = '* NUMBERS OF CALLS TO SUBROUTINES *\n'
position_terminate = [i for i, x in enumerate(allLines) if x == chaine]
size = len(position_terminate)
if size < 1:
dico_fichier[fichier] = 0
print fichier, 'was terminated prematurely.'
# Get total multipole moments at convergence. Use the information to determine if the #TEST FILTER
# calculation ran into problems: if there is no such table or only 1, the calculation
# did not converge and this file should be disregarded
chaine = '* MULTIPOLE MOMENTS [UNITS: (10 FERMI)^LAMBDA] TOTAL *\n'
position_multipole = [i for i, x in enumerate(allLines) if x == chaine]
size = len(position_multipole)
# if size < 1:
if size < 2:
dico_fichier[fichier] = 0
else:
actual_line_max = line_max[lambda_max]
qlm = []
for i in range(0,actual_line_max+2,2):
element = allLines[position_multipole[size-1]+4+i]
sequence = dict_qlm[i]
beg = sequence[0]
end = sequence[1]
q_temp =[ element[b:e] for b,e in zip(beg,end) ]
qlm.append(map(removeZEROS, q_temp))
append_qlm_q( [ item for sublist in qlm for item in sublist ])
# Only look for meaningful numbers if the file is converged
if dico_fichier[fichier] > 0: #TEST #FILTER
# Get the basis deformation
chaine = '* CLASSICAL NUCLEAR SURFACE DEFINED FOR:'
position_s = [ i for i, x in enumerate(allLines) if x.find(chaine) > -1 ]
size = len(position_s)
lines = [ allLines[i+6] for i in position_s]
bet2 = map(breakLine, lines)
append_beta2(bet2[0][3])
# Get the nucleus
chaine = '* NUCLIDE:'
position_Z = [ i for i, x in enumerate(allLines) if x.find(chaine) > -1 ]
size = len(position_Z)
lines = [ allLines[i] for i in position_Z]
noyau = map(breakLine, lines)
append_nucleus( (noyau[0][4], noyau[0][7]) )
# Get the value of the Skyrme functional
chaine = '* PARAMETER SET'
position_F = [ i for i, x in enumerate(allLines) if x.find(chaine) > -1 ]
size = len(position_F)
lines = [ allLines[i] for i in position_F]
skyrme = map(breakLine, lines)
append_force(re.split(':',skyrme[0][3])[0])
# Get the characteristics of the basis
chaine = '* OSCILLATOR FREQUENCIES: X='
position_b = [ i for i, x in enumerate(allLines) if x.find(chaine) > -1 ]
size = len(position_b)
deque((list.pop(allLines, i) for i in sorted(position_b[0:size-1], reverse=True)), maxlen=0)
position_b = [ i for i, x in enumerate(allLines) if x.find(chaine) > -1 ]
if size > 0:
i = position_b[0]
# basis frequency
omg = breakLine(allLines[i])
append_omega( (omg[4], omg[6], omg[8]) )
# number of shells
i = i + 4
Nsh = breakLine(allLines[i])
append_shells( (Nsh[7], Nsh[10], Nsh[13]) )
# Gauss-Hermite integration points
i = i + 2
Ngh = breakLine(allLines[i])
append_Gauss( (Ngh[3], Ngh[6], Ngh[9]) )
# Number of states
i = i + 2
Nst = re.split('=',breakLine(allLines[i])[2])
append_states(Nst[1])
chaine = '* HOMEGA='
position_b = [ i for i, x in enumerate(allLines) if x.find(chaine) > -1 ]
size = len(position_b)
deque((list.pop(allLines, i) for i in sorted(position_b[0:size-1], reverse=True)), maxlen=0)
position_b = [ i for i, x in enumerate(allLines) if x.find(chaine) > -1 ]
if size > 0:
# HFODD characteristics
i = position_b[0]
FCHOM0 = breakLine(allLines[i])
append_basis_HFODD( (FCHOM0[2], FCHOM0[4]) )
# Get the characteristics of the pairing force
chaine = '* CONTACT PAIRING INTERACTION:'
position_P = [ i for i, x in enumerate(allLines) if x.find(chaine) > -1 ]
size = len(position_P)
deque((list.pop(allLines, i) for i in sorted(position_P[0:size-1], reverse=True)), maxlen=0)
position_P = [ i for i, x in enumerate(allLines) if x.find(chaine) > -1 ]
if size > 0:
# neutron pairing
i = position_P[0] + 1
lines = allLines[i]
Vn = breakLine(lines)
append_Vn_pair( (Vn[2], Vn[3], Vn[4], Vn[5]) )
# proton pairing
i = i + 1
lines = allLines[i]
Vp = breakLine(lines)
append_Vp_pair( (Vp[2], Vp[3], Vp[4], Vp[5]) )
# energy cut-off
i = i + 4
lines = allLines[i]
Ecut = breakLine(lines)
append_cut_off( Ecut[9] )
# Get the collective inertia
chaine = "* MASS TENSOR M_{ij}/HbarC**2 WITH i=(L,M) AND j=(LP,MP) *\n"
position_collective = [i for i, x in enumerate(allLines) if x == chaine ]
size = len(position_collective)
if size == 1 and dico_fichier[fichier] > 0:
collectiveInertia(position_collective[0], append_col_mass, append_metric, append_zpe)
else:
append_col_mass( {} )
append_metric( {} )
append_zpe( (0.0, 0.0) )
# Get the table of energies
chaine = '* ENERGIES (MEV) *\n'
position_energies = [i for i, x in enumerate(allLines) if x == chaine]
size = len(position_energies)
energies = { 4: kineticEnergy, 5: spEnergy, 6: pairingEnergy, 7: pairingRearrangementEnergy, \
9+lipkin: pairingGap, 10+lipkin: fermiEnergy, 12+2*lipkin: CoulombEnergy, \
18+2*lipkin+1: rearrangementEnergy, 21+2*lipkin+1: soEnergy, \
22+2*lipkin+1: skyrmeEnergy, 24+2*lipkin+1: stability }
# 18+2*lipkin: rearrangementEnergy, 21+2*lipkin: soEnergy, \
# 22+2*lipkin: skyrmeEnergy, 24+2*lipkin: stability }
for indexEnergy in [4, 5, 6, 7, 9+lipkin, 10+lipkin, 12+2*lipkin, 18+2*lipkin+1, 21+2*lipkin+1, 22+2*lipkin+1, 24+2*lipkin+1]:
# for indexEnergy in [4, 5, 6, 7, 9+lipkin, 10+lipkin, 12+2*lipkin, 18+2*lipkin, 21+2*lipkin, 22+2*lipkin, 24+2*lipkin]:
debut = position_energies[size-1]
position = debut + indexEnergy
elementEnergy = allLines[position]
ligneFormattee = breakLine(elementEnergy)
energies.get(indexEnergy)()
# Get fission fragment properties: energies, interaction energy, deformations, etc.
chaine = "* FISSION FRAGMENT PROPERTIES (SHARP ADIABATIC SCISSION) *\n"
position_fragments = [i for i, x in enumerate(allLines) if x == chaine ]
size = len(position_fragments)
if size == 1:
debut = position_fragments[0] + 2
# Get neck characteristics
position = debut
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_couP, 10)
# Neck
position = debut + 1
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_couS, 10)
position = debut + 2
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_couZ, 9)
position = debut + 3
ligneBuffer = allLines[position]
CM1 = extractValues(ligneBuffer, 9)
CM2 = extractValues(ligneBuffer,10)
append_frag_CM( ("{0:> 9.3e}".format(CM1), "{0:> 9.3e}".format(CM2)) )
position = debut + 4
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_couD, 8)
# Interaction energy
position = debut + 5
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_intS, 5)
position = debut + 6
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_intC, 8)
# Exact Coulomb interaction energy
position = debut + 7
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_intCDex, 7)
position = debut + 8
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_intCXex, 7)
# Get fission fragment properties: energies, interaction energy, deformations, etc.
chaine = "* | LEFT FRAGMENT (z < zN) | RIGHT FRAGMENT (z > zN) *\n"
position_energies = [i for i, x in enumerate(allLines) if x == chaine ]
debut = position_energies[0] + 2
# Get fragment characteristics (newer versions)
position = debut
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_lefA, 3)
formatValues(ligneBuffer, append_frag_rigA, 5)
position = debut + 1
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_lefZ, 3)
formatValues(ligneBuffer, append_frag_rigZ, 5)
position = debut + 2
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_lefEtot, 3)
formatValues(ligneBuffer, append_frag_rigEtot, 5)
position = debut + 3
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_lefEkin, 3)
formatValues(ligneBuffer, append_frag_rigEkin, 5)
position = debut + 4
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_lefVnuc, 3)
formatValues(ligneBuffer, append_frag_rigVnuc, 5)
position = debut + 5
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_lefVpai, 3)
formatValues(ligneBuffer, append_frag_rigVpai, 5)
position = debut + 6
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_lefVcoD, 3)
formatValues(ligneBuffer, append_frag_rigVcoD, 5)
position = debut + 7
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_lefVcoE, 3)
formatValues(ligneBuffer, append_frag_rigVcoE, 5)
position = debut + 8
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_lefCOM, 3)
formatValues(ligneBuffer, append_frag_rigCOM, 5)
# Get fission fragment multipole moments (in fragment intrinsic frame)
chaine = "* MULTIPOLE MOMENTS IN FRAGMENT INTRINSIC FRAME *\n"
position_multipole = [i for i, x in enumerate(allLines) if x == chaine ]
debut = position_multipole[0] + 4
position = debut
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_lQ20, 3)
formatValues(ligneBuffer, append_frag_rQ20, 5)
position = debut + 1
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_lQ22, 3)
formatValues(ligneBuffer, append_frag_rQ22, 5)
position = debut + 2
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_lQ30, 3)
formatValues(ligneBuffer, append_frag_rQ30, 5)
position = debut + 3
ligneBuffer = allLines[position]
formatValues(ligneBuffer, append_frag_lQ40, 3)
formatValues(ligneBuffer, append_frag_rQ40, 5)
# OPTION:
# These high-order multipole moments only matter if you go that high in the rest of the code. #TEST #FILTER
# position = debut + 4
# ligneBuffer = allLines[position]
# formatValues(ligneBuffer, append_frag_lQ50, 3)
# formatValues(ligneBuffer, append_frag_rQ50, 5)
#
# position = debut + 5
# ligneBuffer = allLines[position]
# formatValues(ligneBuffer, append_frag_lQ60, 3)
# formatValues(ligneBuffer, append_frag_rQ60, 5)
#
# position = debut + 6
# ligneBuffer = allLines[position]
# formatValues(ligneBuffer, append_frag_lQ70, 3)
# formatValues(ligneBuffer, append_frag_rQ70, 5)
#
# position = debut + 7
# ligneBuffer = allLines[position]
# formatValues(ligneBuffer, append_frag_lQ80, 3)
# formatValues(ligneBuffer, append_frag_rQ80, 5)
#
else:
append_frag_couP(0.0), append_frag_couS(0.0), append_frag_couD(0.0), append_frag_couZ(0.0)
append_frag_intS(0.0), append_frag_intC(0.0)
append_frag_intCDex(0.0), append_frag_intCXex(0.0)
append_frag_lefA(0.0), append_frag_lefZ(0.0),
append_frag_rigA(0.0), append_frag_rigZ(0.0)
append_frag_lefEtot(0.0), append_frag_rigEtot(0.0)
append_frag_lefEkin(0.0), append_frag_rigEkin(0.0)
append_frag_lefVnuc(0.0), append_frag_rigVnuc(0.0)
append_frag_lefVpai(0.0), append_frag_rigVpai(0.0)
append_frag_lefVcoD(0.0), append_frag_rigVcoD(0.0)
append_frag_lefVcoE(0.0), append_frag_rigVcoE(0.0)
append_frag_lefCOM(0.0), append_frag_rigCOM(0.0)
append_frag_lQ20(0.0), append_frag_lQ22(0.0)
append_frag_lQ30(0.0), append_frag_lQ40(0.0)
append_frag_lQ50(0.0), append_frag_lQ60(0.0)
append_frag_lQ70(0.0), append_frag_lQ80(0.0)
append_frag_rQ20(0.0), append_frag_rQ22(0.0)
append_frag_rQ30(0.0), append_frag_rQ40(0.0)
append_frag_rQ50(0.0), append_frag_rQ60(0.0)
append_frag_rQ70(0.0), append_frag_rQ80(0.0)
# Get temperature and entropy at convergence
chaine = '* FINITE-TEMPERATURE HFB CALCULATIONS AT'
position_entropy = [i for i, x in enumerate(allLines) if x.find(chaine) > -1]
size = len(position_entropy)
if size == 1:
debut = position_entropy[size-1]
# Get temperature
formatValues(allLines[debut], append_fthfb_temp, 7)
# Get total entropy (sum of neutrons and protons)
position = debut + 2
ligneEntropy = allLines[position]
temperatureValues(ligneEntropy, append_fthfb_entr, 3, 6)
# Get quantum fluctuations of particle number
position = debut + 3
ligneQuantum = allLines[position]
temperatureValues(ligneQuantum, append_fthfb_quan, 3, 5)
# Get statistical fluctuations of particle number
position = debut + 4
ligneStatistical = allLines[position]
temperatureValues(ligneStatistical, append_fthfb_stat, 3, 5)
# Get quantum and statistical fluctuations of multipole moment constraints
position = debut + 8
ligneStatistical = [ allLines[position+n] for n in range(0,number_constraints) ]
pos = [ 2, 3, 4, 5 ]
dispersionQ(ligneStatistical, append_dispersion, pos, number_constraints) #TEST #FILTER
else:
append_fthfb_temp(0.0), append_fthfb_entr(0.0)
append_fthfb_quan(0.0), append_fthfb_stat(0.0)
zero_liste = [ '0' for i in range(0,number_constraints)]
append_dispersion( (zero_liste, zero_liste, zero_liste, zero_liste) )
elapsed_total = (time.time() - start_total)
print 'Time elapsed for total ....: ', elapsed_total
#-------------------------------------------------------------------------------------------------------------------#
# Printing the listing of converged results: multipole moments, energy plus various other relevant quantities #
#-------------------------------------------------------------------------------------------------------------------#
start_post = time.time()
listeFichier_good = [ fichier for fichier in listeFichier if dico_fichier[fichier]==1 ]
if verbose:
print "Total number of files...........: ", len(listeFichier)
print "Total number of complete files..: ", len(listeFichier_good)
root = ET.Element("root")
liste_i, liste_j, liste_value = [], [], []
liste_l, liste_m, liste_QF, liste_SF = [], [], [], []
n10, n11, n20, n22, n30, n40, n50, n60, n70, n80 = 1, 2, 3, 5, 6, 10, 15, 21, 28, 36
dico = { "id": "0", "neighborsID": " 0 1 2 3", "nom": "1", "dir": "repertoire/", "dE": "0.0 MeV", \
"beta2": " 0.000", "omega0": " 0.000", "FCHOM0": " 0.000", \
"omega_x": " 0.000", "omega_y": " 0.000", "omega_z": " 0.000", \
"Nx": " 0", "Ny": " 0", "Nz": " 0", "Ng_x": " 0", "Ng_y": " 0", "Ng_z": " 0", "LDBASE": " 0",\
"q20": "0.0 b", "q22": "0.0 b", "q30": "0.0 b^3/2", "q40": "0.0 b^2", \
"q50": "0.0 b^5/2", "q60": "0.0 b^3", "q70": "0.0 b^7/2", "q80": "0.0 b^4", \
"EHFB": "0.0 MeV", "E0_GCM": "0.0 MeV", "E0_ATDHF": "0.0 MeV", \
"deltaN": "0.0 MeV", "deltaP": "0.0 MeV", "EpairN": "0.0 MeV", "EpairP": "0.0 MeV", \
"lambdaN": "-1.0 MeV", "lambdaP": "-1.0 MeV", \
"T": "0.0 MeV", "S": "0.0 MeV", \
"N_QF": " 0.000", "N_SF": " 0.000", "lambda": liste_l, "mu": liste_m, "Q_QF": liste_QF, "Q_SF": liste_SF, \
"zN": "0.0 fm", "D": "0.0 fm", "qN": "0.0", "Nz": "0.0", \
"Z1": "0.0", "A1": "0.0", "Z2": "0.0", "A2": "0.0", \
"q20_1": "0.0 b", "q22_1": "0.0 b", "q30_1": "0.0 b^3/2", "q40_1": "0.0 b^2", \
"q50_1": "0.0 b^5/2", "q60_1": "0.0 b^3", "q70_1": "0.0 b^7/2", "q80_1": "0.0 b^4", \
"q20_2": "0.0 b", "q22_2": "0.0 b", "q30_2": "0.0 b^3/2", "q40_2": "0.0 b^2", \
"q50_2": "0.0 b^5/2", "q60_2": "0.0 b^3", "q70_2": "0.0 b^7/2", "q80_2": "0.0 b^4", \
"Enuc": "0.0 MeV", "ECou": "0.0 MeV", "ECouDir_exact": "0.0 MeV", "ECouExc_exact": "0.0 MeV", \
"Ekin_1": "0.0 MeV", "Enuc_1": "0.0 MeV", "Epair_1": "0.0 MeV", \
"ECouD_1": "0.0 MeV", "ECouE_1": "0.0 MeV", "ECM_1": "0.0 MeV", \
"Ekin_2": "0.0 MeV", "Enuc_2": "0.0 MeV", "Epair_2": "0.0 MeV", \
"ECouD_2": "0.0 MeV", "ECouE_2": "0.0 MeV", "ECM_2": "0.0 MeV", \
"i": liste_i, "j": liste_j, "value": liste_value }
Nprot, Nneut = 0, 0
EDF = 'toto'
temperature = ' 0.000'
pair_n = (' 0.000', ' 0.000', ' 0.000', ' 0.000', ' 0.000')
pair_p = (' 0.000', ' 0.000', ' 0.000', ' 0.000', ' 0.000')
cut = ' 0.000'
for fichier,i in zip(listeFichier_good,range(0,len(listeFichier_good))):
skyrme = getStringFromList_safe(force, i)
noyau = getTupleFromList_safe(nucleus, i, "{0:> 3d}")
temp = getNumberFromList_safe(Temperature, i, "{0:> 6.3f}")
Vp_n = getTupleFromList_safe(Vn_pair, i, "{0:> 9.3f}")
Vp_p = getTupleFromList_safe(Vp_pair, i, "{0:> 9.3f}")
Ecut = getNumberFromList_safe(cut_off, i, "{0:> 8.3f}")
same_PES = ( Nneut == noyau[0] ) and ( Nprot == noyau[1] ) and ( EDF == skyrme) \
and ( temp == temperature ) \
and ( Vp_n == pair_n ) and ( Vp_p == pair_p ) and ( Ecut == cut )
# Header
if not same_PES:
PES = ET.SubElement(root, "PES")
PES.attrib["name"] = "The new version!"
Global = ET.SubElement(PES, "Global")
version = ET.SubElement(Global, "version")
version.attrib["XML"] = versionXML
nucl = ET.SubElement(Global, "nucleus")
nucl.attrib["Z"] = noyau[1]
nucl.attrib["N"] = noyau[0]
f = ET.SubElement(Global, "force")
f.attrib["name"] = skyrme
T = ET.SubElement(Global, "temperature")
T.attrib["T"] = temp
VpairN = ET.SubElement(Global, "pairingForceN")
VpairN.attrib["V0"] = Vp_n[0]
VpairN.attrib["V1"] = Vp_n[1]
VpairN.attrib["rho"] = Vp_n[2]
VpairN.attrib["alpha"] = Vp_n[3]
VpairP = ET.SubElement(Global, "pairingForceP")
VpairP.attrib["V0"] = Vp_p[0]
VpairP.attrib["V1"] = Vp_p[1]
VpairP.attrib["rho"] = Vp_p[2]
VpairP.attrib["alpha"] = Vp_p[3]
PairingCutoff = ET.SubElement(Global, "pairingCutoff")
PairingCutoff.attrib["Ecut"] = Ecut
solver = ET.SubElement(Global, "comment")
solver.attrib['name'] = "HFODD"
solver.attrib['version'] = "git"
comment = ET.SubElement(Global, "comment")
comment.text = "HFODD output parser version " + versionXML
Nprot, Nneut = noyau[1], noyau[0]
EDF = skyrme
temperature = temp
pair_n, pair_p, cut = Vp_n, Vp_p, Ecut