Skip to content

Commit 109c8cf

Browse files
author
Vishikh Athavale
committed
update docs
1 parent 9427a25 commit 109c8cf

File tree

9 files changed

+92
-87
lines changed

9 files changed

+92
-87
lines changed

docs/source/Feature-XLBOMD.rst

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@ Extended Lagrangian Born Oppenheimer Molecular Dynamics (XL-BOMD)
33

44
Extended Lagrangian Born–Oppenheimer Molecular Dynamics (XL-BOMD) improves upon traditional Born–Oppenheimer Molecular Dynamics (BOMD) by introducing auxiliary dynamical variables that track the electronic density matrix in a harmonic potential. This reduces the need for fully converged self-consistent field (SCF) calculations at each time step.
55

6-
The method enables energy-conserving dynamics even with relaxed SCF convergence, significantly lowering computational cost while maintaining stability. XL-BOMD is particularly effective for long-time simulations and large molecular systems, and is well-suited for semiempirical, Hartree–Fock, and DFT-based electronic structure methods.
6+
The method enables energy-conserving dynamics even with relaxed SCF convergence, significantly lowering computational cost while maintaining stability. XL-BOMD is particularly effective for long-time simulations and large molecular systems.
77

8-
This implementation supports efficient simulations by reducing the number of SCF iterations required per time step, enabling practical quantum-based molecular dynamics for systems where conventional BOMD would be prohibitively expensive.
9-
10-
PYSEQM provides two variants:
8+
PYSEQM provides two variants of XL-BOMD:
119

1210
- **XL_BOMD**
1311
Base extended‐Lagrangian Born–Oppenheimer MD.
1412

1513
- **KSA_XL_BOMD**
16-
Krylov‐subspace‐approximated XL‐BOMD with low‐rank electronic updates (more accurate dynamics without sacrificing speed).
14+
An improved Krylov subspace approximation (KSA) scheme for the integration of the electronic equations of motion within XL-BOMD
15+
(more accurate dynamics without sacrificing speed).
1716

1817

