API reference for utils submodule#

Module for various control functions.

buildh.utils.check_atom(universe, res_name, atom_name)#

Check if atom_name from residue res_name is present in universe.

Parameters
  • universe (MDAnalysis universe instance) –

  • res_name (str) – residue name

  • atom_name (str) – atom name

Returns

True if the atom is present. False otherwise.

Return type

Bool

buildh.utils.check_def_file(universe, res_name, atoms_name)#

Check if atoms from the definition file are present in the structure in universe.

This function return false if there is one missing in the structure. Print also an error message.

Parameters
  • universe (MDAnalysis universe instance) –

  • res_name (str) – lipid residue name

  • atoms_name (list of str) – list of atom names

Returns

True if all atoms are found in the structure. False otherwise.

Return type

Bool

buildh.utils.check_def_topol_consistency(dic_Cname2Hnames, lipid_top)#

Check the consistency between the lipid topology and the def file.

Ensure that the carbons in the def file are present in the topology. Ensure that all hydrogens of a given carbon as described in the topology are present in the def file.

Parameters
  • dic_Cname2Hnames (dictionary) – This dictionary gives the correspondance Cname -> Hname. It is a dictionary of tuples extracted from the def file.

  • lipid_top (dictionary) – lipid topology for hydrogen.

Returns

True is it’s coherent. False otherwise.

Return type

Bool

buildh.utils.check_slice_options(system, first_frame=None, last_frame=None)#

Verify the slicing options and return a range of frames in MDAnalysis.

This function check whether the first frame and the last frame are consistent within themselves (first_frame cant be superior to last_frame) and with the trajectory supplied (if the trajectory starts at 1000ps, first_frame cant be equal to 0 for example). Then, the function translate the range from picosecond-time to the number of frame in MDanalysis.

Parameters
  • system (MDAnalysis universe instance) – This is the universe without hydrogen.

  • first_frame (int) – the first frame to read (in ps)

  • last_frame (int) – the last frame to read (in ps)

Returns

The number of first and last frame

Return type

tuple of int

Raises

IndexError – When the slicing options are out of range.

buildh.utils.is_allHs_present(def_file, lipids_name, dic_ref_CHnames)#

Check if all H’s to be rebuild are present in the def file.

Parameters
  • def_file (str) – Filename containing OP definition (e.g. Berger_POPC.def).

  • lipids_name (dictionary) – Comes from dic_lipids.py. Contains carbon names and helper names needed for reconstructing hydrogens.

  • dic_ref_CHnames (dictionary) – Contains all CH molecules

Returns

whether or not all Hs are present.

Return type

boolean