Functions for initializing, reading, and writing Desmond 
  parameters.
  This is also where global variables that are shared among different 
  tabs are defined.
  Copyright Schrodinger, LLC. All rights reserved.
    |  | 
        
          | _is_equal(a,
        b,
        epsilon=1e-06) Compares two floating numbers and returns True if the absolute 
      difference is within epsilon (defaults to 1E-6), False if not.
 |  |  | 
    |  | 
        
          | _boolean(s) Returns 1 if the string 's' is one of the following: 'true', 'yes', 
      'on', '1', 't', 'y'.
 |  |  | 
    |  |  | 
    |  | 
        
          | _update_key_with_file(key,
        fname,
        raise_exception) |  |  | 
    |  | 
        
          | _parent_dir(dir_name,
        up=1) Returns the parent directory name.
 |  |  | 
    |  | 
        
          | gen_key(file=None,
        raise_exception=False) Returns a Key object that is constructed based on 
      'DEFAULT_CONFIG' (see above) and the default config file that is 
      saved in the directory as given by 'DEFAULT_CONFIG_FILE' (see above).
 |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  |  | 
    |  | 
        
          | is_powerof2(x) Returns True if 'x' is a power of 2, or False otherwise.
 |  |  | 
    |  | 
        
          | _xchk_power2(key,
        val,
        prefix,
        ev) |  |  | 
    |  | 
        
          | _xchk_file_exists(key,
        val,
        prefix,
        ev) |  |  | 
    |  | 
        
          | _xchk_dir_exists(key,
        val,
        prefix,
        ev) |  |  | 
    |  |  | 
    |  |  | 
    |  | 
        
          | _match(check_func,
        key,
        valid,
        ev,
        prefix) |  |  | 
    |  | 
        
          | _check_atom(key,
        valid,
        ev,
        prefix) |  |  | 
    |  | 
        
          | _check_list(key,
        valid,
        ev,
        prefix) |  |  | 
    |  | 
        
          | check_key(key,
        valid=Key(__CONFIG_VALIDATION),
        ev=None,
        prefix= '') |  |  | 
    |  |  | 
    |  | 
        
          | extract_cfg(cpt_fname,
        min_size=1048576) Extracts the extended ark content from a checkpoint file.
 |  |  | 
    |  | 
        
          | has_plugin(key,
        plugin_name) |  |  | 
    |  | 
        
          | add_plugin(key,
        plugin_name,
        position=None) |  |  | 
    |  | 
        
          | remove_plugin(key,
        plugin_name) |  |  | 
    |  | 
        
          | has_mmffio(ct) Returns 1 if 'ct' has an mmffio block, or 0 if it does not.
 |  |  | 
    |  | 
        
          | has_fepio(struc) Returns True if any of the Structures in 'struc' have a fepio_fep 
      block, or False if they do not.
 |  |  | 
    |  |  | 
    |  | 
        
          | prep_struc(struc) This function does the following mutations to each element of 
      'struc':
 |  |  | 
    |  | 
        
          | clean_struc(struc) For each 'Structure' ojbect in 'struct', this function removes the 
      '_ffh' attribute of the member object and frees the memory as held by
      '_ffh'.
 |  |  | 
    |  | 
        
          | get_box(struc) Given a list of CTs, return None if something is wrong, or a tuple of
      (size_x, size_y, size_z, (9-element list for box matrix)).
 |  |  | 
    |  | 
        
          | dotprod(v,
        u) Returns the dot product of two 3-D vectors.
 |  |  | 
    |  | 
        
          | crossprod(v,
        u) Returns the cross product of two 3-D vectors.
 |  |  | 
    |  | 
        
          | norm(v) Returns the norm of the 3-D vector 'v'.
 |  |  | 
    |  | 
        
          | get_boxsize(box) Given a simulation box in the form of a 3x3 matrix, this function 
      returns the size of the box.
 |  |  | 
    |  |  | 
    |  | 
        
          | get_homebox(box,
        cpu_top) |  |  | 
    |  |  | 
    |  | 
        
          | get_clone_xyz(r_clone,
        homebox_volume,
        homebox_size) |  |  | 
    |  | 
        
          | set_farterm(key) Optimizes the parameters of the far term of the Coulombic potential.
 |  |  | 
    |  | 
        
          | optimize_key(key,
        n_k=None,
        should_retry=True,
        num_atom=None,
        grid=1.2) Optimizes the simulation parameters in 'key', where 'key' must 
      represent a complete config file.
 |  |  | 
    |  | 
        
          | _calc_vdw_lambda(n_win) Given the number of windows, returns a list of lambda values for VDW 
      potentials.
 |  |  | 
    |  | 
        
          | fep_schedule(n_win,
        fep_type= 'alchemical')Returns a FEP schedule, which is calculated for the given FEP type 
      ('fep_type').
 |  |  | 
    |  | 
        
          | _default_group_selector(grp) |  |  | 
    |  | 
        
          | condense_atom_group(grp,
        group_selector) |  |  | 
    |  | 
        
          | compare_atom_group(grp1,
        grp2,
        group_selector=<function _default_group_selector at 0x2b331c4d8a28>) Compares two given atom groups 'grp1' and 'grp2', and returns True if
      they are the same or False if they are not.
 |  |  | 
    |  | 
        
          | get_asl(raw_grp) Returns an ASL string for a given group of atoms ('raw_grp').
 |  |  | 
    |  |  | 
    |  |  | 
    |  | 
        
          | inject_atom_grp(struc,
        atom_grp) |  |  | 
    |  |  | 
    |  |  | 
    |  | 
        
          | compare_restr_grp(grp1,
        grp2) Compares two given restraint groups 'grp1' and 'grp2', and returns 
      True if they are the same or False if they are not.
 |  |  | 
    |  | 
        
          | resize_restr_block(ffh,
        size) Resizes the "ffio_restraints" block, i.e., changes the 
      number of entries of the block.
 |  |  | 
    |  | 
        
          | set_restr(ffh,
        i,
        k,
        i_atom,
        x,
        y,
        z) |  |  | 
    |  | 
        
          | set_restr_block(ct,
        restr) |  |  | 
    |  | 
        
          | inject_restr(struc,
        restr_grp) |  |  | 
    |  | 
        
          | get_restr2(struc) This differs from 'get_restr' in that this one get the complete 
      restraint information whereas 'get_restr' does not get the atom 
      coordinates and assumes that the force constants are the same for x, 
      y, and z directions.
 |  |  | 
    |  | 
        
          | merge_restr2(ct,
        restr,
        k,
        atom_list) |  |  | 
    |  |  | 
    |  | DEFAULT_CONFIG = '{\nDesmond = {\n   config_version = 2\n}\ngl... | 
    |  | __CONFIG_VALIDATION = '{\nDesmond = {\n   config_version = {\n... | 
    |  | APPDATA_DIR = '/home/buildbot/.schrodinger' | 
    |  | DEFAULT_CONFIG_FILE = '/home/buildbot/.schrodinger/desmond20/d... | 
    |  | DEFAULT_CONFIG_FILE_OLD = '/home/buildbot/.schrodinger/desmond... | 
    |  | NEW_CONFIG_DIR = '/home/buildbot/.schrodinger/desmond20' | 
    |  | OLD_CONFIG_DIR = '/home/buildbot/.schrodinger/desmond10' | 
    |  | MACRO_NAMESPACE_NAME = 'desmond_macro' | 
    |  | __CHECK_CFG_DEBUG = Falsehash(x)
 | 
    |  | __debug_str_buf = '' | 
    |  | __OP = {"==": __op_eq, "<": __op_lt, "<=": __op_le, ">": __op_... | 
    |  | __TYPE = {'bool': <type 'bool'>, 'enum': <type 'str'>, 'float'... | 
    |  | __CONVERTIBLE_TO = {<type 'int'>: [<type 'float'>]} | 
    |  | __xcheck = {"power2": _xchk_power2, "file_exists": _xchk_file_... | 
    |  | CFG_PATTERN = re.compile(r'\{[-~\s]{300,}\}') | 
    |  | PREDEFINED_ATOM_GROUP = ['frozen'] | 
    |  | ATOMGROUP_PREFIX_NAME = 'i_ffio_grp_' | 
    |  | ATOMGROUP_PREFIX_LEN = 11 | 
    |  | a = Key("{a = 1}") | 
    |  | __package__ = 'schrodinger.application.desmond' |