polymer - lunds universitet · polymer 3 preface this documentation describes the software polymer....

33
POLYMER 1 POLYMER POLYMER is a software for solving lattice mean-field models containing a mixture of solvents and polymers for homogeneous (Flory-Huggins theory) and heterogeneous (Scheutjens-Fleer theory) solutions extended to polymers possessing internal degrees of freedom Version 3.4.2 Documentation update June 2015 Per Linse Division of Physical Chemistry Department of Chemistry Lund University, P.O. Box 124 S-221 00 Lund, SWEDEN This document can be downloaded from www.physchem.lu.se/sm

Upload: others

Post on 22-Jul-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

1

POLYMER

POLYMER is a software for solving lattice mean-field models containing a mixture of solvents and polymers for homogeneous

(Flory-Huggins theory) and heterogeneous (Scheutjens-Fleer theory) solutions extended to polymers possessing internal degrees of

freedom

Version 3.4.2

Documentation update June 2015

Per Linse Division of Physical Chemistry

Department of Chemistry Lund University, P.O. Box 124

S-221 00 Lund, SWEDEN

This document can be downloaded from www.physchem.lu.se/sm

Page 2: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

2

Copyright 1990-2015 by Per Linse. All rights reserved. The software POLYMER may not be redistributed or modified, with the exception of the user-provided routines in source file poluser.F90, without the written consent of the copyright owner. The copyright owner does not take any responsibility for any error in the software or its documentation. I hope that the software will be useful for you and request a proper reference (POLYMER, Version 3.4.2, P. Linse, Lund University, Lund, Sweden 2015) when using it.

Page 3: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

3

Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set up an environment for a user, and to run it is provided. Thereafter, an explanation of all input variables divided into subsections is given, and the namelist technique used is explained in an appendix. The remaining chapters deal with user-provided routines and more technical aspects important for a more advanced use of the software. Only the use of the software is given in the documentation. It is assumed that the user has a general understanding of the relevant theory. Very few references are provided here; however, further references are given in the source code, often at the top of the routines. The software POLYMER is written in Fortran 95. It can be run interactively or in a batch environment. The connection between external units and files is made in a command file.

Page 4: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

4

Table of contents 1. Introduction .................................................................................................................................... 5  2. Installation ...................................................................................................................................... 7  3. Getting started ................................................................................................................................ 8  4. Input ................................................................................................................................................ 9  

4.1. Namelists ................................................................................................................................. 9  4.2. Input variables ......................................................................................................................... 9  

4.2.1. nmlSystem ........................................................................................................................ 9  4.2.2. nmlState .......................................................................................................................... 10  4.2.3. nmlSpecies ...................................................................................................................... 11  4.2.4. nmlComponent ............................................................................................................... 11  4.2.5. nmlStateIteration ............................................................................................................ 12  4.2.6. nmlEnergy ...................................................................................................................... 13  4.2.7. nmlPhase ......................................................................................................................... 13  4.2.8. nmlPhase2 ....................................................................................................................... 13  4.2.9. nmlSurface ...................................................................................................................... 15  4.2.10. nmlSurfaceIteration ...................................................................................................... 17  4.2.11. nmlNXSI ....................................................................................................................... 18  4.2.12. nmlAggregation ............................................................................................................ 19  4.2.13. nmlFormFactor ............................................................................................................. 19  

5. User-provided routines ................................................................................................................. 20  6. Distributed files ............................................................................................................................ 21  7. External units ................................................................................................................................ 22  8. Routines ........................................................................................................................................ 24  

8.1. pol.F90 ................................................................................................................................... 24  8.2. polymer.F90 ........................................................................................................................... 24  8.3. polhom.F90 ............................................................................................................................ 24  8.4. polhet.f90 ............................................................................................................................... 25  8.5. pollib.f90 ............................................................................................................................... 25  8.6. poluser.F90 ............................................................................................................................ 26  

9. Appendix A. Some concepts used in POLYMER ........................................................................ 27  10. Appendix B. Namelist ................................................................................................................ 28  11. Appendix C. Examples of partial inputs describing the components ......................................... 29  

11.1. Aqueous solution of a triblock copolymer .......................................................................... 29  11.2. Solution of branched hexamer ............................................................................................. 30  11.3. Solution of a dendrimer of first generation ......................................................................... 31  

12. Appendix D. Main properties calculated .................................................................................... 32  13. Appendix E. Suggestions or problems? ...................................................................................... 33

Page 5: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

5

