Skip to content

Commit 59ab046

Browse files
committed
Added an error if no stress tensor is found
1 parent 74061a6 commit 59ab046

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Modules/Relax.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,8 @@ def vc_relax(self, target_press = 0, static_bulk_modulus = 100,
609609
if ensemble_loc is not None and self.save_ensemble:
610610
self.minim.ensemble.save_bin(ensemble_loc, pop)
611611

612+
613+
612614
self.minim.population = pop
613615
self.minim.init(delete_previous_data = False)
614616

@@ -625,6 +627,11 @@ def vc_relax(self, target_press = 0, static_bulk_modulus = 100,
625627
stress_tensor *= sscha.SchaMinimizer.__RyBohr3_to_evA3__
626628
stress_err *= sscha.SchaMinimizer.__RyBohr3_to_evA3__
627629

630+
# Check if the stress tensor is actually loaded in the ensemble
631+
if np.max(np.abs(self.stresses)) < 1e-10:
632+
# Probably there is an error in the submission of the stress tensor calculation
633+
raise ValueError("Error, the stress tensor is not loaded in the ensemble. Check the stress tensor calculation.")
634+
628635
# Get the pressure
629636
Press = np.trace(stress_tensor) / 3
630637

0 commit comments

Comments
 (0)