Package schrodinger :: Package application :: Package matsci :: Package rxn_channel :: Module rxn_channel :: Class ChannelDefinitions
[hide private]
[frames] | no frames]

Class ChannelDefinitions

object --+
         |
        ChannelDefinitions

Manage a collection of reaction channel definitions.

Instance Methods [hide private]
 
__init__(self, logger=None)
Create an instance.
bool
addDefinition(self, str_definition)
Add a reaction channel definition to the list of definitions.
 
addDefinitionsFromFile(self, channels_file)
Add reaction channel definitions from an input file to the list of definitions.
str
buildChannelStrDef(self, atom_a_one, atom_b_one, atom_a_two=None, atom_b_two=None)
Build the string representation of a reaction channel from a sequence of integers.
list of strs
getDissociationChannels(self, reactants, no_reactive_h)
Return a list of all dissociation channel string definitions for the given reactant structures.
list of strs
getAssociationChannels(self, reactants)
Return a list of all association channel string definitions for the given reactant structures.
list of strs
getSingleDisplacementChannels(self, reactants, no_reactive_h, unique)
Return a list of all single displacement channel string definitions for the given reactant structures.
list of strs
getDoubleDisplacementChannels(self, reactants, no_reactive_h, unique)
Return a list of all double displacement channel string definitions for the given reactant structures.
list of strs, dict
getAllChannels(self, reactants, random_types, no_reactive_h, unique)
Return a list of all channel string definitions for the given reactant structures.
 
printAllChannels(self, types_to_sizes_dict)
For each type of sampled channel log the total number of such channels.
 
addRandomChannelsFromAll(self, num_random_channels, random_seed, all_channel_defs)
Add the specified number of random channels to the list of channels to be computed by picking a random sample of the size given from the list of all possible channels.
 
addRandomChannelsOnTheFly(self, reactants, num_random_channels, random_types, no_reactive_h, unique)
Generate the specified number of random reaction channels without ever precomputing the list of all possible channels.
 
addRandomChannels(self, reactants, num_random_channels=Constants.NUM_RANDOM_CHANNELS, random_types=Constants.DEFAULT_RANDOM_TYPES, random_seed=Constants.RANDOM_SEED, allow_adsorption_onto=Constants.ALLOW_ADSORPTION_ONTO.values(), no_reactive_h=Constants.NO_REACTIVE_H, unique=Constants.UNIQUE)
Generate the specified number of random reaction channels.

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

