import numpy as np
from time import time
import matplotlib.pyplot as plt

import odeg as od
from odeg.h_eigenvalues import calculateEVs
od.utils.blockevs.output_time = True
# od.utils.hamiltonian.h_is_p_symmetric = False
plt.rcParams['figure.dpi'] = 300
plt.rcParams['savefig.dpi'] = 300


if __name__ == '__main__':
    
    mu_grid = np.linspace(-1.34, -1.32, 300)
    
    
    cfg = {
        'r0': 1,
        'rs': 2,
        'p_max': 4,
        'pos_charge': 5,
        'n_spin': 2,
        'theta': 0.125,
        'mu': mu_grid,
        'parallel': False,
        'coupling_strength': 1,
        'load_evs': True,
        }

    # print("\n\nconfiguration:\n", cfg, "\n\n")
    
    start = time()
    h_exp, n_exp, n2_exp = od.fctExp(od.energyFct, od.numberFct, od.number2Fct, **cfg)
    # evs, cat = calculateEVs(**cfg)
    print("t[fctexp] =", time() - start)
    # free_energy = od.freeEnergy(**cfg)
    # entropy = od.entropy(**cfg)
    
    plt.plot(mu_grid, n_exp)