dmorse / pscfpp

Polymer Self-Consistent Field Theory (C++/CUDA version)
https://pscf-home.cems.umn.edu
GNU General Public License v3.0
28 stars 20 forks source link

External field feature added for thin films, new documentation written #76

Closed benmagruder closed 2 years ago

benmagruder commented 2 years ago

This pull request contains the remainder of the thin-film feature in pspc. An external field can now be added into AmIterator, which changes how the residuals are calculated to account for the presence of the external field. The external field feature has been tested by using it to replicate Fig. 2 of Mark Matsen's 1997 thin films paper, and the free energy trends generated with this new feature look identical to his.

The Iterator base class now contains information about masks and external fields, rather than the AmIteratorTmpl class.

The free energy calculation required small modifications, because the volume that should be used to calculate the free energy is the volume accessible to the polymers, not the volume of the unit cell, which differ from one another when there is a mask imposed upon the unit cell.

Users can now perform a "wall_chi" sweep that varies one of the wall/polymer "chi" parameters in the AmIteratorFilm object. This required a static_cast operation to convert an Iterator pointer into a FilmIterator pointer.

Other small changes have been made based on comments on my previous thin film pull request. Thin film examples have also been modified/improved.

A new command, WRITE_DATA, has been added, which writes the parameter file and thermodynamic data for a converged solution. This allows users to save/store only the relevant data for each converged solution, rather than having to store the entire output trace which can be long and can contain unneeded information.

.dox files for AmIteratorFilm, AmIterator, LinearSweep, Iterator, and Sweep classes have been added and incorporated into the main documentation (both pspc and fd1d). Currently, Iterator.dox and Sweep.dox are not used in the main documentation, but they are written in a way that they could be introduced later if we add more types of iterators/sweeps and we want a central place to list all of the derived classes of the Iterator/Sweep base classes.

Documentation has also been updated to include all commands that are implemented and can be included in command files. REMESH_W and EXTEND_W were skipped in fd1d because I didn't know how exactly to describe them, since I've never used them.

All unit tests pass, including pspg unit tests. This was tested on a Mac with M1 chip, a Mac without M1 chip, and on MSI.

If there are any additional changes to make or further documentation that I can help write, I am happy to create another "cleanup" pull request this week, just let me know!