Documentation
¶
Index ¶
- func AreaModulusWeight(miller Miller, Q *mat.Dense) float64
- func BuildCrystal(ucell UnitCell, kernel AtomicKernel, grid *pfutil.Grid)
- func BulkModWeight(miller Miller, Q *mat.Dense) float64
- func CornersScaledCrd(cell Cell, domainSize []int) *mat.Dense
- func CubicUnitCellDensity(miller Miller) float64
- func NumEquivalent(miller Miller, dim int) int
- func NumEquivalent2D(miller Miller) int
- func NumEquivalent3D(miller Miller) int
- func QuadCube(f func(float64, float64, float64) float64, n int) float64
- func QuadSquare(f func(float64, float64) float64, n int) float64
- func ShearModWeight(m Miller, Q *mat.Dense) float64
- func TiltGB(grid *pfutil.Grid, angle float64)
- func XYPlaneShearWeight(miller Miller, Q *mat.Dense) float64
- type AtomicKernel
- type Cell
- type CircleKernel
- type ElasticPropResult
- type ElasticPropertyTarget
- type ElasticTargetType
- type GaussianKernel
- type HyperOctantExplorer
- type IdealMix
- type InitialGuessExplorer
- type Miller
- type ModeResult
- type ModeSolver
- func (ms *ModeSolver) MatchElasticProp(properties map[string]float64) ElasticPropResult
- func (ms *ModeSolver) ModeDensity(mode int, scaledPosition []float64) float64
- func (ms *ModeSolver) PeakWidths(target map[string]float64, modeAmp []float64) PeakWidthResult
- func (ms *ModeSolver) Solve(initGuess InitialGuessExplorer) ModeResult
- func (ms *ModeSolver) UnitcellIntegral(powers []int, order int) float64
- type Peak
- type PeakWidthResult
- type ReciprocalCell
- type ReciprocalSpacePairCorrelation
- type SinglePointExplorer
- type UnitCell
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreaModulusWeight ¶
AreaModulusWeight return the weight associated with area compression this is the 2D equivalent of the bulk modulus. The modulus is obtained as follows. The area modulus is defined via B_A = A*dE^2/dA^2, where E is the total elastic energy
func BuildCrystal ¶
func BuildCrystal(ucell UnitCell, kernel AtomicKernel, grid *pfutil.Grid)
BuildCrystal constructs a field that is organized as a crystal ucell is the unit cell, kernel is the functional form used to represent the field form one atom and grid is a computational grid that will be assigned the field corresponding to the crystal structure
func BulkModWeight ¶
BulkModWeight returns the weight (e.g. value in design matrix) needed to fit a bulk modulus. Miller is the mode, Q is that matrix product C^TC, where each column in C represents a reciprocal lattice vector The Reuss formula for the bulk modulus is applied https://wiki.materialsproject.org/Elasticity_calculations
func CornersScaledCrd ¶
CornersScaledCrd returns the positions of the corners in scaled coordinates Cell represents the unit cell and domainSize gives the size of the domain which is assumed to be the box [0, domainSize[0]] x [0, domainSize[1]] (x [0, domainSize[2]] if in 3D)
func CubicUnitCellDensity ¶
CubicUnitCellDensity returns the density of a plane when the underlying Bravais lattice is cubic.
func NumEquivalent ¶
NumEquivalent returns the number of equivalent indices
func NumEquivalent2D ¶
NumEquivalent2D returns the number of equivalent miller indices in 2D
func NumEquivalent3D ¶
NumEquivalent3D returns the number of equivalent planes
func QuadCube ¶
QuadCube calculates the 3D integral over a unit cube [0, 1] x [0, 1] x [0, 1] using tensorial Legendre quadrature. The tensorial Legendre quadrature, is not optimal with respect to function evaluations, but does the job.
func QuadSquare ¶
QuadSquare calculates the 2D integral over a unit square [0, 1] x [0, 1] using tensorial Legendre quadrature. The tensorial Legendre quadrature, is not optimal with respect to function evaluations, but does the job.
func ShearModWeight ¶
ShearModWeight calcualtes the weight needed to fit the shear modulus Miller is the mode, Q is that matrix product C^TC, where each column in C represents a reciprocal lattice vector The Reuss formula for the shear modulus is applied https://wiki.materialsproject.org/Elasticity_calculations
func TiltGB ¶
TiltGB creates a tilt grain boundary from a grid that is already initialized as a single crystal. The grain boundary is centered at the computational cell
func XYPlaneShearWeight ¶
XYPlaneShearWeight returns the shear modulus associated with shear in the XY plane. The values for the averages is obtained from
Meille, S. and Garboczi, E.J., 2001. Linear elastic properties of 2D and 3D models of porous materials made from elongated objects. Modelling and Simulation in Materials Science and Engineering, 9(5), p.371.
Types ¶
type AtomicKernel ¶
type AtomicKernel interface { // Eval evaluates the kernel at the given coordinate Eval(x float64) float64 // Cutoff specifies a maximum value beyond which Eval returns // essentially zero Cutoff() float64 }
AtomicKernel is a function type that returns a density
type Cell ¶
Cell is a type used to represent a unit cell. In the underlying CellVec matrix, each column represents a cell vector
func SC3D ¶
SC3D returns the primitive unit cell for a simple cubic structure with lattice parameter a in 3D
func Triangular2D ¶
Triangular2D returns the primitive cell of a triangular lattice in 2D
func (*Cell) Reciprocal ¶
func (c *Cell) Reciprocal() ReciprocalCell
Reciprocal returns a cell object representing the reciprocal cell The underlying matrix of the reciprocal lattice is given by
M^T = 2*pi*C^{-1}
where each column of M is a reciprocal lattice vector and each column if C is a real lattice vector
type CircleKernel ¶
type CircleKernel struct {
Radius float64
}
CircleKernel represents the field from one atom as a square
func (*CircleKernel) Cutoff ¶
func (ck *CircleKernel) Cutoff() float64
Cutoff returns the width of the square
func (*CircleKernel) Eval ¶
func (ck *CircleKernel) Eval(x float64) float64
Eval return 1 if -width/2 <= x < width/2, and zero otherwise
type ElasticPropResult ¶
ElasticPropResult returns the obtained amplitide as well as the elastic tensor that corresponds to the solution
type ElasticPropertyTarget ¶
type ElasticPropertyTarget struct { Bulk float64 Shear float64 TargetType ElasticTargetType }
ElasticPropertyTarget is a type that holds target values for fitting widths of peak heights. The default is to fit an isotropic material (in which case the bulk modules and shear modulus are matched)
type ElasticTargetType ¶
type ElasticTargetType int
ElasticTargetType is an integer type used to tune peak widths
const ( // ISOTROPIC is used together with ElasticPropertyTarget type to indicate // that the bulk and shear modulus should be fitted ISOTROPIC ElasticTargetType = iota )
type GaussianKernel ¶
type GaussianKernel struct { // Width is the "standard deviation" of the gaussian Width float64 }
GaussianKernel is a type that represents the field from one atoms as a Gaussian centered at position of the atom
func (*GaussianKernel) Cutoff ¶
func (gk *GaussianKernel) Cutoff() float64
Cutoff returns a cutoff where the kernel is essentiall zero
func (*GaussianKernel) Eval ¶
func (gk *GaussianKernel) Eval(x float64) float64
Eval evaluates the gaussian kernel
type HyperOctantExplorer ¶
type HyperOctantExplorer struct { // Starting positions X0 []float64 // contains filtered or unexported fields }
HyperOctantExplorer tries initial conditions starting from all combinations of +- X0
func (*HyperOctantExplorer) Next ¶
func (hoe *HyperOctantExplorer) Next() []float64
Next returns the next hyper parameter
func (*HyperOctantExplorer) OnMinimizationFinished ¶
func (hoe *HyperOctantExplorer) OnMinimizationFinished(res *optimize.Result)
OnMinimizationFinished does nothing (included to satisfy the InitialGuessExplorer interface)
type IdealMix ¶
IdealMix is a type used to represent the ideal mixing entropy with respect to a reference state. The polynomial is used together with a dimensionless density field n = rho/rho_0 - 1, where rho is the real density field and rho_0 is the reference density. The real mixing free energy is given by
F_id = (1 + n)*ln(1 + n) - n
An expansion of this around the reference state (n = 0) yields
F_id = (n^2/2 - C3*n^3/6 + C4*n^4/12)
where C3 and C4 are treated as free parameters that can be used to stabilize particular structures of interest. Reference
Greenwood, M., Provatas, N. and Rottler, J., 2010. Free energy functionals for efficient phase field crystal modeling of structural phase transformations. Physical review letters, 105(4), p.045702.
func (*IdealMix) FourthOrderPrefactor ¶
FourthOrderPrefactor returns the prefactor in front of the fourth order term
func (*IdealMix) QuadraticPrefactor ¶
QuadraticPrefactor returns the prefactor in front of the quadratic term
func (*IdealMix) ThirdOrderPrefactor ¶
ThirdOrderPrefactor returns the prefactor in front of the third order term
type InitialGuessExplorer ¶
type InitialGuessExplorer interface { // Next return the next initial guess. It should return // nil when all initial guess has been explored Next() []float64 // OnMinimzationFinished is a callback method that is called everytime // the local minimizer finds a solution OnMinimizationFinished(res *optimize.Result) }
InitialGuessExplorer is a type that is used to generate initial guesses for local minimzation algorithms
type Miller ¶
type Miller struct {
H, K, L int
}
Miller is a struct used to represent the Miller indices of a crystal plane
func EquivalentMiller ¶
EquivalentMiller returns a array with all miller indices that are equivalent to the one passed (including the one passed)
func EquivalentMillerNoPermutations ¶
EquivalentMillerNoPermutations returns all equivalent miller indices without taking permutations into account
type ModeResult ¶
ModeResult is a type that is returned by the mode optimizer
type ModeSolver ¶
type ModeSolver struct { IdealMix IdealMix // Miller is a list of miller corresponding to each mode Miller []Miller // ReciprocalCell is a type that represents the reciprocal lattice ReciprocalCell ReciprocalCell }
ModeSolver directly solves the phase field equations by expanding the density field into modes. The modes are assumed to correspond to peaks in the free energy spectrum
func (*ModeSolver) MatchElasticProp ¶
func (ms *ModeSolver) MatchElasticProp(properties map[string]float64) ElasticPropResult
MatchElasticProp calculates a set of prefactors associated with each mode peak such that it matches the passed elastic tensor. The expressions are obtained as follows are obtained by taking second derivatives with respect to the strain tensor. From the n^2 term in the ideal mixture term and the excess energy we obtain the following relation for the contribution to the the total energy F_q = 0.5*beta_q*A_q*(1 - (1 - dk_q^2/2(w_q))) where V_cell is the volume of the unit cell, q is a multiindex representing a hkl tuple. beta_q is the number of equivalent planes, A_eq is the amplitude associated with the mode. Finally, the gaussian peak as been expanded around the maximum to leading order in dk_q, which is the change in mode location due to the strain. w_q is width of the peak. In the following we introduce a set of factors h_q^2 = 0.5*beta_q*A_q/w_q. The contribution to the free energy from mode q is therefore given by F_q = 0.5*h_q^2*dk^2 The change in reciprocal lattice originating from a small strain is to first order dC = -C*e, where e is the strain tensor and C is the original reciprocal lattice A given hkl vector is given by dk_q = C*m_q, where m_q is a vector of miller indices. Further, the length of the dk_q square is given by dk_q^Tdk_q = m^T*e^T*C^T*C*e*m Differentiation twice with respect to an element in the strain tensor (let's say st and uv) we get that C_{stuv} = -h_q*m_t*Q_su*m_v, where Q = C^TC has been introduced. To obtain the total free energy, we sum over all modes q. This leaves, a linear system of equations to be solved. It is possible to fit the following properties 1. Bulk - bulk modulus in 3D 2. shear - shear modulus in 3D 3. area - area modulus (the equivalent of bulk modulus, but in 2D) 4. xyshear - shear modulus in 2D (e.g. shear in xy plane)
func (*ModeSolver) ModeDensity ¶
func (ms *ModeSolver) ModeDensity(mode int, scaledPosition []float64) float64
ModeDensity returns the contribution to the total density from the mode being passed. The position should be given in scaled coordinates. The contribution to the total density from onde mode is given by sum_{hkl} cos(g_{hkl}*r), where the sum runs over all equivalent miller indices. r is the position vector.
func (*ModeSolver) PeakWidths ¶
func (ms *ModeSolver) PeakWidths(target map[string]float64, modeAmp []float64) PeakWidthResult
PeakWidths returns the width of the different peaks in the correlation function. The widths are obtained by matching elastic properties specified in target.
func (*ModeSolver) Solve ¶
func (ms *ModeSolver) Solve(initGuess InitialGuessExplorer) ModeResult
Solve returns the coefficients that minimizes the free energy. initGuess provised an explorer such that the method can try many different starting positions, and then return the best. If nil, the HyperOctantSearcher will be used.
func (*ModeSolver) UnitcellIntegral ¶
func (ms *ModeSolver) UnitcellIntegral(powers []int, order int) float64
UnitcellIntegral integrates powers of mode contributions over the unitcell. Powers is a an array of the powers of each term in the same order as the modes are listed in the Miller attribute. The order of the Gauss-Quadrature rule used internally is passed as order
Example: If the density consists of three modes, let's say [[100], [111], [200]] denotet n_{100}, n_{111} and n_{200}, respectively. If power = [1, 2, 3] this corresponds to the integral
** 1 *
----- * dV n_{100}^1 * n_{111}^2 * n_{200}^3
V * **unit cell
where V is the volume of the unit cell
type Peak ¶
Peak represent one peak in the reciprocal space pair correlation function
func SquareLattice2D ¶
SquareLattice2D construct the two peaks with the lowest frequency peaks for the square lattice in 2D. The width of the two peaks is given as an array and the lattice parameter is given via a. The unit of both width and a is pixels.
func TriangularLattice2D ¶
TriangularLattice2D returns the peaks nessecary to describe a triangular lattice in 2D
type PeakWidthResult ¶
PeakWidthResult a type that contains the widths of the correlation function peaks as well as the fitted elastic properties resulting from the fit
type ReciprocalCell ¶
ReciprocalCell is a type used to represent the reciprocal lattice. In underlying CellVec matrix, each column represents a cell vector. The easiest way to initialize this type is via the Reciprocal method of the Cell type.
func (*ReciprocalCell) CellChange ¶
func (rc *ReciprocalCell) CellChange(realSpaceChange *mat.Dense) *mat.Dense
CellChange returns the change in the reciprocal lattice resulting from a given change in the real space lattice. It is assumed that the change is small and the function relies on a first order series expansion of the inverse real space cell
func (*ReciprocalCell) ChangeHKLVector ¶
func (rc *ReciprocalCell) ChangeHKLVector(miller Miller, realSpaceChange *mat.Dense) []float64
ChangeHKLVector returns the change in the HKL vector originating from a change in the real space lattice
func (*ReciprocalCell) HKLVector ¶
func (rc *ReciprocalCell) HKLVector(miller Miller) []float64
HKLVector returns a vector correslonding to the passed miller indices
type ReciprocalSpacePairCorrelation ¶
ReciprocalSpacePairCorrelation implements the type of correlation function presented by Greenwood et al.
Greenwood, M., Provatas, N. and Rottler, J., 2010. Free energy functionals for efficient phase field crystal modeling of structural phase transformations. Physical review letters, 105(4), p.045702.
func (ReciprocalSpacePairCorrelation) Eval ¶
func (rspc ReciprocalSpacePairCorrelation) Eval(k float64) float64
Eval evaluates the pair correlation function
type SinglePointExplorer ¶
type SinglePointExplorer struct { X0 []float64 // contains filtered or unexported fields }
SinglePointExplorer explores single initial guess
func (*SinglePointExplorer) Next ¶
func (spe *SinglePointExplorer) Next() []float64
Next returns X0 the first time it is called. Subsequent calls will return nil
func (*SinglePointExplorer) OnMinimizationFinished ¶
func (spe *SinglePointExplorer) OnMinimizationFinished(res *optimize.Result)
OnMinimizationFinished does nothing (included to satisfy the InitialGuessExplorer interface)
type UnitCell ¶
type UnitCell struct { // Cell represents where each column is a cell vector Cell Cell // Basis represents the positions inside the unit cell. // It is assumed that the basis is given in scaled coordinates. // Cartesian coordinates can thus be obtained by C = Cell.dot(Basis) Basis *mat.Dense }
UnitCell is a type that represents a unit cell of a crystal structure