Changeset 38
- Timestamp:
- Apr 16, 2013 3:02:17 PM (9 years ago)
- Location:
- trunk/User Procedures/Irena
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/User Procedures/Irena/IR1_FormFactors.ipf
r33 r38 1 1 #pragma rtGlobals=1 // Use modern global access method. 2 #pragma version=2. 182 #pragma version=2.20 3 3 4 4 … … 17 17 //2.17 changed old obsolete BessJ into Besselj - newer implementation in Igor Pro 18 18 //2.18 added SphereWHSLocMonoSq - requested by masato, this is sphere with Hard spheres Percus-Yevic structure factor which has distance which is related linearly to size of the sphere itself. 19 //2.19 removed algebraic form factor and added Janus Core Shell micelles, added special list of form factor for Size Distribution, which cannot handle complex shapes (and should not)... 20 //2.20 Added Form and Structure factor description as Igor Help file. 19 21 20 22 //this is utility package providing various form factors to be used by Standard model package and Sizes … … 72 74 // it is text function... 73 75 76 static constant JanusCoreShellMicNumIngtPnts=66 //weird, with 40 there are specific radii where code fails to produces NaN 77 74 78 Function IR1T_InitFormFactors() 75 79 //here we initialize the form factor calculations … … 79 83 NewDataFolder/O/S root:Packages:FormFactorCalc 80 84 81 string/g ListOfFormFactors="Spheroid;Cylinder;CylinderAR;CoreShell;CoreShellShell;CoreShellCylinder;User;Integrated_Spheroid; Algebraic_Globules;Algebraic_Rods;Algebraic_Disks;Unified_Sphere;Unified_Rod;Unified_RodAR;Unified_Disk;Unified_Tube;Fractal Aggregate;"82 ListOfFormFactors+="NoFF_setTo1;SphereWHSLocMonoSq; "83 // ListOfFormFactors+="Unified_Level;"85 string/g ListOfFormFactors="Spheroid;Cylinder;CylinderAR;CoreShell;CoreShellShell;CoreShellCylinder;User;Integrated_Spheroid;Unified_Sphere;Unified_Rod;Unified_RodAR;Unified_Disk;Unified_Tube;Fractal Aggregate;" 86 ListOfFormFactors+="NoFF_setTo1;SphereWHSLocMonoSq;Janus CoreShell Micelle 1;Janus CoreShell Micelle 2;" 87 string/g ListOfFormFactorsSD="Spheroid;Cylinder;CylinderAR;CoreShell;CoreShellShell;CoreShellCylinder;User;Integrated_Spheroid;Unified_Sphere;Unified_Rod;Unified_RodAR;Unified_Disk;Unified_Tube;Fractal Aggregate;" 84 88 string/g CoreShellVolumeDefinition 85 89 SVAR CoreShellVolumeDefinition //this will be user choice for definition of volume of core shell particle: "Whole particle;Core;Shell;", NIST standard definition is Whole particle, default... … … 100 104 Function IR2T_LoadFFDescription() 101 105 106 //try to open Igor help file frist and only if that fails call pdf file... 107 DisplayHelpTopic /Z "Form Factors & Structure factors" 108 if(V_Flag) 109 102 110 string WhereIsManual 103 111 string WhereAreProcedures=RemoveEnding(FunctionPath(""),"IR1_FormFactors.ipf") 104 112 String manualPath = ParseFilePath(5,"FormFactorList.pdf","*",0,0) 105 113 String cmd 106 107 if (stringmatch(IgorInfo(3), "*Macintosh*")) 108 // manualPath = "User Procedures:Irena:Irena manual.pdf" 109 sprintf cmd "tell application \"Finder\" to open \"%s\"",WhereAreProcedures+manualPath 110 ExecuteScriptText cmd 111 if (strlen(S_value)>2) 112 // DoAlert 0, S_value 114 if (stringmatch(IgorInfo(3), "*Macintosh*")) 115 // manualPath = "User Procedures:Irena:Irena manual.pdf" 116 sprintf cmd "tell application \"Finder\" to open \"%s\"",WhereAreProcedures+manualPath 117 ExecuteScriptText cmd 118 if (strlen(S_value)>2) 119 // DoAlert 0, S_value 120 endif 121 122 else 123 //manualPath = "User Procedures\Irena\Irena manual.pdf" 124 //WhereIsIgor=WhereIsIgor[0,1]+"\\"+IN2G_ChangePartsOfString(WhereIsIgor[2,inf],":","\\") 125 WhereAreProcedures=ParseFilePath(5,WhereAreProcedures,"*",0,0) 126 whereIsManual = "\"" + WhereAreProcedures+manualPath+"\"" 127 NewNotebook/F=0 /N=NewBatchFile 128 Notebook NewBatchFile, text=whereIsManual//+"\r" 129 SaveNotebook/O NewBatchFile as SpecialDirPath("Temporary", 0, 1, 0 )+"StartFormFactors.bat" 130 DoWindow/K NewBatchFile 131 ExecuteScriptText "\""+SpecialDirPath("Temporary", 0, 1, 0 )+"StartFormFactors.bat\"" 113 132 endif 114 115 else116 //manualPath = "User Procedures\Irena\Irena manual.pdf"117 //WhereIsIgor=WhereIsIgor[0,1]+"\\"+IN2G_ChangePartsOfString(WhereIsIgor[2,inf],":","\\")118 WhereAreProcedures=ParseFilePath(5,WhereAreProcedures,"*",0,0)119 whereIsManual = "\"" + WhereAreProcedures+manualPath+"\""120 NewNotebook/F=0 /N=NewBatchFile121 Notebook NewBatchFile, text=whereIsManual//+"\r"122 SaveNotebook/O NewBatchFile as SpecialDirPath("Temporary", 0, 1, 0 )+"StartFormFactors.bat"123 DoWindow/K NewBatchFile124 ExecuteScriptText "\""+SpecialDirPath("Temporary", 0, 1, 0 )+"StartFormFactors.bat\""125 133 endif 126 134 end … … 193 201 // Shell1Rho=ParticlePar5 // rho for shell 1 material 194 202 // Shell2Rho=particlePar6 // rho for shell 2 material 203 // 204 //Janus CoreShell Micelle 1 //particle size is total size of the particle (R0 in the figure in description) 205 // Shell_Thickness=ParticlePar1 //shell thickness A 206 // SolventRho=ParticlePar2 // rho for solvent material 207 // CoreRho=ParticlePar3 // rho for core material 208 // Shell1Rho=ParticlePar4 // rho for shell 1 material 209 // Shell2Rho=particlePar5 // rho for shell 2 material 210 //Janus CoreShell Micelle 2 //particle size here is shell thickness!!! 211 // Core_Size=ParticlePar1 // Core radius A 212 // SolventRho=ParticlePar2 // rho for solvent material 213 // CoreRho=ParticlePar3 // rho for core material 214 // Shell1Rho=ParticlePar4 // rho for shell 1 material 215 // Shell2Rho=particlePar5 // rho for shell 2 material 216 195 217 //Fractal aggregate FractalRadiusOfPriPart=ParticlePar1=root:Packages:Sizes:FractalRadiusOfPriPart //radius of primary particle 196 218 // FractalDimension=ParticlePar2=root:Packages:Sizes:FractalDimension //Fractal dimension … … 255 277 endif 256 278 endfor 257 For(i=0;i< 1+floor(numpnts(R_dist)/5);i+=1)279 For(i=0;i<floor(numpnts(R_dist)/5);i+=1) 258 280 if(cmpstr(StringByKey("R_"+num2str(i), OldNote),num2str(R_dist[i]))!=0 ) //check every 5th R value written in wave note 259 281 Recalculate=1 … … 271 293 variable FractalDimension, thickness 272 294 variable QR, QH, topp, bott, Rd, QRd, sqqt, argument, surchi, rP, Qj, bP, bM, length,WallThickness 273 variable CoreShellCoreRho,CoreShellThickness,CoreShellShellRho, CoreShellSolvntRho 295 variable CoreShellCoreRho,CoreShellThickness,CoreShellShellRho, CoreShellSolvntRho, Shell_Thickness, Core_Size 274 296 variable CoreContrastRatio, CoreShell_1_Thickness, CoreShell_2_Thickness, Shell1Rho, Shell2Rho, SolventRho, CoreRho 275 297 … … 490 512 Gmatrix[][i]=TempWave[p] //and here put it into G wave 491 513 endfor 492 elseif(cmpstr(ParticleModel,"Algebraic_Rods")==0) //Pete's rods model, apparently using AJA code from whenever 493 aspectRatio=ParticlePar1 //Aspect ratio is set by particleparam1 514 elseif(cmpstr(ParticleModel,"Janus CoreShell Micelle 1")==0) 515 //Janus CoreShell Micelle 1 //particle size is total size of the particle (R0 in the figure in description) 516 Shell_Thickness=ParticlePar1 //shell thickness A 517 SolventRho=ParticlePar5 // rho for solvent material 518 CoreRho=ParticlePar2 // rho for core material 519 Shell1Rho=ParticlePar3 // rho for shell 1 material 520 Shell2Rho=particlePar4 // rho for shell 2 material 494 521 For (i=0;i<N;i+=1) //calculate the G matrix in columns!!! 495 522 currentR=R_dist[i] 496 for(j=0;j<numpnts(TempWave);j+=1) //calulate separately TempWave 497 QR = currentR * Q_vec[j] 498 QH = Q_vec[j] * AspectRatio * currentR 499 topp = 1 + 2*pi*QH^3 * QR/(9 * (4 + QR^2)) + (QH^3 * QR^4)/8 500 bott = 1 + QH^2 * (1 + QH^2 * QR)/9 + (QH^4 * QR^7)/16 501 tempWave[j] = (2*pi*AspectRatio * currentR^3)^VolumePower * topp/bott 502 endfor 523 multithread TempWave=IR1T_JanusFF(Q_vec[p], CurrentR, CoreRho, Shell1Rho, Shell2Rho, SolventRho,CurrentR-Shell_Thickness) //this is already 2nd power and should be normalized by volume 524 multithread TempWave*= IR1T_JanusVp(CurrentR,CoreRho, Shell1Rho, Shell2Rho,CurrentR-Shell_Thickness)^VolumePower //scale by volume 503 525 Gmatrix[][i]=TempWave[p] //and here put it into G wave 504 526 endfor 505 elseif(cmpstr(ParticleModel,"Algebraic_Disks")==0) //Pete's disk model, apparently using AJA code from whenever 506 aspectRatio=ParticlePar1 //Aspect ratio is set by particleparam1 527 elseif(cmpstr(ParticleModel,"Janus CoreShell Micelle 2")==0) 528 //Janus CoreShell Micelle 2 //particle size here is shell thickness!!! 529 Core_Size=ParticlePar1 //Core radius A 530 SolventRho=ParticlePar5 // rho for solvent material 531 CoreRho=ParticlePar2 // rho for core material 532 Shell1Rho=ParticlePar3 // rho for shell 1 material 533 Shell2Rho=particlePar4 // rho for shell 2 material 507 534 For (i=0;i<N;i+=1) //calculate the G matrix in columns!!! 508 535 currentR=R_dist[i] 509 for(j=0;j<numpnts(TempWave);j+=1) 510 QR = currentR * Q_vec[j] 511 Rd = currentR * AspectRatio //disk radius 512 QH = Q_vec[j] * currentR 513 QRd = Q_vec[j] * currentR * AspectRatio 514 topp = 1 + QRd^3 / (3 + QH^2) + (QH^2 * QRd / 3)^2 515 bott = 1 + QRd^2 * (1 + QH * QRd^2)/16 + (QH^3 * QRd^2 / 3)^2 516 tempWave[j] = (2*pi*AspectRatio * currentR^3)^VolumePower * topp/bott 517 endfor 536 multithread TempWave=IR1T_JanusFF(Q_vec[p], Core_Size+CurrentR, CoreRho, Shell1Rho, Shell2Rho, SolventRho,Core_Size) //this is already 2nd power and should be normalized by volume 537 multithread TempWave*= IR1T_JanusVp(Core_Size+CurrentR,CoreRho, Shell1Rho, Shell2Rho,Core_Size)^VolumePower //scale by volume 518 538 Gmatrix[][i]=TempWave[p] //and here put it into G wave 519 539 endfor 520 elseif(cmpstr(ParticleModel,"Algebraic_Globules")==0) //Pete's Globules model, apparently using AJA code from whenever 521 aspectRatio=ParticlePar1 //Aspect ratio is set by particleparam1 522 if(AspectRatio<0.99) 523 sqqt = sqrt(1-AspectRatio^2) 524 argument = (2 - AspectRatio^2 + 2*sqqt)/(AspectRatio^2) 525 surchi = (1 + AspectRatio^2 * ln(argument) / (2*sqqt)) / (2 * AspectRatio) 526 elseif(AspectRatio>1.01) 527 sqqt = sqrt(AspectRatio^2 - 1) 528 argument = sqqt / AspectRatio 529 surchi = (1 + AspectRatio^2 * asin(argument) / (sqqt)) / (2 * AspectRatio) 530 else //AspectRatio==1 531 surchi = 1 532 endif 533 For (i=0;i<N;i+=1) //calculate the G matrix in columns!!! 534 currentR=R_dist[i] 535 for(j=0;j<numpnts(TempWave);j+=1) 536 QR = currentR * Q_vec[j] 537 bott = 1 + QR^2 * (2 + AspectRatio^2)/15 + 2 * AspectRatio * QR^4 / (9 * surchi) 538 tempWave[j] = (4/3 * pi * AspectRatio * currentR^3)^VolumePower / bott 539 endfor 540 Gmatrix[][i]=TempWave[p] //and here put it into G wave 541 endfor 542 elseif(cmpstr(ParticleModel,"Algebraic_Spheres")==0) //Pete's Algebraic Spheres model, apparently using Petes old code from whenever 543 For (i=0;i<N;i+=1) //calculate the G matrix in columns!!! 544 currentR=R_dist[i] 545 rP = currentR + IR1T_BinWidthInRadia(R_dist,i) 546 for(j=0;j<numpnts(TempWave);j+=1) 547 Qj = Q_vec[j] 548 bP = rp/2 + (Qj^2) *(rP^3)/6 + (0.25*(Qj * rP^2) - 0.625/Qj) * sin(2 * Qj * rP) + 0.75 * rP * cos(2 * Qj * rP) 549 bM = currentR/2 + (Qj^2)*(currentR^3)/6 + (0.25 * (Qj * currentR^2) - 0.625/Qj) * sin(2 * Qj * currentR) + 0.75 * currentR * cos(2 * Qj * currentR) 550 topp = bP - bM 551 bott = Qj^6 * (rP^4 - currentR^4) * currentR^3 552 tempWave[j] = 36 * (4/3 * pi * currentR^3)^VolumePower * topp/bott 553 endfor 554 Gmatrix[][i]=TempWave[p] //and here put it into G wave 555 endfor 540 541 // elseif(cmpstr(ParticleModel,"Algebraic_Rods")==0) //Pete's rods model, apparently using AJA code from whenever 542 // aspectRatio=ParticlePar1 //Aspect ratio is set by particleparam1 543 // For (i=0;i<N;i+=1) //calculate the G matrix in columns!!! 544 // currentR=R_dist[i] 545 // for(j=0;j<numpnts(TempWave);j+=1) //calulate separately TempWave 546 // QR = currentR * Q_vec[j] 547 // QH = Q_vec[j] * AspectRatio * currentR 548 // topp = 1 + 2*pi*QH^3 * QR/(9 * (4 + QR^2)) + (QH^3 * QR^4)/8 549 // bott = 1 + QH^2 * (1 + QH^2 * QR)/9 + (QH^4 * QR^7)/16 550 // tempWave[j] = (2*pi*AspectRatio * currentR^3)^VolumePower * topp/bott 551 // endfor 552 // Gmatrix[][i]=TempWave[p] //and here put it into G wave 553 // endfor 554 // elseif(cmpstr(ParticleModel,"Algebraic_Disks")==0) //Pete's disk model, apparently using AJA code from whenever 555 // aspectRatio=ParticlePar1 //Aspect ratio is set by particleparam1 556 // For (i=0;i<N;i+=1) //calculate the G matrix in columns!!! 557 // currentR=R_dist[i] 558 // for(j=0;j<numpnts(TempWave);j+=1) 559 // QR = currentR * Q_vec[j] 560 // Rd = currentR * AspectRatio //disk radius 561 // QH = Q_vec[j] * currentR 562 // QRd = Q_vec[j] * currentR * AspectRatio 563 // topp = 1 + QRd^3 / (3 + QH^2) + (QH^2 * QRd / 3)^2 564 // bott = 1 + QRd^2 * (1 + QH * QRd^2)/16 + (QH^3 * QRd^2 / 3)^2 565 // tempWave[j] = (2*pi*AspectRatio * currentR^3)^VolumePower * topp/bott 566 // endfor 567 // Gmatrix[][i]=TempWave[p] //and here put it into G wave 568 // endfor 569 // elseif(cmpstr(ParticleModel,"Algebraic_Globules")==0) //Pete's Globules model, apparently using AJA code from whenever 570 // aspectRatio=ParticlePar1 //Aspect ratio is set by particleparam1 571 // if(AspectRatio<0.99) 572 // sqqt = sqrt(1-AspectRatio^2) 573 // argument = (2 - AspectRatio^2 + 2*sqqt)/(AspectRatio^2) 574 // surchi = (1 + AspectRatio^2 * ln(argument) / (2*sqqt)) / (2 * AspectRatio) 575 // elseif(AspectRatio>1.01) 576 // sqqt = sqrt(AspectRatio^2 - 1) 577 // argument = sqqt / AspectRatio 578 // surchi = (1 + AspectRatio^2 * asin(argument) / (sqqt)) / (2 * AspectRatio) 579 // else //AspectRatio==1 580 // surchi = 1 581 // endif 582 // For (i=0;i<N;i+=1) //calculate the G matrix in columns!!! 583 // currentR=R_dist[i] 584 // for(j=0;j<numpnts(TempWave);j+=1) 585 // QR = currentR * Q_vec[j] 586 // bott = 1 + QR^2 * (2 + AspectRatio^2)/15 + 2 * AspectRatio * QR^4 / (9 * surchi) 587 // tempWave[j] = (4/3 * pi * AspectRatio * currentR^3)^VolumePower / bott 588 // endfor 589 // Gmatrix[][i]=TempWave[p] //and here put it into G wave 590 // endfor 591 // elseif(cmpstr(ParticleModel,"Algebraic_Spheres")==0) //Pete's Algebraic Spheres model, apparently using Petes old code from whenever 592 // For (i=0;i<N;i+=1) //calculate the G matrix in columns!!! 593 // currentR=R_dist[i] 594 // rP = currentR + IR1T_BinWidthInRadia(R_dist,i) 595 // for(j=0;j<numpnts(TempWave);j+=1) 596 // Qj = Q_vec[j] 597 // bP = rp/2 + (Qj^2) *(rP^3)/6 + (0.25*(Qj * rP^2) - 0.625/Qj) * sin(2 * Qj * rP) + 0.75 * rP * cos(2 * Qj * rP) 598 // bM = currentR/2 + (Qj^2)*(currentR^3)/6 + (0.25 * (Qj * currentR^2) - 0.625/Qj) * sin(2 * Qj * currentR) + 0.75 * currentR * cos(2 * Qj * currentR) 599 // topp = bP - bM 600 // bott = Qj^6 * (rP^4 - currentR^4) * currentR^3 601 // tempWave[j] = 36 * (4/3 * pi * currentR^3)^VolumePower * topp/bott 602 // endfor 603 // Gmatrix[][i]=TempWave[p] //and here put it into G wave 604 // endfor 556 605 else 557 606 Gmatrix[][]=NaN … … 591 640 592 641 593 //*****************************************************************************************************************594 //*****************************************************************************************************************595 //*****************************************************************************************************************596 //*****************************************************************************************************************597 //*****************************************************************************************************************598 599 //*****************************************************************************************************************600 //*****************************************************************************************************************601 //*****************************************************************************************************************602 //*****************************************************************************************************************603 //*****************************************************************************************************************604 //*****************************************************************************************************************605 //*****************************************************************************************************************606 //*****************************************************************************************************************607 //*****************************************************************************************************************608 //*****************************************************************************************************************609 //*****************************************************************************************************************610 642 //***************************************************************************************************************** 611 643 //***************************************************************************************************************** … … 1883 1915 //need to disable usused fitting parameters so the code which is using this package does not have to contain list of form factors... 1884 1916 1885 //go through all form factors kn won and set the ones unsused to zeroes...1917 //go through all form factors known and set the ones unsused to zeroes... 1886 1918 if(stringmatch(CurFF,"Unified_Sphere")||stringmatch(CurFF,"NoFF_setTo1")) //no parameters at all... 1887 1919 FitP1=0 … … 1916 1948 elseif(stringmatch(CurFF,"CoreShellCylinder")) 1917 1949 1950 elseif(stringmatch(CurFF,"Janus CoreShell Micelle 1")) 1951 1952 elseif(stringmatch(CurFF,"Janus CoreShell Micelle 2")) 1953 1918 1954 elseif(stringmatch(CurFF,"User")) 1919 1955 1920 1956 elseif(stringmatch(CurFF,"Integreated_Spheroid")) 1921 FitP2=01922 FitP3=01923 FitP4=01924 FitP5=01925 elseif(stringmatch(CurFF,"Algebraic_*"))1926 1957 FitP2=0 1927 1958 FitP3=0 … … 1990 2021 //Algebraic_Rods AspectRatio = ParticlePar1, AR > 10 1991 2022 //Algebraic_Disks AspectRatio = ParticlePar1, AR < 0.1 1992 //first variable......2023 //first variable...... 1993 2024 NVAR/Z CurVal= $(P1Str) 1994 2025 if(!NVAR_Exists(CurVal)) … … 2032 2063 elseif(stringmatch(CurrentFF,"Fractal aggregate")) 2033 2064 SetVariable P1Value, title="Frctl rad. prim part = ", help={"Fractal Radius of primary particle"} 2065 elseif(stringmatch(CurrentFF,"Janus CoreShell Micelle 1")) 2066 SetVariable P1Value, title="Shell thickness [A] = ", help={"Thickness of the shell for Janus CoreShell micelle"} 2067 elseif(stringmatch(CurrentFF,"Janus CoreShell Micelle 2")) 2068 SetVariable P1Value, title="Core radius [A] = ", help={"Radius of core for Janus CoreShell Micelle"} 2034 2069 endif 2035 2070 … … 2064 2099 endif 2065 2100 2066 if(stringmatch(CurrentFF,"User") || stringmatch(CurrentFF,"CoreShellCylinder") || stringmatch(CurrentFF,"CoreShell") || stringmatch(CurrentFF,"CoreShellShell") )2067 //define next 3 parameters ( need at least 4 arams for these three...)2101 if(stringmatch(CurrentFF,"User") || stringmatch(CurrentFF,"CoreShellCylinder") || stringmatch(CurrentFF,"CoreShell") || stringmatch(CurrentFF,"CoreShellShell") || stringmatch(CurrentFF,"Janus CoreShell Micelle*")) 2102 //define next 3 parameters ( need at least 4 params for these three...) 2068 2103 NVAR/Z CurVal= $(FitP2Str) 2069 2104 NVAR/Z CurVal2= $(LowP2Str) … … 2119 2154 SetVariable P2Value, title="Core Rho = ", help={"Scattering length density of core"} 2120 2155 SetVariable P3Value, title="Shell Rho = ", help={"Scattering length density of shell "} 2121 SetVariable P4Value, title="Solvent Rho = ", help={"Solvent Scattering length density"} 2122 2156 SetVariable P4Value, title="Solvent Rho = ", help={"Solvent Scattering length density"} 2123 2157 endif 2124 if(stringmatch(CurrentFF,"CoreShellCylinder" ) ||stringmatch(CurrentFF,"CoreShellShell" ) || stringmatch(CurrentFF,"User") )2158 if(stringmatch(CurrentFF,"CoreShellCylinder" ) ||stringmatch(CurrentFF,"CoreShellShell" ) || stringmatch(CurrentFF,"User")||stringmatch(CurrentFF,"Janus CoreShell Micelle*")) 2125 2159 //add fifth set of values... 2126 2160 NVAR/Z CurVal= $(FitP5Str) … … 2152 2186 2153 2187 endif 2154 if(stringmatch(CurrentFF,"User")) 2188 if(stringmatch(CurrentFF,"Janus CoreShell Micelle*")) 2189 //CoreShell CoreShellThickness=ParticlePar1 //skin thickness in Angstroems 2190 // CoreRho=ParticlePar2 // rho for core material 2191 // ShellRho=ParticlePar3 // rho for shell material 2192 // SolventRho=ParticlePar4 // rho for solvent material 2193 SetVariable P2Value, title="Core Rho = ", help={"Scattering length density of core"} 2194 SetVariable P3Value, title="Shell 1 Rho = ", help={"Scattering length density of shell "} 2195 SetVariable P4Value, title="Shell 2 Rho = ", help={"Scattering length density of shell "} 2196 SetVariable P5Value, title="Solvent Rho = ", help={"Solvent Scattering length density"} 2197 endif 2198 if(stringmatch(CurrentFF,"User")) 2155 2199 //User uses user provided functions. There are two userprovided fucntions necessary - F(q,R,par1,par2,par3,par4,par5) 2156 2200 // and V(R,par1,par2,par3,par4,par5) … … 2818 2862 //***************************************************************************************************************** 2819 2863 //***************************************************************************************************************** 2820 //***************************************************************************************************************** 2864 // Janus coreshell Micelle functions... 2865 //***************************************************************************************************************** 2866 threadsafe static Function IR1T_JanusFF(Qv, Ro, RhoA, RhoB, RhoC, RhoSolv,Ri) 2867 variable Qv, Ro, RhoA, RhoB, RhoC, RhoSolv, Ri 2868 2869 variable numP=JanusCoreShellMicNumIngtPnts 2870 // Ro = Ro in Fig 1 2871 // Ri = Ri in Fig 1 2872 //define parameters as per manuscript. 2873 variable mu //cos(th), where th is that from the figure 7 going from 0 to pi/2 2874 //we need to integrate this per whole particle - remember to weigh by cos(th) in the integration as AnisoPorod used to be 2875 variable kv //is Q * mu 2876 variable DrhoBA = RhoA - RhoB // RhoA - RhoB 2877 variable DrhoCA = RhoA - RhoC //RhoA - RhoC 2878 // now we need to do the calculations. 2879 variable Vp = IR1T_JanusVp(Ro,RhoA, RhoB, RhoC,Ri) 2880 make/O/N=(numP) IntgWvMu, weightFac 2881 SetScale /I x, 0, pi/2,"", IntgWvMu, weightFac 2882 weightFac = sin(x) 2883 multithread IntgWvMu = IR1T_JanusOneMu(Qv,Ro,Ri, DrhoBA, DrhoCA, RhoB, RhoC, Qv*cos(x), numP, Vp, cos(x)) 2884 IntgWvMu[0]=IntgWvMu[1] //IntgWvMu[0] = NaN so needs to be repalced by next point. Known numercial issue... 2885 IntgWvMu *=weightFac 2886 return 2* area(IntgWvMu, 0, pi/2) 2887 end 2888 //***************************************************************************************************************** 2889 //***************************************************************************************************************** 2890 threadsafe static Function IR1T_JanusOneMu(Qv,Ro,Ri, DrhoBA, DrhoCA, RhoB, RhoC, kv, numP, Vp, mu ) 2891 variable Qv,Ro,Ri, DrhoBA, DrhoCA, RhoB, RhoC, kv, numP, Vp, mu 2892 2893 variable Prefactor = 4 * pi^2 /(Qv^2 * (1 - mu^2) * Vp^2) 2894 variable part1, part2, part3, part4 2895 part1 = (RhoB + RhoC) * IR1T_JanusIntgCos(kv,Qv, Ro,mu, numP) 2896 part2 = (DrhoBA + DrhoCA) * IR1T_JanusIntgCos(kv,Qv, Ri,mu, numP) 2897 part3 = (RhoB - RhoC) * IR1T_JanusIntgSin(kv,Qv, Ro,mu, numP) 2898 part4 = (DrhoBA - DrhoCA) * IR1T_JanusIntgSin(kv,Qv, Ri,mu, numP) 2899 2900 return Prefactor * ((part1+part2)^2+(part3+part4)^2) 2901 end 2902 //***************************************************************************************************************** 2903 //***************************************************************************************************************** 2904 threadsafe static Function IR1T_JanusIntgCos(kv,Qv, Rx,mu, numP) 2905 variable kv,Qv, Rx,mu, numP 2906 make/Free/N=(numP) IntgWv 2907 SetScale /I x, 0, Rx ,"", IntgWv 2908 IntgWv = cos(kv * x) * IR1T_JanusF(Qv, Rx,x,mu) 2909 return area(IntgWv , 0, Rx) 2910 end 2911 //***************************************************************************************************************** 2912 //***************************************************************************************************************** 2913 threadsafe static Function IR1T_JanusIntgSin(kv,Qv, Rx,mu, numP) 2914 variable kv,Qv, Rx,mu, numP 2915 make/Free/N=(numP) IntgWv 2916 SetScale /I x, 0, Rx ,"", IntgWv 2917 IntgWv = sin(kv * x) * IR1T_JanusF(Qv, Rx,x,mu) 2918 return area(IntgWv , 0, Rx) 2919 end 2920 //***************************************************************************************************************** 2921 //***************************************************************************************************************** 2922 threadsafe static Function IR1T_JanusF(Qv, Rj,Zv,mu) 2923 variable Qv, Rj, Zv, mu 2924 variable part1 = sqrt(Rj^2 - Zv^2) 2925 variable BesArg= Qv * sqrt(1-mu^2)*part1 2926 variable part2 = Besselj(1,BesArg) 2927 return part1 * part2 2928 end 2929 //***************************************************************************************************************** 2930 //***************************************************************************************************************** 2931 threadsafe static Function IR1T_JanusVp(Ro,RhoA, RhoB, RhoC,Ri ) 2932 variable Ro,RhoA, RhoB, RhoC,Ri 2933 return (4/3)*pi*(((RhoB+RhoC)/2)*(Ro^3 - Ri^3) + RhoA*Ri^3) 2934 end 2935 2936 //***************************************************************************************************************** 2937 //***************************************************************************************************************** 2938 //***************************************************************************************************************** 2939 //***************************************************************************************************************** 2940 //***************************************************************************************************************** 2941 2942 //***************************************************************************************************************** 2943 //***************************************************************************************************************** 2944 //***************************************************************************************************************** 2945 //***************************************************************************************************************** 2946 //***************************************************************************************************************** 2947 //***************************************************************************************************************** 2948 //***************************************************************************************************************** 2949 //***************************************************************************************************************** 2950 //***************************************************************************************************************** 2951 //***************************************************************************************************************** 2952 //***************************************************************************************************************** -
trunk/User Procedures/Irena/IR1_IntCalculations.ipf
r6 r38 407 407 ParticlePar4=UserPar4 408 408 ParticlePar5=UserPar5 409 elseif(cmpstr(ShapeType,"Janus CoreShell Micelle*")==0) //Janus core shell Micelle has 5 parameters 410 ParticlePar1=UserPar1 411 ParticlePar2=UserPar2 412 ParticlePar3=UserPar3 413 ParticlePar4=UserPar4 414 ParticlePar5=UserPar5 409 415 elseif(cmpstr(ShapeType,"CoreShell")==0) //CoreShell - 2 parameters 410 // NVAR CoreShellThicknessRatio=root:Packages:Sizes:CoreShellThicknessRatio //radius of primary particle411 416 ParticlePar1=Param1 412 // NVAR CoreShellContrastRatio=root:Packages:Sizes:CoreShellContrastRatio413 417 ParticlePar2=Param2 414 418 ParticlePar3=Param3 415 419 ParticlePar4=Param4 416 420 elseif(cmpstr(ShapeType,"Fractal aggregate")==0) //Fractal aggregate - 2 parameters 417 // NVAR FractalRadiusOfPriPart=root:Packages:Sizes:FractalRadiusOfPriPart //radius of primary particle418 421 ParticlePar1=Param1 419 // NVAR FractalDimension=root:Packages:Sizes:FractalDimension420 422 ParticlePar2=Param2 421 423 elseif(cmpstr(ShapeType,"Unified_Tube")==0) //Tube - 3 parameters 422 // NVAR TubeLength=root:Packages:Sizes:TubeLength //TubeLength423 424 ParticlePar1=Param1 424 // NVAR TubeWallThickness=root:Packages:Sizes:TubeWallThickness //WallThickness425 425 ParticlePar2=Param2 426 426 elseif(cmpstr(ShapeType,"CoreShellCylinder")==0) //Tube - 3 parameters 427 // NVAR TubeLength=root:Packages:Sizes:TubeLength //TubeLength428 427 ParticlePar1=Param1 429 // NVAR TubeWallThickness=root:Packages:Sizes:TubeWallThickness //WallThickness430 428 ParticlePar2=Param2 431 // NVAR TubeCoreContrastRatio=root:Packages:Sizes:TubeCoreContrastRatio //CoreContrastRatio432 429 ParticlePar3=Param3 433 430 ParticlePar4=Param4 … … 446 443 Duplicate/O G_matrixFF, $("G_matrix_"+num2str(DistNum)) //G_matrixFF (root:Packages:Sizes:G_matrixFF) contains form factor without contrast, except for Tube and Core shell... 447 444 Wave G_matrix=$("G_matrix_"+num2str(DistNum)) 448 if( cmpstr(ShapeType,"CoreShell")==0 || cmpstr(ShapeType,"CoreShellCylinder")==0)445 if(stringmatch(ShapeType,"CoreShell") || stringmatch(ShapeType,"CoreShellCylinder") || stringmatch(ShapeType,"Janus CoreShell Micelle*")) 449 446 G_matrix=G_matrixFF * 1e20 //this shape contains contrast already in... 450 447 else -
trunk/User Procedures/Irena/IR1_Sizes.ipf
r6 r38 1 1 #pragma rtGlobals=1 // Use modern global access method. 2 #pragma version = 2.0 72 #pragma version = 2.08 3 3 Constant IR1RSversionNumber=2.07 4 4 … … 10 10 //*************************************************************************/ 11 11 12 //2.08 Modified to handle only some of the form factors. This tool really should not handle Janus CoreShell Micelle. 12 13 //2.07 Added Scrolling buttons to move up down for small displays. 13 14 //2.06 Added ability to generate uncertainities for size distributions. Attempted to fix Regularization by forcing min values to be fraction of maximum of the dirttribution … … 373 374 NVAR ScatteringContrast=root:Packages:Sizes:ScatteringContrast 374 375 375 if(cmpstr(ShapeType,"CoreShell")==0 || cmpstr(ShapeType,"Tube")==0 )376 if(cmpstr(ShapeType,"CoreShell")==0 || cmpstr(ShapeType,"Tube")==0 || stringmatch(ShapeType,"Janus CoreShell Micelle*")) 376 377 G_matrix=G_matrixFF * 1e20 //this case the contrast is part of the calculations already... 377 378 else … … 2495 2496 string EUserLookup="r*:s*;" 2496 2497 IR2C_AddDataControls("Sizes","IR1R_SizesInputPanel","DSM_Int;M_DSM_Int;SMR_Int;M_SMR_Int;","",UserDataTypes,UserNameString,XUserLookup,EUserLookup, 0,0) 2498 //root:Packages:FormFactorCalc:ListOfFormFactorsSD 2497 2499 CheckBox ShowDiagnostics,pos={10,165},size={141,14},title="Diagnostics?", help={"Check to show extendend diagnostics during evaluation"} 2498 2500 CheckBox ShowDiagnostics,variable= root:Packages:Sizes:ShowDiagnostics … … 2535 2537 //shapes 2536 2538 PopupMenu ShapeModel,pos={10,418},size={223,21},proc=IR1R_PopMenuProc,title="Select particle shape model", help={"Particle shape models in the code. Set appropriate Aspect ratio. "} 2537 PopupMenu ShapeModel,mode=1,popvalue=root:Packages:Sizes:ShapeType,value= root:Packages:FormFactorCalc:ListOfFormFactors 2539 PopupMenu ShapeModel,mode=1,popvalue=root:Packages:Sizes:ShapeType,value= root:Packages:FormFactorCalc:ListOfFormFactorsSD 2538 2540 2539 2541 SetVariable AspectRatio,pos={10,444},size={140,16},title="Aspect Ratio ", help={"Aspect ratio for spheroids and other particles with AR"} -
trunk/User Procedures/Irena/IR2L_NLSQFCalc.ipf
r6 r38 1 1 #pragma rtGlobals=1 // Use modern global access method. 2 #pragma version=1.0 52 #pragma version=1.06 3 3 4 4 //*************************************************************************\ … … 8 8 //*************************************************************************/ 9 9 10 //1.05 fixed problem with calcualtions of peak positions 10 //1.06 added Janus CoreShell Micelle 11 //1.05 fixed problem with calculations of peak positions 11 12 //1.04 changed min size used by the tool to 1A. Lot of users seems to be using this at really high qs... 12 13 //1.03 Add Diffraction peak and Unified level as Populations, increase number of populations to 10 … … 704 705 //Wave G_matrix=$("G_matrix_"+num2str(DistNum)) 705 706 //here need to use copy of the G matrix, so we do not include contrast in it... 706 if(cmpstr(FormFactor,"CoreShell")==0 || cmpstr(FormFactor,"CoreShellCylinder")==0 || cmpstr(FormFactor,"CoreShellShell")==0 )707 if(cmpstr(FormFactor,"CoreShell")==0 || cmpstr(FormFactor,"CoreShellCylinder")==0 || cmpstr(FormFactor,"CoreShellShell")==0|| stringmatch(FormFactor,"Janus CoreShell Micelle*")) 707 708 MatrixOP/O GmatrixTemp = Gmatrix * 1e20 //this shape contains contrast already in... 708 709 else -
trunk/User Procedures/Irena/IR2L_NLSQFmain.ipf
r6 r38 1 1 #pragma rtGlobals=3 // Use modern global access method. 2 #pragma version=1.0 83 Constant IR2LversionNumber = 1.0 82 #pragma version=1.09 3 Constant IR2LversionNumber = 1.09 4 4 5 5 //*************************************************************************\ … … 9 9 //*************************************************************************/ 10 10 11 //1.09 added form and structure factor description as Igor help file with the buttons from the panel directly. 11 12 //1.08 added scroll buttons to move content up down for small displays. 12 13 //1.07 removed all font and font size from panel definitions to enable user control … … 226 227 PopupMenu FormFactorPop help={"Select form factor to be used for this population of scatterers"} 227 228 228 PopupMenu PopSizeDistShape title="Distribution type : ",proc=IR2L_PanelPopupControl, pos={190, 320}229 PopupMenu PopSizeDistShape title="Distribution type : ",proc=IR2L_PanelPopupControl, pos={190,295} 229 230 PopupMenu PopSizeDistShape mode=1, value="LogNormal;Gauss;LSW;Schulz-Zimm;" 230 231 PopupMenu PopSizeDistShape help={"Select Distribution type for this population"} 232 233 Button GetFFHelp,pos={320,320},size={80,15}, proc=IR2L_InputPanelButtonProc,title="F.F. Help", help={"Get help for Form factors"} 234 Button GetSFHelp,pos={320,468},size={80,15}, proc=IR2L_InputPanelButtonProc,title="S.F. Help", help={"Get Help for Structure factor"} 231 235 232 236 // Unified controls … … 279 283 SetVariable UF_RGCOMax,pos={290,435},size={80,15},title="Max ", help={"High limit for P"} 280 284 281 PopupMenu KFactor,pos={2 50,455},size={170,21},proc=IR2L_PanelPopupControl,title="k factor :"285 PopupMenu KFactor,pos={240,452},size={170,15},proc=IR2L_PanelPopupControl,title="k factor :" 282 286 PopupMenu KFactor,mode=2,popvalue="1",value= #"\"1;1.06;\"", help={"This value is usually 1, for weak decays and mass fractals 1.06"} 283 287 … … 421 425 // CheckBox UseInterference,pos={40,435},size={25,16},proc=IR2L_ModelTabCheckboxProc,title="Use Structure factor?" 422 426 // CheckBox UseInterference,variable= root:Packages:IR2L_NLSQF:UseInterference_pop1, help={"Check to use structure factor"} 423 PopupMenu StructureFactorModel title="Structure Factor : ",proc=IR2L_PanelPopupControl, pos={10,46 5}427 PopupMenu StructureFactorModel title="Structure Factor : ",proc=IR2L_PanelPopupControl, pos={10,468} 424 428 PopupMenu StructureFactorModel value=#"(root:Packages:StructureFactorCalc:ListOfStructureFactors)" 425 429 SVAR StrA=root:Packages:IR2L_NLSQF:StructureFactor_pop1 -
trunk/User Procedures/Irena/IR2L_NLSQFsupport.ipf
r10 r38 1 1 #pragma rtGlobals=1 // Use modern global access method. 2 #pragma version=1.1 32 #pragma version=1.15 3 3 4 4 //*************************************************************************\ … … 8 8 //*************************************************************************/ 9 9 10 //1.13 modified data stored in wavenote to minimize stuff saved there. 10 //1.15 added Form and Structrue factor description as Igor help file. Added buttons to call the help file from GUI. 11 //1.14 Modified to handle Janus CoreShell Micelle FF 12 //1.13 modified data stored in wavenote to minimize stuff saved there. 11 13 //1.12 removed exp[ress calls to font and fsize for panels to enable user controls over these parameters 12 14 //1.11 Modifed local Guinier and Power law fits to handle multiple contrasts for data when using multiple input data sets. … … 167 169 endif 168 170 endif 171 172 if(stringmatch(ctrlName,"GetFFHelp")) 173 ControlInfo /W=LSQF2_MainPanel FormFactorPop 174 //print S_Value 175 DisplayHelpTopic /Z "Form Factors & Structure factors["+S_Value+"]" 176 if(V_Flag) 177 DisplayHelpTopic /Z "Form Factors & Structure factors" 178 endif 179 endif 180 if(stringmatch(ctrlName,"GetSFHelp")) 181 ControlInfo /W=LSQF2_MainPanel StructureFactorModel 182 //print S_Value 183 DisplayHelpTopic /Z "Form Factors & Structure factors["+S_Value+"]" 184 if(V_Flag) 185 DisplayHelpTopic /Z "Form Factors & Structure factors" 186 endif 187 endif 188 169 189 if(stringmatch(ctrlName,"FitRgandG")) 170 190 ControlInfo/W=LSQF2_MainPanel DistTabs … … 1042 1062 F_sw=3 //unused yet. 1043 1063 endif 1044 if(stringmatch(FormFactor, "CoreShell*") )1064 if(stringmatch(FormFactor, "CoreShell*") || stringmatch(FormFactor, "Janus CoreShell Micelle*")) 1045 1065 CS_sw=0 1046 1066 else … … 1076 1096 1077 1097 Execute("PopupMenu FormFactorPop,win=LSQF2_MainPanel, mode=(WhichListItem(root:Packages:IR2L_NLSQF:FormFactor_pop"+num2str(tab+1)+",root:Packages:FormFactorCalc:ListOfFormFactors+\"Unified_Level;\")+1), disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(UsePop)+")") 1098 Execute("Button GetFFHelp,win=LSQF2_MainPanel, disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(UsePop)+")") 1078 1099 1079 1100 Execute("PopupMenu PopSizeDistShape,win=LSQF2_MainPanel, mode=(WhichListItem(root:Packages:IR2L_NLSQF:PopSizeDistShape_pop"+num2str(tab+1)+",\"LogNormal;Gauss;LSW;Schulz-Zimm;\")+1), disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(F_sw==1)+"|| !"+num2str(UsePop)+")") … … 1230 1251 SVAR StrB=root:Packages:StructureFactorCalc:ListOfStructureFactors 1231 1252 Execute("PopupMenu StructureFactorModel win=LSQF2_MainPanel, mode=WhichListItem(\""+StrA+"\",\""+StrB+"\" )+1, disable=(!"+num2str(DisplayModelControls)+"||! "+num2str(F_sw<=1)+"|| !"+num2str(UsePop)+")") 1253 Execute("Button GetSFHelp win=LSQF2_MainPanel, disable=(!"+num2str(DisplayModelControls)+"||! "+num2str(F_sw<=1)+"|| !"+num2str(UsePop)+")") 1232 1254 //contrasts 1233 1255 Execute("SetVariable Contrast,win=LSQF2_MainPanel,variable= root:Packages:IR2L_NLSQF:Contrast_pop"+num2str(tab+1)+", disable=(!"+num2str(DisplayModelControls)+"|| !"+num2str(CS_sw)+"|| !"+num2str(UsePop)+"|| !"+num2str(!SameContr || !MID)+")") -
trunk/User Procedures/Irena/Modification history.txt
r32 r38 6 6 2.52 xxxx 7 7 Control Procedures - fixed failure to work for qrs waves when folder name contained []. 8 Form factors/Modeling II - Added Janus CoreShell micelles form factor. 9 Form factors - removed algebraic form factors. Useless, use Unified ones if needed. 10 Form/Structure factors - created Igor help file with the description. Added call buttons from Modeling II GUI. Needs to be finished on Sizes. 8 11 9 12
Note: See TracChangeset
for help on using the changeset viewer.