GapMD
GapMD is an efficient way to explore the region near the conical intersections, see for details:
Mikołaj Martyka, Lina Zhang, Fuchun Ge, Yi-Fan Hou, Joanna Jankowska, Mario Barbatti, Pavlo O. Dral. Charting electronic-state manifolds across molecules with multi-state learning and gap-driven dynamics via efficient and robust active learning. 2024. Preprint on ChemRxiv: https://doi.org/10.26434/chemrxiv-2024-dtc1w.
Zip with tutorial materials
including Jupyter notebook:
import mlatom as ml
#Load some database of initial conditions.
initial_conditions = ml.data.molecular_database.load("init_cond_db.json", format="json")
#Define a model, we will use the AL-trained ML model for fulvene.
ml_model = ml.models.msani(model_file='fulvene_energy_iteration_19.npz')
model loaded from fulvene_energy_iteration_19.npz
#Initialize a gapMD run
dyn = ml.gap_md(
model = ml_model,
molecule = initial_conditions[-1],
ensemble='NVE',
time_step=0.5,
maximum_propagation_time = 100,
lower_state =0,
upper_state =1,
current_state=1,
nstates=2,
gap_threshold=0.03,
)
#View the gap dynamics. Notice the ethylenic-type CI twisting between the
#5-membered ring and =CH2.
dyn.molecular_trajectory.view()
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
#GapMD can also be ran in parallel. For that we need to prepare parameters,
#like for NAMD...
gapmd_kwargs ={
'model':ml_model,
'ensemble':'NVE',
'time_step':0.5,
'maximum_propagation_time':100,
'lower_state':0,
'upper_state':1,
'current_state':1,
'nstates':2,
'gap_threshold':0.03}
#... and use the same method, run_in_parallel to run them all.
dyns = ml.simulations.run_in_parallel(molecular_database=initial_conditions[:2], task=ml.gap_md, task_kwargs=gapmd_kwargs, create_and_keep_temp_directories=False)
trajs = [d.molecular_trajectory for d in dyns]
for traj in trajs:
traj.view()
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
#MLatom trajectories can be analyzed and visualized using simple Python code. An example below.
energies = [[],[]]
time = []
gap = []
for step in trajs[0].steps:
energies[0].append(step.molecule.electronic_states[0].energy)
energies[1].append(step.molecule.electronic_states[1].energy)
time.append(step.time)
gap.append(step.molecule.electronic_states[1].energy-step.molecule.electronic_states[0].energy)
import matplotlib.pyplot as plt
import numpy as np
plt.plot(time, np.transpose(energies))
plt.xlabel("Time (fs)")
plt.ylabel("Energy (Hartree)")
plt.legend(['S0', 'S1'])
<matplotlib.legend.Legend at 0x2b520fd35880>
plt.plot(time, gap)
plt.xlabel("Time (fs)")
plt.ylabel("Gap (Hartree)")
Text(0, 0.5, 'Gap (Hartree)')