1918
Driver Classes & Initialization
@@ -42,35 +41,47 @@ Import the drivers and instantiate with common arguments:
4241
).to(device)
4342
4443
# 2. KSA-XL-BOMD (low-rank Krylov approximation)
45-
ksa_params = {
44+
xl_bomd_params = {
4645
'k': 6, # dissipative force coefficient
47-
'max_rank': 3, # Krylov subspace rank
46+
'max_rank': 3, # Krylov subspace approximation kernel rank
4847
'err_threshold': 0.0, # approximation error tolerance
4948
'T_el': 1500 # electronic temperature (K)
5049
}
5150
md_ksa = KSA_XL_BOMD(
52-
xl_bomd_params=ksa_params,
51+
xl_bomd_params=xl_bomd_params,
5352
damp=100.0, # optional, if needed, damping constant (fs) for Langevin dynamics
5453
seqm_parameters=seqm_parameters,
5554
Temp=400.0,
5655
timestep=0.4,
5756
output=output
5857
).to(device)
5958
60-
Key Parameters
61-
~~~~~~~~~~~~~~
62-
- **xl_bomd_params['k']** (`float`)
63-
Controls the strength of the dissipative electronic force `Niklasson, Anders, et al., The Journal of Chemical Physics 130.21 (2009) <https://aip.scitation.org/doi/full/10.1063/1.3148075>`_.
59+
Key Parameters of XL-BOMD
60+
~~~~~~~~~~~~~~~~~~~~~~~~~~
61+
62+
The XL-BOMD drivers need a dictionary that specify the parameters for XL-BOMD dynamics. In the above code, this dictionary is `xl_bomd_params`.
63+
The key/value pairs for this dictionary are:
64+
65+
- **'k'** (`int`)
66+
Controls `K` of the dissipative electronic force. See `Niklasson, Anders, et al., The Journal of Chemical Physics 130.21 (2009) <https://aip.scitation.org/doi/full/10.1063/1.3148075>`_.
6467

65-
- **max_rank** (`int`, KSA only)
66-
Maximum rank of the Krylov subspace used in the low‐rank update.
68+
Values from ``3`` to ``9`` are accepted.
6769

68-
- **err_threshold** (`float`, KSA only)
70+
- **'max_rank'** (`int`, KSA only)
71+
Maximum rank of the kernel for the update in the Krylov subspace approximation.
72+
73+
- **'err_threshold'** (`float`, KSA only)
6974
Error tolerance for the low‐rank approximation (set to 0.0 to fix at `max_rank`).
7075

71-
- **T_el** (`float`, KSA only)
76+
- **'T_el'** (`float`, KSA only)
7277
Electronic “temperature” for thermalized Hartree–Fock.
7378

79+
The parameters to initialize the MD drivers `XL_BOMD()` and `KSA_XL_BOMD()` are the same as those for `Molecular_Dynamics_Basic()` as in :ref:`bomd_driver`.
80+
The extra parameters you can specify for XL-BOMD drivers are:
81+
82+
- **xl_bomd_params** (`dict`)
83+
The dictionary that specifes the parameters for XL-BOMD dynamics, as described above.
84+
7485
- **damp** (`float`)
7586
If you want to run Langevin dynamics, then specify the damping constant `damp` in fs. Langevin dynamics is turned off by default.
7687

docs/source/Initialization.rst

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Supported Molecular Input Formats
1010
You can supply molecular data (atoms and coordinates) in two ways:
1111

1212
- **PyTorch tensors** (in-memory, zero-padded batches)
13-
- **`.xyz` files** (read and padded automatically)
13+
- **.xyz files** (read and padded automatically)
1414

1515

1616
Using PyTorch Tensors
@@ -66,8 +66,8 @@ An `.xyz` file includes:
6666
2. Comment or title (second line)
6767
3. Atom symbol and coordinates per line (x, y, z)
6868

69-
Use `read_xyz` to load and pad.
70-
The `read_xyz` function returns numpy tensors (species and coordinates) that have to be converted to PyTorch tensors
69+
Use `read_xyz(...)` to load and pad.
70+
The `read_xyz(...)` function returns numpy tensors (species and coordinates) that have to be converted to PyTorch tensors
7171

7272
.. code-block:: python
7373
@@ -147,7 +147,7 @@ These imports provide the core components needed to define molecules and access
147147
from seqm.seqm_functions.constants import Constants
148148
from seqm.Molecule import Molecule
149149
150-
**Required if reading molecular structures from a `.xyz` file:**
150+
**Required if reading molecular structures from .xyz files:**
151151

152152
Use this to load molecular geometries from `.xyz` files
153153

@@ -179,12 +179,15 @@ Includes stochastic and frictional forces to model interaction with a heat bath,
179179
180180
from seqm.MolecularDynamics import Molecular_Dynamics_Langevin
181181
182-
**Required for KSA-XL Born-Oppenheimer Molecular Dynamics:**
182+
**Required for Extended-Lagrangian Born-Oppenheimer Molecular Dynamics:**
183183

184-
Implements an efficient Born-Oppenheimer MD scheme using extended Lagrangian and Krylov subspace methods for long, accurate simulations on quantum surfaces.
184+
Implements an extended Lagrangian Born-Oppenheimer MD (XL-BOMD) scheme and an improved Krylov subspace approximation (KSA) scheme for the integration of the electronic equations of motion within XL-BOMD termed as KSA-XL-BOMD for long, accurate MD simulations.
185185

186186
.. code-block:: python
187187
188+
# basic XL-BOMD
189+
from seqm.MolecularDynamics import XL_BOMD
190+
# XL-BOMD with Krylov subspace approximation for the integration of the electronic equations of motion
188191
from seqm.MolecularDynamics import KSA_XL_BOMD
189192
190193
@@ -197,7 +200,7 @@ Implements an efficient Born-Oppenheimer MD scheme using extended Lagrangian and
197200
SEQM Parameters
198201
---------------
199202

200-
The ``seqm_parameters`` dictionary defines settings for a semiempirical quantum mechanics (SEQM) simulation.
203+
The ``seqm_parameters`` dictionary helps you give the specifications for the semiempirical quantum mechanics (SEQM) calculation.
201204
Below is a typical configuration:
202205

203206
.. code-block:: python
@@ -207,9 +210,10 @@ Below is a typical configuration:
207210
'scf_eps': 1.0e-6,
208211
'scf_converger': [2,],
209212
'sp2': [False, 1.0e-5],
213+
...
210214
}
211215
212-
Some of the basic parameters in the ``seqm_parameters`` dictionary are:
216+
Some of the basic key/value pairs in the ``seqm_parameters`` dictionary are:
213217

