diff --git a/.clang-format b/.clang-format index 1c27bb2..a9b8259 100644 --- a/.clang-format +++ b/.clang-format @@ -34,7 +34,7 @@ AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: true BinPackArguments: true BinPackParameters: true -BraceWrapping: +BraceWrapping: AfterClass: false AfterControlStatement: false AfterEnum: false @@ -65,7 +65,7 @@ DisableFormat: false ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] -IncludeCategories: +IncludeCategories: - Regex: '^"' Priority: 1 - Regex: '^<' diff --git a/.github/integration_testing.cmake b/.github/integration_testing.cmake index d4624eb..a98fff3 100644 --- a/.github/integration_testing.cmake +++ b/.github/integration_testing.cmake @@ -1 +1 @@ -set(INTEGRATION_TESTING ON) \ No newline at end of file +set(INTEGRATION_TESTING ON) diff --git a/.github/tamm_testing.cmake b/.github/tamm_testing.cmake index 66541a4..a1349eb 100644 --- a/.github/tamm_testing.cmake +++ b/.github/tamm_testing.cmake @@ -1,3 +1,3 @@ set(INTEGRATION_TESTING ON) set(BUILD_TAMM_SCF ON) -set(BUILD_PYBIND11_PYBINDINGS OFF) \ No newline at end of file +set(BUILD_PYBIND11_PYBINDINGS OFF) diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index 99eeddb..c3d5d5c 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -24,7 +24,7 @@ jobs: check_formatting: uses: NWChemEx/.github/.github/workflows/check_formatting.yaml@master with: - license_config: ".github/.licenserc.yaml" + license_config: ".licenserc.yaml" test_nwx_docs: uses: NWChemEx/.github/.github/workflows/test_nwx_docs.yaml@master @@ -47,4 +47,3 @@ jobs: # with: # compilers: '["gcc-11"]' # repo_toolchain: '.github/tamm_testing.cmake' - \ No newline at end of file diff --git a/.github/.licenserc.yaml b/.licenserc.yaml similarity index 98% rename from .github/.licenserc.yaml rename to .licenserc.yaml index 15b42a8..da06fad 100644 --- a/.github/.licenserc.yaml +++ b/.licenserc.yaml @@ -24,5 +24,6 @@ header: - src/scf/common/ - src/scf/scf/ - LICENSE + - build comment: never diff --git a/CMakeLists.txt b/CMakeLists.txt index f5230d8..9234844 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,7 +82,7 @@ nwx_add_pybind11_module( DEPENDS "${PROJECT_NAME}" ) -if("${BUILD_TESTING}") +if("${BUILD_TESTING}") include(CTest) set(PYTHON_TEST_DIR "${SCF_TESTS_DIR}/python") set(CXX_TEST_DIR "${SCF_TESTS_DIR}/cxx") @@ -113,7 +113,7 @@ if("${BUILD_TESTING}") python_mpi_test( integration_test_scf "${PYTHON_TEST_DIR}/integration_tests/run_integration_tests.py" - SUBMODULES nwchemex chemcache integrals simde chemist pluginplay + SUBMODULES nwchemex chemcache integrals simde chemist pluginplay parallelzone friendzone tensorwrapper nux ) diff --git a/LICENSE b/LICENSE index 4947287..f433b1a 100644 --- a/LICENSE +++ b/LICENSE @@ -174,4 +174,4 @@ incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - END OF TERMS AND CONDITIONS \ No newline at end of file + END OF TERMS AND CONDITIONS diff --git a/cmake/get_nwx_cmake.cmake b/cmake/get_nwx_cmake.cmake index 2aec0e7..c99674d 100644 --- a/cmake/get_nwx_cmake.cmake +++ b/cmake/get_nwx_cmake.cmake @@ -28,4 +28,4 @@ macro(get_nwx_cmake) ) endmacro() -get_nwx_cmake() \ No newline at end of file +get_nwx_cmake() diff --git a/cmake/mpi_test.cmake b/cmake/mpi_test.cmake index 3a1ce1f..9986f5b 100644 --- a/cmake/mpi_test.cmake +++ b/cmake/mpi_test.cmake @@ -28,7 +28,7 @@ macro(python_mpi_test test_name test_script) add_test( NAME "py_${test_name}" COMMAND "${MPIEXEC_EXECUTABLE}" "${MPIEXEC_NUMPROC_FLAG}" "2" - "${Python_EXECUTABLE}" + "${Python_EXECUTABLE}" "${test_script}" ) nwx_python_path(TEST_PYTHONPATH ${ARGN}) @@ -37,4 +37,4 @@ macro(python_mpi_test test_name test_script) PROPERTIES ENVIRONMENT "${TEST_PYTHONPATH}" ) endif() -endmacro() \ No newline at end of file +endmacro() diff --git a/docs/make.bat b/docs/make.bat index 7ab3ebd..0b43249 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -1,17 +1,17 @@ -rem Copyright 2022 NWChemEx-Project -rem -rem Licensed under the Apache License, Version 2.0 (the "License"); -rem you may not use this file except in compliance with the License. -rem You may obtain a copy of the License at -rem -rem http://www.apache.org/licenses/LICENSE-2.0 -rem -rem Unless required by applicable law or agreed to in writing, software -rem distributed under the License is distributed on an "AS IS" BASIS, -rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -rem See the License for the specific language governing permissions and -rem limitations under the License. - +rem Copyright 2022 NWChemEx-Project +rem +rem Licensed under the Apache License, Version 2.0 (the "License"); +rem you may not use this file except in compliance with the License. +rem You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + @ECHO OFF pushd %~dp0 diff --git a/docs/source/conf.py b/docs/source/conf.py index 08e84e1..7988496 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -21,13 +21,14 @@ # http://www.sphinx-doc.org/en/master/config import os + import git # -- Project information ----------------------------------------------------- -project = u'SCF' -copyright = u'2024, NWChemEx Team' -author = u'NWChemEx Team' +project = "SCF" +copyright = "2024, NWChemEx Team" +author = "NWChemEx Team" ############################################################################## # Shouldn't need to change anything below this point # @@ -61,40 +62,40 @@ # If your documentation needs a minimal Sphinx version, state it here. # -needs_sphinx = '7.2.6' +needs_sphinx = "7.2.6" # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx.ext.autodoc', - 'sphinx.ext.mathjax', - 'sphinx.ext.githubpages', - 'sphinx.ext.autosummary', - 'sphinx_rtd_theme', + "sphinx.ext.autodoc", + "sphinx.ext.mathjax", + "sphinx.ext.githubpages", + "sphinx.ext.autosummary", + "sphinx_rtd_theme", # 'sphinxcontrib.bibtex', - 'sphinx_tabs.tabs', - 'sphinx.ext.intersphinx', + "sphinx_tabs.tabs", + "sphinx.ext.intersphinx", ] # Add any paths that contain templates here, relative to this directory. -#templates_path = ['_templates'] +# templates_path = ['_templates'] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # # source_suffix = ['.rst', '.md'] -source_suffix = '.rst' +source_suffix = ".rst" # The master toctree document. -master_doc = 'index' +master_doc = "index" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = 'en' +language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -102,7 +103,7 @@ exclude_patterns = [] # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" numfig = True numfig_secnum_depth = 0 @@ -112,7 +113,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'sphinx_rtd_theme' +html_theme = "sphinx_rtd_theme" # html_logo = "assets/logo.png" @@ -120,12 +121,12 @@ # further. For a list of options available for each theme, see the # documentation. # -html_theme_options = {'logo_only': True} +html_theme_options = {"logo_only": True} # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -#html_static_path = ['_static'] +# html_static_path = ['_static'] # Custom sidebar templates, must be a dictionary that maps document names # to template names. @@ -140,7 +141,7 @@ # -- Options for HTMLHelp output --------------------------------------------- # Output file base name for HTML help builder. -htmlhelp_basename = project + 'doc' +htmlhelp_basename = project + "doc" # -- Options for LaTeX output ------------------------------------------------ @@ -148,15 +149,12 @@ # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). # # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. # # 'preamble': '', - # Latex figure (float) alignment # # 'figure_align': 'htbp', @@ -166,16 +164,22 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, project + '.tex', project + ' Documentation', author, - 'manual'), + ( + master_doc, + project + ".tex", + project + " Documentation", + author, + "manual", + ), ] # -- Options for manual page output ------------------------------------------ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [(master_doc, project.lower(), project + ' Documentation', - [author], 1)] +man_pages = [ + (master_doc, project.lower(), project + " Documentation", [author], 1) +] # -- Options for Texinfo output ---------------------------------------------- @@ -183,8 +187,15 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, project, project + ' Documentation', author, project, - 'One line description of project.', 'Miscellaneous'), + ( + master_doc, + project, + project + " Documentation", + author, + project, + "One line description of project.", + "Miscellaneous", + ), ] # -- Extension configuration ------------------------------------------------- @@ -192,4 +203,4 @@ # -- Options for intersphinx extension --------------------------------------- # Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {'python': ('https://docs.python.org/3', None)} +intersphinx_mapping = {"python": ("https://docs.python.org/3", None)} diff --git a/docs/source/module_api/index.rst b/docs/source/module_api/index.rst index adafd75..a98a8d9 100644 --- a/docs/source/module_api/index.rst +++ b/docs/source/module_api/index.rst @@ -18,4 +18,4 @@ Module API .. toctree:: :maxdepth: 1 - :caption: Packages \ No newline at end of file + :caption: Packages diff --git a/examples/driver/scf_driver.cpp b/examples/driver/scf_driver.cpp index a630ca8..01080c1 100644 --- a/examples/driver/scf_driver.cpp +++ b/examples/driver/scf_driver.cpp @@ -16,12 +16,11 @@ #include -#include #include +#include #include int main(int argc, char** argv) { - tamm::initialize(argc, argv); // Populate modules @@ -31,24 +30,26 @@ int main(int argc, char** argv) { // Create ChemicalSystem std::string mol_name = "water"; - auto mol = mm.at("NWX Molecules").run_as(mol_name); + auto mol = + mm.at("NWX Molecules").run_as(mol_name); simde::type::chemical_system cs(mol); // Create BasisSet - std::string basis_name = "sto-3g"; // This is the only supported basis in ChemCache + std::string basis_name = + "sto-3g"; // This is the only supported basis in ChemCache auto aos = mm.at(basis_name).run_as(mol); // Run module auto E = mm.at("SCF Energy").run_as(aos, cs); std::cout << "SCF Energy = " << E << " Hartree" << std::endl; - + std::vector xc_type = {"pbe0"}; mm.change_input("SCF Energy", "xc_type", xc_type); mm.change_input("SCF Energy", "molecule_name", mol_name); E = mm.at("SCF Energy").run_as(aos, cs); std::cout << "SCF Energy = " << E << " Hartree" << std::endl; - + tamm::finalize(); - + return 0; } diff --git a/requirements.txt b/requirements.txt index 9bf8cb8..aefa9e3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ +ase +networkx # This file is a hack to get CI/CD to work. These packages are needed by # FriendZone NOT this repo. pydantic>=1.10.13 qcengine -networkx -ase \ No newline at end of file diff --git a/src/scf/coulombs_law.cpp b/src/scf/coulombs_law.cpp index 8f525c5..d4bad26 100644 --- a/src/scf/coulombs_law.cpp +++ b/src/scf/coulombs_law.cpp @@ -33,17 +33,17 @@ electrostatic potential at the point :math:`\mathbf{r}` generated by :math:`Q`, .. math:: - E_Q(\mathbf{r}) = \sum_{i=1}^{N_Q} + E_Q(\mathbf{r}) = \sum_{i=1}^{N_Q} \frac{q_i}{\left|\mathbf{r} - \mathbf{r_i}\right|} -Let :math:`S` be a set of :math:`N_S` point charges that is disjoint with -:math:`Q`, then the interaction of :math:`S` with :math:`Q`, :math:`V_{SQ}` is +Let :math:`S` be a set of :math:`N_S` point charges that is disjoint with +:math:`Q`, then the interaction of :math:`S` with :math:`Q`, :math:`V_{SQ}` is given by: .. math:: V_{SQ} =& \sum_{i=1}^{N_S} q_i E_Q(\mathbf{r_i})\\ - =& \sum_{i=1}^{N_S}\sum_{j=1}^{N_Q} + =& \sum_{i=1}^{N_S}\sum_{j=1}^{N_Q} \frac{q_i q_j}{\left|\mathbf{r_i} - \mathbf{r_j}\right|} This module will compute :math:`V_{SQ}`, including in the common scenario where @@ -78,4 +78,4 @@ MODULE_RUN(CoulombsLaw) { return pt::wrap_results(rv, e); } -} // namespace scf \ No newline at end of file +} // namespace scf diff --git a/src/scf/driver/scf_driver.cpp b/src/scf/driver/scf_driver.cpp index 116ee06..9c69b93 100644 --- a/src/scf/driver/scf_driver.cpp +++ b/src/scf/driver/scf_driver.cpp @@ -72,4 +72,4 @@ MODULE_RUN(SCFDriver) { return pt::wrap_results(rv, e); } -} // namespace scf::driver \ No newline at end of file +} // namespace scf::driver diff --git a/src/scf/eigen_solver/eigen_generalized.cpp b/src/scf/eigen_solver/eigen_generalized.cpp index 1016537..89e8947 100644 --- a/src/scf/eigen_solver/eigen_generalized.cpp +++ b/src/scf/eigen_solver/eigen_generalized.cpp @@ -103,4 +103,4 @@ MODULE_RUN(EigenGeneralized) { return pt::wrap_results(rv, values, vectors); } -} // namespace scf::eigen_solver \ No newline at end of file +} // namespace scf::eigen_solver diff --git a/src/scf/eigen_solver/eigen_solver.hpp b/src/scf/eigen_solver/eigen_solver.hpp index 41d99db..9c5664e 100644 --- a/src/scf/eigen_solver/eigen_solver.hpp +++ b/src/scf/eigen_solver/eigen_solver.hpp @@ -25,4 +25,4 @@ inline void load_modules(pluginplay::ModuleManager& mm) { mm.add_module("Generalized eigensolve via Eigen"); } -} // namespace scf::eigen_solver \ No newline at end of file +} // namespace scf::eigen_solver diff --git a/src/scf/fock_operator/fock_operator.hpp b/src/scf/fock_operator/fock_operator.hpp index c2327f1..f6ef6de 100644 --- a/src/scf/fock_operator/fock_operator.hpp +++ b/src/scf/fock_operator/fock_operator.hpp @@ -63,4 +63,4 @@ EXTERN_RKOHN_SHAM(simde::type::decomposable_e_density); #undef EXTERN_RKOHN_SHAM #undef EXTERN_RESTRICTED -} // namespace scf::fock_operator \ No newline at end of file +} // namespace scf::fock_operator diff --git a/src/scf/fock_operator/fock_operator_common.hpp b/src/scf/fock_operator/fock_operator_common.hpp index 84a7fee..c8b338f 100644 --- a/src/scf/fock_operator/fock_operator_common.hpp +++ b/src/scf/fock_operator/fock_operator_common.hpp @@ -53,4 +53,4 @@ class FockOperatorCommon : public chemist::qm_operator::OperatorVisitor { simde::type::fock* m_pF_; }; -} // namespace scf::fock_operator \ No newline at end of file +} // namespace scf::fock_operator diff --git a/src/scf/fock_operator/restricted.cpp b/src/scf/fock_operator/restricted.cpp index ea16ba9..0ba6de1 100644 --- a/src/scf/fock_operator/restricted.cpp +++ b/src/scf/fock_operator/restricted.cpp @@ -50,11 +50,11 @@ const auto desc = R"( Restricted Fock Operator Builder -------------------------------- -This module builds the Fock operator given a restricted density. Under this -assumption, the Fock operator is created by mapping each term in the +This module builds the Fock operator given a restricted density. Under this +assumption, the Fock operator is created by mapping each term in the electronic Hamiltonian to itself with the exception of the electron-electron repulsion. The electron-electron repulsion is mapped to 2J-K where J is the -Coulomb operator for the electrons interacting with a density and K is the +Coulomb operator for the electrons interacting with a density and K is the exchange operator for the same density. N.b. Empty densities are treated as zero densities and this module will skip @@ -92,4 +92,4 @@ RESTRICTED(simde::type::decomposable_e_density); #undef RESTRICTED -} // namespace scf::fock_operator \ No newline at end of file +} // namespace scf::fock_operator diff --git a/src/scf/fock_operator/rkohn_sham.cpp b/src/scf/fock_operator/rkohn_sham.cpp index 0d1ced3..358d0db 100644 --- a/src/scf/fock_operator/rkohn_sham.cpp +++ b/src/scf/fock_operator/rkohn_sham.cpp @@ -54,11 +54,11 @@ const auto desc = R"( Restricted Kohn-Sham Operator Builder ------------------------------------- -This module builds the Kohn-Sham operator given a restricted density. Under this -assumption, the Kohn-Sham operator is created by mapping each term in the +This module builds the Kohn-Sham operator given a restricted density. Under this +assumption, the Kohn-Sham operator is created by mapping each term in the electronic Hamiltonian to itself with the exception of the electron-electron repulsion. The electron-electron repulsion is mapped to 2J + X where J is the -Coulomb operator for the electrons interacting with a density and X is the +Coulomb operator for the electrons interacting with a density and X is the exchange-correlation potential for the same density. N.b. Empty densities are treated as zero densities and this module will skip @@ -98,4 +98,4 @@ RESTRICTED(simde::type::decomposable_e_density); #undef RESTRICTED -} // namespace scf::fock_operator \ No newline at end of file +} // namespace scf::fock_operator diff --git a/src/scf/guess/core.cpp b/src/scf/guess/core.cpp index ace3108..e5f7ad2 100644 --- a/src/scf/guess/core.cpp +++ b/src/scf/guess/core.cpp @@ -95,4 +95,4 @@ MODULE_RUN(Core) { return pt::wrap_results(rv, Psi0); } -} // namespace scf::guess \ No newline at end of file +} // namespace scf::guess diff --git a/src/scf/guess/guess.hpp b/src/scf/guess/guess.hpp index 4009fe6..9c94b3d 100644 --- a/src/scf/guess/guess.hpp +++ b/src/scf/guess/guess.hpp @@ -39,4 +39,4 @@ inline void set_defaults(pluginplay::ModuleManager& mm) { "Diagonalization Fock update"); } -} // namespace scf::guess \ No newline at end of file +} // namespace scf::guess diff --git a/src/scf/guess/sad.cpp b/src/scf/guess/sad.cpp index ef8fb42..9006355 100644 --- a/src/scf/guess/sad.cpp +++ b/src/scf/guess/sad.cpp @@ -98,4 +98,4 @@ MODULE_RUN(SAD) { return pt::wrap_results(rv, Psi0); } -} // namespace scf::guess \ No newline at end of file +} // namespace scf::guess diff --git a/src/scf/matrix_builder/density_matrix.cpp b/src/scf/matrix_builder/density_matrix.cpp index 2bd823f..8269d93 100644 --- a/src/scf/matrix_builder/density_matrix.cpp +++ b/src/scf/matrix_builder/density_matrix.cpp @@ -103,4 +103,4 @@ MODULE_RUN(DensityMatrix) { return pt::wrap_results(rv, p); } -} // namespace scf::matrix_builder \ No newline at end of file +} // namespace scf::matrix_builder diff --git a/src/scf/matrix_builder/electronic_energy.cpp b/src/scf/matrix_builder/electronic_energy.cpp index 1bc5ac5..95ad6a7 100644 --- a/src/scf/matrix_builder/electronic_energy.cpp +++ b/src/scf/matrix_builder/electronic_energy.cpp @@ -99,13 +99,11 @@ MODULE_RUN(ElectronicEnergy) { } if(i == 0) e = temp; - else { - e("") = e("") + temp(""); - } + else { e("") = e("") + temp(""); } } auto rv = results(); return pt::wrap_results(rv, e); } -} // namespace scf::matrix_builder \ No newline at end of file +} // namespace scf::matrix_builder diff --git a/src/scf/matrix_builder/fock.cpp b/src/scf/matrix_builder/fock.cpp index 6099489..8cacdc4 100644 --- a/src/scf/matrix_builder/fock.cpp +++ b/src/scf/matrix_builder/fock.cpp @@ -66,4 +66,4 @@ MODULE_RUN(Fock) { return pt::wrap_results(rv, F); } -} // namespace scf::matrix_builder \ No newline at end of file +} // namespace scf::matrix_builder diff --git a/src/scf/matrix_builder/matrix_builder.hpp b/src/scf/matrix_builder/matrix_builder.hpp index 3139a8c..1c75c2a 100644 --- a/src/scf/matrix_builder/matrix_builder.hpp +++ b/src/scf/matrix_builder/matrix_builder.hpp @@ -49,4 +49,4 @@ inline void set_defaults(pluginplay::ModuleManager& mm) { mm.change_submod("Electronic energy", "XC Energy", "GauXC XC Energy"); } -} // namespace scf::matrix_builder \ No newline at end of file +} // namespace scf::matrix_builder diff --git a/src/scf/matrix_builder/scf_integrals_driver.cpp b/src/scf/matrix_builder/scf_integrals_driver.cpp index 99c6163..77539c1 100644 --- a/src/scf/matrix_builder/scf_integrals_driver.cpp +++ b/src/scf/matrix_builder/scf_integrals_driver.cpp @@ -111,4 +111,4 @@ MODULE_RUN(SCFIntegralsDriver) { return pt::wrap_results(rv, std::move(t)); } -} // namespace scf::matrix_builder \ No newline at end of file +} // namespace scf::matrix_builder diff --git a/src/scf/tamm_scf.cpp b/src/scf/tamm_scf.cpp index e17c825..1269a7b 100644 --- a/src/scf/tamm_scf.cpp +++ b/src/scf/tamm_scf.cpp @@ -329,4 +329,4 @@ MODULE_RUN(TAMMEnergy) { } } // namespace scf -#endif \ No newline at end of file +#endif diff --git a/src/scf/update/diagonalization.cpp b/src/scf/update/diagonalization.cpp index 9beeaf3..db9a2ff 100644 --- a/src/scf/update/diagonalization.cpp +++ b/src/scf/update/diagonalization.cpp @@ -62,4 +62,4 @@ MODULE_RUN(Diagonalization) { return pt::wrap_results(rv, new_guess); } -} // namespace scf::update \ No newline at end of file +} // namespace scf::update diff --git a/src/scf/update/update.hpp b/src/scf/update/update.hpp index 20dceff..cb7277c 100644 --- a/src/scf/update/update.hpp +++ b/src/scf/update/update.hpp @@ -32,4 +32,4 @@ inline void set_defaults(pluginplay::ModuleManager& mm) { "Fock matrix builder"); } -} // namespace scf::update \ No newline at end of file +} // namespace scf::update diff --git a/src/scf/xc/gauxc/gauxc.cpp b/src/scf/xc/gauxc/gauxc.cpp index e39efce..e4fe9fc 100644 --- a/src/scf/xc/gauxc/gauxc.cpp +++ b/src/scf/xc/gauxc/gauxc.cpp @@ -54,4 +54,4 @@ void set_defaults(pluginplay::ModuleManager& mm) { "GauXC Quadrature Batches"); } -} // namespace scf::xc::gauxc \ No newline at end of file +} // namespace scf::xc::gauxc diff --git a/src/scf/xc/gauxc/gauxc.hpp b/src/scf/xc/gauxc/gauxc.hpp index 433e8cd..8dea516 100644 --- a/src/scf/xc/gauxc/gauxc.hpp +++ b/src/scf/xc/gauxc/gauxc.hpp @@ -38,4 +38,4 @@ DECLARE_MODULE(QuadratureBatches); void set_defaults(pluginplay::ModuleManager& mm); void load_modules(pluginplay::ModuleManager& mm); -} // namespace scf::xc::gauxc \ No newline at end of file +} // namespace scf::xc::gauxc diff --git a/src/scf/xc/gauxc/utilities.hpp b/src/scf/xc/gauxc/utilities.hpp index f686c90..9a28fa9 100644 --- a/src/scf/xc/gauxc/utilities.hpp +++ b/src/scf/xc/gauxc/utilities.hpp @@ -54,4 +54,4 @@ auto eigen_to_tw( return tensorwrapper::Tensor(std::move(shape), std::move(pbuffer)); } -} // namespace scf::xc::gauxc \ No newline at end of file +} // namespace scf::xc::gauxc diff --git a/src/scf/xc/gauxc/xc_energy.cpp b/src/scf/xc/gauxc/xc_energy.cpp index 792e4f4..f089a76 100644 --- a/src/scf/xc/gauxc/xc_energy.cpp +++ b/src/scf/xc/gauxc/xc_energy.cpp @@ -52,4 +52,4 @@ MODULE_RUN(XCEnergy) { return pt::wrap_results(rv, exc); } -} // namespace scf::xc::gauxc \ No newline at end of file +} // namespace scf::xc::gauxc diff --git a/src/scf/xc/gauxc/xc_potential.cpp b/src/scf/xc/gauxc/xc_potential.cpp index 15199a1..8e8d64d 100644 --- a/src/scf/xc/gauxc/xc_potential.cpp +++ b/src/scf/xc/gauxc/xc_potential.cpp @@ -54,4 +54,4 @@ MODULE_RUN(XCPotential) { return pt::wrap_results(rv, vxc); } -} // namespace scf::xc::gauxc \ No newline at end of file +} // namespace scf::xc::gauxc diff --git a/tests/cxx/integration_tests/coulombs_law.cpp b/tests/cxx/integration_tests/coulombs_law.cpp index 46e3503..8fe56a4 100644 --- a/tests/cxx/integration_tests/coulombs_law.cpp +++ b/tests/cxx/integration_tests/coulombs_law.cpp @@ -40,4 +40,4 @@ TEMPLATE_LIST_TEST_CASE("CoulombsLaw", "", test_scf::float_types) { pcorr->set_elem({}, 0.71510297482837526); tensorwrapper::Tensor corr(shape_corr, std::move(pcorr)); REQUIRE(approximately_equal(corr, e_nuclear, 1E-6)); -} \ No newline at end of file +} diff --git a/tests/cxx/integration_tests/driver/scf_driver.cpp b/tests/cxx/integration_tests/driver/scf_driver.cpp index cf6e44b..50a6450 100644 --- a/tests/cxx/integration_tests/driver/scf_driver.cpp +++ b/tests/cxx/integration_tests/driver/scf_driver.cpp @@ -71,4 +71,4 @@ TEMPLATE_LIST_TEST_CASE("SCFDriver", "", test_scf::float_types) { simde::type::tensor corr(shape_corr, std::move(pcorr)); REQUIRE(approximately_equal(corr, e, 1E-6)); } -} \ No newline at end of file +} diff --git a/tests/cxx/integration_tests/driver/scf_loop.cpp b/tests/cxx/integration_tests/driver/scf_loop.cpp index a38d451..240dc64 100644 --- a/tests/cxx/integration_tests/driver/scf_loop.cpp +++ b/tests/cxx/integration_tests/driver/scf_loop.cpp @@ -83,4 +83,4 @@ TEMPLATE_LIST_TEST_CASE("SCFLoop", "", test_scf::float_types) { REQUIRE(approximately_equal(corr, e, 1E-6)); } } -} \ No newline at end of file +} diff --git a/tests/cxx/integration_tests/guess/core.cpp b/tests/cxx/integration_tests/guess/core.cpp index 7c12cf6..9faf9a9 100644 --- a/tests/cxx/integration_tests/guess/core.cpp +++ b/tests/cxx/integration_tests/guess/core.cpp @@ -41,4 +41,4 @@ TEMPLATE_LIST_TEST_CASE("Core", "", test_scf::float_types) { using tensorwrapper::operations::approximately_equal; REQUIRE(approximately_equal(corr, evals, 1E-6)); -} \ No newline at end of file +} diff --git a/tests/cxx/integration_tests/guess/sad.cpp b/tests/cxx/integration_tests/guess/sad.cpp index 41c1503..63ccaa5 100644 --- a/tests/cxx/integration_tests/guess/sad.cpp +++ b/tests/cxx/integration_tests/guess/sad.cpp @@ -50,4 +50,4 @@ TEMPLATE_LIST_TEST_CASE("SAD", "", test_scf::float_types) { REQUIRE(psi.orbital_indices() == occs); REQUIRE(psi.orbitals().from_space() == aos); REQUIRE(approximately_equal(corr, evals, 1E-6)); -} \ No newline at end of file +} diff --git a/tests/cxx/integration_tests/integration_tests.hpp b/tests/cxx/integration_tests/integration_tests.hpp index d5c9930..a4a1efe 100644 --- a/tests/cxx/integration_tests/integration_tests.hpp +++ b/tests/cxx/integration_tests/integration_tests.hpp @@ -61,4 +61,4 @@ pluginplay::ModuleManager load_modules() { return mm; } -} // namespace test_scf \ No newline at end of file +} // namespace test_scf diff --git a/tests/cxx/integration_tests/matrix_builder/determinant_driver.cpp b/tests/cxx/integration_tests/matrix_builder/determinant_driver.cpp index 7768d78..a89c460 100644 --- a/tests/cxx/integration_tests/matrix_builder/determinant_driver.cpp +++ b/tests/cxx/integration_tests/matrix_builder/determinant_driver.cpp @@ -88,4 +88,4 @@ TEMPLATE_LIST_TEST_CASE("DeterminantDriver", "", test_scf::float_types) { tensorwrapper::Tensor corr(shape_corr, std::move(pcorr)); REQUIRE(approximately_equal(corr, K, 1E-6)); } -} \ No newline at end of file +} diff --git a/tests/cxx/integration_tests/matrix_builder/electronic_energy.cpp b/tests/cxx/integration_tests/matrix_builder/electronic_energy.cpp index 364044b..82de8b0 100644 --- a/tests/cxx/integration_tests/matrix_builder/electronic_energy.cpp +++ b/tests/cxx/integration_tests/matrix_builder/electronic_energy.cpp @@ -68,4 +68,4 @@ TEMPLATE_LIST_TEST_CASE("ElectronicEnergy", "", test_scf::float_types) { REQUIRE(approximately_equal(corr, E_elec, 1E-5)); } } -} \ No newline at end of file +} diff --git a/tests/cxx/integration_tests/matrix_builder/scf_integrals_driver.cpp b/tests/cxx/integration_tests/matrix_builder/scf_integrals_driver.cpp index 7bbc767..dd12e3e 100644 --- a/tests/cxx/integration_tests/matrix_builder/scf_integrals_driver.cpp +++ b/tests/cxx/integration_tests/matrix_builder/scf_integrals_driver.cpp @@ -108,4 +108,4 @@ TEMPLATE_LIST_TEST_CASE("SCFIntegralsDriver", "", test_scf::float_types) { simde::type::tensor corr{{-0.357302, -0.23347}, {-0.23347, -0.357302}}; REQUIRE(approximately_equal(vxc, corr, 1E-5)); } -} \ No newline at end of file +} diff --git a/tests/cxx/integration_tests/update/diagonalization.cpp b/tests/cxx/integration_tests/update/diagonalization.cpp index 7a10d3f..cd50f23 100644 --- a/tests/cxx/integration_tests/update/diagonalization.cpp +++ b/tests/cxx/integration_tests/update/diagonalization.cpp @@ -56,4 +56,4 @@ TEMPLATE_LIST_TEST_CASE("Diagaonalization", "", test_scf::float_types) { using tensorwrapper::operations::approximately_equal; REQUIRE(approximately_equal(evals, corr, 1E-6)); } -} \ No newline at end of file +} diff --git a/tests/cxx/test_scf.hpp b/tests/cxx/test_scf.hpp index 508c5d4..a56a0f4 100644 --- a/tests/cxx/test_scf.hpp +++ b/tests/cxx/test_scf.hpp @@ -269,4 +269,4 @@ inline auto h2_fock() { return F; } -} // namespace test_scf \ No newline at end of file +} // namespace test_scf diff --git a/tests/cxx/unit_tests/coulombs_law.cpp b/tests/cxx/unit_tests/coulombs_law.cpp index fe75251..d7ad445 100644 --- a/tests/cxx/unit_tests/coulombs_law.cpp +++ b/tests/cxx/unit_tests/coulombs_law.cpp @@ -70,4 +70,4 @@ TEST_CASE("CoulombsLaw") { tensorwrapper::Tensor corr(shape_corr, std::move(pcorr)); REQUIRE(approximately_equal(corr, e, 1E-6)); } -} \ No newline at end of file +} diff --git a/tests/cxx/unit_tests/eigen_solver/eigen_generalized.cpp b/tests/cxx/unit_tests/eigen_solver/eigen_generalized.cpp index 4281693..9880f72 100644 --- a/tests/cxx/unit_tests/eigen_solver/eigen_generalized.cpp +++ b/tests/cxx/unit_tests/eigen_solver/eigen_generalized.cpp @@ -52,4 +52,4 @@ TEMPLATE_LIST_TEST_CASE("EigenGeneralized", "", test_scf::float_types) { simde::type::tensor corr(corr_shape, std::move(corr_buffer)); REQUIRE(tensorwrapper::operations::approximately_equal(corr, values, 1E-6)); -} \ No newline at end of file +} diff --git a/tests/cxx/unit_tests/fock_operator/restricted.cpp b/tests/cxx/unit_tests/fock_operator/restricted.cpp index 45cdcf1..45bd920 100644 --- a/tests/cxx/unit_tests/fock_operator/restricted.cpp +++ b/tests/cxx/unit_tests/fock_operator/restricted.cpp @@ -71,4 +71,4 @@ TEMPLATE_LIST_TEST_CASE("Restricted", "", test_scf::float_types) { REQUIRE(f == f_corr); } } -} \ No newline at end of file +} diff --git a/tests/cxx/unit_tests/matrix_builder/density_matrix.cpp b/tests/cxx/unit_tests/matrix_builder/density_matrix.cpp index 1b5b558..27262d2 100644 --- a/tests/cxx/unit_tests/matrix_builder/density_matrix.cpp +++ b/tests/cxx/unit_tests/matrix_builder/density_matrix.cpp @@ -38,4 +38,4 @@ TEMPLATE_LIST_TEST_CASE("Density Matrix Builder", "", test_scf::float_types) { using tensorwrapper::operations::approximately_equal; REQUIRE(approximately_equal(P, corr, 1E-6)); -} \ No newline at end of file +} diff --git a/tests/cxx/unit_tests/xc/gauxc/basis_conversion.cpp b/tests/cxx/unit_tests/xc/gauxc/basis_conversion.cpp index 05dfc28..585cdeb 100644 --- a/tests/cxx/unit_tests/xc/gauxc/basis_conversion.cpp +++ b/tests/cxx/unit_tests/xc/gauxc/basis_conversion.cpp @@ -46,4 +46,4 @@ TEST_CASE("BasisConversion") { REQUIRE(rv.nshells() == 2); REQUIRE(rv.max_l() == 0); } -} \ No newline at end of file +} diff --git a/tests/cxx/unit_tests/xc/gauxc/molecule_conversion.cpp b/tests/cxx/unit_tests/xc/gauxc/molecule_conversion.cpp index 9d5c723..a64d31c 100644 --- a/tests/cxx/unit_tests/xc/gauxc/molecule_conversion.cpp +++ b/tests/cxx/unit_tests/xc/gauxc/molecule_conversion.cpp @@ -44,4 +44,4 @@ TEST_CASE("MoleculeConversion") { REQUIRE(rv.natoms() == 2); REQUIRE(rv.maxZ() == 1); } -} \ No newline at end of file +} diff --git a/tests/cxx/unit_tests/xc/gauxc/snlink.cpp b/tests/cxx/unit_tests/xc/gauxc/snlink.cpp index c3b59fd..22bc967 100644 --- a/tests/cxx/unit_tests/xc/gauxc/snlink.cpp +++ b/tests/cxx/unit_tests/xc/gauxc/snlink.cpp @@ -36,4 +36,4 @@ TEST_CASE("snLinK") { {{0.627264, 0.561828}, {0.561828, 0.627264}}); REQUIRE(approximately_equal(K, corr_k, 1E-5)); } -} \ No newline at end of file +} diff --git a/tests/cxx/unit_tests/xc/gauxc/xc_energy.cpp b/tests/cxx/unit_tests/xc/gauxc/xc_energy.cpp index a6a3378..93b2104 100644 --- a/tests/cxx/unit_tests/xc/gauxc/xc_energy.cpp +++ b/tests/cxx/unit_tests/xc/gauxc/xc_energy.cpp @@ -59,4 +59,4 @@ TEST_CASE("XCEnergy") { simde::type::tensor corr(-0.819986); REQUIRE(approximately_equal(exc, corr, 1E-5)); } -} \ No newline at end of file +} diff --git a/tests/cxx/unit_tests/xc/gauxc/xc_potential.cpp b/tests/cxx/unit_tests/xc/gauxc/xc_potential.cpp index 6aa0bde..7c23235 100644 --- a/tests/cxx/unit_tests/xc/gauxc/xc_potential.cpp +++ b/tests/cxx/unit_tests/xc/gauxc/xc_potential.cpp @@ -57,4 +57,4 @@ TEST_CASE("XCPotential") { simde::type::tensor corr(shape_corr, std::move(pcorr)); REQUIRE(approximately_equal(vxc, corr, 1E-5)); } -} \ No newline at end of file +} diff --git a/tests/python/integration_tests/driver/test_scf_driver.py b/tests/python/integration_tests/driver/test_scf_driver.py index f7781e6..ff9b201 100644 --- a/tests/python/integration_tests/driver/test_scf_driver.py +++ b/tests/python/integration_tests/driver/test_scf_driver.py @@ -12,18 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +import unittest + +import chemist +import numpy as np import nux -import simde +import nwchemex as nwx import parallelzone as pz -import chemist import pluginplay as pp -import nwchemex as nwx -import numpy as np -import unittest +import simde class TestSCFDriver(unittest.TestCase): - def test_scf_driver(self): self.mm.change_input("Loop", "DIIS", False) egy = self.mm.run_as(self.ao_energy, "SCF Driver", self.aos, self.sys) @@ -40,12 +40,15 @@ def setUp(self): nwx.load_modules(self.mm) # Set Submods - self.mm.change_submod("SCF Driver", "Hamiltonian", - "Born-Oppenheimer Approximation") - self.mm.change_submod("SCF integral driver", "Fundamental matrices", - "AO integral driver") - self.mm.change_submod("Diagonalization Fock update", - "Overlap matrix builder", "Overlap") + self.mm.change_submod( + "SCF Driver", "Hamiltonian", "Born-Oppenheimer Approximation" + ) + self.mm.change_submod( + "SCF integral driver", "Fundamental matrices", "AO integral driver" + ) + self.mm.change_submod( + "Diagonalization Fock update", "Overlap matrix builder", "Overlap" + ) self.mm.change_submod("Loop", "Overlap matrix builder", "Overlap") # Property Types @@ -55,5 +58,5 @@ def setUp(self): # Inputs self.water = self.mm.at("NWX Molecules").run_as(self.mol, "water") - self.aos = self.mm.at('STO-3G').run_as(self.basis_set, self.water) + self.aos = self.mm.at("STO-3G").run_as(self.basis_set, self.water) self.sys = chemist.ChemicalSystem(self.water) diff --git a/tests/python/integration_tests/run_integration_tests.py b/tests/python/integration_tests/run_integration_tests.py index 3889763..08322fa 100644 --- a/tests/python/integration_tests/run_integration_tests.py +++ b/tests/python/integration_tests/run_integration_tests.py @@ -11,12 +11,13 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import scf -import sys import os +import sys import unittest -if __name__ == '__main__': +import scf + +if __name__ == "__main__": rv = scf.initialize(sys.argv) my_dir = os.path.dirname(os.path.realpath(__file__)) @@ -28,4 +29,4 @@ scf.finalize() - sys.exit(ret) \ No newline at end of file + sys.exit(ret) diff --git a/tests/python/integration_tests/test_tamm_scf.py b/tests/python/integration_tests/test_tamm_scf.py index e7f5230..6a855d8 100755 --- a/tests/python/integration_tests/test_tamm_scf.py +++ b/tests/python/integration_tests/test_tamm_scf.py @@ -12,37 +12,39 @@ # See the License for the specific language governing permissions and # limitations under the License. -from pluginplay import ModuleManager -import scf -from simde import AOEnergy, MoleculeFromString, MolecularBasisSet +import unittest + import nwchemex from chemist import ChemicalSystem -import unittest +from pluginplay import ModuleManager +from simde import AOEnergy, MolecularBasisSet, MoleculeFromString + +import scf class TestTAMMSCF(unittest.TestCase): - def test_4cHF(self): if self.has_TAMM: - self.mm.change_input(self.key, 'molecule_name', 'water') + self.mm.change_input(self.key, "molecule_name", "water") egy = self.mm.run_as(AOEnergy(), self.key, self.aos, self.cs) self.assertAlmostEqual(egy, -74.3670617803483, places=6) def test_dft(self): if self.has_TAMM: - self.mm.change_input(self.key, 'xc_type', ["pbe0"]) - self.mm.change_input(self.key, 'molecule_name', 'water') + self.mm.change_input(self.key, "xc_type", ["pbe0"]) + self.mm.change_input(self.key, "molecule_name", "water") egy = self.mm.run_as(AOEnergy(), self.key, self.aos, self.cs) self.assertAlmostEqual(egy, -74.81168986385825, places=6) def setUp(self): self.mm = ModuleManager() scf.load_modules(self.mm) - self.key = 'SCF Energy via TAMM' + self.key = "SCF Energy via TAMM" self.has_TAMM = self.mm.count(self.key) != 0 if self.has_TAMM: nwchemex.load_modules(self.mm) - mol = self.mm.run_as(MoleculeFromString(), "NWX Molecules", - "water") - self.aos = self.mm.run_as(MolecularBasisSet(), 'sto-3g', mol) + mol = self.mm.run_as( + MoleculeFromString(), "NWX Molecules", "water" + ) + self.aos = self.mm.run_as(MolecularBasisSet(), "sto-3g", mol) self.cs = ChemicalSystem(mol) diff --git a/tests/python/unit_tests/eigen_solver/test_eigen_generalized.py b/tests/python/unit_tests/eigen_solver/test_eigen_generalized.py index a992b63..6b3c2fc 100644 --- a/tests/python/unit_tests/eigen_solver/test_eigen_generalized.py +++ b/tests/python/unit_tests/eigen_solver/test_eigen_generalized.py @@ -13,16 +13,17 @@ # limitations under the License. import unittest -import pluginplay as pp + +import numpy as np import parallelzone as pz -import scf +import pluginplay as pp import simde import tensorwrapper as tw -import numpy as np + +import scf class TestEigenGeneralized(unittest.TestCase): - def test_eigen_generalized(self): # Property Type pt = simde.GeneralizedEigenSolve() diff --git a/tests/python/unit_tests/run_unit_tests.py b/tests/python/unit_tests/run_unit_tests.py index 3889763..08322fa 100644 --- a/tests/python/unit_tests/run_unit_tests.py +++ b/tests/python/unit_tests/run_unit_tests.py @@ -11,12 +11,13 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import scf -import sys import os +import sys import unittest -if __name__ == '__main__': +import scf + +if __name__ == "__main__": rv = scf.initialize(sys.argv) my_dir = os.path.dirname(os.path.realpath(__file__)) @@ -28,4 +29,4 @@ scf.finalize() - sys.exit(ret) \ No newline at end of file + sys.exit(ret) diff --git a/uncertainty/eigen_generalized.py b/uncertainty/eigen_generalized.py index 2f02b49..5d3e560 100644 --- a/uncertainty/eigen_generalized.py +++ b/uncertainty/eigen_generalized.py @@ -13,14 +13,13 @@ # limitations under the License. import numpy as np -from pluginplay import ModuleManager from nwchemex import load_modules +from pluginplay import ModuleManager from simde import GeneralizedEigenSolve from tensorwrapper import Tensor class GeneralizedEigenSolverTester: - def __init__(self): self.mm = ModuleManager() load_modules(self.mm) @@ -35,7 +34,8 @@ def solve_gen_eigenproblem(self, A, B, verify=True): # Solve λ, V = map( np.array, - self.solver.run_as(GeneralizedEigenSolve(), A_tensor, B_tensor)) + self.solver.run_as(GeneralizedEigenSolve(), A_tensor, B_tensor), + ) if verify: max_residual = self._verify_results(A, B, λ, V) @@ -51,16 +51,16 @@ def _verify_results(self, A, B, λ, V, rtol=1e-8): max_residual = max(max_residual, np.linalg.norm(res)) return max_residual - def analyze_uncertainty(self, - num_trials=100, - matrix_size=5, - noise_level=1e-10): + def analyze_uncertainty( + self, num_trials=100, matrix_size=5, noise_level=1e-10 + ): """ - Analyze numerical uncertainty in generalized eigensolve by testing pertubed matricies + Analyze numerical uncertainty in generalized eigensolve by testing + pertubed matricies Args: num_trials = Number of random matricies to test - matrix_size = Size of the random matricies + matrix_size = Size of the random matricies noise_level: Magnitude of pertubations to add """ @@ -68,7 +68,7 @@ def analyze_uncertainty(self, eigenvector_errors = [] for _ in range(num_trials): - #Generate random symmetric matrices + # Generate random symmetric matrices A = np.random.rand(matrix_size, matrix_size) A = (A + A.T) / 2 B = np.eye(matrix_size) @@ -80,11 +80,14 @@ def analyze_uncertainty(self, λ_p, V_p = self.solve_gen_eigenproblem(A_perturbed, B, False) eigenvalue_errors.append(np.abs(λ - λ_p)) - eigenvector_errors.append([ - np.linalg.norm(V[:, i] - V_p[:, i]) for i in range(matrix_size) - ]) - - #results + eigenvector_errors.append( + [ + np.linalg.norm(V[:, i] - V_p[:, i]) + for i in range(matrix_size) + ] + ) + + # results print("\n=== Uncertainty Analysis ===") print( f"Tested {num_trials} random {matrix_size}*{matrix_size} matricies" @@ -114,9 +117,9 @@ def run_standard_example(self): def main(): tester = GeneralizedEigenSolverTester() - tester.analyze_uncertainty(num_trials=100, - matrix_size=5, - noise_level=1e-10) + tester.analyze_uncertainty( + num_trials=100, matrix_size=5, noise_level=1e-10 + ) print("\n=== Standard Example ===") tester.run_standard_example()