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

Ruberhauptmann / quant-met / 16227982322

11 Jul 2025 07:18PM UTC coverage: 36.605% (+3.6%) from 33.046%
16227982322

push

github

web-flow
Implement crit-temp and test for Graphene (#124)

3 of 45 branches covered (6.67%)

Branch coverage included in aggregate %.

11 of 28 new or added lines in 3 files covered. (39.29%)

135 of 332 relevant lines covered (40.66%)

1.22 hits per line

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

34.78
/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 sisl
3✔
8

9
from quant_met import routines
3✔
10
from quant_met.parameters import Parameters
3✔
11

12
logger = logging.getLogger(__name__)
3✔
13

14

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

18
    Parameters
19
    ----------
20
    parameters: Parameters
21
        An instance of Parameters containing control settings, the model,
22
        and k-point specifications for the T_C calculation.
23
    """
NEW
24
    result_path = Path(parameters.control.outdir)
×
NEW
25
    result_path.mkdir(exist_ok=True, parents=True)
×
26

NEW
27
    hamiltonian = sisl.get_sile(parameters.control.hamiltonian_file).read_hamiltonian()
×
NEW
28
    k_grid_obj = sisl.MonkhorstPack(
×
29
        hamiltonian.geometry, [parameters.k_points.nk1, parameters.k_points.nk2, 1]
30
    )
31

NEW
32
    delta_vs_temp, critical_temperatures, fit_fig = routines.search_crit_temp(
×
33
        hamiltonian=hamiltonian,
34
        kgrid=k_grid_obj,
35
        hubbard_int_orbital_basis=parameters.control.hubbard_int_orbital_basis,
36
        epsilon=parameters.control.conv_treshold,
37
        max_iter=parameters.control.max_iter,
38
        q=parameters.control.q,
39
        n_temp_points=parameters.control.n_temp_points,
40
    )
41

NEW
42
    logger.info("Search for T_C completed successfully.")
×
NEW
43
    logger.info("Obtained T_Cs: %s", critical_temperatures)
×
44

NEW
45
    fit_fig.savefig(
×
46
        result_path / f"{parameters.control.prefix}_critical_temperatures_fit.pdf",
47
        bbox_inches="tight",
48
    )
49

NEW
50
    result_file = result_path / f"{parameters.control.prefix}_critical_temperatures.hdf5"
×
NEW
51
    delta_vs_temp.to_hdf(result_file, key="delta_vs_temp")
×
NEW
52
    with h5py.File(result_file, mode="a") as file:
×
NEW
53
        for orbital, crit_temp_orbital in enumerate(critical_temperatures):
×
NEW
54
            file.attrs[f"T_C_{orbital}"] = crit_temp_orbital
×
55

NEW
56
    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