Skip to content

Commit 3652287

Browse files
authored
Merge branch 'master' into programmers-docs
2 parents 7d20183 + ae09736 commit 3652287

File tree

304 files changed

+43249
-879
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

304 files changed

+43249
-879
lines changed

.github/workflows/build-test.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
runs-on: ${{ matrix.os }}
2222
strategy:
2323
matrix:
24+
# setup-miniconda not compatible with macos-latest presently.
25+
# https://github.com/conda-incubator/setup-miniconda/issues/344
2426
os: [ubuntu-latest, macos-12]
2527

2628
steps:
@@ -35,7 +37,7 @@ jobs:
3537
key:
3638
${{ matrix.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('.github/mrchem-gha.yml') }}
3739

38-
- uses: conda-incubator/setup-miniconda@v2
40+
- uses: conda-incubator/setup-miniconda@v3
3941
with:
4042
auto-update-conda: true
4143
auto-activate-base: false

CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ include(${PROJECT_SOURCE_DIR}/cmake/downloaded/autocmake_code_coverage.cmake)
5858
include(${PROJECT_SOURCE_DIR}/cmake/custom/mpi.cmake)
5959
include(${PROJECT_SOURCE_DIR}/cmake/custom/omp.cmake)
6060
include(${PROJECT_SOURCE_DIR}/cmake/custom/sad_basis.cmake)
61+
include(${PROJECT_SOURCE_DIR}/cmake/custom/hirshfeld.cmake)
62+
include(${PROJECT_SOURCE_DIR}/cmake/custom/azora_potentials.cmake)
6163
include(${PROJECT_SOURCE_DIR}/cmake/custom/main.cmake)
6264
include(${PROJECT_SOURCE_DIR}/cmake/custom/feature_summary.cmake)
6365
include(${PROJECT_SOURCE_DIR}/cmake/custom/tests.cmake)

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ chemistry (Hartree-Fock and Density Functional Theory).
1414
The code is being developed at the Hylleraas Centre for Quantum Molecular
1515
Sciences at UiT - The Arctic University of Norway.
1616

17-
### User support: [mrchem.slack.com](https://join.slack.com/t/mrchem/shared_invite/enQtNTI3MjMzNjM0NTk0LWNkODZjNTMwYmM4NmRmODExMjQzMDc3NThlMzNmNmIyNWQwM2YwOGY0OWY4NmNmNzE4ZmM2NzgxYzUzNDg3NDM)
1817
### Documentation: [mrchem.readthedocs.io](http://mrchem.readthedocs.io)
1918

2019

cmake/custom/azora_potentials.cmake

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
set(AZORA_POTENTIALS_SOURCE_DIR ${PROJECT_SOURCE_DIR}/share/azora_potentials CACHE STRING "Path to azora potentials")
2+
set(AZORA_POTENTIALS_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/azora_potentials)
3+
install(
4+
DIRECTORY share/azora_potentials
5+
DESTINATION share/${PROJECT_NAME}
6+
)
7+

cmake/custom/hirshfeld.cmake

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
set(HIRSHFELD_SOURCE_DIR ${PROJECT_SOURCE_DIR}/share/hirshfeld CACHE STRING "Path to azora potentials")
3+
set(HIRSHFELD_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/hirshfeld)
4+
install(
5+
DIRECTORY share/hirshfeld
6+
DESTINATION share/${PROJECT_NAME}
7+
)

doc/users/schema_input.json

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
"zeta": int, # Zeta quality for AO basis
102102
"method": string, # Name of method for initial energy
103103
"localize": bool, # Use localized orbitals
104+
"rotate": bool, # Rotate orbitals in initial guess
104105
"restricted": bool, # Use spin restricted orbitals
105106
"relativity": string, # Name of relativistic method
106107
"screen": float, # Screening used in GTO evaluations

doc/users/user_inp.rst

+1
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ The ``core`` and ``sad`` guesses are fully specified with the following keywords
449449
guess_prec = 1.0e-3 # Numerical precision used in guess
450450
guess_type = sad_gto # Type of inital guess (chk, mw, cube, core_XX, sad_XX)
451451
guess_screen = 12.0 # Number of StdDev before a GTO is set to zero (sad_gto)
452+
guess_rotate = true # Localize/Diagonalize guess orbitals before calculating the initial guess energy
452453
}
453454
454455
Checkpointing

doc/users/user_ref.rst

+52-7
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,13 @@ User input reference
231231

232232
**Default** ``-1``
233233

234-
:omp_threads: Force the number of OpenMP threads.
235-
234+
:omp_threads: Force the number of omp threads (leave default is better).
235+
236236
**Type** ``int``
237-
237+
238238
**Default** ``-1``
239-
240-
:Basis: Define polynomial basis.
239+
240+
:Basis: Define polynomial basis.
241241

242242
:red:`Keywords`
243243
:order: Polynomial order of multiwavelet basis. Negative value means it will be set automatically based on the world precision.
@@ -326,14 +326,14 @@ User input reference
326326

327327
**Default** ``True``
328328

329-
:relativity: Set method for relativistic treatment. ``ZORA`` for fully self-consistent ZORA potential, by default including all potentials (``V_nuc``, ``J``, ``V_xc``) but this can be overwritten in the ``ZORA`` section. ``nZORA`` is shortcut for nuclear-ZORA, i.e. only ``V_nuc`` is included (this keyword takes precedence over keywords in the ``ZORA`` section).
329+
:relativity: Set method for relativistic treatment. ``ZORA`` for fully self-consistent ZORA potential, by default including all potentials (``V_nuc``, ``J``, ``V_xc``) but this can be overwritten in the ``ZORA`` section. ``nZORA`` is shortcut for nuclear-ZORA, i.e. only ``V_nuc`` is included (this keyword takes precedence over keywords in the ``ZORA`` section). ``azora`` uses atomic ZORA potentials, which are precomputed and read from the directory specified in the ``azora_potential_path`` keyword.
330330

331331
**Type** ``str``
332332

333333
**Default** ``none``
334334

335335
**Predicates**
336-
- ``value.lower() in ['none', 'zora', 'nzora']``
336+
- ``value.lower() in ['none', 'zora', 'nzora', 'azora']``
337337

338338
:environment: Set method for treatment of environment. ``none`` for vacuum calculation. ``PCM`` for Polarizable Continuum Model, which will activate the ``PCM`` input section for further parametrization options. The ``PB`` and ``LPB`` variants add the Poisson-Boltzmann and Linearized Poisson-Boltzmann solvers, respectively.
339339

@@ -374,6 +374,12 @@ User input reference
374374

375375
**Default** ``True``
376376

377+
:azora_potential_path: Path to the directory containing the AZORA potentials. If not specified, the default potentials will be used. Look into the readme file in the share/azora_potentials directory for information about the potential file format.
378+
379+
**Type** ``str``
380+
381+
**Default** ``none``
382+
377383
:DFT: Define the exchange-correlation functional in case of DFT.
378384

379385
:red:`Keywords`
@@ -440,12 +446,45 @@ User input reference
440446

441447
**Default** ``[]``
442448

449+
:hirshfeld_charges: Compute Hirshfeld charges.
450+
451+
**Type** ``bool``
452+
453+
**Default** ``False``
454+
443455
:geometric_derivative: Compute geometric derivative.
444456

445457
**Type** ``bool``
446458

447459
**Default** ``user['GeometryOptimizer']['run']``
448460

461+
:Forces: Define parameters for the computation of forces.
462+
463+
:red:`Keywords`
464+
:method: Method for computing forces. ``surface_integrals`` (more accurate) uses surface integrals over the quantum mechanical stress tensor, while ``hellmann_feynman`` uses the Hellmann-Feynman theorem.
465+
466+
**Type** ``str``
467+
468+
**Default** ``surface_integrals``
469+
470+
**Predicates**
471+
- ``value.lower() in ['surface_integrals', 'hellmann_feynman']``
472+
473+
:surface_integral_precision: Precision of the surface integrals used in the computation of forces. Determines the number of Lebedev grid points used in the surface integration.
474+
475+
**Type** ``str``
476+
477+
**Default** ``medium``
478+
479+
**Predicates**
480+
- ``value.lower() in ['low', 'medium', 'high']``
481+
482+
:radius_factor: Sets the radius of the surface used in the computation of forces. The radius is given by this factor times the distance to the neariest neighbour. Must be between 0.1 and 0.9. This should rarely need to be changed. Different values can change the accuracy of the forces.
483+
484+
**Type** ``float``
485+
486+
**Default** ``0.5``
487+
449488
:ExternalFields: Define external electromagnetic fields.
450489

451490
:red:`Keywords`
@@ -722,6 +761,12 @@ User input reference
722761
**Predicates**
723762
- ``value[-1] != '/'``
724763

764+
:guess_rotate: Localize/Diagonalize the initial guess orbitals before calculating the initial guess energy.
765+
766+
**Type** ``bool``
767+
768+
**Default** ``True``
769+
725770
:write_orbitals: Write final orbitals to disk, file name ``<path_orbitals>/phi_<p/a/b>_scf_idx_<0..Np/Na/Nb>``. Can be used as ``mw`` initial guess in subsequent calculations.
726771

727772
**Type** ``bool``

python/README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ To run the script:
1212

1313
```bash
1414
$ cd python/mrchem
15+
$ rm -r input_parser/plumbing/pyparsing
1516
$ python update_input_parser.py
1617
```
1718

@@ -24,7 +25,7 @@ This does three things:
2425
Each of these steps can be deactivated by appropriate flags. For help on running the script, run
2526

2627
```bash
27-
$ cd python
28+
$ cd python/mrchem
2829
$ python update_input_parser.py -h
2930
```
3031

@@ -33,7 +34,8 @@ If the `Constants` and `Elements` input sections are unchanged, you can update t
3334
The utility script can also do this, by specifying the flag `--skip-template`:
3435

3536
```bash
36-
$ cd python
37+
$ cd python/mrchem
38+
$ rm -r input_parser/plumbing/pyparing
3739
$ python update_input_parser --skip-template
3840
```
3941

@@ -43,6 +45,7 @@ You can also perform these steps manually without using the utility script:
4345

4446
```bash
4547
$ cd python
48+
$ rm -r mrchem/input_parser/plumbing/pyparsing
4649
$ parselglossy generate --template template.yml --docfile user_ref.rst --doc-header="User input reference" --target="mrchem/input_parser"
4750
$ cp mrchem/input_parser/docs/user_ref.rst ../doc/users/user_ref.rst
4851
```

python/mrchem/helpers.py

+42-13
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,19 @@ def write_scf_fock(user_dict, wf_dict, origin):
5959
"include_nuclear": user_dict["ZORA"]["include_nuclear"],
6060
"include_coulomb": user_dict["ZORA"]["include_coulomb"],
6161
"include_xc": user_dict["ZORA"]["include_xc"],
62+
"isAZORA": False,
63+
"azora_potential_path": user_dict["ZORA"]["azora_potential_path"]
6264
}
65+
# AZORA
66+
if user_dict["WaveFunction"]["relativity"].lower() == "azora":
67+
fock_dict["zora_operator"] = {
68+
"include_nuclear": False,
69+
"include_coulomb": False,
70+
"include_xc": False,
71+
"isAZORA": True
72+
}
73+
if user_dict["ZORA"]["azora_potential_path"].lower() != "none":
74+
fock_dict["zora_operator"]["azora_potential_path"] = user_dict["ZORA"]["azora_potential_path"]
6375

6476
# Kinetic
6577
fock_dict["kinetic_operator"] = {"derivative": user_dict["Derivatives"]["kinetic"]}
@@ -224,6 +236,7 @@ def write_scf_guess(user_dict, wf_dict):
224236
"external_field": wf_dict["external_name"],
225237
"screen": scf_dict["guess_screen"],
226238
"localize": scf_dict["localize"],
239+
"rotate": scf_dict["guess_rotate"],
227240
"restricted": user_dict["WaveFunction"]["restricted"],
228241
"file_chk": f"{scf_dict['path_checkpoint']}/phi_scf",
229242
"file_basis": file_dict["guess_basis"],
@@ -274,7 +287,7 @@ def write_scf_solver(user_dict, wf_dict):
274287
def write_scf_properties(user_dict, origin):
275288
prop_dict = {}
276289
if user_dict["Properties"]["dipole_moment"]:
277-
prop_dict["dipole_moment"] = {}
290+
prop_dict["dipole_moment"] = {}
278291
prop_dict["dipole_moment"]["dip-1"] = {
279292
"operator": "h_e_dip",
280293
"precision": user_dict["world_prec"],
@@ -293,7 +306,16 @@ def write_scf_properties(user_dict, origin):
293306
"operator": "h_nuc_grad",
294307
"precision": user_dict["world_prec"],
295308
"smoothing": user_dict["Precisions"]["nuclear_prec"],
309+
"method": user_dict["Forces"]["method"],
310+
"surface_integral_precision": user_dict["Forces"]["surface_integral_precision"],
311+
"radius_factor": user_dict["Forces"]["radius_factor"],
312+
}
313+
if user_dict["Properties"]["hirshfeld_charges"]:
314+
prop_dict["hirshfeld_charges"] = {}
315+
prop_dict["hirshfeld_charges"]["hirshfeld-1"] = {
316+
'precision': user_dict["world_prec"]
296317
}
318+
297319
return prop_dict
298320

299321

@@ -506,12 +528,21 @@ def parse_wf_method(user_dict):
506528

507529
# Determine relativity name label for print outs to the output file
508530
relativity_name = "None"
531+
wf_dict = dict()
509532
if user_dict["WaveFunction"]["relativity"].lower() in ["none"]:
510533
user_dict["WaveFunction"]["relativity"] = "off"
511534
user_dict["ZORA"]["include_nuclear"] = False
512535
user_dict["ZORA"]["include_coulomb"] = False
513536
user_dict["ZORA"]["include_xc"] = False
514537

538+
if user_dict["WaveFunction"]["relativity"].lower() in ["azora"]:
539+
relativity_name = "AZORA"
540+
user_dict["WaveFunction"]["relativity"] = "azora"
541+
user_dict["ZORA"]["include_nuclear"] = False
542+
user_dict["ZORA"]["include_coulomb"] = False
543+
user_dict["ZORA"]["include_xc"] = False
544+
user_dict["ZORA"]["isAZORA"] = True
545+
515546
if user_dict["WaveFunction"]["relativity"].lower() in ["nzora"]:
516547
user_dict["WaveFunction"]["relativity"] = "zora"
517548
user_dict["ZORA"]["include_nuclear"] = True
@@ -534,10 +565,10 @@ def parse_wf_method(user_dict):
534565
else:
535566
raise RuntimeError("ZORA selected, but no ZORA potential included")
536567

537-
if user_dict["ZORA"]["include_xc"] and not restricted:
538-
raise RuntimeError(
539-
"ZORA (V_xc) not available for unrestricted wavefunctions"
540-
)
568+
# if user_dict["ZORA"]["include_xc"] and not restricted:
569+
# raise RuntimeError(
570+
# "ZORA (V_xc) not available for unrestricted wavefunctions"
571+
# )
541572

542573
# Determine environment name label for print outs to the output file
543574
environment_name = "None"
@@ -560,14 +591,12 @@ def parse_wf_method(user_dict):
560591
# Labels to aggregate
561592
external_name = f"Electric field ({x}, {y}, {z})"
562593

563-
wf_dict = {
564-
"relativity_name": relativity_name,
565-
"environment_name": environment_name,
566-
"external_name": external_name,
567-
"method_name": method_name,
568-
"method_type": method_type,
569-
"dft_funcs": dft_funcs,
570-
}
594+
wf_dict["relativity_name"] = relativity_name
595+
wf_dict["environment_name"] = environment_name
596+
wf_dict["external_name"] = external_name
597+
wf_dict["method_name"] = method_name
598+
wf_dict["method_type"] = method_type
599+
wf_dict["dft_funcs"] = dft_funcs
571600
return wf_dict
572601

573602

python/mrchem/input_parser/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
This file was automatically generated by parselglossy on 2024-01-29
1+
This file was automatically generated by parselglossy on 2024-08-15
22
Editing is *STRONGLY DISCOURAGED*
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# -*- coding: utf-8 -*-
22

3-
# This file was automatically generated by parselglossy on 2024-01-29
3+
# This file was automatically generated by parselglossy on 2024-08-15
44
# Editing is *STRONGLY DISCOURAGED*

0 commit comments

Comments
 (0)