flory.interaction.flory_huggins_block
Module for Flory-Huggins block interaction energy of mixture.
The Flory-Huggins block interaction means that several components may have exactly same interactions. Equivalently, the matrix \(\chi_{ij}\) has blocked structure.
Classes
Class for Flory-Huggins block interaction energy of mixture. |
- class FloryHugginsBlockInteraction(num_feat, chis_feat, num_comp_per_feat=1)[source]
Bases:
FloryHugginsInteractionBaseClass for Flory-Huggins block interaction energy of mixture.
The particular form of interaction energy density reads
\[f_\mathrm{interaction}(\{\phi_i\}) = \sum_{i,j=1}^{N_\mathrm{C}} \frac{\chi_{ij}}{2} \phi_i\phi_j\]where \(\phi_i\) is the fraction of component \(i\), \(\chi_{ij}\) is the Flory-Huggins interaction matrix. The blocked structure of \(\chi_{ij}\) is defined as
\[\chi_{ij} = \chi_{rs} \qquad : \qquad i \in B_r, j \in B_s \;,\]where \(B_r\) and \(B_s\) are the set of index of components that belong to feature \(r\) and \(s\), respectively.
- Parameters:
Public Data Attributes:
Number of components in each feature.
The Flory-Huggins interaction matrix of components \(\chi_{ij}\).
The Flory-Huggins interaction matrix of features \(\chi_{rs}\).
Public Methods:
Inherited from
InteractionBase:compiled(**kwargs_full)Make a compiled interaction instance for
CoexistingPhasesFinder.Private Methods:
_compiled_impl(*[, additional_chis_shift])Implementation of creating a compiled interaction instance.
Inherited from
FloryHugginsInteractionBase:_compiled_impl(*[, additional_chis_shift])Implementation of creating a compiled interaction instance.
_energy_impl(phis)Implementation of calculating interaction energy.
_jacobian_impl(phis)Implementation of calculating Jacobian \(\partial f_\mathrm{interaction}/\partial \phi_i\).
_hessian_impl(phis)Implementation of calculating Hessian \(\partial^2 f_\mathrm{interaction}/\partial \phi_i^2\).
Inherited from
InteractionBase:_compiled_impl(**kwargs)Implementation of creating a compiled interaction instance (Interface).
_energy_impl(phis)Implementation of calculating interaction energy \(f_\mathrm{interaction}\) (Interface).
_jacobian_impl(phis)Implementation of calculating Jacobian \(\partial f_\mathrm{interaction}/\partial \phi_i\) (Interface).
_hessian_impl(phis)Implementation of calculating Hessian \(\partial^2 f_\mathrm{interaction}/\partial \phi_i^2\) (Interface).
- property chis: ndarray
The Flory-Huggins interaction matrix of components \(\chi_{ij}\).
This property should not be modified directly. Consider property
chis_featinstead.
- _compiled_impl(*, additional_chis_shift=1.0)[source]
Implementation of creating a compiled interaction instance.
This method overwrites the interface
_compiled_impl()inInteractionBase.- Parameters:
additional_chis_shift¶ (
float, default:1.0) – Shift of the entire chis matrix to improve the convergence by evolving towards incompressible system faster. This value should be larger than 0. This value only affects the numerics, not the actual physical system. Note that with very large value, the convergence will be slowed down, since the algorithm no longer have enough ability to temporarily relax the incompressibility.- Returns:
Instance of
FloryHugginsInteractionCompiled.- Return type:
- _energy_impl(phis)
Implementation of calculating interaction energy.
This method overwrites the interface
_energy_impl()inInteractionBase.
- _hessian_impl(phis)
Implementation of calculating Hessian \(\partial^2 f_\mathrm{interaction}/\partial \phi_i^2\).
This method overwrites the interface
_hessian_impl()inInteractionBase.
- _jacobian_impl(phis)
Implementation of calculating Jacobian \(\partial f_\mathrm{interaction}/\partial \phi_i\).
This method overwrites the interface
_jacobian_impl()inInteractionBase.
- compiled(**kwargs_full)
Make a compiled interaction instance for
CoexistingPhasesFinder.This function requires the implementation of
_compiled_impl(). The interaction instance is a compiled class, which must implement a list of methods or properties. SeeInteractionBaseCompiledfor the list and the detailed information. See alsoFloryHugginsInteractionCompiledfor an example. Note that different from the classInteractionBaseitself, the returned compiled class use the feature-based description, and can consider the degeneracy of components.- Parameters:
kwargs_full¶ – The keyword arguments for
_compiled_impl()but allowing redundant arguments.- Returns:
The compiler interaction instance.
- Return type: