Inherits _ApoObject.
Public Member Functions | |
| None | __init__ (self, FilePath path) |
| Constructs an owning wrapper from one PSF file. | |
| int | getNumAtoms (self) |
| Returns the atom count. | |
| int | getNumBonds (self) |
| Returns the bond count. | |
| int | getNumAngles (self) |
| Returns the angle count. | |
| int | getNumDihedrals (self) |
| Returns the proper-dihedral count. | |
| int | getNumImpropers (self) |
| Returns the improper-dihedral count. | |
| int | getNumCrossTerms (self) |
| Returns the CMAP cross-term count. | |
| list[str] | getSegmentIdentifiers (self) |
| Returns copied per-atom segment identifiers. | |
| list[int] | getResidueIdentifiers (self) |
| Returns copied per-atom residue identifiers. | |
| list[str] | getResidueNames (self) |
| Returns copied per-atom residue names. | |
| list[str] | getAtomNames (self) |
| Returns copied per-atom atom names. | |
| list[str] | getAtomTypes (self) |
| Returns copied per-atom CHARMM atom types. | |
| list[float] | getCharges (self) |
| Returns copied per-atom partial charges. | |
| list[float] | getMasses (self) |
| Returns copied per-atom masses. | |
| float | getNetCharge (self) |
| Computes the net partial charge. | |
| float | getTotalMass (self) |
| Computes the total mass. | |
| str | getFileName (self) |
| Returns the stored PSF path. | |
Owns a parsed native CHARMM PSF.
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 as a Python object. Parsing and native derivation complete before construction returns.
Every metadata getter returns a new Python scalar, string, or list. No returned Python value aliases native PSF storage. The current Python API exposes counts, per-atom metadata, aggregate charge and mass, and the stored path; native bond, angle, dihedral, connectivity, residue-interval, water, and group arrays are not exposed.
The wrapper owns one C handle. close() and context-manager exit release that handle and are idempotent. Accessing a method after closure raises RuntimeError. Native ForceManager and CharmmContext objects created from this PSF retain shared native ownership; their Python wrappers also retain the source wrapper where required by the current high-level API.
The wrapper provides no internal synchronization. Do not overlap close() with another method call from a different thread.
| None apocharmm.charmm_psf.CharmmPsf.__init__ | ( | self, | |
| FilePath | path | ||
| ) |
Constructs an owning wrapper from one PSF file.
The path is converted with os.fsencode and copied before native parsing. File-name extensions are not validated. The native constructor parses atom metadata and topology, then derives residue intervals, recognized water tuples, connected-component intervals, and exclusion data.
| [in] | path | Path supplied as str, bytes, os.PathLike[str], or os.PathLike[bytes]. Its encoded representation must be non-empty. |
| TypeError | If path cannot be converted by os.fsencode. |
| ApoCharmmError | If the encoded path is empty, the file cannot be read, the PSF is malformed, a count or topology atom number is unsupported, or a native CUDA operation fails. |
| RuntimeError | If APOCHARMM_LIBRARY_PATH is unset or empty, or if native construction reports success but produces a NULL handle. |
| OSError | If the configured apoCHARMM C ABI shared library cannot be loaded. |
| list[str] apocharmm.charmm_psf.CharmmPsf.getAtomNames | ( | self | ) |
Returns copied per-atom atom names.
Each native field occupies eight bytes, is decoded as UTF-8, and has leading and trailing whitespace removed with str.strip().
list[str] of length getNumAtoms() in atom-record order. The list and strings do not alias native storage. | RuntimeError | If this wrapper is closed. |
| ApoCharmmError | If a native count or buffer operation fails. |
| UnicodeDecodeError | If a returned fixed-width field is not valid UTF-8. |
| list[str] apocharmm.charmm_psf.CharmmPsf.getAtomTypes | ( | self | ) |
Returns copied per-atom CHARMM atom types.
Each native field occupies eight bytes, is decoded as UTF-8, and has leading and trailing whitespace removed with str.strip().
list[str] of length getNumAtoms() in atom-record order. The list and strings do not alias native storage. | RuntimeError | If this wrapper is closed. |
| ApoCharmmError | If a native count or buffer operation fails. |
| UnicodeDecodeError | If a returned fixed-width field is not valid UTF-8. |
| list[float] apocharmm.charmm_psf.CharmmPsf.getCharges | ( | self | ) |
Returns copied per-atom partial charges.
list[float] of length getNumAtoms() in atom-record order. Values use elementary-charge units and do not alias native storage. | RuntimeError | If this wrapper is closed. |
| ApoCharmmError | If a native count or buffer operation fails. |
| str apocharmm.charmm_psf.CharmmPsf.getFileName | ( | self | ) |
Returns the stored PSF path.
The method requests a fixed 1024-byte C buffer, decodes the complete buffer as UTF-8, and removes trailing ASCII spaces. The returned Python string is a copy and does not alias native storage.
str. | RuntimeError | If this wrapper is closed. |
| ApoCharmmError | If the native path requires more than 1024 bytes or the native handle is invalid. |
| UnicodeDecodeError | If the stored path bytes are not valid UTF-8. |
| list[float] apocharmm.charmm_psf.CharmmPsf.getMasses | ( | self | ) |
Returns copied per-atom masses.
list[float] of length getNumAtoms() in atom-record order. Values use atomic mass units and do not alias native storage. | RuntimeError | If this wrapper is closed. |
| ApoCharmmError | If a native count or buffer operation fails. |
| float apocharmm.charmm_psf.CharmmPsf.getNetCharge | ( | self | ) |
Computes the net partial charge.
float containing the sum in elementary-charge units. | RuntimeError | If this wrapper is closed. |
| ApoCharmmError | If the native atom count is uninitialized, the native charge-vector length is inconsistent, or the handle is invalid. |
| int apocharmm.charmm_psf.CharmmPsf.getNumAngles | ( | self | ) |
Returns the angle count.
int. | RuntimeError | If this wrapper is closed. |
| ApoCharmmError | If the native handle is invalid or reports a negative angle count. |
| int apocharmm.charmm_psf.CharmmPsf.getNumAtoms | ( | self | ) |
Returns the atom count.
int. | RuntimeError | If this wrapper is closed. |
| ApoCharmmError | If the native handle is invalid or reports a negative atom count. |
| int apocharmm.charmm_psf.CharmmPsf.getNumBonds | ( | self | ) |
Returns the bond count.
int. | RuntimeError | If this wrapper is closed. |
| ApoCharmmError | If the native handle is invalid or reports a negative bond count. |
| int apocharmm.charmm_psf.CharmmPsf.getNumCrossTerms | ( | self | ) |
Returns the CMAP cross-term count.
int. | RuntimeError | If this wrapper is closed. |
| ApoCharmmError | If the native handle is invalid or reports a negative cross-term count. |
| int apocharmm.charmm_psf.CharmmPsf.getNumDihedrals | ( | self | ) |
Returns the proper-dihedral count.
int. | RuntimeError | If this wrapper is closed. |
| ApoCharmmError | If the native handle is invalid or reports a negative proper-dihedral count. |
| int apocharmm.charmm_psf.CharmmPsf.getNumImpropers | ( | self | ) |
Returns the improper-dihedral count.
int. | RuntimeError | If this wrapper is closed. |
| ApoCharmmError | If the native handle is invalid or reports a negative improper-dihedral count. |
| list[int] apocharmm.charmm_psf.CharmmPsf.getResidueIdentifiers | ( | self | ) |
Returns copied per-atom residue identifiers.
list[int] of length getNumAtoms() in atom-record order. Values are dimensionless and do not alias native storage. | RuntimeError | If this wrapper is closed. |
| ApoCharmmError | If a native count or buffer operation fails. |
| list[str] apocharmm.charmm_psf.CharmmPsf.getResidueNames | ( | self | ) |
Returns copied per-atom residue names.
Each native field occupies eight bytes, is decoded as UTF-8, and has leading and trailing whitespace removed with str.strip().
list[str] of length getNumAtoms() in atom-record order. The list and strings do not alias native storage. | RuntimeError | If this wrapper is closed. |
| ApoCharmmError | If a native count or buffer operation fails. |
| UnicodeDecodeError | If a returned fixed-width field is not valid UTF-8. |
| list[str] apocharmm.charmm_psf.CharmmPsf.getSegmentIdentifiers | ( | self | ) |
Returns copied per-atom segment identifiers.
Each native field occupies eight bytes, is decoded as UTF-8, and has leading and trailing whitespace removed with str.strip().
list[str] of length getNumAtoms() in atom-record order. The list and strings do not alias native storage. | RuntimeError | If this wrapper is closed. |
| ApoCharmmError | If a native count or buffer operation fails. |
| UnicodeDecodeError | If a returned fixed-width field is not valid UTF-8. |
| float apocharmm.charmm_psf.CharmmPsf.getTotalMass | ( | self | ) |
Computes the total mass.
float containing the sum in atomic mass units. | RuntimeError | If this wrapper is closed. |
| ApoCharmmError | If the native atom count is uninitialized, the native mass-vector length is inconsistent, or the handle is invalid. |