1. Introduction POLYMER is a software for solving lattice mean-field models containing a mixture of solvents and polymers for homogeneous (Flory-Huggins theory) and heterogeneous (Scheutjens-Fleer theory) solutions extended to polymers possessing internal degrees of freedom (Karlström). The solution of interest contains a mixture of particles, and the type of particle is referred to as a component. A particle is composed of one or several segments, where the type of segment is labeled species (typically a solvent or a monomer). A segment may be charged. If a particle is composed of several segments, it is referred to as a polymer, otherwise a solvent. Each segment can attain one or several states, which are in equilibrium with each other, and the states have different interaction parameters with other states. If all segments are of the same species, the polymer is classified as a homopolymer, otherwise as a heteropolymer. A heteropolymer could be a linear block copolymer, where each block consists of segments of the same type or a hyperbranced polymer, including starpolymers, dendrimers and bottle-brush polymers, the latter two appearing with different number of generations. In the homogeneous systems, the Coulomb interactions are described by enforcing electroneautral solutions and in the heterogeneous system by using the Poisson-Boltzmann equation. The concept of internal degrees of freedom allows to describe (i) polymer solutions possessing lower consolute points, i.e., phase separates upon heating, by using a physical model of how the solvency deteriorates at increasing temperature, and (ii) weak polyelectrolytes. The software allows for three different types of calculations involving the determination of (i) the free energy and chemical potential of homogeneous systems, (ii) phase composition of homogeneous systems, and (iii) thermodynamic and structural properties of a one-dimensionally heterogeneous systems. Phase determination of homogenous systems: On the basis of the composition of the initial solution, POLYMER determines whether it is thermodynamic stable or separates into two or several phases. If a phase separation appears, the volume and the composition of the coexisting phases are provided. The determination of the phase composition is based on (a) equal chemical potential or on (b) free energy minimization. The former case is restricted to a 2-component system only, but includes a possibility of successive calculations at different temperature. In the second case, there is a possibility successive calculations with different initial composition. After randomly distributing the N components into N solutions, the free energy is minimized by systematic moving particles between different solutions until a given tolerance of the free energy change is achieved. When the global free energy minimum is achieved, the chemical potential of the different components are equal in the different solutions. The number of solutions with different composition constitutes the number of coexisting phases. Thermodynamics and structure of heterogeneous systems: Three different geometries are supported: (i) plane, (ii) cylinder, and (iii) sphere. In any of the three cases, different number of surfaces can be present, viz. (i) none, (ii) one, or (iii) two. If two surfaces are present in the curved geometries, the surfaces have two be concentrical. Two different ensembles can be applied, either the canonical involving a fixed amount of the particles, or the grand canonical where the number the particles is controlled by the chemical potential of a bulk solution with specified composition. The surface is characterized by an interaction parameter as well and can possess either a fixed surface charge density or surface potential. There is also a possibility of having particles grafted on the surfaces. The standard results involve the inhomogeneous distribution of components, species, and states as well as excess free energy. In addition, distribution of selected segments of a given rank, the excess amount at the wall, loops, tails, train, and bridge characteristics can be obtained. In

Page 6: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

6

the case of self-association, aggregation properties and form factors can be determined. The numerical solution is obtained by either (i) solving a set of nonlinear equations following Denis and Schnabel, or (ii) transforming it to a minimization problem solved by the Powell method. In the former case, the initial value of the iteration variable can be (i) calculated from an initial mean-field potential provided in the input file, (ii) calculated from a mean-field potential from a previous calculation, or (ii) directly taken from a previous calculation. The performance of the numerical solution is controlled by a number of different parameters. It is easy to add user-provided routines to the software to enhance the capability of it. These routines may, e.g., perform additional analyses or facilitate sequential calculations. The user-provided routines are collected in the file poluser.F90 and do not belong to the supported software. An existing input variable controls the calls of these routines. The specification of input variables characterizing the model and controlling the calculation is given in an input file. That makes it easy to make sequential calculations with only minor differences in the specification. Both names and values of the variables are given in input file using the Namelist protocol, making it easy to read and prepare input files. Blocks of input data are collected into separate groups. References: Flory, P. J. “Principles of Polymer Chemistry”; Cornell University Press; Ithaca: NY 1953. Fleer, G. J.; Cohen Stuart, M. A.; Scheutjens, J. M. H. M.; Cosgrove, T.; Vincent, B. “Polymers at Interfaces”; Chapman & Hall: London, 1993. Linse, P.; Björling, M. “Lattice theory for multicomponent mixtures of copolymers with internal degrees of freedom in heterogeneous systems”Macromolecules 1991, 24, 6700.

Page 7: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

7

2. Installation This chapter describes how to install the software POLYMER on a Unix(Linux)-based workstation after obtaining the installation file polymer.xxx.tar.gz, where xxx should be replaced by three digits (version number). In the following, your top directory is referred to as $(HOME). The installation involves the following steps: – Create the directory Polymer in the directory $(HOME) – Copy the file polymer.xxx.tar.gz to the directory Polymer – Go to file directory Polymer – Type 'tar -zxf polymer.xxx.tar.gz' The tar command (i) creates the subdirectory Src, which in the following is referred to as the source directory, and (ii) places the source files into the source directory. The name and content of the distributed files are given in chapter 6. – Go to directory Src – Open the makefile and if necessary edit it for appropriate compiler – Type 'make' The make command starts compilation and linking. After completion, (i) additional files have been created in the source directory, (ii) a subdirectory Bin has been created and now contains the executable polymer.exe, and (iii) the file polymer has been copied from the source directory to $(HOME)/bin. Note, the environmental variable PATH has to contain $(HOME)/bin for the software to function. – The installation file polymer.xxx.tar.gz in directory Polymer can now be removed The installation of the software is now completed.

Page 8: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

8

3. Getting started This chapter describes how to execute the software. – Create a work subdirectory, in which corresponding input and result files will reside This directory will in the following be referred to as the work directory. The location of the work directory is arbitrary. – Copy an input file, here referred to as job.in, to the work directory An input file could, e.g., be retrieved from www.physchem.lu.se/sm. At this moment we will not consider the content and the meaning of the variables in the input file. The input variables are the subject of the next chapter. – Type 'polymer job' After execution the output file job.out have been created in the work directory. The content of the output file should be essentially the same as that obtained by execution trough www.physchem.lu.se/sm. If not, probably some error has occurred in the transfer of the code or during the installation.

Page 9: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

