Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
372 commits
Select commit Hold shift + click to select a range
a337a07
Update: add CLAUDE.md
shaoqx Aug 4, 2025
13aa4ca
Update: Rename CLAUDE.md to .claude/CLAUDE.md
shaoqx Aug 4, 2025
f2a8839
Update: need them from develop but not too much
shaoqx Aug 4, 2025
e7dd2f3
Determine which cavity contains most atoms from the ligand, instead o…
SwordJack Aug 4, 2025
2136a80
Update: update CLAUDE.md with more specific pytest
shaoqx Aug 4, 2025
043ebda
Update: update CLAUDE.md and add GEMINI.md
shaoqx Aug 4, 2025
81684c4
Update: reorganize the CLAUDE.md
shaoqx Aug 4, 2025
9c1ab0b
checkpoint
shaoqx Aug 5, 2025
ebd49f1
checkpoint of dev instructions 001
shaoqx Aug 5, 2025
16d9a01
checkpoint
shaoqx Aug 5, 2025
f5ba362
Update: fix a docstring in test_amber_interface.py
shaoqx Aug 5, 2025
2377f11
Update: final version of task 001 before claude
shaoqx Aug 5, 2025
47b2ba8
CC ver 1 code for maa support in AmberInterface
shaoqx Aug 5, 2025
a6c2d4c
Update: update task 001 doc and ask for running
shaoqx Aug 5, 2025
382cf30
Update: CC ver 2 for maa support in AmberInterface
shaoqx Aug 5, 2025
b01d696
Update: CC ver 3 for maa support in AmberInterface
shaoqx Aug 5, 2025
2fb39ad
Add test on `ensemble_cavity_volumes`.
SwordJack Aug 5, 2025
45f03d0
Update: CC ver 4 for maa support in AmberInterface
shaoqx Aug 5, 2025
a6fb022
Update: update CLAUDE.md
shaoqx Aug 5, 2025
57c5c7a
Update: add feedback
shaoqx Aug 5, 2025
dea6e65
Update: CC ver 5 for maa support in AmberInterface
shaoqx Aug 5, 2025
b6bbec5
Update: CC ver 6 for maa support in AmberInterface
shaoqx Aug 5, 2025
74d388b
Update: new feedback
shaoqx Aug 5, 2025
6677b6c
update: clean test
shaoqx Aug 5, 2025
9728d21
Filter None chain ID from `_parse_cavity` results.
SwordJack Aug 5, 2025
307fb14
Update: CC ver 7 fix prepgen test
shaoqx Aug 6, 2025
6fc559f
Update: fix import issues in test_connectivity.py
shaoqx Aug 6, 2025
5f44d6d
Update: CC ver 7 deepcopy fix plan. (wrong)
shaoqx Aug 6, 2025
705a0fa
Update: CC ver 8 for maa support in AmberInterface
shaoqx Aug 6, 2025
230c12f
Update: fix the wrong test files
shaoqx Aug 6, 2025
97560ec
Set `contain_ligand` related residue as `non_active_residues`.
SwordJack Aug 6, 2025
b26a3cd
Bugfix: Fix deepcopy in DoublyLinkedNode to properly handle connectiv…
shaoqx Aug 6, 2025
3e07a53
Update: fix wrong test filename
shaoqx Aug 6, 2025
773703e
Update: feedback for Claude Code
shaoqx Aug 6, 2025
bd0b57c
Update: CC ver 9 for maa support
shaoqx Aug 6, 2025
52caeca
Update: feedback to cc
shaoqx Aug 6, 2025
9986654
Update: CC ver 10 for maa supp
shaoqx Aug 6, 2025
bfc71f6
Update: figure out a bug in prepgen.
shaoqx Aug 6, 2025
e7c78ae
Update: feedback to Claude code
shaoqx Aug 6, 2025
861ede9
Update: clean up that run_prepgen
shaoqx Aug 6, 2025
0bcbf38
Update: wrap error checking in run_prepgen
shaoqx Aug 6, 2025
b41767a
Update: fix bug in run_prepgen
shaoqx Aug 6, 2025
8511af0
Update: wrap remove ATTN lines into a function
shaoqx Aug 6, 2025
df18ac6
Update: finalize maa support and lv5 test
shaoqx Aug 6, 2025
c48111b
Update: fix run_tleap will always raise error if tleap fails silently
shaoqx Aug 6, 2025
1145156
Update: finished maa support
shaoqx Aug 6, 2025
dbc2f03
Update: address PR comments
shaoqx Aug 6, 2025
427fde0
Merge branch 'develop' into sebastian/mc_file_gen
shaoqx Aug 6, 2025
81aaf5b
Update enzy_htp/structure/modified_residue.py
shaoqx Aug 6, 2025
b7fa70b
Update enzy_htp/structure/modified_residue.py
shaoqx Aug 6, 2025
0733909
Update: address PR comments
shaoqx Aug 6, 2025
46db00f
Update: add util to summarize Amber atom types
shaoqx Aug 6, 2025
719361e
Update: add force_field.py
shaoqx Aug 6, 2025
1044505
Update: expand force field support
shaoqx Aug 6, 2025
b69bb04
Update: update the .dat support for amber ff
shaoqx Aug 6, 2025
ae24575
Update: add task for CC
shaoqx Aug 6, 2025
63a0920
Update: check ff support for maa first in maa supp
shaoqx Aug 6, 2025
7ed23b4
Merge pull request #216 from ChemBioHTP/sebastian/mc_file_gen
shaoqx Aug 7, 2025
e3d9ab2
Update: move llm supp over
shaoqx Aug 7, 2025
f344ca3
gemini ver 1 of residue_pka supp. Resived by QZ
shaoqx Aug 7, 2025
aaeb2ae
Update: CC ver 1 for residue_pka support
shaoqx Aug 7, 2025
2082374
Update: feedback to
shaoqx Aug 7, 2025
e3052cb
Update: CC ver 2 for residue pKa calculation
shaoqx Aug 7, 2025
53c6c78
Update: feedback to Claude Code
shaoqx Aug 7, 2025
ca1b6dd
Update: include size in the warning message
shaoqx Aug 7, 2025
76116af
Update: CC ver 3 for residue_pka supp QZ revised
shaoqx Aug 7, 2025
00b06fa
Update: clean up
shaoqx Aug 7, 2025
4cc4025
Merge branch 'develop' into robbie/feature_get-residue-pka
shaoqx Aug 7, 2025
54f2fa7
somehow this file left after resolving conflicts.
shaoqx Aug 7, 2025
2ff27cb
Update: fix dispatch get_file_str mismatch
shaoqx Aug 7, 2025
996fffd
clean up
shaoqx Aug 7, 2025
f4c2bdb
Update: report confidence scores for cavity select
shaoqx Aug 8, 2025
df328ff
Update: update environment.yml so that test works
shaoqx Aug 8, 2025
0eadddb
Update: actually clean up the mess
shaoqx Aug 8, 2025
9155b45
Bugfix: fix wrong dir handling
shaoqx Aug 8, 2025
83c9939
Update: fix Structure string representation
shaoqx Aug 8, 2025
fb02548
Bugfix: remove solvent in structure_0 when
shaoqx Aug 8, 2025
0d1fa46
move llm supp over
shaoqx Aug 8, 2025
f1189c8
Update: dev task for gemini
shaoqx Aug 8, 2025
3eab528
Update: add chain id
shaoqx Aug 8, 2025
c3a8ec5
Update: finalized tests and bug fixes in ensemble
shaoqx Aug 8, 2025
f44c16f
Merge branch 'develop' into yinjie/fix_mole2_cavity_calculation
shaoqx Aug 8, 2025
4f9ac66
Merge pull request #226 from ChemBioHTP/yinjie/fix_mole2_cavity_calcu…
shaoqx Aug 8, 2025
53aa42a
Update: address PR comments
shaoqx Aug 8, 2025
a34700b
Merge pull request #204 from ChemBioHTP/robbie/feature_get-residue-pka
shaoqx Aug 9, 2025
00d915a
Update: add missing SUB_MODULE in setup.py
shaoqx Aug 12, 2025
a2317cc
Bugfix: fix StructureEnsemble can be cwd dependent
shaoqx Aug 12, 2025
59fc4d0
Bugfix: decouple amberinterface parsers with cwd
shaoqx Aug 12, 2025
334343f
Update: plan v1 by gemini
shaoqx Aug 15, 2025
30786bf
Update: add feedback to gemini
shaoqx Aug 15, 2025
f47f7a7
Update: v2 plan from gemini
shaoqx Aug 15, 2025
03b70d1
simplify the repo instruction for gemini
shaoqx Aug 15, 2025
8f94a30
clean up LLM tasks
shaoqx Aug 15, 2025
deadf47
Update: add engine in function signature
shaoqx Aug 15, 2025
bbdeb0b
Update: CC ver 1 for dsi support
shaoqx Aug 15, 2025
4bf6125
Update: add slash commands
shaoqx Aug 15, 2025
4299b7f
Update: CC ver 2 for dsi support QZ revised
shaoqx Aug 15, 2025
928f1db
Update: fix the description of dsi
shaoqx Aug 15, 2025
5e2607b
Merge pull request #234 from ChemBioHTP/shaoqz/feature_dsi_api
shaoqx Aug 16, 2025
72d1f77
Update: gemini plan of structure prediction task
shaoqx Aug 16, 2025
a7a6f18
Update: gemini ver 1 for structure_prediction supp
shaoqx Aug 16, 2025
f07a59a
Update: check point for feedback for gemini
shaoqx Aug 16, 2025
7f7d762
Update: feedback to gemini
shaoqx Aug 17, 2025
78b9567
Update: finalize structure prediction API
shaoqx Aug 18, 2025
74c75bf
Update: placeholder for unit tests
shaoqx Aug 18, 2025
9a7f9b1
Update: clean up the mess by gemini and hand to CC
shaoqx Aug 18, 2025
5af5246
Update: CC ver 1 on af2 supp and feedback
shaoqx Aug 18, 2025
ad6ff9f
Update: CC ver 2 for af2 supp (qz revised)
shaoqx Aug 19, 2025
a903683
Update: CC ver 3 for af2 support (qz revised)
shaoqx Aug 19, 2025
a5d19a9
Update: support qos in accre_r9
shaoqx Aug 19, 2025
a866791
Update: clean up and finish feedback
shaoqx Aug 19, 2025
e0c33f9
update feedback
shaoqx Aug 19, 2025
6176767
Update: access to core_type
shaoqx Aug 19, 2025
792f095
Update: CC ver 4 for af2 supp (qz revise&feedback)
shaoqx Aug 19, 2025
6eb0e3a
Update: CC ver 5 for af2 support (qz revised)
shaoqx Aug 19, 2025
d12b1b0
Update: add feedback for CC
shaoqx Aug 19, 2025
7e10206
Update: support qos
shaoqx Aug 19, 2025
6e261d9
Update: screen some tests
shaoqx Aug 19, 2025
aab9f35
Update: align with new accre
shaoqx Aug 21, 2025
f6fd96a
Hotfix: fix a bug in tleap run
shaoqx Aug 22, 2025
37d72dc
Update: refactored mesh file parsing and debug
shaoqx Aug 22, 2025
4f0de04
Update: support single pdb as structure ensemble
shaoqx Aug 26, 2025
25b9934
Update: CC ver 6 for af2 support
shaoqx Aug 26, 2025
7440aae
Update: QZ fix bug and make test for CC
shaoqx Aug 27, 2025
1a960d7
Update: clean up and add feedback
shaoqx Aug 27, 2025
6a4cb98
Update: CC ver 7; QZ revise and feedback
shaoqx Aug 27, 2025
665a93e
Update: add a tool script for gpu usage
shaoqx Aug 28, 2025
08b6210
Update: bug fix in the tool script
shaoqx Aug 28, 2025
d368723
Update: fix bug
shaoqx Aug 28, 2025
130fc76
Update: CC ver 8 and QZ revise and feedback
shaoqx Aug 28, 2025
119a942
Update: feedback
shaoqx Aug 28, 2025
937f587
Update: CC ver 9 with QZ revision
shaoqx Aug 28, 2025
2349037
Update: clean up arguments
shaoqx Aug 28, 2025
168f1d6
Update: fix bug
shaoqx Aug 28, 2025
7971f44
Update: feedback and test
shaoqx Aug 29, 2025
e8a296e
Update: refactored sequence treatment in af2_predict
shaoqx Aug 29, 2025
2afa47c
Update: feedback to CC
shaoqx Aug 29, 2025
943cd5f
Update: CC ver 10 & 11 & QZ revise
shaoqx Aug 29, 2025
5a273a7
Update: clean up unnecessary parsing code
shaoqx Aug 29, 2025
24ac907
Update: test multimer prediction and fix bug
shaoqx Aug 29, 2025
e36ea67
Update: test colabfold multimer and fix bugs
shaoqx Aug 29, 2025
586d9bc
Update: clean up deprocated code
shaoqx Aug 29, 2025
f4f1714
Update: finish the logic about native container install
shaoqx Aug 30, 2025
806f04a
Update: clean up unnecessary unit tests
shaoqx Aug 30, 2025
1fe0c51
clean up
shaoqx Aug 30, 2025
7c6c38e
Update: remove dev reference files
shaoqx Sep 2, 2025
db35764
Update: add support for codex
shaoqx Sep 2, 2025
540bf29
Update: fix bugs in template scripts
shaoqx Sep 2, 2025
225d6fd
Update: add a context manager about logging level
shaoqx Sep 2, 2025
f18328b
Update: fix unnecessary logging
shaoqx Sep 2, 2025
43f0e7c
Update: collect and update workflow_app
shaoqx Sep 2, 2025
468f9cf
Update: update the shrapnel template
shaoqx Sep 2, 2025
6edae3d
Update: add structure_prediction submodule
shaoqx Sep 3, 2025
63d54bd
Update type hinting and docstrings
shaoqx Sep 3, 2025
3cbe3c9
Update: align input format
shaoqx Sep 3, 2025
dca7054
Merge pull request #235 from ChemBioHTP/shaoqz/feature_stru_pred
shaoqx Sep 3, 2025
3648413
Update: clean up test for structure prediction API
shaoqx Sep 4, 2025
348e7ea
remove rel path
shaoqx Sep 4, 2025
95b3285
Update: add error check for add_pdb function
shaoqx Sep 4, 2025
d67ac06
Update: warn and remove solvent if send in AmberParameterizer
shaoqx Sep 4, 2025
98601fc
Merge pull request #236 from ChemBioHTP/shaoqz/hotfix_addpdb
shaoqx Sep 4, 2025
8f10f3e
Update: residue_caps need unique names
shaoqx Sep 5, 2025
b9b3f52
Update: clean up convert_to_structure
shaoqx Sep 5, 2025
73aa362
Update: add note for future reference
shaoqx Sep 5, 2025
665fad1
Update: fix a bug that copying a connected item
shaoqx Sep 5, 2025
7f38f44
Update: fix a bug that copying a connected item
shaoqx Sep 5, 2025
0de235f
Update: add a test that expose a bug in deepcopy
shaoqx Sep 5, 2025
e893698
Update: fix ref leaking in deepcopy of doublylinkedtree nodes
shaoqx Sep 5, 2025
04f55a5
Update: all test passes
shaoqx Sep 5, 2025
f98100a
Bugfix: maa does not have peptide bond connected
shaoqx Sep 5, 2025
e30b436
Update: support a fast clone to a point that:
shaoqx Sep 5, 2025
bb57233
Update: create plan with CC
shaoqx Sep 5, 2025
51655c1
Update: clone connectivity in Atom
shaoqx Sep 5, 2025
887f814
Update: support clone and add tests
shaoqx Sep 5, 2025
51c47a2
Update: clone support for residue derived classes
shaoqx Sep 5, 2025
4fbebc7
Update: use private attributes
shaoqx Sep 5, 2025
9152f9a
Update: improve the performance of clone
shaoqx Sep 5, 2025
8b3b650
Update: put method in the right region
shaoqx Sep 5, 2025
a22fc15
clean up
shaoqx Sep 5, 2025
2cca2f1
Merge pull request #237 from ChemBioHTP/shaoqz/feature_fast_clone
shaoqx Sep 5, 2025
2a9f49b
Bugfix: get_ligand should store connectivity in atoms
shaoqx Sep 10, 2025
052996b
Update: not necessary and bug causing
shaoqx Sep 10, 2025
6f127e4
Update: fix files generated outside of repo
shaoqx Sep 10, 2025
dfa6158
Update: capture unnecessary tleap logs at debug level, not error level.
shaoqx Sep 10, 2025
211a4bb
Update: add a test about alt loc resolving
shaoqx Sep 12, 2025
aeb6429
Update: expose alt_loc_keep and fix bug in "first"
shaoqx Sep 12, 2025
8ba135d
Update: add test for MAA protonation
shaoqx Sep 13, 2025
f88a4c3
Update: QZ revision of Codex plan
shaoqx Sep 16, 2025
89a123b
Bugfix: fix env settings misuse
shaoqx Sep 30, 2025
cff9212
Bugfix: clean env so that colabfold container is
shaoqx Sep 30, 2025
4579539
Merge pull request #239 from ChemBioHTP/shaoqz/hotfix_colabfold
shaoqx Sep 30, 2025
21fcf08
Update: main script for ml features
shaoqx Oct 1, 2025
1c245e1
Update: fix error msg
shaoqx Oct 3, 2025
4266ad2
Update: update enzyhtp support message
shaoqx Oct 3, 2025
74c5cf1
Update: add test for protonate_stru with maa but
shaoqx Oct 4, 2025
3e83108
Update: add clone_chain_names
shaoqx Oct 4, 2025
f761c63
Update: codex 1st version of maa pybel protonation
shaoqx Oct 4, 2025
c8cdf51
Update: 2nd version of the test, still need to improve
shaoqx Oct 4, 2025
36f431e
Update: record a bug
shaoqx Oct 4, 2025
579c389
Update: remove Hs on N from the free form
shaoqx Oct 4, 2025
6828e84
Update: add backbone H back
shaoqx Oct 4, 2025
1dad3f9
Update: finished maa pybel support
shaoqx Oct 4, 2025
1e3b8b9
Update:finish testing modaa protonation with pybel
shaoqx Oct 4, 2025
534d96f
Bugfix:altloc is globally coupled not local to residue
shaoqx Oct 4, 2025
ad55eb3
Update: fix bugs
shaoqx Oct 5, 2025
eed456c
Bugfix: fix multiple bugs in amber_interface
shaoqx Oct 5, 2025
ae010b1
Update: created the task with gemini
shaoqx Oct 5, 2025
230d449
Update:finished infrastructure for file conversion from prepin to mol2
shaoqx Oct 13, 2025
8fc4636
Bugfix: bugs in MAA parameterization(mol2 related)
shaoqx Oct 13, 2025
51fc51c
Merge pull request #238 from ChemBioHTP/shaoqz/hotfix_ncaa_param
shaoqx Oct 16, 2025
930d257
Update: supported constraint for AccreR9()
shaoqx Oct 27, 2025
a388f06
Update: update warning msg for the new support kw
shaoqx Oct 27, 2025
e7eb51c
Bugfix: fix pbc update when there is no pbc info
shaoqx Nov 4, 2025
f4c7a91
Bugfix: fix path check when input is too long
shaoqx Nov 12, 2025
c2046c0
Update: added a main script for clustering example
shaoqx Nov 16, 2025
52fa87b
Update: done testing and fixing
shaoqx Nov 17, 2025
401da04
Merge pull request #242 from ChemBioHTP/shaoqz/fix_load_traj_pdb_default
shaoqx Nov 17, 2025
297eb98
Update: make heating step nvt
shaoqx Nov 19, 2025
a1f811e
Update: read occupancy and alt_loc into Atom()
shaoqx Dec 31, 2025
4388365
Update: support a fallback alt loc
shaoqx Dec 31, 2025
241425a
Update: refine naming
shaoqx Dec 31, 2025
bd3e933
Update:revise when preferred alt loc is not found
shaoqx Dec 31, 2025
fbb3cf6
Update: handle atoms with only one alt_loc record.
shaoqx Jan 1, 2026
df719a6
Update: add TODOs
shaoqx Jan 1, 2026
cb32028
Update: Add method to get alt locs in residue
shaoqx Jan 1, 2026
af8452c
Update: add a san check to avoid delayed error
shaoqx Jan 1, 2026
53b8ae1
Update: fix support for different rosetta install
shaoqx Jan 1, 2026
d3746ca
Update: fixed a version bug in cavity calc
shaoqx Jan 10, 2026
8eb14a8
Update: add todo comment
shaoqx Jan 20, 2026
d92c4e6
Update: add TODO comment
shaoqx Jan 21, 2026
c5ba779
Merge pull request #243 from ChemBioHTP/shaoqz/feature_exp_esm_support
shaoqx Jan 22, 2026
9e5f7be
Update: record a main script for metal-involved MD
shaoqx Jan 22, 2026
c66aceb
Update: fix error info
shaoqx Jan 24, 2026
1c97cd5
Update: fix error handling in job state mapping
shaoqx Jan 31, 2026
3502e29
Update: archive main script for af2_multiconf_main
shaoqx Jan 31, 2026
7e04666
Upodate: add enzy_htp/workflow_app/af2_main.py
shaoqx Feb 1, 2026
c18d912
Update: fix bugs in af2_main.py
shaoqx Feb 4, 2026
a9ea1d6
Update: fix env name
shaoqx Feb 12, 2026
212ea96
Update: new accre will load software stack at first module load comma…
shaoqx Feb 12, 2026
974add3
Bugfix: fix the problem that not adding bond lines
shaoqx Mar 10, 2026
a9c97e7
Merge pull request #245 from ChemBioHTP/shaoqz/fix_ncaa_peptide_bond
shaoqx Mar 10, 2026
9dd43ef
Bugfix: fix basis set name mapping in gaussian
shaoqx Mar 28, 2026
75559c5
Update: add full metrics hmt workflow main
shaoqx Mar 28, 2026
f629ec3
Update: add a fix to the template
shaoqx Mar 28, 2026
3a17662
Update: improve error handling in get method
shaoqx Mar 30, 2026
1a24f3d
Bugfix:fix when reverse bond idx exist in dip file
shaoqx Mar 30, 2026
0debc91
Bugfix: qm related issue
shaoqx Mar 30, 2026
7b306e6
Update: bugfix and better checkpoint in shrapnel
shaoqx Mar 30, 2026
9d83e16
Update: First Version of Energy-Injection API
SonkeLarkin Apr 29, 2026
baca607
Update: 2nd Version of Energy-Injection API
SonkeLarkin May 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
103 changes: 103 additions & 0 deletions .claude/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Installation and Setup
- Avoid installing the package yourself. If you found a problem involving environment or need to test install, ask for help from the user.

## Testing

The project uses `pytest` for testing. Use a default timeout wall of 10 min.

**IMPORTANT:** Avoid running `pytest` on the entire test suite, as it is very time-consuming. Instead, run specific tests or smaller groups of tests.

### Running Tests

The commands below are examples; you should replace file paths and test names with your actual targets.

- **Run all tests in a file:**
`pytest test/structure/test_structure.py`
- **Run a specific test function:**
`pytest test/structure/test_structure.py::test_deepcopy`
- **Run tests by name pattern:**
`pytest -k "deepcopy"`

IMPORTANT! Always run the unit test you wrote and make sure they passes so that the function is complete and working!

## Architecture Overview

EnzyHTP is a modular Python library for high-throughput enzyme modeling that automates molecular simulation workflows. The architecture follows a layered design with clear separation of concerns.

### Core Architecture Principles
- **Modular Design**: Each workflow component is encapsulated in its own module
- **Interface Pattern**: Science APIs are decoupled from external tools via interface layer
- **Structure-Centric**: Most operations work on `Structure` or `StructureEnsemble` objects
- **Extensibility**: Easy to add new modules or replace existing implementations

### Key Modules

#### Core Data Structures
The library is built around several key data types that represent different aspects of molecular systems:

**Primary Structure Types (`enzy_htp/structure/`):**
- `Structure` - Central data type representing complete enzyme structures. Its data structure is described in `DoubleLinkedNode`.
- `StructureEnsemble` - Collections of structures for ensemble-based operations
- `StructureRegion` - Specific regions within structures for targeted operations

**Molecular Component Types:**
- `Atom`, `Residue`, `Chain` - Hierarchical molecular building blocks
- `Ligand`, `MetalAtom`, `Solvent` - Specialized molecular components
- `ModifiedResidue`, `NoncanonicalBase` - Non-standard structural elements

**Workflow Data Types:**
- `Mutation` (`enzy_htp/mutation_class/`) - Represents amino acid substitutions
- `ElectronicStructure` (`enzy_htp/electronic_structure/`) - Represents electronic structure and wavefunctions from quantum calculations
- Interface handle types in `enzy_htp/_interface/handle_types/`

**Structure Support Classes:**
- Structure I/O, operations, selections, constraints, and translation utilities
- Located in respective subdirectories under `enzy_htp/structure/`

Most functions in this library operate on these data types, particularly `Structure` objects.

#### Science APIs (High-level Workflow Modules)
These modules provide the main scientific functionality and are designed to be extensible:

**Current Science API Modules:**
- `enzy_htp/preparation/` - Structure preparation, cleaning, protonation, docking
- `enzy_htp/mutation/` - Amino acid substitutions and mutation pattern matching
- `enzy_htp/geometry/` - Reaction geometry and conformational sampling
- `enzy_htp/quantum/` - Quantum mechanics calculations and electronic structure
- `enzy_htp/analysis/` - Post-simulation analysis (RMSD, binding, stability, clustering, etc.)

