Skip to content

Commit

Permalink
Merge pull request #34 from molssi-seamm/dev
Browse files Browse the repository at this point in the history
Making the Fermi level a scalar to avoid problems.
  • Loading branch information
seamm committed Nov 9, 2023
2 parents 59fe727 + 82a1160 commit 4e12526
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
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

0 comments on commit 4e12526

Please sign in to comment.