Skip to content

Commit 01e0ab3

Browse files
committed
Merge branch 'new_cluster' of github.com:SSCHAcode/python-sscha into new_cluster
2 parents 6e0e41d + 324529d commit 01e0ab3

2 files changed

Lines changed: 23 additions & 4 deletions

File tree

Modules/Ensemble.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,8 @@ def save_raw(self, root_directory, type_dict = None):
873873
np.savetxt(os.path.join(root_directory, "coord.raw"), self.xats.reshape((self.N, 3 * nat)))
874874

875875
# Save the box
876-
np.savetxt(os.path.join(root_directory, "box.raw"), np.tile(self.current_dyn.structure.unit_cell.ravel(), (self.N, 1)))
876+
#Prepare an array with all the unit cells
877+
np.savetxt(os.path.join(root_directory, "box.raw"), np.array([s.unit_cell.ravel() for s in self.structures]))
877878

878879
# Save the forces
879880
np.savetxt(os.path.join(root_directory, "force.raw"), self.forces.reshape((self.N, 3*nat)) * Rydberg)

Modules/SchaMinimizer.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,25 @@ def finalize(self, verbose = 1):
12321232
self.__gw_err__[-1] * __RyTomev__))
12331233
print ("Kong-Liu effective sample size = ", self.ensemble.get_effective_sample_size())
12341234
print ()
1235-
1235+
1236+
# Print the total force on the structure
1237+
print("Total force on the centroids [eV/A]:")
1238+
forces, err = self.ensembe.get_average_forces()
1239+
# Apply the symmetries
1240+
if not self.neglect_symmetries:
1241+
qe_sym = CC.symmetries.QE_Symmetry(self.dyn.structure)
1242+
if self.use_spglib:
1243+
qe_sym.SetupFromSPGLIB()
1244+
else:
1245+
qe_sym.SetupQPoint()
1246+
qe_sym.SymmetrizeVector(forces)
1247+
qe_sym.SymmetrizeVector(err)
1248+
err /= np.sqrt(qe_sym.QE_nsym)
1249+
1250+
for i in range(self.dyn.structure.N_atoms):
1251+
print("{:4d}) {:14.6f}{:14.6f}{:14.6f} +- {:14.6f}{:14.6f}{:14.6f}".format(*list([i] + list(forces[i, :] * CC.Units.RY_TO_EV) + list(err[i,:] * CC.Units.RY_TO_EV)))
1252+
print()
1253+
12361254
if self.ensemble.has_stress and verbose >= 1:
12371255
print ()
12381256
print (" ==== STRESS TENSOR [GPa] ==== ")
@@ -1387,9 +1405,9 @@ def check_stop(self):
13871405
print ()
13881406
print ("The gw gradient satisfy the convergence condition.")
13891407

1390-
if self.gradi_op == "gc":
1408+
if self.gradi_op == "gc" or not self.minim_struct:
13911409
total_cond = gc_cond
1392-
elif self.gradi_op == "gw":
1410+
elif self.gradi_op == "gw" or not self.minim_dyn:
13931411
total_cond = gw_cond
13941412
elif self.gradi_op == "all":
13951413
total_cond = gc_cond and gw_cond

0 commit comments

Comments
 (0)