Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions polymer_brushes/FreeformVFP.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np

from scipy.interpolate import PchipInterpolator as Pchip
from scipy.integrate import simps
from scipy.integrate import simpson

from refnx.reflect import Structure, Component, SLD, Slab
from refnx.analysis import Parameters, Parameter, possibly_create_parameter
Expand Down Expand Up @@ -84,6 +84,11 @@ def __init__(self, adsorbed_amount, vff, dzf, polymer_sld, name='',
possibly_create_parameter(adsorbed_amount,
name='%s - adsorbed amount' % name))

# NEW : need a non-varying parameter that can be used for binaryops
# for corefining
self.extent = (possibly_create_parameter(0,
name='%s - extent' % name))

# dzf are the spatial gaps between the spline knots
self.dzf = Parameters(name='dzf - spline')
for i, z in enumerate(dzf):
Expand Down Expand Up @@ -152,6 +157,9 @@ def _extent(self):
interpolator = self._vfp_interpolator()
extent = difference / interpolator.integrate(0, 1)

# Update proxy-parameter
self.extent.value = extent

return extent

def _slab_area(self):
Expand Down Expand Up @@ -243,7 +251,7 @@ def moment(self, moment=1):
"""
zed, profile = self.profile()
profile *= zed**moment
val = simps(profile, zed)
val = simpson(profile, zed)
area = self.profile_area()
return val / area

Expand All @@ -254,7 +262,7 @@ def is_monotonic(self):
def parameters(self):
p = Parameters(name=self.name)
p.extend([self.adsorbed_amount, self.dzf, self.vff,
self.polymer_sld.parameters])
self.polymer_sld.parameters, self.extent])
p.extend([slab.parameters for slab in self.left_slabs])
p.extend([slab.parameters for slab in self.right_slabs])
return p
Expand Down
21 changes: 20 additions & 1 deletion polymer_brushes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,23 @@ interface where the interfacial volume can be approximated.
Added by:
Isaac Gresham

Date: 24/03/2020
Date: 24/03/2020


# Maxent
Added by:
Andrew Nelson

Date: 01/08/2023


# numerical self-consistent field theory

Adapts the public domain nSCFT code written for Refl1D by Paul Kienzle and Richard Sheridan.
The work of Sheridan et al. should be cited if this code is used: https://doi.org/10.1021/acs.macromol.7b00639


Added by:
Isaac Gresham

Date: 10/08/2023
Loading