solnXRayPotTools
index
solnXRayPotTools.py

tools to aid in setup/analysis of potential terms emplying solution
X-Ray scattering data.
 
this module provides functions to simplify the creation and
analysis of solnScatPot.SolnScatPot potential terms. 

 
Functions
       
calc_g(name, q, V0, Vm)
create_solnXRayPot(instanceName, aSelection='not name H*', experiment=0, radiusScale=1, simulation=0)

    create a solnScatPot.SolnScatPot term appropriate for refining
    against solution X-Ray scattering data.
 
    the experiment argument should either be a file (or string)
    with lines starting with
    <q value> < I(q) >
    or a list of (q, I(q)) tuples.
 
    experiment can be specified as the name of a file whose first two
    columns are the experimental q, I(q). An optional third column specifies
    a weight to use for I(q). Lines starting with # or ! are
    skipped. experiment can also be specified as a sequence of (q,I(q)) tuples.
 
    If the q values are evenly spaced, starting at q=0, calcType is set to
    'uniform'
 
    solnScatPot.SolnScatPot.numAngles is initialized to 500
 
    solnScatPot.SolnScatPot.cmpType is initialized to 'log'.
 
    radiusScale is used to scale the effective atomic radii- perhaps due to
      the presence of a solvent layer.
 
    this function initializes effective atomic form factors including
    an excluded volume term.
 
    For atom j
      feff_j(q) = f_j(q) - g_j(q)
 
    where f_j(q) is the atomic scattering factor of group j, evaluated using a
    5-Gaussian sum.
 
    g_j(q) = rho0 * V_j * exp(-q**2 * V_j**(2./3) / (4 PI)) *             V0/Vm * exp(-q**2 * (V0**(2./3) - Vm**(2./3))/(4 PI))
 
    where rho0 is the solvent electron density, V_j is the solvent-displaced
    volume. The second line of the expression is an overall expansion factor,
    in which 
          V0 = ( r0 sqrt(PI) )^3
          Vm = ( rm sqrt(PI) )^3
 
    where rm is the average atomic group radius, and r0 is an effective radius.
 
      r0 = radiusScale * rm
 
    and radiusScale is specified as a number approximately equal to 1.
 
    
 
 
    
exp(...)
exp(x)
 
Return e raised to the power of x.
f_glob(q, atoms, dist)
 determine globbed value of f (using calc_f) given a list of atom names
    and a dictionary containing atom-atom distances. Can only be used with very
    simple glob defs.
    
getCombinedAtoms(atom, atomGroups=0)
 given an atom object, determine the combination of heavy and light
    atoms in this group.
 
    atomGroups is used to hold per-group counts.
    
numElectrons(atom)

    return the number of electrons of a given atom.
    
sinc(x)
updateQValues(pot, newQ)

    update the solnScatPot.SolnScatPot term with new values of scattering
    vector amplitude newQ.
 
    
use4GaussianFormFactors()
use5GaussianFormFactors()
useGlobs(term, globTable=[], globRules={'ADE': [('P', 'O1P', 'O2P'), ("O5'", "C5'"), ("O3'", "C3'"), ("O4'", "C4'"), ("C1'", "C2'"), ('N1', 'C2'), ('N3', 'C4'), ('C5', 'C6', 'N6'), ('N7', 'C8', 'N9')], 'CYT': [('P', 'O1P', 'O2P'), ("O5'", "C5'"), ("O3'", "C3'"), ("O4'", "C4'"), ("C1'", "C2'"), ('N1', 'C2', 'O2'), ('N3', 'C4', 'N4'), ('C5', 'C6')], 'GUA': [('P', 'O1P', 'O2P'), ("O5'", "C5'"), ("O3'", "C3'"), ("O4'", "C4'"), ("C1'", "C2'"), ('N1', 'C2', 'N2'), ('N3', 'C4'), ('C5', 'C6', 'O6'), ('N7', 'C8', 'N9')], 'THY': [('P', 'O1P', 'O2P'), ("O5'", "C5'"), ("O3'", "C3'"), ("O4'", "C4'"), ("C1'", "C2'"), ('N1', 'C2', 'O2'), ('N3', 'C4', 'O4'), ('C5', 'CM', 'C6')]}, verbose=0)
set up solnScatPot.SolnScatPot term to use the atom globbing
    approximation for solution X-ray scattering.
 
    globTable contains a list of list of atoms with in user-defined globs.
    Atoms not specified in globTable are glob'ed by the pre-residue definitions
    in the globRules dictionary.
 
    globRules is a dictionary whose keys are upper case residue names
    each entry containing a list of list of atoms to be globed.
 
    Atoms in term.selection() which are not specified by globTable or by
    globRules are placed into single-atom globs.
    
    

 
Data
        globRules = {'ADE': [('P', 'O1P', 'O2P'), ("O5'", "C5'"), ("O3'", "C3'"), ("O4'", "C4'"), ("C1'", "C2'"), ('N1', 'C2'), ('N3', 'C4'), ('C5', 'C6', 'N6'), ('N7', 'C8', 'N9')], 'CYT': [('P', 'O1P', 'O2P'), ("O5'", "C5'"), ("O3'", "C3'"), ("O4'", "C4'"), ("C1'", "C2'"), ('N1', 'C2', 'O2'), ('N3', 'C4', 'N4'), ('C5', 'C6')], 'GUA': [('P', 'O1P', 'O2P'), ("O5'", "C5'"), ("O3'", "C3'"), ("O4'", "C4'"), ("C1'", "C2'"), ('N1', 'C2', 'N2'), ('N3', 'C4'), ('C5', 'C6', 'O6'), ('N7', 'C8', 'N9')], 'THY': [('P', 'O1P', 'O2P'), ("O5'", "C5'"), ("O3'", "C3'"), ("O4'", "C4'"), ("C1'", "C2'"), ('N1', 'C2', 'O2'), ('N3', 'C4', 'O4'), ('C5', 'CM', 'C6')]}
metalAtoms = ['ZN', 'MN']
pi = 3.1415926535897931
rho0 = 0.33400000000000002
solventVolume = {'C': 16.440000000000001, 'CH': 21.59, 'CH2': 26.739999999999998, 'CH3': 31.890000000000001, 'Ca': 31.890000000000001, 'Cu': 8.7799999999999994, 'Fe': 7.9900000000000002, 'H': 5.1500000000000004, 'MN': 9.1999999999999993, 'Mg': 17.16, ...}
solventVolumeSets = {'svergun': {'C': 16.440000000000001, 'CH': 21.59, 'CH2': 26.739999999999998, 'CH3': 31.890000000000001, 'Ca': 31.890000000000001, 'Cu': 8.7799999999999994, 'Fe': 7.9900000000000002, 'H': 5.1500000000000004, 'MN': 9.1999999999999993, 'Mg': 17.16, ...}, 'tiede': {'Br': 26.52, 'C': 9.0, 'CH': 20.0, 'CH2': 21.0, 'CH3': 33.0, 'Ca': 31.0, 'Cl': 22.449999999999999, 'Cu(2)': 9.1999999999999993, 'Fe(2)': 8.3000000000000007, 'Fe(3)': 8.3000000000000007, ...}, 'xiaobing': {'Br': 26.52, 'C': 16.440000000000001, 'CH': 21.59, 'CH2': 26.739999999999998, 'CH3': 31.890000000000001, 'Ca': 31.890000000000001, 'Cl': 22.449999999999999, 'Cu(2)': 9.1999999999999993, 'Fe(2)': 8.3000000000000007, 'Fe(3)': 8.3000000000000007, ...}}