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, jobname=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.
 
getJaguarNonDefault(self)
Return a dictionary of all non-default Jaguar keys except 'multip' and 'molchg', which must be retrieved explicitly.
 
_addAutoTSJaguarDefaults(self, keywords_set)
Add a few defaults for Jaguar that are specific to AutoTS.
 
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, clean_st=False)
Return list of reactants.
 
getProducts(self, fileonly=False, clean_st=False)
Return list of products.
 
getReactantComplex(self, fileonly=False, clean_st=False)
Return Reactant Complex.
 
getProductComplex(self, fileonly=False, clean_st=False)
Return Product Complex.
 
getReferenceReactantComplex(self, fileonly=False, clean_st=False)
Return Reference Reactant Complex.
 
getReferenceProductComplex(self, fileonly=False, clean_st=False)
Return Reference 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.
 
setJobname(self, jobname)
Set the attribute jobname.
 
read(self, inputfile)
Read an existing Reactiq input file.
 
remove_input_file_paths(self)
Remove full paths from file specifications.
 
update_input_file_paths(self)
Update full paths for file specifications to reflect the CWD.
 
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
  values
Support access to ReactiqKeyword values via attribute syntax.

Inherited from object: __class__

Method Details [hide private]

__init__(self, inputfile=None, keywords=None, jaguar_keywords=None, jobname=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
  • jaguar_keywords (dict) - Jaguar &gen section keyword/value pairs
  • jobname (string) - Name of job, if it is not None it will be set to the basename of the input file name.
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

_addAutoTSJaguarDefaults(self, keywords_set)

 

Add a few defaults for Jaguar that are specific to AutoTS.

Parameters:
  • keywords_set (list) - List of jaguar keywords that have already been set. No specialized non-defaults will be set for any of these keywords.

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, clean_st=False)

 

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

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

getProducts(self, fileonly=False, clean_st=False)

 

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

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

getReactantComplex(self, fileonly=False, clean_st=False)

 

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

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

getProductComplex(self, fileonly=False, clean_st=False)

 

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

Parameters:
  • fileonly (bool) - if True, return only file paths, else Structures.
  • clean_st (bool) - if True redefine bonding using mmlewis.
Returns:
Product Complex Structures or file path.

getReferenceReactantComplex(self, fileonly=False, clean_st=False)

 

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

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

getReferenceProductComplex(self, fileonly=False, clean_st=False)

 

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

Parameters:
  • fileonly (bool) - if True, return only file paths, else Structures.
  • clean_st (bool) - if True redefine bonding using mmlewis.
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

setJobname(self, jobname)

 

Set the attribute jobname.

Parameters:
  • jobname (string) - input name of job. If jobname is None we try to use self._inputfile. If that is also None we assign a unique name.

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. A new input file is no longer written, if that is desired the user must call the save method.

update_input_file_paths(self)

 

Update full paths for file specifications to reflect the CWD. This is useful if running this job in a subdirectory or on a remote host.

_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)

values


Support access to ReactiqKeyword values via attribute syntax.
e.g.
    ri = ReactiqInput()
    print ri.values.optimize   # print 'optimize' keyword value

Get Method:
unreachable.values(self) - Support access to ReactiqKeyword values via attribute syntax.