9

4. Input All input data read from the file FIN are done with the namelist procedure. Each namelist contains related input variables. A few concepts used in POLYMER are given in Appendix A. Further information on the namelist procedure is given in Appendix B.

4.1. Namelists The program uses the following namelists in the order given below. The set of namelist used for the four different modes are specified. Compulsory nameslist are checked with bold style. namelist free hom hom het variables describing ene sys sys sys nmlSystem X X X X general variables nmlState X X X X states nmlSpecies X X X X species nmlComponent X X X X components nmlStateIteration X X X X state iteration nmlEnergy X calculation of free energy and chemical potential nmlPhase X calculation of phases of a two-component system nmlPhase2 X calculation of phases of a N-component system nmlSurface X calculation of the heterogeneous system nmlSurfaceIteration X calculation of the heterogeneous system nmlNXSI X calculation of volume fraction of segments nmlAggregation X calculation of properties related to aggregation nmlFormFactor X calculation of form factor

4.2. Input variables This subsection contains all input variables that are used for reading data from file FIN. The variables are grouped together and listed below their namelist name. The first line contains the name, the type, the dimension, and, if any, the default value of the variable. The following lines briefly explain the use of the variable. If the variable only can attain a limited number of values, these are listed. If description about writing data is given, the output is made on file FOUT (if nothing else is stated). A practical point. Often there is a need of reading a variable conditionally, i.e. if some condition is true the variable is assigned a value and used later. If the condition is false, the presence of the variable in the input file does no harm; thus it has not to be deleted. In the latter case the input file contains redundant data. Examples of partial inputs describing the components are given in Appendix C.

4.2.1. nmlSystem The namelist nmlSystem contains variables that describe the option of calculation and some flags that control output. txTitle character(80) User-provided title.

Page 10: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

10

txMode character(15) 'free_energy' Calculate the free energy and chemical potential given a composition of a

homogeneous system. 'phase' Calculate the phases in equilibrium for a two-component system. 'phase2' Calculate the phases in equilibrium for a given composition of a N-component

system. 'surface' Calculate the segment distribution of a heterogeneous system. txUser character(8) For user-provided routines. iTest integer /0/ 0 Nothing. The normal use. 1-3 Extensive output for maintenance purposes. iIter integer /0/ 0 Nothing. >0 Iteration data are listed (txMode='phase2' and 'surface'). iShow integer /0/ 0 Nothing. >0 Calculated data are listed (txMode='phase' and 'surface'). iList integer /0/ 0 Nothing. >0 Calculated data are listed on file FLIST (txMode='phase2' and 'surface').

4.2.2. nmlState The namelist nmlState contains variables that describe the states. nStat integer Number of different states. txStat character(15) (1:mnStat) Label of the states. UStat real (1:mnStat) /mnStat*0.0/ Internal energy of the state. GStat real (1:mnStat) /mnStat*1.0/ Degeneracy of the states. ZStat real (1:mnStat) /mnStat*0.0/ Fraction of elementary charge of the states. ChiSS real (1:mnStat,1:mnStat) /mnStat**2*0.0/ Interaction parameter among the states (kJ mol-1). Only one triangle of the

symmetric interaction matrix has to be given.

Page 11: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

11

4.2.3. nmlSpecies The namelist nmlSpecies contains variables that describe the species. nSpec integer Number of different species. txSpec character(15) (1:mnSpec) Label of the species. nStatSpec integer (1:mnSpec2) Number of states belonging to the species. iStat integer (1:mnStat,1:mnSpec2) iStat(KST,ISP) is the global state of the local state KST of species ISP.

4.2.4. nmlComponent The namelist nmlComponent contains variables that describe the components. nComp integer Number of different components. txComp character(15) (1:mnComp) Label of the components. nBlockRep integer (1:mnComp) /mnComp*1/ Number of repetitions of the set of blocks of the component. nBlock integer (1:mnComp) Number of blocks of the component. LenBlock integer (1:mnBlock,1:mnComp) LenBlock(ibl,ico) is the length of block ibl of component ico. lBranchComp logical (1:mnComp) /nmComp*.false./ Enabling one component to be hyperbranched (described by the following

parameters). nGen integer /1/ Number of generations. iSpecGen integer (0:mnGen) iSepcGen(igen) denotes the global species of segments belonging to generation igen. nSegChain integer (0:mnGen) /(mnGen+1)*1/ nSegChain(igen) denotes the number of segments of a chain of generation igen.

Page 12: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

12

nBranchM integer (0:mnGen) /(mnGen+1)*1/ nBranchM(igen) denotes the multiplicity of a branch point of generation igen. nBranchP integer (0:mnGen) /(mnGen+1)*0/ nBranchP(igen) denotes the number branch points for a chain of generation igen. iBranchPBeg integer (0:mnGen) /(mnGen+1)*1/ iBranchPBeg(igen) denotes the segment number of the first branch point for a chain

of generation igen. iBranchPInc integer (0:mnGen) /(mnGen+1)*1/ iBranchPBeg(igen) denotes the segment increment between branch points for a chain

of generation igen. IRandSeq logical (1:mnComp) /.false./ .true. Random segment sequence Generated from a standard block sequence by nSwopRandSeq pairwise

permutations. .false. Nothing. iSeedRandSeq integer /987/ Seed to random number generation for generating random segment sequence. nSwopRandSeq integer /10/ Number of pairwise permutations for generating random segment sequence.

