pestifer.logparsers.packmollogparser module¶
Packmol log parsing utility
- class pestifer.logparsers.packmollogparser.PackmolLogParser(basename='packmol-logparser')[source]¶
Bases:
LogParserA class for parsing Packmol log files. This class is a subclass of
LogParserand provides methods for reading, updating, and dumping Packmol log data.- Parameters:
basename (str) – The base name for the log parser. This is used to name the output log file.
- banner_separator = '################################################################################'¶
The separator used to identify banners in the Packmol log file.
- finalize()[source]¶
Finalize the Packmol log parser by saving the metadata and GENCAN data to files. This method writes the metadata to a YAML file and the GENCAN data to CSV files. It also generates plots of the GENCAN function values over iterations for each molecule type and saves them as PNG files.
- Returns:
The filename of the generated PNG file containing the GENCAN function value plots.
- Return type:
- measure_progress()[source]¶
Measure the progress of the Packmol log parsing. This method calculates the progress based on the number of GENCAN loops completed and the maximum number of GENCAN loops. It updates the progress attribute with the calculated progress value.
- process_banner(bytes: str)[source]¶
Process a banner in the Packmol log file. This method identifies the type of banner and updates the metadata accordingly.
- Parameters:
bytes (bytes) – The bytes representing the banner to be processed. This can be a string or bytes object containing the banner data.
- process_gencan_report(bytes: str)[source]¶
Process a report about the GENCAN (GENeric CANonical) packing algorithm in the Packmol log file. This method extracts information about the GENCAN loops, such as the iteration number, radius scaling, function values, and violations of target distances and constraints. It updates the
gencanattribute with the extracted information.- Parameters:
bytes (bytes) – The bytes representing the GENCAN report to be processed. This can be a string or bytes object containing the report data.
- process_gencan_success(bytes: str)[source]¶
Process a report about the successful completion of the GENCAN packing algorithm in the Packmol log file. This method extracts information about the molecule type, objective function value, maximum violation of target distance, and maximum constraint violation. It updates the metadata of the corresponding molecule type in the
metadata['structures']attribute with the extracted information.- Parameters:
bytes (bytes) – The bytes representing the GENCAN success report to be processed. This can be a string or bytes object containing the report data.
- process_header(bytes: str)[source]¶
Process the header section of the Packmol log file. This method extracts metadata from the header and updates the metadata attribute with relevant information.
- Parameters:
bytes (bytes) – The bytes representing the header section to be processed. This can be a string or bytes object containing the header data.
- process_molecule_report(bytes: str)[source]¶
Process a report about molecules in the Packmol log file. This method extracts information about the molecules, such as their type, function values before and after moving, and restraint violations.
- Parameters:
bytes (bytes) – The bytes representing the molecule report to be processed. This can be a string or bytes object containing the report data.
- process_moving_worst_molecules(bytes: str)[source]¶
Process a report about moving the worst molecules in the Packmol log file. This method extracts information about the function values before and after moving molecules, the types of molecules moved, and their percentages.
- Parameters:
bytes (bytes) – The bytes representing the report about moving worst molecules to be processed. This can be a string or bytes object containing the report data.
- process_section(bytes: str)[source]¶
Process a section of the Packmol log file. This method identifies the type of section and processes it accordingly.
- Parameters:
bytes (bytes) – The bytes representing the section to be processed. This can be a string or bytes object containing the section data.
- section_separator = '--------------------------------------------------------------------------------'¶
The separator used to identify sections in the Packmol log file.