BFEE2.commonTools

BFEE2.commonTools.commonSlots

BFEE2.commonTools.commonSlots.openFileDialog(fileType, lineEdit)[source]
return a openFile function that opens special type of files

the openFile dialog is connected with a lineEdit widget

Parameters
  • fileType (str) – the file type for opening

  • lineEdit (QLineEdit) – the QLineEdit that connects to the QFileDialog

Returns

slot function opening special type of files

Return type

function obj

BFEE2.commonTools.commonSlots.openFilesDialog(fileType, listWidget)[source]
return a openFile function that opens a series of files

the openFile dialog is connected with a QListWidget

Parameters
  • fileType (str) – the file type for opening

  • listWidget (QListWidget) – the QListWidget that connects to the QFileDialog

Returns

slot function opening a series of files

Return type

function obj

BFEE2.commonTools.fileParser

exception BFEE2.commonTools.fileParser.SelectionError(arg)[source]

Bases: RuntimeError

class BFEE2.commonTools.fileParser.fileParser(topFile, coorFile='')[source]

Bases: object

topology and coordinate parser, this class implements basic method for the topology and coordinate file, used by BFEE

centerSystem()[source]

move all the atoms in the loaded file, such that the center of system be (0,0,0)

getResid(selection)[source]
return a string listing the resid of the selection

may be used to generate amber masks

Parameters

selection (str) – MDAnalysis selection

Raises

SelectionError – if the selection corresponds to nothing

Returns

a list of resid, e.g. (4,5,6,7,8,9,10)

Return type

str

measureCenter(selection)[source]

mimic vmd measure center

Parameters

selection (str) – selection of atoms

Raises

SelectionError – if the selection corresponds to nothing

Returns

(x, y, z)

Return type

np.array (3, float)

measureDistance(selection1, selection2)[source]
measure the distance between the center of mass

of two atom groups

Parameters
  • selection1 (str) – selection of atom group 1

  • selection2 (str) – selection of atom group 2

Returns

distance between the center of mass of the two atom groups

Return type

float

measureMinmax(selection)[source]

mimic VMD measure minmax

Parameters

selection (str) – selection of atoms

Raises

SelectionError – if the selection corresponds to nothing

Returns

((minX, minY, minZ), (maxX, maxY, maxZ))

Return type

np.array (2*3, float)

measurePBC()[source]

measure periodic boundary condition of the file

Returns

((lengthX, lengthY, lengthZ), (centerX, centerY, centerZ))

Return type

np.array (2*3, float)

measurePolarAngles(selectionPro, selectionLig)[source]

calculation the polar angles based on selectionPro and selectionLig

Parameters
  • selectionPro (str) – selection of the host molecule

  • selectionLig (str) – selection of the ligand molecule

Returns

(theta, phi) in degrees

Return type

np.array (2, float)

moveSystem(moveVector)[source]

move all the atoms in the loaded file

Parameters

moveVector (np.array, 3, float) – the vector of moving

rotateSystem(axis, degrees)[source]

rotate all the atoms in the loaded file

Parameters
  • axis (str) – ‘x’ or ‘y’ or ‘z’

  • degrees (float) – degrees to move by

saveFile(selection, targetPath, targetType, saveTop=False, topPath='')[source]
save the coordinate file to the target type

this function cannot really ‘save’ the topology file, it can only copy the original topology to the target path

Parameters
  • selection (str) – selection of atoms to save

  • targetPath (str) – path for the coor file to be saved

  • targetType (str) – type of the coor file (pdb, xyz)

  • saveTop (bool) – whether the topology file will be saved. Defaults to False.

  • topPath (str, optional) – path for the topology file to be saved. Defaults to ‘’.

Raises

SelectionError – if the selection corresponds to nothing

saveNDX(selections, names, targetPath, nonHydrogen=True)[source]

save an ndx file, including the selections

Parameters
  • selections (list of str) – the selections for the ndx file

  • names (list of str) – the name in ndx of each selection

  • targetPath (str) – path for the file to be saved

  • nonHydrogen (bool, optional) – whether only non-H atoms are considered. Defaults to True.

Raises

SelectionError – if the selection corresponds to nothing

setBeta(selection, beta)[source]

set beta for the selected atoms

Parameters
  • selection (str) – selection of atoms to change beta

  • beta (int) – beta value

Raises

SelectionError – if the selection corresponds to nothing

BFEE2.commonTools.ploter

BFEE2.commonTools.ploter.calcRMSD(inputArray)[source]

calculate RMSD of a np.array with respect to (0,0,0,…0)

Parameters

inputArray (1D np.array) – the input array

Returns

RMSD of a np.array with respect to (0,0,0,…0)

Return type

float

BFEE2.commonTools.ploter.mergePMF(pmfFiles)[source]

merge several PMF files

Parameters

pmfFiles (list of np.arrays) – list of 1D pmfs

Returns

merged PMF if the PMFs overlap, pmfFiles[0] otherwise

Return type

np.array (N * 2)

BFEE2.commonTools.ploter.parseHistFile(histPath)[source]

parse a hist.czar.pmf file and return frame-RMSD list

Parameters

histPath (str) – path to a hist.czar.pmf file

Returns

time evolution of RMSD with respect to zero array

Return type

1D np.array

BFEE2.commonTools.ploter.plotConvergence(rmsdList)[source]

plot the time evolution of PMF rmsd

Parameters

rmsdList (list or 1D np.array, float) – time evolution of RMSD with respect to zero array

BFEE2.commonTools.ploter.plotPMF(pmf)[source]

plot a pmf

Parameters

np.array (pmf) – pmf to be plotted

BFEE2.commonTools.ploter.readFrame(input)[source]

read a frame of Colvars hist file and calculate its RMSD with respect to zero array

Parameters

input (python file object) – input object

Returns

RMSD with respect to zero array

Return type

float

BFEE2.commonTools.ploter.readPMF(pmfFile)[source]

read a 1D namd PMF file

Parameters

pmfFile (str) – path to the pmf File

Returns

1D PMF

Return type

np.array (N * 2)

BFEE2.commonTools.ploter.writePMF(pmfFile, pmf)[source]

write a 1D namd PMF file

Parameters
  • pmfFile (str) – path to the pmf File

  • np.array (pmf) – pmf to be written