API Documentation

QMMM

class qmhub.QMMM(mode, driver=None, cwd=None)[source]

QMHub python module

__init__(mode, driver=None, cwd=None)[source]

Creates the QMHub module with the I/O mode, cwd, and driver.

Parameters:
  • mode (str)

  • driver (str, optional)

  • cwd (str, optional)

setup_simulation(protocol='md', **kwargs)[source]

Prepares a simulations with given protocols.

Parameters:

protocol (str, optional) – md is molecular dynamics.`mts` is multiple time step molecular dynamics, where multiple steps of molecular simulation are made between each quantum mechanical step. Default is md.

build_model(switching_type=None, cutoff=None, swdist=None, pbc=None)[source]

Creates a model to store atome positions and charges, takes several options with defaults of None.

Parameters:
  • switching_type (optional)

  • cutoff (optional)

  • swdit (optional)

  • pbc (optional)

add_engine(engine, name=None, group_name=None, cwd=None, options=None)[source]

The engine to model atom positions and charges. Default engine name is engine.

Parameters:
  • engine ()

  • name (str, optional)

  • group_name (str, optional)

  • cwd (str, optional)

  • options (str, optional)

return_results(output=None)[source]

Prints the simulation energy figures and energy gradient base on current simulations.

Parameters:

output (str, optional)

Atoms

class qmhub.atoms.Atoms(positions=None, charges=None, elements=None)[source]

QMHub atom object

__init__(positions=None, charges=None, elements=None)[source]

Stores position, charge, and element of atom object

Parameters:
  • positons (optional)

  • charges (optional)

  • elements (optional)

classmethod new(n_atoms)[source]

Appends the number of atoms to arrays of atom positions, charges, and elements.

Parameters:
  • cls ()

  • n_atoms (int)

classmethod from_atoms(atoms, index=None)[source]

Appends an atoms positons, charge, and elements to arrays of atom positions, charges, and elements.

Parameters:
  • cls ()

  • atoms (Atoms)

  • index (optionals)

Simulation

class qmhub.simulation.Simulation(protocol=None, engine_name=None, engine2_name=None, *, nrespa=None, scaling_factor=None)[source]

Simulation object stores energy gradient and energy values as an array with a dependency on the simulation step; among other factors such as the engine, protocol, and scaling factor needed by the simulation.

__init__(protocol=None, engine_name=None, engine2_name=None, *, nrespa=None, scaling_factor=None)[source]

Creates the simulation object by storing the variable the array needs, placing them in a list as needed to form the energy array and energy gradient array.

Parameters:
  • protocol (str, optional)

  • engine_name (str, optional)

  • engine2_name (str, optional)

  • nrespa (int, optional, keyword only)

  • scaling_factor (int, optional, keyword only)

add_engine(name, engine)[source]

Attaches engine to simulation object, and gives the energy array and energy gradient arrays those arrays brought by the engine.

Parameters:
  • name (str)

  • engine (str)

static _get_energy(step, energy, energy2=None, protocol=None, nrespa=None, scaling_factor=None)[source]

Retuerns the free energy of the system as a float. A static method for all instances of the simulation class. Will return 0 if ((step + 1) % nrespa)

Parameters:
  • step (int)

  • energy (Array)

  • energy2 (Array, optional)

  • protocol (str, optional)

  • nrespa (int, optional)

  • scaling_factor (int, optional)

Returns:

float

static _get_energy_gradient(step, gradient, gradient2=None, protocol=None, nrespa=None, scaling_factor=None)[source]

Returns the energy gradient and as Numpy array output. A static method for all instances of the simulation class.

Parameters:
  • step ()

  • gradient ()

  • gradient2 (optional)

Returns:

Numpy Array

Model

class qmhub.model.Model(qm_positions, positions, qm_charges, charges, cell_basis, qm_total_charge, switching_type=None, cutoff=None, swdist=None, pbc=None)[source]

QMHub Model object

__init__(qm_positions, positions, qm_charges, charges, cell_basis, qm_total_charge, switching_type=None, cutoff=None, swdist=None, pbc=None)[source]

Creates a Model object to store values for both the MM and QM simulation which are not part of the simulation’s engine.

Parameters:
  • qm_positions ()

  • positions ()

  • qm_charges ()

  • charges ()

  • cell_basis ()

  • qm_total_charge ()

  • switching_type (optional)

  • cutoff (optional)

  • swdist (optional)

  • pbc (optional)

get_result(name, qm_energy, qm_energy_gradient, mm_esp)[source]

Sets the attraction values of the named simulation with the results of the previous step.

Parameters:
  • name ()

  • qm_energy ()

  • qm_energy_gradient ()

  • mm_esp()

Engine

class qmhub.engine.Engine(qm_positions, qm_elements, mm_positions=None, mm_charges=None, charge=None, mult=None)[source]

QMHub Engine object

__init__(qm_positions, qm_elements, mm_positions=None, mm_charges=None, charge=None, mult=None)[source]

Creates an Engine object for QM simulations; which stores the elements and positions of the QM simulation, and optionally the positions and charges from the MM simulation. Also creates energy arrays and energy gradients arrays particular to the QM system.

Parameters:
  • qm_positions ()

  • qm_elements ()

  • mm_positions (optional)

  • mm_charges (optional)

  • charge (optional)

  • mult (optional)

add_engine(engine, name=None, cwd=None, options=None)[source]

Attaches an given engine to the dictionary of the Engine object, i.e. the set of engines; allowing for the results of different engines to be added together for additional module components, e.g. error correction.

Parameters:
  • engine (Engine)

  • name (str, optional)

  • cwd (optional)

  • options (str, optional)

System

class qmhub.system.System(n_atoms, n_qm_atoms, qm_charge, qm_mult)[source]

QMHub System object

__init__(n_atoms, n_qm_atoms, qm_charge, qm_mult)[source]

Creates system in which the simulation will run. Contains the total number of atoms to run the Molecular Mechanical simulation on, and the number of atoms to run the Quantum Mechanical simulation on. N.B. The numer of QM atoms cannot be greater than the number of total atoms.

Parameters:
  • n_atoms (int)

  • n_qm_atoms (int)

  • qm_charge ()

  • qm_mult ()

wrap_positions()[source]

Wraps the positon of MM atoms around the center of the QM atoms.