214218
**method** (`str`)
215219
Specifies the semiempirical model to use.
@@ -220,10 +224,10 @@ Some of the basic parameters in the ``seqm_parameters`` dictionary are:
220224
Convergence threshold for the SCF (Self-Consistent Field) loop.
221225
The SCF iteration stops when the energy difference between steps is less than this value.
222226

223-
:recommended: 1e-5 for single point SCF, 1e-8 for excited state calculations
227+
:recommended: ``1e-5`` for single-point SCF, ``1e-8`` for excited-state calculations
224228

225229
**scf_converger** (`list`)
226-
Specifies the alorithm used to update the density matrix to converge SCF.
230+
Specifies the alorithm and other details that will be used to update the density matrix to converge SCF.
227231

228232
Available options:
229233

@@ -232,7 +236,7 @@ Some of the basic parameters in the ``seqm_parameters`` dictionary are:
232236
Constant linear mixing of the density matrix:
233237

234238
``P_new = alpha * P_old + (1 - alpha) * P_candidate``
235-
where ``alpha`` is the mixing coefficient (e.g., 0.2).
239+
where ``alpha`` is the mixing coefficient (e.g., ``0.2``).
236240

237241
- ``[1]``
238242

@@ -257,7 +261,7 @@ Some of the basic parameters in the ``seqm_parameters`` dictionary are:
257261
:format: ``[enabled, tolerance]``
258262

259263
* ``enabled`` (`bool`): Whether to activate SP2
260-
* ``tolerance`` (`float`): SP2 threshold. Recommened between 1e-3 to 1e-7
264+
* ``tolerance`` (`float`): SP2 threshold. Recommened between ``1e-3`` to ``1e-7`` for double-precision calculations
261265

262266
**eig** (`bool`)
263267
Optional parameter to control whether to compute molecular orbitals after SCF convergence.

docs/source/bomd.rst

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,28 @@ PYSEQM had MD engines for:
1313
- **Born–Oppenheimer MD** via `Molecular_Dynamics_Basic`
1414
- **Langevin-thermostatted dynamics** via `Molecular_Dynamics_Langevin`
1515

16+
.. _bomd_driver:
17+
1618
BOMD driver
1719
~~~~~~~~~~~~~~~~~
1820
Call the BOMD engine using
1921

