Pscfpp
Polymer Self-Consistent Field Theory (C++/CUDA version)
Install / Use
/learn @dmorse/PscfppREADME
PSCF - Polymer Self-Consistent Field (C++/CUDA)
PSCF is a software package for field-theoretic analysis of inhomogeneous equilibrium states of polymerc materials with constituents that tend to phase separate. PSCF can be used to perform either self-consistent field theory (SCFT) calculations or some types of stochastic field-theoretic simulation (FTS) calculations.
The current version of PSCF is written primarily in C++, supplemented by CUDA to enable the use of a graphics processing unit (GPU). PSCF is distributed only in source code form, and so must be compiled by the user.
Methods: SCFT and PS-FTS
PSCF was originally designed for SCFT calculations, and provides an extensive set of tools for this purpose . The acronym PSCF stands for Polymer Self-Consistent Field, reflecting this origin.
PSCF can now also perform field theoretic simulation (FTS) calculations that rely on a partial saddle-point approximation (PS-FTS). Such simulations can be performed using ether Brownian dynamics (BD) or Monte-Carlo (MC) sampling techniques.
The fully-fluctuating formulation of polymer field theory (which is not implemented in PSCF) requires the stochastic sampling of complex-valued fields. The partial saddle-point approximation for FTS used in the current version of PSCF is an approximation for incompressible models in which a Langrange multiplier pressure-like field that imposes a constraint on the total monomer density is approximated at a mean-field (or saddle-point) level, while fields that couple to composition fluctuations are allowed to freely fluctuate. The resulting approximation yields a theory that involves only real-valued fields.
History
The current C++/CUDA version of PSCF originated as a completely rewritten version of an older Fortran SCFT program of the same name. The Fortran PSCF version builds a single program that was designed for SCFT analysis of systems that can contain mixtures of linear block polymers and small molecule solvents in a domain with periodic boundary conditions. The current C++/CUDA version is intended to supersede the Fortran version, which is no longer being developed or actively maintained. The Fortran PSCF program is still available in a separate github.com repository at https://github.com/dmorse/pscf. The current C++/CUDA version provides almost all of the capabilities of the Fortran PSCF program, and many important new capabilities, as discussed below.
Functional differences between the current C++/CUDA version of PSCF and the legacy Fortran version include the following:
-
The current version is an extensible package of several programs that are designed for different types of spatial domain and/or different types of hardware, implemented within a common framework.
-
The current version can perform stochastic PS-FTS calculations as well as SCFT.
-
The current version can treat systems that contain acyclic branched polymers, while the Fortran program was designed for linear polymers.
-
The current version enables use of a graphics processing unit (GPU) to dramatically accelerate some applications.
Programs
PSCF provides source code for the following three executable programs:
-
pscf_1d : The pscf_1d program is is designed to perform SCFT calculations for one-dimensional (1D) problems in Cartesian, cylindrical or spherical coordinates. A finite difference method is used to solve the underlying partial differential equation, known as the modified diffusion equation (MDE). This program can be used to treat problems involving flat and curved interfaces, as well as cylindrical and spherical micelles.
-
pscf_pc : The pscf_pc program can be used to perform SCFT and PS-FTS calculations for systems that are periodic in 1, 2 or 3 spatial dimensions, using standard CPU hardware. A pseudo-spectral algorithm is used to solve the MDE. This program provides capabilities for SCFT calculations analogous to those of the older Fortran PSCF program, as well as tools for PS-FTS calculations. The suffix "pc" stands for "periodic CPU".
-
pscf_pg : The pscf_pg program is a GPU-accelerated version of pscf_pc that can also perform SCFT and PS-FTS calculations for periodic systems. It is based on algorithms analogous to those used in pscf_pc and provides almost identical features, but provides higher performance for large systems. The suffix "pg" stands for "periodic GPU".
Features
All three PSCF programs are designed to treat an incompressible mixture containing any number of block polymer, homopolymer and small molecule (point-like) solvent molecular species. Polymer species may be modelled using either the standard Gaussian model of polymer conformations as continuous random walks or (in pscf_pc and pscf_pg) using a discrete bead-spring model with harmonic springs.
Features relevant to both SCFT and PS-FTS (all programs):
-
Ability to treat acyclic branched block polymers
-
Ability to use canonical, grand-canonical or mixed statistical ensembles: Users may specify either a volume fraction or a chemical potential for each molecular species in a mixture
-
Examples of input files for many types of calculation and structures
-
Python tools for data analysis and file preparation
-
User and developer documentation provided as an integrated web manual
-
Well documented, open source code written in object oriented C++
Features for SCFT (all programs):
-
Efficient Anderson-mixing SCFT iteration algorithms
-
Parameter "sweeps": Continuation algorithms for sequences of SCFT calculations with different parameters along a 1D path through parameter space.
Features for SCFT or PS-FTS for periodic systems (pscf_pc and pscf_pg):
-
Pseudo-spectral solution of the modified diffusion equation
-
Choice of a continuous chain or a discrete bead-spring model for polymer conformations.
-
Periodic boundary conditions with 1, 2 or 3 dimensional periodicity
-
Unit cells with any possible 2D and 3D Bravais lattice system (e.g., cubic, orthorhombic, monoclinic, etc.)
-
A companion Matlab package for visualization of periodic structures: Polymer Visual
Features for SCFT on periodic systems (pscf_pc and pscf_pg):
-
Automatic optimization of unit cell parameters so as to minimize the SCFT free energy density
-
Imposition of any user-selected space-group symmetry on SCFT solutions
-
Built-in database of symmetry operations for all 230 3D space groups and 17 2D plane groups
-
Inhomogeneous density constraint (a "mask") for SCFT of systems in a confined geometry.
-
External fields
-
Tools for thin polymer films (using a mask to represent confinement and external fields for selective surface interactions)
Features for PS-FTS (pscf_pc and pscf_pg):
-
Brownian dynamics (BD) and Monte Carlo (MC) sampling algorithms
-
BD algorithms: Leimkuhler-Matthews and predictor-corrector BD step algorithms
-
MC algorithms: real-space and "smart"/force-bias MC moves
-
Efficient new algorithms for adjusting the pressure field so as to find partial saddle-point states (i.e., to impose incompressibility)
-
Tools for calculation of free energy differences by thermodynamic integration, including the Einstein-crystal method
-
Parameter "ramps" in which one or more parameters change continuously during a simulation
-
"Analyzer" classes to compute and analyze quantities of physical interest, including the structure factor, order parameters used to identify phase transitions, and derivatives of the Hamiltonian needed to for thermodynamic integration calculations
-
Tools for performing data analysis either during a simulation or by postprocessing field trajectory files that are created during a simulation
Non-features (provided by the Fortran program but not the current version):
- The only capability of the older Fortran PSCF program that is not provided by the current version is the ability to perform SCFT linear susceptibility calculations for periodic ordered phases [A. Ranjan, J. Qin, and D. Morse, Macromolecules 41, 942 (2008)].
Getting the source code
The PSCF source code is maintained in the github repository
https://github.com/dmorse/pscfpp.
The source code should be obtained by using a git version control system client to clone this repository. To do so from the unix command line on a machine with a git client installed, enter the command:
git clone --recursive https://github.com/dmorse/pscfpp.git
Note the use of the --recursive option of the git clone command. Use of this option is necessary with PSCF to clone and install two git submodules that are maintained in separate github repositories. This command will create a new directory called pscfpp that contains all of the source code and associated documentation, including the two required git submodules.
We do not recommend that users obtain the source code by simply downloading and unpackng a zip or tar file of a tagged release from the PSCF github repository. Doing so would create a pscfpp directory that does not contain source code for two git repositories that are automatically installed as submodules by the above git command. It is possible to install these submodules after the fact, but simpler to follow the instructions given above.
Documentation
PSCF is distributed with source files for an html web manual. A copy of the manual for the most recent numbered release is available online at
https://dmorse.github.io/pscfpp-man
All information given in this README file is also given in the web manual, often in much greater detail.
If desired, users can use the [doxygen](<https://www.doxygen.nl/i
Related Skills
node-connect
350.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
350.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
350.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
