@@ -1884,11 +1884,14 @@ def get_preconditioned_gradient_parallel(self, *args, **kwargs):
18841884 For documentation, see get_preconditioned_gradient
18851885 """
18861886
1887+ print ("force length:" , len (self .force_computed ))
18871888
18881889 def work_function (argument ):
1890+ print ("force length [inside]:" , len (self .force_computed ))
18891891 ensemble_start_config , ensemble_end_config = argument
18901892 mask = np .zeros (self .N , dtype = bool )
18911893 mask [ensemble_start_config : ensemble_end_config ] = True
1894+ print ("mask length:" , np .sum (mask .astype (int ))," total N:" , len (mask ))
18921895 new_ensemble = self .split (mask )
18931896
18941897 gradient , error = new_ensemble .get_preconditioned_gradient (* args , ** kwargs )
@@ -1909,7 +1912,10 @@ def work_function(argument):
19091912
19101913 list_of_inputs .append ( (start_config , end_config ) )
19111914
1912- gradient , error = CC .Settings .GoParallelTuple (work_function , list_of_inputs , "+" )
1915+ results = CC .Settings .GoParallelTuple (work_function , list_of_inputs , "+" )
1916+ print (results )
1917+ print (np .shape (results ))
1918+ gradient , error = results
19131919 gradient /= np .sum (self .rho )
19141920 error /= np .sum (self .rho )
19151921
@@ -3082,9 +3088,12 @@ def compute_ensemble(self, calculator, compute_stress = True, stress_numerical =
30823088 else :
30833089 computing_ensemble .get_energy_forces (calculator , compute_stress , stress_numerical , verbose = verbose )
30843090
3091+ print ("CE BEFORE MERGE:" , len (self .force_computed ))
3092+
30853093 if should_i_merge :
30863094 # Remove the noncomputed ensemble from here, and merge
30873095 self .merge (computing_ensemble )
3096+ print ("CE AFTER MERGE:" , len (self .force_computed ))
30883097
30893098 print ('ENSEMBLE ALL PROPERTIES:' , self .all_properties )
30903099
@@ -3150,6 +3159,11 @@ def split(self, split_mask):
31503159 N = np .sum (split_mask .astype (int ))
31513160 ens = Ensemble (self .dyn_0 , self .T0 , self .dyn_0 .GetSupercell ())
31523161 ens .init_from_structures (structs )
3162+ print ("Split length:" , len (split_mask ))
3163+ print ("original force legnth:" , len (self .force_computed ))
3164+ print ("Expected length:" , len (ens .force_computed ))
3165+ print ("Splitting force length:" , len (self .force_computed [split_mask ]))
3166+
31533167 ens .force_computed [:] = self .force_computed [split_mask ]
31543168 ens .stress_computed [:] = self .stress_computed [split_mask ]
31553169 ens .energies [:] = self .energies [split_mask ]
@@ -3172,7 +3186,7 @@ def remove_noncomputed(self):
31723186 It may be used to run a minimization even if the ensemble was not completely calculated.
31733187 """
31743188
3175- good_mask = self .force_computed
3189+ good_mask = np . copy ( self .force_computed )
31763190 if self .has_stress :
31773191 good_mask = good_mask & self .stress_computed
31783192
@@ -3184,6 +3198,8 @@ def remove_noncomputed(self):
31843198 self .sscha_energies = self .sscha_energies [good_mask ]
31853199 self .xats = self .xats [good_mask , :, :]
31863200 self .u_disps = self .u_disps [good_mask , :]
3201+ self .force_computed = self .force_computed [good_mask ]
3202+ self .stress_computed = self .stress_computed [good_mask ]
31873203
31883204 self .structures = [self .structures [x ] for x in np .arange (len (good_mask ))[good_mask ]]
31893205 self .all_properties = [self .all_properties [x ] for x in np .arange (len (good_mask ))[good_mask ]]
@@ -3236,6 +3252,7 @@ def get_energy_forces(self, ase_calculator, compute_stress = True, stress_numeri
32363252
32373253 # Setup the calculator for each structure
32383254 parallel = False
3255+ print ("Force computed shape:" , len (self .force_computed ))
32393256 if __MPI__ :
32403257 comm = MPI .COMM_WORLD
32413258 size = comm .Get_size ()
@@ -3392,6 +3409,7 @@ def get_energy_forces(self, ase_calculator, compute_stress = True, stress_numeri
33923409 # Reshape the arrays
33933410 self .forces [:, :, :] = np .reshape (total_forces , (N_rand , self .current_dyn .structure .N_atoms * np .prod (self .supercell ), 3 ), order = "C" )
33943411 self .force_computed [:] = True
3412+ print ("Force computed shape:" , len (self .force_computed ))
33953413
33963414 if compute_stress :
33973415 self .stresses [:,:,:] = np .reshape (total_stress , (N_rand , 3 , 3 ), order = "C" )
0 commit comments