Skip to content

Commit

Permalink
cavity function used directly instead of projected first (#458)
Browse files Browse the repository at this point in the history
* cavity function used directly instead of projected first

* clear d_V

* Update SCRF.cpp 

define ranks in accelerator, so that all mpi ranks use kain

* cavity function used directly instead of projected first

* clear d_V

* Update SCRF.cpp 

define ranks in accelerator, so that all mpi ranks use kain

* manage to pull down to 12.2 and 30.0 gb

* reduced memory usage to ca. 3 gb from 8 gb

* Remove print statement for memory

* Small changes to desctructor and clear

* Use latest MRCPP

* Use default initialization in header file

* Do some cleaning after feedback

* Remove ´optimizer´ option from inputs

* Fix tests

---------

Co-authored-by: Roberto Di Remigio Eikås <[email protected]>
Co-authored-by: Gabrielgerez <[email protected]>
  • Loading branch information
3 people authored Nov 2, 2023
1 parent e0ea9c9 commit f0d0560
Show file tree
Hide file tree
Showing 16 changed files with 185 additions and 303 deletions.
9 changes: 0 additions & 9 deletions doc/users/user_ref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -845,15 +845,6 @@ User input reference

**Default** ``True``

:optimizer: Choose which function to use in the KAIN solver, the surface charge ``density`` (gamma) or the reaction ``potential`` (V_R).

**Type** ``str``

**Default** ``potential``

**Predicates**
- ``value.lower() in ['density', 'potential']``

:density_type: What part of the total molecular charge density to use in the algorithm. ``total`` uses the total charge density. ``nuclear`` uses only the nuclear part of the total charge density. ``electronic`` uses only the electronic part of the total charge density.

**Type** ``str``
Expand Down
2 changes: 1 addition & 1 deletion external/upstream/fetch_mrcpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ else()
GIT_REPOSITORY
https://github.com/MRChemSoft/mrcpp.git
GIT_TAG
a3618d1498410124ec47bef777adf8b50a7e71b0
f8def0a086da6410e5dd8e078de4f6b6305b6ea3
)

FetchContent_GetProperties(mrcpp_sources)
Expand Down
1 change: 0 additions & 1 deletion python/mrchem/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def write_scf_fock(user_dict, wf_dict, origin):
"poisson_prec": user_dict["world_prec"],
"kain": user_dict["PCM"]["SCRF"]["kain"],
"max_iter": user_dict["PCM"]["SCRF"]["max_iter"],
"optimizer": user_dict["PCM"]["SCRF"]["optimizer"],
"dynamic_thrs": user_dict["PCM"]["SCRF"]["dynamic_thrs"],
"density_type": user_dict["PCM"]["SCRF"]["density_type"],
"epsilon_in": user_dict["PCM"]["Permittivity"]["epsilon_in"],
Expand Down
9 changes: 1 addition & 8 deletions python/mrchem/input_parser/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

# This file was automatically generated by parselglossy on 2023-09-25
# This file was automatically generated by parselglossy on 2023-10-30
# Editing is *STRONGLY DISCOURAGED*

from copy import deepcopy
Expand Down Expand Up @@ -572,13 +572,6 @@ def stencil() -> JSONDict:
{ 'default': True,
'name': 'dynamic_thrs',
'type': 'bool'},
{ 'default': 'potential',
'name': 'optimizer',
'predicates': [ 'value.lower() '
'in '
"['density', "
"'potential']"],
'type': 'str'},
{ 'default': 'total',
'name': 'density_type',
'predicates': [ 'value.lower() '
Expand Down
9 changes: 0 additions & 9 deletions python/mrchem/input_parser/docs/user_ref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -845,15 +845,6 @@ User input reference

**Default** ``True``

:optimizer: Choose which function to use in the KAIN solver, the surface charge ``density`` (gamma) or the reaction ``potential`` (V_R).

**Type** ``str``

**Default** ``potential``

**Predicates**
- ``value.lower() in ['density', 'potential']``

:density_type: What part of the total molecular charge density to use in the algorithm. ``total`` uses the total charge density. ``nuclear`` uses only the nuclear part of the total charge density. ``electronic`` uses only the electronic part of the total charge density.

**Type** ``str``
Expand Down
8 changes: 0 additions & 8 deletions python/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -828,14 +828,6 @@ sections:
are close to convergence (``mo_residual < world_prec*10``) the convergence
threshold will be set equal to ``world_prec``.
``false`` uses ``world_prec`` as convergence threshold throughout.
- name: optimizer
type: str
default: potential
predicates:
- value.lower() in ['density', 'potential']
docstring: |
Choose which function to use in the KAIN solver, the surface charge ``density``
(gamma) or the reaction ``potential`` (V_R).
- name: kain
type: int
default: user['SCF']['kain']
Expand Down
7 changes: 4 additions & 3 deletions src/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "utils/math_utils.h"
#include "utils/print_utils.h"

#include "chemistry/chemistry_utils.h"
#include "qmfunctions/Density.h"
#include "qmfunctions/Orbital.h"
#include "qmfunctions/density_utils.h"
Expand Down Expand Up @@ -1050,18 +1051,18 @@ void driver::build_fock_operator(const json &json_fock, Molecule &mol, FockBuild

auto kain = json_fock["reaction_operator"]["kain"];
auto max_iter = json_fock["reaction_operator"]["max_iter"];
auto optimizer = json_fock["reaction_operator"]["optimizer"];
auto dynamic_thrs = json_fock["reaction_operator"]["dynamic_thrs"];
auto density_type = json_fock["reaction_operator"]["density_type"];
auto eps_i = json_fock["reaction_operator"]["epsilon_in"];
auto eps_o = json_fock["reaction_operator"]["epsilon_out"];
auto formulation = json_fock["reaction_operator"]["formulation"];
auto accelerate_pot = (optimizer == "potential") ? true : false;

Permittivity dielectric_func(*cavity_p, eps_i, eps_o, formulation);
dielectric_func.printParameters();
Density rho_nuc(false);
rho_nuc = chemistry::compute_nuclear_density(poisson_prec, nuclei, 100);

auto scrf_p = std::make_unique<SCRF>(dielectric_func, nuclei, P_p, D_p, poisson_prec, kain, max_iter, accelerate_pot, dynamic_thrs, density_type);
auto scrf_p = std::make_unique<SCRF>(dielectric_func, rho_nuc, P_p, D_p, kain, max_iter, dynamic_thrs, density_type);
auto V_R = std::make_shared<ReactionOperator>(std::move(scrf_p), Phi_p);
F.getReactionOperator() = V_R;
}
Expand Down
Loading

0 comments on commit f0d0560

Please sign in to comment.