Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions Modules/Ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@ class is created.

# # Get the symmetries from spglib
# super_structure = self.current_dyn.structure.generate_supercell(self.supercell)
# spglib_syms = spglib.get_symmetry(super_structure.get_ase_atoms())
# spglib_syms = spglib.get_symmetry(super_structure.get_spglib_cell())

# # Convert them into the cellconstructor format
# cc_syms = CC.symmetries.GetSymmetriesFromSPGLIB(spglib_syms, False)
Expand Down Expand Up @@ -1534,7 +1534,7 @@ def _unwrap_symmetries_(self):

# Get the symmetries from spglib
super_structure = self.current_dyn.structure.generate_supercell(self.supercell)
spglib_syms = spglib.get_symmetry(super_structure.get_ase_atoms())
spglib_syms = spglib.get_symmetry(super_structure.get_spglib_cell())

# Convert them into the cellconstructor format
cc_syms = CC.symmetries.GetSymmetriesFromSPGLIB(spglib_syms, False)
Expand Down Expand Up @@ -3655,6 +3655,15 @@ def get_free_energy_hessian(self, include_v4 = False, get_full_hessian = True, v
# """
# raise NotImplementedError(ERROR_MSG)

# Check if the ensemble has been initialized
if len(self.forces) == 0:
n_forces = len(self.forces)
raise ValueError(
f"Cannot evaluate free-energy Hessian: 'self.forces' is empty (len={n_forces}). "
"Initialize or load the ensemble and compute energies and forces first."
)


# Convert anything into the Ha units
# This is needed for the Fortran subroutines
self.convert_units(UNITS_HARTREE)
Expand Down
6 changes: 3 additions & 3 deletions Modules/SchaMinimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ def print_info(self):
print (" use spglib = ", self.use_spglib)
if self.use_spglib:
import spglib
print (" Symmetry group = {}".format(spglib.get_spacegroup(self.dyn.structure.get_ase_atoms())))
print (" Symmetry group = {}".format(spglib.get_spacegroup(self.dyn.structure.get_spglib_cell())))
print (" Number of symmetries in the unit cell = ", self.N_symmetries)

print ()
Expand Down Expand Up @@ -1097,7 +1097,7 @@ def init(self, verbosity = False, delete_previous_data = True, init_timer = True

import spglib
if verbosity:
print("Symmetry group: ", spglib.get_spacegroup(self.dyn.structure.get_ase_atoms()))
print("Symmetry group: ", spglib.get_spacegroup(self.dyn.structure.get_spglib_cell()))

self.N_symmetries = qe_sym.QE_nsym

Expand Down Expand Up @@ -1337,7 +1337,7 @@ def run(self, verbose = 1, custom_function_pre = None, custom_function_post = No
print ("")
print("Number of symmetries before the step: ", self.N_symmetries)
if self.use_spglib:
print("Group space: ", spglib.get_spacegroup(self.dyn.structure.get_ase_atoms()))
print("Group space: ", spglib.get_spacegroup(self.dyn.structure.get_spglib_cell()))
print ("Harmonic contribution to free energy = %16.8f meV" % (harm_fe * __RyTomev__))
print ("Anharmonic contribution to free energy = %16.8f +- %16.8f meV" % (anharm_fe * __RyTomev__,
np.real(err) * __RyTomev__))
Expand Down
8 changes: 4 additions & 4 deletions Tutorials/LaH10/VariableCellRelaxation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
],
"source": [
"import spglib\n",
"print (\"The original spacegroup is:\", spglib.get_spacegroup(dyn.structure.get_ase_atoms(), 0.05))"
"print (\"The original spacegroup is:\", spglib.get_spacegroup(dyn.structure.get_spglib_cell(), 0.05))"
]
},
{
Expand All @@ -244,7 +244,7 @@
"# we define a function that prints the space group during the optimization\n",
"space_groups = []\n",
"def print_spacegroup(minim):\n",
" spgroup = spglib.get_spacegroup(minim.dyn.structure.get_ase_atoms(), 0.05)\n",
" spgroup = spglib.get_spacegroup(minim.dyn.structure.get_spglib_cell(), 0.05)\n",
" space_groups.append(spgroup)\n",
" \n",
" # We can save them in the output at each minimization step\n",
Expand Down Expand Up @@ -370,7 +370,7 @@
}
],
"source": [
"spglib.get_spacegroup(relax.minim.dyn.structure.get_ase_atoms(), 0.05)"
"spglib.get_spacegroup(relax.minim.dyn.structure.get_spglib_cell(), 0.05)"
]
},
{
Expand All @@ -390,7 +390,7 @@
}
],
"source": [
"spglib.get_spacegroup(dyn.structure.get_ase_atoms(), 0.1)"
"spglib.get_spacegroup(dyn.structure.get_spglib_cell(), 0.1)"
]
},
{
Expand Down