vacf_input_file_reader¶
A module containing a class to read input files to setup the
VACF class.
Summary¶
Classes:
A class to read input files to setup the |
Reference¶
- class VACFInputFileReader(filename: str)[source]¶
Bases:
_TopologyFilesMixin,PQAnalysisInputFileReaderA class to read input files to setup the
VACFclass.For the VACF 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 velocity trajectory files to read. This can be a single file or a list of files.
target_selection
The selection string to select the atoms for which the VACF is calculated. For more details see
Selection.out_file
The output file to write the VACF data to. It must not exist yet.
time_step
The time step between two frames in ps. It is used to build the time axis of the VACF and the frequency axis of the spectrum.
The following keys are optional:
Key
Value
window
The correlation window size in frames. Default is 1000. It has to be an integer multiple of the gap.
gap
The gap between two time origins in frames. Default is 1.
method
The VACF estimator, either “direct” (legacy-exact sliding origins, default) or “fft” (denser-origin Wiener-Khinchin estimator, ignores the gap).
charge_file
A static charge file for the charge-flux mode. The file consists of a header line with the number of atoms, a comment line and one “name charge” line per atom.
charge_files
Charge trajectory files (.chrg) for the charge-flux mode with time-dependent charges, read in lockstep with the velocity trajectory. Cannot be combined with charge_file.
spectrum_file
The output file for the cosine-transform spectrum of the VACF. If not given, no spectrum is calculated.
ftsize
The Fourier transform point size of the spectrum. The VACF is zero-padded (or truncated) to this size. Default is 2000.
window_function
The apodization window function of the spectrum, one of “none”, “exponential”, “hann” and “blackman”. Default is “none”.
window_param
The decay coefficient of the exponential window. Default is 4.0.
window_start
The time in ps at which the apodization window starts to decay. Default is 0.0.
window_stop
The time in ps at which the apodization window becomes zero. Default is 1000.0.
windowed_out_file
The output file for the windowed VACF. Can only be used together with spectrum_file.
log_file
The log file to write the log information to.
use_full_atom_info
Whether to use full atom information for the selections.
target_com
Whether the targets are the centers of mass of the molecules instead of atoms, so that the VACF is that of the molecules (the velocity of a center is the mass weighted mean of the velocities of its atoms). The target selection then picks the atoms that define each center. Needs the restart file and the moldescriptor file and cannot be combined with the charge-flux keys. Default is false.
restart_file
The restart file that defines the molecules, needed for target_com. Inferred from the first trajectory file if omitted (
trajectory.velmaps totrajectory.rst).moldescriptor_file
The moldescriptor file with the molecule types, needed for target_com. Inferred from the trajectory directory (
moldescriptor.dat) if omitted.Note
The output files follow the legacy FreqCalc and ft.f formats. See VACF output files for the columns and units of the correlation, spectrum and optional windowed-correlation files.
- 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 both a static charge file and charge trajectory files are given
InputFileError – if a windowed output file is requested without a spectrum file
InputFileError – if the window function is unknown
InputFileError – if the target_com key is used together with a charge file or charge trajectory files, or without a restart file and a moldescriptor file that can be given or inferred
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 charge_file: str | None¶
The static charge file for the charge-flux mode.
- Type:
str | None
- charge_file_key = 'charge_file'¶
- property charge_files: list[str] | None¶
The charge trajectory files for the charge-flux mode.
- Type:
List[str] | None
- charge_files_key = 'charge_files'¶
- property delta_r: PositiveReal | None¶
The radius step size of the PQAnalysis.
- Type:
PositiveReal | None
- delta_r_key = 'delta_r'¶
- property ftsize: PositiveInt | None¶
The Fourier transform point size.
- Type:
PositiveInt | None
- ftsize_key = 'ftsize'¶
- property gap: PositiveInt | None¶
The gap between two time origins in frames.
- Type:
PositiveInt | None
- gap_key = 'gap'¶
- 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.VACFInputFileReader (INFO)>¶
- property method: str | None¶
The VACF estimator method (direct or fft).
- Type:
str | None
- method_key = 'method'¶
- 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', 'target_selection', 'out_file', 'time_step', 'window', 'gap', 'method', 'charge_file', 'charge_files', 'spectrum_file', 'ftsize', 'window_function', 'window_param', 'window_start', 'window_stop', 'windowed_out_file', 'log_file', 'use_full_atom_info', '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', 'target_selection', 'out_file', 'time_step']¶
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 spectrum_file: str | None¶
The output file for the VACF spectrum.
- Type:
str | None
- spectrum_file_key = 'spectrum_file'¶
- 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 time_step: PositiveReal | None¶
The time step between two frames in ps.
- Type:
PositiveReal | None
- time_step_key = 'time_step'¶
- 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'¶
- property window: PositiveInt | None¶
The correlation window size in frames.
- Type:
PositiveInt | None
- property window_function: str | None¶
The apodization window function of the spectrum.
- Type:
str | None
- window_function_key = 'window_function'¶
- window_key = 'window'¶
- property window_param: PositiveReal | None¶
The exponential window decay coefficient.
- Type:
PositiveReal | None
- window_param_key = 'window_param'¶
- property window_start: PositiveReal | None¶
The window start time in ps.
- Type:
PositiveReal | None
- window_start_key = 'window_start'¶
- property window_stop: PositiveReal | None¶
The window stop time in ps.
- Type:
PositiveReal | None
- window_stop_key = 'window_stop'¶
- property windowed_out_file: str | None¶
The output file for the windowed correlation function.
- Type:
str | None
- windowed_out_file_key = 'windowed_out_file'¶