4.2.5. nmlStateIteration The namelist nmlStateIteration contains variables that control the state iteration. txStatIter character(4) /'fast'/ 'fast' The fast algorithm for iterating the state distribution. It does not check for multiple

solutions. 'slow' The slow algorithm for iterating the state distribution. It checks for multiple

solutions. It works only for species with two states. nStatIter integer /50/ Maximum no of iterations. TolStatIter real /1d-8/ Tolerance for the largest state change. DelStatIter real /1d-6/ Start point for search of multiple solutions (only for txStatIter='slow').

Page 13: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

13

4.2.6. nmlEnergy The namelist nmlEnergy contains variables that describe the calculation of free energy and chemical potentials of a homogeneous system. Temp real Temperature (K). Note, the choice T = (1 kJ/mol K)/R = 120.27236 implies that

energies are expressed in RT units. VFCompBulk real (1:mnComp) Volume fraction of the components.

4.2.7. nmlPhase The namelist nmlPhase contains variables that describe the calculation of phases of a two component system. TempLow real Lower temperature for search of phases. TempUpp real Upper temperature for search of phases. nTemp integer /1/ Number of temperatures of the search. VFLow real Lowest volume fraction considered in the search. VFUpp real 1-VFUpp is the upper volume fraction considered in the search. nVF integer /200/ Number of steps for the calculation of the chemical potentials.

4.2.8. nmlPhase2 The namelist nmlPhase2 contains variables that describe the calculation of phases of a N-component system of a given composition. Temp real Temperature (K). nPhase integer Maximal number of phases to be considered. nDim integer /0/ Dimension of the space from which the composition of the systems is selected. '0' One system given by VFCompIn(:1). '1' Systems determined from VFCompIn (:1) and VFCompIn (:2).

Page 14: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

14

'2' Systems determined from VFCompIn (:1), VFCompIn (:2), and VFCompIn (:3). nSys1d integer /1/ Number of systems in one dimension. If nDim=0, nSys1d is forced to be 1. The total

number of systems becomes 1, nSys1d, and (nSys1d+1)* nSys1d/2 for nDim=0, 1, and 2, respectively.

VFCompIn real (1:mnComp, 3) Composition of the "corners" of the space from which the composition of the

systems is selected. txTag character(2) /'fc'/ Controls the tag added to binodal data listed of FLIST (only if iList>1). Useful in

connection with the 3PHASE program. 'sl' Writes the tag 'sl' for the first phase and 'fl' for the other ones. other Writes txTag (e.g., 'fc' gives filled circles indicated the phases). txInitComp character(6) /'random'/ Controls the initial distribution of the components among the phases. 'random' Random distribution 'old' Data from file FAUX is read and are used together with VFCompIn to create the

initial distribution. iSeed integer /98243/ Seed to a random number generator that provides random number for generation of

the initial distribution. Should be larger than zero. nPowerBeg integer /1/ 10**(-nPowerBeg) is the initial volume element moving around for determining the

phases. nPowerEnd integer /7/ 10**(-nPowerEnd) is the final volume element moving around for determining the

phases. nDivision integer /1/ Number of divisions. TolVol real /1.0d-3/ Parameter controlling the no of different phases found. A phase is considered as

nonexisting if its volume is less that TolVol. TolComp real /1.0d-3/ Parameter controlling the no of different phases found. Phases are considered as

different if the volume fraction of at least one component differs with more than TolVol between the two phases.

Page 15: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

15

4.2.9. nmlSurface The namelist nmlSurface contains variables that describe the calculation of the heterogeneous system. Temp real Temperature (K). lCharge logical /.false./ .true. Electrostatic interactions are included. .false. Electrostatic interactions are not included. txLatticeType character(3) /'hex'/ 'pc' Primitive cubic lattice (lambda(i,i)=2/3). 'hex' Hexagonal lattice (lambda(i,i)=1/2). 'fcc' Face centered cubic lattice (lambda(i,i)=1/3). 'bcc' Body centered cubic lattice (lambda(i,i)=0). txLatticeSym character(8) 'plane' Planar geometry. Further specification by PlaneArea. 'cylinder' Cylindrical symmetry. Further specification by CylRad and CylLength. 'sphere' Spherical symmetry. Further specification by SphRad. PlaneArea real Area of the plane(s) (only used if txLatticeSym = 'plane'). CylRad real Radius of the cylinder (only used if txLatticeSym = 'cylinder'). CylLength real Length of the cylinder (only used if txLatticeSym = 'cylinder'). SphRad real Radius of the sphere (only used if txLatticeSym = 'sphere'). nLayer integer Number of the layers excluding the surface layer. dLattice real Lattice spacing (m). Only used for electrostatic interaction calculations. Epsi real Relative dielectric permittivity. Only used for electrostatic interaction calculations. SurfCharge real (1:2) /2.0*0.0/ Fraction of elementary charge per lattice area of each surface. SurfPot real (1:2) /2.0*0.0/

Page 16: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

16

Surface potential of each surface (V). BoundCond character(9) (1:2) /2*'surface'/ Boundary condition of surfaces 1 and 2. Surface 1 is located in layer 0 and surface 2

in layer nLayer+1. 'nosurface' No surface (reflecting boundary condition). 'surface/c' Surface (adsorbing boundary condition) and, if electrostatic is included, fixed

surface charged. 'surface/p' Surface (adsorbing boundary condition) and, if electrostatic is included, fixed

surface potential. CompCond character(5) (1:mnComp) /mnComp*'equil'/ 'equil' The amount of the component is determined by equilibrium with bulk. 'fixed' The amount of the component is fixed. (Not all components should have

CompCond=.fixed.). 'graft' This component is grafted to one or both surfaces. The first segment is forced to be

located in layer 1 (or in layer M). VFCompBulk real (1:mnComp) Bulk volume fraction of the component (only used if CompCond='equil'). nChain real (1:mnComp) Number of molecules of the component (only used if CompCond='fixed'). GraftDens real (1:mnComp,1:2) Grafting density of the component (only used if CompCond='graft'). The density is

given as fraction of sites occupied by the first segment in layers adjacent to the surface(s).

ChiSW real (1:mnStat,1:2) ChiSW(IST,ISF) is the interaction parameter (in kJ mol-1) between state IST and

surface ISF. lChiSW logical /.false./ .true. ChiSW(IST,ISF) are divided by lamm(1) (lambda(1,0)) .false. Nothing. lVFCompSpec logical /.false./ .true. Calculate volume fractions of all species belonging to different component. .false. Nothing. lNXSI logical /.false./ .true. Calculate volume fraction of segment of given rank belonging to given component. .false. Nothing. lExMom logical /.false./ .true. Calculate 1st, root of the 2nd, and rms moments of the excess amount. .false. Nothing.

Page 17: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

17

lLTTB logical /.false./ .true. Analyse loops, tails, trains, and bridges and calculate adsorbed amount. .false. Nothing. lAggregation logical /.false./ .true. Calculate aggregation properties as total volume fraction etc. .false. Nothing. lFormFactor logical /.false./ .true. Calculate the form factor (only for spherical symmetry). .false. Nothing.

4.2.10. nmlSurfaceIteration The namelist nmlSurfaceIteration contains variables that control the solution of the set of nonlinear equations for solving the heterogeneous system. txInitX character(4) /'unew'/ 'unew' The iteration variable X is set from initial U. 'xold' The iteration variable X is read from file FAUX. 'uold' The iteration variable X is taken from U which is read from file FAUX. lUMod logical /.false./ .true. Sets U of all species to zero at the upper limit. .false. Nothing. nUStep real (1:mnSpec) /See below/ Number of blocks where U is nonzero (if txInitX='unew'). The default values of

nUStep, ULevel, and nUInit are such that U=-0.01 in layers adjacent to a surface. ULevel real (1:nUStep,1:mnSpec) Value of U of the different blocks (if txInitX='unew'). ULayer real (2,1:n ustep,1:mnSpec) Lower and upper layer number where the value of U is nonzero. tXSolve character(6) /'nesolv'/ 'nesolv' Solves the system of nonlinear equations using a modified Newton-Raphson method.

Uses the variables: txGlobal, txJac, nFVDigit, FVTol, dxTol, dFTol, dXMax, nIterNE, iPrint.

'powell' Solves the system of nonlinear equations by minimization using the Powell method. Uses the variables: TolPowell, nIterPowell.

txGlobal character(6) /'line'/ Selects the global method for determining the dx. 'newrap' Newton-Raphson method. 'line' Line search with backtracking if the Newton-Raphson step is unacceptable. txJac character(9) /'secantfac'/

Page 18: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

18

Selects the method for the calculation of the Jacobian. 'findiff' Finite differential method, O(n**3). 'secant' Broyden's secant method, O(n**3). 'secantfac' Broyden's secant method with factorization, O(n**2). nFVDigit integer /12/ Estimate of the number of reliable digits of the function. FVTol real /1d-6/ Tolerance of the largest component of the function for termination. dxTol real /1d-10/ Tolerance of the DX for termination. dFTol real /1d-10/ Tolerance of the square of the function for termination. dXMax real /10.0/ Determines the maximal change in X in one iteration. nIterNE integer /30/ Maximum number of iterations. iPrint integer /1/ Flag for output from NESOLV. The larger the more output. TolPowell real /1d-6/ Tolerance for termination of the minimization. nIterPowell integer /50/ Maximum number of iterations in the minimization.

4.2.11. nmlNXSI The namelist nmlNXSI contains variables that control the calculation of the volume fraction of segments of given rank belonging to a given component. nSegSel integer /1/ Number of segments to be selected (max 5). iiComp integer /1/ Component to be selected. iiSeg integer (1:nSegTot) /1/ Ranks of the segments to be selected.

Page 19: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

19

4.2.12. nmlAggregation The namelist nmlAggregation contains variables that controls the calculation of properties related to aggregation. lCompAgg logical (1:mnComp) /mnComp*.false./ .true. Components to be included in the aggregate. .false. Not included.

4.2.13. nmlFormFactor The namelist nmlFormFactor contains variables that control the calculation of the form factor (only for spherical geometry). nBin integer /2048/ Number of bins of the FFT transformation (should be a power of 2). RUppFT real Upper limit of the real space for the FFT. The upper limit of the reciprocal space is

pi/dr, where dr=RUppFT/nBin. RelContrast real (1:mnSpec2) /mnSpec2*0.0/ Contrast of the species including the inner wall. RUppOutput real Truncate the listing at RUppOutput or QUppOutput, whenever comes first. QuppOutput real Truncate the listing at RUppOutput or QUppOutput, whenever comes first. lNorm logical /.true./ .true. Normalize the form factor to one at q=0. .false. No normalization.

Page 20: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

20

5. User-provided routines The file poluser.F90 contains routines that are conditionally called and which might be modified by the user. This allows the software to be extended without having to modify the core of it. The existing code in the distributed file poluser.F90 reflects the current use of it. The procedure to insert a new routine is as follows: – At the appropriate position in driver poluser, extend the test of txUser and write the appropriate call to the new subroutine – Add your new subroutine in poluser.F90 – Compile

Page 21: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

21

6. Distributed files This chapter contains a complete list of the distributed files. pol.F90 Module for the POLYMER program polymer.F90 Main code of POLYMER polhom.F90 Routines for the homogeneous system polhet.F90 Routines for the heterogeneous system pollib.F90 Library routines poluser.F90 User-provided routines polymer.ver Description of version changes polymer Command file for execution makefile Makefile for compilation and linking archive Command file for filing

Page 22: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

22

7. External units A file is specified by its name and type, which are separated by a dot. The file types are used in a predetermined way to describe the use of the file and leaves file name to label the project.

File type Generic name Content in FIN Input data

out FOUT Output data aux FAUX Iteration variable X list FLIST List data user FUSER Avail for the user

Flow chart of the use of external files. Bold arrows denote files that are always required or generated, while thin arrows denote files which might be required or generated, depending on input variables.

FIN

FAUX

FUSER

FOUT FAUX FLIST

FUSER

POLYMER

Page 23: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

23

Flow chart of the external files in more detail. The actions enclosed in bold lines do always appear, whereas those in thin lines are controlled by user-provided routines.

Start

Reading  of  input  variables

Change  of  input  variables

Output  of  input  variables

Additional  output

Calculation

Output  of  calculation

Additional  output

More? Stop Yes

No

FIN

FIN

FUSER

FOUT

FOUT

FOUT

FUSER

FUSER

FLIST FAUX

FAUX

Page 24: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

24

Routines This chapter lists the routines in the software. The routines are listed according to the Fortran files they are located in and in the order they appear in the files.

7.1. pol.F90

PolymerModule main module of POLYMER

7.2. polymer.F90

Polymer main routine of POLYMER ReadProjectName get name of external units IOSystem perform i/o on system variables IOParticle perform i/o on particle variables IOStateIteration perform i/o on state iteration variables SetSegment set segment related variables ReducedUnits change UStat, ChiSS, and ChiSW to reduced units and set ElecFac CalcVFSpecBulk calculate species volume fraction VFSpecBulk, i.e. Phi(a) CalcStateHomo calculate optimal PStatBulk, i.e. p(ab) SubStateHomo calculate new PStatBulk, PStatBulk = f(PStatBulk), i.e. p(ab) CalcStateHetero calculate optimal PStat, i.e. p(abi) SubStateHetero calculate new PStat, PStat = f(PStat), i.e. p(abi) ChemPotential calculate the chemical potential for the components FreeEnergyHomo calculate the total free energy of the homogeneous system FreeEnergyHetero calculate free energies of the heterogeneous system ExcessFreeEnergy calculate the excess free energy relative to a reference chem pot CalcChiEff calculate effective (species-species) interaction parameters CheckVolumeFraction check that volume fractions sum up to one TransferWCompVFComp transfer between WComp and VFComp CalcPolydisp calculate segment average and polydispersity FileFlush flush external files

7.3. polhom.F90 CalcFreeEnergy calculate free energy and chemical potential CalcPhase calculate phases and their composition of a two-component system SubPhase calculate phase boundaries, if any CalcPhase2 calculate phases and their composition of a n-component system CalcSysVF calculate the number of systems and their composition WritePhaseData write volume, volume fraction, and chemical potentials MinimizeFreeEnergy minimize the free energy of the homogeneous system CalcVFCompPhase calculate the volume fractions VFComp of the phases TotalFreeEnergy calculate the total free energy of the phases using VFCompPhase and

VolCompPhase CalcNoPhase calculate the number of phases (solutions with different composition) CalcSeparationType classify phase separation (associative, segregative or of boarder line

type) CalcChargeBulk calculate the net charge of bulk solution

Page 25: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

25

7.4. polhet.f90

Surface driver of the solution of the heterogeneous system IOSsurface perform i/o on variables describing the heterogenity IOIteration perform i/o on variables describing the non-linear equ. iteration XInitTask initialize XIter and PStat and store XIter SubSurface solve the heterogeneous system OutputSurface analysis and output for the one-dimensional heterogeneous system CalcVFCompSpec calculate volume fractions of species belonging to different comp CalcNXSI calculate volume fraction of segment of rank s belong to component x in

layer i CalcExcessMoment calculate and write thickness based on excesses (over bulk) CalcLTTB analyse loops, tails, trains, and bridges and calculate ads amount CalcLTTB1 calculate volume fraction profiles VFCompz and VFCompGroup CalcLTTB2 calculate volume fraction profiles VFSpecgr MakeStep1 calculate Forwz, Backz, and PSumz MakeStep2 calculate Forwz, Backz, and PSumz Aggregation control calculation of properties related to aggregation CalcAggregation calculate properties related to aggregation CalcThickness calculate various thicknesses of the volume fraction profile CalcHydroDThickness calculate hydrodynamic thickness CalcFormFactor calculate the form factor using the volume fraction profiles FVec calculate the function (heterogeneous system) CalJac calculate the jacobian (heterogeneous system) (dummy routine) Func calculate the function (heterogeneous system) MakeStep calculate Forw, Back, and PSum MakeStepForward make one Forward step MakeStepBackward make one Backward step CalcCoLaSp calculate CompLaySpec by summation of Forw*Back CalcRefPotential calculate the reference potential URef for composition VFCompURef CalcVFSpec calculate VFSpec from CRed and CompLaySpec CalcCharge calculate z from VFSpec, PStat, and ZStat CalcNChain calculate nChain from VFComp FuncPowell call func and calculate the value of the deviation

