Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
221 commits
Select commit Hold shift + click to select a range
28c9d2d
mrchem recognize precompiled libxc
ylvao Jan 23, 2025
b3a4051
git ignore install folder
ylvao Jan 23, 2025
240bfbc
cleaned some stuff
ylvao Jan 23, 2025
f55cd6e
newest changes - still not working
ylvao Feb 4, 2025
1068d45
works if imported loc is specified
ylvao Feb 4, 2025
16fcdb5
libxc seems to liked with mrchem
ylvao Feb 4, 2025
86557f7
some formatting
ylvao Feb 4, 2025
0c91c62
Libxc is callable from mrchem
ylvao Feb 10, 2025
a49fae4
Small changes for testing
ylvao Feb 17, 2025
88a6ada
removed -flto flag for testing
ylvao Feb 18, 2025
6e84c21
should build libxc
ylvao Feb 20, 2025
cccb8c5
xc.h is found
ylvao Feb 26, 2025
e2a5991
changes to factory for libxc
ylvao Mar 11, 2025
17625a0
Added the LibXC integration files.
Tirtho13 Apr 9, 2025
c86e39e
Merge pull request #1 from Tirtho13/libxc-mrchem
ylvao Apr 14, 2025
9eeb97b
Added new factory files for libxc
ylvao Apr 14, 2025
4ffc3a5
working on debugg (does not compile)
ylvao Apr 14, 2025
98e9e16
Debugging libxc interface files
ylvao Apr 29, 2025
2c45b7c
some typos
ylvao Apr 29, 2025
11c7ada
almost compiling ig
ylvao Apr 30, 2025
b52aa64
Merge branch 'MRChemSoft:master' into libxc-mrchem
ylvao May 2, 2025
809136f
compiles
ylvao May 6, 2025
4d478dd
restructure new folder for libxc
ylvao May 9, 2025
2e4e986
some cleanup in manes and stuff
ylvao May 9, 2025
1ebdc34
change in header inclusion
ylvao May 20, 2025
07c7b23
functional.cpp file back to original
ylvao Jul 16, 2025
70075f0
compiles with external libxc
ylvao Jul 23, 2025
412a04e
Original mrchem
ylvao Jul 25, 2025
2c34c3c
bugs, compiles
ylvao Jul 25, 2025
20f9d2f
Shit runs but wrong number
ylvao Jul 28, 2025
f9f7760
removed some prints
ylvao Jul 29, 2025
cc63634
compiles at least
ylvao Jul 30, 2025
3cf0f58
might work
ylvao Jul 30, 2025
d22325c
commiting before breaking again
ylvao Aug 1, 2025
a7a1d4f
moved libxc bool out of eval func
ylvao Aug 5, 2025
48ab21b
added vector for libxc objects
ylvao Aug 5, 2025
9d2573d
at least it rund
ylvao Aug 18, 2025
a5e5fae
xc lib can be changed from input file without recompiling
ylvao Aug 20, 2025
3129e86
removed shit ton of debug prints
ylvao Aug 20, 2025
c3edc9f
back to using libxc-7.0.0
ylvao Aug 20, 2025
b9bce3a
map func includes coef
ylvao Aug 26, 2025
e0c8019
updated functionals in newmapfuncname
ylvao Sep 3, 2025
fb607aa
Merge branch 'MRChemSoft:master' into new_from_scratch
ylvao Sep 3, 2025
41fe6d5
fixed b3p86
ylvao Sep 3, 2025
6484510
vas
ylvao Sep 11, 2025
816af20
back to normal
ylvao Sep 12, 2025
a949130
fixed sad to correspond to master
ylvao Sep 12, 2025
ce11e6d
small fixes
ylvao Sep 27, 2025
f59d84f
possible bug?
ylvao Sep 27, 2025
f1248f0
revomed comment
ylvao Sep 27, 2025
13f0061
test of git commits
ylvao Sep 27, 2025
9bc56f9
test of git commits
ylvao Sep 27, 2025
543d778
gga bug fix due to eigen
ylvao Oct 23, 2025
bf07d4e
removing some debug code
ylvao Oct 30, 2025
4a3d3c7
some cleanup
ylvao Oct 30, 2025
d9954ae
whitespace and typo fixes
ylvao Oct 30, 2025
8aab09d
whitespace fixes
ylvao Oct 30, 2025
3424587
cosmetic fixes to be similar to master
ylvao Oct 30, 2025
6103b7b
prints density cutoff in out file
ylvao Oct 30, 2025
637dbd6
prints libxc reference
ylvao Nov 3, 2025
98f2afe
New fetch Libxc
Tirtho13 Nov 4, 2025
e3d66ed
New CMakeLists.txt for targetting Libxc
Tirtho13 Nov 4, 2025
8db2a72
autocmake for libxc works
ylvao Nov 4, 2025
e627117
Merge remote-tracking branch 'mrchem/master' into libxc
Tirtho13 Nov 5, 2025
86b8301
Fetching Libxc in MRChem
Tirtho13 Nov 5, 2025
6a41597
Removing unnecessary comment lines
Tirtho13 Nov 5, 2025
0b2ce5e
Merge branch 'master' of https://github.com/MRChemSoft/mrchem into wo…
ylvao Nov 5, 2025
5a22deb
trying to fix cmake
ylvao Nov 5, 2025
5d37258
some fixes to make program compile
ylvao Nov 5, 2025
bd19f67
compile fix
ylvao Nov 5, 2025
48b3cee
linefix
ylvao Nov 5, 2025
9fefd70
cosmetics
ylvao Nov 5, 2025
d9524bf
Merge branch 'working_libxc' of https://github.com/ylvao/mrchem into …
ylvao Nov 5, 2025
2edd518
Working LibXC build: Trial 1
Tirtho13 Nov 19, 2025
8a450ec
Merge remote-tracking branch 'refs/remotes/mrchem/libxc' into libxc
Tirtho13 Nov 19, 2025
b05a2fd
added luca's cmake bugfix
ylvao Nov 19, 2025
ff75871
cleaned up fetch_libxc.cmake to fit the style of mrchem
ylvao Nov 19, 2025
088a6e9
added some temp ifs so to not build libxc obj if only running xcfun
ylvao Nov 20, 2025
44ba6a2
remove unnecessary line + small input fix
ylvao Nov 20, 2025
3feb842
removed cutoff debugg code
ylvao Nov 20, 2025
7e3e352
line fixes
ylvao Nov 21, 2025
11b8330
remove message lines in cmake not present in master
ylvao Nov 21, 2025
ad32690
tab alignment
ylvao Nov 24, 2025
24d2330
all tests are passing :D
ylvao Nov 25, 2025
ea675be
Merge branch 'master' into libxc
ylvao Nov 25, 2025
4331358
try to fix cmake error
ylvao Nov 25, 2025
cbb8a50
Merge branch 'libxc' of https://github.com/MRChemSoft/mrchem into libxc
ylvao Nov 25, 2025
b26ea6c
added cmake policy setting
ylvao Nov 25, 2025
8631e97
remove cmake policy setting
ylvao Nov 25, 2025
ee67032
white space cleanup
ylvao Nov 25, 2025
2d9743c
Adding hybrid parameters from LibXC
Tirtho13 Nov 25, 2025
e92dc7a
Some merged changes
Tirtho13 Nov 25, 2025
2619b67
Adding hyb_exx_coef
Tirtho13 Nov 25, 2025
41c4479
Fixing build errors
Tirtho13 Nov 25, 2025
8c7df12
removed hardcoded xcfun init for hyb param
ylvao Nov 26, 2025
3544e5a
Cleaning up setFunctional
Tirtho13 Dec 1, 2025
0852c14
Adding citation for Libxc functionals
Tirtho13 Dec 9, 2025
6b8efdb
Update src/mrdft/Functional.cpp
Tirtho13 Dec 12, 2025
82b3413
Update src/mrdft/Functional.h
Tirtho13 Dec 12, 2025
c8eb7d4
Update src/driver.cpp
Tirtho13 Dec 15, 2025
5540efb
Merge remote-tracking branch 'upstream' into libxc
susilehtola Dec 16, 2025
ea1ffa3
debug print for actual library used
ylvao Dec 16, 2025
0ad36ce
Clean up Functional
susilehtola Dec 16, 2025
d3d295a
Merge remote-tracking branch 'upstream/master' into libxc
susilehtola Dec 16, 2025
7fe69d9
Clearer debug message
susilehtola Dec 16, 2025
afd7b12
Fix xc lib parsing
susilehtola Dec 16, 2025
514f861
Throw error for not implemented GGA
susilehtola Dec 16, 2025
e1ad904
added spin unrestricted code for libxc ggas
ylvao Dec 16, 2025
abdb9ad
Proper printout of Libxc functional references. Also eliminate needle…
susilehtola Dec 16, 2025
f10485e
Reduce number of lines in debug printout
susilehtola Dec 16, 2025
fd7d479
DRY, comment on wrong code
susilehtola Dec 16, 2025
a657595
A few more places with wrong code
susilehtola Dec 16, 2025
233c29e
Improvements to mapfunctionalname
susilehtola Dec 16, 2025
6a27e9a
New look through the code
susilehtola Dec 16, 2025
698b61b
Simplify code
susilehtola Dec 16, 2025
34b741c
Adding XC Functional citation
Tirtho13 Dec 17, 2025
883c31b
Fix commit 34b741c
susilehtola Dec 17, 2025
13f4b20
Forgot to commit other files
susilehtola Dec 17, 2025
e9f1c69
fixed spin case for libxc
ylvao Dec 17, 2025
d63b4d7
Merge branch 'libxc' of https://github.com/MRChemSoft/mrchem into libxc
ylvao Dec 17, 2025
7b04545
temp fix for making tests pass
ylvao Dec 17, 2025
4fd3703
Improve Libxc citation message
susilehtola Dec 18, 2025
2cd9470
Move some allocs and update comments
susilehtola Dec 18, 2025
d7d638d
Remove two needless calls to XCFun
susilehtola Dec 18, 2025
56b79d5
Extra parentheses
susilehtola Dec 18, 2025
ebb8db2
Remove needless comments
susilehtola Dec 18, 2025
c0f5a99
Throw error for not implemented
susilehtola Dec 18, 2025
65b8b13
No need to ask XCFun for number of input and output variables
susilehtola Dec 18, 2025
a1f76ff
Remove duplicated implementations in evaluate and evaluate_transposed.
susilehtola Dec 18, 2025
977a615
Dimensoon fix
susilehtola Dec 18, 2025
111366b
Also check output matrix dimension
susilehtola Dec 18, 2025
c945084
Fix SpinGGA input and output dimensions
susilehtola Dec 18, 2025
d672c1d
Fix GGA input and output dimensions
susilehtola Dec 18, 2025
6bcfcf6
Drop unused functions
susilehtola Dec 18, 2025
0b6ca85
TO DO -> TODO
susilehtola Dec 18, 2025
a1a9886
Drop unused function
susilehtola Dec 18, 2025
939361a
Update comment to reflect function's content
susilehtola Dec 21, 2025
d1359ed
Support all supported Libxc functionals
susilehtola Dec 21, 2025
d4826d1
Density cutoff should *not* default to 0!
susilehtola Dec 21, 2025
e053620
Fix issues in Libxc printout
susilehtola Dec 21, 2025
b732641
added li_scf_pbe0_libxc test
ylvao Jan 6, 2026
add38c0
works
ylvao Jan 6, 2026
198a136
stuff
ylvao Jan 6, 2026
510ca07
pass
ylvao Jan 9, 2026
66c45d7
moved evaluate
ylvao Jan 9, 2026
4d0837e
error prints
ylvao Jan 9, 2026
4e9e802
ok
ylvao Jan 9, 2026
09328fd
ok
ylvao Jan 9, 2026
9169df7
ok
ylvao Jan 9, 2026
4e74fc6
transposed eval data function
ylvao Jan 9, 2026
c0c1035
functional cpp ok
ylvao Jan 9, 2026
ed38ee6
name fix
ylvao Jan 9, 2026
bc1dff4
ok
ylvao Jan 9, 2026
8cd8f49
ok
ylvao Jan 9, 2026
8f05a2a
final
ylvao Jan 12, 2026
70fbe37
bug fixes
ylvao Jan 12, 2026
f7b6b1b
Undo obfuscation of evaluate_transposed
susilehtola Jan 12, 2026
9149984
disable autocmake libxc tests
ylvao Jan 12, 2026
cdf84d9
Merge branch 'libxc' of https://github.com/MRChemSoft/mrchem into libxc
ylvao Jan 12, 2026
cd6ddd0
coeff -> coef
ylvao Jan 12, 2026
69a2f1c
force not building libxc tests
ylvao Jan 12, 2026
c4626f6
typo fix
ylvao Jan 12, 2026
48cccf4
Fixed bug in refactoring
Tirtho13 Jan 12, 2026
fdb782d
Merge remote-tracking branch 'refs/remotes/mrchem/libxc' into libxc
Tirtho13 Jan 12, 2026
95960a7
Changed CMake files to not have tests for LibXC
Tirtho13 Jan 20, 2026
828e443
Revised git tag
Tirtho13 Jan 20, 2026
e182d80
Added tests for H2O
Tirtho13 Jan 21, 2026
9dc537c
Adding tests for N, N2 and Ne
Tirtho13 Jan 21, 2026
d49462b
Removing some tests (long wall time)
Tirtho13 Jan 22, 2026
61abfeb
Remaking the 'Ne' test
Tirtho13 Jan 22, 2026
639375e
Remaking the 'Li' test
Tirtho13 Jan 22, 2026
7a24bb3
Adding test on 'He'
Tirtho13 Jan 22, 2026
11a55cb
Changes in the parent CMakeList
Tirtho13 Jan 22, 2026
55caddf
Removing a test (h2o)
Tirtho13 Jan 22, 2026
3d818ec
Added tests for h2 instead
Tirtho13 Jan 22, 2026
9e33521
Add libxc dependencies in github codecov and actions setups
susilehtola Jan 23, 2026
b2f0e96
clean up comments
susilehtola Jan 23, 2026
08a71a6
clean up test labels
ylvao Jan 27, 2026
cf35235
Merge branch 'master' into libxc
ylvao Jan 27, 2026
2246191
revert li_pbe0 test. should use xcfun for reference, consistent prec …
ylvao Jan 27, 2026
76922b8
Revert "revert li_pbe0 test. should use xcfun for reference, consiste…
ylvao Jan 27, 2026
9a36ccd
Reapply "revert li_pbe0 test. should use xcfun for reference, consist…
ylvao Jan 27, 2026
ae074ae
Revert dash patch
susilehtola Jan 27, 2026
ec28e10
Error out range separated functionals
susilehtola Jan 27, 2026
a22781e
Merge branch 'libxc' of https://github.com/MRChemSoft/mrchem into libxc
ylvao Jan 27, 2026
4502377
Exception handling using MSG_ABORT
susilehtola Jan 27, 2026
690ed4b
Improve error message
susilehtola Jan 27, 2026
34474de
out_data is out not in
susilehtola Jan 27, 2026
85af562
Fix typo
susilehtola Jan 27, 2026
eac9f05
fix bracket error
ylvao Jan 27, 2026
a3363de
moving check inside loop (compiles locally)
ylvao Jan 27, 2026
7f10b01
added libxc in test input
ylvao Jan 27, 2026
6f22e3d
dir name change
ylvao Jan 27, 2026
c952a38
Restore more logical handling of libxc flag
susilehtola Jan 27, 2026
613ed6f
fixing tests
ylvao Jan 28, 2026
e6202c5
remove outdated line
ylvao Jan 29, 2026
9c17b85
pbe0 -> b3lyp in tests + some doc
ylvao Jan 29, 2026
8c5b146
make h2 tests restricted
ylvao Jan 29, 2026
2bb9e2f
remove he test, adjust test tolerance
ylvao Jan 29, 2026
96bbb5a
updating tests
ylvao Jan 29, 2026
d9196df
documentation for factory
ylvao Jan 29, 2026
2910347
documenting functional
ylvao Jan 29, 2026
b4d11a1
update documentation
ylvao Jan 29, 2026
b30a15f
update om documentation
ylvao Jan 30, 2026
1de2f9d
adding pbe
ylvao Feb 2, 2026
4208f03
remove white line
ylvao Feb 2, 2026
e035266
accidentaly removed mra variable
ylvao Feb 2, 2026
ab04812
requirement for eigen 3.4.0
ylvao Feb 2, 2026
34cea32
cmake looks for eigen 3.4 not 3.4.0
ylvao Feb 2, 2026
bdf5dbf
added linbreak in functional ref print
ylvao Feb 2, 2026
8dd14a3
remove comment
ylvao Feb 2, 2026
cdd0549
makes libxc dir in install/include
ylvao Feb 2, 2026
41e8b4c
update doc
ylvao Feb 2, 2026
bfb8956
LDA is not SVWN5. B3LYP is not B3LYP5.
susilehtola Feb 2, 2026
3644308
Use SVWN5 instead of ambiguous "LDA"
susilehtola Feb 2, 2026
6cc3e92
Merge branch 'master' into libxc
ilfreddy Feb 2, 2026
457aa2b
Fix formatting issue in helpers.py
ilfreddy Feb 2, 2026
ccea3bd
Eliminate unitialized variable warning
susilehtola Feb 2, 2026
5a07ca2
testkeyword lda -> svwn5 for libxc tests
ylvao Feb 3, 2026
b4bfcd7
for now use b3lyp5 from libxc as b3lyp
ylvao Feb 3, 2026
75da7b8
remove unused includes and debug prints
ylvao Feb 3, 2026
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
1 change: 1 addition & 0 deletions .github/mrchem-codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ dependencies:
- ninja
- nlohmann_json
- xcfun
- libxc
1 change: 1 addition & 0 deletions .github/mrchem-gha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ dependencies:
- ninja
- nlohmann_json
- xcfun
- libxc
1 change: 1 addition & 0 deletions cmake/custom/main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ set(_build_type ${CMAKE_BUILD_TYPE})
# Order IS important here!
include(${PROJECT_SOURCE_DIR}/external/upstream/fetch_nlohmann_json.cmake)
include(${PROJECT_SOURCE_DIR}/external/upstream/fetch_xcfun.cmake)
include(${PROJECT_SOURCE_DIR}/external/upstream/fetch_libxc.cmake)
include(${PROJECT_SOURCE_DIR}/external/upstream/fetch_eigen3.cmake)
include(${PROJECT_SOURCE_DIR}/external/upstream/fetch_mrcpp.cmake)
# reset CMAKE_BUILD_TYPE to whatever it was for MRChem
Expand Down
2 changes: 1 addition & 1 deletion doc/users/user_inp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ Here we specify the exchange-correlation functional used in DFT

DFT {
spin = false # Use spin-polarized functionals
density_cutoff = 0.0 # Cutoff to set XC potential to zero
density_cutoff = 1e-11 # Cutoff to set XC potential to zero
$functionals
<func1> 1.0 # Functional name and coefficient
<func2> 1.0 # Functional name and coefficient
Expand Down
2 changes: 1 addition & 1 deletion external/upstream/fetch_eigen3.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
find_package(Eigen3 CONFIG QUIET
find_package(Eigen3 3.4 CONFIG QUIET
NO_CMAKE_PATH
NO_CMAKE_PACKAGE_REGISTRY
)
Expand Down
36 changes: 36 additions & 0 deletions external/upstream/fetch_libxc.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
find_package(Libxc QUIET CONFIG)

if(TARGET Libxc::xc)
get_target_property(_loc Libxc::xc LOCATION)
message(STATUS "Libxc::xc: ${_loc} (found version ${Libxc_VERSION})")
else()
message(STATUS "Suitable LibXC could not be located. Fetching and building!")
include(FetchContent)
FetchContent_Declare(libxc_sources
GIT_REPOSITORY https://gitlab.com/libxc/libxc
GIT_TAG 7.0.0
)
set(CMAKE_INSTALL_INCLUDEDIR "include/" CACHE STRING "" FORCE) # Creates Libxc subdir in install
set(BUILD_TESTING OFF CACHE BOOL "Build LibXC tests" FORCE)
set(ENABLE_TESTS OFF CACHE BOOL "Enable LibXC tests" FORCE)
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build LibXC shared libs" FORCE)
set(ENABLE_FORTRAN OFF CACHE BOOL "Build LibXC Fortran bindings" FORCE)
set(DISABLE_FXC ON CACHE BOOL "Disable 2nd derivatives (Fxc)" FORCE)
set(DISABLE_KXC ON CACHE BOOL "Disable 3rd derivatives (Kxc)" FORCE)
set(DISABLE_LXC ON CACHE BOOL "Disable 4th derivatives (Lxc)" FORCE)

FetchContent_MakeAvailable(libxc_sources)

if(TARGET xc)
if(NOT TARGET Libxc::xc)
add_library(Libxc::xc ALIAS xc)
endif()

target_include_directories(xc
INTERFACE
$<BUILD_INTERFACE:${libxc_sources_SOURCE_DIR}/src>
$<BUILD_INTERFACE:${libxc_sources_BINARY_DIR}>
$<INSTALL_INTERFACE:include/Libxc>
)
endif()
endif()
15 changes: 15 additions & 0 deletions python/mrchem/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ def write_scf_fock(user_dict, wf_dict, origin):
},
}

