Skip to content

Commit

Permalink
Fix bug in Qha2dFlow.finalize
Browse files Browse the repository at this point in the history
  • Loading branch information
gmatteo committed Jan 30, 2025
1 parent f847763 commit 6f94904
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions abipy/dfpt/qha_2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def from_gsr_ddb_paths(cls,
Args:
nqsmall_or_qppa: Define the q-mesh for the computation of the PHDOS.
if > 0, it is interpreted as nqsmall
if < 0, it is interpreted as qppa.
if > 0, it is interpreted as nqsmall.
if < 0, it is interpreted as q-point per atom qppa.
gsr_paths: list of paths to GSR files.
ddb_paths: list of paths to DDB files.
bo_strains_ac: List of strains for the a and the c lattice vector.
Expand Down
2 changes: 1 addition & 1 deletion abipy/dfpt/tests/test_vzsisa.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def test_vzsisa(self):
assert qha.plot_abc_vs_t_4th(tstop=tstop, tstart=tstart, num=101, lattice="a", show=False)
assert qha.plot_abc_vs_t_4th(tstop=tstop, tstart=tstart, show=False)
assert qha.plot_thermal_expansion_coeff_4th(tref=293, show=False)
assert qha.plot_thermal_expansion_coeff_abc_4th(tstop=tstop, tstart=tstart ,num=101, tref=293, show=False)
assert qha.plot_thermal_expansion_coeff_abc_4th(tstop=tstop, tstart=tstart, num=101, tref=293, show=False)
assert qha.plot_angles_vs_t_4th(tstop=tstop, tstart=tstart, num=101, angle=3, show=False)

plotter = qha.get_phdos_plotter()
Expand Down
2 changes: 1 addition & 1 deletion abipy/dfpt/vzsisa.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ def vol_E2Vib1(self, tstart=0, tstop=1000, num=101) -> tuple:
vols[i] = V0 - (dfe_dV1[i] + self.pressure / abu.eVA3_GPa) / E2D

# Calculate total energies (Eq 15, 16)
# FIXME The consntant term F_V0(T) is missing
# FIXME The constant term F_V0(T) is missing
gibbs_vt = (self.bo_energies[self.iv0]
+ 0.5 * (bo_volumes[np.newaxis, :].T - V0)**2 * E2D
+ (bo_volumes[np.newaxis, :].T - V0) * dfe_dV1
Expand Down
5 changes: 4 additions & 1 deletion abipy/examples/flows/run_qha_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ def build_flow(options):
bo_strains_c = [-5, 0, 5, 10, 15]
#bo_strains_a = [0, 5, 10, 15, 20]
#bo_strains_c = [0, 5, 10, 15, 20]
bo_strains_a = [0, 5]
# This is just for testing purposes
#bo_strains_a = [0, 5]
#bo_strains_c = [0, 5]
bo_strains_a = [0, ]
bo_strains_c = [0, 5]
bo_strains_a = np.array(bo_strains_a) / 100
bo_strains_c = np.array(bo_strains_c) / 100
Expand Down
2 changes: 1 addition & 1 deletion abipy/examples/plot/plot_qha_vzsisa.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
=========================================
This example shows how to use the GSR.nc and PHDOS.nc files computed with different volumes
to compute thermodynamic properties within the v-ZSISA method.
to compute thermodynamic properties within the v-ZSISA approximation.
"""
import os
import abipy.data as abidata
Expand Down
11 changes: 6 additions & 5 deletions abipy/flowtk/qha_2d.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# coding: utf-8
"""
Workflows for calculations within the quasi-harmonic approximation.
Workflows for calculations within the quasi-harmonic approximation
with two degrees of freedom. The main entry point is Qha2dFlow.
"""
from __future__ import annotations

Expand Down Expand Up @@ -89,10 +90,10 @@ def finalize(self):
gsr_relax_volumes.append(gsr.structure.volume)

data["gsr_relax_entries"] = gsr_relax_entries

data["ddb_relax_paths"] = [ph_work.outdir.has_abiext("DDB") for ph_work in work.ph_works]
data["gsr_relax_edos_paths"] = [] if not work.edos_work else [task.gsr_path for task in work.edos_work]
data["gsr_relax_ebands_paths"] = [] if work.ndivsm == 0 else [ph_work.ebands_task.gsr_path for ph_work in work.ph_works]
data["gsr_relax_ebands_paths"] = [] if work.ndivsm == 0 else \
[ph_work.ebands_task.gsr_path for ph_work in work.ph_works if ph_work.ebands_task is not None]

# Write json file
mjson_write(data, self.outdir.path_in("qha_2d.json"), indent=4)
Expand Down Expand Up @@ -146,7 +147,7 @@ def from_scf_input(cls,
# Create input for relaxation and register the relaxation task.
work.relax_template = relax_template = scf_input.deepcopy()

# optcell = 3: constant-volume optimization of cell geometry
# optcell = 3 --> constant-volume optimization of cell geometry.
relax_template.pop_tolerances()
relax_template.set_vars(optcell=3, ionmov=ionmov, tolvrs=1e-8, tolmxf=1e-6)
relax_template.set_vars_ifnotin(ecutsm=1.0, dilatmx=1.05)
Expand Down Expand Up @@ -215,7 +216,7 @@ def on_all_ok(self):
self.ph_works.append(ph_work)
self.flow.register_work(ph_work)

# Add task for electron DOS calculation to edos_work
# Add task for electron DOS calculation to edos_work.
if self.edos_ngkpt is not None:
edos_input = scf_input.make_edos_input(self.edos_ngkpt)
self.edos_work.register_nscf_task(edos_input, deps={ph_work[0]: "DEN"}).set_name(deformationname)
Expand Down
2 changes: 1 addition & 1 deletion abipy/flowtk/zsisa.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class ZsisaFlow(Flow):
"""
Flow for QHA calculations with the VZSISA approach.
Flow for QHA calculations with the ZSISA approach.
.. rubric:: Inheritance Diagram
.. inheritance-diagram:: ZsisaFlow
Expand Down
2 changes: 1 addition & 1 deletion requirements-tests.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Libraries required for running unit tests.
python-coveralls
pytest
python-coveralls
pytest-cov
pytest-xdist
pytest-sugar
Expand Down

0 comments on commit 6f94904

Please sign in to comment.