2022
.. code-block:: python
2123
22-
from seqm.MolecularDynamics import (
23-
Molecular_Dynamics_Basic,
24-
Molecular_Dynamics_Langevin
25-
)
24+
from seqm.MolecularDynamics import Molecular_Dynamics_Basic
2625
27-
# Basic BOMD
28-
md = Molecular_Dynamics_Basic( seqm_parameters=seqm_parameters, Temp=300.0,
26+
md = Molecular_Dynamics_Basic(seqm_parameters=seqm_parameters, Temp=300.0,
2927
timestep=0.5, output=output).to(device)
3028
3129
The parameters of `Molecular_Dynamics_Basic` are:
3230

33-
- `seqm_parameters` (`dict`)
31+
- ``seqm_parameters`` (`dict`)
3432

35-
- `Temp` (`float`) Specify the inital temperature (K) for BOMD. Given the initial temperature in BOMD, the initial nuclear velocities are set by drawing from a Maxwell–Boltzmann distribution so that each degree of freedom has an average kinetic energy of ½ kT
33+
- ``Temp`` (`float`) Specify the inital temperature (K) for BOMD. Given the initial temperature in BOMD, the initial nuclear velocities are set by drawing from a Maxwell–Boltzmann distribution so that each degree of freedom has an average kinetic energy of ½ kT
3634

37-
- `timestep` (`float`) Integration step size (fs)
35+
- ``timestep`` (`float`) Integration step size (fs)
3836

39-
- `output`: (`dict`) controlling prints & file dumps, see below
37+
- ``output``: (`dict`) controlling prints & file dumps, see below
4038

4139
Langevin dynamics
4240
~~~~~~~~~~~~~~~~~
@@ -74,13 +72,15 @@ Call the Langevin dynamics engine using
7472

7573
.. code-block:: python
7674
75+
from seqm.MolecularDynamics import Molecular_Dynamics_Langevin
76+
7777
md_langevin = Molecular_Dynamics_Langevin( damp=100.0, seqm_parameters=seqm_parameters,
7878
Temp=300.0, timestep=0.5,
7979
output=output).to(device)
8080
8181
In addition to the same parameters as `Molecular_Dynamics_Basic`, `Molecular_Dynamics_Langevin` has the following parameter(s):
8282

83-
- `damp` (`float`) Damping constant in fs
83+
- ``damp`` (`float`) Damping constant in fs
8484

8585
Configuring Outputs from BOMD
8686
-----------------------------
@@ -109,7 +109,7 @@ In addition to specifying :ref:`seqm-parameters`, the MD engines also require an
109109

110110
- **prefix** (`str`)
111111
Path prefix for all output files.
112-
If you set prefix to `'my_output'`, files will be named like ``./my_output.{molid}.xyz``, etc.
112+
If you set prefix to `'my_output'`, then output files will be named like ``./my_output.{molid}.xyz``, etc.
113113

114114
Running the MD Simulation
115115
--------------------------
@@ -134,6 +134,7 @@ Parameters:
134134

135135
- **remove_com** (`[bool, int]`)
136136
Control removal of center‐of‐mass motion:
137+
137138
- First element (`bool`): whether to remove COM drift.
138139
- Second element (`int`): how often to apply it (every N steps).
139140

docs/source/excited_states.rst

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ CIS constructs excited states by promoting electrons from occupied to virtual or
99

1010
RPA includes both excitation and de-excitation operators, and accounts for more electronic correlation than CIS.
1111

12-
Both methods are calculated with `Electronic_Structure` driver; you simply add an `excited_states` key to your `seqm_parameters` dictionary.
12+
Both methods are calculated with `Electronic_Structure` driver.
1313

1414
Configuring Excited States
1515
--------------------------
1616

17-
In order to prompt an excited state calculation, add an `excited_states` dictionary to `seqm_parameters`:
17+
In order to prompt an excited state calculation, simply add an `excited_states` key/value pair to your `seqm_parameters` dictionary:
1818

1919
.. code-block:: python
2020
@@ -34,12 +34,12 @@ This value dictionary should contain the following key/value pairs:
3434

3535
- **method** (`str`): Method used for excited state calculations. Available options:
3636

37-
- `'rpa'`
38-
- `'cis'`
37+
- ``'rpa'``
38+
- ``'cis'``
3939

40-
By default it is set to `cis`
40+
By default it is set to ``'cis'``
4141

42-
- **cis_tolerance** (`float`): Convergence criterion for CIS/RPA excited states. By default it is set to 1e-6.
42+
- **cis_tolerance** (`float`): Convergence criterion for CIS/RPA excited states. By default it is set to ``1e-6``.
4343

4444
See :ref:`seqm-parameters` for other settings for the calculation.
4545

@@ -58,7 +58,7 @@ Running an Excited-State Calculation
5858
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
5959
6060
species = torch.as_tensor([[8,6,1,1],
61-
[8,6,1,1],
61+
[8,6,1,1],],
6262
dtype=torch.int64, device=device)
6363
6464
coordinates = torch.tensor([
@@ -76,27 +76,24 @@ Running an Excited-State Calculation
7676
],
7777
], device=device)
7878
79-
species = torch.as_tensor(species, dtype=torch.int64, device=device)[:]
80-
coordinates = torch.tensor(coordinates, device=device)[:]
8179
const = Constants().to(device)
8280
8381
seqm_parameters = {
8482
'method': 'AM1',
8583
'scf_eps': 1.0e-8,
86-
'scf_converger': [2],
87-
'excited_states': {'n_states': 5},
84+
'scf_converger': [1],
85+
'excited_states': {'n_states': 10},
8886
}
8987
9088
molecule = Molecule(const, seqm_parameters, coordinates, species).to(device)
9189
esdriver = Electronic_Structure(seqm_parameters).to(device)
9290
esdriver(molecule)
9391
94-
After ``esdriver(molecule)``, inspect the ``molecule`` attributes:
92+
After ``esdriver(molecule)`` has run, inspect the ``molecule`` attributes:
9593

