Changeset 38


Ignore:
Timestamp:
Apr 16, 2013 3:02:17 PM (9 years ago)
Author:
ilavsky
Message:

Added Janus Micelle as form factor and converted Form factor and Structure factor description to Igor help file. Added buttons to Modeling II and main menu to open this if available.

Location:
trunk/User Procedures/Irena
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/User Procedures/Irena/IR1_FormFactors.ipf

    r33 r38  
    11#pragma rtGlobals=1             // Use modern global access method.
    2 #pragma version=2.18
     2#pragma version=2.20
    33
    44
     
    1717//2.17 changed old obsolete BessJ into Besselj - newer implementation in Igor Pro
    1818//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.
    1921
    2022//this is utility package providing various form factors to be used by Standard model package and Sizes
     
    7274// it is text function...
    7375
     76static constant JanusCoreShellMicNumIngtPnts=66         //weird, with 40 there are specific radii where code fails to produces NaN
     77
    7478Function IR1T_InitFormFactors()
    7579        //here we initialize the form factor calculations
     
    7983        NewDataFolder/O/S root:Packages:FormFactorCalc
    8084       
    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;"
    8488        string/g CoreShellVolumeDefinition
    8589        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...
     
    100104Function IR2T_LoadFFDescription()
    101105
     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
    102110                string WhereIsManual
    103111                string WhereAreProcedures=RemoveEnding(FunctionPath(""),"IR1_FormFactors.ipf")
    104112                String manualPath = ParseFilePath(5,"FormFactorList.pdf","*",0,0)
    105113        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\""
    113132                endif
    114 
    115         else
    116                 //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=NewBatchFile
    121                 Notebook NewBatchFile, text=whereIsManual//+"\r"
    122                 SaveNotebook/O NewBatchFile as SpecialDirPath("Temporary", 0, 1, 0 )+"StartFormFactors.bat"
    123                 DoWindow/K NewBatchFile
    124                 ExecuteScriptText "\""+SpecialDirPath("Temporary", 0, 1, 0 )+"StartFormFactors.bat\""
    125133        endif
    126134end
     
    193201                //                                              Shell1Rho=ParticlePar5                  // rho for shell 1 material
    194202                //                                              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               
    195217                //Fractal aggregate             FractalRadiusOfPriPart=ParticlePar1=root:Packages:Sizes:FractalRadiusOfPriPart  //radius of primary particle
    196218                //                                              FractalDimension=ParticlePar2=root:Packages:Sizes:FractalDimension                      //Fractal dimension
     
    255277                        endif
    256278                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)
    258280                        if(cmpstr(StringByKey("R_"+num2str(i), OldNote),num2str(R_dist[i]))!=0 )                //check every 5th R value written in wave note
    259281                                Recalculate=1
     
    271293                        variable FractalDimension, thickness
    272294                        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
    274296                        variable CoreContrastRatio, CoreShell_1_Thickness, CoreShell_2_Thickness, Shell1Rho, Shell2Rho, SolventRho, CoreRho
    275297                       
     
    490512                                        Gmatrix[][i]=TempWave[p]                                                                //and here put it into G wave
    491513                                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                                                                                     
    494521                                For (i=0;i<N;i+=1)                                                                                      //calculate the G matrix in columns!!!
    495522                                        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
    503525                                        Gmatrix[][i]=TempWave[p]                                                                //and here put it into G wave
    504526                                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                                                                                     
    507534                                For (i=0;i<N;i+=1)                                                                                      //calculate the G matrix in columns!!!
    508535                                        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
    518538                                        Gmatrix[][i]=TempWave[p]                                                                //and here put it into G wave
    519539                                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
    556605                else
    557606                        Gmatrix[][]=NaN         
     
    591640
    592641
    593 //*****************************************************************************************************************
    594 //*****************************************************************************************************************
    595 //*****************************************************************************************************************
    596 //*****************************************************************************************************************
    597 //*****************************************************************************************************************
    598 
    599 //*****************************************************************************************************************
    600 //*****************************************************************************************************************
    601 //*****************************************************************************************************************
    602 //*****************************************************************************************************************
    603 //*****************************************************************************************************************
    604 //*****************************************************************************************************************
    605 //*****************************************************************************************************************
    606 //*****************************************************************************************************************
    607 //*****************************************************************************************************************
    608 //*****************************************************************************************************************
    609 //*****************************************************************************************************************
    610642//*****************************************************************************************************************
    611643//*****************************************************************************************************************
     
    18831915        //need to disable usused fitting parameters so the code which is using this package does not have to contain list of form factors...
    18841916       
    1885         //go through all form factors knwon and set the ones unsused to zeroes...
     1917        //go through all form factors known and set the ones unsused to zeroes...
    18861918        if(stringmatch(CurFF,"Unified_Sphere")||stringmatch(CurFF,"NoFF_setTo1"))                       //no parameters at all...
    18871919                FitP1=0
     
    19161948        elseif(stringmatch(CurFF,"CoreShellCylinder"))
    19171949       
     1950        elseif(stringmatch(CurFF,"Janus CoreShell Micelle 1"))
     1951       
     1952        elseif(stringmatch(CurFF,"Janus CoreShell Micelle 2"))
     1953       
    19181954        elseif(stringmatch(CurFF,"User"))
    19191955       
    19201956        elseif(stringmatch(CurFF,"Integreated_Spheroid"))
    1921                 FitP2=0
    1922                 FitP3=0
    1923                 FitP4=0
    1924                 FitP5=0
    1925         elseif(stringmatch(CurFF,"Algebraic_*"))
    19261957                FitP2=0
    19271958                FitP3=0
     
    19902021        //Algebraic_Rods                        AspectRatio = ParticlePar1, AR > 10
    19912022        //Algebraic_Disks                       AspectRatio = ParticlePar1, AR < 0.1
    1992 //first variable......
     2023        //first variable......
    19932024        NVAR/Z CurVal= $(P1Str)
    19942025        if(!NVAR_Exists(CurVal))
     
    20322063        elseif(stringmatch(CurrentFF,"Fractal aggregate"))
    20332064                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"}
    20342069        endif
    20352070
     
    20642099        endif
    20652100
    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...)
    20682103                NVAR/Z CurVal= $(FitP2Str)
    20692104                NVAR/Z CurVal2= $(LowP2Str)
     
    21192154                        SetVariable P2Value, title="Core Rho = ", help={"Scattering length density of core"}
    21202155                        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"}                 
    21232157                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*"))
    21252159                        //add fifth set of values...
    21262160                        NVAR/Z CurVal= $(FitP5Str)
     
    21522186               
    21532187                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"))
    21552199                //User                                  uses user provided functions. There are two userprovided fucntions necessary - F(q,R,par1,par2,par3,par4,par5)
    21562200                //                                              and V(R,par1,par2,par3,par4,par5)
     
    28182862//*****************************************************************************************************************
    28192863//*****************************************************************************************************************
    2820 //*****************************************************************************************************************
     2864//                      Janus coreshell Micelle functions...
     2865//*****************************************************************************************************************
     2866threadsafe 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)
     2887end
     2888//*****************************************************************************************************************
     2889//*****************************************************************************************************************
     2890threadsafe 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)     
     2901end
     2902//*****************************************************************************************************************
     2903//*****************************************************************************************************************
     2904threadsafe 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)
     2910end
     2911//*****************************************************************************************************************
     2912//*****************************************************************************************************************
     2913threadsafe 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)
     2919end
     2920//*****************************************************************************************************************
     2921//*****************************************************************************************************************
     2922threadsafe 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   
     2928end
     2929//*****************************************************************************************************************
     2930//*****************************************************************************************************************
     2931threadsafe 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)     
     2934end
     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  
    407407                ParticlePar4=UserPar4
    408408                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
    409415        elseif(cmpstr(ShapeType,"CoreShell")==0)                                //CoreShell - 2 parameters
    410         //      NVAR CoreShellThicknessRatio=root:Packages:Sizes:CoreShellThicknessRatio        //radius of primary particle
    411416                ParticlePar1=Param1
    412         //      NVAR CoreShellContrastRatio=root:Packages:Sizes:CoreShellContrastRatio 
    413417                ParticlePar2=Param2     
    414418                ParticlePar3=Param3     
    415419                ParticlePar4=Param4     
    416420        elseif(cmpstr(ShapeType,"Fractal aggregate")==0)                                //Fractal aggregate - 2 parameters
    417         //      NVAR FractalRadiusOfPriPart=root:Packages:Sizes:FractalRadiusOfPriPart  //radius of primary particle
    418421                ParticlePar1=Param1
    419         //      NVAR FractalDimension=root:Packages:Sizes:FractalDimension     
    420422                ParticlePar2=Param2     
    421423        elseif(cmpstr(ShapeType,"Unified_Tube")==0)                             //Tube - 3 parameters
    422         //      NVAR TubeLength=root:Packages:Sizes:TubeLength                  //TubeLength
    423424                ParticlePar1=Param1
    424         //      NVAR TubeWallThickness=root:Packages:Sizes:TubeWallThickness            //WallThickness
    425425                ParticlePar2=Param2     
    426426        elseif(cmpstr(ShapeType,"CoreShellCylinder")==0)                                //Tube - 3 parameters
    427         //      NVAR TubeLength=root:Packages:Sizes:TubeLength                  //TubeLength
    428427                ParticlePar1=Param1
    429         //      NVAR TubeWallThickness=root:Packages:Sizes:TubeWallThickness            //WallThickness
    430428                ParticlePar2=Param2     
    431         //      NVAR TubeCoreContrastRatio=root:Packages:Sizes:TubeCoreContrastRatio            //CoreContrastRatio
    432429                ParticlePar3=Param3     
    433430                ParticlePar4=Param4     
     
    446443        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... 
    447444        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*"))
    449446                G_matrix=G_matrixFF * 1e20                      //this shape contains contrast already in...
    450447        else
  • trunk/User Procedures/Irena/IR1_Sizes.ipf

    r6 r38  
    11#pragma rtGlobals=1             // Use modern global access method.
    2 #pragma version = 2.07
     2#pragma version = 2.08
    33Constant IR1RSversionNumber=2.07
    44
     
    1010//*************************************************************************/
    1111
     12//2.08 Modified to handle only some of the form factors. This tool really should not handle Janus CoreShell Micelle.
    1213//2.07 Added Scrolling buttons to move up down for small displays.
    1314//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
     
    373374        NVAR ScatteringContrast=root:Packages:Sizes:ScatteringContrast
    374375       
    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*"))       
    376377                G_matrix=G_matrixFF * 1e20              //this case the contrast is part of the calculations already...
    377378        else
     
    24952496        string EUserLookup="r*:s*;"
    24962497        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
    24972499        CheckBox ShowDiagnostics,pos={10,165},size={141,14},title="Diagnostics?", help={"Check to show extendend diagnostics during evaluation"}
    24982500        CheckBox ShowDiagnostics,variable= root:Packages:Sizes:ShowDiagnostics
     
    25352537//shapes
    25362538        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
    25382540
    25392541        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  
    11#pragma rtGlobals=1             // Use modern global access method.
    2 #pragma version=1.05
     2#pragma version=1.06
    33
    44//*************************************************************************\
     
    88//*************************************************************************/
    99
    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
    1112//1.04 changed min size used by the tool to 1A. Lot of users seems to be using this at really high qs...
    1213//1.03 Add Diffraction peak and Unified level as Populations, increase number of populations to 10
     
    704705                //Wave G_matrix=$("G_matrix_"+num2str(DistNum))
    705706                //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*"))
    707708                        MatrixOP/O GmatrixTemp = Gmatrix * 1e20                 //this shape contains contrast already in...
    708709                else
  • trunk/User Procedures/Irena/IR2L_NLSQFmain.ipf

    r6 r38  
    11#pragma rtGlobals=3             // Use modern global access method.
    2 #pragma version=1.08
    3 Constant IR2LversionNumber = 1.08
     2#pragma version=1.09
     3Constant IR2LversionNumber = 1.09
    44
    55//*************************************************************************\
     
    99//*************************************************************************/
    1010
     11//1.09 added form and structure factor description as Igor help file with the buttons from the panel directly.
    1112//1.08 added scroll buttons to move content up down for small displays.
    1213//1.07 removed all font and font size from panel definitions to enable user control
     
    226227                PopupMenu FormFactorPop help={"Select form factor to be used for this population of scatterers"}
    227228
    228                 PopupMenu PopSizeDistShape title="Distribution type : ",proc=IR2L_PanelPopupControl, pos={190,320}
     229                PopupMenu PopSizeDistShape title="Distribution type : ",proc=IR2L_PanelPopupControl, pos={190,295}
    229230                PopupMenu PopSizeDistShape mode=1, value="LogNormal;Gauss;LSW;Schulz-Zimm;"
    230231                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"}
    231235
    232236// Unified controls
     
    279283                SetVariable UF_RGCOMax,pos={290,435},size={80,15},title="Max ", help={"High limit for P"}
    280284
    281                 PopupMenu KFactor,pos={250,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 :"
    282286                PopupMenu KFactor,mode=2,popvalue="1",value= #"\"1;1.06;\"", help={"This value is usually 1, for weak decays and mass fractals 1.06"}
    283287
     
    421425//              CheckBox UseInterference,pos={40,435},size={25,16},proc=IR2L_ModelTabCheckboxProc,title="Use Structure factor?"
    422426//              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,465}
     427                PopupMenu StructureFactorModel title="Structure Factor : ",proc=IR2L_PanelPopupControl, pos={10,468}
    424428                PopupMenu StructureFactorModel value=#"(root:Packages:StructureFactorCalc:ListOfStructureFactors)"
    425429                SVAR StrA=root:Packages:IR2L_NLSQF:StructureFactor_pop1
  • trunk/User Procedures/Irena/IR2L_NLSQFsupport.ipf

    r10 r38  
    11#pragma rtGlobals=1             // Use modern global access method.
    2 #pragma version=1.13
     2#pragma version=1.15
    33
    44//*************************************************************************\
     
    88//*************************************************************************/
    99
    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.
    1113//1.12 removed exp[ress calls to font and fsize for panels to enable user controls over these parameters
    1214//1.11 Modifed local Guinier and Power law fits to handle multiple contrasts for data when using multiple input data sets.
     
    167169                endif
    168170        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
    169189        if(stringmatch(ctrlName,"FitRgandG"))
    170190                ControlInfo/W=LSQF2_MainPanel DistTabs
     
    10421062                F_sw=3          //unused yet.
    10431063        endif
    1044         if(stringmatch(FormFactor, "CoreShell*"))
     1064        if(stringmatch(FormFactor, "CoreShell*") || stringmatch(FormFactor, "Janus CoreShell Micelle*"))
    10451065                CS_sw=0
    10461066        else
     
    10761096
    10771097                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)+")")
    10781099
    10791100                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)+")")
     
    12301251                SVAR StrB=root:Packages:StructureFactorCalc:ListOfStructureFactors
    12311252                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)+")")
    12321254                //contrasts
    12331255                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  
    662.52 xxxx
    77Control Procedures - fixed failure to work for qrs waves when folder name contained [].
     8Form factors/Modeling II - Added Janus CoreShell micelles form factor.
     9Form factors - removed algebraic form factors. Useless, use Unified ones if needed.
     10Form/Structure factors - created Igor help file with the description. Added call buttons from Modeling II GUI. Needs to be finished on Sizes.
    811
    912
Note: See TracChangeset for help on using the changeset viewer.