htmd.membranebuilder.build_membrane module#
- htmd.membranebuilder.build_membrane.buildMembrane(xysize, ratioupper, ratiolower, waterbuff=20, platform='CUDA', minimize=0, equilibrate=0, outdir=None, lipidf=None, forcefield_files=None, seed=None, solute=None, timestep_fs=2.0, head_z=15.0, head_restraint_k=0.0)#
Construct a membrane containing arbitrary lipids and ratios of them.
- Parameters:
xysize (list) – A list containing the size in x and y dimensions of the membrane in Angstroms
ratioupper (dict) – A dict with keys the molecule names and the ratio of that molecule for the upper layer
ratiolower (dict) – Same as ratioupper but for the lower layer
waterbuff (float) – The z-dimension size of the water box above and below the membrane
platform (str) – OpenMM platform on which to run the LJ-fluid lipid placement and the minimization/equilibration (‘CUDA’, ‘OpenCL’, ‘CPU’, or ‘Reference’)
minimize (int) – If not 0 it minimizes the membrane for the given number of steps
equilibrate (float) – If not 0 it equilibrates the membrane for the given number of nanoseconds
outdir (str) – A folder in which to store the output PDB files
lipidf (str) – The path to the folder containing the single-lipid PDB structures as well as the lipid DB file
forcefield_files (list[str] or None) – OpenMM ForceField XML files used to parameterize the membrane during minimization/equilibration. Defaults to AMBER Lipid17 + TIP3P (
["amber14/lipid17.xml", "amber14/tip3p.xml"]).seed (int or None) – Seed for the numpy global RNG. If provided, the build is reproducible (lipid conformer choice, initial rotations, and the LJ-fluid Halton shuffle). The OpenMM minimization/dynamics step is not seeded here.
solute (
Moleculeor None) – Optional pre-positioned solute (typically a protein) around which the membrane is built. The solute must be aligned with bilayer center at z=0; the membrane is shifted in XY to follow the solute’s membrane-embedded COM. The user’s Molecule is not modified.timestep_fs (float) – Integrator timestep in femtoseconds for the OpenMM equilibration. Default 2.0 (compatible with
constraints=HBonds).head_z (float) – Half-bilayer head-plane Z (Angstrom). Every lipid head is placed at
+head_z(upper leaflet) or-head_z(lower) regardless of species, so a mixed bilayer starts with a flat head plane that NPT relaxes to per-species depths. Default 15.0.head_restraint_k (float) – If > 0, apply a harmonic z-restraint of strength
head_restraint_k(kJ/mol/A^2) to each lipid head atom toward its initial head plane during minimization and equilibration. Default 0.0 (no restraint).
- Returns:
mol – The resulting membrane including surrounding waters
- Return type:
Molecule <moleculekit.molecule.Molecule
Examples
>>> lipidratioupper = {'popc': 10, 'chl1': 1} >>> lipidratiolower = {'popc': 8, 'chl1': 2} >>> width = [50, 100] >>> res = buildMembrane(width, lipidratioupper, lipidratiolower)
- htmd.membranebuilder.build_membrane.equilibrateMembrane(mol, minimize=0, equilibrate_ns=0, platform_name='CUDA', forcefield_files=None, temperature=300, timestep_fs=2.0, solute=None, head_anchors=None, head_restraint_k=0.0, head_atoms=None, water_resname='HOH', water_oxygen_name='O')#
Minimize and/or equilibrate a solvated membrane
molwith OpenMM.Works both for membranes built by
buildMembrane()and for user-supplied membranes (e.g. from CHARMM-GUI or another tool). The function detects the water naming used bymoland renames it to match the chosen force field XMLs. Whenhead_restraint_k > 0and no explicithead_anchorsare given, anchors are auto-derived via_headAnchorsFromMolecule().Equilibrated coordinates and the final box are written back into
molin place.- Parameters:
mol (moleculekit.molecule.Molecule) – Solvated membrane. Modified in place.
minimize (int) – Conjugate-gradient minimization steps before L-BFGS. 0 to skip.
equilibrate_ns (float) – Length of NPT equilibration in nanoseconds. 0 to skip.
platform_name (str) – OpenMM platform name (
CUDA,OpenCL,CPU,Reference).forcefield_files (list of str, optional) – Force field XMLs. Defaults to
["amber14/lipid17.xml", "amber14/tip3p.xml"].temperature (float) – Temperature in kelvin.
timestep_fs (float) – Integrator timestep in fs.
solute (moleculekit.molecule.Molecule, optional) – If given, heavy atoms of its membrane-spanning slab are added to the OpenMM System as frozen
mass=0particles so the lipids relax around the solute. The solute Molecule itself is not modified and ghost atoms are discarded before writing back.head_anchors (list of (int, float), optional) – Explicit
(atom_idx, z_target_A)anchors. IfNoneandhead_restraint_k > 0, anchors are auto-derived frommol.head_restraint_k (float) – Harmonic z-restraint constant (kcal/mol/A^2) on head atoms. 0 disables the restraint.
head_atoms (dict, optional) –
{resname: head_atom_name}used when auto-deriving anchors. Defaults to the htmd lipid library map.water_resname (str) – Target water resname and oxygen atom name expected by the chosen force field XML. Defaults match AMBER
tip3p.xml(HOH/O). Whatever water naming is detected inmolis renamed to these on a working copy;molitself is not renamed.water_oxygen_name (str) – Target water resname and oxygen atom name expected by the chosen force field XML. Defaults match AMBER
tip3p.xml(HOH/O). Whatever water naming is detected inmolis renamed to these on a working copy;molitself is not renamed.
- htmd.membranebuilder.build_membrane.listLipids()#
Lists all available lipids
Examples
>>> from htmd.membranebuilder.build_membrane import buildMembrane >>> build_membrane.listLipids() ---- Lipids list: ...
- htmd.membranebuilder.build_membrane.wrapping_dist_python(coor1, coor2, box)#