@@ -125,16 +125,19 @@ def print(self) -> None:
125125 c11 , c12 , c44 = self .cubic_average ()
126126 K , G = (c11 + 2 * c12 ) / 3.0 , (c11 - c12 + 3 * c44 ) / 5.0
127127 E = 9 * K * G / (3 * K + G ) if (3 * K + G ) > 0 else 0.0
128- print (f"MDElastic @ T={ self .temperature :.0f} K ({ self .ensemble } ):" )
129- print (f" V_eq = { self .V_eq :.3f} A^3" )
130- print (f" T_actual = { self .T_actual :.1f} K" )
131- print (f" reference sigma= { np .array2string (self .stress_ref , precision = 3 )} GPa" )
132- print (f" C11 (cubic avg)= { c11 :.2f} GPa" )
133- print (f" C12 (cubic avg)= { c12 :.2f} GPa" )
134- print (f" C44 (cubic avg)= { c44 :.2f} GPa" )
135- print (f" K (V) = { K :.2f} GPa" )
136- print (f" G (V) = { G :.2f} GPa" )
137- print (f" E = { E :.2f} GPa" )
128+ lines = [
129+ f"MDElastic @ T={ self .temperature :.0f} K ({ self .ensemble } ):" ,
130+ f" V_eq = { self .V_eq :.3f} A^3" ,
131+ f" T_actual = { self .T_actual :.1f} K" ,
132+ f" reference sigma= { np .array2string (self .stress_ref , precision = 3 )} GPa" ,
133+ f" C11 (cubic avg)= { c11 :.2f} GPa" ,
134+ f" C12 (cubic avg)= { c12 :.2f} GPa" ,
135+ f" C44 (cubic avg)= { c44 :.2f} GPa" ,
136+ f" K (V) = { K :.2f} GPa" ,
137+ f" G (V) = { G :.2f} GPa" ,
138+ f" E = { E :.2f} GPa" ,
139+ ]
140+ print ("\n " .join (lines ), flush = True )
138141
139142
140143# ============================================================
@@ -766,7 +769,8 @@ def scan_parallel(
766769 if not quiet :
767770 print (
768771 f"[MDElastic.scan_parallel] phase 1: { len (ref_tasks )} ref runs "
769- f"on { n_workers_ref } workers x { n_threads_ref } threads ..."
772+ f"on { n_workers_ref } workers x { n_threads_ref } threads ..." ,
773+ flush = True ,
770774 )
771775 ctx = _mp .get_context ("spawn" )
772776 with ProcessPoolExecutor (max_workers = n_workers_ref , mp_context = ctx ) as ex :
@@ -783,7 +787,8 @@ def scan_parallel(
783787 if not quiet :
784788 print (
785789 f"[MDElastic.scan_parallel] phase 2: { len (deform_tasks )} deformation "
786- f"runs on { n_workers_def } workers x { n_threads_def } threads ..."
790+ f"runs on { n_workers_def } workers x { n_threads_def } threads ..." ,
791+ flush = True ,
787792 )
788793 with ProcessPoolExecutor (max_workers = n_workers_def , mp_context = ctx ) as ex :
789794 def_results = list (ex .map (_run_deform_segment , deform_tasks ))
@@ -1074,7 +1079,8 @@ def _execute_single(self) -> MDElasticResult:
10741079 if not self .quiet :
10751080 print (
10761081 f"[MDElastic] T={ self .temperature } K reference "
1077- f"({ self .thermostat } , ensemble={ self .ensemble } ) ..."
1082+ f"({ self .thermostat } , ensemble={ self .ensemble } ) ..." ,
1083+ flush = True ,
10781084 )
10791085 ref = _run_reference_segment (self ._build_reference_args ())
10801086
@@ -1088,7 +1094,8 @@ def _execute_single(self) -> MDElasticResult:
10881094 if not self .quiet :
10891095 print (
10901096 f"[MDElastic] T={ self .temperature } K: "
1091- f"{ len (deform_args )} deformations on { n_w } workers ..."
1097+ f"{ len (deform_args )} deformations on { n_w } workers ..." ,
1098+ flush = True ,
10921099 )
10931100 if n_w > 1 :
10941101 ctx = _mp .get_context ("spawn" )
0 commit comments