fairmd.lipids.analib.maicos module

Wrappers for MAICoS calculations adapted to Databank needs.

  • Checks if a system is suitable for maicos calculations

  • Custom JSON encoder for numpy arrays

  • Custom maicos analysis classes with save methods adapted to Databank needs

fairmd.lipids.analib.maicos.is_system_suitable_4_maicos(system: System) bool[source]

Check if the system is suitable for maicos calculations.”

Parameters:

system – Databank System object (System)

Returns:

False if system should be skipped

fairmd.lipids.analib.maicos.first_last_carbon(system: System, logger: Logger) tuple[str, str][source]

Find last carbon of sn-1 tail and g3 carbon.

fairmd.lipids.analib.maicos.traj_centering_for_maicos_gromacs(system_path: str, trj_name: str, tpr_name: str, last_atom: str, g3_atom: str, eq_time: int = 0, *, recompute: bool = False) str[source]

Center trajectory around the center of mass of all methyl carbons.

fairmd.lipids.analib.maicos.traj_centering_for_maicos_mda(universe: Universe, system_path: str, last_atom: str, eq_time: int = 0, *, recompute: bool = False, logger: Logger | None = None) str[source]

Center trajectory around the center of mass of specified reference atoms.

This function processes trajectory frames sequentially, unwrapping molecules, centering on the specified reference group, and re-wrapping into the box.

Parameters:
  • universe – MDAnalysis Universe object with loaded trajectory.

  • system_path – Path to the system directory where output will be saved.

  • last_atom – Atom name for centering reference (e.g., terminal methyl carbon).

  • eq_time – Equilibration time to skip in ps. Defaults to 0.

  • recompute – If True, recompute even if output file exists. Defaults to False.

  • logger – Optional logger for progress information.

Returns:

Path to the centered trajectory file (whole.xtc).

fairmd.lipids.analib.maicos.traj_centering_for_maicos_mda_parallel(universe: Universe, system_path: str, last_atom: str, eq_time: int = 0, n_jobs: int = -1, *, recompute: bool = False, logger: Logger | None = None, show_progress: bool = False) str[source]

Center trajectory using parallel chunk processing.

Uses joblib to process trajectory chunks in parallel, providing ~4x speedup at the cost of ~3x memory usage compared to the sequential version.

Note

Requires the optional ‘parallel’ dependency: pip install fairmd-lipids[parallel]

Parameters:
  • universe – MDAnalysis Universe object with loaded trajectory.

  • system_path – Path to the system directory where output will be saved.

  • last_atom – Atom name for centering reference (e.g., terminal methyl carbon).

  • eq_time – Equilibration time to skip in ps. Defaults to 0.

  • n_jobs – Number of parallel workers. -1 uses all available cores. Defaults to -1.

  • recompute – If True, recompute even if output file exists. Defaults to False.

  • logger – Optional logger for progress information.

  • show_progress – If True, display per-worker tqdm progress bars. Defaults to False.

Returns:

Path to the centered trajectory file (whole.xtc).

Raises:

ImportError – If joblib is not installed.

class fairmd.lipids.analib.maicos.NumpyArrayEncoder(*args, **kwargs)[source]

Bases: CompactJSONEncoder

Encoder for 2xN numpy arrays to be used with json.dump.

encode(o) str[source]

Encode numpy arrays as lists.

class fairmd.lipids.analib.maicos.FormFactorPlanar(atomgroup: AtomGroup, unwrap: bool = True, dim: int = 2, zmin: float | None = None, zmax: float | None = None, bin_width: float = 1, refgroup: AtomGroup | None = None, pack: bool = True, output: str = 'form_factor.dat', concfreq: int = 0, jitter: float = 0.0)[source]

Bases: ProfilePlanarBase

Form factor of a planar system based on the linear electron density profile.

save() None[source]

Save performing unit conversion from Å to nm.

NOTE: see comments in _single_frame

class fairmd.lipids.analib.maicos.DensityPlanar(atomgroup: AtomGroup, dens: str = 'mass', dim: int = 2, zmin: float | None = None, zmax: float | None = None, bin_width: float = 1, refgroup: AtomGroup | None = None, sym: bool = False, grouping: str = 'atoms', unwrap: bool = True, pack: bool = True, bin_method: str = 'com', output: str = 'density.dat', concfreq: int = 0, jitter: float = 0.0)[source]

Bases: DensityPlanar

Density profiler for planar system.

save() None[source]

Save performing unit conversion from Å to nm and e/Å^3 to e/nm^3

class fairmd.lipids.analib.maicos.DielectricPlanar(atomgroup: AtomGroup, dim: int = 2, zmin: float | None = None, zmax: float | None = None, bin_width: float = 0.5, refgroup: AtomGroup | None = None, is_3d: bool = False, sym: bool = False, unwrap: bool = True, pack: bool = True, temperature: float = 300, output_prefix: str = 'eps', concfreq: int = 0, jitter: float = 0.0, vcutwidth: float = 0.1)[source]

Bases: DielectricPlanar

Dielectric profile for planar system.

save() None[source]

Save performing unit conversion from Å to nm for the distance.

class fairmd.lipids.analib.maicos.DiporderPlanar(atomgroup: AtomGroup, dim: int = 2, zmin: float | None = None, zmax: float | None = None, bin_width: float = 1, refgroup: AtomGroup | None = None, sym: bool = False, grouping: str = 'residues', unwrap: bool = True, pack: bool = True, bin_method: str = 'com', output: str = 'diporder_planar.dat', concfreq: int = 0, pdim: int = 2, order_parameter: str = 'P0', jitter: float = 0.0)[source]

Bases: DiporderPlanar

Dipole order parameter profile for planar system.

save() None[source]

Save performing unit conversion from Å to nm for the distance.