Package schrodinger :: Package application :: Package jaguar :: Module reactiq_input :: Class ReactiqInput
[hide private]
[frames] | no frames]

Class ReactiqInput

object --+
         |
        ReactiqInput


A class to completely specify a Reactiq calculation.

Example usage:

input = ReactiqInput()
# Set user-defined values
input.setValue('integerKW', 3)
input.setValue('floatKW', '7.0')
input.setValue('stringKW', 'foo')

# Print all keyword/value pairs.
for keyword in input:
    print "keyword '%s' has value %s" % (keyword, input[keyword])

# Handling the case of trying to set an unsupported keyword
try:
    input['mykeyword'] = 'value'
except ReactiqKeywordException as e:
    print e.allowed_keywords

Instance Methods [hide private]
 
__init__(self, inputfile=None, keywords=None, jaguar_keywords=None)
Create a ReactiqInput instance.
 
__iter__(self)
Provide convenient way to iterate over the keywords.
 
getValue(self, key)
Return the value for Reactiq keyword 'key'.
 
setValue(self, key, value)
Set the Reactiq keyword 'key' to value 'value'.
 
__getitem__(self, key)
Return the value for Reactiq keyword 'key'.
 
__setitem__(self, key, value)
Set the Reactiq keyword 'key' to value 'value'.
 
setValues(self, keywords)
Set multiple Reactiq keywords.
 
getJaguarValue(self, key)
Return the value for Jaguar keyword 'key'.
 
setJaguarValue(self, key, value)
Set the Jaguar &gen section keyword 'key' to value 'value'.
 
setJaguarValues(self, keywords)
Set multiple Jaguar &gen section keywords.
 
resetKey(self, key)
Reset keyword to default state.
 
resetAll(self)
Reset all keywords to their default states.
 
getDefault(self, key)
Return the default value for Reactiq keyword 'key'.
 
getNonDefaultKeys(self)
Return a dictionary of all non-default-value ReactiqKeyword instances indexed by name.
 
getNonDefaultJaguarKeys(self)
Return a dictionary of all non-default-value Jaguar keywords
 
isNonDefault(self, key)
Has the specified key been set to a non-default value?
 
getReactants(self, fileonly=False)
Return list of reactants.
 
getProducts(self, fileonly=False)
Return list of products.
 
getReactantComplex(self, fileonly=False)
Return Reactant Complex.
 
getProductComplex(self, fileonly=False)
Return Product Complex.
 
validate(self)
Perform a self-consistency check of all currently set keywords.
 
validate_structures(self)
Perform a check to ensure that matter is conserved and that charge/multiplicity are consistent with structures.
 
save(self, name)
Create a Reactiq input file called 'name' in the current working directory based on this class instance.
 
read(self, inputfile)
Read an existing Reactiq input file.
 
remove_input_file_paths(self)
Remove full paths from file specifications in the main input file.
 
get_input_files(self)
Return set of expected input files.
 
_parse_keyword_line(self, line)
Parse line of text for keyword=value and store it.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]
  keywords

Inherited from object: __class__

Method Details [hide private]

__init__(self, inputfile=None, keywords=None, jaguar_keywords=None)
(Constructor)

 

Create a ReactiqInput instance. If a keyword is specified in both 'inputfile' and 'keywords', then the values in 'keywords' will be set preferrentially. This also applies to 'jaguar_keywords'.

Parameters:
  • inputfile (str) - Path to a Reactiq input file
  • keywords (dict) - Reactiq keyword/value pairs
  • keywords (dict) - Jaguar &gen section keyword/value pairs
Overrides: object.__init__

getValue(self, key)

 

Return the value for Reactiq keyword 'key'. The return type depends on the keyword.

Parameters:
  • key (string) - name of keyword

    @raise ReactiqKeywordError if no keyword found

setValue(self, key, value)

 

Set the Reactiq keyword 'key' to value 'value'. Note that there may be type-checking and conversion by the ReactiqKeyword class.

If 'value' is None, the keyword will be reset.

Parameters:
  • key (string) - name of keyword
  • value (anytype) - value of keyword

    @raise ReactiqKeywordError if no keyword found

