⚡ Bolt: Fast Extended XYZ metadata parsing via read_extxyz_info_fast#498
⚡ Bolt: Fast Extended XYZ metadata parsing via read_extxyz_info_fast#498
Conversation
This commit introduces a significant performance improvement when analyzing extended xyz (.xyz) files. Many scripts loop over these files using `ase.io.read()` solely to extract the `atoms.info` dictionary. This causes the full structural parsing of the coordinate system, cell, and properties. By introducing and using `read_extxyz_info_fast`, which directly leverages `ase.io.extxyz.key_val_str_to_dict` to only parse the second line (the properties line) of the file, we bypass the expensive full-structure reading. Affected files: - `ml_peg/analysis/utils/utils.py` - `ml_peg/analysis/defect/Relastab/analyse_Relastab.py` - `ml_peg/analysis/defect/Defectstab/analyse_Defectstab.py` A minor bug fix regarding `labels_list` initialization in `solvMPCONF196` was also included. Co-authored-by: alinelena <3306823+alinelena@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
💡 What: Introduced
read_extxyz_info_fastutility to quickly extract metadata from Extended XYZ files, completely bypassing the heavy full-coordinate structure parser ofase.io.read(). It was applied toRelastabandDefectstabanalysis scripts where system and subset labels are fetched fromatoms.info.🎯 Why: In loops traversing many large
.xyzstructure files (which is common in this codebase for metrics extraction), reading the entire atoms object just to access the.infodictionary causes severe slowdowns. Since.infois stored entirely on the second line of the file, we can parse it in O(1) time.📊 Impact: Massively reduces I/O parsing overhead during metric generation for defect analysis, speeding up test collection and metric generation times, particularly as datasets scale up. Avoids large memory allocations from ASE Atom objects that are immediately discarded.
🔬 Measurement: Run the analysis pipelines for Defectstab or Relastab with large data sets, or observe the test suite timing which remains steady without introducing regressions.
PR created automatically by Jules for task 4276595547892877527 started by @alinelena