fairmd.lipids.molecules module

module:

settings/molecules.py

description:

Module file with definition of different global-level dictionaries.

There is a dictionary of lipids, ions, etc. If you add a lipid which is not yet in the databank, you have to add it here!

exception fairmd.lipids.molecules.MoleculeError(message: str, mol=None)[source]

Bases: Exception

Custom exception for molecule-related errors.

@param message: Error message describing the issue. @param mol: Optional Molecule object related to the error.

exception fairmd.lipids.molecules.MoleculeMappingError(message: str, mol=None)[source]

Bases: MoleculeError

Custom exception for molecule mapping errors.

class fairmd.lipids.molecules.Molecule(name: str)[source]

Bases: ABC

Abstract base class representing a molecule and its related operations.

This class is designed to provide an interface for interacting with molecule-related files, which are stored in a molecule-related folder. It serves as a base for concrete implementations that need to define specific operations for handling molecule data.

register_mapping(fname: str) None[source]

Register mapping dictionary for the Molecule object

Parameters:

fname – mapping filename (without path)

Returns:

check_mapping(u: Universe, name: str) bool[source]

Check consistency of mapping file against Universe.

Parameters:
  • u – MDAnalysis Universe

  • name – string standing for residue name if it is not in the mapping file

Raises:

MoleculeMappingError – if mapping is inconsistent

property mapping_dict: dict

Return mapping dictionary (load on first call)

md2uan(mdatomname: str, mdresname: str | None = None) str[source]

Convert MD atom name to the Universal Atom Name.

Raises:

MoleculeMappingError – if the md atom name is not found in the mapping.

Returns:

Universal Atom Name (str)

uan2selection(uname: str, resname: str) str[source]

Convert the Universal Atom Name to MD atom name.

Raises:

KeyError – if the universal name is not found in the mapping.

Returns:

selection string for MDAnalysis

abstract property metadata: dict

Metadata for the molecule

property name: str

Molecule name

property mapping_file: str

Mapping file name

class fairmd.lipids.molecules.Lipid(name: str)[source]

Bases: Molecule

Lipid class inherited from Molecule base.

Is used for all the molecules located in the bilayer.

property metadata: dict

Return metadata for the lipid.

Returns:

dict with metadata

class fairmd.lipids.molecules.NonLipid(name: str)[source]

Bases: Molecule

Class for non-bilayer molecules: solvent, ions, etc.

property metadata: dict

Metadata for the molecule

class fairmd.lipids.molecules.MoleculeSet(*args)[source]

Bases: MutableSet[Molecule], ABC

Set repeating normal set functionality with some additional molecule-specific things.

add(item) None[source]

Add a lipid to the set.

Parameters:

item – Can add either Molecule or str (then Molecule constructor will be called)

discard(item) None[source]

Remove a lipid from the set without raising an error if it does not exist.

get(key: str, default=None) Molecule | None[source]

Get a molecule by its name.

Parameters:
  • key – The name of the molecule to retrieve.

  • default – The value to return if the molecule is not found.

property names: set[str]

Set of molecule names in the set.

class fairmd.lipids.molecules.LipidSet(*args)[source]

Bases: MoleculeSet

MoleculeSet specialization for Lipid.

static load_from_data() LipidSet[source]

Load lipid data from the designated directory and returns a set of lipids.

Return type:

LipidSet

Returns:

An instance of loaded LipidSet.

class fairmd.lipids.molecules.NonLipidSet(*args)[source]

Bases: MoleculeSet

MoleculeSet specialization for NonLipid.

static load_from_data() NonLipidSet[source]

Load Nonlipid data from the designated directory and returns a set of lipids.

Return type:

NonLipidSet

Returns:

An instance of loaded NonLipidSet.

fairmd.lipids.molecules.lipids_set: LipidSet = LipidSet[{'TOCL', 'DPPC', 'POPE', 'POPC', 'CHOL'}]

MutableSet of possible lipids

fairmd.lipids.molecules.lipids_dict = LipidSet[{'TOCL', 'DPPC', 'POPE', 'POPC', 'CHOL'}]

Use lipids_set instead.

Type:

@deprecated

fairmd.lipids.molecules.molecules_set: NonLipidSet = NonLipidSet[{'SOD', 'CLA', 'SOL'}]

Dictionary of other than lipid molecules.

fairmd.lipids.molecules.molecules_dict = NonLipidSet[{'SOD', 'CLA', 'SOL'}]

Use molecules_set instead

Type:

@deprecated

fairmd.lipids.molecules.molecule_ff_set = {'FFCHOL', 'FFCLA', 'FFDPPC', 'FFPOPC', 'FFPOPE', 'FFSOD', 'FFSOL', 'FFTOCL'}

Dictionary containing possible force-field labels for molecules given by the contributor (used for README/info fields validation)