Inherits _ApoObject.
Public Member Functions | |
| None | __init__ (self, FilePath path) |
| Constructs an owning wrapper from one CHARMM coordinate file. | |
| int | getNumAtoms (self) |
| Returns the parsed atom count. | |
| list[list[float]] | getCoordinates (self) |
| Returns a copied nested list of Cartesian coordinates. | |
Owns coordinates parsed from one CHARMM CRD or COR file.
Construct the wrapper from a str, bytes, os.PathLike[str], or os.PathLike[bytes] path. The path is converted with os.fsencode, copied through the C ABI, and not retained. Native parsing completes synchronously before construction returns.
getCoordinates() returns a newly allocated nested Python list in atom-major [x, y, z] order. Returned values never alias native storage. The wrapper owns one C handle. close(), destroy(), and context-manager exit release it idempotently. Accessing a getter after closure raises RuntimeError.
The wrapper provides no internal synchronization. Do not overlap close() with another method call from a different thread.
| None apocharmm.charmm_crd.CharmmCrd.__init__ | ( | self, | |
| FilePath | path | ||
| ) |
Constructs an owning wrapper from one CHARMM coordinate file.
Standard and extended CHARMM fixed-width coordinate records are supported. File-name extensions are not validated. The encoded path and file contents are not retained after native construction finishes.
| [in] | path | Path supplied as str, bytes, os.PathLike[str], or os.PathLike[bytes]. Its encoded representation must be nonempty. |
| TypeError | If path cannot be converted by os.fsencode. |
| ApoCharmmError | If the encoded path is empty, the file cannot be read, the atom count or a coordinate record is malformed, a coordinate is non-finite, or native host allocation fails. |
| RuntimeError | If APOCHARMM_LIBRARY_PATH is unset or empty, or native construction reports success but produces a NULL handle. |
| OSError | If the configured apoCHARMM C ABI shared library cannot be loaded. |
| list[list[float]] apocharmm.charmm_crd.CharmmCrd.getCoordinates | ( | self | ) |
Returns a copied nested list of Cartesian coordinates.
The result contains one three-element list per atom in [x, y, z] order. Values are Python float objects copied from native double-precision host storage and use angstroms. An empty coordinate set returns an empty list.
list[list[float]] with exact shape (N, 3). | RuntimeError | If this wrapper is closed. |
| ApoCharmmError | If the native count or coordinate getter rejects the handle or output buffer. |
| OverflowError | If 3 * N cannot be represented as a ctypes array length. |
| MemoryError | If the temporary C buffer or returned Python lists cannot be allocated. |
| int apocharmm.charmm_crd.CharmmCrd.getNumAtoms | ( | self | ) |
Returns the parsed atom count.
int. | RuntimeError | If this wrapper is closed. |
| ApoCharmmError | If the native handle is invalid or reports a negative atom count. |