Skip to content

Commit

Permalink
Merge pull request #478 from stigrj/release/1.1
Browse files Browse the repository at this point in the history
Prepare MRChem-v1.1.4
  • Loading branch information
stigrj committed Jan 17, 2024
2 parents 87ae1cd + 30a17ef commit 8196932
Show file tree
Hide file tree
Showing 18 changed files with 1,327 additions and 19 deletions.
17 changes: 17 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.3
1.1.4
2 changes: 1 addition & 1 deletion external/upstream/fetch_mrcpp.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 2 additions & 4 deletions src/qmoperators/QMDerivative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
15 changes: 7 additions & 8 deletions src/qmoperators/one_electron/MomentumOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<mrcpp::DerivativeOperator<3>> D) {
auto p_x = std::make_shared<QMDerivative>(0, D, true);
auto p_y = std::make_shared<QMDerivative>(1, D, true);
auto p_z = std::make_shared<QMDerivative>(2, D, true);
MomentumOperator(std::shared_ptr<mrcpp::DerivativeOperator<3>> 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]";
Expand Down
8 changes: 4 additions & 4 deletions src/qmoperators/one_electron/NablaOperator.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ namespace mrchem {

class NablaOperator final : public RankOneOperator<3> {
public:
NablaOperator(std::shared_ptr<mrcpp::DerivativeOperator<3>> D) {
auto d_x = std::make_shared<QMDerivative>(0, D);
auto d_y = std::make_shared<QMDerivative>(1, D);
auto d_z = std::make_shared<QMDerivative>(2, D);
NablaOperator(std::shared_ptr<mrcpp::DerivativeOperator<3>> D, bool imag = false) {
auto d_x = std::make_shared<QMDerivative>(0, D, imag);
auto d_y = std::make_shared<QMDerivative>(1, D, imag);
auto d_z = std::make_shared<QMDerivative>(2, D, imag);

// Invoke operator= to assign *this operator
RankOneOperator<3> &d = (*this);
Expand Down
2 changes: 1 addition & 1 deletion src/scf_solver/HelmholtzVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 11 additions & 0 deletions tests/h2_mag_lda/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
)
42 changes: 42 additions & 0 deletions tests/h2_mag_lda/h2.inp
Original file line number Diff line number Diff line change
@@ -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
]
}
}
12 changes: 12 additions & 0 deletions tests/h2_mag_lda/initial_guess/mrchem.bas
Original file line number Diff line number Diff line change
@@ -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
101 changes: 101 additions & 0 deletions tests/h2_mag_lda/initial_guess/mrchem.moa
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 8196932

Please sign in to comment.