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

Making the Fermi level a scalar to avoid problems. #34

Merged
merged 1 commit into from
Nov 9, 2023
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
6 changes: 6 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
=======
History
=======
2023.11.8 -- Bugfix: Fermi level being an array caused problems
* The Fermi level in DFTB+ is a vector with 1 or 2 elements, depending whether the
calculation is spin-polarized. DFTB+ can handle different Fermi levels, but it is
not clear how useful this is, so for the time being not allowing such calculations
and treating the Fermi level as a scalar.

2023.11.7 -- Added structure to orbital and density plots
* The Dashboard expects 'structure.sdf' in order to display the structure with the
orbital or debsity plots from CUBE files.
Expand Down
7 changes: 6 additions & 1 deletion dftbplus_step/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,12 @@ def parse_results(self, lines):
if _type == "real":
values = [float(x) for x in values]

property_data[key] = redimension(values, dims)
if key == "fermi_level":
# The Fermi level has one or two values if spin-polarized, but
# normally they are the same, so turn into a scalar.
property_data[key] = values[0]
else:
property_data[key] = redimension(values, dims)
if key not in properties:
self.logger.warning("Property '{}' not recognized.".format(key))
if key in properties and "units" in properties[key]:
Expand Down
3 changes: 2 additions & 1 deletion dftbplus_step/energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,8 @@ def analyze(self, indent="", data={}, out=[]):

# Prepare the DOS graph(s)
if "fermi_level" in data:
Efermi = list(Q_(data["fermi_level"], "hartree").to("eV").magnitude)
# Efermi = list(Q_(data["fermi_level"], "hartree").to("eV").magnitude)
Efermi = [Q_(data["fermi_level"], "hartree").to("eV").magnitude]
else:
Efermi = [0.0]
wd = Path(self.directory)
Expand Down
2 changes: 1 addition & 1 deletion dftbplus_step/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"optimization",
],
"description": "The Fermi level",
"dimensionality": [2],
"dimensionality": "scalar",
"property": "Fermi level#DFTB+#{model}",
"type": "float",
"units": "E_h",
Expand Down
Loading