API reference for UI submodule#

User Interface module.

It contains functions used for the CLI mode and the one for the ‘module mode’.

exception buildh.UI.BuildHError#

Raised when BuildH returns a error.

This should be used when using BuildH as a module.

buildh.UI.entry_point()#

Correspond to the entry point buildH.

buildh.UI.isfile(path)#

Callback for checking file existence.

This function checks if path is an existing file. If not, raise an error. Else, return the path.

Parameters

path (str) – The path to be checked.

Returns

The validated path.

Return type

str

buildh.UI.launch(coord_file, def_file, lipid_type, traj_file=None, out_file='OP_buildH.out', prefix_traj_ouput=None, begin=None, end=None, lipid_jsons=None, ignore_CH3s=False)#

Launch BuildH calculations.

This is the only function which can be called inside a Python script to use BuildH as a module. It checks the different arguments and call the main function.

Parameters
  • coord_file (str) – Coordinate file. Only .pdb and .gro files are currently supported.

  • def_file (str) – Order parameter definition file.

  • lipid_type (str) – Combinaison of ForceField name and residue name for the lipid to calculate the OP on (e.g. Berger_POPC). It must match with the internal topology (json) files or the one(s) supplied.

  • traj_file (str, optional) – Trajectory file (could be in XTC, TRR or DCD format), by default None.

  • out_file (str, optional) – Output file name for storing order parameters, by default “OP_buildH.out”.

  • prefix_traj_ouput (str, optional) – Base name for trajectory output with hydrogens. File extension will be automatically added. By default None.

  • begin (int, optional) – The first frame (ps) to read from the trajectory, by default None.

  • end (int, optional) – The last frame (ps) to read from the trajectory, by default None.

  • lipid_jsons (list, optional) – User topology lipid json file(s), by default None.

  • ignore_CH3s (bool, optional) – Ignore CH3s groups for the construction of hydrogens and the calculation of the OP.

Raises
  • FileNotFoundError – When either coord_file, def_file or the traj_file is missing.

  • TypeError – When lipid_jsons is not a list.

  • BuildHError – When something went wront during calculation.

buildh.UI.main(coord_file, traj_file, def_file, out_file, prefix_traj_ouput, dic_lipid, begin=None, end=None, ignore_CH3s=False)#

Main function of BuildH.

It takes care of all the necessary steps to compute the Order Parameter :
  • create MDAnalysis Universe

  • create internal dictionaries

  • Check topology

  • Reconstruct the hydrogens

  • Compute OP and write the result in the output file.

  • If asked, write the trajectory with the hydrogens.

Note

This function shouldn’t be called directly. Either it’s called by the entry point or by the launch function.

Parameters
  • coord_file (str) – Coordinate file. Only .pdb and .gro files are currently supported.

  • traj_file (str) – Trajectory file (could be in XTC, TRR or DCD format). Can be None.

  • def_file (str) – Order parameter definition file.

  • out_file (str) – Output file name for storing order parameters.

  • prefix_traj_ouput (str) – Base name for trajectory output with hydrogens. File extension will be automatically added. Can be None.

  • dic_lipid (dict) – Lipid Topology for the reconstruction of the hydrogens.

  • begin (int) – The first frame (ps) to read from the trajectory, by default None.

  • end (int) – The last frame (ps) to read from the trajectory, by default None.

  • ignore_CH3s (bool) – Ignore CH3s groups for the construction of hydrogens and the calculation of the OP. By default, False.

Raises

BuildHError – When something went wront during calculation.

buildh.UI.parse_cli()#

Handle the user parameters from the command line.