nanotools.bindingcurve module

class nanotools.bindingcurve.BindingCurve(displacements=None, separations=<Quantity([3.  3.2 3.4 3.6 3.8 4.  4.2 4.4 4.6 4.8 5. ], 'angstrom')>, free_energies=None, total_energy_calc: ~nanotools.totalenergy.TotalEnergy | None = None, workdir='./')[source]

Bases: Base

generate_inputs()[source]

Generate input files for all separations.

get_binding_curve()[source]

Returns the fine grid and the binding curve sampled on the find grid.

get_bond_length()[source]

Returns the equilibrium bond length.

get_curve_fit()[source]

Returns a spline interpolation function.

Returns:

spline interpolator.

Return type:

PPoly

get_fine_grid(resolution=0.001)[source]

Returns a fine grid sampling the separation interval.

get_force()[source]

Returns the fine grid and the force sampled on the find grid.

get_free_energies()[source]

Returns the free energy of each separation.

Returns:

list of free energies.

Return type:

List[Quantity]

plot(figure=None, filename=None, shift=False, show=True, label=None)[source]

Plot the binding curve.

Parameters:
  • figure (Figure, optional) – Pyplot figure handle. Defaults to None.

  • filename (str, optional) – if not None, the figure is saved to filename. Defaults to None.

  • shift (bool, optional) – shift the last energy to zero. Defaults to False.

  • show (bool, optional) – display figure before returning. Defaults to True.

  • label (str, optional) – label for the legend. Defaults to None.

Returns:

Pyplot figure handle.

Return type:

Figure

solve(n_jobs=1)[source]

Perform a total energy calculation for each separation.

Parameters:

n_jobs (int, optional) – Perform n_jobs total energy calculations in parallel. Defaults to 1.

class nanotools.bindingcurve.Displacement(separation, free_energy=None, workdir: str = '/')[source]

Bases: Base

Displacement class.

separation

Quantity Distance between the two atoms.

Type:

pint.registry.Quantity

free_energy

Quantity Free energy of the system.

Type:

pint.registry.Quantity

workdir

str Working directory for calculations.

Type:

str

generate_input(calc)[source]

Generates input files.

get_calc(calc)[source]

Returns a total energy calculator.

get_free_energy()[source]

Returns the free energy of the system.

Raises:

Exception – Missing output file.

Returns:

Free energy

Return type:

float

get_output_paths()[source]

Returns the JSON and HDF5 output paths.

solve(calc)[source]

Performs a total energy calculation.

Parameters:

calc (TotalEnergy) – total energy calculator.