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

Module genetic_optimization

Classes [hide private]
  Property
Manage a property to be used in a genetic optimization.
  StructureGenome
Manage a genome.
  Skip
Manage a skip.
  Failure
Manage a failure.
  CheckInput
Manage checking user input.
  GeneticOptimization
Manage the genetic optimization.
Functions [hide private]
 
set_title_to_stoichiometry(astructure, toappend=None, separation=STOICH_BASE_EXT_SEP)
Set the structure title to be the stoichiometry of the structure.
 
from_initial_population(genome, **args)
Draw a unique genome from the initial population.
int
get_num_simple_bonds(astructure)
Return the number of simple bonds in the provided structure.
schrodinger.structure.Structure
combine_two_structures(astructure, bstructure, offset=10.0)
Combine two structure objects into a single structure object using somewhat arbitrary placement.
tuple
bond_crossover(genome, **args)
Perform a crossover operation by swapping molecular fragments at two randomly choosen bonds, i.e.
dict
get_element_mutator_dict(astructure)
Return a dictionary where the keys contain the indicies of the mutatable atoms and the values contain those elements that the keyed atom may be mutated to.
list
get_isoelectronic_mutator_indicies(astructure)
Return a list of atom indicies that can be mutated by the isoelectronic mutator.
schrodinger.structure.Structure
get_child_like_parent(parent_st, children_sts, definition)
Return the child structure that is most like the provided parent.
int
elemental_mutator(genome, **args)
Perform a random elemental mutation to an element in the same column (as known as group) of the periodic table.
int
fragment_mutator(genome, **args)
Randomly mutate the genome by swapping a molecular fragement on one side of a bond by a similar fragment from a library.
int
isoelectronic_mutator(genome, **args)
Perform a random isoelectronic mutation from the following sets of series CH3X, NH2X, OHX, and FX, CH2XY, NHXY, OXY, and CHXYZ and NXYZ, where X, Y, and Z are non-H-bonds.
str
get_loggable_float(afloat, num_decimal=NUM_DECIMAL, field_width=FIELD_WIDTH)
Return a float as a string with the specified format.
 
uniquify_titles_callback(ga_obj)
Callback to uniquify titles of the individuals.
 
prepare_next_generation_dirs_callback(ga_obj)
Callback to update the generation property of the genomes and to create a subdirectory to hold the next series of evaluations.
 
manage_skips_callback(ga_obj)
Callback to manage skips in the evaluation.
 
manage_failures_callback(ga_obj)
Callback to manage failures in the evaluation.
 
logging_summary_callback(ga_obj)
Callback to log progress.
 
molecule_history_callback(ga_obj)
Callback to append all structures from all generations to individual log files.
bool
first_property(ga_obj)
Terminate when the first property has been matched.
bool
all_properties(ga_obj)
Terminate when all properties have been matched.
bool
unproductive(ga_obj)
Terminate if the maximum number of unproductive generations has been reached.
 