**Workflow and Application Modules:**
- `enzy_htp/workflow_app/` - Complete workflow applications for specific use cases
- `enzy_htp/workflow_generation/` - Workflow configuration and execution management. (deporecated)

**Extensibility Note:**
New science API modules may be added in the future following the same patterns. Each typically contains:
- Submodules containing Science APIs (functions typically have "Science API" in their docstring)
- Clear separation from interface implementations

#### Interface Layer (`enzy_htp/_interface/`)
- Interfaces to external tools: Amber, Gaussian, Rosetta, PyMOL, RDKit, etc.
- Configurations stored in `enzy_htp/_config/`
- Science APIs use these interfaces but are not tightly coupled to them

#### Support Modules
- `enzy_htp/core/` - General utilities, file system, job management, clusters
- `enzy_htp/chemical/` - Knowledge base (chemistry, atoms, residues, physics constants)

## Code Conventions

### Code Quality

- MAKE SURE you write state-of-the-art quality code. Make it modular, robust, extensible, and maintainable.
- `yapf --in-place <file_path>`: Formats a Python file using the project's `yapf` style.
- **IMPORTANT:** Only use yapf for new files. For existing files, follow the established formatting to avoid unnecessary changes.

### Key Patterns
- Use interface pattern to avoid tight coupling with external tools
- Test-driven development with tests mirroring source code structure
- Type hints for function parameters and return values
- Google Python Style Guide compliance with custom pylint configuration
1 change: 1 addition & 0 deletions .claude/commands/feedback.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
There are some problems in your code changes. Here is my feedback: $ARGUMENTS. Please address them.
1 change: 1 addition & 0 deletions .claude/commands/repoinit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please read @.claude/CLAUDE.md to learn about the repo
2 changes: 2 additions & 0 deletions .claude/commands/start_task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
You task in described in $ARGUMENTS.
Read it and understand the task. Then work on it.
134 changes: 134 additions & 0 deletions .claude/tasks/001-claude-plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Analysis and Solution Plan for Structure Deepcopy Circular Reference Issue

