MDFactoryMDFactory

build

Core build pipeline for constructing MD simulation systems.

func_compute_charge_from_universe(u, species)int

Compute total system charge from actual residue counts in the universe.

This is needed because transformations like sphere cropping or shell projection may change residue counts from the input specification.

paramumda.Universe

The universe with the actual system structure

paramspecieslist

List of species objects with resname and charge properties

Returns

int

Total system charge based on actual residue counts

func_get_parametrize_function(inp)

Get the parametrization function, optionally wrapping with config for SMIRNOFF.

paraminpBuildInput

Returns

None
funcbuild_mixedbox(inp)

Build a mixed-box system: compress, ionize, write topology and run files.

paraminpBuildInput

Returns

None
funccreate_mixedbox_by_compression(inp)

Create a mixed-box universe by packing at low density then compressing with OpenMM.

paraminpBuildInput

Returns

tuple

(universe, parameters, parametrize_function, topology_function)

funcbuild_bilayer(inp)

Build a bilayer system: compress, solvate, ionize, write topology and run files.

paraminpBuildInput

Returns

None
funccreate_bilayer_by_compression(inp)

Create a bilayer universe by placing lipids then compressing with OpenMM.

paraminp

Returns

tuple

(universe, parameters, parametrize_function, topology_function)

funcbuild_lnp(inp)

Build an LNP (Lipid Nanoparticle) system.

The LNP consists of:

  • Core (internal): A compressed sphere of lipid molecules
  • Shell (external): A spherical monolayer wrapping the core

Workflow:

  1. Create core via create_mixedbox_by_compression → create_sphere
  2. Create shell via create_bilayer_by_compression → shell_from_monolayer
  3. Merge core and shell components
  4. Solvate with spherical exclusion zone
  5. Ionize the solvated system
  6. Write topology and run files
paraminpBuildInput

Returns

None
funccreate_lnp_core(inp)

Create the LNP core by compressing a mixed box and shaping into a sphere.

For efficiency, we pack only a unit cell (1/n³ of total molecules) and replicate it n×n×n times before cropping to a sphere.

paraminpBuildInput

Returns

tuple

(u_core, parameters, parametrize_function, topology_function)

funccreate_lnp_shell(inp, parametrize_function, topology_function)

Create the LNP shell from a monolayer projected onto the core surface.

paraminpBuildInput
paramparametrize_function
paramtopology_function

Returns

tuple

(u_shell, shell_parameters)

func_log_lnp_composition(u, inp)None

Log a table comparing input fractions vs actual fractions for core and shell.

paramumda.Universe
paraminpBuildInput

Returns

None
funcmerge_lnp_components(u_core, u_shell, inp, parameters, parametrize_function, topology_function)

Merge core and shell into a single LNP universe.

The shell is positioned around the core and the combined system undergoes a brief equilibration with spherical restraints.

paramu_core
paramu_shell
paraminpBuildInput
paramparameters
paramparametrize_function
paramtopology_function

Returns

MDAnalysis.Universe

Merged LNP universe.

funcionize_solvated_system(ion_config, u_solvated, total_charge)

Add ions for neutralization and salt concentration.

paramion_configIonizationConfig or None

Ionization settings (concentration, neutralize, etc.)

paramu_solvatedmda.Universe

Solvated system universe

paramtotal_chargeint

Total charge of the system before ionization

Returns

tuple

Ionized universe and list of ion species added