pyscf.md package

Submodules

pyscf.md.integrators module

class pyscf.md.integrators.Frame(ekin=None, epot=None, coord=None, veloc=None, time=None)[source]

Bases: object

Basic class to hold information at each time step of a MD simulation

Attributes:
ekinfloat

Kinetic energy

epotfloat

Potential energy (electronic energy)

etotfloat

Total energy, sum of the potential and kinetic energy

coord2D array with shape (natm, 3)

Geometry of the system at the current time step

veloc2D array with shape (natm, 3)

Velocities of the system at the current time step

timefloat

Time for which this frame represents

class pyscf.md.integrators.Integrator(method, **kwargs)[source]

Bases: object

Integrator base class

Args:

method : lib.GradScanner, rhf.GradientsMixin instance, or has nuc_grad_method method.

Method by which to compute the energy gradients and energies in order to propogate the equations of motion. Realistically, it can be any callable object such that it returns the energy and potential energy gradient when given a mol.

Attributes:
incore_anywaybool

If true, then it will save every frame in memory. False, no frames are saved.

velocndarray

Initial velocity for the simulation. Values should be given in atomic units (Bohr/a.u.). Dimensions should be (natm, 3) such as

[[x1, y1, z1], [x2, y2, z2], [x3, y3, z3]]

verboseint

Print level

stepsint

Number of steps to take when the kernel or run function is called.

dtfloat

Time between steps. Given in atomic units.

stdoutfile object

Default is self.scanner.mol.stdout.

energy_outputfile object

Stream to write energy to during the course of the simulation.

trajectory_outputfile object

Stream to write the trajectory to during the course of the simulation. Written in xyz format.

framesndarray of Frames or None

If incore_anyway is true, then this will hold a list of frames corresponding to the simulation trajectory.

epotfloat

Potential energy of the last time step during the simulation.

ekinfloat

Kinetic energy of the last time step during the simulation

timefloat

Time of the last step during the simulation.

callbackfunction(envs_dict) => None

Callback function takes one dict as the arugment which is generaged by the builtin function locals(), so that the callback function can access all local variables in the current environment.

check_sanity()[source]
compute_kinetic_energy()[source]

Compute the kinetic energy of the current frame.

dump_input(verbose=None)[source]
kernel(veloc=None, steps=None, dump_flags=True, verbose=None)[source]

Runs the molecular dynamics simulation.

Args:
velocndarray

Initial velocity for the simulation. Values should be given in atomic units (Bohr/a.u.). Dimensions should be (natm, 3) such as

[[x1, y1, z1],

[x2, y2, z2], [x3, y3, z3]]

stepsint

Number of steps to take when the kernel or run function is called.

dump_flagsbool

Print flags to output.

verboseint

Print level

Returns:

Integrator with final epot, ekin, mol, and veloc of the simulation.

run(veloc=None, steps=None, dump_flags=True, verbose=None)

Runs the molecular dynamics simulation.

Args:
velocndarray

Initial velocity for the simulation. Values should be given in atomic units (Bohr/a.u.). Dimensions should be (natm, 3) such as

[[x1, y1, z1],

[x2, y2, z2], [x3, y3, z3]]

stepsint

Number of steps to take when the kernel or run function is called.

dump_flagsbool

Print flags to output.

verboseint

Print level

Returns:

Integrator with final epot, ekin, mol, and veloc of the simulation.

class pyscf.md.integrators.VelocityVerlet(method, **kwargs)[source]

Bases: Integrator

Velocity Verlet algorithm

Args:

method : lib.GradScanner or rhf.GradientsMixin instance, or has nuc_grad_method method.

Method by which to compute the energy gradients and energies in order to propogate the equations of motion. Realistically, it can be any callable object such that it returns the energy and potential energy gradient when given a mol.

Attributes:
accelndarray

Current acceleration for the simulation. Values are given in atomic units (Bohr/a.u.^2). Dimensions is (natm, 3) such as

[[x1, y1, z1], [x2, y2, z2], [x3, y3, z3]]

pyscf.md.integrators.kernel(integrator, verbose=3)[source]

Module contents

Molecular Dynamics

Simple usage:

>>> from pyscf import gto, dft
>>> import pyscf.md as md
>>> mol = gto.M(atom='N 0 0 0; N 0 0 1', basis='def2-tzvp')
>>> mf = dft.RKS(mol)
>>> mf.xc = 'pbe,pbe'
>>> integrator = md.NVE(mf, dt=5, time=10).run()