qml.qchem.Molecule

class Molecule(symbols, coordinates, charge=0, mult=1, basis_name='sto-3g', load_data=False, l=None, alpha=None, coeff=None, normalize=True)[source]

Bases: object

Create a molecule object that stores molecular information and default basis set parameters.

The molecule object can be passed to functions that perform a Hartree-Fock calculation.

Parameters
  • symbols (list[str]) – Symbols of the atomic species in the molecule. Currently, atoms with atomic numbers 1-10 are supported.

  • coordinates (array[float]) – 1D array with the atomic positions in Cartesian coordinates. The coordinates must be given in atomic units and the size of the array should be 3*N where N is the number of atoms.

  • charge (int) – net charge of the molecule

  • mult (int) – Spin multiplicity \(\mathrm{mult}=N_\mathrm{unpaired} + 1\) for \(N_\mathrm{unpaired}\) unpaired electrons occupying the HF orbitals. Currently, openshell systems are not supported; mult must be equal to \(1\).

  • basis_name (str) – Atomic basis set used to represent the molecular orbitals. Currently, the only supported basis sets are ‘STO-3G’, ‘6-31G’, ‘6-311G’ and ‘CC-PVDZ’.

  • load_data (bool) – flag to load data from the basis-set-exchange library

  • l (tuple[int]) – angular momentum quantum numbers of the basis function

  • alpha (array[float]) – exponents of the primitive Gaussian functions

  • coeff (array[float]) – coefficients of the contracted Gaussian functions

  • r (array[float]) – positions of the Gaussian functions

  • normalize (bool) – if True, the basis functions get normalized

Example

>>> symbols  = ['H', 'H']
>>> geometry = np.array([[0.0, 0.0, -0.694349],
>>>                      [0.0, 0.0,  0.694349]], requires_grad = True)
>>> mol = Molecule(symbols, geometry)
>>> print(mol.n_electrons)
2

atomic_orbital(index)

Return a function that evaluates an atomic orbital at a given position.

molecular_orbital(index)

Return a function that evaluates a molecular orbital at a given position.

atomic_orbital(index)[source]

Return a function that evaluates an atomic orbital at a given position.

Parameters

index (int) – index of the atomic orbital, order follwos the order of atomic symbols

Returns

function that computes the value of the orbital at a given position

Return type

function

Example

>>> symbols  = ['H', 'H']
>>> geometry = np.array([[0.0, 0.0, 0.0], [0.0, 0.0, 1.0]], requires_grad = False)
>>> mol = qml.qchem.Molecule(symbols, geometry)
>>> ao = mol.atomic_orbital(0)
>>> ao(0.0, 0.0, 0.0)
0.62824688
molecular_orbital(index)[source]

Return a function that evaluates a molecular orbital at a given position.

Parameters

index (int) – index of the molecular orbital

Returns

function to evaluate the molecular orbital

Return type

function

Example

>>> symbols  = ['H', 'H']
>>> geometry = np.array([[0.0, 0.0, 0.0], [0.0, 0.0, 1.0]], requires_grad = False)
>>> mol = qml.qchem.Molecule(symbols, geometry)
>>> qml.qchem.scf(mol)() # run scf to obtain the optimized molecular orbitals
>>> mo = mol.molecular_orbital(1)
>>> mo(0.0, 0.0, 0.0)
0.01825128