@@ -502,7 +502,7 @@ def init(self):
502
502
503
503
504
504
505
- def load (self , data_dir , population , N , verbose = False , load_displacements = True , raise_error_on_not_found = False , load_noncomputed_ensemble = False ,
505
+ def load (self , data_dir , population , N , verbose = False , load_displacements = True , raise_error_on_not_found = False , load_noncomputed_ensemble = False , skip_extra_rows = False ,
506
506
timer = None ):
507
507
"""
508
508
LOAD THE ENSEMBLE
@@ -554,6 +554,9 @@ def load(self, data_dir, population, N, verbose = False, load_displacements = Tr
554
554
load_noncomputed_ensemble: bool
555
555
If True, it allows for loading an ensemble where some of the configurations forces and stresses are missing.
556
556
Note that it must be compleated before running a SCHA minimization
557
+ skip_extra_rows : bool
558
+ If True, only loads the first Nat_sc rows of the forces.
559
+ Useful if the parsing script reads more than the necessary rows from the calculation output.
557
560
"""
558
561
A_TO_BOHR = 1.889725989
559
562
@@ -599,6 +602,12 @@ def load(self, data_dir, population, N, verbose = False, load_displacements = Tr
599
602
total_t_for_loading = 0
600
603
total_t_for_sscha_ef = 0
601
604
t_before_for = time .time ()
605
+
606
+ # Avoid reading extra rows on the forces
607
+ maxrowforces = None
608
+ if skip_extra_rows :
609
+ maxrowforces = Nat_sc
610
+
602
611
for i in range (self .N ):
603
612
# Load the structure
604
613
structure = CC .Structure .Structure ()
@@ -636,10 +645,11 @@ def load(self, data_dir, population, N, verbose = False, load_displacements = Tr
636
645
force_path = os .path .join (data_dir , "forces_population%d_%d.dat" % (population , i + 1 ))
637
646
638
647
if os .path .exists (force_path ):
648
+
639
649
if timer :
640
- self .forces [i ,:,:] = timer .execute_timed_function (np .loadtxt , force_path ) * A_TO_BOHR
650
+ self .forces [i ,:,:] = timer .execute_timed_function (np .loadtxt , force_path , max_rows = maxrowforces ) * A_TO_BOHR
641
651
else :
642
- self .forces [i ,:,:] = np .loadtxt (force_path ) * A_TO_BOHR
652
+ self .forces [i ,:,:] = np .loadtxt (force_path , max_rows = maxrowforces ) * A_TO_BOHR
643
653
self .force_computed [i ] = True
644
654
else :
645
655
if raise_error_on_not_found :
0 commit comments