Class Variables [hide private]
  BLANK_PATTERN = re.compile('\s*\n$')
  RANDOM_ALL_TO_ON_THE_FLY_THRESH = 50
  MAX_NUM_UNPRODUCTIVE_CYCLES = 1000
  DESCRIPTOR_DICT = {Constants.DISSOCIATION_TYPE: 'Dissociation:...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, logger=None)
(Constructor)

 

Create an instance.

Parameters:
  • logger (logging.getLogger) - output logger
Overrides: object.__init__

addDefinition(self, str_definition)

 

Add a reaction channel definition to the list of definitions.

Parameters:
  • str_definition (str) - the string representation of the definition
Returns: bool
not_accepted, False for an accepted definition, True for a definition that was not accepted

addDefinitionsFromFile(self, channels_file)

 

Add reaction channel definitions from an input file to the list of definitions.

Parameters:
  • channels_file (str) - input file containing the definitions of the reaction channels

buildChannelStrDef(self, atom_a_one, atom_b_one, atom_a_two=None, atom_b_two=None)

 

Build the string representation of a reaction channel from a sequence of integers.

Parameters:
  • atom_a_one (int) - the first atom of the first part of the definition
  • atom_b_one (int) - the first atom of the second part of the definition
  • atom_a_two (int) - the second atom of the first part of the definition
  • atom_b_two (int) - the second atom of the second part of the definition
Returns: str
str_def, the string representation of the provided reaction channel

getDissociationChannels(self, reactants, no_reactive_h)

 

Return a list of all dissociation channel string definitions for the given reactant structures.

Parameters:
  • reactants (schrodinger.structure.Structure) - the reactants from which channels will be enumerated
  • no_reactive_h (bool) - specify that R-H bonds be considered inert
Returns: list of strs
dissociation_defs, all dissociation channels for the given reactants

getAssociationChannels(self, reactants)

 

Return a list of all association channel string definitions for the given reactant structures.

Parameters:
  • reactants (schrodinger.structure.Structure) - the reactants from which channels will be enumerated
Returns: list of strs
association_defs, all association channels for the given reactants

getSingleDisplacementChannels(self, reactants, no_reactive_h, unique)

 

Return a list of all single displacement channel string definitions for the given reactant structures.

Parameters:
  • reactants (schrodinger.structure.Structure) - the reactants from which channels will be enumerated
  • no_reactive_h (bool) - specify that R-H bonds be considered inert
  • unique (bool) - provide only unique products
Returns: list of strs
single_displacement_defs, all single displacement channels for the given reactants

getDoubleDisplacementChannels(self, reactants, no_reactive_h, unique)

 

Return a list of all double displacement channel string definitions for the given reactant structures.

Parameters:
  • reactants (schrodinger.structure.Structure) - the reactants from which channels will be enumerated
  • no_reactive_h (bool) - specify that R-H bonds be considered inert
  • unique (bool) - provide only unique products
Returns: list of strs
double_displacement_defs, all double displacement channels for the given reactants

getAllChannels(self, reactants, random_types, no_reactive_h, unique)

 

Return a list of all channel string definitions for the given reactant structures.

Parameters:
  • reactants (schrodinger.structure.Structure) - the reactants from which channels will be enumerated
  • random_types (list) - list of strings specifying which types of channels should be sampled when generating the random reaction channels
  • no_reactive_h (bool) - specify that R-H bonds be considered inert
  • unique (bool) - provide only unique products
Returns: list of strs, dict
channel_defs_to_sample, all possible channel definitions, types_to_sizes_dict, keys are types, values are the number of channels of that type

printAllChannels(self, types_to_sizes_dict)

 

For each type of sampled channel log the total number of such channels.

Parameters:
  • types_to_sizes_dict (dict) - keys are types of channels, values are the number of such channels

addRandomChannelsFromAll(self, num_random_channels, random_seed, all_channel_defs)

 

Add the specified number of random channels to the list of channels to be computed by picking a random sample of the size given from the list of all possible channels. If the number of random channels is 'all' or greater than or equal to the number of possible channels then pick all of them in order.

Parameters:
  • num_random_channels (int or str 'all') - the desired number of random channels to generate
  • random_seed (None or int) - the seed for the random number generator
  • all_channel_defs (list of strs) - the string definitions of all possible reaction channels

addRandomChannelsOnTheFly(self, reactants, num_random_channels, random_types, no_reactive_h, unique)

 

Generate the specified number of random reaction channels without ever precomputing the list of all possible channels.

Parameters:
  • reactants (schrodinger.structure.Structure) - the reactants from which channels will be enumerated
  • num_random_channels (int) - the desired number of random channels to generate
  • random_types (list) - list of strings specifying which types of channels should be sampled when generating the random reaction channels
  • no_reactive_h (bool) - specify that R-H bonds be considered inert
  • unique (bool) - provide only unique products

addRandomChannels(self, reactants, num_random_channels=Constants.NUM_RANDOM_CHANNELS, random_types=Constants.DEFAULT_RANDOM_TYPES, random_seed=Constants.RANDOM_SEED, allow_adsorption_onto=Constants.ALLOW_ADSORPTION_ONTO.values(), no_reactive_h=Constants.NO_REACTIVE_H, unique=Constants.UNIQUE)

 

Generate the specified number of random reaction channels.

Parameters:
  • reactants (schrodinger.structure.Structure) - the reactants from which channels will be enumerated
  • num_random_channels (int or str) - the desired number of random channels to generate or 'all'
  • random_types (list) - list of strings specifying which types of channels should be sampled when generating the random reaction channels
  • random_seed (None or int) - the seed for the random number generator
  • allow_adsorption_onto (list) - SMARTS patterns of arbitrary adsorption sites to support
  • no_reactive_h (bool) - specify that R-H bonds be considered inert
  • unique (bool) - provide only unique products

Class Variable Details [hide private]

DESCRIPTOR_DICT

Value:
{Constants.DISSOCIATION_TYPE: 'Dissociation: ', Constants.ASSOCIATION_\
TYPE: 'Association: ', Constants.SINGLE_DISPLACEMENT_TYPE: 'Single Dis\
placement: ', Constants.DOUBLE_DISPLACEMENT_TYPE: 'Double Displacement\
: '}