Package schrodinger :: Package application :: Package ligprep :: Module ionizer :: Class Ionizer
[hide private]
[frames] | no frames]

Class Ionizer

object --+
         |
        Ionizer

Class for ionizing structures (part of LigPrep).

To ionize a structure, do:

i = Ionizer() out_sts = i.ionizeStructure(st)

These options can be adjusted after instantiating the class:

Instance Methods [hide private]
 
__init__(self, loglevel=0, specfile=None, ph=None, ph_thresh=None, pk_thresh=None)
x.__init__(...) initializes x; see help(type(x)) for signature
 
__del__(self)
 
initializeMmlibs(self)
Initialize the mmlibs libraries.
 
readFragmentLibrary(self, flib_name)
Read the ionized frag library and populate self.frags dictionary.
 
readSpecFile(self)
Put cwd and $HOME/.schrodinger/mmshare at the front of the mmfile search path, to allow user "ionizer.ini" in either of those dirs to override installed data file in the mmshare data dir.
Spec
ionizeCommandParser(self, linenum, cmd, subs_patt, frag_name, pka)
Validate mmsubs pattern spec; if all goes well, will store compiled pattern matcher below
 
excludeCommandParser(self, linenum, subs_patt)
Validate an "exclude" mmsubs pattern spec.
 
_treatStructure(self, st)
This method generates the ionization states for the specified structure, and appends them to the self.output_structures list.
 
collectIonCandidates(self, st)
Check CT for matches to Acid/Base/Exclude patterns, in same order as supplied in control spec file; for non-Excluded, final Acid/Base matches, store specs in hash indexed on ion center atom number; also get ordered list of candidate atom numbers.
 
_expandCT(self, st, input_ct_chargef_tot, ion_cand_atoms, ion_candidates)
Basically a continuation of _treatStructure().
 
generateStateCT(self, st, total_charge, state_num, state_fuse_atoms, ion_candidates, ycost_total, zcost_total)
Generate the CT for the specificed ionization state.
 
fuseIonFragment(self, output_st, fuse_atom_orig, pre_fuse_center, renumbered_fuse_atoms, cand)
This function coordinates the ionization of one ionizable group, via mmbuild_fuse() of the appropriate ionizing fragment onto the group's ionization center atom (same method as Maestro builder uses for Place onto non-terminal atom); function also takes care of various property adjustments in the modified CT.
 
saveIonCenterProps(self, st, center_anum)
Save certain properties of an ion center atom before the ionizing fuse.
 
restoreIonCenterProps(self, st, iatom)
Restores the atom properties saved by the method above.
 
reviseIonizedGroup(self, st, center_atom)
Function to apply above reset function to all atoms of newly ionized group.
 
addIonProperties(self, st, state_num, total_charge, center_atoms_string, center_types_string, center_atoms_orig_string)
This function writes CT-level properties recording several details of a particular ionization state; it's intended to be used on CTs generated for output; the values expressed in the properties must be calculated beforehand; all of these properties get marked as dependent on CONNECTIVITY.
 
addCostProperties(self, st, ycost_total, zcost_total)
For use in pH mode only, this function adds CT-level properties recording the free energy costs associated with this particular ionization state.
List of structures.
ionizeStructure(self, st)
This is the public interface method.

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

Instance Variables [hide private]
  keep_props
Whether to keep any structure-based properties from the input CT in the output CTs.
  logger
Logger instance.
  max_abstotq
Maximum absolute value of total charge.
  max_groups
Maximum ionizational groups to handle (up to MAX_GROUPS_MAX).
  max_ions
Maximum number of ionizations.
  max_outcts
Maximum output CTs per input CT.
  retain
Whether to retain the input structure in the output.
  retain_lab
Retain the input structure that has "i_lp_orig_ion_str" property set.
  retitle_with
Prefix for adding ion state numbers to output CT titles.
  show_final_list
Report final ionization candidate list to logger.
  show_match_atoms
Whether to report substructure pattern matches to the logger (log file).
  show_skips
