packing_defect.core.topology
Classes
|
Read CHARMM RTF/STR topology files ( |
- class packing_defect.core.topology.TopologyReader(radii: Dict[str, float], classifier: ClassificationStrategy | Callable[[str, str], int])[source]
Bases:
objectRead CHARMM RTF/STR topology files (
*.rtf,*.str) and extract atom properties for a given residue.Each atom is mapped to a tuple
(radius, code), where:radius is looked up from a provided radii dictionary
code is determined using a classification strategy
The classifier may be either:
An object with a
.classify(resname, atom_name)methodA plain function
f(resname, atom_name) -> int
- read(resname: str, topo_path: str) Dict[str, Tuple[float, int]][source]
Parse the
RESIblock for a given residue in the topology file.- Parameters:
- Returns:
dict of {str – Mapping from atom name to a tuple
(radius, code).- Return type:
- Raises:
FileNotFoundError – If the topology file does not exist.
KeyError – If an atom type is not found in the radii map.
TypeError – If the classifier is not callable or does not implement
.classify().