Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
gmatteo committed May 23, 2016
1 parent 0df34d3 commit 30f32c2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
15 changes: 13 additions & 2 deletions pseudo_dojo/core/pseudos.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def get_dojo_dataframe(self, **kwargs):
from pseudo_dojo.core.dojoreport import DojoDataFrame
return DojoDataFrame(rows, index=names), errors

def get_dfgbrv_dataframe(self):
def get_dfgbrv_dataframe(self, raise_if_none_dojoreport=False):
"""
Build and return a pandas :class:`DataFrame` in the form.
Expand All @@ -314,6 +314,10 @@ def get_dfgbrv_dataframe(self):
...
where `gbrv_bcc` and `gbrv_fcc` are the relative errors (in percentage) wrt the AE calculations.
Args:
raise_if_none_dojoreport: If True, a ValueError is raised if one of the pseudo does not
have the dojo_report else a warning is emitted.
"""
_TRIALS2KEY = {
"deltafactor": "dfact_meV",
Expand All @@ -324,8 +328,15 @@ def get_dfgbrv_dataframe(self):
rows = []
for p in self:
# Extract the dojo_report
report = p.dojo_report
if not p.has_dojo_report:
msg = "%s does not have the dojo_report" % p.filepath
if not raise_if_none_dojoreport:
logger.warning(msg)
continue
else:
raise ValueError(msg)

report = p.dojo_report
row = dict(basename=p.basename, symbol=p.symbol, md5=p.md5)

for trial, key in _TRIALS2KEY.items():
Expand Down
2 changes: 1 addition & 1 deletion pseudo_dojo/scripts/dojorun.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def build_flow(pseudo, options):
print(pseudo)

if options.soc and not pseudo.supports_soc:
raise TypeError("SOC is on but pseudo does not support spin-orbit couplit")
raise TypeError("SOC is on but pseudo does not support spin-orbit coupling")

if not options.soc and pseudo.supports_soc and pseudo.path.endswith("psp8"):
cprint("[STRANGE]: Your psp8 pseudo supports SOC but options.soc is off", "magenta")
Expand Down
10 changes: 6 additions & 4 deletions pseudo_dojo/tests/tests_dojotables.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test_official_tables(self):
print("All dojo tables", dojo_tables)
print("Table names", dojo_tables.keys())
print("available XC functionals", dojo_tables.available_xcs)
assert "PBE" in dojo_tables.available_xcs

# Can select tables by XC and or PP type.
print("all_nctables:", dojo_tables.all_nctables())
Expand Down Expand Up @@ -46,6 +47,7 @@ def test_official_tables(self):
if retcode:
raise RuntimeError("dojo_find_errors returned errors. Check djson files.")

# md5 values should be unique.
retcode = 0
md5_pseudo = {}
for table in dojo_tables.values():
Expand Down Expand Up @@ -94,11 +96,11 @@ def test_official_tables(self):
assert retcode

# Programmatic interface to extract pseudos.
assert (p.isnc and p.symbol == "Si" and p.xc == "PBE" for p in
dojo_tables.select_nc_pseudos("Si", xc="PBE"))
assert (all(p.isnc and p.symbol == "Si" and p.xc == "PBE" for p in
dojo_tables.select_nc_pseudos("Si", xc="PBE")))

assert (p.ispaw and p.symbol == "Al" and p.xc == "PW" for p in
dojo_tables.select_paw_pseudos("Al", xc="PW"))
assert (all(p.ispaw and p.symbol == "Al" and p.xc == "PW" for p in
dojo_tables.select_paw_pseudos("Al", xc="PW")))

# Plots
#dojo_tables.plot_numpseudos()

0 comments on commit 30f32c2

Please sign in to comment.