Whether to show skipped state generations.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, loglevel=0, specfile=None, ph=None, ph_thresh=None, pk_thresh=None)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • logleve - Reporting log level. Use 0 for quietest (default); use 1 to log state generations; use 2 to log ion frag fusions also.
  • specfile (str or None) - Path to the non-standard patterns spec file to use.
  • ph (float or None) - Effective pH of active site. Does not apply to pK-only mode.
  • ph_thresh (float or None) - De-protonated |pKa-pH| difference limit. Does not apply to pK-only mode.
  • pk_thresh (float or None) - Strong/weak pK threshold (no default). Overrides pH-based rejection mode and activates pK-only mode. Reject on pKa values only (no pH).
  • loglevel (int)
Overrides: object.__init__

readFragmentLibrary(self, flib_name)

 

Read the ionized frag library and populate self.frags dictionary.

The ionized frag lib contains a fairly small number of fragments, all or most of which will be fused in a typical run; therefore we just collect information on all of them now.

readSpecFile(self)

 

Put cwd and $HOME/.schrodinger/mmshare at the front of the mmfile search path, to allow user "ionizer.ini" in either of those dirs to override installed data file in the mmshare data dir.

Note: We wait as late as possible to do this, to prevent any similar override of the mmfrag data files, which we currently consider to be inviolate, that is, the user must not be allowed to override them, even accidentally.

ionizeCommandParser(self, linenum, cmd, subs_patt, frag_name, pka)

 

Validate mmsubs pattern spec; if all goes well, will store compiled pattern matcher below

Parses both Acid and Base specs.

Parameters:
  • linenum (int) - Line number that is being parsed
  • cmd (str) - Spec command that is being parsed. Either "acid" or "base".
  • subs_patt (str) - Substructure pattern for this specification.
  • frag_name (str) - Name of the fragment to use (from the "ionized" fragment library).
  • pka (str) - String representation of the pKa for this ionizable group.
Returns: Spec
The Spec instance representing this ionizable group.

excludeCommandParser(self, linenum, subs_patt)

 

Validate an "exclude" mmsubs pattern spec.

Parameters:
  • linenum (int) - Line number that is being parsed
  • subs_patt (str) - Substructure pattern for this specification.

_treatStructure(self, st)

 

This method generates the ionization states for the specified structure, and appends them to the self.output_structures list.

Parameters:
Raises:

generateStateCT(self, st, total_charge, state_num, state_fuse_atoms, ion_candidates, ycost_total, zcost_total)

 

Generate the CT for the specificed ionization state.

Parameters:
  • st (structure.Structure) - Input structure.
  • total_charge (int) - Total charge of this ionization state.
  • state_num (int) - The number of this state (0-indexed)
  • state_fuse_atoms (list of ints) - List of atoms to which the new fragment will be attached to.
  • ion_candidates (dict; key: atom index; value: Spec) - Specifications for this state change.
  • ycost_total (float) - Charging ionization penalty for this state
  • zcost_total (float) - Neutral ionization penalty for this state

restoreIonCenterProps(self, st, iatom)

 

Restores the atom properties saved by the method above. Also sets the default display color property based on the atom's new (i.e., post-fuse) atom type. Pass in post-fuse atom number (new ionized group center or bonded H).

reviseIonizedGroup(self, st, center_atom)

 

Function to apply above reset function to all atoms of newly ionized group. Pass in post-fuse ionized group center atom number Collect list of newly ionized group's atoms (new ionized center + all Hydrogens bonded to it); revise certain atom properties to match original ion center

ionizeStructure(self, st)

 

This is the public interface method. The specified CT will be ionized, and the output structures will be returned as a list.

Parameters:
Returns: List of structures.
Returns a list of ionized output structures.
Raises:

Instance Variable Details [hide private]

logger

Logger instance. When processing CTs, any info, warning, and error messages will be redirected here.

show_skips

Whether to show skipped state generations. Applies only to log levels 1 and up.