# Exchange-Correlation library
if wf_dict["method_type"] in ["dft"]:
fock_dict["xc_library"] = user_dict["DFT"]["xc_library"],

# External electric field
if len(user_dict["ExternalFields"]["electric_field"]) > 0:
fock_dict["external_operator"] = {
Expand Down Expand Up @@ -249,6 +253,8 @@ def write_scf_guess(user_dict, wf_dict):
"file_CUBE_p": f"{vector_dir}CUBE_p_vector.json",
"file_CUBE_a": f"{vector_dir}CUBE_a_vector.json",
"file_CUBE_b": f"{vector_dir}CUBE_b_vector.json",
"xc_library": user_dict["DFT"]["xc_library"],
"cutoff": user_dict["DFT"]["density_cutoff"],
}
return guess_dict

Expand Down Expand Up @@ -279,6 +285,7 @@ def write_scf_solver(user_dict, wf_dict):
"energy_thrs": scf_dict["energy_thrs"],
"orbital_thrs": scf_dict["orbital_thrs"],
"helmholtz_prec": user_dict["Precisions"]["helmholtz_prec"],
"xc_library": user_dict["DFT"]["xc_library"],
"deltascf_method": scf_dict["deltascf_method"],
}

Expand Down Expand Up @@ -466,6 +473,12 @@ def write_rsp_fock(user_dict, wf_dict):
},
}

# Exchange-Correlation library
if wf_dict["method_type"] in ["dft"]:
fock_dict["xc_library"] = {
"xc_library": user_dict["DFT"]["xc_library"],
}

# Reaction
if user_dict["WaveFunction"]["environment"].lower() != "none":
fock_dict["reaction_operator"] = _reaction_operator_handler(user_dict, rsp=True)
Expand Down Expand Up @@ -496,6 +509,8 @@ def write_rsp_solver(user_dict, wf_dict, d):
"property_thrs": user_dict["Response"]["property_thrs"],
"helmholtz_prec": user_dict["Precisions"]["helmholtz_prec"],
"orth_prec": 1.0e-14,
"xc_library": user_dict["DFT"]["xc_library"],
"cutoff": user_dict["DFT"]["density_cutoff"],
}
return solver_dict

Expand Down
11 changes: 9 additions & 2 deletions python/mrchem/input_parser/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,15 +338,22 @@ def stencil() -> JSONDict:
'name': 'azora_potential_path',
'type': 'str'}],
'name': 'ZORA'},
{ 'keywords': [ { 'default': 0.0,
{ 'keywords': [ { 'default': 1e-11,
'name': 'density_cutoff',
'type': 'float'},
{ 'default': ' ',
'name': 'functionals',
'type': 'str'},
{ 'default': "not(user['WaveFunction']['restricted'])",
'name': 'spin',
'type': 'bool'}],
'type': 'bool'},
# { 'default': True,
# 'name': 'libxc',
# 'type': 'bool'}
{ 'default': 'xcfun',
'name': 'xc_library',
'type': 'str'}
],
'name': 'DFT'},
{ 'keywords': [ { 'default': True,
'name': 'dipole_moment',
Expand Down
5 changes: 5 additions & 0 deletions python/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,11 @@ sections:
default: 0.0
docstring: |
Hard cutoff for passing density values to XCFun.
- name: xc_library
type: str
default: xcfun
docstring: |
Runs Libxc or XCFun
- name: functionals
type: str
default: ' '
Expand Down
1 change: 1 addition & 0 deletions setup
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def gen_cmake_command(options, arguments):
command.append('-DENABLE_MPI={0}'.format(arguments['--mpi']))
command.append('-DENABLE_OPENMP={0}'.format(arguments['--omp']))
command.append('-DCMAKE_BUILD_TYPE={0}'.format(arguments['--type']))
command.append('-DCMAKE_POLICY_VERSION_MINIMUM=3.5')
command.append('-G"{0}"'.format(arguments['--generator']))
if arguments['--cmake-options'] != "''":
command.append(arguments['--cmake-options'])
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ target_link_libraries(mrchem
PRIVATE
Eigen3::Eigen
PUBLIC
Libxc::xc
XCFun::xcfun
MRCPP::mrcpp
nlohmann_json::nlohmann_json
Expand Down
30 changes: 30 additions & 0 deletions src/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <MRCPP/MWOperators>
#include <MRCPP/Printer>
#include <MRCPP/Timer>
#include <mrdft/MRDFT.h> // libxc debug

#include "driver.h"
#include <filesystem>
Expand Down Expand Up @@ -248,6 +249,15 @@ json driver::scf::run(const json &json_scf, Molecule &mol) {
json json_out = {{"success", true}};
if (json_scf.contains("properties")) driver::init_properties(json_scf["properties"], mol);

///////////////////////////////////////////////////////////
////////////////// Setting XC Library //////////////////
///////////////////////////////////////////////////////////
std::string xc_lib;

if (json_scf["fock_operator"].contains("xc_library")) {
xc_lib = json_scf["fock_operator"]["xc_library"][0].get<std::string>();
} else {xc_lib = "xcfun";}

///////////////////////////////////////////////////////////
//////////////// Building Fock Operator ///////////////
///////////////////////////////////////////////////////////
Expand Down Expand Up @@ -312,6 +322,7 @@ json driver::scf::run(const json &json_scf, Molecule &mol) {
solver.setRotation(rotation);
solver.setLocalize(localize);
solver.setMethodName(method);
solver.setLibxc((xc_lib == "libxc") ? true : false);
solver.setRelativityName(relativity);
solver.setEnvironmentName(environment);
solver.setExternalFieldName(external_field);
Expand Down Expand Up @@ -507,14 +518,18 @@ bool driver::scf::guess_energy(const json &json_guess, Molecule &mol, FockBuilde
auto external_field = json_guess["external_field"];
auto localize = json_guess["localize"];
auto rotate = json_guess["rotate"];
std::string xc_lib = json_guess["xc_library"].get<std::string>();
auto cutoff = json_guess["cutoff"];

mrcpp::print::separator(0, '~');
print_utils::text(0, "Calculation ", "Compute initial energy");
print_utils::text(0, "Method ", method);
print_utils::text(0, "XC Library ", (xc_lib == "libxc") ? "LibXC" : "XCFun");
print_utils::text(0, "Relativity ", relativity);
print_utils::text(0, "Environment ", environment);
print_utils::text(0, "External fields", external_field);
print_utils::text(0, "Precision ", print_utils::dbl_to_str(prec, 5, true));
print_utils::text(0, "Density cutoff ", print_utils::dbl_to_str(cutoff, 5, true));
print_utils::text(0, "Localization ", (localize) ? "On" : "Off");
mrcpp::print::separator(0, '~', 2);

Expand Down Expand Up @@ -1343,9 +1358,21 @@ void driver::build_fock_operator(const json &json_fock, Molecule &mol, FockBuild
auto xc_cutoff = json_xcfunc["cutoff"];
auto xc_funcs = json_xcfunc["functionals"];
auto xc_order = order + 1;
// TODO: Look over and input parser so this is not necessary
std::string xc_lib;
if (json_fock.contains("xc_library")) {
if(json_fock["xc_library"].is_array()){
xc_lib = json_fock["xc_library"][0].get<std::string>();
}else{
xc_lib = json_fock["xc_library"]["xc_library"].get<std::string>();
}
}else{
xc_lib = "xcfun";
}

mrdft::Factory xc_factory(*MRA);
xc_factory.setSpin(xc_spin);
xc_factory.setLibxc((xc_lib == "libxc") ? true : false);
xc_factory.setOrder(xc_order);
xc_factory.setDensityCutoff(xc_cutoff);
for (const auto &f : xc_funcs) {
Expand All @@ -1354,6 +1381,9 @@ void driver::build_fock_operator(const json &json_fock, Molecule &mol, FockBuild
xc_factory.setFunctional(name, coef);
}
auto mrdft_p = xc_factory.build();

mrdft_p->functional().print_functional_references();

exx = mrdft_p->functional().amountEXX();

if (order == 0) {
Expand Down
14 changes: 8 additions & 6 deletions src/initial_guess/sad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ bool initial_guess::sad::setup(OrbitalVector &Phi, double prec, double screen, c
print_utils::text(0, "Screening ", print_utils::dbl_to_str(screen, 5, true) + " StdDev");
print_utils::text(0, "Restricted ", (restricted) ? "True" : "False");
print_utils::text(0, "Functional ", "LDA (SVWN5)");
print_utils::text(0, "XC Library ", (mrdft::Factory::libxc) ? "LibXC" : "XCFun");
print_utils::text(0, "AO basis ", "Hydrogenic orbitals");
print_utils::text(0, "Zeta quality", std::to_string(zeta));
mrcpp::print::separator(0, '~', 2);
Expand All @@ -90,8 +91,8 @@ bool initial_guess::sad::setup(OrbitalVector &Phi, double prec, double screen, c
MomentumOperator p(D_p);
NuclearOperator V_nuc(nucs, prec);
CoulombOperator J(P_p);
XCOperator XC(mrdft_p);
RankZeroOperator V = V_nuc + J + XC;
XCOperator XC_(mrdft_p);
RankZeroOperator V = V_nuc + J + XC_;

auto plevel = Printer::getPrintLevel();
if (plevel == 1) mrcpp::print::header(1, "SAD Initial Guess");
Expand All @@ -103,7 +104,7 @@ bool initial_guess::sad::setup(OrbitalVector &Phi, double prec, double screen, c
initial_guess::sad::project_atomic_densities(prec, rho_j, nucs, screen);

// Compute XC density
Density &rho_xc = XC.getDensity(DensityType::Total);
Density &rho_xc = XC_.getDensity(DensityType::Total);
mrcpp::deep_copy(rho_xc, rho_j);
if (plevel == 1) mrcpp::print::time(1, "Projecting GTO density", t_lap);

Expand Down Expand Up @@ -151,6 +152,7 @@ bool initial_guess::sad::setup(OrbitalVector &Phi, double prec, double screen, c
print_utils::text(0, "Screening ", print_utils::dbl_to_str(screen, 5, true) + " StdDev");
print_utils::text(0, "Restricted ", (restricted) ? "True" : "False");
print_utils::text(0, "Functional ", "LDA (SVWN5)");
print_utils::text(0, "XC Library ", (mrdft::Factory::libxc) ? "LibXC" : "XCFun");
print_utils::text(0, "AO basis ", "3-21G");
mrcpp::print::separator(0, '~', 2);

Expand All @@ -167,8 +169,8 @@ bool initial_guess::sad::setup(OrbitalVector &Phi, double prec, double screen, c
MomentumOperator p(D_p);
NuclearOperator V_nuc(nucs, prec);
CoulombOperator J(P_p);
XCOperator XC(mrdft_p);
RankZeroOperator V = V_nuc + J + XC;
XCOperator XC_(mrdft_p);
RankZeroOperator V = V_nuc + J + XC_;

auto plevel = Printer::getPrintLevel();
if (plevel == 1) mrcpp::print::header(1, "SAD Initial Guess");
Expand All @@ -180,7 +182,7 @@ bool initial_guess::sad::setup(OrbitalVector &Phi, double prec, double screen, c
initial_guess::sad::project_atomic_densities(prec, rho_j, nucs, screen);

// Compute XC density
Density &rho_xc = XC.getDensity(DensityType::Total);
Density &rho_xc = XC_.getDensity(DensityType::Total);
mrcpp::deep_copy(rho_xc, rho_j);
if (plevel == 1) mrcpp::print::time(1, "Projecting GTO density", t_lap);

Expand Down
Loading
Loading