Skip to content

[Data Pipeline] Request for CIF-to-npz preprocessing script #3

Description

@breatheccc

[Data Pipeline] Request for CIF-to-npz preprocessing script — missing link in the mobility prediction pipeline

First of all, thank you for the excellent work on OCNet! The paper (npj Computational Materials, 2025, 11, 308) presents a very promising framework for multi-scale virtual characterization of organic functional materials.


What I found

I am trying to reproduce the full CIF → electron mobility pipeline described in the README:

cd ./biomolecular_properties/code/film_ll_scripts_elec
 && python lmdb_convert.py mol_105511_mob && bash infer.sh
 && python mobility_film.py mol_105901_mob OCNet

After thorough investigation, I discovered that the zhengcheng branch contains the three downstream scripts referenced above — lmdb_convert.py, infer.sh, and mobility_film.py — which handle the LMDB conversion → OCNet inference → kMC mobility stages. Thank you for making these available!

However, lmdb_convert.py (line 57–63) reads a pre-computed data_ll.npz file:

data = np.load(input_path, allow_pickle=True)
coord = data['coord']        # dimer 3D coordinates
symbol = data['symbol']      # atom types
features = data['feature']   # 8-dimensional TB-level descriptors
mol_name = data['name']      # molecule identifiers

No script in either the main or zhengcheng branches, nor in any of the four Zenodo records (14935486, 14934728, 14934618, 15083880), generates these data_ll.npz files from raw CIF or dimer structures. The .gitignore excludes biomolecular_properties/code/*_scripts, which suggests the preprocessing scripts exist in the development environment but were not committed or distributed.

Additionally, I noticed that mobility_film.py (line 3) references gen_sol_box.py — likely another preprocessing utility that is also not present in the repository.


Primary Request

Could you please share the preprocessing script(s) that generate data_ll.npz files from CIF or film structures?

According to the paper, this step uses xTB to compute the 8-dimensional tight-binding-level electronic descriptors (overlap integrals, orbital-specific effective transfer integrals, and total effective transfer integrals). Specifically, the script should handle:

  1. Extracting molecular dimers from the crystal/film structure (center-of-mass distance < 10 Å)
  2. Computing the 3D coordinates and atom types for each dimer
  3. Running xTB to obtain TB-level electronic descriptors → 8-dimensional feature vector
  4. Computing the reorganization energy (reorg_e), displacement vectors (displace), and dimer pair indices (pair)
  5. Saving everything in the .npz format expected by lmdb_convert.py

Any code snippet, configuration file, or even a brief description of the workflow would be tremendously helpful for reproducibility.


Additional Technical Questions

To ensure full compatibility with the pre-trained weights, I would appreciate clarification on a few implementation details:

  1. n_max (maximum number of atoms). Is this 1024 (as suggested by --max-atoms default in trans_mix_feature_infer.py:80), or a different value used during pre-training?

  2. Vocabulary mapping. The pretrain_dict.txt file lists 33 elements (including [PAD], [CLS], [SEP], [UNK]). Is this the exact element-to-index mapping used during pre-training?

  3. Gaussian kernel parameters a_ij and b_ij. The GaussianLayer in unimol.py uses learned nn.Embedding layers for mul and bias per edge type. Are the pre-trained values of these embeddings accessible, or should they be (1, 0) for inference?

  4. PAD masking strategy. Is the padding mask computed simply as src_tokens.eq(self.padding_idx) (as in unimol.py:205), or is there an additional attention mask generation step?


Acknowledgment

I will properly cite OCNet (doi: 10.1038/s41524-025-01788-y) in any subsequent academic work. Thank you for your time and consideration!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions