Changeset 59994557 in sasmodels


Ignore:
Timestamp:
Oct 8, 2016 12:36:46 PM (8 years ago)
Author:
richardh
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
3f5a566, 630cdd4
Parents:
bba9361 (diff), ec8b9a3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of https://github.com/sasview/sasmodels

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • doc/ref/gpu/gpu_computations.rst

    r066f296 r711f17e  
    88 
    99To run on the GPU, your computer must have OpenCL drivers installed. 
    10 For information about OpenCL installation see the 
    11 :ref:`opencl-installation` documentation 
     10For information about OpenCL installation see this 
     11:ref:`opencl-installation` guidance. 
    1212 
    1313Where the model is evaluated is a little bit complicated. 
     
    1616on the CPU.  If the OpenCL driver is not available for the CPU then 
    1717it will run as a normal program on the CPU. 
     18 
    1819For models with a large number of parameters or with a lot of code, 
    1920the GPU may be too small to run the program effectively. 
    2021In this case, you should try simplifying the model, maybe breaking it 
    21 into several different models so that you don't need if statements in your code. 
     22into several different modules so that you don't need *IF* statements in your code. 
    2223If it is still too big, you can set *opencl=False* in the model file and 
    2324the model will only run as a normal program on the CPU. 
    2425This will not usually be necessary. 
    2526 
     27Device Selection 
     28................ 
    2629If you have multiple GPU devices you can tell SasView which device to use. 
    2730By default, SasView looks for one GPU and one CPU device 
    2831from available OpenCL platforms. 
    2932 
    30 It prefers AMD or NVIDIA drivers for GPU, and prefers Intel or 
    31 Apple drivers for CPU. 
    32 Both GPU and CPU are included on the assumption that CPU is always available 
    33 and supports double precision. 
     33SasView prefers AMD or NVIDIA drivers for GPU, and prefers Intel or 
     34Apple drivers for CPU. Both GPU and CPU are included on the assumption that CPU  
     35is always available and supports double precision. 
    3436 
    3537The device order is important: GPU is checked before CPU on the assumption that 
    3638it will be faster. By examining ~/sasview.log you can see which device SasView 
    3739chose to run the model. 
     40 
    3841If you don't want to use OpenCL, you can set *SAS_OPENCL=None* 
    3942in the environment, and it will only use normal programs. 
     43 
    4044If you want to use one of the other devices, you can run the following 
    4145from the python console in SasView:: 
     
    4852Use that value as the value of *SAS_OPENCL*. 
    4953 
     54Compiler Selection 
     55.................. 
    5056For models run as normal programs, you may need to specify a compiler. 
    5157This is done using the SAS_COMPILER environment variable. 
     
    5460TinyCC is provided with SasView so that is the default. 
    5561If you want one of the other compilers, be sure to have it available 
    56 on the path so SasView can find it. 
     62in your *PATH* so SasView can find it! 
     63 
     64 
     65.. note:: 
     66    This help document was last changed by Steve King, 08Oct2016 
  • doc/ref/gpu/opencl_installation.rst

    r6ae7957 rec8b9a3  
    44OpenCL Installation 
    55******************* 
     6*Warning! GPU devices do not in general offer the same level of memory protection as CPU devices. If your code attempts to write outside allocated memory buffers unpredicatable behaviour may result (eg, your video display may freeze, or your system may crash, etc). Do not install OpenCL drivers without first checking for known issues (eg, some computer manufacturers install modified graphics drivers so replacing these may not be a good idea!). If in doubt, seek advice from an IT professional before proceeding further.* 
    67 
    781. Check if you have OpenCL already installed 
     
    910 
    1011Windows 
    11 ========= 
     12....... 
    1213    The following instructions are based on 
    1314    http://web.engr.oregonstate.edu/~mjb/cs475/DoIHaveOpenCL.pdf 
    1415 
    15     * Go to: Start -> Control Panel -> Administrative Tools 
     16    * Go to: Start -> Control Panel -> System & Security -> Administrative Tools 
    1617    * Double Click on Computer Managment 
    1718    * Click on Device Manager 
     
    2324 
    2425Mac OSX 
    25 ========= 
    26     For OSXs higher than 10.6 OpenCL is shipped along with the system. 
     26....... 
     27    For OS X operating systems higher than 10.6 OpenCL is shipped along with the system. 
     28 
     29    However, OpenCL has had a rocky history on Macs. Apple provide a useful compatibility table at https://support.apple.com/en-us/HT202823 
    2730 
    2831 
     
    3134 
    3235Windows 
    33 ========= 
    34     Depeneding on the graphic card on your system, drivers 
     36....... 
     37    Depending on the graphic card in your system, drivers 
    3538    can be obtained from different sources: 
    3639 
    37     * Nvidia: https://developer.nvidia.com/opencl 
     40    * NVIDIA: https://developer.nvidia.com/opencl 
    3841    * AMD: http://developer.amd.com/tools-and-sdks/opencl-zone/ 
    3942 
    4043Mac OSX 
    41 ========= 
     44....... 
    4245    N/A 
     46         
     47        You cannot download OpenCL driver updates for your Mac. They are packaged with the normal quarterly OS X updates from Apple.  
    4348 
    4449 
    4550.. note:: 
    46     Note that Intel provides an OpenCL drivers for Intel processors: 
    47     https://software.intel.com/en-us/articles/opencl-drivers 
    48     This can sometimes make use of special vector instructions across multiple 
     51    Intel provides OpenCL drivers for Intel processors at     https://software.intel.com/en-us/articles/opencl-drivers  
     52    These can sometimes make use of special vector instructions across multiple 
    4953    processors, so it is worth installing if the GPU does not support double 
    5054    precision. You can install this driver alongside the GPU driver for NVIDIA 
    5155    or AMD. 
     56 
     57         
     58.. note:: 
     59    This help document was last changed by Steve King, 08Oct2016 
  • sasmodels/models/polymer_micelle.py

    ra807206 rbba9361  
    1111 
    1212The 1D scattering intensity for this model is calculated according to 
    13 the equations given by Pedersen (Pedersen, 2000). 
     13the equations given by Pedersen (Pedersen, 2000), summarised briefly here. 
     14 
     15The micelle core is imagined as $N\_aggreg$ polymer heads, each of volume $v\_core$, 
     16which then defines a micelle core of $radius\_core$, which is a separate parameter 
     17even though it could be directly determined. 
     18The Gaussian random coil tails, of gyration radius $rg$, are imagined uniformly  
     19distributed around the spherical core, centred at a distance $radius\_core + d\_penetration.rg$ 
     20from the micelle centre, where $d\_penetration$ is of order unity. 
     21A volume $v\_corona$ is defined for each coil. 
     22The model in detail seems to separately parametrise the terms for the shape of I(Q) and the 
     23relative intensity of each term, so use with caution and check parameters for consistency. 
     24The spherical core is monodisperse, so it's intensity and the cross terms may have sharp 
     25oscillations (use q resolution smearing if needs be to help remove them). 
     26 
     27.. math:: 
     28    P(q) = N^2\beta^2_s\Phi(qR)^2+N\beta^2_cP_c(q)+2N^2\beta_s\beta_cS_{sc}s_c(q)+N(N-1)\beta_c^2S_{cc}(q) 
     29     
     30    \beta_s = v\_core(sld\_core - sld\_solvent) 
     31     
     32    \beta_c = v\_corona(sld\_corona - sld\_solvent) 
     33 
     34where $N = n\_aggreg$, and for the spherical core of radius $R$  
     35 
     36.. math::    
     37   \Phi(qR)= \frac{\sin(qr) - qr\cos(qr)}{(qr)^3} 
     38 
     39whilst for the Gaussian coils 
     40 
     41.. math:: 
     42 
     43   P_c(q) &= 2 [\exp(-Z) + Z - 1] / Z^2 
     44 
     45   Z &= (q R_g)^2 
     46 
     47The sphere to coil ( core to corona) and coil to coil (corona to corona) cross terms are 
     48approximated by: 
     49 
     50.. math:: 
     51    
     52   S_{sc}(q)=\Phi(qR)\psi(Z)\frac{sin(q(R+d.R_g))}{q(R+d.R_g)} 
     53    
     54   S_{cc}(q)=\psi(Z)^2\left[\frac{sin(q(R+d.R_g))}{q(R+d.R_g)} \right ]^2 
     55    
     56   \psi(Z)=\frac{[1-exp^{-Z}]}{Z} 
    1457 
    1558Validation 
    1659---------- 
    1760 
    18 This model has not yet been validated. Feb2015 
     61$P(q)$ above is multiplied by $ndensity$, and a units conversion of 10^{-13}, so $scale$ 
     62is likely 1.0 if the scattering data is in absolute units. This model has not yet been  
     63independently validated. 
    1964 
    2065 
     
    3176title = "Polymer micelle model" 
    3277description = """ 
    33     This model provides an approximate form factor, P(q), for a micelle with 
    34     a spherical core with Gaussian polymer chains attached to the surface. 
     78This model provides the form factor, $P(q)$, for a micelle with a spherical 
     79core and Gaussian polymer chains attached to the surface, thus may be applied 
     80to block copolymer micelles. To work well the Gaussian chains must be much 
     81smaller than the core, which is often not the case.  Please study the 
     82reference to Pedersen and full documentation carefully.  
    3583    """ 
     84 
     85 
    3686category = "shape:sphere" 
    3787 
  • sasmodels/models/spinodal.py

    r43fe34b rbba9361  
    55This model calculates the SAS signal of a phase separating solution under spinodal decomposition.  
    66The scattering intensity $I(q)$ is calculated as 
    7 .. math:: I(q) = I_{max}\frac{(1+\gamma/2)x^2}{\gamma/2+x^{2+\gamma}}+B 
    8 where $x=q/q_0$ and $B$ is a flat background. The characteristic structure length 
    9  scales with the correlation peak at $q_0$. The exponent $\gamma$ is equal to  
     7 
     8.. math::  
     9    I(q) = I_{max}\frac{(1+\gamma/2)x^2}{\gamma/2+x^{2+\gamma}}+B 
     10 
     11where $x=q/q_0$ and $B$ is a flat background. The characteristic structure length  
     12scales with the correlation peak at $q_0$. The exponent $\gamma$ is equal to  
    1013$d+1$ with d the dimensionality of the off-critical concentration mixtures. 
    11 A transition to $\gamma=2 d$is seen near the percolation treshold into the  
     14A transition to $\gamma=2d$ is seen near the percolation threshold into the  
    1215critical concentration regime. 
    1316 
     
    4346# pylint: disable=bad-whitespace, line-too-long 
    4447#             ["name", "units", default, [lower, upper], "type", "description"], 
    45 parameters = [["scale",    "",  1.0, [-inf, inf], "", "Scale factor"], 
    46               ["gamma",      "",      3.0, [-inf, inf], "", "Exponent"], 
     48parameters = [["scale",    "",      1.0, [-inf, inf], "", "Scale factor"], 
     49              ["gamma",      "",    3.0, [-inf, inf], "", "Exponent"], 
    4750              ["q_0",  "1/Ang",     0.1, [-inf, inf], "", "Correlation peak position"] 
    4851             ] 
Note: See TracChangeset for help on using the changeset viewer.