4. Modules¶
4.1. gen_mesh
— Mesh generation¶
This module contains functions that are necessary to generate and optimize meshes by numerical error thresholds of the initial-guess density.
- var_mesh.gen_mesh.atom_amount(mol)[source]¶
Get the amount of atoms in a molecule.
- Args:
- mol :
Object of class
Mole
.
- Returns: dict
Atom type identifiers as keys and amounts as values.
- var_mesh.gen_mesh.atom_types(mol)[source]¶
Get types of atoms in a molecule.
- Args:
- mol :
Object of class
Mole
.
- Returns: set
Unique atom type identifiers.
- var_mesh.gen_mesh.build_mesh(mesh, types, levels, mode)[source]¶
Build mesh for given grid levels.
- Args:
- mesh :
Object of class
Grids
.- typeslist
Atom type identifiers.
- levelslist
Grid levels per atom type.
- modestr
Set the output format. If the code does not support different grids for different atom types, only the largest atom grid will be used in an optimization step. Can be one of
'pyscf'
,'erkale'
or'gamess'
.
- Returns:
Object of class
Grids
.
- var_mesh.gen_mesh.get_ang(symb, level)[source]¶
Get angular grids.
- Args:
- symbstr
Atom type identifier.
- levelint
Grid level of atom type.
- Returns: int
Amount of angular grids.
- var_mesh.gen_mesh.get_combs(mol, level)[source]¶
Generate possible grid level combinations for a fine grid search.
- Args:
- mol :
Object of class
Mole
.- levelint
Grid level of the found match in the coarse grid search.
- Returns: ndarray
Possible combinations of grid levels.
- var_mesh.gen_mesh.get_rad(symb, level)[source]¶
Get radial grids.
- Args:
- symbstr
Atom type identifier.
- levelint
Grid level of atom type.
- Returns: int
Amount of radial grids.
- var_mesh.gen_mesh.get_steps()[source]¶
Get the maximum number of optimization steps.
- Returns: int
Largest grid level.
- var_mesh.gen_mesh.mesh_error(mf)[source]¶
Calculate the error per electron when integrating the electron density.
- Args:
- mol :
Object of class
RKS
orUKS
.
- Returns: float
Mesh error.
- var_mesh.gen_mesh.var_mesh(mesh, thres=1e-06, precise=True, mode='pyscf')[source]¶
Minimize grid points for a given error threshold for the initial density.
- Args:
- mesh :
Object of class
Grids
.
- Kwargs:
- thresfloat
Maximum error of the initial-guess density (normalized to one electron).
- precisebool
Disable the coarse grid search when set to
False
. This will speed up the mesh generation but results in more grid points.- modestr
Set the output format. If the code does not support different grids for different atom types, only the largest atom grid will be used in an optimization step. Can be one of
'pyscf'
,'erkale'
or'gamess'
.
- Returns:
Object of class
Grids
.
4.2. helpers
— Mesh visualization¶
This module contains functions to visualize different meshes, but are not necessary to generate them.
- var_mesh.helpers.plot_mesh_2d(mesh, weight=False, plane='xy')[source]¶
Project atoms and grid points to a given plane in a 2d plot.
- Args:
- mesh :
Object of class
Grids
.
- Kwargs:
- weightbool or int
Scale grid points by their weights when set to
True
. Integers will scale grid points.- planestr
Contains the plane to project on to. Needs two elements of
'x'
,'y'
, and'z'
.