print_bad_jobs(all_bad_jobs, logger, bad_type='skip')
Log bad jobs, i.e.
str
get_output_file_name(basename)
Get the output file name from the basename.
str
get_generation_log_file_name(basename, generation)
Get the generation log file name.
function
thread_safe_evaluator(evaluator)
Decorator to make evaluator functions thread-safe, i.e.
float
get_structure_score(astructure, properties, conformational_search)
Return the structure score for the provided structure.
float
structure_evaluator(genome)
This is the structure evaulator.
float
base_evaluator(genome)
This is the base evaulator used to wrap all other evaluators.
launcher.Launcher
optoelectronics_evaluator(genome)
Run an optoelectronics job.
list
apply_uniform_operator_weights(operators)
Set the operator weights uniformly.
bool
structure_is_open_shell(astructure, ignore_charge=True)
Return True if the provided structure is open shell, i.e.
dict
get_element_histogram(astructure)
Return a dictionary where keys are elements and values are the numbers of atoms of a given element.
str
remove_basename_ext(stoich_ext)
Remove the basename extension from the given string and return the remainder which is the stoichiometry.
list of schrodinger.structure.Structure, int
get_low_energy_conformers(astructure_in, macromodel_options_file=None, remove_files=False, overwrite=False, seed=None)
Return the lowest energy conformers from a Macromodel conformational search.
schrodinger.structure.Structure or None
get_random_structure(structure_libs, tries_from_libs=TRIES_FROM_LIBS, structure_score_threshold=None, properties=None, conformational_search=CONFORMATIONAL_SEARCH)
From the given dictionary of libraries return a random structure.
schrodinger.structure.Structure or None
get_freezer_structure(structure_libs, tries_from_libs=TRIES_FROM_LIBS, structure_score_threshold=None, properties=None, conformational_search=CONFORMATIONAL_SEARCH, inoculate=NO_CHILD, crossover_applied=None, mutation_applied=None, basename_ext=None)
Return a random structure from the freezer and update that structure's properties.
Variables [hide private]
  __doc__ = ...
  _version = '$Revision 0.0 $'
  PYEVOLVE_LOG_EXT = '-pyevolve.log'
  IN_MAE_EXT = '-in.mae'
  OUT_MAE_EXT = '-out.mae'
  BOND_CROSSOVER = 'bond'
  CROSSOVER_CHOICES = [BOND_CROSSOVER]
  DEFAULT_CROSSOVERS = [BOND_CROSSOVER]
  ELEMENTAL_MUTATOR = 'elemental'
  FRAGMENT_MUTATOR = 'fragment'
  ISOELECTRONIC_MUTATOR = 'isoelectronic'
  MUTATOR_CHOICES = [ELEMENTAL_MUTATOR, FRAGMENT_MUTATOR, ISOELE...
  DEFAULT_MUTATORS = [FRAGMENT_MUTATOR, ISOELECTRONIC_MUTATOR]
  GENERATIONS = 10
  POPULATION = 8
  CROSSOVER_RATE = 90.0
  MUTATION_RATE = 90.0
  RANK_SELECTION = 'rank'
  ROULETTE_WHEEL_SELECTION = 'roulette_wheel'
  TOURNAMENT_SELECTION = 'tournament'
  TOURNAMENT_SELECTION_WITH_ROULETTE = 'tournament_with_roulette'
  UNIFORM_SELECTION = 'uniform'
  SELECTION_DICT = {RANK_SELECTION: Selectors.GRankSelector, ROU...
  SELECTION_CHOICES = [RANK_SELECTION, ROULETTE_WHEEL_SELECTION,...
  DEFAULT_SELECTION = 'roulette_wheel'
  TOURNAMENT_SIZE = 2
  UNPRODUCTIVE_TERM = 'unproductive'
  FIRST_PROPERTY_TERM = 'first_property'
  ALL_PROPERTIES_TERM = 'all_properties'
  MAX_GENERATIONS_TERM = 'max_generations'
  TERM_CHOICES = [UNPRODUCTIVE_TERM, FIRST_PROPERTY_TERM, ALL_PR...
  DEFAULT_TERMS = [UNPRODUCTIVE_TERM, ALL_PROPERTIES_TERM]
  NUM_UNPRODUCTIVE = 6
  LINEAR_SCALING = 'linear'
  POWER_LAW_SCALING = 'power_law'
  EXPONENTIAL_SCALING = 'exponential'
  SATURATED_SCALING = 'saturated'
  SIGMA_TRUNCATION_SCALING = 'sigma_truncation'
  BOLTZMANN_SCALING = 'boltzmann'
  SCALING_DICT = {LINEAR_SCALING: Scaling.LinearScaling, POWER_L...
  SCALING_CHOICES = [LINEAR_SCALING, POWER_LAW_SCALING, EXPONENT...
  DEFAULT_SCALING = 'sigma_truncation'
  ALLOWS_NEGATIVE_SCORES = [EXPONENTIAL_SCALING, SATURATED_SCALI...
  ELITISM = 1
  RANDOM_SEED = None
hash(x)
  RANDOM_INT_BOUND = 1000000
  NO_MINIMIZE = False
hash(x)
  INDIVIDUAL_KEY = 'i_matsci_individual_index'
  GENERATION_KEY = 'i_matsci_generation'
  STRUCTURE_SCORE_KEY = 'r_matsci_structure_score'
  RAW_SCORE_KEY = 'r_matsci_raw_score'
  FIT_SCORE_KEY = 'r_matsci_fit_score'
  SKIP_KEY = 'b_matsci_skipped'
  FAILURE_KEY = 'b_matsci_failed'
  LOCALHOST = 'localhost'
  TPP_GA = 1
  TPP_EVAL = 1
  TPP_STR = '-TPP'
  DEFAULT_EVAL_KWARGS = {}
  ORGANIC = 'organic'
  N_HETEROCYCLES = 'N-heterocycles'
  O_HETEROCYCLES = 'O-heterocycles'
  S_HETEROCYCLES = 'S-heterocycles'
  MIXED_HETEROCYCLES = 'Mixed-heterocycles'
  COMBIGLIDE_DEFAULT = 'combiglide_default'
  OPTOELECTRONICS = 'optoelectronics'
  ALL = 'all'
  MMSHARE_MAIN_DATA = hunt('mmshare', dir= 'data')
  FRAGMENT_LIBS = {ORGANIC: os.path.join(MMSHARE_MAIN_DATA, 'res...
  FRAGMENT_LIBS_DEFAULT = [OPTOELECTRONICS]
  ENTRY_NAME_KEY = 's_m_entry_name'
  GROW_NAME_KEY = 's_m_grow_name'
  PDB_ATOM_NAME_KEY = 's_m_pdb_atom_name'
  PDB_RES_NAME_KEY = 's_m_pdb_residue_name'
  CROSSOVER_PARENTS_KEY = 's_matsci_crossover_parents'
  CROSSOVER_APPLIED_KEY = 's_matsci_crossover_applied'
  MUTATION_PARENT_KEY = 's_matsci_mutation_parent'
  MUTATION_APPLIED_KEY = 's_matsci_mutation_applied'
  EVALUATOR_JOBS_DIR = 'evaluator_jobs'
  GENER_SUBDIR = 'generation_'
  NUM_DECIMAL = '%.2f'
  FIELD_WIDTH = 10
  INFINITE_SCORE = 1000000000
  BAD_SCORE = -10000000
  RXN_KEY = 's_matsci_RXN_representation'
  SMALL_CHILD_FREQ = 0.75
  SIMILAR_STDEV_CHILDREN_FREQ = 0.75
  FILE_BASE_NAME = 'genopt'
  NO_OPEN_SHELL = False
hash(x)
  TERM_THRESH = 0.0001
  SMARTS_PATTERN_SEPARATOR = '_'
  SMARTS_PROP = 'smarts'
  MOL_WEIGHT_PROP = 'molecular_weight'
  NATOMS_PROP = 'natoms'
  NELEMENTS_PROP = 'nelements'
  STRUCTURE_PROPERTIES = {SMARTS_PROP, MOL_WEIGHT_PROP, NATOMS_P...
  SMARTS_KEY = 'i_matsci_SMARTS_property_%s'
  MOL_WEIGHT_KEY = 'r_m_Molecular_weight'
  NATOMS_KEY = 'i_m_Number_of_atoms'
  NELEMENTS_KEY = 'i_m_Number_of_elements'
  NONE = 'none'
  ATYPICAL = 'atypical'
  ATYPICAL_PATTERNS = OrderedDict([('three-atom or longer chains...
  ATYP_MW_TARGET = 1100
  ATYP_MW_WEIGHT = 1.0
  ATYP_NAT_TARGET = 200
  ATYP_NAT_WEIGHT = 1.0
  ATYP_NEL_TARGET = 5
  ATYP_NEL_WEIGHT = 15
  ATYPICAL_PROPS = ['name=natoms target=%d comparator=lt weight=...
  DIHYDROGEN = 'dihydrogen'
  DIHYDROGEN_PATTERNS = OrderedDict([('dihydrogen molecule', '[H...
  DIHYDROGEN_PROPS = ['name=smarts patterns=%s minimax=min weigh...
  PENALIZE_PROTOCOLS = OrderedDict([(ATYPICAL, (ATYPICAL_PATTERN...
  PENALIZE_CHOICES = [NONE, ATYPICAL, DIHYDROGEN]
  PENALIZE_DEFAULT = [ATYPICAL, DIHYDROGEN]
  STRUCTURE_SCORE_THRESHOLD = -50.0
  EXTS_TO_RETURN = ['.spm']
  STOICH_BASE_EXT_SEP = '.'
  CONFORMATIONAL_SEARCH = False
hash(x)
  CONF_SEARCH_FAILED_KEY = 'b_matsci_Conf_Search_Failed'
  CONF_SEARCH_SEED_RANGE = [1, 78593]
  GENER_LOG_FILE_SEP = '-'
  REMAINDER = 'remainder'
  PREVIOUS = 'previous'
  FRAGMENT = 'fragment'
  FREEZER_CHOICES = [REMAINDER, PREVIOUS, FRAGMENT]
  FREEZERS_DEFAULT = [REMAINDER, PREVIOUS]
  FROM_FREEZER_KEY = 's_matsci_From_Freezer'
  REMAINDER_FILE_EXT = '-remainder.mae'
  NO_CHILD = 'no_child'
  BAD_STRUCTURE = 'bad_structure'
  INOCULATE_CHOICES = [NONE, NO_CHILD, BAD_STRUCTURE]
  INOCULATE_DEFAULT = [NO_CHILD, BAD_STRUCTURE]
  INOCULATE_KEY = 's_matsci_Inoculate'
  TRIES_FROM_LIBS = 3
  TRIES_FRAGMENT_MUTATOR = 3
Function Details [hide private]

set_title_to_stoichiometry(astructure, toappend=None, separation=STOICH_BASE_EXT_SEP)

 

Set the structure title to be the stoichiometry of the structure.

Parameters:
  • astructure (schrodinger.structure.Structure) - the structure
  • toappend (str) - a string to append to the stoichiometry
  • separation (str) - used to separate the stoichiometry and the toappend str

from_initial_population(genome, **args)

 

Draw a unique genome from the initial population.

Parameters:
  • genome (StructureGenome) - a genome
  • args (dict) - dictionary of genetic optimization parameters created and used by pyevolve

get_num_simple_bonds(astructure)

 

Return the number of simple bonds in the provided structure. The definition of a simple bond follows from that used in the reaction channel module and is an acyclic single order bond that may involve a hydrogen atom.

Parameters:
  • astructure (schrodinger.structure.Structure) - the structure for which to get the number of simple bonds
Returns: int
the number of simple bonds

combine_two_structures(astructure, bstructure, offset=10.0)

 

Combine two structure objects into a single structure object using somewhat arbitrary placement.

Parameters:
  • astructure (schrodinger.structure.Structure) - the first of the structures to be combined
  • bstructure (schrodinger.structure.Structure) - the second of the structures to be combined
  • offset (float) - the final distance between the structures will be the sum of the molecular VDW radii plus this offset in Angstrom
Returns: schrodinger.structure.Structure
the combined structure object

bond_crossover(genome, **args)

 

Perform a crossover operation by swapping molecular fragments at two randomly choosen bonds, i.e. a double displacement reaction channel.

Parameters:
  • genome (StructureGenome) - a genome
  • args (dict) - dictionary of genetic optimization parameters created and used by pyevolve
Returns: tuple
tuple containing the sister and brother StructureGenome

get_element_mutator_dict(astructure)

 

Return a dictionary where the keys contain the indicies of the mutatable atoms and the values contain those elements that the keyed atom may be mutated to.

Parameters:
  • astructure (schrodinger.structure.Structure) - the structure to be mutated
Returns: dict
keys are atom indicies of those atoms that are mutatable and values are those elements that the atom can be mutated to

get_isoelectronic_mutator_indicies(astructure)

 

Return a list of atom indicies that can be mutated by the isoelectronic mutator.

Parameters:
  • astructure (schrodinger.structure.Structure) - the structure to be mutated
Returns: list
mutatable indicies

get_child_like_parent(parent_st, children_sts, definition)

 

Return the child structure that is most like the provided parent.

Parameters:
  • parent_st (schrodinger.structure.Structure) - the parent structure
  • children_sts (list of schrodinger.structure.Structure) - the children structures
  • definition (two-element list) - each sublist contains two atom indicies describing the reactive bonds in parent and fragment structures which created the children
Returns: schrodinger.structure.Structure
the sought child structure

elemental_mutator(genome, **args)

 

Perform a random elemental mutation to an element in the same column (as known as group) of the periodic table. Note that hydrogen and the halogens are considered to belong to the same column.

Parameters:
  • genome (StructureGenome) - a genome
  • args (dict) - dictionary of genetic optimization parameters created and used by pyevolve
Returns: int
the number of mutations applied, appears to never be used in PyEvolve

fragment_mutator(genome, **args)

 

Randomly mutate the genome by swapping a molecular fragement on one side of a bond by a similar fragment from a library.

Parameters:
  • genome (StructureGenome) - a genome
  • args (dict) - dictionary of genetic optimization parameters created and used by pyevolve
Returns: int
the number of mutations applied, appears to never be used in PyEvolve

isoelectronic_mutator(genome, **args)

 

Perform a random isoelectronic mutation from the following sets of series CH3X, NH2X, OHX, and FX, CH2XY, NHXY, OXY, and CHXYZ and NXYZ, where X, Y, and Z are non-H-bonds.

Parameters:
  • genome (StructureGenome) - a genome
  • args (dict) - dictionary of genetic optimization parameters created and used by pyevolve
Returns: int
the number of mutations applied, appears to never be used in PyEvolve

get_loggable_float(afloat, num_decimal=NUM_DECIMAL, field_width=FIELD_WIDTH)

 

Return a float as a string with the specified format.

Parameters:
  • afloat (float) - a float to convert to a string
  • num_decimal (str) - the format of the string representation
  • field_width (int) - the field width of the final string
Returns: str
the float as a string

uniquify_titles_callback(ga_obj)

 

Callback to uniquify titles of the individuals.

Parameters:
  • ga_obj (GSimpleGA.GSimpleGA) - the entire current state of the genetic optimization

prepare_next_generation_dirs_callback(ga_obj)

 

Callback to update the generation property of the genomes and to create a subdirectory to hold the next series of evaluations.

Parameters:
  • ga_obj (GSimpleGA.GSimpleGA) - the entire current state of the genetic optimization

manage_skips_callback(ga_obj)

 

Callback to manage skips in the evaluation.

Parameters:
  • ga_obj (GSimpleGA.GSimpleGA) - the entire current state of the genetic optimization

manage_failures_callback(ga_obj)

 

Callback to manage failures in the evaluation.

Parameters:
  • ga_obj (GSimpleGA.GSimpleGA) - the entire current state of the genetic optimization

logging_summary_callback(ga_obj)

 

Callback to log progress.

Parameters:
  • ga_obj (GSimpleGA.GSimpleGA) - the entire current state of the genetic optimization

molecule_history_callback(ga_obj)

 

Callback to append all structures from all generations to individual log files.

Parameters:
  • ga_obj (GSimpleGA.GSimpleGA) - the entire current state of the genetic optimization

first_property(ga_obj)

 

Terminate when the first property has been matched.

Parameters:
  • ga_obj (GSimpleGA.GSimpleGA) - the entire current state of the genetic optimization
Returns: bool
True to terminate, False otherwise

all_properties(ga_obj)

 

Terminate when all properties have been matched.

Parameters:
  • ga_obj (GSimpleGA.GSimpleGA) - the entire current state of the genetic optimization
Returns: bool
True to terminate, False otherwise

unproductive(ga_obj)

 

Terminate if the maximum number of unproductive generations has been reached.

Parameters:
  • ga_obj (GSimpleGA.GSimpleGA) - the entire current state of the genetic optimization
Returns: bool
True to terminate, False otherwise

print_bad_jobs(all_bad_jobs, logger, bad_type='skip')

 

Log bad jobs, i.e. skips and failures.

Parameters:
  • all_bad_jobs (dict) - a collection of bad subjobs, keys are genetic optimization generation and values are a list of Skip or Failure objects for bad subjobs
  • logger (logging.Logger) - output logger
  • bad_type (str) - specifies either 'skip' or 'fail' type

get_output_file_name(basename)

 

Get the output file name from the basename.

Parameters:
  • basename (str) - base name to use
Returns: str
output_file_name, name of output file

get_generation_log_file_name(basename, generation)

 

Get the generation log file name.

Parameters:
  • basename (str) - base name to use
  • generation (int) - the generation
Returns: str
generation_log_file_name, name of generation log file

thread_safe_evaluator(evaluator)

 

Decorator to make evaluator functions thread-safe, i.e. to make using the random module safe, meaning usability and reproducibility, with the multiprocessing module.

Parameters:
  • evaluator (function) - the function to decorate
Returns: function
the decorated function

get_structure_score(astructure, properties, conformational_search)

 

Return the structure score for the provided structure.

Parameters:
  • astructure (schrodinger.structure.Structure) - the structure to score
  • properties (list of Property) - the properties used in scoring
  • conformational_search (bool or str) - specifies whether a Macromodel conformational search will be performed prior to evaluation, when a string it specifies a simplified Macromodel input file containing extra options
Returns: float
the structure score

structure_evaluator(genome)

 

This is the structure evaulator.

Parameters:
  • genome (StructureGenome) - a genome
Returns: float
the score for this individual
Decorators:
  • @thread_safe_evaluator

base_evaluator(genome)

 

This is the base evaulator used to wrap all other evaluators.

Parameters:
  • genome (StructureGenome) - a genome
Returns: float
the score for this individual
Decorators:
  • @thread_safe_evaluator

optoelectronics_evaluator(genome)

 

Run an optoelectronics job.

Parameters:
  • genome (StructureGenome) - a genome
Returns: launcher.Launcher
the script launcher object for this individual, it is run in the base evaluator

apply_uniform_operator_weights(operators)

 

Set the operator weights uniformly.

Parameters:
  • operators (list) - a list of two-element tuples, each tuple contains first an operator function and second a weight
Returns: list
list of two-element tuples of operators and uniform weights

structure_is_open_shell(astructure, ignore_charge=True)

 

Return True if the provided structure is open shell, i.e. has an odd number of electrons.

Parameters:
  • astructure (schrodinger.structure.Structure) - the structure in question
  • ignore_charge (bool) - if True then ignore any structure.formal_charge settings
Returns: bool
True if the provided structure is open shell, False otherwise

get_element_histogram(astructure)

 

Return a dictionary where keys are elements and values are the numbers of atoms of a given element.

Parameters:
  • astructure (schrodinger.structure.Structure) - the structure in question
Returns: dict
dictionary with element histogram, keys are elements (strs) and values are numbers (ints)

remove_basename_ext(stoich_ext)

 

Remove the basename extension from the given string and return the remainder which is the stoichiometry. Do this instead of having to recompute the stoichiometry which can be expensive.

Parameters:
  • stoich_ext (str) - contains the stoichiometry and basename extension
Returns: str
stoichiometry

get_low_energy_conformers(astructure_in, macromodel_options_file=None, remove_files=False, overwrite=False, seed=None)

 

Return the lowest energy conformers from a Macromodel conformational search.

Parameters:
  • astructure_in (schrodinger.structure.Structure) - the structure to search for conformations
  • macromodel_options_file (str or None) - the name of a simplified Macromodel input file that contains any options to use in addition to those used by default in a conformational search or None if there are none and you just want to use the defaults
  • remove_files (bool) - if the job is successful, specifies whether to remove all files created for it after it finishes
  • overwrite (bool) - if True then the coordinates of the input structure will be overwritten by those of the lowest energy conformer and that structure alone returned by this function
  • seed (int or None) - used to seed the random number generator used in the Macromodel conformational search, should be in CONF_SEARCH_SEED_RANGE, if None then if a CONFSEARCH_SEED has been specified in macromodel_options_file it will be used, otherwise the system time in seconds will be used
Returns: list of schrodinger.structure.Structure, int
the structures of the lowest energy conformers sorted by increasing energy and the seed used in the conformational search (same as input if input was given either as seed or in macromodel_options_file)

get_random_structure(structure_libs, tries_from_libs=TRIES_FROM_LIBS, structure_score_threshold=None, properties=None, conformational_search=CONFORMATIONAL_SEARCH)

 

From the given dictionary of libraries return a random structure.

Parameters:
  • structure_libs (dict) - keys are strings specifying the types of libraries to be used and can be module constants from FREEZER_CHOICES.keys(), values are lists of libraries by type and can be either module constants from FRAGMENT_LIBS.keys(), ALL, or the names of Maestro files (including the file extensions)
  • tries_from_libs (int) - the number of times to try before giving up
  • structure_score_threshold (float or None) - specifies that a structure with a structure score greater-than-or-equal-to this threshold is sought, the best of the considered structures will be returned and will contain several structure properties related to the scoring
  • properties (list of Property or None) - the properties used in structure scoring
  • conformational_search (bool or str) - specifies whether a Macromodel conformational search will be performed prior to evaluation, when a string it specifies a simplified Macromodel input file containing extra options
Returns: schrodinger.structure.Structure or None
the random structure or None if one couldn't be found

get_freezer_structure(structure_libs, tries_from_libs=TRIES_FROM_LIBS, structure_score_threshold=None, properties=None, conformational_search=CONFORMATIONAL_SEARCH, inoculate=NO_CHILD, crossover_applied=None, mutation_applied=None, basename_ext=None)

 

Return a random structure from the freezer and update that structure's properties.

Parameters:
  • structure_libs (dict) - keys are strings specifying the types of libraries to be used and can be module constants from FREEZER_CHOICES.keys(), values are lists of libraries by type and can be either module constants from FRAGMENT_LIBS.keys(), ALL, or the names of Maestro files (including the file extensions)
  • tries_from_libs (int) - the number of times to try before giving up
  • structure_score_threshold (float or None) - specifies that a structure with a structure score greater-than-or-equal-to this threshold is sought, the best of the considered structures will be returned and will contain several structure properties related to the scoring
  • properties (list of Property or None) - the properties used in structure scoring
  • conformational_search (bool or str) - specifies whether a Macromodel conformational search will be performed prior to evaluation, when a string it specifies a simplified Macromodel input file containing extra options
  • inoculate (str) - specify the reason for drawing from the freezer, which is an inoculate option from INOCULATE_CHOICES
  • crossover_applied (str or None) - specify the intended crossover operator or None if there isn't to be one
  • mutation_applied (str or None) - specify the intended mutation operator or None if there isn't to be one
  • basename_ext (str or None) - specify an extension to append to the stoichiometry which is used to set the title of the returned structure
Returns: schrodinger.structure.Structure or None
the random structure or None if one couldn't be found

Variables Details [hide private]

__doc__

Value:
"""
Classes and functions for the genetic optimization module.

Copyright Schrodinger, LLC.  All rights reserved."""

MUTATOR_CHOICES

Value:
[ELEMENTAL_MUTATOR, FRAGMENT_MUTATOR, ISOELECTRONIC_MUTATOR]

SELECTION_DICT

Value:
{RANK_SELECTION: Selectors.GRankSelector, ROULETTE_WHEEL_SELECTION: Se\
lectors.GRouletteWheel, TOURNAMENT_SELECTION: Selectors.GTournamentSel\
ectorAlternative, TOURNAMENT_SELECTION_WITH_ROULETTE: Selectors.GTourn\
amentSelector, UNIFORM_SELECTION: Selectors.GUniformSelector}

SELECTION_CHOICES

Value:
[RANK_SELECTION, ROULETTE_WHEEL_SELECTION, TOURNAMENT_SELECTION, TOURN\
AMENT_SELECTION_WITH_ROULETTE, UNIFORM_SELECTION]

TERM_CHOICES

Value:
[UNPRODUCTIVE_TERM, FIRST_PROPERTY_TERM, ALL_PROPERTIES_TERM, MAX_GENE\
RATIONS_TERM]

SCALING_DICT

Value:
{LINEAR_SCALING: Scaling.LinearScaling, POWER_LAW_SCALING: Scaling.Pow\
erLawScaling, EXPONENTIAL_SCALING: Scaling.ExponentialScaling, SATURAT\
ED_SCALING: Scaling.SaturatedScaling, SIGMA_TRUNCATION_SCALING: Scalin\
g.SigmaTruncScaling, BOLTZMANN_SCALING: Scaling.BoltzmannScaling}

SCALING_CHOICES

Value:
[LINEAR_SCALING, POWER_LAW_SCALING, EXPONENTIAL_SCALING, SATURATED_SCA\
LING, SIGMA_TRUNCATION_SCALING, BOLTZMANN_SCALING]

ALLOWS_NEGATIVE_SCORES

Value:
[EXPONENTIAL_SCALING, SATURATED_SCALING, SIGMA_TRUNCATION_SCALING, BOL\
TZMANN_SCALING]

FRAGMENT_LIBS

Value:
{ORGANIC: os.path.join(MMSHARE_MAIN_DATA, 'res', 'organic.bld'), N_HET\
EROCYCLES: os.path.join(MMSHARE_MAIN_DATA, 'res', 'N-heterocycles.bld'\
), O_HETEROCYCLES: os.path.join(MMSHARE_MAIN_DATA, 'res', 'O-heterocyc\
les.bld'), S_HETEROCYCLES: os.path.join(MMSHARE_MAIN_DATA, 'res', 'S-h\
eterocycles.bld'), MIXED_HETEROCYCLES: os.path.join(MMSHARE_MAIN_DATA,\
 'res', 'Mixed-heterocycles.bld'), COMBIGLIDE_DEFAULT: os.path.join(MM\
SHARE_MAIN_DATA, 'cg', 'interactive_palettes', 'default_palette.mae'),\
 OPTOELECTRONICS: os.path.join(MMSHARE_MAIN_DATA, 'genetic_optimizatio\
...

STRUCTURE_PROPERTIES

Value:
{SMARTS_PROP, MOL_WEIGHT_PROP, NATOMS_PROP, NELEMENTS_PROP}

ATYPICAL_PATTERNS

Value:
OrderedDict([('three-atom or longer chains containing N, O, P, and S',\
 '[$([#7,#8,#15,#16][#7,#8,#15,#16][#7,#8,#15,#16])]'), ('two or more \
different halogens', 'F.Cl_F.Br_F.I_Cl.Br_Cl.I_Br.I')])

ATYPICAL_PROPS

Value:
['name=natoms target=%d comparator=lt weight=%.1f' %(ATYP_NAT_TARGET, \
ATYP_NAT_WEIGHT), 'name=molecular_weight target=%d comparator=lt weigh\
t=%.1f' %(ATYP_MW_TARGET, ATYP_MW_WEIGHT), 'name=nelements target=%d c\
omparator=lt weight=%.1f' %(ATYP_NEL_TARGET, ATYP_NEL_WEIGHT), 'name=s\
marts patterns=%s minimax=min weight=15.0' % '_'.join(ATYPICAL_PATTERN\
S.values())]

DIHYDROGEN_PATTERNS

Value:
OrderedDict([('dihydrogen molecule', '[H][H]')])

DIHYDROGEN_PROPS

Value:
['name=smarts patterns=%s minimax=min weight=100.0' % '_'.join(DIHYDRO\
GEN_PATTERNS.values())]

PENALIZE_PROTOCOLS

Value:
OrderedDict([(ATYPICAL, (ATYPICAL_PATTERNS, ATYPICAL_PROPS)), (DIHYDRO\
GEN, (DIHYDROGEN_PATTERNS, DIHYDROGEN_PROPS))])