inpRW._inpW

Module Contents

This module contains functions for writing a new input file from the information in keywords.

class inpRW._inpW.Write

The Write class contains functions that write input files from the parsed data structure.

generateInpSum()

Generates the .sum file, which includes the keyword line and path for each keyword block.

The file will be written to _kwsumName.

writeBlocks(iterable, output=None)

Generates strings from a sequence of inpKeyword objects.

This function generates strings from a sequence of inpKeyword objects. It will either write the strings to output, if output is a file, or it will append the strings to output if output is a list.

This function will call itself recursively to handle suboptions.

Parameters:
  • iterable (list) – Items in list should be inpKeyword blocks.

  • output (file object or list) – Output will be written to this object. Defaults to [].

Returns:

If output is a list, this function will return a list. If output is a file, there is no return.

Return type:

list

writeInp(blocks=None, output='')

This function writes out the contents of the input file structure (including any changes) to the file indicated by output.

If blocks is not specified, every keyword block will be written. If output is not specified, the output .inp will be inpName + jobSuffix. inpName will have “.inp” removed before jobSuffix is added.

Parameters:
  • blocks (list) – The list of inpKeywords to write to output. Defaults to None, which will write out all keyword blocks.

  • output (str) – The name of the file to which the new input file will be written. Defaults to ‘’, which will write to inpName + jobSuffix.