Skip to content

Fix Protoss pathing: source PDB from project root, bypass Protoss dir#3

Open
amengland9 wants to merge 2 commits into
hjkgrp:mainfrom
amengland9:fix/protoss-pathing-bypass
Open

Fix Protoss pathing: source PDB from project root, bypass Protoss dir#3
amengland9 wants to merge 2 commits into
hjkgrp:mainfrom
amengland9:fix/protoss-pathing-bypass

Conversation

@amengland9

@amengland9 amengland9 commented Jul 11, 2026

Copy link
Copy Markdown

Description

Fixes the Protoss pathing bug in get_charges() (qp/manager/charge_embedding.py). Before, the function always sourced the structure PDB for charge embedding from out/<pdb>/Protoss/<pdb>_protoss.pdb, with no way to point it elsewhere. This PR changes it to look for the source .pdb in the project root (the directory containing out/) using a case-insensitive filename match if it cannot find a Protoss folder, so charge embedding can be run against a structure that bypasses Protoss entirely if desired.

Todos

  • Add find_source_pdb() helper with case-insensitive glob match and clear errors on zero/multiple matches
  • Replace fixed-hop-count path construction with explicit lookup of "out" in the cwd path
  • Switch from hardcoded '/' splitting to os.sep for Windows compatibility (I usually use the package on my local machine so this was moreso for me)

Questions

  • rename_and_clean_resnames() runs immediately after this and assigns HIP/HIE/HID based on HD1/HE2 hydrogens being present which means it assumes a protonated structure. Should there be an explicit check/warning if the bypassed structure isn't already protonated, rather than relying on the user to confirm this themselves?

Status

  • Ready to go

Added a function to find Protoss-processed PDB files with case-insensitive lookup and fallback to source PDB.
@Benzoin96485
Benzoin96485 self-requested a review July 15, 2026 19:24
Full path to the matched Protoss PDB, or ``None`` if the
Protoss folder or a matching file inside it doesn't exist.
"""
protoss_dir = os.path.join(project_root, "out", pdb_name, "Protoss")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this always hold? Where does the out directory come from?

@Benzoin96485 Benzoin96485 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments because I don't think there is a standard output directory prefix like "out" and we shouldn't assume any. Regarding your question, user may confirm the protonation themselves

Comment on lines +497 to +498
if "out" in cwd_parts:
project_root = os.sep.join(cwd_parts[:cwd_parts.index("out")])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same question: why "out"?

@Benzoin96485 Benzoin96485 added bug Something isn't working enhancement New feature or request good first issue Good for newcomers labels Jul 16, 2026
@Benzoin96485 Benzoin96485 added this to the 2026 Summer QP Hackathon milestone Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants