-
Notifications
You must be signed in to change notification settings - Fork 197
Failure amid $fix atoms and many disconnected fragments when optimizing with the L-ANC #1379
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
Open
DanielWicz
wants to merge
2
commits into
grimme-lab:main
Choose a base branch
from
DanielWicz:bugfix/fix-fixset-lancopt
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ set( | |
| "gfn2" | ||
| "gfnff" | ||
| "hessian" | ||
| "relaxation-engine" | ||
| "iff" | ||
| "latticepoint" | ||
| "molecule" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,7 @@ tests = [ | |
| 'gfn2', | ||
| 'gfnff', | ||
| 'hessian', | ||
| 'relaxation-engine', | ||
| 'iff', | ||
| 'latticepoint', | ||
| 'molecule', | ||
|
|
||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| ! This file is part of xtb. | ||
| ! SPDX-Identifier: LGPL-3.0-or-later | ||
| ! | ||
| ! xtb is free software: you can redistribute it and/or modify it under | ||
| ! the terms of the GNU Lesser General Public License as published by | ||
| ! the Free Software Foundation, either version 3 of the License, or | ||
| ! (at your option) any later version. | ||
| ! | ||
| ! xtb is distributed in the hope that it will be useful, | ||
| ! but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| ! GNU Lesser General Public License for more details. | ||
| ! | ||
| ! You should have received a copy of the GNU Lesser General Public License | ||
| ! along with xtb. If not, see <https://www.gnu.org/licenses/>. | ||
|
|
||
| module test_relaxation_engine | ||
| use testdrive, only : new_unittest, unittest_type, error_type, check_ => check | ||
| implicit none | ||
| private | ||
|
|
||
| public :: collect_relaxation_engine | ||
|
|
||
| contains | ||
|
|
||
| subroutine collect_relaxation_engine(testsuite) | ||
| type(unittest_type), allocatable, intent(out) :: testsuite(:) | ||
|
|
||
| testsuite = [ & | ||
| new_unittest("gfnff-fix-lancopt", test_gfnff_fix_lancopt) & | ||
| ] | ||
|
|
||
| end subroutine collect_relaxation_engine | ||
|
|
||
|
|
||
| subroutine test_gfnff_fix_lancopt(error) | ||
| use xtb_mctc_accuracy, only : wp | ||
| use xtb_type_environment, only : TEnvironment, init | ||
| use xtb_type_molecule, only : TMolecule, init | ||
| use xtb_type_restart, only : TRestart | ||
| use xtb_gfnff_calculator, only : TGFFCalculator, newGFFCalculator | ||
| use xtb_relaxation_engine, only : l_ancopt | ||
| use xtb_setparam, only : set, p_ext_gfnff, p_olev_normal | ||
| use xtb_fixparam, only : init_fix, clear_fix, fixset | ||
| use xtb_splitparam, only : init_split, atmass | ||
| use mctcpar_atomic_masses, only : atomic_mass | ||
| use xtb_mctc_convert, only : autoamu | ||
|
|
||
| type(error_type), allocatable, intent(out) :: error | ||
|
|
||
| integer, parameter :: nat = 510 | ||
| integer, parameter :: nfix = 500 | ||
| real(wp), parameter :: spacing = 2.8_wp | ||
| real(wp), parameter :: zigzag = 0.5_wp | ||
| real(wp), parameter :: frag_sep = 200.0_wp | ||
|
|
||
| type(TEnvironment) :: env | ||
| type(TMolecule) :: mol | ||
| type(TRestart) :: chk | ||
| type(TGFFCalculator) :: calc | ||
|
|
||
| integer, allocatable :: at(:) | ||
| real(wp), allocatable :: xyz(:,:) | ||
| real(wp), allocatable :: gradient(:, :) | ||
| real(wp) :: energy, egap, sigma(3, 3) | ||
|
|
||
| logical :: fail, exitRun | ||
| integer :: saved_mode_extrun, saved_micro_opt | ||
|
|
||
| integer :: i | ||
|
|
||
| ! Regression test for: GFN-FF + L-ANC + $fix + (N > 500) used to abort in | ||
| ! ANC generation with e.g. "k=30 nvar=1530" / "ANC generation failed". | ||
| ! Core invariant: degrees of freedom must account for fixed atoms, | ||
| ! nvar = 3*N - 3*nfix - 3, | ||
| ! even when using the fragmented Hessian path in L-ANC. | ||
|
|
||
| saved_mode_extrun = set%mode_extrun | ||
| saved_micro_opt = set%optset%micro_opt | ||
| set%mode_extrun = p_ext_gfnff | ||
| set%optset%micro_opt = 1 ! keep runtime low (1 LBFGS micro step) | ||
|
|
||
| allocate(at(nat), source=6) | ||
| allocate(xyz(3, nat), source=0.0_wp) | ||
|
|
||
| do i = 1, nat/2 | ||
| xyz(1, i) = spacing*real(i-1, wp) | ||
| xyz(2, i) = merge(zigzag, -zigzag, mod(i, 2) == 0) | ||
| end do | ||
| do i = nat/2 + 1, nat | ||
| xyz(1, i) = spacing*real(i-1-nat/2, wp) | ||
| xyz(2, i) = frag_sep + merge(zigzag, -zigzag, mod(i, 2) == 0) | ||
| end do | ||
|
|
||
| call init(env) | ||
| call init(mol, at, xyz) | ||
|
|
||
| call init_split(mol%n) | ||
| atmass = atomic_mass(mol%at) * autoamu | ||
|
|
||
| call delete_file('charges') | ||
| call newGFFCalculator(env, mol, calc, '.param_gfnff.xtb', .false.) | ||
| call env%check(exitRun) | ||
| call check_(error, .not.exitRun) | ||
| if (allocated(error)) goto 100 | ||
|
|
||
| call init_fix(mol%n) | ||
| fixset%n = nfix | ||
| do i = 1, nfix | ||
| fixset%atoms(i) = i | ||
| end do | ||
|
|
||
| allocate(gradient(3, nat), source=0.0_wp) | ||
| energy = 0.0_wp | ||
| egap = 0.0_wp | ||
| sigma = 0.0_wp | ||
|
|
||
| call l_ancopt(env, -1, mol, chk, calc, p_olev_normal, 1, energy, egap, gradient, sigma, 0, fail) | ||
| call check_(error, .not.fail) | ||
|
|
||
| 100 continue | ||
| call clear_fix | ||
| set%mode_extrun = saved_mode_extrun | ||
| set%optset%micro_opt = saved_micro_opt | ||
| call mol%deallocate | ||
|
|
||
| end subroutine test_gfnff_fix_lancopt | ||
|
|
||
|
|
||
| end module test_relaxation_engine |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, consider to create a separate PR for this.