Package schrodinger :: Package application :: Module inputconfig
[hide private]
[frames] | no frames]

Module inputconfig

A modified version of the configobj module.

This module can be used to read and write simplified input file (SIF) formats, such as those used by VSW, QPLD, Prime, Glide, MacroModel, etc.

The SIF format is related to the Windows INI (*.ini) format that is read and writen by configobj, but with following exceptions:

  1. Spaces are used instead of equals signs to separate keywords from values.
  2. Keywords should be written in upper case. (The reading of keywords is case-sensitive).

Example input file:

   KEYWORD1 value
   KEYWORD2 "value with $special$ characters"
   KEYWORD3 item1, item2, item3
   KEYWORD4 True
   KEYWORD5 10.2
   KEYWORD6 1.1, 2.2, 3.3, 4.4

   [ SECTION1 ]
      SUBKEYWORD1 True
      SUBKEYWORD2 12345
      SUBKEYWORD3 "some string"

   #END

For more information on ConfigObj, see: http://www.voidspace.org.uk/python/configobj.html

Copyright Schrodinger, LLC. All rights reserved.

Classes [hide private]
  InputConfig
Parse keyword-value input files and make the settings available in a dictionary-like fashion.
Functions [hide private]
 
custom_is_list(value, min=None, max=None)
This list validator turns single items without commas into 1-element lists.
 
custom_is_string_list(value, min=None, max=None)
Custom is_string_list() method which overrides the one in validate.py.
 
determine_jobtype(inpath)
Parse the specified file and determines its job type.
Variables [hide private]
  wspace = ' \r\n\x0b\t'
  __package__ = 'schrodinger.application'
Function Details [hide private]

custom_is_list(value, min=None, max=None)

 

This list validator turns single items without commas into 1-element lists. The default list validator requires a trailing comma for these.

That is, with this function as the list validator and a list spec, an input line of "indices = 1" will create a value of [1] for the key 'indices'.

custom_is_string_list(value, min=None, max=None)

 

Custom is_string_list() method which overrides the one in validate.py. This method does not raise an exception if a string is passed, and instead tries to break it into a list of strings.

determine_jobtype(inpath)

 

Parse the specified file and determines its job type.

This is needed in order to avoid parsing of an input file if its job type is invalid.

Return the job type as a string, or the empty string if no JOBTYPE keyword is found.