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

Surface forces #488

Open
wants to merge 102 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 93 commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
b498633
density wrong
moritzgubler Apr 16, 2024
ac6dd6d
better plots
moritzgubler Apr 16, 2024
ba79c2c
add new directory
moritzgubler Apr 17, 2024
c341527
add docs
moritzgubler Apr 17, 2024
0c65c1d
add header
moritzgubler Apr 17, 2024
d3fec08
move stuff around
moritzgubler Apr 17, 2024
dba6fd8
it compiles
moritzgubler Apr 17, 2024
2eee72b
maxwell test running
moritzgubler Apr 17, 2024
45a809b
maxwell stress correct
moritzgubler Apr 17, 2024
5182024
xc extraction working
moritzgubler Apr 19, 2024
25a412c
add hessian operator
moritzgubler Apr 22, 2024
84b1d0f
add test for kinetic stress
moritzgubler Apr 22, 2024
944ff7f
add other template
moritzgubler Apr 22, 2024
69a3990
change types
moritzgubler Apr 22, 2024
6a6b6d9
working for tiny radius
moritzgubler Apr 22, 2024
139649f
surface force working for one orbital
moritzgubler Apr 23, 2024
dac3be0
cleanup surface force function
moritzgubler Apr 23, 2024
ba24584
multiple orbitals fix
moritzgubler Apr 23, 2024
9115c52
delete unused stuff
moritzgubler Apr 23, 2024
ff7a1ce
prepare for tests
moritzgubler Apr 23, 2024
e402bbc
more points
moritzgubler Apr 23, 2024
0cf22e0
switch to surface forces and debug info
moritzgubler Apr 23, 2024
ea6e9f8
fix initialization of nabla
moritzgubler Apr 24, 2024
90ad7c7
add check
moritzgubler Apr 24, 2024
9dfc7ba
reduce number of grid points
moritzgubler Apr 24, 2024
2978a21
average over different radii
moritzgubler Apr 24, 2024
7b0f913
more averaging
moritzgubler Apr 24, 2024
098b59c
pass operators
moritzgubler Apr 25, 2024
41fc2d3
add timer
moritzgubler Apr 25, 2024
f52ed1e
better radii
moritzgubler Apr 25, 2024
25109bd
add auto radius
moritzgubler May 1, 2024
88df4a8
break symmetry
moritzgubler May 1, 2024
2c26116
make sqnm energy free
moritzgubler May 1, 2024
fa73276
choose better radii
moritzgubler May 1, 2024
9e0706f
make radii more random
moritzgubler May 2, 2024
3e8ca93
less radii
moritzgubler May 2, 2024
6a7c4cc
add lebvedev shift integration
moritzgubler May 5, 2024
9aca8e2
larger tiny radius
moritzgubler May 5, 2024
eca0860
more moderate smoothing
moritzgubler May 6, 2024
5836292
more points
moritzgubler May 6, 2024
635ef12
make forces faster
moritzgubler May 10, 2024
d9e2d27
start work on finite nucleus
moritzgubler May 12, 2024
6905b7b
fix typo
moritzgubler May 31, 2024
b07e4a8
update template and helper
moritzgubler May 31, 2024
609e6c7
automatic changes
moritzgubler May 31, 2024
d612212
adjust driver
moritzgubler May 31, 2024
53bc18c
pass new parameters to code
moritzgubler May 31, 2024
18e5f47
add linebreaks
moritzgubler May 31, 2024
668402a
input mech not yet working
moritzgubler Jun 4, 2024
fc14ee6
fix all bugs
moritzgubler Jun 5, 2024
ae36e91
new lebvedev files
moritzgubler Jun 5, 2024
2f4d6f8
add noise estimation
moritzgubler Jun 5, 2024
947e5f5
remove old comment
moritzgubler Jun 5, 2024
cdc41de
use parameters from input file
moritzgubler Jun 5, 2024
623cd2d
move lebvedev files to share
moritzgubler Jun 5, 2024
9fbf0a3
install lebvedev data files and pass their location to source code in…
moritzgubler Jun 5, 2024
d34cb31
adjust paths
moritzgubler Jun 5, 2024
3f613be
use fewer lebvedev points
moritzgubler Jun 5, 2024
5abc1e4
add new parameter
moritzgubler Jun 6, 2024
d8d858e
convert matrix to vector
moritzgubler Jun 6, 2024
947b012
add finite nucleus but do not use it.
moritzgubler Jun 6, 2024
35ec6be
Merge branch 'master' into surface_forces
moritzgubler Jun 12, 2024
44b016d
remove unused includes
moritzgubler Jun 12, 2024
349becf
add more documentation
moritzgubler Jun 12, 2024
9c8a73a
remove typo
moritzgubler Jul 17, 2024
6b9ffc9
fix typo in doc
moritzgubler Jul 17, 2024
07decab
add lebvedev data
moritzgubler Jul 17, 2024
35e866c
add meta utils
moritzgubler Jul 17, 2024
88b8e27
get rid of reading files
moritzgubler Jul 18, 2024
bc637f0
get rid of lebedev data files
moritzgubler Jul 18, 2024
987dbca
suggestion from peter
moritzgubler Jul 19, 2024
e9103de
it compiles
moritzgubler Jul 19, 2024
df71ece
fix it again
moritzgubler Jul 22, 2024
4400abf
start work on xcfun
moritzgubler Jul 23, 2024
475a1f1
working but mess
moritzgubler Jul 30, 2024
62d9774
better interface
moritzgubler Jul 31, 2024
2a1da0c
gga working
moritzgubler Jul 31, 2024
f829a77
open shell gga working
moritzgubler Jul 31, 2024
e4d550f
revert changes in xc operator
moritzgubler Jul 31, 2024
9fb3893
rename files
moritzgubler Jul 31, 2024
eba9cb1
rename functions
moritzgubler Jul 31, 2024
fec3b6c
move xc stress to seperate file
moritzgubler Jul 31, 2024
2bfcf2f
adjust tests
moritzgubler Jul 31, 2024
13b89d8
add more documentation and namespaces
moritzgubler Jul 31, 2024
be22297
remove averaging feature
moritzgubler Aug 1, 2024
642c71b
remove averaging parameters
moritzgubler Aug 1, 2024
6f5d1c2
update input parser
moritzgubler Aug 1, 2024
51417d4
output more digits in xyz file
moritzgubler Aug 6, 2024
210cff8
make xc potentials visible
moritzgubler Aug 7, 2024
cf2fcc6
make xc operator to get wavelet represantation of xc potential
moritzgubler Aug 7, 2024
6c75108
use wavelet represenatation for xc potential in gga case
moritzgubler Aug 7, 2024
4992efd
add new radius_factor keyword.
moritzgubler Aug 7, 2024
6fa276a
remove prints
moritzgubler Aug 7, 2024
64bf02b
remove orbitalvectors
moritzgubler Aug 8, 2024
f3552f2
more prints
moritzgubler Aug 8, 2024
e2f1395
turn on xc stress again
moritzgubler Aug 8, 2024
a32c309
Merge branch 'master' into surface_forces_fix_MPI
moritzgubler Aug 12, 2024
34c9bf0
debugging
moritzgubler Aug 12, 2024
2f44450
remove prints
moritzgubler Aug 12, 2024
1dca98f
mpi working
moritzgubler Aug 12, 2024
fc49bac
add test
moritzgubler Aug 12, 2024
9408238
reorganize calculation of nuclear gradients
moritzgubler Aug 12, 2024
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
27 changes: 27 additions & 0 deletions doc/users/user_ref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,33 @@ User input reference

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

:Forces: Define parameters for the computation of forces.

:red:`Keywords`
: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.

**Type** ``str``

**Default** ``surface_integrals``

**Predicates**
- ``value.lower() in ['surface_integrals', 'hellmann_feynman']``

: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.

**Type** ``str``

**Default** ``medium``

**Predicates**
- ``value.lower() in ['low', 'medium', 'high']``

: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.

**Type** ``float``

**Default** ``0.6``

:ExternalFields: Define external electromagnetic fields.

:red:`Keywords`
Expand Down
5 changes: 4 additions & 1 deletion python/mrchem/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def write_scf_solver(user_dict, wf_dict):
def write_scf_properties(user_dict, origin):
prop_dict = {}
if user_dict["Properties"]["dipole_moment"]:
prop_dict["dipole_moment"] = {}
prop_dict["dipole_moment"] = {}
prop_dict["dipole_moment"]["dip-1"] = {
"operator": "h_e_dip",
"precision": user_dict["world_prec"],
Expand All @@ -294,6 +294,9 @@ def write_scf_properties(user_dict, origin):
"operator": "h_nuc_grad",
"precision": user_dict["world_prec"],
"smoothing": user_dict["Precisions"]["nuclear_prec"],
"method": user_dict["Forces"]["method"],
"surface_integral_precision": user_dict["Forces"]["surface_integral_precision"],
"radius_factor": user_dict["Forces"]["radius_factor"],
}
return prop_dict

Expand Down
2 changes: 1 addition & 1 deletion python/mrchem/input_parser/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
This file was automatically generated by parselglossy on 2024-05-14
This file was automatically generated by parselglossy on 2024-08-07
Editing is *STRONGLY DISCOURAGED*
2 changes: 1 addition & 1 deletion python/mrchem/input_parser/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-

# This file was automatically generated by parselglossy on 2024-05-14
# This file was automatically generated by parselglossy on 2024-08-07
# Editing is *STRONGLY DISCOURAGED*
20 changes: 19 additions & 1 deletion 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 2024-05-14
# This file was automatically generated by parselglossy on 2024-08-07
# Editing is *STRONGLY DISCOURAGED*

from copy import deepcopy
Expand Down Expand Up @@ -363,6 +363,24 @@ def stencil() -> JSONDict:
'name': 'geometric_derivative',
'type': 'bool'}],
'name': 'Properties'},
{ 'keywords': [ { 'default': 'surface_integrals',
'name': 'method',
'predicates': [ 'value.lower() '
'in '
"['surface_integrals', "
"'hellmann_feynman']"],
'type': 'str'},
{ 'default': 'medium',
'name': 'surface_integral_precision',
'predicates': [ 'value.lower() '
"in ['low', "
"'medium', "
"'high']"],
'type': 'str'},
{ 'default': 0.6,
'name': 'radius_factor',
'type': 'float'}],
'name': 'Forces'},
{ 'keywords': [ { 'default': [],
'name': 'electric_field',
'predicates': [ 'len(value) == 0 '
Expand Down
2 changes: 1 addition & 1 deletion python/mrchem/input_parser/cli.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 2024-05-14
# This file was automatically generated by parselglossy on 2024-08-07
# Editing is *STRONGLY DISCOURAGED*

import argparse
Expand Down
27 changes: 27 additions & 0 deletions python/mrchem/input_parser/docs/user_ref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,33 @@ User input reference

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

:Forces: Define parameters for the computation of forces.

:red:`Keywords`
: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.

**Type** ``str``

**Default** ``surface_integrals``

**Predicates**
- ``value.lower() in ['surface_integrals', 'hellmann_feynman']``

: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.

**Type** ``str``

**Default** ``medium``

**Predicates**
- ``value.lower() in ['low', 'medium', 'high']``

: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.

**Type** ``float``

**Default** ``0.6``

:ExternalFields: Define external electromagnetic fields.

:red:`Keywords`
Expand Down
2 changes: 1 addition & 1 deletion python/mrchem/input_parser/plumbing/lexer.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 2024-05-14
# This file was automatically generated by parselglossy on 2024-08-07
# Editing is *STRONGLY DISCOURAGED*

import json
Expand Down
4 changes: 2 additions & 2 deletions python/mrchem/input_parser/plumbing/pyparsing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ def __repr__(self):
return f"{__name__}.{type(self).__name__}({', '.join('{}={!r}'.format(*nv) for nv in zip(self._fields, self))})"


__version_info__ = version_info(3, 1, 1, "final", 1)
__version_time__ = "29 Jul 2023 22:27 UTC"
__version_info__ = version_info(3, 1, 2, "final", 1)
__version_time__ = "06 Mar 2024 07:08 UTC"
__version__ = __version_info__.__version__
__versionTime__ = __version_time__
__author__ = "Paul McGuire <ptmcg.gm+pyparsing@gmail.com>"
Expand Down
21 changes: 5 additions & 16 deletions python/mrchem/input_parser/plumbing/pyparsing/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ def with_attribute(*args, **attr_dict):
<div type="graph">1,3 2,3 1,1</div>
<div>this has no type</div>
</div>

'''
div,div_end = make_html_tags("div")

Expand Down Expand Up @@ -199,19 +198,9 @@ def with_class(classname, namespace=""):

# pre-PEP8 compatibility symbols
# fmt: off
@replaced_by_pep8(replace_with)
def replaceWith(): ...

@replaced_by_pep8(remove_quotes)
def removeQuotes(): ...

@replaced_by_pep8(with_attribute)
def withAttribute(): ...

@replaced_by_pep8(with_class)
def withClass(): ...

@replaced_by_pep8(match_only_at_col)
def matchOnlyAtCol(): ...

replaceWith = replaced_by_pep8("replaceWith", replace_with)
removeQuotes = replaced_by_pep8("removeQuotes", remove_quotes)
withAttribute = replaced_by_pep8("withAttribute", with_attribute)
withClass = replaced_by_pep8("withClass", with_class)
matchOnlyAtCol = replaced_by_pep8("matchOnlyAtCol", match_only_at_col)
# fmt: on
9 changes: 8 additions & 1 deletion python/mrchem/input_parser/plumbing/pyparsing/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class pyparsing_common:
scientific notation and returns a float"""

# streamlining this expression makes the docs nicer-looking
number = (sci_real | real | signed_integer).setName("number").streamline()
number = (sci_real | real | signed_integer).set_name("number").streamline()
"""any numeric expression, returns the corresponding Python type"""

fnumber = (
Expand All @@ -216,6 +216,13 @@ class pyparsing_common:
)
"""any int or real number, returned as float"""

ieee_float = (
Regex(r"(?i)[+-]?((\d+\.?\d*(e[+-]?\d+)?)|nan|inf(inity)?)")
.set_name("ieee_float")
.set_parse_action(convert_to_float)
)
"""any floating-point literal (int, real number, infinity, or NaN), returned as float"""

identifier = Word(identchars, identbodychars).set_name("identifier")
"""typical code identifier (leading alpha or '_', followed by 0 or more alphas, nums, or '_')"""

Expand Down
Loading
Loading