pestifer.scripters.psfgen module

class pestifer.scripters.psfgen.PsfgenScripter(*args, **kwargs)[source]

Bases: VMDScripter

This class extends the VMDScripter class to provide functionality for creating and managing psfgen scripts.

Parameters:

config (Config) – The configuration object containing settings for the script.

addpostregenerateline(line)[source]

Add a line to the post-regenerate commands section of the psfgen script.

Parameters:

line (str) – The line of Tcl code to be added to the post-regenerate commands.

describe_molecule(mol: Molecule)[source]

Describe a molecule in the psfgen script. This method sets up the molecule in the psfgen script by writing the necessary Tcl commands to create a new molecule and load its topology and coordinates.

Parameters:

mol (Molecule) – The molecule object to be described in the psfgen script.

fetch_standard_charmm_topologies()[source]

Fetch the standard CHARMM topologies from the configuration and copy them to the local directory. This method retrieves the topologies defined in the CHARMM force field configuration and copies them to the local directory for use in the psfgen script.

Returns:

A list of topology files that have been copied to the local directory.

Return type:

list

load_project(*objs)[source]

Load a project into psfgen by reading the PSF and PDB files. This method takes one or two objects (PSF and PDB files) and loads them into psfgen. If only one object is provided, it is assumed to be the basename of both the PSF and PDB files. If two objects are provided, the first is treated as the PSF file and the second as the PDB file.

Parameters:

objs (tuple) –

A tuple containing either one or two objects:

  • If one object, it should be the basename of both the PSF and PDB files.

  • If two objects, the first should be the PSF file and the second should be the PDB file.

newscript(basename: str = '', packages: list[str] = [], additional_topologies: list[str] = [])[source]

Initialize a new psfgen script with a specified basename and packages. If no basename is provided, a default script name is used.

Parameters:
  • basename (str, optional) – The base name for the script file. If not provided, a default name is used.

  • packages (list, optional) – A list of Tcl packages to be imported in the script.

  • additional_topologies (list, optional) – A list of additional topology files to be included in the script. These files should not contain a path (i.e., they should be in the current working directory). These can be either ‘rtf’ or ‘str’ extension files.

runscript(*args, **options)[source]

Run the psfgen script using the VMD command line interface. This method constructs a command to execute VMD with the specified script and options.

Parameters:
  • args (tuple) – Additional arguments to be passed to the VMD command.

  • options (dict) – A dictionary of options to be passed to the VMD command.

Returns:

The command object that was constructed to run the psfgen script, after it has been executed.

Return type:

Command

write_cfusion_insegment(C: Cfusion)[source]

Writes the Tcl commands to add the fusion into the active segment of the base molecule.

Parameters:

C (Cfusion) – The Cfusion object representing the fusion segment to be added.

write_cfusion_postsegment(C: Cfusion)[source]

Writes the Tcl commands to finalize the fusion segment in the Psfgen script.

Parameters:

C (Cfusion) – The Cfusion object representing the fusion segment to be finalized.

write_cfusion_presegment(C: Cfusion)[source]

Writes the Tcl commands to create a fusion segment in the Psfgen script.

Parameters:

C (Cfusion) – The Cfusion object representing the fusion segment to be created. This method generates the Tcl commands to create a fusion segment in the Psfgen script, including the selection of atoms and writing the segment to a PDB file.

write_generic_stanza(segment: Segment, transform: Transform = None)[source]

Write a generic segment stanza to the psfgen script. This method generates the Tcl commands to define a generic segment in the psfgen script, including its name, type, and any associated patches.

Parameters:
  • segment (Segment) – The generic segment object to be written to the psfgen script.

  • transform (Transform, optional) – A transform object that may be applied to the segment. Default is None.

write_glycan_stanza(segment: Segment, transform: Transform = None)[source]

Write a glycan segment stanza to the psfgen script. This method generates the Tcl commands to define a glycan segment in the psfgen script, including its name, type, and any associated patches.

Parameters:
  • segment (Segment) – The glycan segment object to be written to the psfgen script.

  • transform (Transform, optional) – A transform object that may be applied to the segment. Default is None.

write_graft_presegment(G: Graft)[source]

Writes the Tcl commands to create a graft segment in the Psfgen script.

Parameters:

G (Graft) – The Graft object representing the graft segment to be created. This method generates the Tcl commands to create a graft segment in the Psfgen script, including the selection of atoms and writing the segment to a PDB file.

Writes the Tcl commands to create a link in the Psfgen script.

Parameters:

L (Link) – The Link object representing the link to be created. This method generates the Tcl commands to create a link in the Psfgen script, including the selection of atoms and writing the link to a PDB file.

write_mol_tcl(mol: Molecule)[source]
write_mutation(mutation: Mutation)[source]
write_mutations(mutations: MutationList)[source]
write_nucleicacid_stanza(segment: Segment, transform: Transform = None)[source]

Write a nucleic acid segment stanza to the psfgen script. This method generates the Tcl commands to define a nucleic acid segment in the psfgen script, including its name, type, and any associated patches.

Parameters:
  • segment (Segment) – The nucleic acid segment object to be written to the psfgen script.

  • transform (Transform, optional) – A transform object that may be applied to the segment. Default is None.

write_polymer_stanza(segment: Segment, transform: Transform = None)[source]

Write a polymer segment stanza to the psfgen script. This method generates the Tcl commands to define a polymer segment in the psfgen script, including its name, type, and any associated patches.

Parameters:
  • segment (Segment) – The polymer segment object to be written to the psfgen script.

  • transform (Transform, optional) – A transform object that may be applied to the segment. Default is None.

write_segment(segment: Segment, transform: Transform = None)[source]

Write a segment to the psfgen script. This method generates the Tcl commands to define a segment in the psfgen script, including its name, type, and any associated patches.

Parameters:
  • segment (Segment) – The segment object to be written to the psfgen script.

  • transform (Transform, optional) – A transform object that may be applied to the segment. Default is None.

write_segments(segments: SegmentList, transform: Transform = None)[source]
write_ssbond(S: SSBond, transform: Transform = None)[source]

Writes the Tcl commands to create a disulfide bond in the Psfgen script.

Parameters:

S (SSBond) – The SSBond object representing the disulfide bond to be created. This method generates the Tcl commands to create a disulfide bond in the Psfgen script, including the selection of atoms and writing the bond to a PDB file.

write_ssbonds(ssbonds: SSBondList, transform: Transform = None)[source]
writescript(statename, guesscoord=True, regenerate=True, writepsf=True, writepdb=True, force_exit=False)[source]

Finalize the psfgen script by adding commands to write the PSF and PDB files, and optionally regenerate angles and dihedrals, and guess coordinates. This method checks if an exit statement is already present in the script; if not, it adds one.

Parameters:
  • statename (str) – The name of the state to be used for writing the PSF and PDB files.

  • guesscoord (bool, optional) – If True, the script will include a command to guess coordinates. Default is True.

  • regenerate (bool, optional) – If True, the script will include a command to regenerate angles and dihedrals. Default is True.

  • writepsf (bool, optional) – If True, the script will include a command to write the PSF file. Default is True.

  • writepdb (bool, optional) – If True, the script will include a command to write the PDB file. Default is True.

  • force_exit (bool, optional) – If True, the script will include an exit statement even if one is already present. Default is False.