Skip to content

fix: providing self.box from sim.py when .pdb does not have it#41

Closed
PolyachenkoYA wants to merge 1 commit intoKULL-Centre:mainfrom
PolyachenkoYA:main
Closed

fix: providing self.box from sim.py when .pdb does not have it#41
PolyachenkoYA wants to merge 1 commit intoKULL-Centre:mainfrom
PolyachenkoYA:main

Conversation

@PolyachenkoYA
Copy link

@PolyachenkoYA PolyachenkoYA commented Dec 30, 2025

Addresses this issue

Current behaviour:
I tried running the AF-CALVADOS example, but it failed at the box = np.append(u.dimensions[:3]/10., u.dimensions[3:]) line in build.py.

The reason was: my .pdb from AF2 did not have a CRYST line, which resulted in u.dimensions being None.

Desired behaviour:
Actually, not 100% sure how the situation "L-box is provided in config.yaml but not in *.pdb" should be handled. More precisely, I think L-box should be passed to Protein.dimensions, but I am not sure at which level the L-box should be passed (self.defaults vs "a separate argument" vs ??).

The provided fix:

Pass the L-box info via comp_defaults.

All tests passed.

sim.py) Add the L-box info to the Sim.comp_defaults so that it is later propagated to child objects, e.g. Protein

build.py) The geometry_from_pdb returns pos, box always, meaning downstream code may rely on that. So, I added a default way to construct box when .pdb does not have the box info.
The proposed default way: take the X-range of positions and add auto_box_margin to it (in Angstroms). The verbose option is to report this construction in case it's not intended.

I actually think it'd better to make this verbose=True by default, but I wanted to utilize the already-present verbose from calc_properties (line 174 from components.py), which is False and may affect other things. Any thoughts on that?

Also, what should the box be in case it's not provided by .pdb, and also no auto-construction is requested (auto_box_margin < 0) ?

components.py) Handle the new default Protein.dimensions: skip reading it from .pdb if it is already present. Check the pre-existing box is consistent with the X-s from .pdb.

A related question: what should be prioritized if both config.yaml and .pdb provide L-box info?

@sobuelow
Copy link
Collaborator

Thanks, closing this using #42

@sobuelow sobuelow closed this Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants