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

units as parameter in read_* #726

Merged
merged 10 commits into from
Mar 22, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
some polishing
tfrederiksen committed Mar 22, 2024
commit 174f890c53a6c28248496ed757ead29de9e8991d
7 changes: 3 additions & 4 deletions src/sisl/io/orca/stdout.py
Original file line number Diff line number Diff line change
@@ -5,8 +5,7 @@

from sisl._internal import set_module
from sisl.messages import deprecation
from sisl.unit import serialize_units_arg
from sisl.unit import units as sunits
from sisl.unit import serialize_units_arg, unit_convert
from sisl.utils import PropertyDict

from .._multiple import SileBinder
@@ -267,7 +266,7 @@ def read_energy(self, units="eV"):
Parameters
----------
units :
what energy units the data should be returned in
selects units in the returned data
Note
----
@@ -285,7 +284,7 @@ def read_energy(self, units="eV"):
self.readline() # skip blank line

units = serialize_units_arg(units)
Ha2unit = sunits.convert("Ha", units["energy"])
Ha2unit = unit_convert("Ha", units["energy"])

E = PropertyDict()

15 changes: 7 additions & 8 deletions src/sisl/io/orca/txt.py
Original file line number Diff line number Diff line change
@@ -6,8 +6,7 @@
from sisl._core.geometry import Geometry
from sisl._internal import set_module
from sisl.messages import deprecation
from sisl.unit import serialize_units_arg
from sisl.unit import units as sunits
from sisl.unit import serialize_units_arg, unit_convert
from sisl.utils import PropertyDict

from .._multiple import SileBinder
@@ -81,8 +80,8 @@ def read_energy(self, units="eV"):
Parameters
----------
unit :
what energy unit the data should be returned in
units :
selects units in the returned data
Note
----
@@ -101,7 +100,7 @@ def read_energy(self, units="eV"):
self.readline() # prop. index

units = serialize_units_arg(units)
Ha2unit = sunits.convert("Ha", units["energy"])
Ha2unit = unit_convert("Ha", units["energy"])

E = PropertyDict()

@@ -207,8 +206,8 @@ def read_hyperfine_coupling(self, units="eV"):
Parameters
----------
unit :
what energy unit the data should be returned in
units :
selects units in the returned data
For a nucleus :math:`k`, the hyperfine interaction is usually
written in terms of the symmetric :math:`3\times 3` hyperfine
@@ -237,7 +236,7 @@ def read_hyperfine_coupling(self, units="eV"):
return None

units = serialize_units_arg(units)
MHz2unit = sunits.convert("MHz", units["energy"])
MHz2unit = unit_convert("MHz", units["energy"])

def read_A():
A = PropertyDict()

Unchanged files with check annotations Beta

# add new quantity to dictionary
new_units_arg[g] = u
else:
raise ValueError(

Check warning on line 444 in src/sisl/unit/base.py

Codecov / codecov/patch

src/sisl/unit/base.py#L444

Added line #L444 was not covered by tests
f"Two units for the same quantity was specified. This is not allowed."
)
return new_units_arg