Skip to content

Commit a694e5d

Browse files
Merge branch 'master' into examples/aiida
2 parents d4dc5df + 586cf88 commit a694e5d

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

Modules/Relax.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,6 @@ def vc_relax(self, target_press = 0, static_bulk_modulus = 100,
584584
if kind_minimizer == "RPSD":
585585
# Compute the static bulk modulus
586586
sbm = GetStaticBulkModulus(self.minim.dyn.structure, self.calc)
587-
print ("BM:")
588-
print (sbm)
589587
BFGS = sscha.Optimizer.SD_PREC_UC(self.minim.dyn.structure.unit_cell, sbm)
590588

591589
# Generate the ensemble
@@ -607,16 +605,13 @@ def vc_relax(self, target_press = 0, static_bulk_modulus = 100,
607605
self.calc, True, stress_numerical, cluster = self.cluster)
608606
#self.minim.ensemble.get_energy_forces(self.calc, True, stress_numerical = stress_numerical)
609607

610-
print("RELAX force length:", len(self.minim.ensemble.force_computed))
611608

612609
if ensemble_loc is not None and self.save_ensemble:
613610
self.minim.ensemble.save_bin(ensemble_loc, pop)
614-
print("RELAX force length:", len(self.minim.ensemble.force_computed))
615611

616612
self.minim.population = pop
617613
self.minim.init(delete_previous_data = False)
618614

619-
print("RELAX force length:", len(self.minim.ensemble.force_computed))
620615
self.minim.run(custom_function_pre = self.__cfpre__,
621616
custom_function_post = self.__cfpost__,
622617
custom_function_gradient = self.__cfg__)
@@ -633,6 +628,14 @@ def vc_relax(self, target_press = 0, static_bulk_modulus = 100,
633628
# Get the pressure
634629
Press = np.trace(stress_tensor) / 3
635630

631+
# Get the error correctly accounting for symmetries
632+
stress_diagonal_err = np.diag(stress_err)
633+
press_err = 0
634+
for i in range(3):
635+
if not stress_diagonal_err[i] in stress_diagonal_err[:i]:
636+
press_err += stress_diagonal_err[i]**2
637+
press_err = np.sqrt(press_err)
638+
636639
# Get the volume
637640
Vol = self.minim.dyn.structure.get_volume()
638641

@@ -660,6 +663,11 @@ def vc_relax(self, target_press = 0, static_bulk_modulus = 100,
660663
ENTHALPIC CONTRIBUTION
661664
======================
662665
666+
Current pressure P = {:.4f} +- {:.4f} GPa
667+
Target pressure P = {:.4f} GPa
668+
669+
For enthalpy we use the target pressure.
670+
663671
P = {:.4f} GPa V = {:.4f} A^3
664672
665673
P V = {:.8e} eV
@@ -668,7 +676,7 @@ def vc_relax(self, target_press = 0, static_bulk_modulus = 100,
668676
Gibbs Free energy = {:.10e} eV {}
669677
Zero energy = {:.10e} eV
670678
671-
""".format(target_press , Vol,target_press_evA3 * Vol, helmoltz, mark_helmoltz, gibbs, mark_gibbs, self.minim.eq_energy)
679+
""".format(Press / CC.Units.GPA_TO_EV_PER_A3, press_err/ CC.Units.GPA_TO_EV_PER_A3, target_press , Vol,target_press_evA3 * Vol, helmoltz, mark_helmoltz, gibbs, mark_gibbs, self.minim.eq_energy)
672680
print(message)
673681
# print " ====================== "
674682
# print " ENTHALPIC CONTRIBUTION "

0 commit comments

Comments
 (0)