dmorse / pscfpp

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

Fixed thin film bugs, edited appendices in documentation #112

Closed benmagruder closed 1 year ago

benmagruder commented 1 year ago

In this pull request, I made small changes to the handling of the homogeneous field component in canonical ensemble in the presence of an external field (the changes in AmIterator.tpp) so that the field output by the software is able to be used properly in a subsequent grand canonical ensemble calculation. The issue was that the homogeneous component of the external field needs to be added to the homogeneous component of the w field, but the code was not doing this when it manually set the w field's homogeneous component in a canonical calculation.

It is worth noting that, though the homogeneous component of the field should not affect the result of the SCFT calculation in canonical ensemble, I noticed that my results were, in fact, changing a bit after I fixed this bug (a difference of about 1e-4kT in free energy). The reason is because the relNorm errorType in AmIterator uses the norm of the w field to calculate the error, and this bugfix changes the norm of the w field so it changed my error threshold ever so slightly.

Another issue I fixed was the calculation of the homogeneous field in grand canonical ensemble in the presence of a mask; this was simply written wrong to include an unnecessary term, and I made sure this term was omitted if a mask is present.

Also, I modified the chiBottom and chiTop inputs so that they are now required inputs for a thin film iterator. I mainly did this because these parameters are sweep-able, but if you sweep them without including them in the original param file then they are not written out as part of the *.dat files of the sweep. They are important parameters for any thin film calculation, so it makes sense to simply make them required, even if they contain only zeros.

Finally, I made a large number of small edits to the appendices of the documentation after reading them over closely. Most changes are just typos, plus I changed $R^{T}$ to $R^{\dagger} $to represent the adjoint of $R$, and I changed the indices in a few summations from $i,j,...$ to $j,k,...$ so there is no confusion between $i$ as an index and $i$ as an imaginary number. I added a few references to the beginning of the appendices as well, for readers who aren't as familiar with these ideas and would benefit from the extra resources.