pywindow.PDB¶
- class pywindow.PDB(filepath)[source]¶
Bases:
TrajectoryMethods
- Parameters:
filepath (pathlib.Path | str)
- analysis(frames='all', ncpus=1, ncpus_analysis=1, override=False, modular=False, rebuild=False, swap_atoms=None, forcefield=None)¶
Perform structural analysis on a frame/ set of frames.
Depending on the passed parameters a frame, a list of particular frames, a range of frames (from, to), or all frames can be analysed with this function.
The analysis is performed on each frame and each discrete molecule in that frame separately. The steps are as follows:
A frame is extracted and returned as a
MolecularSystem.If swap_atoms is set the atom ids are swapped.
If forcefield is set the atom ids are deciphered.
If rebuild is set the molecules in the system are rebuild.
Each discrete molecule is extracted as
MoleculeEach molecule is analysed with
Molecule.full_analysis()Analysis output populates the
analysis_outputdictionary.
As the analysis of trajectories often have to be unique, many options are conditional.
A side effect of this function is that the analysed frames are also returned to the
framesmimicking the behaviour of theget_frames().- Parameters:
frames (int | list | tuple | str) –
intorlistortupleorstrSpecified frame (int), or frames (list), or range (touple), or all/everything (str). (default=’all’)override (bool) –
boolIf True, an output already storred inanalysis_outputcan be override. (default=False)swap_atoms (dict | None) –
dict, optional If this kwarg is passed with an appropriate dictionary apywindow.MolecularSystem.swap_atom_keys()will be applied to the extracted frame.forcefield (str | None) –
str, optional If this kwarg is passed with appropriate forcefield keyword apywindow.MolecularSystem.decipher_atom_keys()will be applied to the extracted frame.modular (bool) –
bool, optional If this kwarg is passed apywindow.MolecularSystem.make_modular()will be applied to the extracted frame. (default=False)rebuild (bool) –
bool, optional If this kwarg is passed a rebuild=True is passed topywindow.MolecularSystem.make_modular()that will be applied to the extracted frame. (default=False)ncpus (int) –
int, optional If ncpus > 1, then the analysis is performed in parallel for the specified number of parallel jobs. Otherwise, it runs in serial. (default=1)ncpus_analysis (int) –
int, optional If ncpus > 1, then the analysis is performed in parallel for the specified number of parallel jobs. Otherwise, it runs in serial. (default=1)
- Returns:
NoneTypeThe function returns None, the analysis output is returned to
analysis_outputdictionary.
- Return type:
None
- get_frames(frames='all', override=False, swap_atoms=None, forcefield=None, extract_data=True)¶
Extract frames from the trajectory file.
Depending on the passed parameters a frame, a list of particular frames, a range of frames (from, to), or all frames can be extracted with this function.
- Parameters:
frames (int | list[int] | tuple[int, int] | Literal['all', 'everything']) –
intorlistortupleorstrSpecified frame (int), or frames (list), or range (tuple), or all/everything (str). (default=`all`)override (bool) –
boolIf True, a frame already storred inframescan be override. (default=False)extract_data (bool) –
bool, optional If False, a frame is returned as astrblock as in the trajectory file. Ohterwise, it is extracted and returned aspywindow.MolecularSystem. (default=True)swap_atoms (dict | None) –
dict, optional If this kwarg is passed with an appropriate dictionary apywindow.MolecularSystem.swap_atom_keys()will be applied to the extracted frame.forcefield (str | None) –
str, optional If this kwarg is passed with appropriate forcefield keyword apywindow.MolecularSystem.decipher_atom_keys()will be applied to the extracted frame.
- Returns:
Dictionary of frames.
- Return type:
- save_analysis(filepath=None, override=False)¶
Dump the content of
analysis_outputas JSON dictionary.