Changeset 33e475a in sasmodels
- Timestamp:
- Aug 26, 2017 8:17:30 PM (7 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 573ffab
- Parents:
- d439007 (diff), bedb9b0 (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. - Files:
-
- 14 added
- 5 deleted
- 17 edited
- 8 moved
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
r8a5f021 rc26897a 11 11 /doc/api/ 12 12 /doc/model/ 13 /doc/ ref/models13 /doc/guide/models 14 14 .mplconfig 15 15 /pylint_violations.txt -
.travis.yml
r24cd982 rb419c2d 8 8 env: 9 9 - PY=2.7 10 - NUMPYSPEC=numpy11 10 - os: linux 12 11 env: 13 - PY=3 14 - NUMPYSPEC=numpy 12 - PY=3.6 15 13 - os: osx 16 14 language: generic 17 15 env: 18 16 - PY=2.7 19 - NUMPYSPEC=numpy20 17 - os: osx 21 18 language: generic 22 19 env: 23 - PY=3 24 - NUMPYSPEC=numpy 20 - PY=3.5 25 21 26 22 # whitelist … … 52 48 - conda info -a 53 49 54 - conda install --yes python=$PY $NUMPYSPECscipy cython mako cffi50 - conda install --yes python=$PY numpy scipy cython mako cffi 55 51 56 - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then 57 pip install pyopencl; 58 fi; 52 # Not testing with opencl below, so don't need to install it 53 #- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then 54 # pip install pyopencl; 55 # fi; 59 56 60 57 install: … … 63 60 64 61 script: 65 - export WORKSPACE=/home/travis/build/SasView/sasmodels/66 - python -m sasmodels.model_test dll all62 - python --version 63 - python -m sasmodels.model_test -v dll all 67 64 68 65 notifications: -
doc/conf.py
r39674a0 r8ae8532 42 42 ] 43 43 44 # Redirect mathjax to a different CDN 45 mathjax_path = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML" 46 44 47 # Add any paths that contain templates here, relative to this directory. 45 48 templates_path = ['_templates'] -
doc/developer/calculator.rst
re822c97 r870a2f4 1 1 .. currentmodule:: sasmodels 2 3 .. _Calculator_Interface: 2 4 3 5 Calculator Interface … … 7 9 model calculator which implements the polydispersity and magnetic SLD 8 10 calculations. There are three separate implementations of this layer, 9 *kernelcl.py*for OpenCL, which operates on a single Q value at a time,10 *kerneldll.c*for the DLL, which loops over a vector of Q values, and11 *kernelpy.py*for python models which operates on vector Q values.11 :mod:`kernelcl` for OpenCL, which operates on a single Q value at a time, 12 :mod:`kerneldll` for the DLL, which loops over a vector of Q values, and 13 :mod:`kernelpy` for python models which operates on vector Q values. 12 14 13 15 Each implementation provides three different calls *Iq*, *Iqxy* and *Imagnetic* -
doc/developer/index.rst
rb85be2d r2e66ef5 7 7 :maxdepth: 4 8 8 9 overview.rst 9 10 calculator.rst -
doc/genapi.py
ra5b8477 r2e66ef5 2 2 import os.path 3 3 4 MODULE_TEMPLATE =""".. Autogenerated by genmods.py4 MODULE_TEMPLATE = """.. Autogenerated by genmods.py 5 5 6 6 ****************************************************************************** … … 19 19 """ 20 20 21 INDEX_TEMPLATE =""".. Autogenerated by genmods.py21 INDEX_TEMPLATE = """.. Autogenerated by genmods.py 22 22 23 23 .. _api-index: … … 46 46 os.makedirs(dir) 47 47 48 for module, name in modules:49 with open(os.path.join(dir, module+'.rst'), 'w') as f:48 for module, name in modules: 49 with open(os.path.join(dir, module+'.rst'), 'w') as f: 50 50 f.write(MODULE_TEMPLATE%locals()) 51 51 52 rsts = "\n ".join(module+'.rst' for module, name in modules)53 with open(os.path.join(dir, 'index.rst'),'w') as f:52 rsts = "\n ".join(module+'.rst' for module, name in modules) 53 with open(os.path.join(dir, 'index.rst'), 'w') as f: 54 54 f.write(INDEX_TEMPLATE%locals()) 55 55 56 56 57 modules =[58 #('__init__', 'Top level namespace'),57 modules = [ 58 ('__init__', 'Sasmodels package'), 59 59 #('alignment', 'GPU data alignment [unused]'), 60 60 ('bumps_model', 'Bumps interface'), 61 ('compare_many', 'Batch compare models on different compute engines'), 61 62 ('compare', 'Compare models on different compute engines'), 62 63 ('convert', 'Sasview to sasmodel converter'), … … 66 67 ('direct_model', 'Simple interface'), 67 68 ('exception', 'Annotate exceptions'), 68 #('frozendict', 'Freeze a dictionary to make it immutable'),69 69 ('generate', 'Model parser'), 70 70 ('kernel', 'Evaluator type definitions'), … … 79 79 ('resolution', '1-D resolution functions'), 80 80 ('resolution2d', '2-D resolution functions'), 81 ('rst2html', 'Convert doc strings the web pages'), 81 82 ('sasview_model', 'Sasview interface'), 82 83 ('sesans', 'SESANS calculation routines'), 83 #('transition', 'Model stepper for automatic model selection'),84 84 ('weights', 'Distribution functions'), 85 85 ] 86 package ='sasmodels'87 package_name ='Reference'86 package = 'sasmodels' 87 package_name = 'Reference' 88 88 genfiles(package, package_name, modules) -
doc/gentoc.py
r40a87fa r990d8df 16 16 from sasmodels.modelinfo import ModelInfo 17 17 18 TEMPLATE ="""\18 TEMPLATE = """\ 19 19 .. 20 20 Generated from doc/gentoc.py -- DO NOT EDIT -- … … 30 30 """ 31 31 32 MODEL_TOC_PATH = " ref/models"32 MODEL_TOC_PATH = "guide/models" 33 33 34 34 def _make_category(category_name, label, title, parent=None): … … 65 65 # assume model is in sasmodels/models/name.py, and ignore the full path 66 66 model_name = basename(item)[:-3] 67 if model_name.startswith('_'): continue 67 if model_name.startswith('_'): 68 continue 68 69 model_info = load_model_info(model_name) 69 70 if model_info.category is None: 70 71 print("Missing category for", item, file=sys.stderr) 71 72 else: 72 category.setdefault(model_info.category, []).append(model_name)73 category.setdefault(model_info.category, []).append(model_name) 73 74 74 75 # Check category names 75 for k, v in category.items():76 for k, v in category.items(): 76 77 if len(v) == 1: 77 print("Category %s contains only %s"%(k, v[0]), file=sys.stderr)78 print("Category %s contains only %s"%(k, v[0]), file=sys.stderr) 78 79 79 80 # Generate category files for the table of contents. … … 86 87 # alphabetical order before them. 87 88 88 if not exists(MODEL_TOC_PATH): mkdir(MODEL_TOC_PATH) 89 if not exists(MODEL_TOC_PATH): 90 mkdir(MODEL_TOC_PATH) 89 91 model_toc = _make_category( 90 'index', 92 'index', 'Models', 'Model Functions') 91 93 #shape_toc = _make_category( 92 94 # 'shape', 'Shapes', 'Shape Functions', model_toc) 93 95 free_toc = _make_category( 94 'shape-independent', 96 'shape-independent', 'Shape-independent', 95 97 'Shape-Independent Functions') 96 98 struct_toc = _make_category( 97 'structure-factor', 98 custom_toc = _make_category(99 'custom-models','Custom-models', 'Custom Models')99 'structure-factor', 'Structure-factor', 'Structure Factors') 100 #custom_toc = _make_category( 101 # 'custom-models', 'Custom-models', 'Custom Models') 100 102 101 103 # remember to top level categories … … 105 107 'shape-independent':free_toc, 106 108 'structure-factor': struct_toc, 107 'custom': custom_toc,109 #'custom': custom_toc, 108 110 } 109 111 110 112 # Process the model lists 111 for k, v in sorted(category.items()):113 for k, v in sorted(category.items()): 112 114 if ':' in k: 113 cat, subcat = k.split(':')115 cat, subcat = k.split(':') 114 116 _maybe_make_category(cat, v, cat_files, model_toc) 115 117 cat_file = cat_files[cat] 116 label = "-".join((cat, subcat))118 label = "-".join((cat, subcat)) 117 119 filename = label 118 title = subcat.capitalize() +" Functions"120 title = subcat.capitalize() + " Functions" 119 121 sub_toc = _make_category(filename, label, title, cat_file) 120 122 for model in sorted(v): … … 130 132 _add_subcategory('shape-independent', model_toc) 131 133 _add_subcategory('structure-factor', model_toc) 132 _add_subcategory('custom-models', model_toc)134 #_add_subcategory('custom-models', model_toc) 133 135 134 136 # Close the top-level category files 135 137 #model_toc.close() 136 for f in cat_files.values(): f.close() 138 for f in cat_files.values(): 139 f.close() 137 140 138 141 -
doc/guide/index.rst
rbb6f0f3 r2e66ef5 1 ********** 2 SAS Models 3 ********** 1 **************** 2 SAS Models Guide 3 **************** 4 4 5 Small angle X-ray and Neutron (SAXS and SANS) scattering examines the 6 scattering patterns produced by a beam travelling through the sample 7 and scattering at low angles. The scattering is computed as a function 8 of $q_x$ and $q_y$, which for a given beam wavelength corresponds to 9 particular scattering angles. Each pixel on the detector corresponds to 10 a different scattering angle. If the sample is unoriented, the scattering 11 pattern will appear as rings on the detector. In this case, a circular 12 average can be taken with 1-dimension data at $q = \surd (q_x^2 + q_y^2)$ 13 compared to the orientationally averaged SAS scattering pattern. 5 .. toctree:: 6 :numbered: 4 7 :maxdepth: 4 14 8 15 Models have certain features in common. 16 17 Every model has a *scale* and a *background*. 18 19 Talk about orientation, with diagrams for orientation so that we don't need 20 a link on every model page? 21 22 .. _orientation: 23 24 .. figure: img/orientation1.jpg 25 26 Orientation in 3D 27 28 .. figure: img/orientation2.jpg 29 30 Orientation cross sections 31 32 Talk about polydispersity. 33 34 Talk about magnetism, converting the magnetism help file to inline text here, 35 with links so that models can point back to it. 36 37 Need to talk about structure factors even though we don't have any 38 implemented yet. 9 intro.rst 10 install.rst 11 pd/polydispersity.rst 12 resolution.rst 13 magnetism/magnetism.rst 14 sesans/sans_to_sesans.rst 15 sesans/sesans_fitting.rst 16 plugin.rst 17 scripting.rst 18 refs.rst -
doc/guide/magnetism/magnetism.rst
rdeb854f r990d8df 2 2 3 3 Polarisation/Magnetic Scattering 4 ================================ =======================4 ================================ 5 5 6 In earlier versions of SasView magnetic scattering was implemented in just five 7 (2D) models 8 9 * :ref:`sphere` 10 * :ref:`core-shell-sphere` 11 * :ref:`core-multi-shell` 12 * :ref:`cylinder` 13 * :ref:`parallelepiped` 14 15 From SasView 4.x it is implemented on most models in the 'shape' category. 16 17 In general, the scattering length density (SLD = $\beta$) in each region where the 18 SLD is uniform, is a combination of the nuclear and magnetic SLDs and, for polarised 19 neutrons, also depends on the spin states of the neutrons. 6 Models which define a scattering length density parameter can be evaluated 7 as magnetic models. In general, the scattering length density (SLD = 8 $\beta$) in each region where the SLD is uniform, is a combination of the 9 nuclear and magnetic SLDs and, for polarised neutrons, also depends on the 10 spin states of the neutrons. 20 11 21 12 For magnetic scattering, only the magnetization component $\mathbf{M_\perp}$ … … 98 89 .. note:: 99 90 This help document was last changed by Steve King, 02May2015 91 92 * Document History * 93 94 | 2017-05-08 Paul Kienzle -
doc/guide/sesans/sesans_fitting.rst
r3330bb4 r8ae8532 7 7 =================== 8 8 9 .. note:: A proper installation of the developers setup of SasView (http://trac.sasview.org/wiki/AnacondaSetup) is a prerequisite for using these instructions. 9 .. note:: 10 11 A proper installation of the developers setup of SasView 12 (http://trac.sasview.org/wiki/AnacondaSetup) is a prerequisite for 13 using these instructions. 10 14 11 15 It is possible to fit SESANS measurements from the command line in Python. … … 13 17 Simple Fits 14 18 ........... 15 In the folder sasmodels/example the file sesans_sphere_2micron.py gives an example of how to fit a shape to a measurement. 19 In the folder sasmodels/example the file sesans_sphere_2micron.py gives 20 an example of how to fit a shape to a measurement. 16 21 17 22 The command:: … … 23 28 .. image:: sesans_img/SphereLineFitSasView.png 24 29 25 All the parameters and names in sesans_sphere_2micron.py (shown below) can be adjusted to fit your own problem:: 30 All the parameters and names in sesans_sphere_2micron.py (shown below) can 31 be adjusted to fit your own problem:: 26 32 27 33 """ … … 64 70 # Constraints 65 71 # model.param_name = f(other params) 66 # EXAMPLE: model.scale = model.radius*model.radius*(1 - phi) - where radius and scale are model functions and phi is67 # a custom parameter72 # EXAMPLE: model.scale = model.radius*model.radius*(1 - phi) - where radius 73 # and scale are model functions and phi is a custom parameter 68 74 model.scale = phi*(1-phi) 69 75 … … 74 80 Incorporating a Structure Factor 75 81 ................................ 76 An example of how to also include a structure factor can be seen in the following example taken from Washington et al., 77 *Soft Matter*\, (2014), 10, 3016 (dx.doi.org/10.1039/C3SM53027B). These are time-of-flight measurements, which is the 78 reason that not the polarisation is plotted, but the :math:`\frac{log(P/P_0)}{\lambda^2}` . The sample is a dispersion 79 of core-shell colloids at a high volume fraction with hard sphere interactions. 82 An example of how to also include a structure factor can be seen in the 83 following example taken from Washington et al., *Soft Matter*\, (2014), 10, 3016 84 (dx.doi.org/10.1039/C3SM53027B). These are time-of-flight measurements, which 85 is the reason that not the polarisation is plotted, but the 86 :math:`\frac{log(P/P_0)}{\lambda^2}` . The sample is a dispersion of 87 core-shell colloids at a high volume fraction with hard sphere interactions. 80 88 81 89 The fit can be started by:: … … 87 95 .. image:: sesans_img/HardSphereLineFitSasView.png 88 96 89 The code sesans_parameters_css-hs.py can then be used as a template for a fitting problem with a structure factor:: 97 The code sesans_parameters_css-hs.py can then be used as a template for a 98 fitting problem with a structure factor:: 90 99 91 100 """ … … 131 140 # Constraints 132 141 # model.param_name = f(other params) 133 # EXAMPLE: model.scale = model.radius*model.radius*(1 - phi) - where radius and scale are model functions and phi is134 # a custom parameter142 # EXAMPLE: model.scale = model.radius*model.radius*(1 - phi) - where radius 143 # and scale are model functions and phi is a custom parameter 135 144 model.scale = phi*(1-phi) 136 145 model.volfraction = phi -
doc/index.rst
r7bb290c r8ae8532 1 Introduction 2 ============ 1 sasmodels 2 ========= 3 Small angle X-ray and Neutron scattering (SAXS and SANS) examines the 4 scattering patterns produced by a beam travelling through the sample 5 and scattering at low angles. The scattering is computed as a function 6 of reciprocal space $q$, which arises from a combination of beam wavelength 7 and scattering angles. Each pixel on the detector corresponds to 8 a different scattering angle, and has a distinct $q_x$ and $q_y$. If the 9 sample is unoriented, the scattering pattern will appear as rings on the 10 detector. In this case, a circular average can be taken with 1-dimension 11 data at $q = \surd (q_x^2 + q_y^2)$ compared to the orientationally 12 averaged SAS scattering pattern. 13 3 14 The sasmodels package provides theory functions for small angle scattering 4 calculations. 15 calculations for different shapes, including the effects of resolution, 16 polydispersity and orientational dispersion. 5 17 6 18 .. htmlonly:: … … 15 27 16 28 guide/index.rst 29 guide/models/index.rst 17 30 developer/index.rst 18 ref/index.rst19 ref/models/index.rst20 31 api/index.rst 21 32 … … 28 39 .. htmlonly:: 29 40 * :ref:`search` 30 31 32 33 34 35 -
example/model.py
r1182da5 r2e66ef5 17 17 model = Model(kernel, 18 18 scale=0.08, 19 r _polar=15, r_equatorial=800,19 radius_polar=15, radius_equatorial=800, 20 20 sld=.291, sld_solvent=7.105, 21 21 background=0, 22 22 theta=90, phi=0, 23 23 theta_pd=15, theta_pd_n=40, theta_pd_nsigma=3, 24 r _polar_pd=0.222296, r_polar_pd_n=1, r_polar_pd_nsigma=0,25 r _equatorial_pd=.000128, r_equatorial_pd_n=1, r_equatorial_pd_nsigma=0,24 radius_polar_pd=0.222296, radius_polar_pd_n=1, radius_polar_pd_nsigma=0, 25 radius_equatorial_pd=.000128, radius_equatorial_pd_n=1, radius_equatorial_pd_nsigma=0, 26 26 phi_pd=0, phi_pd_n=20, phi_pd_nsigma=3, 27 27 ) 28 28 29 29 # SET THE FITTING PARAMETERS 30 model.r _polar.range(15, 1000)31 model.r _equatorial.range(15, 1000)30 model.radius_polar.range(15, 1000) 31 model.radius_equatorial.range(15, 1000) 32 32 model.theta_pd.range(0, 360) 33 33 model.background.range(0,1000) -
sasmodels/alignment.py
r7ae2b7f r870a2f4 42 42 view[:] = x 43 43 return view 44 -
sasmodels/core.py
r650c6d2 r2e66ef5 117 117 Load model info and build model. 118 118 119 *model_name* is the name of the model as used by :func:`load_model_info`. 120 Additional keyword arguments are passed directly to :func:`build_model`. 119 *model_name* is the name of the model, or perhaps a model expression 120 such as sphere*hardsphere or sphere+cylinder. 121 122 *dtype* and *platform* are given by :func:`build_model`. 121 123 """ 122 124 return build_model(load_model_info(model_name), … … 128 130 """ 129 131 Load a model definition given the model name. 132 133 *model_name* is the name of the model, or perhaps a model expression 134 such as sphere*hardsphere or sphere+cylinder. 130 135 131 136 This returns a handle to the module defining the model. This can be … … 227 232 228 233 Possible types include 'half', 'single', 'double' and 'quad'. If the 229 type is 'fast', then this is equivalent to dtype 'single' with the 230 fast flag set to True. 234 type is 'fast', then this is equivalent to dtype 'single' but using 235 fast native functions rather than those with the precision level guaranteed 236 by the OpenCL standard. 237 238 Platform preference can be specfied ("ocl" vs "dll"), with the default 239 being OpenCL if it is availabe. If the dtype name ends with '!' then 240 platform is forced to be DLL rather than OpenCL. 241 242 This routine ignores the preferences within the model definition. This 243 is by design. It allows us to test models in single precision even when 244 we have flagged them as requiring double precision so we can easily check 245 the performance on different platforms without having to change the model 246 definition. 231 247 """ 232 248 # Assign default platform, overriding ocl with dll if OpenCL is unavailable -
sasmodels/model_test.py
rbb4b509 rbedb9b0 47 47 import sys 48 48 import unittest 49 50 try: 51 from StringIO import StringIO 52 except ImportError: 53 # StringIO.StringIO renamed to io.StringIO in Python 3 54 # Note: io.StringIO exists in python 2, but using unicode instead of str 55 from io import StringIO 49 56 50 57 import numpy as np # type: ignore … … 337 344 338 345 def run_one(model): 339 # type: (str) -> None346 # type: (str) -> str 340 347 """ 341 348 Run the tests for a single model, printing the results to stdout. … … 350 357 351 358 # Build a object to capture and print the test results 352 stream = _WritelnDecorator( sys.stdout) # Add writeln() method to stream359 stream = _WritelnDecorator(StringIO()) # Add writeln() method to stream 353 360 verbosity = 2 354 361 descriptions = True … … 388 395 else: 389 396 stream.writeln("Note: no test suite created --- this should never happen") 397 398 output = stream.getvalue() 399 stream.close() 400 return output 390 401 391 402 -
sasmodels/models/multilayer_vesicle.py
r5d23de2 r870a2f4 71 71 sufficiently fine grained in certain cases. Please report any such occurences 72 72 to the SasView team. Generally, for the best possible experience: 73 * Start with the best possible guess 74 * Using a priori knowledge, hold as many parameters fixed as possible 75 * if N=1, tw (water thickness) must by definition be zero. Both N and tw should 73 74 - Start with the best possible guess 75 - Using a priori knowledge, hold as many parameters fixed as possible 76 - if N=1, tw (water thickness) must by definition be zero. Both N and tw should 76 77 be fixed during fitting. 77 *If N>1, use constraints to keep N > 178 *Because N only really moves in integer steps, it may get "stuck" if the78 - If N>1, use constraints to keep N > 1 79 - Because N only really moves in integer steps, it may get "stuck" if the 79 80 optimizer step size is too small so care should be taken 80 81 If you experience problems with this please contact the SasView team and let -
sasmodels/resolution.py
rb32caab r990d8df 437 437 .. math:: 438 438 439 \log \Delta q = (\log q_n - log q_1) / (n - 1)439 \log \Delta q = (\log q_n - \log q_1) / (n - 1) 440 440 441 441 From this we can compute the number of steps required to extend $q$ … … 451 451 452 452 n_\text{extend} = (n-1) (\log q_\text{max} - \log q_n) 453 / (\log q_n - log q_1)453 / (\log q_n - \log q_1) 454 454 """ 455 455 q = np.sort(q) … … 459 459 log_delta_q = log(10.) / points_per_decade 460 460 if q_min < q[0]: 461 if q_min < 0: q_min = q[0]*MINIMUM_ABSOLUTE_Q 461 if q_min < 0: 462 q_min = q[0]*MINIMUM_ABSOLUTE_Q 462 463 n_low = log_delta_q * (log(q[0])-log(q_min)) 463 464 q_low = np.logspace(log10(q_min), log10(q[0]), np.ceil(n_low)+1)[:-1] -
sasmodels/rst2html.py
rf2f5413 r870a2f4 38 38 - mathml 39 39 - mathjax 40 See ` http://docutils.sourceforge.net/docs/user/config.html#math-output`_40 See `<http://docutils.sourceforge.net/docs/user/config.html#math-output>`_ 41 41 for details. 42 42 … … 176 176 from PyQt5.QtCore import QUrl 177 177 except ImportError: 178 from PyQt4.QtWeb kit import QWebView178 from PyQt4.QtWebKit import QWebView 179 179 from PyQt4.QtCore import QUrl 180 180 helpView = QWebView() … … 204 204 from PyQt5.QtCore import QUrl 205 205 except ImportError: 206 from PyQt4.QtWeb kit import QWebView206 from PyQt4.QtWebKit import QWebView 207 207 from PyQt4.QtCore import QUrl 208 208 frame = QWebView() … … 211 211 sys.exit(app.exec_()) 212 212 213 def can_use_qt(): 214 """ 215 Return True if QWebView exists. 216 217 Checks first in PyQt5 then in PyQt4 218 """ 219 try: 220 from PyQt5.QtWebKitWidgets import QWebView 221 return True 222 except ImportError: 223 try: 224 from PyQt4.QtWebKit import QWebView 225 return True 226 except ImportError: 227 return False 228 213 229 def view_help(filename, qt=False): 214 230 import os 215 url="file:///"+os.path.abspath(filename).replace("\\","/") 231 232 if qt: 233 qt = can_use_qt() 234 235 url = "file:///"+os.path.abspath(filename).replace("\\", "/") 216 236 if filename.endswith('.rst'): 217 237 html = load_rst_as_html(filename) -
sasmodels/models/star_polymer.py
r40a87fa rd439007 1 1 r""" 2 The Benoit model for a simple star polymer, with Gaussian coils arms from3 a common point.4 5 2 Definition 6 3 ---------- 4 5 Calcuates the scattering from a simple star polymer with f equal Gaussian coil 6 arms. A star being defined as a branched polymer with all the branches 7 emanating from a common central (in the case of this model) point. It is 8 derived as a special case of on the Benoit model for general branched 9 polymers\ [#CITBenoit]_ as also used by Richter ''et. al.''\ [#CITRichter]_ 7 10 8 11 For a star with $f$ arms the scattering intensity $I(q)$ is calculated as … … 15 18 where 16 19 17 .. math:: v=\frac{u ^2f}{(3f-2)}20 .. math:: v=\frac{uf}{(3f-2)} 18 21 19 22 and … … 21 24 .. math:: u = \left\langle R_{g}^2\right\rangle q^2 22 25 23 contains the square of the ensemble average radius-of-gyration of an arm. 26 contains the square of the ensemble average radius-of-gyration of the full 27 polymer while v contains the radius of gyration of a single arm $R_{arm}$. 28 The two are related as: 29 30 .. math:: R_{arm}^2 = \frac{f}{3f-2} R_{g}^2 31 24 32 Note that when there is only one arm, $f = 1$, the Debye Gaussian coil 25 equation is recovered. Star polymers in solutions tend to have strong 26 interparticle and osmotic effects, so the Benoit equation may not work well. 27 At small $q$ the Guinier term and hence $I(q=0)$ is the same as for $f$ arms 28 of radius of gyration $R_g$, as described for the :ref:`mono-gauss-coil` model. 33 equation is recovered. 34 35 .. note:: 36 Star polymers in solutions tend to have strong interparticle and osmotic 37 effects. Thus the Benoit equation may not work well for many real cases. 38 At small $q$ the Guinier term and hence $I(q=0)$ is the same as for $f$ arms 39 of radius of gyration $R_g$, as described for the :ref:`mono-gauss-coil` 40 model. A newer model for star polymer incorporating excluded volume has been 41 developed by Li et al in arXiv:1404.6269 [physics.chem-ph]. 29 42 30 43 References 31 44 ---------- 32 45 33 H Benoit *J. Polymer Science*, 11, 596-599 (1953) 46 .. [#CITBenoit] H Benoit *J. Polymer Science*, 11, 507-510 (1953) 47 .. [#CITRichter] D Richter, B. Farago, J. S. Huang, L. J. Fetters, 48 B Ewen *Macromolecules*, 22, 468-472 (1989) 49 50 Authorship and Verification 51 ---------------------------- 52 53 * **Author:** Kieran Campbell **Date:** July 24, 2012 54 * **Last Modified by:** Paul Butler **Date:** Auguts 26, 2017 55 * **Last Reviewed by:** Ziang Li and Richard Heenan **Date:** May 17, 2017 34 56 """ 35 57 … … 45 67 - v = u^2f/(3f-2) 46 68 - u = <R_g^2>q^2, where <R_g^2> is the ensemble average radius of 47 gyration squared of an arm69 gyration squared of the entire polymer 48 70 - f is the number of arms on the star 71 - the radius of gyration of an arm is given b 72 Rg_arm^2 = R_g^2 * f/(3f-2) 49 73 """ 50 74 category = "shape-independent" … … 52 76 # pylint: disable=bad-whitespace, line-too-long 53 77 # ["name", "units", default, [lower, upper], "type","description"], 54 parameters = [["rg_squared", "Ang^2", 100.0, [0.0, inf], "", "Ensemble radius of gyration SQUARED of an arm"],78 parameters = [["rg_squared", "Ang^2", 100.0, [0.0, inf], "", "Ensemble radius of gyration SQUARED of the full polymer"], 55 79 ["arms", "", 3, [1.0, 6.0], "", "Number of arms in the model"], 56 80 ]
Note: See TracChangeset
for help on using the changeset viewer.