Skip to content

Commit

Permalink
Update to 7.8 (#50)
Browse files Browse the repository at this point in the history
* Fix COSMO results parsing.

* Checked unit and integration tests. Updated reference files to 7.8.1.

* Fixed linting.

* Changed documentation.
Changed version.

* Fixed epsilon type in cosmo.
Added parsing of solvent and source in cosmo parsing.
Added more information for checking changes in
dev_script/generate_output_files.py.
Added possibility to set solvent and refind in define parameters
and in add_cosmo method of Control.
Updated reference files.

* Fixed lowercase for solvents.
Added tests for cosmo solvents.

* Updated reference files for integration tests.

* Added test for bad solvent name.

* Added test for cosmo predefined solvent.

* Added deps for docs generation.
Fixed intersphinx_mapping for new versions of sphinx.

* Updated documentation.

* Fixed missing data file (added __init__.py in the directory).
  • Loading branch information
davidwaroquiers authored Sep 12, 2024
1 parent db74669 commit 40e59a5
Show file tree
Hide file tree
Showing 803 changed files with 70,532 additions and 18,579 deletions.
75 changes: 69 additions & 6 deletions dev_scripts/generate_output_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ def compare_to_reference_files(
all_diffs,
tm_exec,
ref_fname="ref_output.json",
dryrun=False,
):
"""
Generate the output object and compare it to the reference one.
Expand All @@ -495,6 +496,7 @@ def compare_to_reference_files(
the reference log files.
tm_exec: Turbomole executable being tested.
ref_fname: Filename of the json-serialized reference output object.
dryrun: Whether in dryrun mode.
Returns:
tuple: Output object and serialized Output object.
Expand All @@ -520,13 +522,34 @@ def compare_to_reference_files(
)
for idiff, diff in enumerate(out_diffs, start=1):
print(f"#{idiff} {diff[0]}\n {diff[1]}")
all_diffs[f"{tm_exec}_{out_cls.__name__}"] = out_diffs
test_name = f"{tm_exec}_{out_cls.__name__}"
all_diffs[test_name] = out_diffs
if dryrun:
dumpfn(
ref_out,
os.path.join(ref_test_dirpath, f"{test_name}_REF.json"),
indent=2,
sort_keys=True,
)
dumpfn(
gen_out_dict,
os.path.join(ref_test_dirpath, f"{test_name}_NEW.json"),
indent=2,
sort_keys=True,
)

return gen_out, gen_out_dict


def compare_to_reference_parser(
log_fpath, ref_test_dirpath, rtol, atol, print_diffs, all_diffs, tm_exec
log_fpath,
ref_test_dirpath,
rtol,
atol,
print_diffs,
all_diffs,
tm_exec,
dryrun,
):
"""
Generate all results of parser methods and compare to the reference parser file.
Expand All @@ -541,6 +564,7 @@ def compare_to_reference_parser(
updated if differences are found between the new and the reference
parser files.
tm_exec: Turbomole executable being tested.
dryrun: Whether in dryrun mode.
Returns:
dict: Dictionary mapping each parser method with it's resulting parsed data.
Expand Down Expand Up @@ -568,13 +592,34 @@ def compare_to_reference_parser(
print("There are differences in the parsed methods:")
for idiff, diff in enumerate(parser_diffs, start=1):
print(f"#{idiff} {diff[0]}\n {diff[1]}")
all_diffs[f"{tm_exec}_Parser"] = parser_diffs
test_name = f"{tm_exec}_Parser"
all_diffs[test_name] = parser_diffs
if dryrun:
dumpfn(
ref_parser_methods,
os.path.join(ref_test_dirpath, f"{test_name}_REF.json"),
indent=2,
sort_keys=True,
)
dumpfn(
parsed_data,
os.path.join(ref_test_dirpath, f"{test_name}_NEW.json"),
indent=2,
sort_keys=True,
)

return parsed_data


def get_outputs_and_parser_objects_and_compare(
log_fpath, ref_test_dirpath, rtol, atol, print_diffs, all_diffs, tm_exec
log_fpath,
ref_test_dirpath,
rtol,
atol,
print_diffs,
all_diffs,
tm_exec,
dryrun,
):
"""
Get the serialized output and parser objects and compare them to the reference.
Expand All @@ -589,6 +634,7 @@ def get_outputs_and_parser_objects_and_compare(
Will be updated if differences are found
between the new and the reference parser and/or output files.
tm_exec: Turbomole executable being tested.
dryrun: Whether in dryrun mode.
Returns:
dict: Dictionary mapping the reference outputs and parser filenames
Expand All @@ -605,6 +651,7 @@ def get_outputs_and_parser_objects_and_compare(
all_diffs,
tm_exec,
ref_fname="ref_output.json",
dryrun=dryrun,
)
outputs_parser_dicts = {"ref_output.json": output_dict}
if tm_exec == "escf":
Expand All @@ -618,11 +665,19 @@ def get_outputs_and_parser_objects_and_compare(
all_diffs,
tm_exec,
ref_fname="ref_escf_output.json",
dryrun=dryrun,
)
outputs_parser_dicts["ref_escf_output.json"] = escf_output_dict

outputs_parser_dicts["ref_parser.json"] = compare_to_reference_parser(
log_fpath, ref_test_dirpath, rtol, atol, print_diffs, all_diffs, tm_exec
log_fpath,
ref_test_dirpath,
rtol,
atol,
print_diffs,
all_diffs,
tm_exec,
dryrun=dryrun,
)

return outputs_parser_dicts
Expand Down Expand Up @@ -656,7 +711,14 @@ def update_json_files(dryrun, rtol, atol, print_diffs):
# to the old ones.
log_fpath = get_log_fpath(test_dirpath, tm_exec)
outputs_parser_dicts = get_outputs_and_parser_objects_and_compare(
log_fpath, test_dirpath, rtol, atol, print_diffs, all_diffs, tm_exec
log_fpath,
test_dirpath,
rtol,
atol,
print_diffs,
all_diffs,
tm_exec,
dryrun=dryrun,
)

# Dump the new json-serialized reference output and parser objects.
Expand Down Expand Up @@ -761,6 +823,7 @@ def main():
args.print_diffs,
all_diffs,
tm_exec,
dryrun=dryrun,
)

# Dump the new json-serialized reference output and parser objects.
Expand Down
11 changes: 6 additions & 5 deletions docs/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Overview: module code &mdash; turbomoleio 1.5.0 documentation</title>
<title>Overview: module code &mdash; turbomoleio 1.6.0 documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../_static/css/theme.css?v=19f00094" />

Expand All @@ -14,8 +14,8 @@

<script src="../_static/jquery.js?v=5d32c60e"></script>
<script src="../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../_static/documentation_options.js?v=e0a75244"></script>
<script src="../_static/doctools.js?v=888ff710"></script>
<script src="../_static/documentation_options.js?v=72d88caf"></script>
<script src="../_static/doctools.js?v=9a2dae69"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
Expand All @@ -34,7 +34,7 @@
turbomoleio
</a>
<div class="version">
1.5.0
1.6.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
Expand Down Expand Up @@ -105,6 +105,7 @@ <h1>All modules for which code is available</h1>
<li><a href="turbomoleio/output/files.html">turbomoleio.output.files</a></li>
<li><a href="turbomoleio/output/parser.html">turbomoleio.output.parser</a></li>
<li><a href="turbomoleio/output/states.html">turbomoleio.output.states</a></li>
<li><a href="turbomoleio/testing.html">turbomoleio.testing</a></li>
</ul>

</div>
Expand All @@ -114,7 +115,7 @@ <h1>All modules for which code is available</h1>
<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2018-2022 BASF SE, Matgenix SRL.</p>
<p>&#169; Copyright 2018-2024 BASF SE, Matgenix SRL.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
Expand Down
10 changes: 5 additions & 5 deletions docs/_modules/turbomoleio/core/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>turbomoleio.core.base &mdash; turbomoleio 1.5.0 documentation</title>
<title>turbomoleio.core.base &mdash; turbomoleio 1.6.0 documentation</title>
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../../../_static/css/theme.css?v=19f00094" />

Expand All @@ -14,8 +14,8 @@

<script src="../../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../../_static/documentation_options.js?v=e0a75244"></script>
<script src="../../../_static/doctools.js?v=888ff710"></script>
<script src="../../../_static/documentation_options.js?v=72d88caf"></script>
<script src="../../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
Expand All @@ -34,7 +34,7 @@
turbomoleio
</a>
<div class="version">
1.5.0
1.6.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
Expand Down Expand Up @@ -430,7 +430,7 @@ <h1>Source code for turbomoleio.core.base</h1><div class="highlight"><pre>
<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2018-2022 BASF SE, Matgenix SRL.</p>
<p>&#169; Copyright 2018-2024 BASF SE, Matgenix SRL.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
Expand Down
35 changes: 29 additions & 6 deletions docs/_modules/turbomoleio/core/control.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>turbomoleio.core.control &mdash; turbomoleio 1.5.0 documentation</title>
<title>turbomoleio.core.control &mdash; turbomoleio 1.6.0 documentation</title>
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../../../_static/css/theme.css?v=19f00094" />

Expand All @@ -14,8 +14,8 @@

<script src="../../../_static/jquery.js?v=5d32c60e"></script>
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="../../../_static/documentation_options.js?v=e0a75244"></script>
<script src="../../../_static/doctools.js?v=888ff710"></script>
<script src="../../../_static/documentation_options.js?v=72d88caf"></script>
<script src="../../../_static/doctools.js?v=9a2dae69"></script>
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
Expand All @@ -34,7 +34,7 @@
turbomoleio
</a>
<div class="version">
1.5.0
1.6.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
Expand Down Expand Up @@ -122,6 +122,7 @@ <h1>Source code for turbomoleio.core.control</h1><div class="highlight"><pre>
<span class="sd">energy, etc ...</span>
<span class="sd">&quot;&quot;&quot;</span>

<span class="kn">import</span> <span class="nn">importlib.resources</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">re</span>
<span class="kn">import</span> <span class="nn">shutil</span>
Expand All @@ -139,6 +140,11 @@ <h1>Source code for turbomoleio.core.control</h1><div class="highlight"><pre>
<span class="kn">from</span> <span class="nn">turbomoleio.core.periodic</span> <span class="kn">import</span> <span class="n">PeriodicSystem</span>
<span class="kn">from</span> <span class="nn">turbomoleio.core.symmetry</span> <span class="kn">import</span> <span class="n">irrep_size</span>

<span class="k">with</span> <span class="n">importlib</span><span class="o">.</span><span class="n">resources</span><span class="o">.</span><span class="n">open_text</span><span class="p">(</span>
<span class="s2">&quot;turbomoleio.core.data&quot;</span><span class="p">,</span> <span class="s2">&quot;available_solvents.txt&quot;</span>
<span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
<span class="n">available_solvents</span> <span class="o">=</span> <span class="p">[</span><span class="n">solvent</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="k">for</span> <span class="n">solvent</span> <span class="ow">in</span> <span class="n">f</span><span class="o">.</span><span class="n">readlines</span><span class="p">()]</span>


<div class="viewcode-block" id="Defaults">
<a class="viewcode-back" href="../../../api/turbomoleio.core.html#turbomoleio.core.control.Defaults">[docs]</a>
Expand Down Expand Up @@ -791,7 +797,9 @@ <h1>Source code for turbomoleio.core.control</h1><div class="highlight"><pre>
<a class="viewcode-back" href="../../../api/turbomoleio.core.html#turbomoleio.core.control.Control.add_cosmo">[docs]</a>
<span class="k">def</span> <span class="nf">add_cosmo</span><span class="p">(</span>
<span class="bp">self</span><span class="p">,</span>
<span class="n">solvent</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">epsilon</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">refind</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">nppa</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">nspa</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
<span class="n">disex</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
Expand All @@ -807,7 +815,11 @@ <h1>Source code for turbomoleio.core.control</h1><div class="highlight"><pre>
<span class="sd"> If None all the options will not be written to the control file.</span>

<span class="sd"> Args:</span>
<span class="sd"> solvent (str): name of solvent used. This sets the values of epsilon and</span>
<span class="sd"> refind below from predefined solvents.</span>
<span class="sd"> epsilon (float): permittivity used for scaling of the screening charges.</span>
<span class="sd"> refind (float): refractive index used for the calculation of vertical</span>
<span class="sd"> excitations and numerical frequencies.</span>
<span class="sd"> nppa (int): number of basis grid points per atom.</span>
<span class="sd"> nspa (int): number of segments per atom.</span>
<span class="sd"> disex (float): distance threshold for A matrix elements (Angstrom).</span>
Expand All @@ -825,8 +837,19 @@ <h1>Source code for turbomoleio.core.control</h1><div class="highlight"><pre>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">cosmo_lines</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;&quot;</span><span class="p">]</span>

<span class="k">if</span> <span class="n">solvent</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">solvent_lower</span> <span class="o">=</span> <span class="n">solvent</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span>
<span class="k">if</span> <span class="n">solvent_lower</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">available_solvents</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span>
<span class="sa">f</span><span class="s2">&quot;Solvent with name </span><span class="si">{</span><span class="n">solvent</span><span class="si">}</span><span class="s2"> is not available. &quot;</span>
<span class="sa">f</span><span class="s2">&quot;See turbomoleio/core/data/available_solvents.txt for available &quot;</span>
<span class="sa">f</span><span class="s2">&quot;solvents.&quot;</span>
<span class="p">)</span>
<span class="n">cosmo_lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">&quot; solvent=</span><span class="si">{}</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">solvent_lower</span><span class="p">))</span>
<span class="k">if</span> <span class="n">epsilon</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">cosmo_lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">&quot; epsilon=</span><span class="si">{}</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">epsilon</span><span class="p">))</span>
<span class="k">if</span> <span class="n">refind</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">cosmo_lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">&quot; refind=</span><span class="si">{}</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">refind</span><span class="p">))</span>
<span class="k">if</span> <span class="n">nppa</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">cosmo_lines</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="s2">&quot; nppa=</span><span class="si">{}</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">nppa</span><span class="p">))</span>
<span class="k">if</span> <span class="n">nspa</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
Expand Down Expand Up @@ -920,7 +943,7 @@ <h1>Source code for turbomoleio.core.control</h1><div class="highlight"><pre>

<span class="k">if</span> <span class="n">dispersion_correction</span> <span class="o">==</span> <span class="s2">&quot;dft-d1&quot;</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span>
<span class="s2">&quot;D1 dispersion correction is not working anymore in &quot;</span> <span class="s2">&quot;Turbomole v7.5.&quot;</span>
<span class="s2">&quot;D1 dispersion correction is not working anymore in Turbomole v7.5.&quot;</span>
<span class="p">)</span>
<span class="c1"># self.add_data_group(&quot;olddisp&quot;, &quot;&quot;)</span>
<span class="k">elif</span> <span class="n">dispersion_correction</span> <span class="o">==</span> <span class="s2">&quot;dft-d2&quot;</span><span class="p">:</span>
Expand Down Expand Up @@ -1398,7 +1421,7 @@ <h1>Source code for turbomoleio.core.control</h1><div class="highlight"><pre>
<hr/>

<div role="contentinfo">
<p>&#169; Copyright 2018-2022 BASF SE, Matgenix SRL.</p>
<p>&#169; Copyright 2018-2024 BASF SE, Matgenix SRL.</p>
</div>

Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
Expand Down
Loading

0 comments on commit 40e59a5

Please sign in to comment.