## CORRECTED Problem Analysis

### Root Cause
The issue is NOT that Structure lacks a custom deepcopy method. **Structure inherits from DoubleLinkedNode**, which DOES have a custom `__deepcopy__` method. The problem occurs because the DoubleLinkedNode's deepcopy method temporarily removes the custom deepcopy method and falls back to Python's default `copy.deepcopy`, which cannot handle circular references in the connectivity system.

### Technical Details

1. **Existing Custom Deepcopy**: The `Structure` class inherits from `DoubleLinkedNode` which has a custom `__deepcopy__` method (`enzy_htp/core/doubly_linked_tree.py:119-158`).

2. **DoubleLinkedNode Deepcopy Logic**:
```python
def __deepcopy__(self, memo: Union[Dict[int, Any], None] = None, _nil=[]):
# Handle parent-child relationships by setting parent to None in memo
# ...
# CRITICAL ISSUE: Temporarily removes custom deepcopy method
self.__deepcopy__ = None

# Falls back to Python's default deepcopy - CANNOT handle circular references
new_self = copy.deepcopy(self, memo)

# Restore custom deepcopy method
delattr(self, "__deepcopy__")
delattr(new_self, "__deepcopy__")
```

3. **Circular References in Connectivity**: When `copy.deepcopy(self, memo)` is called on line 151 of DoubleLinkedNode, it uses Python's default deepcopy behavior which cannot handle the connectivity circular references:
- Each `Atom` has `_connect: List[Tuple[Atom, str]]`
- When atom A connects to atom B: A._connect contains B, and B._connect contains A
- Default deepcopy fails with `RecursionError` on these circular references