7.5. pollib.f90 WriteLog write a logical variable WriteInt write an integer WriteFlt write a real variable WriteVec write a vector WriteMat write a matrix WriteFront write a front WriteHead write a heading WriteDateTime write date and time WriteIOStat write value of iostat and take appropriate action Warn write a warning message Stop write a warning message and stop the process FFTC perform a (inverse) ft of a complex function

Page 26: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

26

FFT3D calculate the 3d ft (real) of a real function using FFTC MatInv matrix inversion with solution of linear equations PolFit calculate least square fit to a polynomial PolVal calculate the value of the polynomial for a given x-value CpuAdd add and write total cpu time elapsed since start CpuTot write total cpu time elapsed since start Second return cpu time used since start (in seconds) LowerCase change a string to lower case UpperCase change a string to upper case Random return a random number in the range of 0 to 1 NEDrive driver of a system of algorithms for solving nonlinear equations NEInCheck routine for checking input parameters and tolerances NEFSquare calculate the sum of squares of the set of nonlinear equations Gradient calculate the gradient g=d(0.5*(fv(t)*fv))/dx=jac(t)*fv MachinePre calculate the machine floating point precision QRDecomp qr decomposition of a square matrix QRSolve solve (qr)x=b RSolve solve rx=b CholSolve Cholesky solve driver, solve (ll(t))s=-g LSolve solve ly=b LTSolve solve l(t)x=y CondEst estimate the condition number of an upper triangular matrix r QRUpdate qr factorization update JacRotate rotate the jacobian QForm form q from q(n-1)...q(1) produced by the qr factorization FDJac calculate a forward difference approximation of the jacobian CholDecom perturbed Cholesky decomposition NENewRap perform a pure newton-raphson step LineSearch line search NEModel formation of the affine model NEModelFac formation of the affine model with factored secant updates NEStop stopping conditions BroyUpdate Broyden's update, unfactored form BroyUpdateFac Broyden's update, factored form Powell minimization according to Powell Powell_module connection between LinMin and F1Dim LinMin minimization in one direction mnBraket bracket a minimum of a function Brent get the minimum of a function F1Dim accompany LinMin

7.6. poluser.F90

PolUser driver of user-provided routines

Page 27: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

27

8. Appendix A. Some concepts used in POLYMER Important variables X type of molecule (component) A type of segment (species) B state i layer number UAB internal energy of state B in species A gAB internal degeneration of state B in species A PAB fraction of species A that is in state B

χBB' state-state Flory-Huggins interaction parameter

Heterogeneous system

Illustration of the two surfaces (in the case of a planar geometry) and the intervening space, which is divided into layers parallel to the surfaces as well as the labeling of the surface and intervening layers. Polymer

Illustration of a component (polymer) in a given conformation on a two-dimensional cubic lattice. The component consists of eight segments of which segments of rank 1 to 4 are of type A and 5 to 8 of type A'. Segments of type A have two internal states, AB and AB', whereas species A' has only one state, A'B. Segments of rank 1 and 2 are in state AB and 3 and 4 in state AB'.

1 2

3 4 5

6 7 8

AB A’B

AB’

Page 28: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

28

9. Appendix B. Namelist – A namelist consists of (i) one start statement, (ii) one end statement, and (iii) a list (possibly

empty) between the start and end statements. – The start statement consists of an ampersand (&) followed by the name of the namelist. – The end statement consists of a slash (/). – The list is composed of variables and their values separated with either by commas. – The order of the variables and their assignments is normally irrelevant. – However, if a variable is assigned values more than once, the last one takes place. – Arrays are allocated either element by element, consecutively by listing values separated by

commas, or by a combination of these to ways. – A value, say 5, appearing r times may be expressed as r*5. – Note the order Fortran stores arrays elements: the left most index is running fastest and the right

most slowest. – Comments are allowed and should proceed by an exclamation sign (!). – Generally, if a program reads several namelists, they have to occur in the inputfile in the same

order as they are read from the program. Here, this is relaxed; the order of the namelist is arbitrary.

– A namelist with no list (empty namelist) has to be specified. – Namelists that are not read by the program do no harm. Example: Consider the following declarations character(4) :: title integer(4) :: m, n real(8) :: ARR1(1:3), ARR2(1:2,1:2), ARR3(1:2,1:2) The namelist nmlSystem below illustrates an element-by-element array assignment &nmlSystem title = 'head', n = 10, m = 10, n = 20, arr1(1) = 1.5, arr1(2) = 2.5, arr1(3) = 2.5, arr2(1,1) = 1.0, arr2(2,1) = 2.0, arr2(1,2) = 3.0, arr2(2,2) = 4.0, arr3(1,1) = 1.0, arr3(2,1) = 2.0, arr3(1,2) = 3.0, arr3(2,2) = 4.0, / which could, for example, be shortened to &nmlSystem title = 'head', n = 20, m = 10, arr1 = 1.5, 2*2.5, arr2 = 1.0, 2.0, 3.0, 4.0, arr3(1,1) = 1.0, 2.0, arr2(1,2) = 3.0, 4.0, /

Page 29: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

29

10. Appendix C. Examples of partial inputs describing the components

10.1. Aqueous solution of a triblock copolymer The system is composed by two components, solvent and a triblock copolymer of the type EO37PO56EO37 (Pluronic polymer). The EO and PO species possess two states each, one polar and one nonpolar. Further details are given in Macromolecules, 26, 4437 (1993). &nmlState nStat = 5, txStat(1) ='water','eo-p ','eo-ap','po-p ','po-ap', UStat(1) = 0.0, 0.0, 5.086, 0.0, 11.5, GStat(1) = 1, 1, 8, 1, 60.0, ChiSS(1,2) = 0.6508, ChiSS(1,3) = 5.568, ChiSS(1,4) = 1.7, ChiSS(1,5) = 8.5, ChiSS(2,3) = 1.266, ChiSS(2,4) = 1.8, ChiSS(2,5) = 3.0, ChiSS(3,4) = 0.5, ChiSS(3,5) =-2.0, ChiSS(4,5) = 1.4, / &nmlSpecies nSpec = 3, txSpec(1) ='water','eo','po', nStatSpec(1) = 1, 2, 2, iStat(1,1) = 1, iStat(1,2) = 2, 3, iStat(1,3) = 4, 5, / &nmlComponent nComp = 2, txComp(1) ='water','pluronic', nBlock(1) = 1, 3, iSpecBlock(1,1) = 1, LenBlock(1,1) = 1, iSpecBlock(1,2) = 2, 3, 2, LenBlock(1,2) = 37, 56, 37, /

Page 30: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

30

10.2. Solution of branched hexamer The system is composed by two components: solvent and a branched hexamer according to &nmlState nStat = 3, tXStat(1) ='solvent','polymer1', polymer2', UStat(1) = 0, 0, 0, GStat(1) = 1, 1, 1, ChiSS(1,2) = 0.0, ChiSS(1,3) = 0.0 ChiSS(2,3) = 0.0, / &nmlSpecies nSpec = 3, txSpec(1) ='solvent','polymer1', polymer2', nStatSpec(1) = 1, 1, 1, iStat(1,1)= 1, iStat(1,2)= 2, iStat(1,3)= 3, / &nmlComponent nComp = 2, txComp(1) ='solvent','polymer', nBlock(1) = 1, iSpecBlock(1,1) = 1, LenBlock(1,1) = 1, lBranchComp(2) = .t. nGen = 1, iSpecGen(0) = 2, 3, nSegChain(0) = 4, 1, nBranchP(0) = 2, iBranchPBeg(0) = 2, iBranchPInc(0) = 1, / The latter component is composed of a main chain with 4 segments of species type 2 and two side chains attached at segment 2 and 3 of the main chain and each are composed of one segment of species type 3.

Page 31: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

31

10.3. Solution of a dendrimer of first generation The system is composed by two components: solvent and a dendrimer of first generation according to &nmlState nStat = 3, tXStat(1) ='solvent','polymer1', polymer2', UStat(1) = 0, 0, 0, GStat(1) = 1, 1, 1, ChiSS(1,2) = 0.0, ChiSS(1,3) = 0.0 ChiSS(2,3) = 0.0, / &nmlSpecies nSpec = 3, txSpec(1) ='solvent','polymer1', polymer2', nStatSpec(1) = 1, 1, 1, iStat(1,1)= 1, iStat(1,2)= 2, iStat(1,3)= 3, / &nmlComponent nComp = 2, txComp(1) ='solvent','polymer', nBlock(1) = 1, iSpecBlock(1,1) = 1, LenBlock(1,1) = 1, lBranchComp(2) = .t. nGen = 1, iSpecGen(0) = 2, 3, nSegChain(0) = 2, 1, nBranchM(0) = 2, nBranchP(0) = 2, iBranchPBeg(0) = 1, iBranchPInc(0) = 1, / The second component is composed of a chain with 2 segments (generation 0) of species type 2, on which 2 chains each composed of one segment of species type 3 are attached to each of the two segments.

Page 32: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

32

11. Appendix D. Main properties calculated The main properties calculated of the four different modes are given here. I. Free energy State distribution Chemical potential of the components Free energy of the system Effective χ-parameters IIa. Homogeneous system (numerical solution based on the chemical potential) Number of phases in equilibrium Composition of coexisting phases Chemical potential of the components IIb. Homogeneous system (numerical solution based on the free energy minimization) Number of phases in equilibrium Volume of coexisting phases Composition of coexisting phases Chemical potential of the components Free energy of the system III. Heterogeneous system Excess amount of the components Free energy of the system Excess free energy of the system Volume fraction profiles of the components Volume fraction profiles of the species State distribution profiles Electrostatic potential and change density profiles Volume fraction profiles of segments with given rank (lNXSI = .true.) Different moments of the volume fraction profiles (lExMom = .true.) Chain conformational data (loop, tail, and trains data) (lLTTB = .true.) Aggregation properties (lAggregation = .true.) Form factor (lFormFactor = .true.)

Page 33: POLYMER - Lunds universitet · POLYMER 3 Preface This documentation describes the software POLYMER. After a short introduction, information of how to install the software, to set

POLYMER

33

12. Appendix E. Suggestions or problems? I would be happy to hear from you if you have any suggestions or problems with the POLYMER software or with this documentation. If so, send – Date – Name – E-mail address – POLYMER version number – Host computer (name and configuration) – Suggestion or problem in as much detail as possible to: [email protected]