PSCF v1.3.1
Pscf::Prdc::ScftThermoTmpl< D, ST > Class Template Reference

Base class for SCFT thermodynamic property calculators. More...

#include <ScftThermoTmpl.h>

Inheritance diagram for Pscf::Prdc::ScftThermoTmpl< D, ST >:
Pscf::Prdc::SystemConstRefTmpl< ST >

Public Types

using Base = SystemConstRefTmpl<ST>
 Base class type name alias.
using SystemT = typename Base::SystemT
 Parent System type name alias.

Public Member Functions

 ScftThermoTmpl (SystemT const &system)
 Constructor.
virtual ~ScftThermoTmpl ()
 Destructor.
State modifiers
void compute ()
 Compute SCFT free energy density and pressure for current fields.
void clear ()
 Clear all thermodynamic data.
SCFT Property Access and Output
bool hasData () const
 Have free energies and pressure been computed?
double fHelmholtz () const
 Get total Helmholtz free energy per monomer / kT.
double fIdeal () const
 Get the ideal gas contribution to fHelmholtz.
double fInter () const
 Get the interaction contribution to fHelmholtz.
double fExt () const
 Get the external field contribution to fHelmholtz.
double pressure () const
 Get the precomputed pressure times monomer volume / kT.
void write (std::ostream &out)
 Write SCFT thermodynamic properties to a file.

Protected Member Functions

virtual double innerProduct (RFieldT const &A, RFieldT const &B) const
 Inner product of two fields.
SystemT const & system () const
 Get the associated System.
MixtureT const & mixture () const
 Get the Mixture.
InteractionT const & interaction () const
 Get the Interaction.
DomainT const & domain () const
 Get the Domain.
CFieldsT const & c () const
 Get the concentration (c) field container.
WFieldsT const & w () const
 Get the chemical potential (w) field container.
WFieldsT const & h () const
 Get the external potential (h) field container.
MaskT const & mask () const
 Get the mask.
FileMaster const & fileMaster () const
 Get the FileMaster.
Protected Member Functions inherited from Pscf::Prdc::SystemConstRefTmpl< ST >
 SystemConstRefTmpl ()
 Default constructor.
 SystemConstRefTmpl (SystemT const &system)
 Constructor.
 ~SystemConstRefTmpl ()
 Destructor.
void associate (SystemT const &system)
 Create associations with a system and its components.
SystemT const & system () const
 Get the associated System.
MixtureT const & mixture () const
 Get the Mixture.
InteractionT const & interaction () const
 Get the Interaction.
DomainT const & domain () const
 Get the Domain.
CFieldsT const & c () const
 Get the concentration (c) field container.
WFieldsT const & w () const
 Get the chemical potential (w) field container.
WFieldsT const & h () const
 Get the external potential (h) field container.
MaskT const & mask () const
 Get the mask.
FileMaster const & fileMaster () const
 Get the FileMaster.

Detailed Description

template<int D, class ST>
class Pscf::Prdc::ScftThermoTmpl< D, ST >

Base class for SCFT thermodynamic property calculators.

This class computes and stores values for the SCFT Helmholtz free energy and pressure, and free energy components (ideal, interaction, external). It is used as a base class for classes named ScftThermo defined in Rpc and Rpg namespaces.

Definition at line 29 of file ScftThermoTmpl.h.

Member Typedef Documentation

◆ Base

template<int D, class ST>
using Pscf::Prdc::ScftThermoTmpl< D, ST >::Base = SystemConstRefTmpl<ST>

Base class type name alias.

Definition at line 35 of file ScftThermoTmpl.h.

◆ SystemT

template<int D, class ST>
using Pscf::Prdc::ScftThermoTmpl< D, ST >::SystemT = typename Base::SystemT

Parent System type name alias.

Definition at line 38 of file ScftThermoTmpl.h.

Constructor & Destructor Documentation