4. **Where Circular References Are Created**: In `enzy_htp/structure/structure_enchantment/connectivity.py:190`:
```python
def _connect_caa_atom(atom: Atom) -> None:
# ... finds connected atoms ...
connect.append((cnt_atom, None)) # Creates reference to other atoms
atom.connect = connect # Stores bidirectional references causing circles
```

## Confirmed Behavior
- **Before connectivity initialization**: DoubleLinkedNode deepcopy works (no circular references)
- **After connectivity initialization**: Default deepcopy fails on connectivity circular references

## Solution Plan

### Option 1: Fix DoubleLinkedNode Deepcopy Method (Recommended)

**Location**: `enzy_htp/core/doubly_linked_tree.py`

**Problem**: The DoubleLinkedNode deepcopy method removes the custom `__deepcopy__` and falls back to default deepcopy, which cannot handle connectivity.

**Solution**: Modify the DoubleLinkedNode deepcopy to handle connectivity circular references:

```python
def __deepcopy__(self, memo: Union[Dict[int, Any], None] = None, _nil=[]):
if memo is None:
memo = {}

# Handle parent relationships as before
if self.parent is not None:
parent_id = id(self.parent)
y = memo.get(parent_id, _nil)
if y is _nil:
memo[id(self.parent)] = None

# Instead of removing __deepcopy__, use a connectivity-aware approach
new_self = self._deepcopy_with_connectivity_handling(memo)
return new_self

def _deepcopy_with_connectivity_handling(self, memo):
# Custom deepcopy logic that handles connectivity circular references
# 1. Create new instance
# 2. Copy non-connectivity attributes
# 3. Handle connectivity separately to break circular references
# 4. Rebuild connectivity with copied atom references
```

### Option 2: Override Deepcopy in Structure Class

**Location**: `enzy_htp/structure/structure.py`

**Implementation**: Override the inherited deepcopy method in Structure to handle connectivity:

```python
def __deepcopy__(self, memo):
# Call parent deepcopy but with connectivity handling
# or implement Structure-specific deepcopy that handles atoms with connectivity
```

### Option 3: Implement Connectivity-Aware Deepcopy at Atom Level

**Location**: `enzy_htp/structure/atom.py`

**Implementation**: Add custom `__deepcopy__` to Atom class to handle its `_connect` attribute properly.

## Recommended Implementation Plan

### Phase 1: DoubleLinkedNode Fix (Option 1)
1. **Modify DoubleLinkedNode's `__deepcopy__` method** to detect and handle connectivity circular references
2. **Add connectivity-aware deepcopy logic** that temporarily removes connectivity, copies the structure, then rebuilds connectivity
3. **Ensure compatibility** with all DoubleLinkedNode subclasses (Structure, Chain, Residue, Atom)

### Phase 2: Testing and Validation
1. **Update `test_structure_deepcopy_isolation`** to verify the fix works
2. **Test deepcopy with connectivity** on various structure types
3. **Verify no regression** in parent-child relationship handling

### Phase 3: Documentation
1. **Document the connectivity handling** in DoubleLinkedNode deepcopy
2. **Add unit tests** for deepcopy with various connectivity scenarios
3. **Document known limitations** if any

## Implementation Priority

**High Priority**: Option 1 (Fix DoubleLinkedNode deepcopy)
- Fixes the root cause in the base class
- Benefits all DoubleLinkedNode subclasses
- Maintains the existing inheritance pattern
- Most comprehensive solution

## Expected Outcome

After implementation:
- `copy.deepcopy(structure)` will work both before and after connectivity initialization
- All DoubleLinkedNode subclasses will properly handle deepcopy with circular references
- Integration tests that rely on structure copying will pass
- Existing parent-child relationship handling is preserved

## Files to Modify

1. **Primary**: `enzy_htp/core/doubly_linked_tree.py` - Fix DoubleLinkedNode `__deepcopy__` method
2. **Testing**: `test/structure/structure_enhancement/test_connectivity.py` - Update test expectations
3. **Additional**: Add unit tests for deepcopy with connectivity in various scenarios
8 changes: 8 additions & 0 deletions .claude/tasks/001-feedback-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Feedback for Claude Code

Several problems in your code.
1. the unit test for test_amber_parameterizer_run_lv_5 is not passed
2. the unit test for test_run_prepgen is incomplete. You need to save an .ac file to the data directory associated with this test folder and use it. Reference other tests.
3. the generated .ac file is not using GAFF atom type which is by default. You need fix the wrong behavior in antechamber_ncaa_to_moldesc about atom_type.
4. the _correct_atom_types_in_ac_file should not use ff14sb atom name mapping by default, you should at least have ff19sb atom name mapping there, and raise error if not in the mapping. You can find the lib file record these information under $AMBERHOME. Look for them.
5. the parm dat path should change according to the force field of choice. you can run tleap and just by sourcing the force field to see the associated parmdat path. There should always be a parmdat path mapped otherwise raise.
25 changes: 25 additions & 0 deletions .claude/tasks/001-feedback-10.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Plan

The task is to make the `_parameterize_modified_res` more robust and use accurate force field.
1. Before searh the ncaa library, we want to check if this maa is already supported by the force field user specified. Make a seperate function for this and call it.
- This new function will be `check_residue_name_ff_support(res_code: str, force_fields: List[str], work_dir: Path) -> bool`
- res_code is the 3-letter code of the residue.
- In this function, we use a simple tleap call to verify the support.
```
# source all user specified force fields
source leaprc.protein.ff14SB
...

# put the res code in
model = sequence { RES }

# print out the description
desc model

quit
```
explore what will happen with supported/unsupported case.
- make unit test for this function and do test driven development
- put it in `_parameterize_modified_res` and configure all the arguments using information we know in `_parameterize_modified_res`
2. It is possible that user will use force field combinations such as ff19SB and ff19SB_modAA. Make sure `get_protein_force_field` if given such list find the correct canonincal AA protein force field. Add this case in the unit test and address any problem.

6 changes: 6 additions & 0 deletions .claude/tasks/001-feedback-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Feedback for Claude Code

Several problems in your code.
1. the unit test for test_amber_parameterizer_run_lv_5 is not passed. You should read the error information and debug until it passes.
2. In amber_interface.py, the logic for finding the protein force field should be wrapped as a method. A list of supported force field should be stored as a class variable. (reference other mappers in AmberInterface)
3. ff19SB use XC for CA, I already made edit to the file and fixed it for you.
9 changes: 9 additions & 0 deletions .claude/tasks/001-feedback-3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Feedback for Claude Code

Several problems in your code.
1. Let's write a unit test try to isolate the deepcopy error happened in our lv 5 test.
2. get_protein_force_field need a unit test. You need to tests different possible input from user. Run the test and make the function more robust. For example, the function is not case sensitive to the input force_field, however should not, this should be addressed. Make sure the test passes.
3. In run_prepgen, os is already imported, remove the redundant import.
4. In run_prepgen, the error handling is not robust. Please keep any exception exposed.
5. The generated frcmod, frcmod2, mol2 file did not use the naming convention. Reference the convention in _parameterize_ligand. (i.e. you need to add target_method in the name.)
6. We need to make sure the "# 0. search parm lib - same as ligand" part of `_parameterize_modified_res` works. Read and understand how this works and write a seperate unit test to test this. (tip: you need to make the frcmod, frcmod2, mol2 files with the correct name and a new ncaa_lib_... dir under the associated data directory. dont forget the ones for RLP as well)
7 changes: 7 additions & 0 deletions .claude/tasks/001-feedback-4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Feedback for Claude Code

Several problems in your code.
1. The `run_prepgen` could hide error in the try block. I have edited the code to fix it. Review it and make sure it works. (i.e.: add a unit test in the case that will fail)
2. The existing unit test of run_prepgen need a rework. It now leaves intermediate files in the working dir and will not correct raise a failed prepgen run.
3. `test_structure_deepcopy_isolation` should not be in `test_amber_interface` because it has nothing to do with Amber. Put it in the right place.
4. Propose a plan to fix the deepcopy problem isolated in `test_structure_deepcopy_isolation`. Write the plan in a new file under `.claude/tasks/001-claude-plan-{index}.md`. You should come up with several plans index them in the filename.
9 changes: 9 additions & 0 deletions .claude/tasks/001-feedback-5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Feedback for Claude Code

Several problems in your code.
1. `test_run_prepgen` need a rework. You need to generate a .mc file and keep it in the data dir. (i.e. using a seperate run.) And avoid generating the .mc file during the test. I have deleted everything in that unit test. Please plan what to test first and complete it and make it work.
2. For fixing the problem isolated in `test_structure_deepcopy_isolation`. Please
a. read and understand the current custom deepcopy method Structure class use
b. read and understand how connectivity is stored in Structure
c. based on your understanding analyze the reason of the problem
d. write your analysis of the reason and a concrete plan about what changes should be made on the custom deepcopy function under `.claude/tasks/001-claude-plan.md`
12 changes: 12 additions & 0 deletions .claude/tasks/001-feedback-6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Feedback for Claude Code

Several problems in your code.
1. `run_prepgen` need to clean up the generated intermediate files. Use `test_run_prepgen` to figure out what files need to be cleaned and change `run_prepgen` to clean them.
!! RUN unit tests related to this problem. Create unit test when it is necessary. A problem is only considered resolved when the related unit test passes.
2. You preivous understanding of the problem isolated in `test_structure_deepcopy_isolation` is wrong. There is a custom deepcopy method defined in the parent class of Structure: `DoubleLinkedNode`
a. read and understand the current custom deepcopy method Structure class use
b. read and understand how connectivity is stored in Structure
c. based on your understanding analyze the reason of the problem
d. update `.claude/tasks/001-claude-plan.md` for your new understanding and plan to fix


14 changes: 14 additions & 0 deletions .claude/tasks/001-feedback-7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Feedback for Claude Code

Several problems in your code.
1. `test_run_prepgen` is wrong. I have fixed it for you. The reason that it failed previously is because you used a broken `ac` and `mc` files. Please add code in `run_prepgen` to expose any error information it reports.
a. make broken .ac file or .mc file.
b. manually run prepgen to see what error informtaion is given.
c. change `run_prepgen` to report these errors.
b. make sure the error handling is working by definig them in `test_run_prepgen_failure_cases` and make sure it passes.
2. You preivous understanding of the problem isolated in `test_structure_deepcopy_isolation` is wrong. I have fixed the the `__deepcopy__` method in `DoubleLinkedNode` and explained in `test_connected_structure_deepcopy`. You need to read the TODO I left in this test function and complete the test function.
3. As the deepcopy problem addressed, you should make sure `test_amber_parameterizer_run_lv_5` works so that the maa support is complete. I commented out the clean up line in this test so that I can check your result.

!! RUN unit tests related to this problem. Create unit test when it is necessary. A problem is only considered resolved when the related unit test passes.


Loading