Skip to content

Commit 8364348

Browse files
author
Suarez
committed
Merge remote-tracking branch 'upstream/devel' into devel
2 parents 388f7e2 + c1f2df9 commit 8364348

14 files changed

Lines changed: 1024 additions & 58 deletions

File tree

src/libra_py/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"data_stat",
2424
"data_visualize",
2525
"dynamics_plotting",
26+
"eigensolvers",
2627
"fgr_py",
2728
"fit",
2829
"fix_motion",

src/libra_py/dynamics/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
__all__ = ["bohmian",
1111
"exact",
1212
"exact_torch",
13+
"ldr_torch",
1314
"heom",
1415
"qtag",
1516
"tsh",

src/libra_py/dynamics/bohmian/compute.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def rho_lorentzian(q, Q, sigma):
6868
return y
6969

7070

71-
def quantum_potential_orginal(Q, sigma, mass, TBF):
71+
def quantum_potential_original(Q, sigma, mass, TBF):
7272
"""
7373
Args:
7474
* Q (Tensor(ntraj, ndof)) - coordinates of all trajectories
@@ -92,6 +92,31 @@ def quantum_potential_orginal(Q, sigma, mass, TBF):
9292
return U
9393

9494

95+
def quantum_potential_original_gen(q, Q, sigma, mass, TBF):
96+
"""
97+
Args:
98+
* Q (Tensor(ntraj, ndof)) - coordinates of all trajectories
99+
* sigma (Tensor(ndof)) - width parameters for each trajectory
100+
* mass ( Tensor(1, ndof)) - masses of all DOFs, same for all trajectories
101+
* TBF (object) - basis function reference (`rho_gaussian` or `rho_lorentzian`)
102+
103+
Returns:
104+
Tensor(1) - quantum potential summed over all trajectory points
105+
"""
106+
107+
ntraj, ndof = Q.shape[0], Q.shape[1]
108+
U = torch.zeros( (1,), requires_grad=True)
109+
f = TBF(q, Q, sigma);
110+
[deriv1] = torch.autograd.grad(f, [q], create_graph=True, retain_graph=True);
111+
for i in range(ndof):
112+
[deriv2] = torch.autograd.grad(deriv1[i], [q], create_graph=True, retain_graph=True);
113+
u = -(0.25/mass[0,i])*( deriv2[i]/f - 0.5 * (deriv1[i]/f)**2 );
114+
U = U + u
115+
return U
116+
117+
118+
119+
95120
def quantum_potential(Q, sigma, mass, TBF):
96121
"""
97122
Compute quantum potential in a fully vectorized way.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# ***********************************************************
2+
# * Copyright (C) 2025 Alexey V. Akimov
3+
# * This file is distributed under the terms of the
4+
# * GNU General Public License as published by the
5+
# * Free Software Foundation; either version 3 of the
6+
# * License, or (at your option) any later version.
7+
# * http://www.gnu.org/copyleft/gpl.txt
8+
# ***********************************************************/
9+
10+
__all__ = ["compute",
11+
]

0 commit comments

Comments
 (0)