morfeus.dispersion module#

Dispersion code.

class morfeus.dispersion.Dispersion(elements, coordinates, radii=None, radii_type='rahm', point_surface=True, compute_coefficients=True, density=0.1, excluded_atoms=None, included_atoms=None)[source]#

Bases: object

Calculates and stores the results for the 🍺P_int dispersion descriptor.

The descriptor is defined in 10.1002/anie.201905439. Morfeus can compute it based on a surface either from vdW radii, surface vertices or the electron density. Dispersion can be obtained with the D3 or D4 model.

Parameters:
  • elements (Iterable[int] | Iterable[str]) – Elements as atomic symbols or numbers

  • coordinates (ArrayLike2D) – Coordinates (Å)

  • radii (ArrayLike1D | None) – VdW radii (Å)

  • radii_type (str) – Choice of vdW radii: ‘alvarez’, ‘bondi’, ‘crc’, ‘rahm’ and ‘truhlar’

  • point_surface (bool) – Use point surface from vdW radii

  • compute_coefficients (bool) – Whether to compute D3 coefficients with internal code

  • density (float) – Area per point (Ų) on the vdW surface

  • excluded_atoms (Sequence[int] | None) – Atoms to exclude (1-indexed). Used for substituent P_ints

  • included_atoms (Sequence[int] | None) – Atoms to include. Used for functional group P_ints

area#

Area of surface (Ų)

Type:

float

atom_areas#

Atom indices as keys and atom areas as values (Ų)

Type:

dict[int, float]

atom_p_int#

Atom indices as keys and P_int as values (kcal¹ᐟ² mol⁻¹⸍²))

Type:

dict[int, float]

atom_p_max#

Atom indices as keys and P_max as values (kcal¹ᐟ² mol⁻¹ᐟ²)

Type:

dict[int, float]

atom_p_min#

Atom indices as keys and P_min as values( kcal¹ᐟ² mol⁻¹ᐟ²)

Type:

dict[int, float]

p_int#

P_int value for molecule (kcal¹ᐟ² mol⁻¹ᐟ²)

Type:

float

p_max#

Highest P value (kcal¹ᐟ² mol⁻¹ᐟ²)

Type:

float

p_min#

Lowest P value (kcal¹ᐟ² mol⁻¹ᐟ²)

Type:

float

p_values#

All P values (kcal¹ᐟ² mol⁻¹ᐟ²)

Type:

Any

volume#

Volume of surface (ų)

Type:

float

Raises:

Exception – When both exluded_atoms and included_atom are given

Parameters:
  • elements (Iterable[int] | Iterable[str]) –

  • coordinates (ArrayLike2D) –

  • radii (ArrayLike1D | None) –

  • radii_type (str) –

  • point_surface (bool) –

  • compute_coefficients (bool) –

  • density (float) –

  • excluded_atoms (Sequence[int] | None) –

  • included_atoms (Sequence[int] | None) –

compute_coefficients(model='id3', order=8, charge=0)[source]#

Compute dispersion coefficients.

Can either use internal D3 model or D4 via Grimme’s dftd4 program.

Parameters:
  • model (str) – Calculation model: ‘id3’ (default) or ‘gd4’

  • order (int) – Order of the Cᴬᴬ coefficients

  • charge (int) – Molecular charge for D4 model

Returns:

Self

Return type:

self

Raises:

ValueError – When model not supported

compute_p_int(points=None)[source]#

Compute P_int values for surface or points.

Parameters:

points (ArrayLike2D | None) – Points to compute P values for

Returns:

Self

Return type:

self

load_coefficients(file, model)[source]#

Load the C₆ and C₈ coefficients.

Output can be read from the dftd3 and dftd4 programs by giving a file in combination with the corresponding model.

Parameters:
  • file (str | PathLike) – Output file from the dftd3 or dftd4 programs

  • model (str) – Calculation model: ‘d3’ or ‘d4’

Returns:

Self

Return type:

self

Raises:

ValueError – When model not supported

print_report(verbose=False)[source]#

Print report of results.

Parameters:

verbose (bool) – Whether to print atom P_ints

Return type:

None

save_vtk(filename)[source]#

Save surface as .vtk file.

Parameters:

filename (str) – Name of file. Use .vtk suffix.

Returns:

Self

Return type:

self

surface_from_cube(file, isodensity=0.001, method='flying_edges')[source]#

Adds an isodensity surface from a Gaussian cube file.

Parameters:
  • file (str | PathLike) – Gaussian cube file

  • isodensity (float) – Isodensity value (electrons/bohr³)

  • method (str) – Method for contouring: ‘contour’ or ‘flying_edges

Returns:

Self

Return type:

self

surface_from_multiwfn(file, fix_mesh=True)[source]#

Adds surface from Multiwfn vertex file with connectivity information.

Parameters:
  • file (str | PathLike) – Vertex.pdb file

  • fix_mesh (bool) – Whether to fix holes in the mesh with pymeshfix (recommended)

Returns:

Self

Return type:

self

morfeus.dispersion.cli(file)[source]#

CLI for dispersion descriptor.

Parameters:

file (str) – Geometry file

Returns:

Partially instantiated class

Return type:

Any