Skip to content

Commit cc54082

Browse files
committed
update
1 parent 0c079a4 commit cc54082

File tree

11 files changed

+960
-489
lines changed

11 files changed

+960
-489
lines changed

docs/_static/logo.png

99.6 KB
Loading

docs/source/Examples.rst

Lines changed: 185 additions & 248 deletions
Large diffs are not rendered by default.

docs/source/Examples_old.rst

Lines changed: 294 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,294 @@
1+
Examples
2+
============
3+
4+
5+
Excited States RIS
6+
------------------------------
7+
8+
.. code-block:: python
9+
10+
11+
import torch
12+
from seqm.seqm_functions.constants import Constants
13+
from seqm.Molecule import Molecule
14+
from seqm.ElectronicStructure import Electronic_Structure
15+
16+
import warnings
17+
warnings.filterwarnings("ignore")
18+
19+
torch.set_default_dtype(torch.float64)
20+
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
21+
22+
# Define species and coordinates
23+
species = torch.as_tensor([[6, 1, 1, 1, 1]], dtype=torch.int64, device=device)
24+
coordinates = torch.tensor([[
25+
[ 0.00000, 0.00000, 0.00000],
26+
[ 0.00000, 0.00000, 1.08900],
27+
[ 1.02672, 0.00000, -0.36300],
28+
[-0.51336, -0.88916, -0.36300],
29+
[-0.51336, 0.88916, -0.36300],
30+
]], device=device)
31+
32+
# Set up constants and parameters
33+
const = Constants().to(device)
34+
elements = [0] + sorted(set(species.reshape(-1).tolist()))
35+
36+
seqm_parameters = {
37+
'method': 'AM1',
38+
'scf_eps': 1.0e-6,
39+
'scf_converger': [2, 0.0],
40+
'sp2': [False, 1.0e-5],
41+
'elements': elements,
42+
'learned': [],
43+
'pair_outer_cutoff': 1.0e10,
44+
'eig': True,
45+
'excited_states': {'n_states': 10, 'method': 'rpa'},
46+
}
47+
48+
# Create molecule and electronic structure driver
49+
molecules = Molecule(const, seqm_parameters, coordinates, species).to(device)
50+
esdriver = Electronic_Structure(seqm_parameters).to(device)
51+
esdriver(molecules)
52+
53+
54+
55+
56+
Excited States CIS
57+
------------------------------
58+
59+
.. code-block:: python
60+
61+
62+
import torch
63+
from seqm.seqm_functions.constants import Constants
64+
from seqm.Molecule import Molecule
65+
from seqm.ElectronicStructure import Electronic_Structure
66+
67+
import warnings
68+
warnings.filterwarnings("ignore")
69+
70+
torch.set_default_dtype(torch.float64)
71+
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
72+
73+
# Define species and coordinates
74+
species = torch.as_tensor([[6, 1, 1, 1, 1]], dtype=torch.int64, device=device)
75+
coordinates = torch.tensor([[
76+
[ 0.00000, 0.00000, 0.00000],
77+
[ 0.00000, 0.00000, 1.08900],
78+
[ 1.02672, 0.00000, -0.36300],
79+
[-0.51336, -0.88916, -0.36300],
80+
[-0.51336, 0.88916, -0.36300],
81+
]], device=device)
82+
83+
# Set up constants and parameters
84+
const = Constants().to(device)
85+
elements = [0] + sorted(set(species.reshape(-1).tolist()))
86+
87+
seqm_parameters = {
88+
'method': 'AM1',
89+
'scf_eps': 1.0e-6,
90+
'scf_converger': [2, 0.0],
91+
'sp2': [False, 1.0e-5],
92+
'elements': elements,
93+
'learned': [],
94+
'pair_outer_cutoff': 1.0e10,
95+
'eig': True,
96+
'excited_states': {'n_states': 10, 'method': 'cis'},
97+
}
98+
99+
# Create molecule and electronic structure driver
100+
molecules = Molecule(const, seqm_parameters, coordinates, species).to(device)
101+
esdriver = Electronic_Structure(seqm_parameters).to(device)
102+
esdriver(molecules)
103+
104+
105+
106+
107+
108+
109+
BOMD
110+
------------------------------
111+
112+
.. code-block:: python
113+
114+
115+
116+
import torch
117+
from seqm.seqm_functions.constants import Constants
118+
from seqm.Molecule import Molecule
119+
from seqm.MolecularDynamics import Molecular_Dynamics_Basic
120+
from seqm.MolecularDynamics import Molecular_Dynamics_Langevin
121+
122+
123+
# Use double precision
124+
torch.set_default_dtype(torch.float64)
125+
126+
# Select device
127+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
128+
129+
# Define atomic species and coordinates
130+
species = torch.tensor([[8, 6, 1, 1], [5, 1, 1, 1]], dtype=torch.int64, device=device)
131+
132+
coordinates = torch.tensor(
133+
[
134+
[
135+
[0.00, 0.0, 0.0],
136+
[1.22, 0.0, 0.0],
137+
[1.82, 0.94, 0.0],
138+
[1.82, -0.94, 0.0],
139+
],
140+
[
141+
[0.00, 0.00, 0.00],
142+
[1.20, 0.00, 0.00],
143+
[-0.60, 1.03, 0.00],
144+
[-0.60, -1.03, 0.00],
145+
],
146+
],
147+
device=device,
148+
)
149+
150+
# Constants and SEQM parameters
151+
const = Constants().to(device)
152+
elements = [0] + sorted(set(species.reshape(-1).tolist()))
153+
154+
seqm_parameters = {
155+
"method": "AM1",
156+
"scf_eps": 1.0e-6,
157+
"scf_converger": [2, 0.0],
158+
"sp2": [False, 1.0e-5],
159+
"elements": elements,
160+
"learned": [],
161+
"pair_outer_cutoff": 1.0e10,
162+
"eig": True,
163+
}
164+
165+
# Output settings
166+
output = {
167+
"molid": [0, 1],
168+
"thermo": 1,
169+
"dump": 1,
170+
"prefix": "Outputs/MD_BOMD",
171+
}
172+
173+
# Create molecule object
174+
molecule = Molecule(const, seqm_parameters, coordinates, species).to(device)
175+
176+
# Example 1: Basic NVE dynamics
177+
md_nve = Molecular_Dynamics_Basic(
178+
seqm_parameters=seqm_parameters, Temp=400.0, timestep=0.4, output=output
179+
).to(device)
180+
md_nve.initialize_velocity(molecule)
181+
md_nve.run(molecule, steps=10, remove_com=[True, 1], Info_log=True)
182+
183+
# Example 2: NVE with energy shift compensation
184+
output["prefix"] = "Outputs/MD_BOMD_Energy_Control"
185+
md_energy_control = Molecular_Dynamics_Basic(
186+
seqm_parameters=seqm_parameters, Temp=400.0, timestep=0.4, output=output
187+
).to(device)
188+
md_energy_control.initialize_velocity(molecule)
189+
md_energy_control.run(
190+
molecule, steps=10, control_energy_shift=True, remove_com=[True, 1], Info_log=True
191+
)
192+
193+
# Example 3: NVT with temperature control
194+
output["prefix"] = "Outputs/MD_BOMD_Temp_Control"
195+
md_temp_control = Molecular_Dynamics_Basic(
196+
seqm_parameters=seqm_parameters, Temp=400.0, timestep=0.4, output=output
197+
).to(device)
198+
md_temp_control.initialize_velocity(molecule)
199+
md_temp_control.run(
200+
molecule, steps=10, scale_vel=[1, 400], remove_com=[True, 1], Info_log=True
201+
)
202+
203+
# Example 4: Langevin dynamics
204+
output["prefix"] = "Outputs/MD_BOMD_Langevin"
205+
md_langevin = Molecular_Dynamics_Langevin(
206+
damp=100.0, seqm_parameters=seqm_parameters, Temp=400.0, timestep=0.4, output=output
207+
).to(device)
208+
md_langevin.initialize_velocity(molecule)
209+
md_langevin.run(molecule, steps=10, remove_com=[True, 1], Info_log=True)
210+
211+
212+
213+
214+
215+
XL-BOMD
216+
------------------------------
217+
218+
.. code-block:: python
219+
220+
221+
import torch
222+
from seqm.seqm_functions.constants import Constants
223+
from seqm.Molecule import Molecule
224+
from seqm.MolecularDynamics import KSA_XL_BOMD
225+
226+
# Set default tensor precision
227+
torch.set_default_dtype(torch.float64)
228+
torch.manual_seed(0)
229+
230+
# Set device
231+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
232+
233+
# Define species and coordinates
234+
species = torch.tensor([[8, 6, 1, 1], [5, 1, 1, 1]], dtype=torch.int64, device=device)
235+
236+
coordinates = torch.tensor([
237+
[
238+
[0.00, 0.0, 0.0],
239+
[1.22, 0.0, 0.0],
240+
[1.82, 0.94, 0.0],
241+
[1.82, -0.94, 0.0],
242+
],
243+
[
244+
[0.00, 0.00, 0.00],
245+
[1.20, 0.00, 0.00],
246+
[-0.60, 1.03, 0.00],
247+
[-0.60, -1.03, 0.00],
248+
]
249+
], device=device)
250+
251+
# Load constants and configure parameters
252+
const = Constants().to(device)
253+
elements = [0] + sorted(set(species.reshape(-1).tolist()))
254+
255+
seqm_parameters = {
256+
'method': 'AM1',
257+
'scf_eps': 1.0e-6,
258+
'scf_converger': [2, 0.0],
259+
'sp2': [False, 1.0e-5],
260+
'elements': elements,
261+
'learned': [],
262+
'pair_outer_cutoff': 1.0e10,
263+
'eig': True
264+
}
265+
266+
# Output and KSA-XL-BOMD specific parameters
267+
output = {
268+
'molid': [0, 1],
269+
'thermo': 1,
270+
'dump': 1,
271+
'prefix': 'Outputs/KSA_XL_BOMD'
272+
}
273+
274+
xl_bomd_params = {
275+
'k': 6,
276+
'max_rank': 3,
277+
'err_threshold': 0.0,
278+
'T_el': 1500
279+
}
280+
281+
# Initialize molecule and dynamics engine
282+
molecule = Molecule(const, seqm_parameters, coordinates, species).to(device)
283+
284+
md = KSA_XL_BOMD(
285+
xl_bomd_params=xl_bomd_params,
286+
seqm_parameters=seqm_parameters,
287+
Temp=400.0,
288+
timestep=0.4,
289+
output=output
290+
).to(device)
291+
292+
# Initialize velocity and run dynamics
293+
md.initialize_velocity(molecule)
294+
md.run(molecule, steps=10, remove_com=[True, 1], Info_log=True)

docs/source/about.rst

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,13 @@ Developers & Contributors
1111
- Benjamin Nebgen, LANL
1212
- Sergei Tretiak, LANL
1313

14-
**Collaborating Institutions**
15-
16-
- Los Alamos National Laboratory (LANL)
17-
- Center for Nonlinear Studies (CNLS)
18-
- T-1, Theoretical Division, LANL
19-
- U.S. Department of Energy (DOE)
2014

2115

2216
How to Cite
2317
---------------
2418

2519
If you use PYSEQM in your research, please cite the following works:
2620

27-
1. **GPU-Accelerated Semiempirical BOMD**
28-
*Guoqing Zhou, et al.*
29-
_Graphics processing unit-accelerated semiempirical Born Oppenheimer molecular dynamics using PyTorch._
30-
*J. Chem. Theory Comput.* **16** (2020): 4951–4962.
31-
https://doi.org/10.1021/acs.jctc.0c00379
32-
33-
2. **Machine-Learned Hamiltonians via Semi-Empirical QM**
34-
*Guoqing Zhou, et al.*
35-
_Deep learning of dynamically responsive chemical Hamiltonians with semiempirical quantum mechanics._
36-
*Proceedings of the National Academy of Sciences* **119.27** (2022): e2120333119.
37-
https://doi.org/10.1073/pnas.2120333119
38-
39-
3. **GPU-Accelerated Linear-Scaling DFTB for Large Systems**
40-
*Guoqing Zhou, William Colglazier, et al.*
41-
_GPU-accelerated linear-scaling density functional tight binding for modeling large molecules and materials._
42-
*J. Chem. Theory Comput.* **19** (2023): 4450–4461.
43-
https://doi.org/10.1021/acs.jctc.3c00179
21+
1. Zhou, G., Lubbers, N., Barros, K., Tretiak, S., & Nebgen, B. (2022). Deep learning of dynamically responsive chemical Hamiltonians with semiempirical quantum mechanics. Proceedings of the National Academy of Sciences, 119(27), e2120333119. https://doi.org/10.1073/pnas.2120333119
22+
2. Kulichenko, M., Barros, K., Lubbers, N., Fedik, N., Zhou, G., Tretiak, S., Nebgen, B., & Niklasson, A. M. N. (2023). Semi-empirical shadow molecular dynamics: A PyTorch implementation. Journal of Chemical Theory and Computation, 19(11), 3209–3222. https://doi.org/10.1021/acs.jctc.3c00234
23+
3. Zhou, G., Nebgen, B., Lubbers, N., Malone, W., Niklasson, A. M. N., & Tretiak, S. (2020). Graphics processing unit-accelerated semiempirical Born–Oppenheimer molecular dynamics using PyTorch. Journal of Chemical Theory and Computation, 16(8), 4951–4962. https://doi.org/10.1021/acs.jctc.0c00243

0 commit comments

Comments
 (0)