Skip to content

Commit

Permalink
Merge pull request #129 from timcallow/MIS_calc
Browse files Browse the repository at this point in the history
make a MIS property for the Density object
  • Loading branch information
timcallow authored Mar 6, 2022
2 parents 87e5786 + d9dfbf2 commit 053cad8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 9 additions & 0 deletions atoMEC/staticKS.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,8 @@ def __init__(self, orbs):
"N": np.zeros((config.spindims)),
}

self._MIS = 0.0

self._orbs = orbs

@property
Expand Down Expand Up @@ -656,6 +658,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

0 comments on commit 053cad8

Please sign in to comment.