◆ ScftThermoTmpl()

template<int D, class ST>
Pscf::Prdc::ScftThermoTmpl< D, ST >::ScftThermoTmpl ( SystemT const & system)

Constructor.

Parameters
systemparent System object

Definition at line 30 of file ScftThermoTmpl.tpp.

References system(), and Pscf::Prdc::SystemConstRefTmpl< ST >::SystemConstRefTmpl().

◆ ~ScftThermoTmpl()

template<int D, class ST>
Pscf::Prdc::ScftThermoTmpl< D, ST >::~ScftThermoTmpl ( )
virtual

Destructor.

Definition at line 44 of file ScftThermoTmpl.tpp.

Member Function Documentation

◆ compute()

template<int D, class ST>
void Pscf::Prdc::ScftThermoTmpl< D, ST >::compute ( )

Compute SCFT free energy density and pressure for current fields.

Resulting values are retrieved by the fHelmholtz(), fIdeal(), fInter(), fExt(), and pressure() accessor functions.

Precondition
w().hasData() == true
c().hasData() == true
Postcondition
hasData() == true

Definition at line 51 of file ScftThermoTmpl.tpp.

References c(), domain(), h(), hasData(), innerProduct(), interaction(), Pscf::PolymerModel::isThread(), Pscf::PolymerSpecies::length(), mask(), mixture(), Pscf::Species::mu(), Pscf::PolymerSpecies::nBead(), Pscf::Species::phi(), Pscf::SolventSpecies::size(), UTIL_CHECK, and w().

Referenced by write().

◆ clear()

template<int D, class ST>
void Pscf::Prdc::ScftThermoTmpl< D, ST >::clear ( )

Clear all thermodynamic data.

Postcondition
hasData() == false

Definition at line 269 of file ScftThermoTmpl.tpp.

◆ hasData()

template<int D, class ST>
bool Pscf::Prdc::ScftThermoTmpl< D, ST >::hasData ( ) const
inline

Have free energies and pressure been computed?

Definition at line 264 of file ScftThermoTmpl.h.

Referenced by compute(), and write().

◆ fHelmholtz()

template<int D, class ST>
double Pscf::Prdc::ScftThermoTmpl< D, ST >::fHelmholtz ( ) const
inline

Get total Helmholtz free energy per monomer / kT.

This function retrieves a value computed by computeFreeEnergy().

Definition at line 224 of file ScftThermoTmpl.h.

References UTIL_CHECK.

Referenced by write().

◆ fIdeal()

template<int D, class ST>
double Pscf::Prdc::ScftThermoTmpl< D, ST >::fIdeal ( ) const
inline

Get the ideal gas contribution to fHelmholtz.

This function retrieves a value computed by computeFreeEnergy().

Definition at line 232 of file ScftThermoTmpl.h.

References UTIL_CHECK.

◆ fInter()

template<int D, class ST>
double Pscf::Prdc::ScftThermoTmpl< D, ST >::fInter ( ) const
inline

Get the interaction contribution to fHelmholtz.

This function retrieves a value computed by computeFreeEnergy().

Definition at line 240 of file ScftThermoTmpl.h.

References UTIL_CHECK.

◆ fExt()

template<int D, class ST>
double Pscf::Prdc::ScftThermoTmpl< D, ST >::fExt ( ) const
inline

Get the external field contribution to fHelmholtz.

This function retrieves a value computed by computeFreeEnergy().

Definition at line 248 of file ScftThermoTmpl.h.

References UTIL_CHECK.

◆ pressure()

template<int D, class ST>
double Pscf::Prdc::ScftThermoTmpl< D, ST >::pressure ( ) const
inline

Get the precomputed pressure times monomer volume / kT.

This function retrieves a value computed by computeFreeEnergy(). The value is -1 times the grand-canonical free energy per monomer divided by kT.

Definition at line 256 of file ScftThermoTmpl.h.

References UTIL_CHECK.

Referenced by write().

◆ write()

template<int D, class ST>
void Pscf::Prdc::ScftThermoTmpl< D, ST >::write ( std::ostream & out)

Write SCFT thermodynamic properties to a file.

This function outputs Helmholtz free energy per monomer, pressure (in units of kT per monomer volume), the volume fraction and chemical potential of each species, and all unit cell parameters.

If data is not available (i.e,. if hasData() == false), this function calls compute() on entry.

If parameter "out" is a file that already exists, this function will append to the end of that file, rather than overwriting it. Calling writeParamNoSweep and writeThermo in succession with the same output stream will thus produce a single file containing both input parameters and calculated thermodynamic properties.

Parameters
outoutput stream

Definition at line 276 of file ScftThermoTmpl.tpp.

References compute(), domain(), fHelmholtz(), h(), hasData(), mixture(), and pressure().

◆ innerProduct()

template<int D, class ST>
virtual double Pscf::Prdc::ScftThermoTmpl< D, ST >::innerProduct ( RFieldT const & A,
RFieldT const & B ) const
inlineprotectedvirtual

Inner product of two fields.

Parameters
A1st field
B2nd field
Returns
inner product (sum of product A[i]*B[i] over mesh points)

Definition at line 174 of file ScftThermoTmpl.h.

Referenced by compute().

◆ system()

template<int D, class ST>
SystemT const & Pscf::Prdc::SystemConstRefTmpl< ST >::system ( ) const
inlineprotected

Get the associated System.

Definition at line 71 of file SystemConstRefTmpl.h.

Referenced by ScftThermoTmpl().

◆ mixture()

template<int D, class ST>
MixtureT const & Pscf::Prdc::SystemConstRefTmpl< ST >::mixture ( ) const
inlineprotected

Get the Mixture.

Definition at line 75 of file SystemConstRefTmpl.h.

Referenced by compute(), and write().

◆ interaction()

template<int D, class ST>
InteractionT const & Pscf::Prdc::SystemConstRefTmpl< ST >::interaction ( ) const
inlineprotected

Get the Interaction.

Definition at line 79 of file SystemConstRefTmpl.h.

Referenced by compute().

◆ domain()

template<int D, class ST>
DomainT const & Pscf::Prdc::SystemConstRefTmpl< ST >::domain ( ) const
inlineprotected

Get the Domain.

Definition at line 83 of file SystemConstRefTmpl.h.

Referenced by compute(), and write().

◆ c()

template<int D, class ST>
CFieldsT const & Pscf::Prdc::SystemConstRefTmpl< ST >::c ( ) const
inlineprotected

Get the concentration (c) field container.

Definition at line 87 of file SystemConstRefTmpl.h.

Referenced by compute().

◆ w()

template<int D, class ST>
WFieldsT const & Pscf::Prdc::SystemConstRefTmpl< ST >::w ( ) const
inlineprotected

Get the chemical potential (w) field container.

Definition at line 91 of file SystemConstRefTmpl.h.

Referenced by compute().

◆ h()

template<int D, class ST>
WFieldsT const & Pscf::Prdc::SystemConstRefTmpl< ST >::h ( ) const
inlineprotected

Get the external potential (h) field container.

Definition at line 95 of file SystemConstRefTmpl.h.

Referenced by compute(), and write().

◆ mask()

template<int D, class ST>
MaskT const & Pscf::Prdc::SystemConstRefTmpl< ST >::mask ( ) const
inlineprotected

Get the mask.

Definition at line 99 of file SystemConstRefTmpl.h.

Referenced by compute().

◆ fileMaster()

template<int D, class ST>
FileMaster const & Pscf::Prdc::SystemConstRefTmpl< ST >::fileMaster ( ) const
inlineprotected

Get the FileMaster.

Definition at line 103 of file SystemConstRefTmpl.h.


The documentation for this class was generated from the following files: