from spotoptim.function import lennard_jones
import numpy as np
rng = np.random.default_rng(42)
X = rng.random(39) # 13 atoms * 3 coords, in [0, 1]
lennard_jones(X)array([74.35227958])
Lennard-Jones Atomic Cluster Potential Energy.
Calculates the potential energy of a cluster of N atoms interacting via the Lennard-Jones potential. The optimization problem involves finding the atomic coordinates that minimize the total potential energy. This is a classic benchmark problem known for its high difficulty due to the exponential growth of local minima with N.
The function accepts inputs in the range [0, 1] and internally maps them to the search domain [-2, 2] for each coordinate.
| Name | Type | Description | Default |
|---|---|---|---|
| X | np.ndarray | Input points. - Shape (n_samples, 3 * n_atoms) for batch evaluation. - Shape (3 * n_atoms,) for single evaluation. The input represents the flattened [x1, y1, z1, x2, y2, z2, …] coordinates. | required |
| n_atoms | int | Number of atoms in the cluster. Defaults to 13. | 13 |
| Name | Type | Description |
|---|---|---|
| np.ndarray | np.ndarray: Potential energy values. Shape (n_samples,). |
| Name | Type | Description |
|---|---|---|
| ValueError | If input dimensions do not match 3 * n_atoms. |
Single point evaluation (random configuration):
array([74.35227958])
Batch evaluation:
Wales, D. J., & Doye, J. P. (1997). Global optimization by basin-hopping and the lowest energy structures of Lennard-Jones clusters containing up to 110 atoms. The Journal of Physical Chemistry A, 101(28), 5111-5116.