• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Ruberhauptmann / quant-met / 16515863745

25 Jul 2025 06:56AM UTC coverage: 33.856% (-2.7%) from 36.605%
16515863745

Pull #125

github

web-flow
Merge 0d0f60816 into b5a0f599e
Pull Request #125: Start q loop

3 of 72 branches covered (4.17%)

Branch coverage included in aggregate %.

98 of 255 new or added lines in 13 files covered. (38.43%)

213 of 566 relevant lines covered (37.63%)

1.13 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

34.48
/src/quant_met/cli/crit_temp.py
1
"""Functions to run self-consistent calculation for the order parameter."""
2

3
import logging
3✔
4
from pathlib import Path
3✔
5

6
import h5py
3✔
7
import numpy as np
3✔
8
import sisl
3✔
9

10
from quant_met import routines
3✔
11
from quant_met.parameters import Parameters
3✔
12
from quant_met.parameters.control import CritTemp
3✔
13

14
logger = logging.getLogger(__name__)
3✔
15

16

17
def crit_temp(parameters: Parameters) -> None:
3✔
18
    """Self-consistent calculation for the order parameter.
19

20
    Parameters
21
    ----------
22
    parameters: Parameters
23
        An instance of Parameters containing control settings, the model,
24
        and k-point specifications for the T_C calculation.
25
    """
NEW
26
    if not isinstance(parameters.control, CritTemp):
×
NEW
27
        err_msg = "Wrong parameters for crit-temp."
×
NEW
28
        raise TypeError(err_msg)
×
29

30
    result_path = Path(parameters.control.outdir)
×
31
    result_path.mkdir(exist_ok=True, parents=True)
×
32

33
    hamiltonian = sisl.get_sile(parameters.control.hamiltonian_file).read_hamiltonian()
×
34
    k_grid_obj = sisl.MonkhorstPack(
×
35
        hamiltonian.geometry,
36
        [parameters.k_points.nk1, parameters.k_points.nk2, 1],
37
    )
38

39
    delta_vs_temp, critical_temperatures, fit_fig = routines.search_crit_temp(
×
40
        hamiltonian=hamiltonian,
41
        kgrid=k_grid_obj,
42
        hubbard_int_orbital_basis=np.array(parameters.control.hubbard_int_orbital_basis),
43
        epsilon=parameters.control.conv_treshold,
44
        max_iter=parameters.control.max_iter,
45
        q=np.array(parameters.control.q),
46
        n_temp_points=parameters.control.n_temp_points,
47
    )
48

49
    logger.info("Search for T_C completed successfully.")
×
50
    logger.info("Obtained T_Cs: %s", critical_temperatures)
×
51

52
    fit_fig.savefig(
×
53
        result_path / f"{parameters.control.prefix}_critical_temperatures_fit.pdf",
54
        bbox_inches="tight",
55
    )
56

57
    result_file = result_path / f"{parameters.control.prefix}_critical_temperatures.hdf5"
×
58
    delta_vs_temp.to_hdf(result_file, key="delta_vs_temp")
×
59
    with h5py.File(result_file, mode="a") as file:
×
60
        for orbital, crit_temp_orbital in enumerate(critical_temperatures):
×
61
            file.attrs[f"T_C_{orbital}"] = crit_temp_orbital
×
62

63
    logger.info("Results saved to %s", result_file)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc