-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example for challenging SCF convergence (#173)
- Loading branch information
1 parent
9c4af05
commit a1e87b0
Showing
3 changed files
with
69 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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 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,13 @@ | ||
$coord | ||
0.03579425573719 -0.09112374056391 0.89335307999458 cr | ||
5.42783204665614 -2.17294661121026 0.65916514368075 o | ||
3.40375271909106 -1.38928570065300 0.82378719806096 c | ||
-0.04074270812561 -0.17596705876656 -2.57265467283161 c | ||
-0.08912415394703 -0.22969604472894 -4.75994430975133 o | ||
-3.33299931144879 1.20626988769390 0.90894089019304 c | ||
-5.36291624030506 1.98396405987989 0.79581613233819 o | ||
1.33083886695733 3.27583741049000 0.75516281864174 c | ||
2.10688687476585 5.29904198098028 0.54889443619263 o | ||
-1.26102459345897 -3.45925462128772 0.97643580779788 c | ||
-2.04398697392212 -5.48898687883367 0.90363185868314 o | ||
$end |
This file contains 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,54 @@ | ||
# This file is part of dxtb. | ||
# | ||
# SPDX-Identifier: Apache-2.0 | ||
# Copyright (C) 2024 Grimme Group | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
""" | ||
https://github.com/grimme-lab/dxtb/issues/123 | ||
""" | ||
from __future__ import annotations | ||
|
||
from pathlib import Path | ||
|
||
import torch | ||
from tad_mctc.io import read | ||
|
||
import dxtb | ||
|
||
|
||
def main() -> int: | ||
dd = {"device": torch.device("cpu"), "dtype": torch.double} | ||
dxtb.timer.cuda_sync = False | ||
|
||
# read molecule from file | ||
f = Path(__file__).parent / "coord" | ||
numbers, positions = read.read_from_path(f, **dd) | ||
charge = read.read_chrg_from_path(f, **dd) | ||
|
||
opts = {"verbosity": 6, "scp_mode": dxtb.labels.SCP_MODE_CHARGE} | ||
calc = dxtb.calculators.GFN1Calculator(numbers, opts=opts, **dd) | ||
|
||
ref = -35.800705002354 | ||
energy = calc.get_energy(positions, chrg=charge) | ||
|
||
print("\nComparison to xtb:") | ||
print(f" - xtb (6.7.1) : {ref: .12f}") | ||
print(f" - dxtb (0.1.0): {energy: .12f}") | ||
print(f" - diff : {energy - ref: .12f}") | ||
|
||
return 0 | ||
|
||
|
||
if __name__ == "__main__": | ||
raise SystemExit(main()) |