-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
streamlined projection options (#875)
* streamlined projection options Still things to do, but for now this catches many things. One thing is that 'basis' projections are now called hadamard (the proper name of the operation). While 'basis' is still allowed it seems better to streamline a against a common name. Signed-off-by: Nick Papior <[email protected]> --------- Signed-off-by: Nick Papior <[email protected]>
- Loading branch information
Showing
16 changed files
with
223 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
from __future__ import annotations | ||
|
||
from sisl.typing import GaugeType, ProjectionType | ||
|
||
__all__ = ["comply_gauge", "comply_projection"] | ||
|
||
|
||
def comply_gauge(gauge: GaugeType) -> str: | ||
"""Comply the gauge to one of two words: atom | cell""" | ||
return { | ||
"R": "cell", | ||
"cell": "cell", | ||
"r": "atom", | ||
"orbital": "atom", | ||
"orbitals": "atom", | ||
"atom": "atom", | ||
"atoms": "atom", | ||
}[gauge] | ||
|
||
|
||
def comply_projection(projection: ProjectionType) -> str: | ||
"""Comply the projection to one of the allowed variants""" | ||
return { | ||
"matrix": "matrix", | ||
"ij": "matrix", | ||
"trace": "trace", | ||
"sum": "trace", | ||
"diagonal": "diagonal", | ||
"diag": "diagonal", | ||
"ii": "diagonal", | ||
"hadamard": "hadamard", | ||
"basis": "hadamard", | ||
"orbital": "hadamard", | ||
"orbitals": "hadamard", | ||
"hadamard:atoms": "hadamard:atoms", | ||
"atoms": "hadamard:atoms", | ||
"atom": "hadamard:atoms", | ||
}[projection] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.