Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make a MIS property for the Density object #129

Merged
merged 2 commits into from
Mar 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions atoMEC/staticKS.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,8 @@ def __init__(self, orbs):
"N": np.zeros((config.spindims)),
}

self._MIS = 0.0

self._orbs = orbs

@property
Expand Down Expand Up @@ -655,6 +657,13 @@ def unbound(self):
self._unbound = self.construct_rho_unbound()
return self._unbound

@property
def MIS(self):
"""ndarray: the mean ionization state."""
occs_pos = np.where(self._orbs.eigvals > 0, self._orbs.occnums_w, 0)
self._MIS = np.sum(occs_pos, axis=(0, 2, 3)) + self.unbound["N"]
return self._MIS

@staticmethod
def construct_rho_orbs(eigfuncs, occnums, xgrid):
"""
Expand Down
3 changes: 1 addition & 2 deletions atoMEC/writeoutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,7 @@ def write_final(self, energy, orbitals, density, conv_vals):
output_str += self.write_final_energies(energy) + spc

# write the chemical potential and mean ionization state
occs_pos = np.where(orbitals.eigvals > 0, orbitals.occnums_w, 0)
N_ub = np.sum(occs_pos, axis=(0, 2, 3)) + density.unbound["N"]
N_ub = density.MIS

if config.spindims == 2:
mu_str = "Chemical potential (u/d)"
Expand Down