C++11 program that computes the pore distribution of a system of spheres (representing polymer beads), parallelized with OpenMP.
Given a system of polymers with explicit solvent, the goal of this program is to compute the system pore distribution, i.e. the distribution of the pores created by the presence of the solvent. The program follows the algorithm described in 1.
Given a random point P (chosen to be not close to the spheres), the algorithm computes the biggest sphere that contains P but does not overlap with the spheres, representing the pore size in that point. By doing this procedure stepsToAverage times, the pore size histogram is computed.
The stopping criteria is based on the normalized difference between the old pore size histogram and the new one:
Currently, only Linux is supported.
- CMake 3.10+
- C++11 compiler
- Boost Libraries: specifically boost::filesystem and boost::system
- NLopt for nonlinear optimization
- OpenMP: optional for parallel computing on CPU
Building the project using CMake:
cd PoreSizeDistribution
mkdir build && cd build
cmake ..
make -j
-
-DUSE_OPENMP=ON: Enable OpenMP support -
-DCMAKE_BUILD_TYPE=Debug: Build debug version
To run the program once built:
./psd SETTINGS_FILE
If OpenMP is enabled, you can select the number of threads at runtime:
OMP_NUM_THREADS=NUMBER_OF_THREADS ./psd SETTINGS_FILE
The file SETTINGS_FILE, in the JSON format (see nlohmann json), contains all simulation-related information. An example settings.json is provided.
In particular, it is possible to choose:
confFileName: the name of the file for the particle configuration.dataFolder: the name of the folder for the output data.useCogli2: choose whether to save a visualization file compatible with cogli2. If set to true, it is possible to change other settings such ascogliFile: file name of cogli2 output.sphereColor: string that represents the color of the spheres to represent the polymer beads in RGBA (from 0 to 1), e.g."1,0,0,1"for blue spheres.poreSphereColor: string that represents the color of the spheres to represent the pore.maxCogliSpheres: maximum number of spheres to save into the cogli2 file.
errorTolerance: tolerance on the normalized error between the new pore distribution and the old one. If the error is lower than the chosen tolerance, the simulation stops. Default value is1e-2.stepsToAverage: number of steps between the computation of the average error between the old distribution and the new distribution.maxLoops: max number of loops to average. If the simulation is not converging fast enough, i.e. the loop number is higher than the max, it stops.
The input file describes the system. The first row of the input file contains the box dimensions 50 50 50. The system is centered around
Currently, the program assumes the spheres to be all the same with diameter set to 1, but this will be changed to account for sets of spheres of different sizes.
There is an example configuration in the docs/ExampleConfiguration folder, together with a simple lammpstrj and a Python script to convert the trajectory to usable data.
The program computes the distribution and returns the Histogram.txt in the chosen dataFolder. The first column represents the pore diameter, the second one its frequency.
Moreover, it returns a cogli2 file to visualize the pore in the Cogli2 folder. The spheres of the input system are by default visualized in blue, while the pore is represented in red:
Footnotes
-
Langmuir 2006, 22, 18, 7726-7731, https://doi.org/10.1021/la052651k ↩
