From f14f28da90507a13223ee7eae242562bc8074f1f Mon Sep 17 00:00:00 2001 From: Stig Rune Jensen Date: Wed, 17 Jan 2024 10:33:37 +0100 Subject: [PATCH 1/4] Copy .readthedocs.yml from master --- .readthedocs.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .readthedocs.yml diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 000000000..65337119d --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,17 @@ +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3.9" + +sphinx: + configuration: doc/conf.py + +formats: + - htmlzip + - pdf + +python: + install: + - requirements: doc/requirements.txt From cabafe06690cbea5fc4d7887c162689f2f57555e Mon Sep 17 00:00:00 2001 From: Stig Rune Jensen Date: Tue, 16 Jan 2024 15:37:25 +0100 Subject: [PATCH 2/4] Bugfix: critical sign error in magnetic properties --- src/qmoperators/QMDerivative.cpp | 6 ++---- src/qmoperators/one_electron/MomentumOperator.h | 15 +++++++-------- src/qmoperators/one_electron/NablaOperator.h | 8 ++++---- src/scf_solver/HelmholtzVector.cpp | 2 +- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/qmoperators/QMDerivative.cpp b/src/qmoperators/QMDerivative.cpp index f2d0b935e..8090518f7 100644 --- a/src/qmoperators/QMDerivative.cpp +++ b/src/qmoperators/QMDerivative.cpp @@ -79,12 +79,11 @@ Orbital QMDerivative::apply(Orbital inp) { if (inp.hasImag()) { out.alloc(NUMBER::Real); mrcpp::apply(out.real(), D, inp.imag(), dir); - if (inp.conjugate()) out.real().rescale(-1.0); + if (!inp.conjugate()) out.real().rescale(-1.0); } if (inp.hasReal()) { out.alloc(NUMBER::Imag); mrcpp::apply(out.imag(), D, inp.real(), dir); - out.imag().rescale(-1.0); } } return out; @@ -121,12 +120,11 @@ QMOperatorVector QMDerivative::apply(QMOperator_p &O) { if (V_inp->hasImag()) { V_out->alloc(NUMBER::Real); mrcpp::apply(V_out->real(), D, V_inp->imag(), d); - if (V_inp->conjugate()) V_out->real().rescale(-1.0); + if (!V_inp->conjugate()) V_out->real().rescale(-1.0); } if (V_inp->hasReal()) { V_out->alloc(NUMBER::Imag); mrcpp::apply(V_out->imag(), D, V_inp->real(), d); - V_out->imag().rescale(-1.0); } } out.push_back(V_out); diff --git a/src/qmoperators/one_electron/MomentumOperator.h b/src/qmoperators/one_electron/MomentumOperator.h index f14717718..b45ae0ad4 100644 --- a/src/qmoperators/one_electron/MomentumOperator.h +++ b/src/qmoperators/one_electron/MomentumOperator.h @@ -27,22 +27,21 @@ #include "tensor/RankOneOperator.h" -#include "qmoperators/QMDerivative.h" +#include "qmoperators/one_electron/NablaOperator.h" namespace mrchem { class MomentumOperator final : public RankOneOperator<3> { public: - MomentumOperator(std::shared_ptr> D) { - auto p_x = std::make_shared(0, D, true); - auto p_y = std::make_shared(1, D, true); - auto p_z = std::make_shared(2, D, true); + MomentumOperator(std::shared_ptr> D) + : MomentumOperator(NablaOperator(D, true)) {} + MomentumOperator(NablaOperator D) { // Invoke operator= to assign *this operator RankOneOperator<3> &p = (*this); - p[0] = p_x; - p[1] = p_y; - p[2] = p_z; + p[0] = -1.0*D[0]; + p[1] = -1.0*D[1]; + p[2] = -1.0*D[2]; p[0].name() = "p[x]"; p[1].name() = "p[y]"; p[2].name() = "p[z]"; diff --git a/src/qmoperators/one_electron/NablaOperator.h b/src/qmoperators/one_electron/NablaOperator.h index 9b272c32d..a58db1ab8 100644 --- a/src/qmoperators/one_electron/NablaOperator.h +++ b/src/qmoperators/one_electron/NablaOperator.h @@ -33,10 +33,10 @@ namespace mrchem { class NablaOperator final : public RankOneOperator<3> { public: - NablaOperator(std::shared_ptr> D) { - auto d_x = std::make_shared(0, D); - auto d_y = std::make_shared(1, D); - auto d_z = std::make_shared(2, D); + NablaOperator(std::shared_ptr> D, bool imag = false) { + auto d_x = std::make_shared(0, D, imag); + auto d_y = std::make_shared(1, D, imag); + auto d_z = std::make_shared(2, D, imag); // Invoke operator= to assign *this operator RankOneOperator<3> &d = (*this); diff --git a/src/scf_solver/HelmholtzVector.cpp b/src/scf_solver/HelmholtzVector.cpp index b5c487873..228f4ec46 100644 --- a/src/scf_solver/HelmholtzVector.cpp +++ b/src/scf_solver/HelmholtzVector.cpp @@ -155,7 +155,7 @@ Orbital HelmholtzVector::apply(int i, Orbital &phi) const { if (phi.hasImag()) { out.alloc(NUMBER::Imag); mrcpp::apply(this->prec, out.imag(), H, phi.imag(), -1, true); // Absolute prec - double sign = (phi.conjugate()) ? -1.0 : 1.0; + double sign = (phi.conjugate()) ? 1.0 : -1.0; out.imag().rescale(sign / (2.0 * mrcpp::pi)); } return out; From 4bbbf5077f0efd8d986ee6077934640be72192ae Mon Sep 17 00:00:00 2001 From: Stig Rune Jensen Date: Tue, 16 Jan 2024 16:41:39 +0100 Subject: [PATCH 3/4] Add test for magnetic properties --- tests/CMakeLists.txt | 1 + tests/h2_mag_lda/CMakeLists.txt | 11 + tests/h2_mag_lda/h2.inp | 42 ++ tests/h2_mag_lda/initial_guess/mrchem.bas | 12 + tests/h2_mag_lda/initial_guess/mrchem.moa | 101 ++++ tests/h2_mag_lda/initial_guess/mrchem.mob | 101 ++++ tests/h2_mag_lda/reference/h2.json | 576 ++++++++++++++++++++++ tests/h2_mag_lda/reference/h2.out | 409 +++++++++++++++ tests/h2_mag_lda/test | 28 ++ tests/tester.py | 7 + 10 files changed, 1288 insertions(+) create mode 100644 tests/h2_mag_lda/CMakeLists.txt create mode 100644 tests/h2_mag_lda/h2.inp create mode 100644 tests/h2_mag_lda/initial_guess/mrchem.bas create mode 100644 tests/h2_mag_lda/initial_guess/mrchem.moa create mode 100644 tests/h2_mag_lda/initial_guess/mrchem.mob create mode 100644 tests/h2_mag_lda/reference/h2.json create mode 100644 tests/h2_mag_lda/reference/h2.out create mode 100755 tests/h2_mag_lda/test diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c529b1a8b..5b6043fdb 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -21,6 +21,7 @@ target_link_libraries(mrchem-tests add_subdirectory(h_el_field) add_subdirectory(h2_scf_hf) add_subdirectory(h2_pol_lda) +add_subdirectory(h2_mag_lda) add_subdirectory(h2o_energy_blyp) add_subdirectory(li_scf_pbe0) add_subdirectory(li_pol_lda) diff --git a/tests/h2_mag_lda/CMakeLists.txt b/tests/h2_mag_lda/CMakeLists.txt new file mode 100644 index 000000000..7e3f5df51 --- /dev/null +++ b/tests/h2_mag_lda/CMakeLists.txt @@ -0,0 +1,11 @@ +if(ENABLE_MPI) + set(_h2_mag_lda_launcher "${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1") +endif() + +add_integration_test( + NAME "H2_magnetic_properties_LDA" + LABELS "H2_magnetic_properties_LDA;magnetizability;nmr;mrchem;h2_mag_lda" + COST 100 + LAUNCH_AGENT ${_h2_mag_lda_launcher} + INITIAL_GUESS ${CMAKE_CURRENT_LIST_DIR}/initial_guess + ) diff --git a/tests/h2_mag_lda/h2.inp b/tests/h2_mag_lda/h2.inp new file mode 100644 index 000000000..e4389d90e --- /dev/null +++ b/tests/h2_mag_lda/h2.inp @@ -0,0 +1,42 @@ +{ + "world_prec": 0.001, + "world_size": 5, + "world_unit": "angstrom", + "MPI": { + "numerically_exact": true + }, + "Molecule": { + "coords": "H 0.0000 0.0000 -0.3705\nH 0.0000 0.0000 0.3705\n" + }, + "WaveFunction": { + "method": "DFT", + "restricted": false + }, + "DFT": { + "functionals": "LDA\n" + }, + "Properties": { + "magnetizability": true, + "nmr_shielding": true + }, + "NMRShielding": { + "nuclear_specific": false, + "nucleus_k": [ + 0 + ] + }, + "SCF": { + "run": false, + "guess_type": "GTO" + }, + "Response": { + "kain": 3, + "max_iter": 10, + "orbital_thrs": 0.01, + "run": [ + true, + false, + false + ] + } +} diff --git a/tests/h2_mag_lda/initial_guess/mrchem.bas b/tests/h2_mag_lda/initial_guess/mrchem.bas new file mode 100644 index 000000000..2b07b1622 --- /dev/null +++ b/tests/h2_mag_lda/initial_guess/mrchem.bas @@ -0,0 +1,12 @@ +Gaussian basis cc-pVDZ + 1 + 1. 2 2 1 1 +H 0.0000000000 0.0000000000 -0.7000000000 +H 0.0000000000 0.0000000000 0.7000000000 + 4 2 + 13.0100000 0.01968500 0.00000000 + 1.9620000 0.13797700 0.00000000 + 0.4446000 0.47814800 0.00000000 + 0.1220000 0.50124000 1.00000000 + 1 1 + 0.7270000 1.00000000 diff --git a/tests/h2_mag_lda/initial_guess/mrchem.moa b/tests/h2_mag_lda/initial_guess/mrchem.moa new file mode 100644 index 000000000..fbc685ea2 --- /dev/null +++ b/tests/h2_mag_lda/initial_guess/mrchem.moa @@ -0,0 +1,101 @@ + 10 + 0.679818844859533 + -0.160895416296538 + -0.000000000000000 + 0.000000000000000 + 0.017200409670392 + 0.679805451164590 + -0.160897270288160 + 0.000000000000000 + -0.000000000000000 + -0.017201747283775 + 0.394259467128243 + 1.587077397076630 + 0.000000000000000 + -0.000000000000000 + -0.022389357994487 + -0.394263910524846 + -1.587077979012975 + 0.000000000000000 + 0.000000000000000 + -0.022387397572700 + 1.187321376637329 + -1.316250637902104 + 0.000000000000000 + 0.000000000000000 + 0.022694692771659 + 1.187304649593490 + -1.316224276109744 + 0.000000000000000 + 0.000000000000000 + -0.022696339380126 + 1.376073054086166 + -2.492342381832811 + 0.000000000000000 + 0.000000000000000 + -0.358858997767801 + -1.376084250923773 + 2.492352716677140 + 0.000000000000000 + 0.000000000000000 + -0.358855133999848 + 0.000000000000000 + -0.000000000000001 + 0.154953780296779 + -0.558091716418119 + 0.000000000000000 + -0.000000000000000 + 0.000000000000001 + 0.154951569196481 + -0.558083752774001 + -0.000000000000000 + 0.000000000000002 + -0.000000000000002 + -0.558091716418118 + -0.154953780296779 + -0.000000000000000 + -0.000000000000001 + 0.000000000000001 + -0.558083752774003 + -0.154951569196481 + 0.000000000000000 + -0.768175736191248 + 0.618306842395530 + 0.000000000000002 + -0.000000000000000 + 0.726245917411092 + -0.768198542983742 + 0.618322374960124 + -0.000000000000002 + 0.000000000000001 + -0.726240941243852 + -0.000000000000001 + 0.000000000000001 + 0.197139927993266 + 0.970753591501604 + -0.000000000000000 + 0.000000000000001 + -0.000000000000000 + -0.197140889760886 + -0.970758327423854 + -0.000000000000001 + 0.000000000000000 + -0.000000000000001 + 0.970753591501605 + -0.197139927993266 + -0.000000000000002 + 0.000000000000003 + -0.000000000000002 + -0.970758327423854 + 0.197140889760886 + 0.000000000000001 + -4.523132495077299 + 2.174458822653225 + -0.000000000000001 + -0.000000000000000 + -2.033927630281827 + 4.523131231784129 + -2.174457955524351 + 0.000000000000000 + 0.000000000000000 + -2.033930080692429 diff --git a/tests/h2_mag_lda/initial_guess/mrchem.mob b/tests/h2_mag_lda/initial_guess/mrchem.mob new file mode 100644 index 000000000..3303d1f75 --- /dev/null +++ b/tests/h2_mag_lda/initial_guess/mrchem.mob @@ -0,0 +1,101 @@ + 10 + 0.679818844859533 + -0.160895416296539 + -0.000000000000000 + 0.000000000000000 + 0.017200409670392 + 0.679805451164589 + -0.160897270288158 + 0.000000000000000 + -0.000000000000000 + -0.017201747283775 + 0.394259467128246 + 1.587077397076628 + 0.000000000000000 + -0.000000000000000 + -0.022389357994487 + -0.394263910524851 + -1.587077979012969 + 0.000000000000000 + -0.000000000000000 + -0.022387397572699 + -1.187321376637334 + 1.316250637902108 + 0.000000000000000 + -0.000000000000000 + -0.022694692771660 + -1.187304649593484 + 1.316224276109738 + 0.000000000000000 + 0.000000000000000 + 0.022696339380125 + -1.376073054086158 + 2.492342381832807 + -0.000000000000000 + -0.000000000000000 + 0.358858997767803 + 1.376084250923769 + -2.492352716677142 + -0.000000000000000 + -0.000000000000000 + 0.358855133999850 + 0.000000000000001 + -0.000000000000001 + -0.574216174284626 + -0.075847367473843 + -0.000000000000000 + -0.000000000000001 + 0.000000000000001 + -0.574207980553876 + -0.075846285176034 + 0.000000000000000 + -0.000000000000001 + 0.000000000000002 + -0.075847367473843 + 0.574216174284625 + -0.000000000000000 + 0.000000000000000 + -0.000000000000002 + -0.075846285176034 + 0.574207980553877 + 0.000000000000000 + -0.768175736191250 + 0.618306842395533 + 0.000000000000000 + -0.000000000000002 + 0.726245917411091 + -0.768198542983740 + 0.618322374960122 + -0.000000000000001 + 0.000000000000002 + -0.726240941243852 + 0.000000000000001 + -0.000000000000002 + -0.332816873429361 + -0.932984252484017 + -0.000000000000001 + 0.000000000000001 + -0.000000000000000 + 0.332818497111055 + 0.932988804144622 + 0.000000000000001 + 0.000000000000000 + -0.000000000000001 + 0.932984252484016 + -0.332816873429361 + -0.000000000000001 + 0.000000000000002 + -0.000000000000001 + -0.932988804144622 + 0.332818497111055 + 0.000000000000000 + -4.523132495077297 + 2.174458822653227 + -0.000000000000000 + 0.000000000000000 + -2.033927630281826 + 4.523131231784130 + -2.174457955524355 + 0.000000000000000 + -0.000000000000000 + -2.033930080692428 diff --git a/tests/h2_mag_lda/reference/h2.json b/tests/h2_mag_lda/reference/h2.json new file mode 100644 index 000000000..d25ed8898 --- /dev/null +++ b/tests/h2_mag_lda/reference/h2.json @@ -0,0 +1,576 @@ +{ + "input": { + "constants": { + "angstrom2bohrs": 1.8897261246257702, + "dipmom_au2debye": 2.5417464739297717, + "electron_g_factor": -2.00231930436256, + "fine_structure_constant": 0.0072973525693, + "hartree2ev": 27.211386245988, + "hartree2kcalmol": 627.5094740630558, + "hartree2kjmol": 2625.4996394798254, + "hartree2simagnetizability": 78.9451185, + "hartree2wavenumbers": 219474.6313632, + "light_speed": 137.035999084 + }, + "molecule": { + "charge": 0, + "coords": [ + { + "atom": "h", + "r_rms": 2.6569547399e-05, + "xyz": [ + 0.0, + 0.0, + -0.7001435291738478 + ] + }, + { + "atom": "h", + "r_rms": 2.6569547399e-05, + "xyz": [ + 0.0, + 0.0, + 0.7001435291738478 + ] + } + ], + "multiplicity": 1 + }, + "mpi": { + "bank_size": -1, + "numerically_exact": true, + "shared_memory_size": 10000 + }, + "mra": { + "basis_order": 5, + "basis_type": "interpolating", + "boxes": [ + 2, + 2, + 2 + ], + "corner": [ + -1, + -1, + -1 + ], + "max_scale": 20, + "min_scale": -5 + }, + "printer": { + "file_name": "h2", + "print_constants": false, + "print_level": 0, + "print_mpi": false, + "print_prec": 6, + "print_width": 75 + }, + "rsp_calculations": { + "ext_mag-0.000000": { + "components": [ + { + "initial_guess": { + "file_CUBE_x_a": "cube_vectors/CUBE_x_a_0_vector.json", + "file_CUBE_x_b": "cube_vectors/CUBE_x_b_0_vector.json", + "file_CUBE_x_p": "cube_vectors/CUBE_x_p_0_vector.json", + "file_CUBE_y_a": "cube_vectors/CUBE_y_a_0_vector.json", + "file_CUBE_y_b": "cube_vectors/CUBE_y_b_0_vector.json", + "file_CUBE_y_p": "cube_vectors/CUBE_y_p_0_vector.json", + "file_chk_x": "checkpoint/X_rsp_0", + "file_chk_y": "checkpoint/Y_rsp_0", + "file_x_a": "initial_guess/X_a_rsp_0", + "file_x_b": "initial_guess/X_b_rsp_0", + "file_x_p": "initial_guess/X_p_rsp_0", + "file_y_a": "initial_guess/Y_a_rsp_0", + "file_y_b": "initial_guess/Y_b_rsp_0", + "file_y_p": "initial_guess/Y_p_rsp_0", + "prec": 0.001, + "type": "none" + }, + "rsp_solver": { + "checkpoint": false, + "file_chk_x": "checkpoint/X_rsp_0", + "file_chk_y": "checkpoint/Y_rsp_0", + "final_prec": 0.001, + "helmholtz_prec": -1.0, + "kain": 3, + "max_iter": 10, + "method": "DFT", + "orbital_thrs": 0.01, + "orth_prec": 1e-14, + "property_thrs": -1.0, + "start_prec": 0.001 + } + }, + { + "initial_guess": { + "file_CUBE_x_a": "cube_vectors/CUBE_x_a_1_vector.json", + "file_CUBE_x_b": "cube_vectors/CUBE_x_b_1_vector.json", + "file_CUBE_x_p": "cube_vectors/CUBE_x_p_1_vector.json", + "file_CUBE_y_a": "cube_vectors/CUBE_y_a_1_vector.json", + "file_CUBE_y_b": "cube_vectors/CUBE_y_b_1_vector.json", + "file_CUBE_y_p": "cube_vectors/CUBE_y_p_1_vector.json", + "file_chk_x": "checkpoint/X_rsp_1", + "file_chk_y": "checkpoint/Y_rsp_1", + "file_x_a": "initial_guess/X_a_rsp_1", + "file_x_b": "initial_guess/X_b_rsp_1", + "file_x_p": "initial_guess/X_p_rsp_1", + "file_y_a": "initial_guess/Y_a_rsp_1", + "file_y_b": "initial_guess/Y_b_rsp_1", + "file_y_p": "initial_guess/Y_p_rsp_1", + "prec": 0.001, + "type": "none" + } + }, + { + "initial_guess": { + "file_CUBE_x_a": "cube_vectors/CUBE_x_a_2_vector.json", + "file_CUBE_x_b": "cube_vectors/CUBE_x_b_2_vector.json", + "file_CUBE_x_p": "cube_vectors/CUBE_x_p_2_vector.json", + "file_CUBE_y_a": "cube_vectors/CUBE_y_a_2_vector.json", + "file_CUBE_y_b": "cube_vectors/CUBE_y_b_2_vector.json", + "file_CUBE_y_p": "cube_vectors/CUBE_y_p_2_vector.json", + "file_chk_x": "checkpoint/X_rsp_2", + "file_chk_y": "checkpoint/Y_rsp_2", + "file_x_a": "initial_guess/X_a_rsp_2", + "file_x_b": "initial_guess/X_b_rsp_2", + "file_x_p": "initial_guess/X_p_rsp_2", + "file_y_a": "initial_guess/Y_a_rsp_2", + "file_y_b": "initial_guess/Y_b_rsp_2", + "file_y_p": "initial_guess/Y_p_rsp_2", + "prec": 0.001, + "type": "none" + } + } + ], + "dynamic": false, + "fock_operator": { + "coulomb_operator": { + "poisson_prec": 0.001, + "shared_memory": false + }, + "exchange_operator": { + "exchange_prec": -1.0, + "poisson_prec": 0.001 + }, + "xc_operator": { + "shared_memory": false, + "xc_functional": { + "cutoff": 0.0, + "functionals": [ + { + "coef": 1.0, + "name": "lda" + } + ], + "spin": true + } + } + }, + "frequency": 0.0, + "perturbation": { + "derivative": "abgv_00", + "operator": "h_b_dip", + "r_O": [ + 0.0, + 0.0, + 0.0 + ] + }, + "properties": { + "magnetizability": { + "mag-0.000000": { + "derivative": "abgv_00", + "dia_operator": "h_bb_dia", + "frequency": 0.0, + "para_operator": "h_b_dip", + "precision": 0.001, + "r_O": [ + 0.0, + 0.0, + 0.0 + ] + } + }, + "nmr_shielding": { + "nmr-0h": { + "derivative": "abgv_00", + "dia_operator": "h_bm_dia", + "para_operator": "h_m_pso", + "precision": 0.001, + "r_K": [ + 0.0, + 0.0, + -0.7001435291738478 + ], + "r_O": [ + 0.0, + 0.0, + 0.0 + ], + "smoothing": 0.001 + } + } + }, + "unperturbed": { + "fock_operator": { + "coulomb_operator": { + "poisson_prec": 0.001, + "shared_memory": false + }, + "exchange_operator": { + "exchange_prec": -1.0, + "poisson_prec": 0.001 + }, + "kinetic_operator": { + "derivative": "abgv_55" + }, + "nuclear_operator": { + "nuclear_model": "point_like", + "proj_prec": 0.001, + "shared_memory": false, + "smooth_prec": 0.001 + }, + "xc_operator": { + "shared_memory": false, + "xc_functional": { + "cutoff": 0.0, + "functionals": [ + { + "coef": 1.0, + "name": "lda" + } + ], + "spin": true + } + } + }, + "localize": false, + "precision": 0.001 + } + } + }, + "scf_calculation": { + "fock_operator": { + "coulomb_operator": { + "poisson_prec": 0.001, + "shared_memory": false + }, + "exchange_operator": { + "exchange_prec": -1.0, + "poisson_prec": 0.001 + }, + "kinetic_operator": { + "derivative": "abgv_55" + }, + "nuclear_operator": { + "nuclear_model": "point_like", + "proj_prec": 0.001, + "shared_memory": false, + "smooth_prec": 0.001 + }, + "xc_operator": { + "shared_memory": false, + "xc_functional": { + "cutoff": 0.0, + "functionals": [ + { + "coef": 1.0, + "name": "lda" + } + ], + "spin": true + } + } + }, + "initial_guess": { + "environment": "None", + "external_field": "None", + "file_CUBE_a": "cube_vectors/CUBE_a_vector.json", + "file_CUBE_b": "cube_vectors/CUBE_b_vector.json", + "file_CUBE_p": "cube_vectors/CUBE_p_vector.json", + "file_basis": "initial_guess/mrchem.bas", + "file_chk": "checkpoint/phi_scf", + "file_gto_a": "initial_guess/mrchem.moa", + "file_gto_b": "initial_guess/mrchem.mob", + "file_gto_p": "initial_guess/mrchem.mop", + "file_phi_a": "initial_guess/phi_a_scf", + "file_phi_b": "initial_guess/phi_b_scf", + "file_phi_p": "initial_guess/phi_p_scf", + "localize": false, + "method": "DFT", + "prec": 0.001, + "relativity": "None", + "restricted": false, + "screen": 12.0, + "type": "gto", + "zeta": 0 + }, + "properties": { + "dipole_moment": { + "dip-1": { + "operator": "h_e_dip", + "precision": 0.001, + "r_O": [ + 0.0, + 0.0, + 0.0 + ] + } + } + } + }, + "schema_name": "mrchem_input", + "schema_version": 1 + }, + "output": { + "properties": { + "center_of_mass": [ + 0.0, + 0.0, + 0.0 + ], + "charge": 0, + "dipole_moment": { + "dip-1": { + "magnitude": 2.3125524128433424e-05, + "r_O": [ + 0.0, + 0.0, + 0.0 + ], + "vector": [ + 0.0, + 0.0, + 2.312552412843342e-05 + ], + "vector_el": [ + 0.0, + 0.0, + 2.3125524068259332e-05 + ], + "vector_nuc": [ + 0.0, + 0.0, + 0.0 + ] + } + }, + "geometry": [ + { + "symbol": "H", + "xyz": [ + 0.0, + 0.0, + -0.7001435291738478 + ] + }, + { + "symbol": "H", + "xyz": [ + 0.0, + 0.0, + 0.7001435291738478 + ] + } + ], + "magnetizability": { + "mag-0.000000": { + "frequency": 0.0, + "isotropic_average": null, + "r_O": [ + 0.0, + 0.0, + 0.0 + ], + "tensor": [ + -0.8858098671165622, + 0.0, + 0.0, + null, + null, + null, + null, + null, + null + ], + "tensor_dia": [ + -0.913111252055222, + 0.0, + 0.0, + 0.0, + -0.9131112520552314, + 0.0, + 0.0, + 0.0, + -0.7722102648042788 + ], + "tensor_para": [ + 0.0273013849386598, + 0.0, + 0.0, + null, + null, + null, + null, + null, + null + ] + } + }, + "multiplicity": 1, + "nmr_shielding": { + "nmr-0h": { + "anisotropy": null, + "diagonalized_tensor": [ + null, + null, + null + ], + "isotropic_average": null, + "r_K": [ + 0.0, + 0.0, + -0.7001435291738478 + ], + "r_O": [ + 0.0, + 0.0, + 0.0 + ], + "tensor": [ + 26.07747616835781, + 0.0, + 1.3677196201292798e-12, + null, + null, + null, + null, + null, + null + ], + "tensor_dia": [ + 25.527087632399677, + 0.0, + 0.0, + 0.0, + 25.52708763239979, + 0.0, + 0.0, + 0.0, + 26.74753488502477 + ], + "tensor_para": [ + 0.5503885359581321, + 0.0, + 1.418610741934619e-12, + null, + null, + null, + null, + null, + null + ] + } + }, + "orbital_energies": { + "energy": [ + -0.3452839682920535, + -0.34528396829205393 + ], + "occupation": [ + 1.0, + 1.0 + ], + "spin": [ + "a", + "b" + ], + "sum_occupied": -0.6905679365841074 + }, + "scf_energy": { + "E_ee": 1.328363917977608, + "E_eext": 0.0, + "E_el": -1.8186520280662704, + "E_en": -3.5666315558595887, + "E_kin": 1.0734860652323053, + "E_next": 0.0, + "E_nn": 0.7141392859689609, + "E_nuc": 0.7141392859689609, + "E_tot": -1.1045127420973095, + "E_x": 0.0, + "E_xc": -0.6538704554165949, + "Er_el": 0.0, + "Er_nuc": 0.0, + "Er_tot": 0.0 + } + }, + "provenance": { + "creator": "MRChem", + "mpi_processes": 1, + "nthreads": 8, + "routine": "mrchem.x", + "total_cores": 8, + "version": "1.2.0-alpha" + }, + "rsp_calculations": { + "ext_mag-0.000000": { + "components": [ + { + "rsp_solver": { + "converged": true, + "cycles": [ + { + "mo_residual": 0.08780898201504643, + "property_update": -0.020433596780801602, + "symmetric_property": -0.020433596780801602, + "wall_time": 1.80950626 + }, + { + "mo_residual": 0.02040507065870614, + "property_update": -0.006635248970956756, + "symmetric_property": -0.027068845751758358, + "wall_time": 2.602521863 + }, + { + "mo_residual": 0.0006574223357317515, + "property_update": -0.0002325391869014426, + "symmetric_property": -0.0273013849386598, + "wall_time": 2.454146546 + } + ], + "wall_time": 6.866252376 + } + }, + null, + null + ], + "frequency": 0.0, + "perturbation": "h_b_dip", + "success": false + } + }, + "scf_calculation": { + "initial_energy": { + "E_ee": 1.328363917977608, + "E_eext": 0.0, + "E_el": -1.8186520280662704, + "E_en": -3.5666315558595887, + "E_kin": 1.0734860652323053, + "E_next": 0.0, + "E_nn": 0.7141392859689609, + "E_nuc": 0.7141392859689609, + "E_tot": -1.1045127420973095, + "E_x": 0.0, + "E_xc": -0.6538704554165949, + "Er_el": 0.0, + "Er_nuc": 0.0, + "Er_tot": 0.0 + }, + "success": true + }, + "schema_name": "mrchem_output", + "schema_version": 1, + "success": false + } +} diff --git a/tests/h2_mag_lda/reference/h2.out b/tests/h2_mag_lda/reference/h2.out new file mode 100644 index 000000000..cbb774a46 --- /dev/null +++ b/tests/h2_mag_lda/reference/h2.out @@ -0,0 +1,409 @@ + + +*************************************************************************** +*** *** +*** *** +*** __ __ ____ ____ _ *** +*** | \/ | _ \ / ___| |__ ___ _ __ ___ *** +*** | |\/| | |_) | | | '_ \ / _ \ '_ ` _ \ *** +*** | | | | _ <| |___| | | | __/ | | | | | *** +*** |_| |_|_| \_\\____|_| |_|\___|_| |_| |_| *** +*** *** +*** VERSION 1.2.0-alpha *** +*** *** +*** Git branch fix/magnetic *** +*** Git commit hash 220bd385634b1c9c4f48-dirty *** +*** Git commit author Stig Rune Jensen *** +*** Git commit date Tue Jan 16 16:41:39 2024 +0100 *** +*** *** +*** Contact: luca.frediani@uit.no *** +*** *** +*** Radovan Bast Magnar Bjorgve *** +*** Roberto Di Remigio Antoine Durdek *** +*** Luca Frediani Gabriel Gerez *** +*** Stig Rune Jensen Jonas Juselius *** +*** Rune Monstad Peter Wind *** +*** *** +*************************************************************************** + +--------------------------------------------------------------------------- + + MPI processes : (no bank) 1 + OpenMP threads : 8 + Total cores : 8 + +--------------------------------------------------------------------------- + +XCFun DFT library Copyright 2009-2020 Ulf Ekstrom and contributors. +See http://dftlibs.org/xcfun/ for more information. + +This is free software; see the source code for copying conditions. +There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. For details see the documentation. +Scientific users of this library should cite +U. Ekstrom, L. Visscher, R. Bast, A. J. Thorvaldsen and K. Ruud; +J.Chem.Theor.Comp. 2010, DOI: 10.1021/ct100117s + +--------------------------------------------------------------------------- + + MRCPP version : 1.6.0-alpha + Git branch : HEAD + Git commit hash : f8def0a086da6410e5dd + Git commit author : Peter Wind + Git commit date : Sat Oct 21 13:32:25 2023 +0200 + + Linear algebra : EIGEN v3.4.0 + Parallelization : OpenMP (8 threads) + +--------------------------------------------------------------------------- + + + +=========================================================================== + MultiResolution Analysis +--------------------------------------------------------------------------- + polynomial order : 5 + polynomial type : Interpolating +--------------------------------------------------------------------------- + total boxes : 8 + boxes : [ 2 2 2 ] + unit lengths : [ 32.00000 32.00000 32.00000 ] + scaling factor : [ 1.00000 1.00000 1.00000 ] + lower bounds : [ -32.00000 -32.00000 -32.00000 ] + upper bounds : [ 32.00000 32.00000 32.00000 ] + total length : [ 64.00000 64.00000 64.00000 ] +=========================================================================== + + + +*************************************************************************** +*** *** +*** Initializing Molecule *** +*** *** +*************************************************************************** + + +=========================================================================== + Molecule +--------------------------------------------------------------------------- + Charge : 0 + Multiplicity : 1 +--------------------------------------------------------------------------- + N Atom : x y z +--------------------------------------------------------------------------- + 0 H : 0.000000 0.000000 -0.700144 + 1 H : 0.000000 0.000000 0.700144 +--------------------------------------------------------------------------- + Center of mass : 0.000000 0.000000 0.000000 +=========================================================================== + + + +*************************************************************************** +*** *** +*** Computing Initial Guess Wavefunction *** +*** *** +*************************************************************************** + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Calculation : Compute initial orbitals + Method : Project GTO molecular orbitals + Precision : 1.00000e-03 + Screening : 1.20000e+01 StdDev + Restricted : False + MO alpha file : initial_guess/mrchem.moa + MO beta file : initial_guess/mrchem.mob +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +=========================================================================== + Molecular Orbitals +--------------------------------------------------------------------------- + Alpha electrons : 1 + Beta electrons : 1 + Total electrons : 2 +--------------------------------------------------------------------------- + n Occ Spin : Norm +--------------------------------------------------------------------------- + 0 1 a : 9.999999041879e-01 + 1 1 b : 9.999999041879e-01 +=========================================================================== + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Calculation : Compute initial energy + Method : DFT + Relativity : None + Environment : None + External fields : None + Precision : 1.00000e-03 + Localization : Off +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +=========================================================================== + Molecular Energy (initial) +--------------------------------------------------------------------------- + Kinetic energy : (au) 1.073486065232 + E-N energy : (au) -3.566631555860 + Coulomb energy : (au) 1.328363917978 + Exchange energy : (au) 0.000000000000 + X-C energy : (au) -0.653870455417 + N-N energy : (au) 0.714139285969 +--------------------------------------------------------------------------- + Electronic energy : (au) -1.818652028066 + Nuclear energy : (au) 0.714139285969 +--------------------------------------------------------------------------- + Total energy : (au) -1.104512742097e+00 + : (kcal/mol) -6.930922098894e+02 + : (kJ/mol) -2.899897806177e+03 + : (eV) -3.005532283883e+01 +=========================================================================== + + +=========================================================================== + Orbital Energies (initial) +--------------------------------------------------------------------------- + n Occ Spin : Epsilon +--------------------------------------------------------------------------- + 0 1 a : (au) -0.345283968292 + 1 1 b : (au) -0.345283968292 +--------------------------------------------------------------------------- + Sum occupied : (au) -0.690567936584 +=========================================================================== + + + +*************************************************************************** +*** *** +*** Computing Linear Response Wavefunction *** +*** *** +*************************************************************************** + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Calculation : Compute initial orbitals + Method : Zero guess +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +=========================================================================== + Molecular Orbitals +--------------------------------------------------------------------------- + Alpha electrons : 1 + Beta electrons : 1 + Total electrons : 2 +--------------------------------------------------------------------------- + n Occ Spin : Norm +--------------------------------------------------------------------------- + 0 1 a : -1.000000000000e+00 + 1 1 b : -1.000000000000e+00 +=========================================================================== + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Calculation : Optimize linear response orbitals + Frequency : Static field + Perturbation : h_B_dip[x] + Method : DFT + Relativity : None + Checkpointing : Off + Max iterations : 10 + KAIN solver : 3 + Start precision : 1.00000e-03 + Final precision : 1.00000e-03 + Helmholtz precision : Dynamic + Property threshold : Off + Orbital threshold : 1.00000e-02 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +=========================================================================== + Iter MO residual Symmetric property Update +--------------------------------------------------------------------------- + 0 1.000000e+00 0.000000000000 0.000000e+00 + 1 8.780898e-02 -0.020433596781 -2.043360e-02 + 2 2.040507e-02 -0.027068845752 -6.635249e-03 + 3 6.574223e-04 -0.027301384939 -2.325392e-04 +--------------------------------------------------------------------------- + SCF converged in 3 iterations! +=========================================================================== + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Calculation : Compute initial orbitals + Method : Zero guess +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +=========================================================================== + Molecular Orbitals +--------------------------------------------------------------------------- + Alpha electrons : 1 + Beta electrons : 1 + Total electrons : 2 +--------------------------------------------------------------------------- + n Occ Spin : Norm +--------------------------------------------------------------------------- + 0 1 a : -1.000000000000e+00 + 1 1 b : -1.000000000000e+00 +=========================================================================== + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Calculation : Compute initial orbitals + Method : Zero guess +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +=========================================================================== + Molecular Orbitals +--------------------------------------------------------------------------- + Alpha electrons : 1 + Beta electrons : 1 + Total electrons : 2 +--------------------------------------------------------------------------- + n Occ Spin : Norm +--------------------------------------------------------------------------- + 0 1 a : -1.000000000000e+00 + 1 1 b : -1.000000000000e+00 +=========================================================================== + + + +*************************************************************************** +*** *** +*** Printing Molecular Properties *** +*** *** +*************************************************************************** + + +=========================================================================== + Molecule +--------------------------------------------------------------------------- + Charge : 0 + Multiplicity : 1 +--------------------------------------------------------------------------- + N Atom : x y z +--------------------------------------------------------------------------- + 0 H : 0.000000 0.000000 -0.700144 + 1 H : 0.000000 0.000000 0.700144 +--------------------------------------------------------------------------- + Center of mass : 0.000000 0.000000 0.000000 +=========================================================================== + + +=========================================================================== + Molecular Energy (final) +--------------------------------------------------------------------------- + Kinetic energy : (au) 1.073486065232 + E-N energy : (au) -3.566631555860 + Coulomb energy : (au) 1.328363917978 + Exchange energy : (au) 0.000000000000 + X-C energy : (au) -0.653870455417 + N-N energy : (au) 0.714139285969 +--------------------------------------------------------------------------- + Electronic energy : (au) -1.818652028066 + Nuclear energy : (au) 0.714139285969 +--------------------------------------------------------------------------- + Total energy : (au) -1.104512742097e+00 + : (kcal/mol) -6.930922098894e+02 + : (kJ/mol) -2.899897806177e+03 + : (eV) -3.005532283883e+01 +=========================================================================== + + +=========================================================================== + Orbital Energies (final) +--------------------------------------------------------------------------- + n Occ Spin : Epsilon +--------------------------------------------------------------------------- + 0 1 a : (au) -0.345283968292 + 1 1 b : (au) -0.345283968292 +--------------------------------------------------------------------------- + Sum occupied : (au) -0.690567936584 +=========================================================================== + + +=========================================================================== + Dipole Moment (dip-1) +--------------------------------------------------------------------------- + r_O : 0.000000 0.000000 0.000000 +--------------------------------------------------------------------------- + Electronic vector : -0.000000 -0.000000 0.000023 + Magnitude : (au) 0.000023 + : (Debye) 0.000059 +--------------------------------------------------------------------------- + Nuclear vector : 0.000000 0.000000 0.000000 + Magnitude : (au) 0.000000 + : (Debye) 0.000000 +--------------------------------------------------------------------------- + Total vector : 0.000000 0.000000 0.000023 + Magnitude : (au) 0.000023 + : (Debye) 0.000059 +=========================================================================== + + +=========================================================================== + Magnetizability (mag-0.000000) +--------------------------------------------------------------------------- + Frequency : (au) 0.000000 + : (cm-1) 0.000000 + r_O : 0.000000 0.000000 0.000000 +--------------------------------------------------------------------------- + Diamagnetic : -0.913111 -0.000000 0.000000 + : -0.000000 -0.913111 0.000000 + : 0.000000 0.000000 -0.772210 + Isotropic average : (au) -0.866144 + : (SI) -68.377861 +--------------------------------------------------------------------------- + Paramagnetic : 0.027301 0.000000 -0.000000 + : N/A N/A N/A + : N/A N/A N/A + Isotropic average : (au) N/A + : (SI) N/A +--------------------------------------------------------------------------- + Total tensor : -0.885810 0.000000 -0.000000 + : N/A N/A N/A + : N/A N/A N/A + Isotropic average : (au) N/A + : (SI) N/A +=========================================================================== + + +=========================================================================== + NMR shielding (nmr-0h) +--------------------------------------------------------------------------- + r_O : 0.000000 0.000000 0.000000 + r_K : 0.000000 0.000000 -0.700144 +--------------------------------------------------------------------------- + Diamagnetic : 25.527088 -0.000000 -0.000000 + : 0.000000 25.527088 -0.000000 + : -0.000000 -0.000000 26.747535 +--------------------------------------------------------------------------- + Paramagnetic : 0.550389 -0.000000 0.000000 + : N/A N/A N/A + : N/A N/A N/A +--------------------------------------------------------------------------- + Total tensor : 26.077476 -0.000000 0.000000 + : N/A N/A N/A + : N/A N/A N/A +--------------------------------------------------------------------------- + Diagonalized tensor : N/A N/A N/A + Isotropic average : (ppm) N/A + Anisotropy : (ppm) N/A +=========================================================================== + + + + +*************************************************************************** +*** *** +*** Exiting MRChem *** +*** *** +*** Wall time : 0h 0m 9s *** +*** *** +*************************************************************************** + + diff --git a/tests/h2_mag_lda/test b/tests/h2_mag_lda/test new file mode 100755 index 000000000..b371d3de1 --- /dev/null +++ b/tests/h2_mag_lda/test @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 + +import sys +from pathlib import Path + +sys.path.append(str(Path(__file__).resolve().parents[1])) + +from tester import * # isort:skip + +options = script_cli() + +filters = { + SUM_OCCUPIED: rel_tolerance(1.0e-6), + E_KIN: rel_tolerance(1.0e-6), + E_EN: rel_tolerance(1.0e-6), + E_EE: rel_tolerance(1.0e-6), + E_X: rel_tolerance(1.0e-6), + E_XC: rel_tolerance(1.0e-6), + E_EEXT: rel_tolerance(1.0e-6), + E_NEXT: rel_tolerance(1.0e-6), + E_EL: rel_tolerance(1.0e-6), + MAGNETIZABILITY(0.0): rel_tolerance(1.0e-6), + NMR_SHIELDING("0h"): rel_tolerance(1.0e-6) +} + +ierr = run(options, input_file="h2", filters=filters, extra_args=["--json"]) + +sys.exit(ierr) diff --git a/tests/tester.py b/tests/tester.py index d2e856890..1faa7e28a 100644 --- a/tests/tester.py +++ b/tests/tester.py @@ -60,6 +60,13 @@ def POLARIZABILITY(frequency): return ("output", "properties", "polarizability", f"pol-{frequency:.6f}", "tensor") +def MAGNETIZABILITY(frequency): + return ("output", "properties", "magnetizability", f"mag-{frequency:.6f}", + "tensor") + +def NMR_SHIELDING(atom): + return ("output", "properties", "nmr_shielding", f"nmr-{atom}", "tensor") + def GEOMETRIC_DERIVATIVE(index, comp): return ("output", "properties", "geometric_derivative", f"geom-{index}", comp) From 30a17efe28f491ebb83be22b04e42534d17c96b1 Mon Sep 17 00:00:00 2001 From: Stig Rune Jensen Date: Wed, 17 Jan 2024 08:59:40 +0100 Subject: [PATCH 4/4] Prepare MRChem-v1.1.4 --- CHANGELOG.md | 6 ++++++ VERSION | 2 +- external/upstream/fetch_mrcpp.cmake | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0227a1c0f..522dd7035 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change log +## Version 1.1.4 2024-01-17 + +### Fixed + +- CRITICAL: sign error in para contribution to magnetic properties + ## Version 1.1.3 2023-08-23 ### Fixed diff --git a/VERSION b/VERSION index 781dcb07c..65087b4f5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.3 +1.1.4 diff --git a/external/upstream/fetch_mrcpp.cmake b/external/upstream/fetch_mrcpp.cmake index 5d2cfcf51..cec6344ec 100644 --- a/external/upstream/fetch_mrcpp.cmake +++ b/external/upstream/fetch_mrcpp.cmake @@ -1,4 +1,4 @@ -find_package(MRCPP CONFIG QUIET +find_package(MRCPP 1.4 CONFIG QUIET NO_CMAKE_PATH NO_CMAKE_PACKAGE_REGISTRY NO_CMAKE_SYSTEM_PACKAGE_REGISTRY