rdf_input_file_reader¶
A module containing a class to read input files to setup the
RDF class.
Summary¶
Classes:
A class to read input files to setup the |
Reference¶
- class RDFInputFileReader(filename: str)[source]¶
Bases:
_TopologyFilesMixin,PQAnalysisInputFileReaderA class to read input files to setup the
RDFclass.For the RDF analysis input file several keys are available of which some are required and some are optional. For more details on the grammar and syntax of the input file see Analysis Input Files.
The following keys are required:
Key - Value
traj_files - The trajectory files to read. This can be a single file or a list of files.
reference_selection - The selection string to select the reference atoms. For more details see
Selection.target_selection - The selection string to select the target atoms. For more details see
Selection.out_file - The output file to write the RDF data to; see RDF output files for its columns, units and normalization formulas.
The following keys are optional:
Key - Value
r_max - The maximum radius to calculate the RDF for.
r_min - The minimum radius to calculate the RDF for.
delta_r - The delta radius to calculate the RDF for.
n_bins - The number of bins to calculate the RDF for.
log_file - The log file to write the log information to.
use_full_atom_info - Whether to use full atom information for the selections.
no_intra_molecular - Whether to exclude intra molecular pairs.
reference_com - Whether the reference entities are the centers of mass of the molecules instead of atoms; the reference selection then picks the atoms that define each center. Needs the restart file and the moldescriptor file.
target_com - Whether the target entities are the centers of mass of the molecules instead of atoms, see
reference_com.restart_file - The restart file to read the topology from.
moldescriptor_file - The moldescriptor file to read the reference residues from.
Note
Optional keys does not mean that they are optional for the analysis. They are optional in the input file, but they might be required for the analysis. This means that if an optional keyword is specified other keywords might be required. For example:
Basic RDF calculations can be run without a restart file. In that case, intra molecular pairs are included.
If both
restart_fileandmoldescriptor_fileare given andno_intra_molecularis omitted,no_intra_moleculardefaults toTrue.If the
no_intra_molecularkey is enabled, therestart_fileandmoldescriptor_filekeys are required in order to exclude intra molecular pairs. Missing files are inferred from the first trajectory file if possible:trajectory.xyzmaps totrajectory.rst, andmoldescriptor.datis searched in the trajectory directory.If
reference_comortarget_comis enabled, both files are required as well and are inferred in the same way. With centers on both sides,no_intra_molecularhas no effect. With centers on one side it removes the pairs of an atom with the center of its own molecule and, as for atoms, defaults toTruewhen both files are given.If the
moldescriptor_filekey is specified, therestart_filekey is required in order to use the reference residues in any meaningful way.Explicitly provided
restart_fileandmoldescriptor_filevalues are used as-is.Inferred and defaulted values are written to the normal PQAnalysis log output.
In general, the
r_max,n_binsanddelta_rare mutual exclusive, meaning that they can’t be specified at the same time. Furthermore, at least one ofn_binsordelta_ris required (for more information seeRDF).
- Parameters:
filename (str) – the filename of the input file
- check_known_keys(
- known_keys: list[str] | None = None,
Checks if all keys in the input file are known.
- Parameters:
known_keys (List[str] | None, optional) – the known keys, by default None
- Warns:
InputFileWarning – if unknown keys were set in the input file
- check_required_keys(
- required_keys: list[str],
Checks if all required keys are set in the input file.
- Parameters:
required_keys (List[str]) – the required keys
- Raises:
InputFileError – if not all required keys are set in the input file
- not_defined_optional_keys(
- optional_keys: list[str],
Checks if optional keys are set in the input file. If not set, it sets them to None.
- Parameters:
optional_keys (List[str]) – the optional keys
- read()[source]¶
Reads the input file and parses it. It also sets the raw_input_file and the dictionary. It checks if all required keys are set and if all keys are known.
- Raises:
InputFileError – if not all required keys are set in the input file
InputFileWarning – if unknown keys are set in the input file
InputFileError – if the no_intra_molecular key is used without a restart file
InputFileError – if the no_intra_molecular key is used without a moldescriptor file
InputFileError – if the reference_com or target_com key is used without a restart file and a moldescriptor file
InputFileError – if the moldescriptor_file key is used without a restart file
- resolve_path(
- path: str | None,
Resolves a filename from the input file against the directory of the input file.
Relative filenames in an input file refer to the directory that contains the input file, not to the working directory of the process. Absolute filenames are returned unchanged.
- Parameters:
path (str | None) – the filename as written in the input file
- Returns:
the resolved filename, or None if path is None
- Return type:
str | None
- resolve_paths(
- paths: list[str] | None,
Resolves a list of filenames with
resolve_path().- Parameters:
paths (List[str] | None) – the filenames as written in the input file
- Returns:
the resolved filenames, or None if paths is None
- Return type:
List[str] | None
- property delta_r: PositiveReal | None¶
The radius step size of the PQAnalysis.
- Type:
PositiveReal | None
- delta_r_key = 'delta_r'¶
- known_keys = ['r_max', 'r_min', 'delta_r', 'n_bins', 'traj_files', 'selection', 'reference_selection', 'target_selection', 'use_full_atom_info', 'out_file', 'log_file', 'no_intra_molecular', 'reference_com', 'target_com', 'moldescriptor_file', 'restart_file']¶
- property log_file: str | None¶
The log file of the simulation.
- Type:
str | None
- log_file_key = 'log_file'¶
- logger = <CustomLogger PQAnalysis.RDFInputFileReader (INFO)>¶
- property moldescriptor_file: str | None¶
The moldescriptor file of the simulation.
- Type:
str | None
- moldescriptor_file_key = 'moldescriptor_file'¶
- property n_bins: PositiveInt | None¶
The number of bins of the PQAnalysis.
- Type:
PositiveInt | None
- n_bins_key = 'n_bins'¶
- property no_intra_molecular: bool | None¶
Whether intra molecular interactions should be excluded.
- Type:
bool | None
- no_intra_molecular_key = 'no_intra_molecular'¶
- optional_keys = ['traj_files', 'reference_selection', 'target_selection', 'out_file', 'r_max', 'r_min', 'delta_r', 'n_bins', 'log_file', 'use_full_atom_info', 'no_intra_molecular', 'reference_com', 'target_com', 'restart_file', 'moldescriptor_file']¶
The optional keys of the input file
- Type:
List[str]
- property out_file: str | None¶
The out file of the simulation.
- Type:
str | None
- out_file_key = 'out_file'¶
- property r_max: PositiveReal | None¶
The maximum radius of the PQAnalysis.
- Type:
PositiveReal | None
- r_max_key = 'r_max'¶
- property r_min: PositiveReal | None¶
The minimum radius of the PQAnalysis.
- Type:
PositiveReal | None
- r_min_key = 'r_min'¶
- property reference_com: bool | None¶
Whether the reference entities are molecule centers.
- Type:
bool | None
- reference_com_key = 'reference_com'¶
- property reference_selection: str | None¶
The reference selection of the simulation.
- Type:
str | None
- reference_selection_key = 'reference_selection'¶
- required_keys = ['traj_files', 'reference_selection', 'target_selection', 'out_file']¶
The required keys of the input file
- Type:
List[str]
- property restart_file: str | None¶
The restart file of the simulation.
- Type:
str | None
- restart_file_key = 'restart_file'¶
- property selection: str | None¶
The selection of the simulation.
- Type:
str | None
- selection_key = 'selection'¶
- property target_com: bool | None¶
Whether the target entities are molecule centers.
- Type:
bool | None
- target_com_key = 'target_com'¶
- property target_selection: str | None¶
The target selection of the simulation.
- Type:
str | None
- target_selection_key = 'target_selection'¶
- property traj_files: list[str] | None¶
The trajectory files of the simulation.
- Type:
List[str] | None
- traj_files_key = 'traj_files'¶
- property use_full_atom_info: bool | None¶
Whether the full atom information should be used.
- Type:
bool | None
- use_full_atom_info_key = 'use_full_atom_info'¶