Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alternate sss L2 options plus test fixes. bump dkh #2949

Merged
merged 2 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ option_with_default(SIMINT_VECTOR "Vectorization type to use for simint (scalar
option_with_default(SPHINX_THEME "Theme for Sphinx documentation and extensions" sphinx_psi_theme)
option_with_default(SPHINXMAN_STRICT "Turn warnings into errors for docs target sphinxman" OFF)
option_with_default(BUILD_Libint2_GENERATOR "If prebuilt not found, don't build Libint2 from source tarball but instead build and run generator (several hours for production library). Edit angular momentum and integrals classes directly in `external/upstream/libint2/CMakeLists.txt` (requires Ninja)." OFF)
option_with_default(psi4_SHGAUSS_ORDERING "Ordering for shells of solid harmonic Gaussians: standard -- standard ordering (-l, -l+1 ... l) -or- gaussian -- the Gaussian ordering (0, 1, -1, 2, -2, ... l, -l). Changing this is experimental, expert only, and not a future plan. Internal calculations should be correct, but exports like Molden, fchk, QCSchema.Wavefunction won't be." gaussian)
option_with_default(psi4_SHGAUSS_ORDERING "Ordering for shells of solid harmonic Gaussians: standard -- standard ordering (-l, -l+1 ... l) -or- gaussian -- the Gaussian ordering (0, 1, -1, 2, -2, ... l, -l). Changing this is experimental, expert only, and not a future plan. Internal calculations should be correct and fchk files should be correct, but other exports like Molden and QCSchema.Wavefunction won't be." gaussian)
include(custom_int_orderings)


Expand Down
1 change: 1 addition & 0 deletions devtools/conda-envs/docs-cf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies:
- doxygen
- cxx-compiler
# core
- boost-cpp
- eigen
- networkx
- pybind11
Expand Down
4 changes: 3 additions & 1 deletion external/upstream/dkh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ if(${ENABLE_dkh})
include(ExternalProject)
message(STATUS "Suitable dkh could not be located, ${Magenta}Building dkh${ColourReset} instead.")
ExternalProject_Add(dkh_external
URL https://github.com/psi4/dkh/archive/v1.2.tar.gz
DEPENDS lapack_external
URL https://github.com/psi4/dkh/archive/319b320.tar.gz # v1.2 + cmake
UPDATE_COMMAND ""
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
Expand All @@ -27,6 +28,7 @@ if(${ENABLE_dkh})
-DBUILD_FPIC=${BUILD_FPIC}
-DENABLE_GENERIC=${ENABLE_GENERIC}
-DLIBC_INTERJECT=${LIBC_INTERJECT}
-DTargetLAPACK_DIR=${TargetLAPACK_DIR}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
CMAKE_CACHE_ARGS -DCMAKE_Fortran_FLAGS:STRING=${CMAKE_Fortran_FLAGS}
Expand Down
81 changes: 77 additions & 4 deletions psi4/src/psi4/libmints/writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <utility>
#include <algorithm>
#include <vector>
#include <libint2/config.h>
#include "psi4/libmints/writer.h"
#include "psi4/psi4-dec.h"
#include "psi4/physconst.h"
Expand Down Expand Up @@ -404,20 +405,72 @@ void FCHKWriter::write(const std::string &filename) {
// / -----------------------------
// \/ (2l-1)!!
//
// which is omitted in the CCA standard, adopted by Psi4. We also need to
// order basis functions to the Gaussian / GAMESS convention. Spherical
// which is omitted in the CCA standard, adopted by Psi4.
//
// We also need to order basis functions to the Gaussian / GAMESS convention.
// * When psi4_SHGAUSS_ORDERING=gaussian (usual case), spherical
// harmonics are already defined appropriately, with the exception of
// the fact that p functions are ordered 0 +1 -1, which is Z X Y, but
// the FCHK format calls for X Y Z; this is a simple reordering operation.
// * When psi4_SHGAUSS_ORDERING=standard (unusual but configurable), all
// spherical harmonics need reordering.

const double pureP[3][3] = {
const double pureP_from_gss[3][3] = {
// 0 1 2
// Psi4: Z X Y
// Psi4: 0 +1 -1
// Expected:+1 -1 0
// Expected: X Y Z
/* 0 */ {0.0, 1.0, 0.0},
/* 1 */ {0.0, 0.0, 1.0},
/* 2 */ {1.0, 0.0, 0.0},
};

const double pureP_from_sss[3][3] = {
// 0 1 2
// Psi4: -1 0 +1
// Expected: +1 -1 0
/* 0 */ {0.0, 0.0, 1.0},
/* 1 */ {1.0, 0.0, 0.0},
/* 2 */ {0.0, 1.0, 0.0}
};
const double pureD_from_sss[5][5] = {
// 0 1 2 3 4
// Psi4: -2 -1 0 +1 +2
// Expected: 0 +1 -1 +2 -2
/* 0 */ {0.0, 0.0, 1.0, 0.0, 0.0},
/* 1 */ {0.0, 0.0, 0.0, 1.0, 0.0},
/* 2 */ {0.0, 1.0, 0.0, 0.0, 0.0},
/* 3 */ {0.0, 0.0, 0.0, 0.0, 1.0},
/* 4 */ {1.0, 0.0, 0.0, 0.0, 0.0}
};
const double pureF_from_sss[7][7] = {
// 0 1 2 3 4 5 6
// Psi4: -3 -2 -1 0 +1 +2 +3
// Expected: 0 +1 -1 +2 -2 +3 -3
/* 0 */ {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
/* 1 */ {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
/* 2 */ {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
/* 3 */ {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
/* 4 */ {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
/* 5 */ {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0},
/* 6 */ {1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}
};
const double pureG_from_sss[9][9] = {
// 0 1 2 3 4 5 6 7 8
// Psi4: -4 -3 -2 -1 0 +1 +2 +3 +4
// Expected: 0 +1 -1 +2 -2 +3 -3 +4 -4
/* 0 */ {0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0},
/* 1 */ {0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0},
/* 2 */ {0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0},
/* 3 */ {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0},
/* 4 */ {0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
/* 5 */ {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0},
/* 6 */ {0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
/* 7 */ {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0},
/* 8 */ {1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}
};

double pf1, pf2, pf3, pf4;
pf1 = 1.0; // aa
pf2 = sqrt(1.0 / 3.0); // ab
Expand Down Expand Up @@ -504,11 +557,31 @@ void FCHKWriter::write(const std::string &filename) {
int am = shell.am();
int nfunc = shell.nfunction();
if (basis->has_puream()) {
#if psi4_SHGSHELL_ORDERING == LIBINT_SHGSHELL_ORDERING_STANDARD
if (am == 1) {
for (int row = 0; row < 3; ++row)
for (int col = 0; col < 3; ++col) transmat->set(offset + row, offset + col, pureP_from_sss[row][col]);
} else if (am == 2) {
for (int row = 0; row < 5; ++row)
for (int col = 0; col < 5; ++col) transmat->set(offset + row, offset + col, pureD_from_sss[row][col]);
} else if (am == 3) {
for (int row = 0; row < 7; ++row)
for (int col = 0; col < 7; ++col) transmat->set(offset + row, offset + col, pureF_from_sss[row][col]);
} else if (am == 4) {
for (int row = 0; row < 9; ++row)
for (int col = 0; col < 9; ++col) transmat->set(offset + row, offset + col, pureG_from_sss[row][col]);
} else if (am >= 5) {
throw PSIEXCEPTION("The Psi4 FCHK writer only supports up to G shell (l=4) spherical functions");
}
#elif psi4_SHGSHELL_ORDERING == LIBINT_SHGSHELL_ORDERING_GAUSSIAN
// Spherical harmonics - everything is fine, apart from P orbitals
if (am == 1) {
for (int row = 0; row < 3; ++row)
for (int col = 0; col < 3; ++col) transmat->set(offset + row, offset + col, pureP[row][col]);
for (int col = 0; col < 3; ++col) transmat->set(offset + row, offset + col, pureP_from_gss[row][col]);
}
#else
# error "unknown value of macro psi4_SHGSHELL_ORDERING"
#endif
} else {
// Cartesians - S and P orbitals are fine, but higher terms need reordering
if (am == 2) {
Expand Down
23 changes: 15 additions & 8 deletions tests/mints3/input.dat
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ molecule h2o {

h2o.R = 0.52917721067 / 0.52917720859

input_directory_simple = get_input_directory() + "/" #TEST
input_directory = get_input_directory() + "/" #TEST
input_directory_sss = get_input_directory() + "/sss_reference/" #TEST

# NOTE: mints3 is expected to fail if psi4_SHGAUSS_ORDERING=standard
# To test with standard ordering, uncomment the following line:
#input_directory = input_directory_sss

#################################################################### #TEST
# Test Angular Momentum Integrals SO #TEST
Expand All @@ -33,11 +39,11 @@ RefX = factory.create_matrix("Lx SO") #TEST
RefY = factory.create_matrix("Ly SO") #TEST
RefZ = factory.create_matrix("Lz SO") #TEST

RefX.load(input_directory + "Lx-STO-3G.dat") #TEST
RefY.load(input_directory + "Ly-STO-3G.dat") #TEST
RefZ.load(input_directory + "Lz-STO-3G.dat") #TEST
RefX.load(input_directory_simple + "Lx-STO-3G.dat") #TEST
RefY.load(input_directory_simple + "Ly-STO-3G.dat") #TEST
RefZ.load(input_directory_simple + "Lz-STO-3G.dat") #TEST

print(" -H2O STO-3G Angular Momentum Integrals:") #TEST
print(" -H2O STO-3G Angular Momentum Integrals:") #TEST
compare_matrices(RefX, Li[0], 12, "SO Lx") #TEST
compare_matrices(RefY, Li[1], 12, "SO Ly") #TEST
compare_matrices(RefZ, Li[2], 12, "SO Lz") #TEST
Expand Down Expand Up @@ -118,11 +124,11 @@ RefX = factory.create_matrix("Px SO") #TEST
RefY = factory.create_matrix("Py SO") #TEST
RefZ = factory.create_matrix("Pz SO") #TEST

RefX.load(input_directory + "Px-STO-3G.dat") #TEST
RefY.load(input_directory + "Py-STO-3G.dat") #TEST
RefZ.load(input_directory + "Pz-STO-3G.dat") #TEST
RefX.load(input_directory_simple + "Px-STO-3G.dat") #TEST
RefY.load(input_directory_simple + "Py-STO-3G.dat") #TEST
RefZ.load(input_directory_simple + "Pz-STO-3G.dat") #TEST

print(" -H2O STO-3G Nabla Integrals:") #TEST
print(" -H2O STO-3G Nabla Integrals:") #TEST
compare_matrices(RefX, Pi[0], 12, "SO Px") #TEST
compare_matrices(RefY, Pi[1], 12, "SO Py") #TEST
compare_matrices(RefZ, Pi[2], 12, "SO Pz") #TEST
Expand All @@ -137,6 +143,7 @@ factory = mints.factory() #TEST

Pi = mints.so_nabla()

# edit matrix.cc to minimize format change: `static const char *str_block_format = "%3d %3d %3d % 16.12f\n";`
#Pi[0].save("Px-6-311Gss.dat", False, False, True) #TEST
#Pi[1].save("Py-6-311Gss.dat", False, False, True) #TEST
#Pi[2].save("Pz-6-311Gss.dat", False, False, True) #TEST
Expand Down
Loading