parmed.formats.psf module

This module contains classes for reading and writing CHARMM- and XPLOR-style PSF files

class parmed.formats.psf.PSFFile[source]

Bases: object

CHARMM- or XPLOR-style PSF file parser and writer. This class is specifically a holder for the writing functionality and a vessel for automatic file type detection. If you wish to instantiate a PSF file directly, use parmed.charmm.CharmmPsfFile or the parmed.formats.load_file() function instead.

Methods

id_format(filename)

Identifies the file type as a CHARMM PSF file

parse(filename)

Read a CHARMM- or XPLOR-style PSF file

write(struct, dest[, vmd])

Writes a PSF file from the stored molecule

static id_format(filename)[source]

Identifies the file type as a CHARMM PSF file

Parameters
filenamestr

Name of the file to check format for

Returns
is_fmtbool

True if it is a CHARMM or Xplor-style PSF file

static parse(filename)[source]

Read a CHARMM- or XPLOR-style PSF file

Parameters
filenamestr

Name of the file to parse

Returns
psf_fileCharmmPsfFile

The PSF file instance with all information loaded

static write(struct, dest, vmd=False)[source]

Writes a PSF file from the stored molecule

Parameters
structStructure

The Structure instance from which the PSF should be written

deststr or file-like

The place to write the output PSF file. If it has a “write” attribute, it will be used to print the PSF file. Otherwise, it will be treated like a string and a file will be opened, printed, then closed

vmdbool

If True, it will write out a PSF in the format that VMD prints it in (i.e., no NUMLP/NUMLPH or MOLNT sections)

Examples

>>> cs = CharmmPsfFile('testfiles/test.psf')
>>> cs.write_psf('testfiles/test2.psf')