__getitem__(self, key)
(Indexing operator)

 

Return the value for Reactiq keyword 'key'. The return type depends on the keyword.

Parameters:
  • key (string) - name of keyword

    @raise ReactiqKeywordError if no keyword found

__setitem__(self, key, value)
(Index assignment operator)

 

Set the Reactiq keyword 'key' to value 'value'. Note that there may be type-checking and conversion by the ReactiqKeyword class.

If 'value' is None, the keyword will be reset.

Parameters:
  • key (string) - name of keyword
  • value (anytype) - value of keyword

    @raise ReactiqKeywordError if no keyword found

setValues(self, keywords)

 

Set multiple Reactiq keywords.

Parameters:
  • keywords (dict of string/anytype pairs) - keyword/value pairs

getJaguarValue(self, key)

 

Return the value for Jaguar keyword 'key'. The return type depends on the keyword.

Parameters:
  • key (string) - name of keyword

setJaguarValue(self, key, value)

 

Set the Jaguar &gen section keyword 'key' to value 'value'.

Parameters:
  • key (string) - name of keyword
  • value (anytype) - value of keyword

    @raise JaguarKeywordException if keyword is invalid

setJaguarValues(self, keywords)

 

Set multiple Jaguar &gen section keywords.

Parameters:
  • keywords (dict of string/anytype pairs) - Jaguar &gen section keyword/value pairs

resetKey(self, key)

 

Reset keyword to default state.

Parameters:
  • key (string) - name of keyword

getDefault(self, key)

 

Return the default value for Reactiq keyword 'key'. The return type depends on the keyword.

Parameters:
  • key (string) - name of keyword

    @raise ReactiqKeywordError if no keyword found

isNonDefault(self, key)

 

Has the specified key been set to a non-default value?

Parameters:
  • key (str) - The key to check
Returns:
True if the specified key is set to a non-default value. False otherwise.

getReactants(self, fileonly=False)

 

Return list of reactants. If no file(s) found, return empty list.

Parameters:
  • fileonly (bool) - if True, return only file paths, else Structures.
Returns:
reactant Structures or file paths.

getProducts(self, fileonly=False)

 

Return list of products. If no file(s) found, return empty list.

Parameters:
  • fileonly (bool) - if True, return only file paths, else Structures.
Returns:
product Structures or file paths.

getReactantComplex(self, fileonly=False)

 

Return Reactant Complex. If no file found, return NoneType.

Parameters:
  • fileonly (bool) - if True, return only file paths, else Structures.
Returns:
Reactant Complex Structures or file path.

getProductComplex(self, fileonly=False)

 

Return Product Complex. If no file found, return NoneType.

Returns:
Product Complex Structures or file path.

validate(self)

 

Perform a self-consistency check of all currently set keywords.

@raise ReactiqKeywordConflictError if conflicting values found @raise ReactiqConservationError if matter not conserved

validate_structures(self)

 

Perform a check to ensure that matter is conserved and that charge/multiplicity are consistent with structures.

A ReactiqConservationError is raised if any test fails.

save(self, name)

 

Create a Reactiq input file called 'name' in the current working directory based on this class instance. Only write the non-default keyword values.

Parameters:
  • name (str) - Path to a Reactiq input file

read(self, inputfile)

 

Read an existing Reactiq input file.
Any keywords specified in the input file will override
existing values in this ReactiqInput instance.

Jaguar &gen section keywords are defined like:
    &JaguarKeywords
      key=val
      key=val
      ...
    &

@type  inputfile: str
@param inputfile: Path to a Reactiq input file

remove_input_file_paths(self)

 

Remove full paths from file specifications in the main input file. The internal state of this class is updated and a new input file is written in the CWD (over-writing the old one if present).

Useful to clean up the input file when all the files are in the CWD.

_parse_keyword_line(self, line)

 

Parse line of text for keyword=value and store it. Ignore comment lines starting with #

Parameters:
  • line (str) - line from input file

    @raise ReactiqKeywordFormatError if line can't be parsed.

    @return (key, value) or (None, None) if empty line.


Property Details [hide private]

keywords

Get Method:
unreachable.keywords(self)