96-
- **Excited-State Energies** (`molecule.cis_energies`)
97-
Tensor of shape `(batch, n_states)` giving excitation energies (eV) above the ground state.
94+
- ``molecule.cis_energies`` Tensor of shape `(batch, n_states)` containing excitation energies (eV) above the ground state.
9895

99-
In addition, excitation energies and a few other useful quantities are printed to console.
96+
In addition, excitation energies and a few other useful quantities (transition dipole moments, oscillator strengths) are printed to console.
10097

10198
Batch Homogeneity Requirement
10299
-----------------------------

docs/source/geometry_optimization.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Overview
55
--------
66
PYSEQM provides two approaches for finding minimum-energy structures:
77

8-
- **geomeTRIC** integration via `geomeTRIC_optimization`
8+
- **geomeTRIC** integration
99

10-
Robust, advanced algorithms (`external package <https://geometric.readthedocs.io/en/latest/>`_; single-molecule only).
11-
- **Steepest-Descent (SD)** via `Geometry_Optimization_SD`
10+
Robust, advanced algorithms using an external package called `geomeTRIC <https://geometric.readthedocs.io/en/latest/>`_; single-molecule only.
11+
- **Steepest-Descent (SD)** via `Geometry_Optimization_SD` driver
1212

1313
Batch-capable but may converge extremely slowly or fail on complex surfaces.
1414

@@ -40,7 +40,6 @@ Example optimization with geomeTRIC
4040
import torch
4141
from seqm.seqm_functions.constants import Constants
4242
from seqm.Molecule import Molecule
43-
from seqm.ElectronicStructure import Electronic_Structure
4443
from seqm.geometryOptimization import geomeTRIC_optimization
4544
4645
torch.set_default_dtype(torch.float64)
@@ -75,13 +74,14 @@ Example optimization with geomeTRIC
7574
}
7675
7776
molecules = Molecule(const, seqm_parameters, coordinates, species).to(device)
77+
7878
geomeTRIC_optimization(molecules)
7979
8080
8181
8282
Built-in Steepest-Descent
8383
-------------------------
84-
Use `Geometry_Optimization_SD` for simple, batched optimization:
84+
Use `Geometry_Optimization_SD` driver for simple, batched optimizations:
8585

8686
.. code-block:: python
8787

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ PYSEQM (PYtorch based SemiEmpirical Quantum Mechanics) is is a flexible, high-pe
77
- **Semiempirical quantum chemical calculations**
88

99
Fast evaluation of molecular energies and forces using established semiempirical methods such as AM1, PM3, PM6.
10-
- **GPU accelerate calculations**
10+
- **GPU accelerated calculations**
1111

1212
Leverage NVIDIA CUDA hardware for highly accelerated simulations; also fully supported on CPU-only systems.
1313
- **Machine-learning integration**

docs/source/quick_start.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ Create a file called `run_quickstart.py` with the following contents:
4848
4949
# 4. Run single‐point SCF
5050
driver = Electronic_Structure(seqm_parameters).to(device)
51-
driver.(molecule)
51+
driver(molecule)
5252
5353
# 5. Print results
5454
print(f"Total Energy (eV): {molecule.Etot.item():.6f}")
5555
print(f"Heat of Formation: {molecule.Hf.item():.6f}")
56-
print(f"Force on Atoms:\n {molecule.force}")
56+
print(f"Force on Atoms:\n{molecule.force}")
5757
5858
3. Execute the Script
5959
---------------------

0 commit comments

Comments
 (0)