Hamaker 2.1

download Hamaker 2.1

of 22

Transcript of Hamaker 2.1

  • 7/30/2019 Hamaker 2.1

    1/22

    1

    Hamaker2.1

    Acolloidalstabilitytoolkit

    May2010

    UliAschauer

    Laboratoiredetechnologiedespoudres

    EcolepolytechniquefdraledeLausanne

    Lausanne,Switzerland

    ChemistryDepartment

    PrincetonUniversity

    Princeton,USA

  • 7/30/2019 Hamaker 2.1

    2/22

    2

    TableofContentsIntroduction................................................................................................................................................... 3

    Howtocite.................................................................................................................................................... 3

    Theinterface................................................................................................................................................. 3

    Menus........................................................................................................................................................ 4

    Doubleclickfilestoopen...................................................................................................................... 4Controllingtheplot................................................................................................................................... 5

    Theplotpane............................................................................................................................................. 5

    Creatingandmodifyingseries................................................................................................................... 6

    Theoreticalbackground................................................................................................................................. 9

    Interactioncalculations............................................................................................................................. 9

    Stabilityevaluation.................................................................................................................................... 9

    Thebuiltinmodels...................................................................................................................................... 11

    Dispersion(vdW)..................................................................................................................................... 11

    Hamaker.............................................................................................................................................. 11

    Gregory................................................................................................................................................ 11

    Vincent................................................................................................................................................ 11

    Effective............................................................................................................................................... 12

    Electrostatic............................................................................................................................................. 12

    HHF...................................................................................................................................................... 12

    LSA....................................................................................................................................................... 12

    Steric........................................................................................................................................................ 13

    Bergstrom............................................................................................................................................ 13

    Writingpluginmodels................................................................................................................................ 14

    Setupyourenvironment......................................................................................................................... 14

    Implementtheinteractionfunctions...................................................................................................... 14

    Compiletheplugin.................................................................................................................................. 17

    Contact........................................................................................................................................................ 18

    Annex........................................................................................................................................................... 19Annex1:Exceldataformat..................................................................................................................... 19

    Annex2:APIdefinition............................................................................................................................ 20

    hamaker2.Serie................................................................................................................................... 20

    hamaker2.Particle............................................................................................................................... 20

    hamaker2.Medium.............................................................................................................................. 20

    Versionhistory............................................................................................................................................ 21

    Version2.0.0............................................................................................................................................ 21

    Version2.1.0............................................................................................................................................ 21

    Version2.1.1............................................................................................................................................ 21

    References................................................................................................................................................... 22

  • 7/30/2019 Hamaker 2.1

    3/22

    3

    IntroductionHamaker2.0isaprogramforthepredictionofthecolloidalstabilityofsuspensions.Itallowsthestudyof

    interactionbetweendissimilarparticlesasa functionofanyvariableofthesystem,thereforeenabling

    scientistsandengineerstounderstandwhataspectscontrolthestability(orinstability)oftheirsystemsandhowtoachievetherequireddegreeofstability.

    HowtociteAnarticlefeaturingHamaker2iscurrentlyinpress.Pleaseciteasfollows:

    U.Aschauer;O.BurgosMontes;R.Moreno;P.Bowen,JournalofDispersionScienceandTechnology in

    Press

    Please check backwith the author ([email protected]) for the latest status of this paper prior to

    submittingyourworkwiththeabovecitation.

    TheinterfaceAfter double clicking the Hamaker2 application, you will see themain window. The Hamaker 2.0

    windowisdividedintothreemainparts(Figure1).Inthetopmostpartonecontrolstheplotdisplayand

    axes.Below follows theplottingpanewhere the graphicsaredisplayed (andmanipulated for the3D

    case).Thebottommostpartfinallyallowstocontrolthedifferentseriestodisplay.ContrarytoHamaker

    1.xitisnowpossibletocontrolallaspectsofthesystemforeachoftheseries.

    Figure1:TheHamaker2.0mainwindow

  • 7/30/2019 Hamaker 2.1

    4/22

    4

    Menus

    For themomentHamaker2.0 ismostlycontrolled troughelements in themainwindowand contains

    onlyonemenuwiththemostessentialitems(Figure2).

    Figure2:The"File"menu Openallows reopeningapreviouslysaved.ham2 file.Thesamecanalsobeachievedby

    doubleclickinga.ham2file(seebelow).

    Savewillsavethecurrentlyopen filetodisk. Ifno locationhasbeenspecified(bypreviouslysavingtodiskoropeningfromdisk),apromptforthelocationwillappear.

    Saveaswill save thecurrentlyopen file todiskaswell,however the locationpromptwillappearinanycase,allowingtosavetoadifferentlocation(i.e.preventingapreviousversionof

    the filefrombeingoverwritten).

    Exportwillsavethefile inadifferent format,readablebyanotherapplication.Thefollowingchoicesareavailable:

    o Excel:Savesthedatainatabseparatedtextformat,whichcanbereadusingMicrosoftExcel.Thedataformatcanbefoundintheannex.

    QuitwillterminateHamaker2.0.Incasethereareunsavedchangedyouwillbepromptedtosaveyourdocument.

    Doubleclick

    files

    to

    open

    Inordertoopen.ham2filesbydoubleclickingthem,the.ham2filetypehastobeassociatedwith

    theHamaker2.exeapplication.Thisstepisoperatingsystemdependent.

    OnMicrosoftWindows:Rightclickthe.ham2 fileandchooseOpenwith fromthepopupmenu.ThenbrowsefortheHamaker2.exeapplicationonyourharddriveandselecttheAlways

    usetheselectedprogramtoopenthiskindoffilecheckbox.

    OnMacOSX:Right click the .ham2 fileand choose Get Info.Under OpenWith: selectOther thenbrowse to theHamaker2.appapplicationon yourharddriveand then click the

    ChangeAllbutton.

    OnLinux:Windowsystemdependent.Pleaseconsultyoursystemsmanualfordetails.

    Nowyoucanopen.ham2filesbydoubleclickingthefile.

  • 7/30/2019 Hamaker 2.1

    5/22

    5

    Controllingtheplot

    Theplotappearancecanbecontrolledinthefollowingpanel(Figure3).

    Figure3:TheplotcontrolpanelThefollowingoptionsareavailable:

    Plottype:o 2D:plotstheinteractionpotentialasafunctionofasinglevariable(specifiedusingthe

    pulldownmenuVariable1,seebelow).

    o 3D:plotstheinteractionpotentialasafunctionoftwovariables(specifiedbythetwopulldownmenusVariable1andVariable2respectively)asasurface.

    o Potential:plotstheinteractionpotentialontheyaxis(normalizedbykT)o

    Force:plotsthe force (firstderivativeofthepotentialwith respecttoseparation)ontheyaxis(normalizedbykT/nm)

    Variable1:The (primary)plotvariable. Incaseofa2Dplot the interactionpotentialwillbeplottedasafunctionofthisvariable.Incaseofa3Dplotthisvariablewillbethefirstcoordinate

    axis.

    o Range:givestherangeofthefirstvariable,whichwillbecalculated. Variable2:Thesecondaryplotvariable.Onlyactiveincasea3Dplotisselected.

    o Range:givestherangeofthesecondvariable. Interactionaxis:givestherangeof the interactionpotentialtobedisplayed.Usethistocap

    theplotandnottodisplayverylargevalues(interactionminima).

    Theplotpane

    Theplotpaneiswherethecurrentlyactiveplotisdisplayed(andmodifiedinthecaseofa3Dplot).

    Figure4:Exampleofa2Dand3DplotA2DplotshowstheinteractionpotentialasafunctionoftheselectedVariable1inthegivenrange.A

    3Dplot shows the interactionpotentialasa functionorVariable1andVariable2 in the selected

    rangesrespectively.Inthecaseofa3Dplotthefollowingactionscanmodifythewaytheplotisviewed:

  • 7/30/2019 Hamaker 2.1

    6/22

    6

    Dragleftmousebutton:Translatethegraphinthewindow Drag rightmouse button: Rotate the graph. The rotation is done using trackballmode. This

    meansthatwhendragginginthecenterofthescreenthegraphwillberotatedaroundthetwo

    axeslyinginthescreenplanewhereasclosetothebordersofthescreenarotationaroundthe

    axisnormaltothescreenwillbeperformed.

    Mousewheel:Zoominoroutofthegraph.Creatingandmodifyingseries

    Seriesarecreatedandmodifiedinthebottommostsectionofthewindow(Figure5).

    Figure5:Theseriespane ThepopupmenuSeriecontrolsonwhichoftheseriesthemodificationswillbeapplied. ByclickingtheAddbuttonyoucanaddanewserie.Thenewseriewillbeplacedattheend

    andbenamedUntitledSerieNwhereNisaconsecutivenumber.

    TheDuplicatebuttoncreatesacopyofthecurrentlyactiveserie.ThenewseriewillbenamesCopyofXwhereXisthenameofthecurrentlyactiveserie.

    TheDeletebutton isonlyactivewhenmorethanoneserieexist.Itwillremovethecurrentlyactiveserie.

    Theboxbelowcontainsallparametersaboutaserie,whichcanbechanged.

    Name:thenameusedtoidentifytheserieasitwillbedisplayedintheSeries:popupmenuandintheoutputfiles.

    Visible:controlsiftheserieisdisplayedornot. Color:Dependingonthetypeoftheplotthisparametercontrols:

    o 2D:thelinecoloroftheploto 3D:thesurfacecoloroftheplot

    Grid:hasaneffectonlyinthe3Dplot.Willchangethecolorofthelinegriddisplayedontopofthesurface.

    Dispersion:willcontrolwhichdispersionmodelisused.Foradescriptionofthebuiltinmodelssee below. Plugin models should provide their own documentation. If a model requires

    additionalparameters,thesecanbeaccessedusingtheParametersbutton.

  • 7/30/2019 Hamaker 2.1

    7/22

    7

    Electrostatic:will controlwhichelectrostaticmodel isused.Foradescriptionof thebuiltinmodelsseebelow.Pluginmodelsshouldprovidetheirowndocumentation.Ifamodelrequires

    additionalparameters,thesecanbeaccessedusingtheParametersbutton.

    Steric:will controlwhich stericmodel is used. For a description of the builtinmodels seebelow.Pluginmodelsshouldprovidetheirowndocumentation. Ifamodelrequiresadditional

    parameters,thesecanbeaccessedusingtheParametersbutton.

    Misc: gives the possibility to include interaction potentials, which are not of dispersion,electrostaticorstericnature(i.e.magneticinteraction).Therearenobuiltinmodelsofthiskind,

    onlypluginswillshowup.ClickingtheDefinebuttonwillshowthefollowingdialog(Figure

    6).

    Figure6:The"misc"dialogOn the left theavailablemodelsaredisplayed.Uponselecting them theycanbeactivated (by

    checking the Active box) or deactivated and if they require additional parameters, the

    AdditionalParameterscanbeclickedtosetthese. Stability will allow setting the parameters for the stability calculation using the following

    dialog(Figure7).

    Figure7:ThestabilitycalculationdialogThe concentrations of particles of type 1 and 2 (for a binary system) are given inwt. %

    calculatedaccordingto:

    powder

    w

    medium

    mc

    m (1)

    Timedefinesthetime forwhich thesuspensionshouldremainstable.ViscousDrag finallyallows selecting a calculationmodel including viscous drag (not implemented yet). Formore

    detailonthestabilitycalculationsseefurtherdown.

  • 7/30/2019 Hamaker 2.1

    8/22

    8

    TheShow inplotboxcontrols if the stability line isdisplayed in theplot (samecoloras theseriebutdashed).

    Required barrier is the value of the interaction potential barrier required to preventagglomerationinthespecifiedsystemforthespecifiedtime.

    Constant distance is the distance to be used for interaction potential calculations in casedistanceisnotselectedasaplotvariable.

    ThetemperatureofthesystemisgivenbyTemperature. The Medium button allows defining the properties of the suspension medium using the

    followingdialog(Figure8).

    Figure8:ThedialogtodefinethesuspensionmediumDensitydefinesthedensityofthe fluidmediumandDielectricConstantgives itsdielectricconstant. The table below controls the contents of the system. Species may be added and

    removedusing theAddandDeletebuttons.EachentryhasaLabelwhich is foreaseof

    identificationonly.TheValencegives the specieschargewhereas theConcentrationgives

    themolarconcentrationofthespecies.

    The Particle

    1

    Defineand Particle

    2

    Definebuttonsallowdefining theparticles in the

    systemusingthefollowingdialog().Pleasenotethatthebuttonforparticle2isonlyactiveifthe

    HeterogeneousSystemboxisticked.

    Figure9:ThedialogtodefineparticlepropertiesParameterstobegivenaretheHamakerConstant,theDensity,theParticleDiameter,theZetaPotentialaswellas the ZetaPotentialPlanewhich is thedistance from the surfacewherethezetapotentialismeasured.TheListbuttonallowsyoutoselecttheoftenhardto

    findHamakerconstantsfromawebbasedrepository.

  • 7/30/2019 Hamaker 2.1

    9/22

    9

    Theoreticalbackground

    Interactioncalculations

    Hamaker2.0calculatestheinterparticleinteractionwithintheDerjaguin,Landau,VerweyandOverbeck

    (DLVO) model, adding contributions for interactions other than van der Waals and electrostatic

    interaction such as steric interaction models and others. The basic equation describing the total

    interparticleinteractionVinHamaker2.0isasfollows:

    vdW electrostat steric miscV V V V V (2)

    VvdW,VelectrostatandVstericbeing thecontributionsof theattractivevanderWaals, theelectrostaticand

    steric interactions respectively.Thesumover theVmisc interactionsallowsaddingacollectionofother

    interactions depending on the system in question. For example one could addmagnetic interaction

    forcesforparticlesexhibitingthisproperty.

    Stability

    evaluation

    ThestabilityofacolloidalsuspensionisevaluatedaccordingtothemodelpublishedbyIsraelachvili[1].

    AparticleofdiameterdanddensitypinasuspensionattemperatureTwillhaveameanBrownian

    velocitygivenby:

    3

    2 2

    3

    1 1 4 12

    2 2 3 2p

    p

    d kTmv v kT v

    d

    (3)

    Wherek istheBoltzmannconstant.Atagivensuspensionconcentrationc(inwt.%s/l)thenumberof

    particlesperunitvolumeNpisgivenasafunctionofthedensitiesoftheparticlespandthemediumm

    aswellastheparticlediameterdbydividingthetotalmassofallparticlesmpTbythemassofasingle

    particlemp.

    3

    100

    4

    3 2

    mpT

    p

    p

    p

    cm

    Nm d

    (4)

    Forabinary system thenumberofparticlesperunit volume isgivenby the sumof the twoparticle

    contributions:

    ,1 ,2p p pN N N (5)

    ThenumberofparticlesalongoneedgeoftheunitvolumeisgivenbythecubicrootofNp,theinverseof

    which finallygivesthespacingbetweentwoparticlesalong theedge.This isconsideredastheclosest

    interparticlespacingdatequilibrium.

  • 7/30/2019 Hamaker 2.1

    10/22

    10

    3

    1

    p

    dN

    (6)

    Inorder for twoparticles tocollide, theparticlehas to travel the interparticledistancedwhichas its

    meanBrownianvelocityvwillrequireatimet,thusthetimebetweencollisions.Thecollisionfrequency

    fcisthengivenbytheinverseoft.

    1c

    vf

    t d

    (7)

    Whereforabinarysystemthemeanvelocityisconsidered:

    1 21

    2v v v (8)

    Theprobabilitypoftwoparticleshavingakineticenergyallowingthemtoovercomeanenergybarrier

    Wisgivenby

    expW

    pkT

    (9)

    kbeingtheBoltzmannconstantandTthetemperature.Withinatimet,tfccollisionswilloccur,which

    meansthatfornoneofthesecollisionsbeingenergeticenoughtoovercomethebarrier is,aminimum

    valueforWinordertoavoidenergeticcollisionsandthusagglomerationcanbecalculatedas:

    min

    1ln

    c

    W

    kT t f

    (10)

  • 7/30/2019 Hamaker 2.1

    11/22

    11

    Thebuiltinmodels

    Dispersion(vdW)

    Theusercan choose from the classicalunretarded interactionmodelbyHamaker [2]or the retarded

    models byGregory [3] andVincent [4]. In allmodelsAH,eff is the effectiveHamaker constant for the

    system,histheparticlesurfacesurfaceseparationanda1anda2aretheparticleradiirespectively.

    Hamaker

    1 2 1 2

    2 2

    1 2 1 2 1 2,

    2

    1 2

    2

    1 2 1 2

    2 2

    2 2 2 2 4

    6 2 2ln

    2 2 4

    H eff

    ham

    a a a a

    h a h a h h a h a h a aAV h

    h a h a h

    h a h a h a a

    (11)

    Gregory

    , 1 2

    1 2

    9

    1 ln 16

    5.32

    100 10

    H eff

    gre

    A a a bhV h

    h a a bh

    b

    (12)

    Vincent

    2

    , 1

    9

    1

    2

    1

    1 2

    2

    82 ln 2 2 ln12

    1.01

    20.14

    100 10

    2

    H effvin A u h u hbay yV h a y u h y

    u h u h y u h y C h u h y

    a

    b

    hx

    a

    a

    y a

    C a a h

    u x xy x

    (13)

  • 7/30/2019 Hamaker 2.1

    12/22

    12

    Effective

    Thismodel implementstheeffectivedistancedependentapproachfortheHamakerconstantbasedon

    dielectricconstantsandrefractiveindices[5].TheHamakerconstantiscalculatedasgiventhefollowing

    equationandthenusedintheunretardedmodel(equation11):

    222 3 32 2 2

    2 2

    32 2 2

    341

    3 4 216 2

    p mp m mH p m

    p mp m

    h n n n hA kT n n

    cn n

    (14)

    Electrostatic

    The HoggHealyFrstenau (HHF) [6] as well as the Linear Superposition Approximation (LSA) is

    implemented.InallmodelstheionicstrengthIcandtheinverseDebyelengtharecalculatedas:

    2

    12

    0

    2

    1

    2

    2 1000

    c i i

    c A

    I c z

    kT

    e I N

    (15)

    Whereciandziaretheconcentrationandvalenceofionsinsolutionrespectively,and0thedielectric

    constant and the electric constant respectively, k Boltzmanns constant, T the temperature, e the

    elementarychargeandNAAvogadrosnumber.

    Thesurfacepotentialiscalculatedfromthemeasurablezetapotential via

    exp sd (16)

    dsbeingthedistancefromthesurfacewherethezetapotentialismeasured.

    HHF

    2 20 1 2

    1 2 1 2

    1 2

    ln 1 exp ln 1 exphhf

    a aV h h h

    a a

    (17)

    LSA

    0 1 2 1 21 2

    4explsa

    a aV h h

    a a h

    (18)

  • 7/30/2019 Hamaker 2.1

    13/22

    13

    Steric

    TheclosetohardwallmodelintroducedbyBergstrom[7]isimplemented.

    Bergstrom

    6

    22 1

    2

    1 2

    : 10

    2 12 : 22

    2 : 0

    a

    ber a a a

    a

    h d

    a a kT V h d h d d h

    a a V

    h d

    (19)

    The parameter da represents the thickness of the adsorbed layer, and the volume fraction of

    adsorbent intheadsorbed layer.V isthemolecularvolumeofthesolventand thesolventadsorbent

    interactionparameter.

  • 7/30/2019 Hamaker 2.1

    14/22

    14

    WritingpluginmodelsTherangeofinteractionmodelsavailableinHamaker2caneasilybeextendedbytheusertroughplugin

    modules.Themodulesare compiledjava classes, implementinga certain interface.The following isa

    shortdescriptiononhowtoproceedtoimplementanewplugin.

    Setupyourenvironment

    YourcomputerwillneedtohaveaJDK(javadevelopmentkit)installed.Youmaydownloadthissoftware

    fromhttp://java.sun.com/javase/downloads/index.jsp.

    Implementtheinteractionfunctions

    Letsassumeyouwant towriteanewdispersion interactionmodel.Ourawesomenewmodelcanbe

    describedby

    ( )V h b ah (20)

    whichcorrespondstothenotveryphysicalcaseofanlinearlyincreasingpotential.Asyoucanseewewill

    needtoimplementtwoparametersaandb,whichareinternaltoourmodel.

    Usingyourfavoritetexteditorcreateanewjavafile,i.e.LinearDispersion.java.Thefileisprovidedfor

    yourreferenceintheplugins/plugindevelopmentdirectory.

    Allpluginsdependonacertainnumberofstandardjavaclasses.Soletsstartbyimportingthese

    import java.util.ArrayList;import java.io.BufferedWriter;import java.io.BufferedReader;import java.io.IOException;

    We thendefine theclass,which in thiscase implementsDispersionInteractionModel. Ifyouwere to

    write another type of model, the classes would implement ElectrostaticInteractionModel,

    StericInteractionModelorMiscInteractionModelrespectively.

    public class LinearDispersion implementshamaker2.models.dispersion.DispersionInteractionModel {

    double a, b;boolean needs_save;

    }

    Wedefinethetwoneededvariablesaandbasdoubleprecisionrealnumbersjustinsidetheclass.We

    alsodefinethevariableneeds_save,which indicates ifthevariablesaandbhavechangedandneedto

    besaved;

    Withinthisclassweimplementacertainnumberoffunctions:

    Public LinearDispersion () {/*default values: potential raises linearly from -5kT and becomes repulsive

    at 10nm*/a = 5/1E-8;b= 5;needs_save = false;

    }

  • 7/30/2019 Hamaker 2.1

    15/22

    15

    Istheconstructorandshouldinitializeallinternalvariablesyourpluginrequirestotheirdefaultvalues.

    public String name() {

    return "Linear Dispersion Interaction";}

    Returnsthenameoftheinteractionfunction(displayedinthecorrespondingHamaker2menuoncethe

    pluginisinstalled).

    public String reference() {return "Hyper Colloids, 12(4), 150-153, (2008)";

    }

    Return the reference,where themodel can be found. This is displayed as the user hovers over the

    correspondingmenuitem.

    public boolean additionalParameters() {return true;

    }

    If themodel has additional parameters,which can be set using the more dialog (see below), this

    functionshouldreturntrue.

    public void showMoreDialog() {MoreDialog dialog = new MoreDialog();

    }

    Wesimplycallthemoredialog,whichisdefinedfurtherdownintheclass.

    public double interactionPotential(hamaker2.Serie serie) {return b + a * serie.getDistance();

    }public double interactionForce(hamaker2.Serie serie) {

    return a;

    }

    These are themainworkhorses of the plug in: They return the interaction potential and the force

    respectively. The builtinmodels implement the force as analytic functions; pluginsmay also use a

    numericalwaytoobtaintheforce,which ishoweverdiscouragedforreasonsofprecision.Seeannex2

    for a list of function exported by Serie and contained objects, which are likely to be used in the

    calculationofthepotentialandforce.

  • 7/30/2019 Hamaker 2.1

    16/22

    16

    public ArrayList plotVariables() {return new ArrayList();

    }

    Returnanarrayofvariablesagainstwhichtheusermayplot.Wedontwanttoplotagainsteitheraorbsowereturnanemptyarray.

    public boolean getNeedsSave() {return needs_save;

    }

    Wereturnifthemodelparametershavechangedandifasaconsequencesavingisrequired(i.e.Doyou

    wanttosavedialoguponclosingofHamaker2).

    public void save(BufferedWriter output) {output.write(String.valueOf(a));output.newLine();output.write(String.valueOf(b));output.newLine();

    }

    public void load(BufferedReader input) {a = hamaker2.Utils.StringToDouble(input.readLine());b = hamaker2.Utils.StringToDouble(input.readLine());

    }

    Herewewriteandreadthemodelparameterstoorfromafile.Itisimportanttowriteandreadinthe

    samesequence.

    public LinearDispersion duplicate() {LinearDispersion copy = new LinearDispersion ();copy.a = a;copy.b = b;copy.needs_save = true;return copy;

    }

    Toallow fordeepcopyingofseriestheduplicate function isused.Herethepluginshouldcreatea

    new Instance of itself and fill the values bymaking adeep copy of itself.Objects (if any) should be

    cloned,whileprimitivevalues (double, int,boolean)maybeassignedasusualusing the=operator.Theneeds_savevariableistobesettotrueasduplicatingconsistsinanoperationrequiringsavingof

    data.

    Thefollowingisaverysimpleimplementationofthemoredialog.Acompletedescriptionisbeyondthe

    scope of this manual, however a programmer proficient withjava and swing should not have any

    problemswiththiscode.Pleaserefertocommentsinthecodeforbasicexplanations.

  • 7/30/2019 Hamaker 2.1

    17/22

    17

    private class MoreDialog extends javax.swing.JDialog {

    public MoreDialog() {//initialize the dialog and componentssuper((java.awt.Frame)null, true);javax.swing.JLabel a_label = new javax.swing.JLabel("A:");javax.swing.JLabel b_label = new javax.swing.JLabel("B:");a_field = new javax.swing.JFormattedTextField(String.valueOf(a));b_field = new javax.swing.JFormattedTextField(String.valueOf(b));

    //create the ok and cancel buttons and attach the corresponding actionsjavax.swing.JButton okButton = new javax.swing.JButton("OK");okButton.addActionListener(new java.awt.event.ActionListener() {

    public void actionPerformed(java.awt.event.ActionEvent evt) {//extract changed valuesa = hamaker2.Utils.StringToDouble(a_field.getText());b = hamaker2.Utils.StringToDouble(b_field.getText());//close the dialogsetVisible(false);//notify hamaker 2 that we need to save new dataneeds_save = true;

    }});

    javax.swing.JButton cancelButton = new javax.swing.JButton("Cancel");cancelButton.addActionListener(new java.awt.event.ActionListener() {

    public void actionPerformed(java.awt.event.ActionEvent evt) {//simply close the dialog

    setVisible(false);}});

    //create a simple grid layout and pack in the componentsjava.awt.GridLayout layout = new java.awt.GridLayout(3,2);getContentPane().setLayout(layout);getContentPane().add(a_label);getContentPane().add(a_field);getContentPane().add(b_label);getContentPane().add(b_field);getContentPane().add(cancelButton);getContentPane().add(okButton);pack();

    //set the dialog to destroy when closingsetDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

    //make it visiblesetVisible(true);

    }

    //fields that need to be accessible in the action methodsprivate javax.swing.JFormattedTextField a_field;private javax.swing.JFormattedTextField b_field;

    }

    Compiletheplugin

    Place the LinearDispersion.java file in the pluginsdirectorywithin yourHamaker2directory.Now

    open a terminal (Windows: Start Menu>Run, type cmd, Mac: Open Applications/Utilities/Terminal,

    Linux: Depends on window system, most often right click and select New Terminal from menu).

    NavigatetoyourHamaker2/pluginsdirectory(usingthecommandcd).Thenexecuteonwindows

    C:\Program Files\Java\jdk1.6.0_11\bin\javac" -classpath plugindevelopment\classes LinearDispersion.java

    oronmac/linux

    javac classpath plugin development/classes LinearDispersion.java

    Ifyourcodecontainsnoerrors,youshouldgetafileLinearDispersion.class inthepluginsdirectoryand

    uponstartingofHamaker2youshouldseeyourbrandnewplugininthecorrespondingmenu.

  • 7/30/2019 Hamaker 2.1

    18/22

    18

    ContactPlease contact the author at [email protected] or [email protected] in case you have

    questions or comments. If emails remainunansweredor bounce (Imay havemoved to anewpost)

    [email protected].

  • 7/30/2019 Hamaker 2.1

    19/22

    19

    Annex

    Annex1:Exceldataformat

    For a 2D plot the datawill be saved as follows (vi is the ith variable value and Pij is the interaction

    potentialoftheithvariablevalueforthejthserie):

    VariableName NameSeries1 NameSeries2 v1 P11 P12

    v2 P21 P22

    vn Pn1 Pn2

    Thismeansthefirstcolumncontainstheinterparticledistance(surfacetosurface),whicharethexaxis

    values for all series. The following columns contain the interactionpotentials (inunitsof kT) for the

    differentseries,onepercolumn.

    Fora3Dplotthedataissavedasfollows(v1iisthe ithvariablevalueofvariable1,v2jisthejthvariable

    value of variable 2 and Pij is the potential for the ith and jth variable value for variable 1 and 2

    respectively):

    Series1NameVariable1Namev11 v12 v1n

    Variable2Name v21 P11 P21 Pn1v22 P12 P22 Pn2

    v2m P1m P2m Pnm

    Series2Name

    Thismeans that there isoneblock (boldborder)per series. In theblock is the top left cell the series

    name.Thenfollowsinthe3rdlineand2ndcolumnthevariablevalueswiththeirrespectivenamesinline2

    andcolumn1respectively.Theinsideofthematrixthencontainsthevaluesforeachvariablevaluepair.

  • 7/30/2019 Hamaker 2.1

    20/22

    20

    Annex2:APIdefinition

    hamaker2.Serie

    //return the interparticle distance in mpublic double getDistance() ;

    //return the temperature in K

    public double getTemperature();

    //returns if the system contains two types of particlespublic boolean getHeterogeneous();

    //return the particle 1 or 2 respectivelypublic hamaker2.Particle getParticle1();public hamaker2.Particle getParticle2();

    //return the mediumpublic hamaker2. Medium getMedium();

    hamaker2.Particle

    //returns the hamaker constant in Jpublic double getHamakerConstant();

    //returns the density in kg/m3public double getDensity();

    //returns the particle diameter or radius in mpublic double getDiameter();public double getRadius();

    //returns the zeta potential in Vpublic double getZetaPotential();

    //returns the origin of the electrostatic interaction wrt the surface in mpublic double getElectrostaticOrigin();

    hamaker2.Medium

    //return the density in kg/m3

    public double getDensity();

    //return the dielectric constantpublic double getDielectricConstant();

    //returns the number of species in the electrolytepublic int getNumElectrolyteComponents();

    //returns the label, valence and concentration of electrolyte component i//according to java standard (i=0..n-1) where n = getNumElectrolyteComponents();public String getElectrolyteComponentLabel(int i);public double getElectrolyteComponentValence(int i);public double getElectrolyteComponentConcentration(int i);

  • 7/30/2019 Hamaker 2.1

    21/22

    21

    Versionhistory

    Version2.0.0

    Initialrelease

    Version2.1.0

    Bugfixes:

    Fixed a shallowcopy bug inmodelswith More dialogs,which resulted in parameters tochangeforallseriessimultaneouslywhenchangingoneserie.

    Fixedabugintheformattingoftherequiredbarrierwhenchangingstabilityparameters.Newfeatures:

    Addedforceplotting AddedtheEffectiveDispersionmodel,whichcalculatesHamakerconstantsontheflybasedon

    dielectricconstantsandrefractiveindices.

    Version2.1.1

    BugFixes:

    Electrostatic,StericandMiscPluginsnothandledcorrectly. PluginAPIwasmissingclassesforparticleandmedium.

  • 7/30/2019 Hamaker 2.1

    22/22

    22

    References[1] J.N.Israelachvili,IntermolecularandSurfaceForces.AcademicPress:SanDiego,1991.

    [2] H.C.Hamaker,Physica1937,4,10581072.

    [3] J.Gregory,JournalofColloidandInterfaceScience1981,83,(1),138145.

    [4] B.Vincent,JournalofColloidandInterfaceScience1973,42,(2),270285.[5] W.B.Russel;D.A.Saville;W.R.Schowalter,ColloidalDispersions.CambridgePress:Cambridge,

    U.K.,1985.

    [6] R.Hogg;T.W.Healy;D.W.Fuerstenau,Transactionsof theFaradaySociety1966,62, (522P),

    16381651.

    [7] L.Bergstrom;C.H.Schilling;I.A.Aksay,JournaloftheAmericanCeramicSociety1992,75,(12),

    33053314.