Phase Behaviors of Block Copolymers - Part 1: Free Energy Evaluations

Quick Setup

Installing Packages

Currently, Polyorder.jl and its dependent packages are private repositories hosted at https://github.com/liuyxpp, which are not registered in the Julia General Registry:

  • PolymerArchitechture.jl
  • Scattering.jl
  • PhaseDiagram.jl

It is recommended to install them via the private registry. First, you need to add the private registry to the Julia package manager in REPL:

(@v1.11) pkg> registry add git@github.com:liuyxpp/lab3083.git

or

(@v1.11) pkg> registry add https://github.com/liuyxpp/lab3083.git

This step only has to be done once. You can now install packages in both the General registry and the lab3083 registry. The dependent packages will be installed automatically just as installing packages normally.

Install all following packages to your project environment via:

(@v1.11) pkg> activate .
(your_project_dir) pkg> add Polymer PolymerArchitecture PolymerArchitectureMakie Scattering Polyorder PhaseDiagram

The environment your_project_dir can be any name you like. Make sure that

  • Polymer.jl (v0.9.1+)
  • PolymerArchitecture (v0.3.7+)
  • Scattering.jl (v0.4.6+)
  • Polyorder.jl (v0.26.2+)
  • PhaseDiagram.jl (v0.9.0+)
  • PolymerArchitectureMakie (v0.3.1+)

which can be checked via

(your_project_dir) pkg> st

To perform stress-guided cell optimization and compute stability limit via RPA, two extra packages are required:

(your_project_dir) pkg> add Optim Roots

Other packages required by this tutorial are registered in the General Registry, and can be installed via

(your_project_dir) pkg> add CairoMakie LaTeXStrings

Loading Packages

In the notebook, we first activate the environment reside in the folder you start Pluto. This step will disable the Pluto built-in package manager. If you are not in Pluto notebook, you should use an appropriate way to activate current environment.

import Pkg
Pkg.activate(".")

using Polymer
using Scattering
using Polyorder
using PhaseDiagram
using PolymerArchitectureMakie
using CairoMakie
using LaTeXStrings
  Activating project at `~/SynologyDrive/Develop/Polyorder.jl/docs/tutorial`
# Suppressing displaying source code file location for @info
using Logging
global_logger(ConsoleLogger());
# Plotting utilities
include("common.jl");

Create Polymer Systems

Polyorder performs computations on a PolymerSystem object which is created by the Polymer.jl package.

A PolymerSystem object contains BlockCopolymer and/or SmallMolecule objects.

Polymers and small molecules

Small molecules

Small molecules can be created by

SmallMolecule(:S)  # :S is the label/name of the samll molecule.
SmallMolecule S with b=1.0

Or you can use the handy method

solvent()  # the default label is :S
SmallMolecule S with b=1.0

Polymers

Polymer.jl currently only supports creating neat polymers and block copolymers, which are represented by a BlockCopolymer object. BlockCopolymer internally uses a graph to represent the chain architecture.

In Polymer.jl, a BlockCopolymer are consisted of PolymerBlocks, each of which is consisted of KuhnSegments, and they are connected by BranchPoints. They may also have FreeEnds.

A method for creating following polymer chain

[A1] - [B] - [A2] - [C1]
         |      |
         [C2]   [D]

Note that the two brackets around each block stand for two ends of that block.

function chainABCACD()
    # The chain has four distinct Kuhnsegments.
    sA = KuhnSegment(:A)
    sB = KuhnSegment(:B)
    sC = KuhnSegment(:C)
    sD = KuhnSegment(:D)
    # Among all block ends, there are three branch points and four free ends.
    eb1 = BranchPoint(:EB1)
    eb2 = BranchPoint(:EB2)
    eb3 = BranchPoint(:EB3)
    # The order of two ends is irrelevant 
    A1 = PolymerBlock(:A1, sA, 0.2, FreeEnd(:A1), eb1)
    B = PolymerBlock(:B, sB, 0.3, eb1, eb2)
    A2 = PolymerBlock(:A2, sA, 0.3, eb2, eb3)
    C1 = PolymerBlock(:C1, sC, 0.1, eb3, FreeEnd(:C1))
    C2 = PolymerBlock(:C2, sC, 0.05, eb2, FreeEnd(:C2))
    D = PolymerBlock(:D, sD, 0.05, eb3, FreeEnd(:D))
    # The order of these blocks is also irrelevant
    return BlockCopolymer(:ABCACD, [A1, B, A2, C1, C2, D])
end
chainABCACD (generic function with 1 method)
chainABCACD()

┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/PpRC2/src/scenes.jl:264

Exercises

  1. Write a function that creates a AB3 star block copolymer

 

  [B1]
  |
[A] - [B2]
  |
  [B3]
  1. Write a function that creates the following block copolymer

 

    [A2]         [B2]
       |         |
[A3] - [B1] - [A1] - [B3]
       |         |
    [A4]         [B4]

Polymer systems

Before adding BlockCopolymer or SmallMolecule objects to PolymerSystem, we have to wrap each of them into a Component struct. A Component object carries extra information such as its volume fraction and its reference length.

AB_system()  # χN and fA can be specified by the keyword arguments
PolymerSystem{Float64}(Component[Component{BlockCopolymer{PolymerBlock{Float64}}, Float64}(BlockCopolymer AB with 2 blocks:
  * PolymerBlock A with f=0.5 of specie A
  * PolymerBlock B with f=0.5 of specie B
, 1.0, 1.0)], BulkConfinement(), Flory-Huggins interaction parameters betwen species:
    (A, B) => 20.0
, 1.0)
ABC_system()
PolymerSystem{Float64}(Component[Component{BlockCopolymer{PolymerBlock{Float64}}, Float64}(BlockCopolymer ABC with 3 blocks:
  * PolymerBlock A with f=0.3 of specie A
  * PolymerBlock B with f=0.4 of specie B
  * PolymerBlock C with f=0.29999999999999993 of specie C
, 1.0, 1.0)], BulkConfinement(), Flory-Huggins interaction parameters betwen species:
    (A, C) => 40.0
    (B, C) => 40.0
    (A, B) => 40.0
, 1.0)

For any block copolymer melts, we can use the PolymerSystem constructor:

let
    chain = chainABCACD()  # Create a polymer chain
    polymer = Component(chain)  # Wrap the chain into a component
    # Create an interaction map between different species
    χNmap = Dict([:A, :B]=>10.0,
                 [:A, :C]=>20.0,
                 [:A, :D]=>30.0,
                 [:B, :C]=>40.0,
                 [:B, :D]=>50.0,
                 [:C, :D]=>60.0
    )
    PolymerSystem([polymer], χNmap)  # Create a polymer system
end
┌ Warning: Timed out waiting for `Base.active_repl_backend.ast_transforms` to become available. Autoloads will not work.
└ @ BasicAutoloads ~/.julia/packages/BasicAutoloads/08hIo/src/BasicAutoloads.jl:117
[ Info: If you have a slow startup file, consider moving `register_autoloads` to the end of it.

PolymerSystem{Float64}(Component[Component{BlockCopolymer{PolymerBlock{Float64}}, Float64}(BlockCopolymer ABCACD with 6 blocks:
  * PolymerBlock A1 with f=0.2 of specie A
  * PolymerBlock B with f=0.3 of specie B
  * PolymerBlock A2 with f=0.3 of specie A
  * PolymerBlock C1 with f=0.1 of specie C
  * PolymerBlock C2 with f=0.05 of specie C
  * PolymerBlock D with f=0.05 of specie D
, 1.0, 1.0)], BulkConfinement(), Flory-Huggins interaction parameters betwen species:
    (D, B) => 50.0
    (A, C) => 20.0
    (B, C) => 40.0
    (A, B) => 10.0
    (A, D) => 30.0
    (D, C) => 60.0
, 1.0)

A/B binary blend

First, we create two homopolymers chainA and chainB via the convenient function homopolymer_chain of Polymer.jl.

chainA = homopolymer_chain(label=:hA, segment=KuhnSegment(:A))
chainB = homopolymer_chain(label=:hB, segment=KuhnSegment(:B));

Then we wrap them into two Component objects. Below, we make them equal length and equal volume fraction.

polymerA = Component(chainA, 1.0, 0.5)  # αA = 1.0, ϕA = 0.5
polymerB = Component(chainB, 1.0, 0.5)  # αB = 1.0, ϕB = 0.5
Component{BlockCopolymer{PolymerBlock{Float64}}, Float64}(BlockCopolymer hB with 1 blocks:
  * PolymerBlock hB with f=1.0 of specie B
, 1.0, 0.5)

Next, we will specify the interactions via a Dict object:

χNmap = Dict([:A, :B]=>20.0)  # requires Polymer.jl v0.8.5
Dict{Vector{Symbol}, Float64} with 1 entry:
  [:A, :B] => 20.0

Finally, we can construct a PolymerSystem object for a A/B binary blend:

PolymerSystem([polymerA, polymerB], χNmap)
PolymerSystem{Float64}(Component[Component{BlockCopolymer{PolymerBlock{Float64}}, Float64}(BlockCopolymer hA with 1 blocks:
  * PolymerBlock hA with f=1.0 of specie A
, 1.0, 0.5), Component{BlockCopolymer{PolymerBlock{Float64}}, Float64}(BlockCopolymer hB with 1 blocks:
  * PolymerBlock hB with f=1.0 of specie B
, 1.0, 0.5)], BulkConfinement(), Flory-Huggins interaction parameters betwen species:
    (A, B) => 20.0
, 1.0)

Note that a convenient function A_B_system has been provide by Polymer.jl to do exactly the above things.

A_B = A_B_system()
PolymerSystem{Float64}(Component[Component{BlockCopolymer{PolymerBlock{Float64}}, Float64}(BlockCopolymer hA with 1 blocks:
  * PolymerBlock hA with f=1.0 of specie A
, 1.0, 0.5), Component{BlockCopolymer{PolymerBlock{Float64}}, Float64}(BlockCopolymer hB with 1 blocks:
  * PolymerBlock hB with f=1.0 of specie B
, 1.0, 0.5)], BulkConfinement(), Flory-Huggins interaction parameters betwen species:
    (A, B) => 20.0
, 1.0)

AB/A binary blend

This can be done via the function AB_A_system provided by the package Polymer.jl.

AB_A_system accepts keyword arguments only. Its signature is

AB_A_system(; χN=20.0, ϕAB=0.5, fA=0.5, α=0.5)

The following is assumed:

  • αAB = 1.0
  • αA = α
  • fA is the length fraction of A block within the AB block copolymer.

Below we create a binary blend which is the same as that in Fig. 3 of Ref. Mester, Z.; Lynd, N. A.; Fredrickson, G. H. Numerical Self-Consistent Field Theory of Multicomponent Polymer Blends in the Gibbs Ensemble. Soft Matter 2013, 9 (47), 11288.

AB_A = AB_A_system(; χN=10.0, fA=0.45, α=1.0)  # function from Polymer.jl
PolymerSystem{Float64}(Component[Component{BlockCopolymer{PolymerBlock{Float64}}, Float64}(BlockCopolymer AB with 2 blocks:
  * PolymerBlock A with f=0.45 of specie A
  * PolymerBlock B with f=0.55 of specie B
, 1.0, 0.5), Component{BlockCopolymer{PolymerBlock{Float64}}, Float64}(BlockCopolymer hA with 1 blocks:
  * PolymerBlock hA with f=1.0 of specie A
, 1.0, 0.5)], BulkConfinement(), Flory-Huggins interaction parameters betwen species:
    (A, B) => 10.0
, 1.0)

AB/A/B ternary blend

Based on Polymer.jl, arbitrary polymer blends including polymer solutions can be created. Below is an example on how to create an AB/A/B ternary blend.

function AB_A_B_system(; χN=20.0, ϕAB=0.5, fA=0.5, ϕA=0.25, αA=0.5, αB=0.5)
    AB = Component(diblock_chain(fA=fA), 1.0, ϕAB)
    A = Component(homopolymer_chain(label=:hA, segment=KuhnSegment(:A)), αA, ϕA)
    B = Component(homopolymer_chain(label=:hB, segment=KuhnSegment(:B)), αB, 1-ϕAB-ϕA)
    return PolymerSystem([A, B, AB], Dict([:A, :B]=>χN))
end
AB_A_B_system (generic function with 1 method)

Note that we put AB as the last component in the PolymerSystem object, which follows literature convention so that chemical related properties are reduced quantities using the last component as a reference.

AB_A_B = AB_A_B_system()
PolymerSystem{Float64}(Component[Component{BlockCopolymer{PolymerBlock{Float64}}, Float64}(BlockCopolymer hA with 1 blocks:
  * PolymerBlock hA with f=1.0 of specie A
, 0.5, 0.25), Component{BlockCopolymer{PolymerBlock{Float64}}, Float64}(BlockCopolymer hB with 1 blocks:
  * PolymerBlock hB with f=1.0 of specie B
, 0.5, 0.25), Component{BlockCopolymer{PolymerBlock{Float64}}, Float64}(BlockCopolymer AB with 2 blocks:
  * PolymerBlock A with f=0.5 of specie A
  * PolymerBlock B with f=0.5 of specie B
, 1.0, 0.5)], BulkConfinement(), Flory-Huggins interaction parameters betwen species:
    (A, B) => 20.0
, 1.0)

Exercises

  1. Create a block copolymer melt system contains a miktoarm chain AB3. The interaction between A and B is 30.0.

  2. Create a AB3/A binary blend. The volume fraction of homopolymer A is 0.1. The reference length is the length of AB3, and the length of homopolymer A is 0.2. The interaction between A and B is 30.0.

Create Simulation Cell

A polymer system has to be put in a simulation cell, which carries the information about the cell size, shape and symmetry. A simulation cell is a Scattering.BravaisLattice object.

Unit cells and crystal systems

Scattering.jl supports all crystal systems in 1D, 2D and 3D. A full list can be viewed by running:

values(Scattering.Crystal.ALL_CRYSTAL_SYSTEMS)
ValueIterator for a Dict{Tuple{Symbol, Symbol, Vararg{Symbol}}, DataType} with 14 entries. Values:
  Oblique
  Hexagonal
  Rectangular
  HexRect
  Line
  Hexagonal2D
  Triclinic
  Orthorhombic
  HexOrthorhombic
  Square
  Cubic
  Tetragonal
  Trigonal
  Monoclinic

Unit cell can be created by the UnitCell constructor function. One way is to specify crystal system and corresponding crystalline parameters.

UnitCell(Cubic(), 4.0)  # create a cubic cell
UnitCell
  * Crystal system: Cubic
  * Edges: [4.0, 4.0, 4.0]
  * Angles: [π/2, π/2, π/2]

Another way is to specify edge lengths and angles. If angles are ignored, they are assumed to be $\pi/2$. The crystal system is inferred from the edge lengths and angles.

let
    uc = UnitCell((2.0, 3.0, 4.0))
    crystalsystem(uc)
end
Orthorhombic crystal system with free lattice parameters [a, b, c]

Space Group

  • For 1D crystals, there are two space groups.
  • For 2D crystals, there are 17 space groups.
  • For 3D crystals, there are 230 space groups.

These space groups can be described by the SpaceGroup struct defined in Crystalline.jl package. They can be created by specifying the space group index and the number of space dimension. For the name of each space group, please check out the list here.

spacegroup(70, 3)  # O70 (Fddd) space group
SpaceGroup{3} ⋕70 (Fddd) with 32 operations:
 1
 {2₀₀₁|¾,¾,0}
 {2₀₁₀|¾,0,¾}
 {2₁₀₀|0,¾,¾}
 -1
 {m₀₀₁|¼,¼,0}
 {m₀₁₀|¼,0,¼}
 {m₁₀₀|0,¼,¼}
 {1|0,½,½}
 {2₀₀₁|¾,¼,½}
 {2₀₁₀|¾,½,¼}
 {2₁₀₀|0,¼,¼}
 {-1|0,½,½}
 {m₀₀₁|¼,¾,½}
 {m₀₁₀|¼,½,¾}
 {m₁₀₀|0,¾,¾}
 {1|½,0,½}
 {2₀₀₁|¼,¾,½}
 {2₀₁₀|¼,0,¼}
 {2₁₀₀|½,¾,¼}
 {-1|½,0,½}
 {m₀₀₁|¾,¼,½}
 {m₀₁₀|¾,0,¾}
 {m₁₀₀|½,¼,¾}
 {1|½,½,0}
 {2₀₀₁|¼,¼,0}
 {2₀₁₀|¼,½,¾}
 {2₁₀₀|½,¼,¾}
 {-1|½,½,0}
 {m₀₀₁|¾,¾,0}
 {m₀₁₀|¾,½,¼}
 {m₁₀₀|½,¾,¼}

Lattice

A simulation cell can be created by specifying the unit cell only. The crystal system is inferred from the unit cell. The space group is chosen to be the first space group of that crystal system.

let
    uc = UnitCell((2.0, 3.0, 4.0))
    BravaisLattice(uc)
end
BravaisLattice
  * Centering: P
  * Space group: #16 (P222)
  * Crystal system: Orthorhombic
  * Unit cell: [2.0, 3.0, 4.0] [π/2, π/2, π/2]
  * Free lattice parameters: [a, b, c]

Alternatively, the space group can be specified explicitly as

let
    uc = UnitCell(Orthorhombic(), 2.0, 3.0, 4.0)
    BravaisLattice(uc, 40)  # No. 40 space group (3D) because uc is 3D.
end
BravaisLattice
  * Centering: A
  * Space group: #40 (Ama2)
  * Crystal system: Orthorhombic
  * Unit cell: [2.0, 3.0, 4.0] [π/2, π/2, π/2]
  * Free lattice parameters: [a, b, c]

An advanced usage of crystal system is to specify which unit cell parameters are fixed. The b edge length of following orthorhombic cell is fixed.

Note that UnitCell object does not explicitly carry any crystal system information. Thus control parameters cannot be set in UnitCell.

let
    uc = UnitCell((2.0, 3.0, 4.0))
    a = Scattering.Crystal.a
    c = Scattering.Crystal.c
    lat = BravaisLattice(uc, 40; freevars=[a, c])
end
BravaisLattice
  * Centering: A
  * Space group: #40 (Ama2)
  * Crystal system: Orthorhombic
  * Unit cell: [2.0, 3.0, 4.0] [π/2, π/2, π/2]
  * Free lattice parameters: [a, c]

Exercises

  1. Create a cubic cell with space group 230 and side length 5.0.

  2. Create a 2D hexagonal cell with default space group and side length 3.0.

Construct SCFT Models

An SCFT model holds all information needed for performing SCFT calculations. It typically includes:

  • A PolymerSystem object: describing the polymer system
  • A BravaisLattice object: describing the simulation cell
  • An array of density fields
  • An array of auxiliary fields
  • An array of propagators
  • An SCFT udpater
  • An array of MDE solvers

Currently, Polyorder only supports non-cyclic chain architechures.

Constructor

The model can be created by the constructor of NoncyclicChainSCFT struct as follows,

let
    uc = UnitCell(4.0)  # Create a unit cell
    lat = BravaisLattice(uc)  # Create a simulation cell
    system = AB_system()  # Create a diblock copolymer system
    ds = 0.01  # global contour step size for all blocks
    model = NoncyclicChainSCFT(system, lat, ds)  # Create the SCFT model
end
Noncyclic Chain SCFT model:
* Free energy: Inf
* Residual: 0.0
* Stress norm: NaN
* Model type: SimpleFieldModel
* Model compressiblity: Incompressible
-----
PolymerSystem (AB) contains 1 components:

Component AB with ϕ=1.0 and α=1.0 contains BlockCopolymer AB with 2 blocks:
  * PolymerBlock A with f=0.5 of specie A
  * PolymerBlock B with f=0.5 of specie B

with Flory-Huggins interaction parameters betwen species:
    (A, B) => 20.0
and confined by BulkConfinement()-----
Simulation Cell: BravaisLattice
  * Centering: p
  * Space group: #1 (p1)
  * Crystal system: Line
  * Unit cell: [4.0] [0]
  * Free lattice parameters: [a]

-----
* Spatial resolution: (27,)
* Contour steps: Dict{Pair, Float64}[Dict((2 => 3) => 0.01, (2 => 1) => 0.01, (1 => 2) => 0.01, (3 => 2) => 0.01)]
* MDE solvers: Dict{Pair, Type{<:MDEAlgorithm}}[Dict((2 => 3) => OSF, (2 => 1) => OSF, (1 => 2) => OSF, (3 => 2) => OSF)]
-----
SCFT updater: PicardMann iteration with α=0.2.
-----
* First density field: 0.0 [0.0, 0.0]
* First auxiliary field: -0.3759 [-2.881, 2.103]

The default MDE solver is OSF, and the default SCFT updater is SD. You can change them by passing them through keywords mde and updater, respectively:

using Polyorder: SIS
let
    uc = UnitCell(4.0)  # Create a unit cell
    lat = BravaisLattice(uc)  # Create a simulation cell
    system = AB_system()  # Create a diblock copolymer system
    ds = 0.01  # global contour step size for all blocks
    # Create an SCFT model with the `RQM4` MDE solver and the `SIS` updater.
    model = NoncyclicChainSCFT(system, lat, ds; mde=RQM4, updater=SIS(0.1))
end;

Configurations

To control the solution of SCFT models, we can create a Polyorder.Config instance. We can check out the default settings by create a default Polyorder.Config instance:

Polyorder.Config()
Polyorder.Config(Polyorder.VersionConfig("Polyorder.jl", v"0.26.2"), PolymerSystemConfig(nothing, SpecieConfig[SpecieConfig(:A, :Segment, 1.0, nothing, nothing), SpecieConfig(:B, :Segment, 1.0, nothing, nothing)], Vector{Any}[[:A, :B, 20.0]], ComponentConfig[ComponentConfig(:BCP, :AB, 1.0, 1.0, BlockConfig[BlockConfig(:A, :A, 0.5, [:AB]), BlockConfig(:B, :B, 0.5, [:AB])])], 1.0), LatticeConfig(CrystalSystemConfig(:Line, Symbol[]), :P, UnitCellConfig(1, 1.0, nothing, nothing, nothing, nothing, nothing), SpaceGroupConfig(1, 1)), IOConfig(1, false, false, ".", "summary", "trace", "fields", "densities", "config", :HDF5, true, true, true, true, true, 100, 1000, 1000, 6, 0), SCFTConfig(false, :simple, false, 0.15, false, [64], 1, 1, 1000, 10, 999.0, true, :norm, :mean, :Residual, 1.0e-6, 0.001, 1.0, false, false, false, false, false, 100, 1.4901161193847656e-8, 1.4901161193847656e-8, 100, 1.0, 100, 10, 10), Dict{Symbol, MDEConfig}(), SCFTUpdaterConfig(:SD, Dict{Symbol, SCFTUpdaterConfig}(), Dict{Symbol, Any}()), CellOptConfig(:VariableCellOpt, CellOptAlgoConfig(:VariableCell, Dict{Symbol, SCFTUpdaterConfig}(), Dict{Symbol, Any}()), Dict{Symbol, Any}(), true, 1.0e-5))

It is useful to serialize SCFT models as a Polyorder.Config. Polyorder provides a function to_config to do it. And save_config to save the Polyorder.Config instance as an YAML file.

let
    uc = UnitCell(4.0)  # Create a unit cell
    lat = BravaisLattice(uc)  # Create a simulation cell
    system = AB_system()  # Create a diblock copolymer system
    ds = 0.01  # global contour step size for all blocks
    # Create an SCFT model with the `OSF` MDE solver and the `SIS` updater.
    model = NoncyclicChainSCFT(system, lat, ds; mde=OSF, updater=SIS(0.1))

    config = to_config(model)  # serialize a model as a Config object
    save_config("config.yml", config)  # save the Config object as an YAML file
end

We can reconstruct the model from the Polyorder.Config instance by using the make function:

let
    config = load_config("config.yml", Polyorder.Config)  # load the Config object from the YAML file
    model = Polyorder.make(config)  # reconstruct the model from the Config object
end
Noncyclic Chain SCFT model:
* Free energy: Inf
* Residual: 0.0
* Stress norm: NaN
* Model type: SimpleFieldModel
* Model compressiblity: Incompressible
-----
PolymerSystem (AB) contains 1 components:

Component AB with ϕ=1.0 and α=1.0 contains BlockCopolymer AB with 2 blocks:
  * PolymerBlock A with f=0.5 of specie A
  * PolymerBlock B with f=0.5 of specie B

with Flory-Huggins interaction parameters betwen species:
    (A, B) => 20.0
and confined by BulkConfinement()-----
Simulation Cell: BravaisLattice
  * Centering: p
  * Space group: #1 (p1)
  * Crystal system: Line
  * Unit cell: [4.0] [0]
  * Free lattice parameters: [a]

-----
* Spatial resolution: (27,)
* Contour steps: Dict{Pair, Float64}[Dict((2 => 3) => 0.01, (2 => 1) => 0.01, (1 => 2) => 0.01, (3 => 2) => 0.01)]
* MDE solvers: Dict{Pair, Type{<:MDEAlgorithm}}[Dict((2 => 3) => OSF, (2 => 1) => OSF, (1 => 2) => OSF, (3 => 2) => OSF)]
-----
SCFT updater: 1S semi-implicit method (SIS-1) with α=0.1.
-----
* First density field: 0.0 [0.0, 0.0]
* First auxiliary field: -0.09609 [-2.854, 1.724]

Exercises

  1. Construct a SCFT model for a miktoarm block copolymer AB3 (fA=0.4, fB1=fB2=fB3=0.2), in a cubic unit cell with side length 4.0 Rg and space group No.230.

  2. Construct a SCFT model for a AB3/A binary blend (fA=0.4, fB1=fB2=fB3=0.2, choose AB3 as reference length, the length of homopolymer A is 0.5), in an orthorhombic unit cell with side length 3.0, 4.0, 5.0, respectively. Use RQM4 as MDE solver, ETD as updater. Set contour step for all A blocks (A in AB3 and A in hompolymer) to be 0.02, contour step for all B blocks to be 0.01.

  3. Explore the source file Polyorder.jl/src/config.jl, and construct a configuration instance that set tol to 1e-8, minimum and maximum number of iterations to be 50 and 500, respectively in SCFTConfig.

Disordered (DIS) phase

The analytical solution at the mean-field level is available, which is the same as the Flory-Huggins lattice theory,

\[\tilde{F} = \frac{F}{CV} = \sum_{X,Y}\chi_{XY}N \bar\phi_X \bar\phi_Y + \sum_i \frac{\phi_i}{\alpha_i}\left( \ln\frac{C\phi_i}{\alpha_i} - 1 \right)\]

where $X, Y = \lbrace A, B, C, \dots \rbrace$ and $Y > X$ are the specie types in the polymer system, and $i = 1, 2, 3, \dots$ are the components in the polymer system. The averaging density for the specie X, $\bar\phi_X$, is

\[\bar\phi_X = \sum_i\sum_j \delta_{XS_{ij}} f_{ij} \phi_i\]

where $S_{ij}$ is the specie type in the $j$-th block of the $i$-th molecule, and $\delta_{XY}$ is the Kronecker delta function. Now we can compute its first-order partial derivative

\[\frac{\partial\bar\phi_X}{\partial\phi_i} = \sum_j \delta_{XS_{ij}} f_{ij}\]

Therefore,

\[\gamma_i = \frac{\partial\tilde{F}}{\partial\phi_i} = \sum_{X,Y}\sum_j ( \delta_{XS_{ij}}\bar\phi_Y + \delta_{YS_{ij}}\bar\phi_X)\chi_{XY}N f_{ij} + \frac{1}{\alpha_i}\ln\frac{C\phi_i}{\alpha_i}\]

and the chemical potential can be readily computed

\[\tilde\mu_i = \gamma_i - \gamma_{n_c}\]

for $i=1, 2, \dots, n_c$ with $n_c$ the number of components in the system.

Polyorder provides two ways to compute the disordered (homogeneous) phase: the analytical way and the numerical way.

Free energy

Create a NoncyclicChainSCFT instance.

begin
    uc_dis = UnitCell(1.0)  # 1D unit cell with length 1.0 Rg
    lattice_dis = BravaisLattice(uc_dis)
    # Space resolution `spacing` Δx is set to be equal to the length of the unit cell to ensure only one grid point is generated.
    nccscft_dis = NoncyclicChainSCFT(AB_A, lattice_dis, 0.01; spacing=1.0, mde=OSF)
end;

It is not recommended to use solve! method to compute the DIS phase. But it is good for testing whether the implementation of a SCFT algorithm is correct. Note that, to ensure that the DIS phase is computed, the number of grid points must be set to 1 to suppress all possible inhomogeneous phases.

The numerical way only serves as a test tool to verify the correctness of a SCFT implementation.

Polyorder.solve!(nccscft_dis)  # solve the SCFT model numerically
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: Inf
[ Info: initial residual norm: 0.0
[ Info: initial stress norm: NaN
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [1.0]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: final loss: 9.67852511639164e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 0.3006028194
[ Info: final loss: 9.68e-7
[ Info: final stress norm: 0.0
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [1.0]
└   * Angles: [0]
[ Info: iterations: 62
[ Info: time per iteration: 31 milliseconds, 736 microseconds, 829 nanoseconds

[ Info: Run time: 00:00:01.967683417
[ Info: =======================================

Polyorder.Successful()

We can simply obtain the free energy (which includes the contribution from the ideal gas terms) by calling the F function on the solved NoncyclicChainSCFT object.

Polyorder.F(nccscft_dis)  # Evaluate the free energy numerically
0.30060281944005274

Compute the enthalpy part of the Flory-Huggins free energy.

Polyorder.enthalpy(nccscft_dis)  # Evaluate the enthalpy numerically
1.99375
Polyorder.enthalpy_FH(nccscft_dis)  # Evaluate the enthalpy analytically using FH theory.
1.9937500000000001

Compute the entropy part (i.e., the ideal gas terms) of the Flory-Huggins free energy,

\[\tilde{S} = -\tilde{F}_{ig} = \sum_i \frac{\phi_i}{\alpha_i}\left( \ln\frac{C\phi_i}{\alpha_i} - 1 \right)\]

Polyorder.entropy(nccscft_dis)  # Evaluate the entropy numerically
1.6931471805599476
Polyorder.entropy_ig(nccscft_dis)  # Evaluate the entropy analytically using FH theory
1.6931471805599454
Polyorder.F_ig(nccscft_dis)  # shoud = -S
-1.6931471805599454

We can combine these two parts to obtain the full Flory-Huggins free energy: F = H - TS.

Polyorder.enthalpy_FH(nccscft_dis) - Polyorder.entropy_ig(nccscft_dis) # should be equal to JP.F(nccscft_dis)
0.30060281944005474

A convenient function is provided in the Polyorder package to compute the Flory-Huggins free energy, which is F_DIS or F_FH. Analytical expressions are utilized to carry out the computation.

We can verify the accuracy of the DIS free energy calculated from SCFT equations:

Polyorder.F_DIS(nccscft_dis) - Polyorder.F(nccscft_dis)
1.9984014443252818e-15

It is not necessary to create an NoncyclicChainSCFT object to compute the disordered phases. Using PolymerSystem directly is the recommended way to compute the DIS free energy:

Polyorder.F_DIS(AB_A)
0.30060281944005474
Polyorder.F_DIS(AB_A_B)
2.460279229160082
Polyorder.F_DIS(A_B)
3.3068528194400546

Chemical potential

Compute chemical potentials from the solved NoncyclicChainSCFT object.

Polyorder.μ̃s(nccscft_dis)  # Evaluate the chemical potential numerically
1-element Vector{Float64}:
 2.4749976045955107

Compute chemical potentials based on Flory Huggins lattice theory.

Polyorder.μ̃s_DIS(nccscft_dis)  # Evaluate the chemical potential analytically
1-element Vector{Float64}:
 2.4750000000000005

Verify the accuracy of the SCFT computation.

Polyorder.μ̃s(nccscft_dis) .- Polyorder.μ̃s_DIS(nccscft_dis)
1-element Vector{Float64}:
 -2.3954044898744087e-6

Similarly, using PolymerSystem directly is the recommended way to compute the DIS chemical potential.

# the modified chemical potentials for each component except the last one.
# the order of component is the same as the array `PolymerSystem.components`.
Polyorder.μ̃s_DIS(AB_A)
1-element Vector{Float64}:
 2.4750000000000005

Thus the chemical potential is for the AB diblock copolymer in the above case.

Polyorder.γs_DIS(AB_A_B)  # the partial derivatives for each component.
3-element Vector{Float64}:
 8.61370563888011
 8.61370563888011
 9.306852819440055
Polyorder.μ̃s_DIS(AB_A_B)  # the modified chemical potentials for each component (AB and A) except the last one (B).
2-element Vector{Float64}:
 -0.6931471805599454
 -0.6931471805599454
Polyorder.μs_DIS(AB_A_B)  # the chemical potentials for each component.
3-element Vector{Float64}:
 1.0568528194400546
 1.0568528194400546
 2.8068528194400546

Batch evaluations

Plot the free energy as a function of the volume fraction of the AB component for the AB/A binary blend.

begin
    system = AB_A_system(; χN=10.0, fA=0.45, α=1.0)
    ϕA_control = ϕControlParameter(:hA, system)  # a handle for modifying PolymerSystem
end
ϕControlParameter{Polymer.var"#30#32"}(2, ϕType{Float64}("volume fraction of a type of chain in a polymer system.", "ϕ", "phi", L"$\phi$", Float64, 0.0, 1.0, Float64[], Float64[]), Polymer.var"#30#32"())
begin
    ϕAs_dis = 0.001:0.001:0.999  # ϕA
    Fs_dis = similar(ϕAs_dis)
    μs_dis = similar(ϕAs_dis)
    for i in eachindex(ϕAs_dis)
        Polymer.update!(system, ϕAs_dis[i], ϕA_control)
        Fs_dis[i], μs_dis[i] = Polyorder.F_DIS(system), Polyorder.μ̃_DIS(system, 1)
    end
end
let
    f = Figure()
    ax = Axis(f[1, 1],
        xlabel = L"$\phi_{hA}$",
        ylabel = L"$F$ and $u$",
    )
    lines!(ax, ϕAs_dis, Fs_dis, label=L"$F$")
    f
end
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/PpRC2/src/scenes.jl:264

A straight line is subtracted from the actual free energy curve to visualize the double-well structure more easily.

let
    line = get_line(ϕAs_dis[1], Fs_dis[1], ϕAs_dis[end], Fs_dis[end])
    F_sub = subtract_line(line, ϕAs_dis, Fs_dis)
    f = Figure()
    ax = Axis(f[1, 1],
        xlabel = L"$\phi_{hA}$",
        ylabel = L"$F$",
    )
    lines!(ax, ϕAs_dis, F_sub, label="DIS")
    f
end
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/PpRC2/src/scenes.jl:264

Exercises

  1. Draw DIS phase free energy curves of the A/B binary blend for χN={1.5, 1.8, 1.99, 2.01, 2.1, 3.0}, and other values which are helpful to understand the trend of the change of these free energy curves.

Ordered Phases

Block copolymers undergo a microphase separation when the interaction between species. Ordered phases emerges during the microphase separation. The ordered structures can be computed by SCFT numerically. Polyorder provides solve! and cell_solve! for fixed cell calculations and cell optimization, respectively.

Here, we use the most simple block copolymer system, AB diblock copolymer melt to demonstrate the usage of Polyorder.

LAM

By restricting in the 1D unit cell, the only possible phases are LAM and DIS.

Sometimes, when $\chi N$ is significantly close to the critical point or the cell size significantly deviates from the equilibrium value, the DIS is computed instead of LAM. Therefore, for a rigorous approach, we must check the density distribution of the final solution to make sure the LAM is actually computed. Or, simply compared its free energy with the DIS phase, if they are close within a threshold (say 1e-8), we can conclude that the DIS instead of LAM is computed.

If DIS has been computed when the target phase is an ordered phase, we can

  • make sure that $\chi N$ is indeed above the binodal line.
  • change the cell size
  • provide an initial density distribution with a larger variation.
scft_AB_lam = let
    ds = 0.01
    uc = UnitCell(3.0)
    lat = BravaisLattice(uc)
    system = AB_system(χN=15.0, fA=0.36)
    NoncyclicChainSCFT(system, lat, ds)
end;

Fixed cell calculation

The SCFT equations are solved for the current set of parameters using solve!. The model is updated in place. Note that the cell is not optimized.

Polyorder.solve!(scft_AB_lam)
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: Inf
[ Info: initial residual norm: 0.0
[ Info: initial stress norm: NaN
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.0]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: number: 100                                                                     
[ Info: F: 2.3605032468                                                                 

[ Info: resediual norm: 0.00221                                                         
[ Info: number: 200                                                                     
[ Info: F: 2.3619062409                                                                 
[ Info: resediual norm: 0.000161                                                        
[ Info: number: 300                                                                     
[ Info: F: 2.3619040482                                                                 
[ Info: resediual norm: 2.87e-5                                                         
[ Info: number: 400                                                                     
[ Info: F: 2.3619040009                                                                 
[ Info: resediual norm: 5.59e-6                                                         
[ Info: number: 500                                                                     
[ Info: F: 2.361903999                                                                  
[ Info: resediual norm: 1.13e-6                                                         
[ Info: final loss: 9.950139910450726e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.361903999
[ Info: final loss: 9.95e-7
[ Info: final stress norm: 0.0939920213304562
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.0]
└   * Angles: [0]
[ Info: iterations: 508
[ Info: time per iteration: 146 microseconds, 971 nanoseconds
[ Info: Run time: 00:00:00.074661583
[ Info: =======================================

Polyorder.Successful()

We can plot out the density fields to verify that the LAM phase is obtained.

plot_density(scft_AB_lam)
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/PpRC2/src/scenes.jl:264

The free energy and other properties can be achieved from the solved model through various methods, such as F, μ, etc.

Polyorder.F(scft_AB_lam)
2.3619039989826414

Cell optimization

The cell should be optimized to have zero stress, i.e. the phase separation structure is stress-free. Polyorder provides three ways to optimize the cell with a unified interface function cell_solve!:

  • Variable cell optimization: this is the most recommended way if you know a good initial guess. It optimizes the auxiliary fields and cell shape/size simultaneously. Therefore, it enjoys a fast convergence.
  • Stress-guided cell optimization: using optimization methods to find the zero-stress unit cell with the aid of the gradient (stress) with respect to cell size and shape. This is a compromising approach to obtain the stress-free solution of the SCFT equations.
  • Gradient-free cell optimization: it optimizes the unit cell sizes using gradient-free optimization methods. Note that only orthogonal unit cells are supported.
Variable cell optimization

To invoke the variable cell optimization mode via cell_solve! method, you need to either specify a VariableCell updater for the SCFT model or explicitly pass a VariableCell updater as an input argument to the cell_solve! method.

Note that the initial guess of the cell size is critical to find the equilibrium cell size. Here, by trial and error, we find the equilibrium cell size is about 7.0 $R_g$.

scft_vc = Polyorder.clone(scft_AB_lam);
using Polyorder: BB
Polyorder.cell_solve!(scft_vc, VariableCell(BB(1.0), SIS(1.0)));
[ Info: ###### Cell Optimization Start ######
┌ Info: Algorithm: Variable cell method
│ * Cell updater: Barzilai-Borwein (BB2) method
│ * max step size: 1.0
│ * step size: 0.2.
│ * Fields updater: 1S semi-implicit method (SIS-1) with α=1.0.
└ * Scheme: run fields updater 10 times per cell iteration.

[ Info: Cell optimization starts ...
[ Info: ******* SCFT Simulation Start *******
┌ Info: Algorithm: Variable cell method
│ * Cell updater: Barzilai-Borwein (BB2) method
│ * max step size: 1.0
│ * step size: 0.2.
│ * Fields updater: 1S semi-implicit method (SIS-1) with α=1.0.
└ * Scheme: run fields updater 10 times per cell iteration.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-5 (stress norm)
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: Inf
[ Info: initial residual norm: 0.0
[ Info: initial stress norm: NaN
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.0]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: final loss: 9.403203049406237e-7

[ Info: Stop triggered by a `ThresholdStress` control. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3352553247
[ Info: final loss: 9.4e-7
[ Info: final stress norm: 3.9e-7
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.5689029278439532]
└   * Angles: [0]
[ Info: iterations: 150
[ Info: time per iteration: 13 milliseconds, 591 microseconds, 744 nanoseconds
[ Info: Run time: 00:00:02.038761708
[ Info: =======================================
[ Info: Cell optimization finished.
[ Info: ------ Cell Optimization Summary ------
[ Info: Convergence: Polyorder.Successful()
┌ Info: Stress-free cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.5689029278439532]
└   * Angles: [0]
[ Info: Final F: 2.335255324663625
[ Info: Final loss: 9.403203049406237e-7
[ Info: Final stress: 3.8965693370336187e-7
[ Info: Total solve! calls: 15
[ Info: Total SCFT iterations: 150
[ Info: Total time: 00:00:03
Polyorder.F(scft_vc)
2.335255324663625
Polyorder.lattice(scft_vc)
BravaisLattice
  * Centering: p
  * Space group: #1 (p1)
  * Crystal system: Line
  * Unit cell: [3.5689029278439532] [0]
  * Free lattice parameters: [a]
Stress-guided cell optimization

If you call the cell_solve! method with only the SCFT model, i.e. no VariableCell updater is given as an input argument and the updater field of the SCFT model is not a VariableCell instance, then the stress-guided cell optimization is invoked.

scft_sgc = Polyorder.clone(scft_AB_lam)
Noncyclic Chain SCFT model:
* Free energy: Inf
* Residual: 0.0
* Stress norm: NaN
* Model type: SimpleFieldModel
* Model compressiblity: Incompressible
-----
PolymerSystem (AB) contains 1 components:

Component AB with ϕ=1.0 and α=1.0 contains BlockCopolymer AB with 2 blocks:
  * PolymerBlock A with f=0.36 of specie A
  * PolymerBlock B with f=0.64 of specie B

with Flory-Huggins interaction parameters betwen species:
    (A, B) => 15.0
and confined by BulkConfinement()-----
Simulation Cell: BravaisLattice
  * Centering: p
  * Space group: #1 (p1)
  * Crystal system: Line
  * Unit cell: [3.0] [0]
  * Free lattice parameters: [a]

-----
* Spatial resolution: (20,)
* Contour steps: Dict{Pair, Float64}[Dict((2 => 3) => 0.01, (2 => 1) => 0.01, (1 => 2) => 0.01, (3 => 2) => 0.01)]
* MDE solvers: Dict{Pair, Type{<:MDEAlgorithm}}[Dict((2 => 3) => OSF, (2 => 1) => OSF, (1 => 2) => OSF, (3 => 2) => OSF)]
-----
SCFT updater: PicardMann iteration with α=0.2.
-----
* First density field: 0.0 [0.0, 0.0]
* First auxiliary field: 1.87 [-4.209, 7.977]
scft_sgc.updater  # updater is PicardMann (alias for SD) not VariableCell
PicardMann iteration with α=0.2.
Polyorder.cell_solve!(scft_sgc);
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.

[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: Inf
[ Info: initial residual norm: 0.0
[ Info: initial stress norm: NaN
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.0]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: final loss: 9.950139910450726e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.361903999
[ Info: final loss: 9.95e-7
[ Info: final stress norm: 0.0939920213304562
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.0]
└   * Angles: [0]
[ Info: iterations: 1
[ Info: time per iteration: 230 microseconds, 875 nanoseconds
[ Info: Run time: 00:00:00.000230875
[ Info: =======================================
[ Info: ###### Cell Optimization Start ######
[ Info: Algorithm: LBFGS
[ Info: Cell optimization starts ...
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.

[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: 2.361903999
[ Info: initial residual norm: 9.95e-7
[ Info: initial stress norm: 0.094
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.0]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: final loss: 9.792596213124027e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.361903999
[ Info: final loss: 9.79e-7
[ Info: final stress norm: 0.09399202133236505
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.0]
└   * Angles: [0]
[ Info: iterations: 1
[ Info: time per iteration: 236 microseconds, 417 nanoseconds
[ Info: Run time: 00:00:00.000236417
[ Info: =======================================
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: 2.361903999
[ Info: initial residual norm: 9.79e-7
[ Info: initial stress norm: 0.0857
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.093992021332365]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: number: 100                                                                     
[ Info: F: 2.3538079447                                                                 
[ Info: resediual norm: 9.82e-6                                                         
[ Info: final loss: 9.817601816895407e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3538082163
[ Info: final loss: 9.82e-7
[ Info: final stress norm: 0.0790552621704265
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.093992021332365]
└   * Angles: [0]
[ Info: iterations: 181
[ Info: time per iteration: 39 microseconds, 965 nanoseconds
[ Info: Run time: 00:00:00.00723375
[ Info: =======================================
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: Inf
[ Info: initial residual norm: 0.0
[ Info: initial stress norm: NaN
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.469960106661825]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: number: 100                                                                     
[ Info: F: 2.336023992                                                                  
[ Info: resediual norm: 2.45e-5                                                         
[ Info: number: 200                                                                     
[ Info: F: 2.3360265287                                                                 
[ Info: resediual norm: 1.33e-6                                                         
[ Info: final loss: 9.805254127742206e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3360265522
[ Info: final loss: 9.81e-7
[ Info: final stress norm: 0.016120954946274867
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.469960106661825]
└   * Angles: [0]
[ Info: iterations: 212
[ Info: time per iteration: 46 microseconds, 420 nanoseconds
[ Info: Run time: 00:00:00.009841083
[ Info: =======================================
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: Inf
[ Info: initial residual norm: 0.0
[ Info: initial stress norm: NaN
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [5.349800533309127]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: number: 100                                                                     
[ Info: F: 2.400488446                                                                  
[ Info: resediual norm: 0.00717                                                         
[ Info: number: 200                                                                     
[ Info: F: 2.3993211466                                                                 
[ Info: resediual norm: 0.000501                                                        
[ Info: number: 300                                                                     
[ Info: F: 2.3993204556                                                                 
[ Info: resediual norm: 4.23e-5                                                         
[ Info: number: 400                                                                     
[ Info: F: 2.3993204564                                                                 
[ Info: resediual norm: 3.58e-6                                                         
[ Info: final loss: 9.910217975848226e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3993204578
[ Info: final loss: 9.91e-7
[ Info: final stress norm: 0.06627459638201587
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [5.349800533309127]
└   * Angles: [0]
[ Info: iterations: 452
[ Info: time per iteration: 76 microseconds, 147 nanoseconds
[ Info: Run time: 00:00:00.034418542
[ Info: =======================================
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: Inf
[ Info: initial residual norm: 0.0
[ Info: initial stress norm: NaN
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [4.174900266654563]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: number: 100                                                                     
[ Info: F: 2.4574872133                                                                 
[ Info: resediual norm: 0.00408                                                         
[ Info: number: 200                                                                     
[ Info: F: 2.4563570048                                                                 
[ Info: resediual norm: 0.00246                                                         

[ Info: number: 300                                                                     
[ Info: F: 2.4480474596                                                                 
[ Info: resediual norm: 0.0152                                                          
[ Info: number: 400                                                                     
[ Info: F: 2.3610466889                                                                 
[ Info: resediual norm: 0.00132                                                         
[ Info: number: 500                                                                     
[ Info: F: 2.3621010938                                                                 
[ Info: resediual norm: 1.12e-5                                                         
[ Info: final loss: 9.769313312584774e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3621019806
[ Info: final loss: 9.77e-7
[ Info: final stress norm: 0.08276623343413614
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [4.174900266654563]
└   * Angles: [0]
[ Info: iterations: 587
[ Info: time per iteration: 124 microseconds, 119 nanoseconds
[ Info: Run time: 00:00:00.072858042
[ Info: =======================================
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: Inf
[ Info: initial residual norm: 0.0
[ Info: initial stress norm: NaN
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.624758663026389]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: number: 100                                                                     
[ Info: F: 2.335517883                                                                  
[ Info: resediual norm: 2.31e-5                                                         
[ Info: number: 200                                                                     
[ Info: F: 2.3355153209                                                                 
[ Info: resediual norm: 1.65e-6                                                         
[ Info: final loss: 9.807549199407386e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3355152853
[ Info: final loss: 9.81e-7
[ Info: final stress norm: 0.008877514204048951
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.624758663026389]
└   * Angles: [0]
[ Info: iterations: 222
[ Info: time per iteration: 46 microseconds, 293 nanoseconds
[ Info: Run time: 00:00:00.010277208
[ Info: =======================================
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: 2.3355152853
[ Info: initial residual norm: 9.81e-7
[ Info: initial stress norm: 0.00929
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.570842759973088]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: number: 100                                                                     
[ Info: F: 2.3352564803                                                                 
[ Info: resediual norm: 2.8e-6                                                          
[ Info: final loss: 9.90166531875647e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3352562094
[ Info: final loss: 9.9e-7
[ Info: final stress norm: 0.0003118318245914243
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.570842759973088]
└   * Angles: [0]
[ Info: iterations: 134
[ Info: time per iteration: 45 microseconds, 327 nanoseconds
[ Info: Run time: 00:00:00.006073875
[ Info: =======================================
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: 2.3352562094
[ Info: initial residual norm: 9.9e-7
[ Info: initial stress norm: 0.000376
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.355179147759884]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: number: 100                                                                     
[ Info: F: 2.3389431772                                                                 
[ Info: resediual norm: 1.34e-5                                                         
[ Info: final loss: 9.88071581214244e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3389419841
[ Info: final loss: 9.88e-7
[ Info: final stress norm: 0.03528700730718277
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.355179147759884]
└   * Angles: [0]
[ Info: iterations: 195
[ Info: time per iteration: 87 microseconds, 829 nanoseconds
[ Info: Run time: 00:00:00.017126667
[ Info: =======================================
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)




[ Info: initial F: 2.3389419841
[ Info: initial residual norm: 9.88e-7
[ Info: initial stress norm: 0.0293
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.568953631581977]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: number: 100                                                                     
[ Info: F: 2.3352539916                                                                 
[ Info: resediual norm: 1.16e-5                                                         
[ Info: final loss: 9.833512543772485e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3352553811
[ Info: final loss: 9.83e-7
[ Info: final stress norm: 8.487539414424555e-6
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.568953631581977]
└   * Angles: [0]
[ Info: iterations: 183
[ Info: time per iteration: 60 microseconds, 172 nanoseconds
[ Info: Run time: 00:00:00.011011542
[ Info: =======================================
[ Info: Cell optimization finished.
[ Info: ------ Cell Optimization Summary ------
[ Info: Convergence: Unknown
┌ Info: Stress-free cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.568953631581977]
└   * Angles: [0]
[ Info: Final F: 2.33525538105806
[ Info: Final loss: 2.3288213063069114e-6
[ Info: Final stress: 8.487539414424555e-6
[ Info: Total solve! calls: 9
[ Info: Total SCFT iterations: 2167
[ Info: Total time: 00:00:02
Polyorder.F(scft_sgc) - Polyorder.F(scft_vc)
5.6394434899686985e-8
Scattering.edges(Polyorder.unitcell(scft_sgc))[1] - Scattering.edges(Polyorder.unitcell(scft_vc))[1]
5.070373802373851e-5
Gradient-free cell optimization
scft_co = Polyorder.clone(scft_AB_lam);
Polyorder.cell_solve!(OptimGradientFreeCellOpt(), scft_co);
[ Info: UnitCell: 3.0
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: Inf
[ Info: initial residual norm: 0.0
[ Info: initial stress norm: NaN
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.0]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: final loss: 9.950139910450726e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.361903999
[ Info: final loss: 9.95e-7
[ Info: final stress norm: 0.0939920213304562
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.0]
└   * Angles: [0]
[ Info: iterations: 1
[ Info: time per iteration: 258 microseconds, 791 nanoseconds
[ Info: Run time: 00:00:00.000258791
[ Info: =======================================
[ Info: UnitCell: 3.23606797749979
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: Inf
[ Info: initial residual norm: 0.0
[ Info: initial stress norm: NaN
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.23606797749979]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: number: 100                                                                     
[ Info: F: 2.3443023612                                                                 
[ Info: resediual norm: 2.01e-5                                                         
[ Info: number: 200                                                                     
[ Info: F: 2.3443034121                                                                 
[ Info: resediual norm: 1.1e-6                                                          
[ Info: final loss: 9.957071075698174e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3443034184
[ Info: final loss: 9.96e-7
[ Info: final stress norm: 0.05540078445175035
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.23606797749979]
└   * Angles: [0]
[ Info: iterations: 204
[ Info: time per iteration: 54 microseconds, 837 nanoseconds
[ Info: Run time: 00:00:00.011186916
[ Info: =======================================
[ Info: UnitCell: 3.381966011250105
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: Inf
[ Info: initial residual norm: 0.0
[ Info: initial stress norm: NaN
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.381966011250105]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: number: 100                                                                     
[ Info: F: 2.3380640218                                                                 
[ Info: resediual norm: 9.91e-6                                                         
[ Info: final loss: 9.756146020293747e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.33806486
[ Info: final loss: 9.76e-7
[ Info: final stress norm: 0.030782739054540445
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.381966011250105]
└   * Angles: [0]
[ Info: iterations: 181
[ Info: time per iteration: 46 microseconds, 816 nanoseconds
[ Info: Run time: 00:00:00.008473791
[ Info: =======================================
[ Info: UnitCell: 3.472135954999579
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: 2.33806486
[ Info: initial residual norm: 9.76e-7
[ Info: initial stress norm: 0.0284
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.472135954999579]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: number: 100                                                                     
[ Info: F: 2.3359918736                                                                 
[ Info: resediual norm: 5.36e-6                                                         
[ Info: final loss: 9.796632321337623e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3359923953
[ Info: final loss: 9.8e-7
[ Info: final stress norm: 0.015761786740508793
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.472135954999579]
└   * Angles: [0]
[ Info: iterations: 157
[ Info: time per iteration: 46 microseconds, 368 nanoseconds
[ Info: Run time: 00:00:00.007279916
[ Info: =======================================
[ Info: UnitCell: 3.5278640450004204
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: 2.3359923953
[ Info: initial residual norm: 9.8e-7
[ Info: initial stress norm: 0.015
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.5278640450004204]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: number: 100                                                                     
[ Info: F: 2.3353819397                                                                 
[ Info: resediual norm: 3.13e-6                                                         
[ Info: final loss: 9.995785970039056e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3353822361
[ Info: final loss: 1.0e-6
[ Info: final stress norm: 0.006630272827639826
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.5278640450004204]
└   * Angles: [0]
[ Info: iterations: 137
[ Info: time per iteration: 46 microseconds, 403 nanoseconds
[ Info: Run time: 00:00:00.00635725
[ Info: =======================================
[ Info: UnitCell: 3.56636479988941
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: 2.3353822361
[ Info: initial residual norm: 1.0e-6
[ Info: initial stress norm: 0.00642
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.56636479988941]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: number: 100                                                                     
[ Info: F: 2.3352551696                                                                 
[ Info: resediual norm: 2.08e-6                                                         
[ Info: final loss: 9.770849984803595e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3352553524
[ Info: final loss: 9.77e-7
[ Info: final stress norm: 0.00040724884947401557
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.56636479988941]
└   * Angles: [0]
[ Info: iterations: 124
[ Info: time per iteration: 46 microseconds, 367 nanoseconds
[ Info: Run time: 00:00:00.005749583
[ Info: =======================================
[ Info: UnitCell: 3.567402686224689
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: 2.3352553524
[ Info: initial residual norm: 9.77e-7
[ Info: initial stress norm: 0.000407
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.567402686224689]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: final loss: 9.874839581310467e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3352547663
[ Info: final loss: 9.87e-7
[ Info: final stress norm: 0.0002402519075697016
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.567402686224689]
└   * Angles: [0]
[ Info: iterations: 47
[ Info: time per iteration: 46 microseconds, 406 nanoseconds
[ Info: Run time: 00:00:00.002181083
[ Info: =======================================
[ Info: UnitCell: 3.5867421228946395
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: 2.3352547663
[ Info: initial residual norm: 9.87e-7
[ Info: initial stress norm: 0.000236
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.5867421228946395]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: number: 100                                                                     
[ Info: F: 2.3352844577                                                                 
[ Info: resediual norm: 1.02e-6                                                         
[ Info: final loss: 9.852517709685371e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3352844661
[ Info: final loss: 9.85e-7
[ Info: final stress norm: 0.00285474746171586
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.5867421228946395]
└   * Angles: [0]
[ Info: iterations: 101
[ Info: time per iteration: 45 microseconds, 426 nanoseconds
[ Info: Run time: 00:00:00.004588125
[ Info: =======================================
[ Info: UnitCell: 3.574789693709334
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: 2.3352844661
[ Info: initial residual norm: 9.85e-7
[ Info: initial stress norm: 0.00288
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.574789693709334]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: final loss: 9.970821470893254e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3352596846
[ Info: final loss: 9.97e-7
[ Info: final stress norm: 0.0009446603353885687
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.574789693709334]
└   * Angles: [0]
[ Info: iterations: 83
[ Info: time per iteration: 46 microseconds, 743 nanoseconds
[ Info: Run time: 00:00:00.00387975
[ Info: =======================================
[ Info: UnitCell: 3.5702242720086734
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: 2.3352596846
[ Info: initial residual norm: 9.97e-7
[ Info: initial stress norm: 0.000948
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.5702242720086734]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: final loss: 9.579821170175291e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.33525638
[ Info: final loss: 9.58e-7
[ Info: final stress norm: 0.00021259986721883884
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.5702242720086734]
└   * Angles: [0]
[ Info: iterations: 69
[ Info: time per iteration: 46 microseconds, 67 nanoseconds
[ Info: Run time: 00:00:00.003178625
[ Info: =======================================
[ Info: UnitCell: 3.567842532704476
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: 2.33525638
[ Info: initial residual norm: 9.58e-7
[ Info: initial stress norm: 0.000213
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.567842532704476]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: final loss: 9.65845298959105e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3352560942
[ Info: final loss: 9.66e-7
[ Info: final stress norm: 0.00016981889396704933
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.567842532704476]
└   * Angles: [0]
[ Info: iterations: 59
[ Info: time per iteration: 46 microseconds, 553 nanoseconds
[ Info: Run time: 00:00:00.002746667
[ Info: =======================================
[ Info: UnitCell: 3.567000176737211
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: 2.3352560942
[ Info: initial residual norm: 9.66e-7
[ Info: initial stress norm: 0.00017
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.567000176737211]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: final loss: 9.818700849932151e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3352557303
[ Info: final loss: 9.82e-7
[ Info: final stress norm: 0.00030536064732300137
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.567000176737211]
└   * Angles: [0]
[ Info: iterations: 41
[ Info: time per iteration: 48 microseconds, 842 nanoseconds
[ Info: Run time: 00:00:00.002002542
[ Info: =======================================
[ Info: UnitCell: 3.5675706926301354
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: 2.3352557303
[ Info: initial residual norm: 9.82e-7
[ Info: initial stress norm: 0.000305
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.5675706926301354]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: final loss: 9.651434972625866e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3352549891
[ Info: final loss: 9.65e-7
[ Info: final stress norm: 0.00021291272071979875
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.5675706926301354]
└   * Angles: [0]
[ Info: iterations: 37
[ Info: time per iteration: 48 microseconds, 655 nanoseconds
[ Info: Run time: 00:00:00.00180025












[ Info: =======================================
[ Info: UnitCell: 3.5672489412812665
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-6 (Residual)
[ Info: initial F: 2.3352549891
[ Info: initial residual norm: 9.65e-7
[ Info: initial stress norm: 0.000213
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.5672489412812665]
└   * Angles: [0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: final loss: 9.396767957476443e-7
[ Info: Stop triggered by EarlyStopping.Threshold(1.0e-6) stopping criterion. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3352561021
[ Info: final loss: 9.4e-7
[ Info: final stress norm: 0.0002659768367749468
┌ Info: final unit cell: UnitCell
│   * Crystal system: Line
│   * Edges: [3.5672489412812665]
└   * Angles: [0]
[ Info: iterations: 29
[ Info: time per iteration: 49 microseconds, 613 nanoseconds
[ Info: Run time: 00:00:00.001438792
[ Info: =======================================
Polyorder.F(scft_co) - Polyorder.F(scft_vc)
7.774691996864647e-7
Scattering.edges(Polyorder.unitcell(scft_co))[1] - Scattering.edges(Polyorder.unitcell(scft_vc))[1]
-0.0016539865626867822

Exercises

  1. Compute the free energies of the LAM phase for the same system with χN=20.0 and fA=[0.36, 0.38, 0.40, 0.42].

HEX

To compute the hexagonal cylinder phase, we construct a simulation cell with simple hexagonal unit cell an space group 17. The space group is used by symmetrizing functionality of Polyorder if enabled.

scft_AB_hex = let
    ds = 0.01
    uc = UnitCell(Hexagonal2D(), 3.6)  # A simple cell with side length 3.6 Rg
    lat = BravaisLattice(uc, 17)  # space group No.17
    system = AB_system(χN=15.0, fA=0.36)
    NoncyclicChainSCFT(system, lat, ds)
end;
let
    scftconfig = SCFTConfig(symmetrize=false, max_iter=500, tolmode=:F, tol=1e-8)
    config = Polyorder.Config(scft=scftconfig)
    Polyorder.solve!(scft_AB_hex, config)
end
[ Info: ******* SCFT Simulation Start *******
[ Info: Algorithm: PicardMann iteration with α=0.2.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-8 (F)
[ Info: initial F: Inf
[ Info: initial residual norm: 0.0
[ Info: initial stress norm: NaN
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Hexagonal2D
│   * Edges: [3.6, 3.6]
└   * Angles: [2π/3, 0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: number: 100                                                                     
[ Info: F: 2.322314367                                                                  
[ Info: resediual norm: 0.00259                                                         
[ Info: final loss: 0.00011021235430670891
[ Info: Stop triggered by a `ThresholdObjFun` control. 
[ Info: > > > > > > Simulation finished.

[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.3276922108
[ Info: final loss: 0.00011
[ Info: final stress norm: 0.02983406539057686
┌ Info: final unit cell: UnitCell
│   * Crystal system: Hexagonal2D
│   * Edges: [3.6, 3.6]
└   * Angles: [2π/3, 0]
[ Info: iterations: 189
[ Info: time per iteration: 13 milliseconds, 178 microseconds, 504 nanoseconds
[ Info: Run time: 00:00:02.490737416
[ Info: =======================================

Polyorder.Successful()

Plot the density field of any component, and verify that the hexagonal cylinder phase is actually being computed. If not, you have to go back to the above procedure, change the cell size or disable symmetrizer or initialize by a perpared hexagonal cylinder phase.

plot_density(scft_AB_hex)
┌ Warning: Found `resolution` in the theme when creating a `Scene`. The `resolution` keyword for `Scene`s and `Figure`s has been deprecated. Use `Figure(; size = ...` or `Scene(; size = ...)` instead, which better reflects that this is a unitless size and not a pixel resolution. The key could also come from `set_theme!` calls or related theming functions.
└ @ Makie ~/.julia/packages/Makie/PpRC2/src/scenes.jl:264

Optimize the simulation cell:

using Polyorder: SD
let
    scftconfig = SCFTConfig(symmetrize=false, max_iter=500, tolmode=:F, tol=1e-8)
    config = Polyorder.Config(scft=scftconfig)
    scft = Polyorder.clone(scft_AB_hex)
    Polyorder.cell_solve!(scft, VariableCell(BB(1.0), SD(0.2)), config)
end;
[ Info: ###### Cell Optimization Start ######
┌ Info: Algorithm: Variable cell method
│ * Cell updater: Barzilai-Borwein (BB2) method
│ * max step size: 1.0
│ * step size: 0.2.
│ * Fields updater: PicardMann iteration with α=0.2.
└ * Scheme: run fields updater 10 times per cell iteration.

[ Info: Cell optimization starts ...
[ Info: ******* SCFT Simulation Start *******
┌ Info: Algorithm: Variable cell method
│ * Cell updater: Barzilai-Borwein (BB2) method
│ * max step size: 1.0
│ * step size: 0.2.
│ * Fields updater: PicardMann iteration with α=0.2.
└ * Scheme: run fields updater 10 times per cell iteration.
[ Info: MDE solvers: ["OSF"]
[ Info: tolerance: 1.0e-5 (stress norm)
[ Info: tolerance: 1.0e-8 (F)
[ Info: initial F: Inf
[ Info: initial residual norm: 0.0
[ Info: initial stress norm: NaN
┌ Info: initial unit cell: UnitCell
│   * Crystal system: Hexagonal2D
│   * Edges: [3.6, 3.6]
└   * Angles: [2π/3, 0]
[ Info: 
[ Info: Simulation starts > > > > > >
[ Info: final loss: 4.707370524641122e-6

[ Info: Stop triggered by a `ThresholdStress` control. 
[ Info: > > > > > > Simulation finished.
[ Info: 
[ Info: ------ SCFT Simulation Summary ------
[ Info: convergence: Polyorder.Successful()
[ Info: final F: 2.315093788
[ Info: final loss: 4.71e-6
[ Info: final stress norm: 2.91e-7
┌ Info: final unit cell: UnitCell
│   * Crystal system: Hexagonal2D
│   * Edges: [4.030685226019776, 4.030685226019776]
└   * Angles: [2π/3, 0]
[ Info: iterations: 160
[ Info: time per iteration: 8 milliseconds, 156 microseconds, 643 nanoseconds
[ Info: Run time: 00:00:01.305063
[ Info: =======================================
[ Info: Cell optimization finished.
[ Info: ------ Cell Optimization Summary ------
[ Info: Convergence: Polyorder.Successful()
┌ Info: Stress-free cell: UnitCell
│   * Crystal system: Hexagonal2D
│   * Edges: [4.030685226019776, 4.030685226019776]
└   * Angles: [2π/3, 0]
[ Info: Final F: 2.3150937879796447
[ Info: Final loss: 4.707370524641122e-6
[ Info: Final stress: 2.906740043964148e-7
[ Info: Total solve! calls: 16
[ Info: Total SCFT iterations: 160
[ Info: Total time: 00:00:02

Exercises

  1. Compute the free energies of the HEX phase for the same system with χN=20.0 and fA=[0.36, 0.38, 0.40, 0.42].