-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathd4s.py
More file actions
41 lines (35 loc) · 1.5 KB
/
Copy pathd4s.py
File metadata and controls
41 lines (35 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# SPDX-Identifier: CC0-1.0
import tad_mctc as mctc
import torch
import tad_dftd4 as d4
numbers = mctc.convert.symbol_to_number(
symbols="C C C C N C S H H H H H".split()
)
# coordinates in Bohr
positions = torch.tensor(
[
[-2.56745685564671, -0.02509985979910, 0.00000000000000],
[-1.39177582455797, +2.27696188880014, 0.00000000000000],
[+1.27784995624894, +2.45107479759386, 0.00000000000000],
[+2.62801937615793, +0.25927727028120, 0.00000000000000],
[+1.41097033661123, -1.99890996077412, 0.00000000000000],
[-1.17186102298849, -2.34220576284180, 0.00000000000000],
[-2.39505990368378, -5.22635838332362, 0.00000000000000],
[+2.41961980455457, -3.62158019253045, 0.00000000000000],
[-2.51744374846065, +3.98181713686746, 0.00000000000000],
[+2.24269048384775, +4.24389473203647, 0.00000000000000],
[+4.66488984573956, +0.17907568006409, 0.00000000000000],
[-4.60044244782237, -0.17794734637413, 0.00000000000000],
]
)
# total charge of the system
charge = torch.tensor(0.0)
# Create the D4S model
model = d4.model.D4SModel(numbers)
param = d4.get_params(method="d4", functional="tpssh")
energy = d4.dftd4(numbers, positions, charge, param, model=model)
torch.set_printoptions(precision=10)
print(energy)
# tensor([-0.0020843975, -0.0019013016, -0.0018165035, -0.0018363572,
# -0.0021877293, -0.0019495023, -0.0022923108, -0.0004326892,
# -0.0004439871, -0.0004362087, -0.0004454589, -0.0005344027])