htmd.membranebuilder.globalminimization module#

htmd.membranebuilder.globalminimization.minimize(lipids, box, stepxy=0.5, steprot=50, contactthresh=2.6)#

Minimize lipid packing by reducing inter-lipid contacts via basin-hopping.

Jointly optimizes the XY positions and Z-rotation angles of all lipids in a single leaflet using SciPy’s basin-hopping algorithm on an L-BFGS-B inner minimizer. The objective function counts the number of inter-lipid atom contacts within contactthresh Angstroms.

Parameters:
  • lipids (list) – List of _Lipid objects with mol, xyz, headname, and neighbours attributes.

  • box (list | ndarray) – Periodic box dimensions used for minimum-image wrapping of inter-lipid distances.

  • stepxy (float) – Maximum XY displacement (Angstroms) per basin-hopping step.

  • steprot (float) – Maximum rotation displacement (degrees) per basin-hopping step.

  • contactthresh (float) – Distance threshold in Angstroms below which two atoms are counted as in contact.

Return type:

tuple

Returns:

  • newpos (numpy.ndarray) – Optimized XY positions for each lipid, shape (N, 2).

  • newrot (numpy.ndarray) – Optimized Z-rotation angles in degrees, shape (N,).