PSCF v1.1
Public Member Functions | List of all members
pscfpp.output.State Class Reference

Container for data in state files produced by a sweep. More...

Public Member Functions

def __init__ (self, filename)
 Constructor. More...
 
def __str__ (self)
 Return string representation of this object in state file format. More...
 
def write (self, filename)
 Write the contents of this object to file in state file format. More...
 

Detailed Description

Container for data in state files produced by a sweep.

This class is a tool to parse a PSCF "state file" and store all input parameters and property valiues within it in a single object. A state file is comprised of a block containing param file block for a given system, which contains most input parameters, and a subsequent block of text containing the thermodynamic data in PSCF thermo file format. These state files are output by PSCF Sweep operation with the extension ".stt". Users can access and modify the stored values of the parameters after parsing by using specific statements (commands), and can write the entire object to a file in proper format.

Construction and Parsing:

The constructor for class State accepts the name of a state file, and parses that file and return a State object that contains the contents of the file.

Example: To read and parse a state file with name 'state':

from pscfpp.output import *
s = State('state')
Module of parsers for PSCF output file formats.
Definition: output.py:1

Acccessing stored variables:

A State object contains two data attributes named param and thermo, which corresponding to param and thermo sections of the state file. The param attribute is an instance of class pscfpp.param.Composite that stores the contents of the parameter file block of the state file, while the thermo attribute is an instance of class pscfpp.thermo.Thermo. Users can access either attribute or the contents of either object using dot notation. See the documenation of the param.Composite and thermo.Thermo classes for instructions on accessing values for specific variables.

In the following examples, suppose that variable s is a State object that contains the contents of a state file.

Example: The expressions

s.param
s.param.Mixture

return pscfpp.param.Composite objects that contain the contents of the entire parameter file block and of the Mixture subblock of the parameter block.

Example: The expressions

s.thermo
s.thermo.fHelmholtz

return the pscfpp.thermo.Thermo object that contains the contents of the thermo block, and the value of the Helmholtz free energy per monomer, respectively.

Modifying values:

Users may also use dot notation to modify values of variables stored in the param and thermo attributes. See documentation of classes pscfpp.param.Composite and pscfpp.thermo.Thermo for details.

Definition at line 398 of file output.py.

Constructor & Destructor Documentation

◆ __init__()

def pscfpp.output.State.__init__ (   self,
  filename 
)

Constructor.

Parameters
filenamename of a state file to be parsed (string)

Definition at line 405 of file output.py.

References pscfpp.command.Command.param(), pscfpp.output.State.param, and pscfpp.output.State.thermo.

Member Function Documentation

◆ __str__()

def pscfpp.output.State.__str__ (   self)

Return string representation of this object in state file format.

This function returns multi-line string containing the contents of this object in file format of a state file (i.e, as a parameter block followed by a thermo block).

Definition at line 423 of file output.py.

References pscfpp.output.State.__str__(), pscfpp.command.Command.param(), pscfpp.output.State.param, and pscfpp.output.State.thermo.

Referenced by pscfpp.output.State.__str__(), pscfpp.field.Field.write(), pscfpp.output.Thermo.write(), and pscfpp.output.State.write().

◆ write()

def pscfpp.output.State.write (   self,
  filename 
)

Write the contents of this object to file in state file format.

This function opens a file with the specified filename and writes the string produced by the str function to that file.

Parameters
filenamename of the output file (string)

Definition at line 435 of file output.py.

References pscfpp.command.Script.__str__(), pscfpp.field.Field.__str__(), pscfpp.file.File.__str__(), pscfpp.file.Directory.__str__(), pscfpp.make.MakeMaker.__str__(), pscfpp.output.Thermo.__str__(), pscfpp.output.State.__str__(), pscfpp.param.Composite.__str__(), pscfpp.param.Parameter.__str__(), pscfpp.param.Array.__str__(), pscfpp.param.Matrix.__str__(), pscfpp.text.Wrapper.__str__(), and pscfpp.text.Record.__str__().


The documentation for this class was generated from the following file: