Skip to content
Snippets Groups Projects
Commit a807dba9 authored by Kostas Vilkelis's avatar Kostas Vilkelis :flamingo:
Browse files

use ndof instead of size

parent 23f4b5d8
No related branches found
No related tags found
1 merge request!6Documentation
This commit is part of merge request !6. Comments created here will be created in the context of that merge request.
......@@ -67,7 +67,7 @@ class Model:
_first_key = list(h_0)[0]
self._ndim = len(_first_key)
self._size = h_0[_first_key].shape[0]
self._ndof = h_0[_first_key].shape[0]
self._local_key = tuple(np.zeros((self._ndim,), dtype=int))
_check_hermiticity(h_0)
......@@ -94,5 +94,5 @@ class Model:
)
return add_tb(
meanfield(rho, self.h_int),
{self._local_key: -fermi_energy * np.eye(self._size)},
{self._local_key: -fermi_energy * np.eye(self._ndof)},
)
......@@ -30,7 +30,7 @@ def cost(mf_param: np.ndarray, model: Model, nk: int = 100) -> np.ndarray:
1D real array that is the difference between the computed and inputted mean-field
parametrisations
"""
shape = model._size
shape = model._ndof
mf = rparams_to_tb(mf_param, list(model.h_int), shape)
mf_new = model.mfield(mf, nk=nk)
mf_params_new = tb_to_rparams(mf_new)
......@@ -65,11 +65,11 @@ def solver(
:
Mean-field correction solution in the tight-binding dictionary format.
"""
shape = model._size
shape = model._ndof
mf_params = tb_to_rparams(mf_guess)
f = partial(cost, model=model, nk=nk)
result = rparams_to_tb(
optimizer(f, mf_params, **optimizer_kwargs), list(model.h_int), shape
)
fermi = calculate_fermi_energy(add_tb(model.h_0, result), model.filling, nk=nk)
return add_tb(result, {model._local_key: -fermi * np.eye(model._size)})
return add_tb(result, {model._local_key: -fermi * np.eye(model._ndof)})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment