MD calculations explode
mamo248 opened this issue · comments
mamo248 commented
Hi,
I tried using the AIMnet ASE calculator to run some MD calculations, but my molecule instantly explodes and the temperature is goes to thousands of kelvin. Does AIMnet not yet work for MD calculations or am I doing something wrong?
from aimnet2ase import AIMNet2Calculator
import torch
from ase.io import read
from ase import units
from ase.md.langevin import Langevin
from ase.md.velocitydistribution import MaxwellBoltzmannDistribution, Stationary, ZeroRotation
torch.backends.cuda.matmul.allow_tf32 = False
torch.backends.cudnn.allow_tf32 = False
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
print(device)
aimnet = torch.jit.load("aimnet2_b973c_ens.jpt", map_location=device)
calc = AIMNet2Calculator(aimnet)
atoms = read("Benzene.xyz")
print(atoms)
calc.do_reset()
calc.set_charge(0)
atoms.set_calculator(calc)
MaxwellBoltzmannDistribution(atoms, temperature_K=300)
Stationary(atoms) # zero linear momentum
ZeroRotation(atoms) # zero angular momentum
dyn = Langevin(atoms, timestep=5.0 * units.fs, temperature_K=300, friction=0.002,
trajectory='md.traj', logfile='md.log')
dyn.run(2000) # take 1000 steps
Olexandr Isayev commented
Hi, your 5fs time step is insanely large! As with ab initio MD, you must use something closer to 0.1 or 0.2 fs time step.
mamo248 commented
Ah, stupid mistake, thanks a lot!