htmd.membranebuilder.ringpenetration module#

htmd.membranebuilder.ringpenetration.getAllNeighbours(lipids: list, idx: int) list#
htmd.membranebuilder.ringpenetration.least_square_fit_plane(coords: ndarray)#
htmd.membranebuilder.ringpenetration.moveLipidToPos(mol, lip)#
htmd.membranebuilder.ringpenetration.resolveRingPenetrations(lipids: list, box: list | ndarray, max_iterations: int = 50)#

Iteratively resolve ring penetrations between neighboring lipids.

Detects pairs of lipids where one lipid’s chain atoms thread through another’s aromatic or aliphatic ring (e.g. cholesterol). When a penetration is found, the offending lipid is rotated by 10 degrees around the Z-axis and the check is repeated. If all penetrations are resolved before max_iterations, the function returns normally; otherwise a warning is logged.

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

  • box (list or np.ndarray) – Periodic box dimensions (XY) used for minimum-image wrapping when checking neighbor distances.

  • max_iterations (int) – Maximum number of rotation-and-recheck cycles before giving up.

htmd.membranebuilder.ringpenetration.wrap(coor: ndarray, com2: ndarray, box: ndarray) ndarray#