Exercise One: First Run

In this first exercise, we will verify that NextGenPB is correctly set up by running a basic electrostatic potential calculation using a real protein input.


Step 1 – Prepare the Inputs

First, enter the directory for the first exercise:

cd ~/ngpb_tutorial/ex1

This is your working directory for this example:

~/ngpb_tutorial/ex1

Inside the NextGenPB repository (cloned in ~/ngpb_tutorial/NextGenPB), you’ll find a data/ folder containing sample inputs.

Copy a .pqr file into your current directory:

cp ../NextGenPB/data/1CCM.pqr .

Create the Parameter File

Create a file named options.prm in the current directory with the following content:

[input]
filetype = pqr
filename = 1CCM.pqr
[../]

[mesh]
mesh_shape = 0
perfil1 = 0.95
perfil2 = 0.2
scale   = 2.0
[../]

[model]
bc_type = 1                                
molecular_dielectric_constant = 2      # Dielectric constant inside the molecule
solvent_dielectric_constant   = 80     # Dielectric constant of the solvent (e.g., water)
ionic_strength                = 0.145  # Ionic strength (mol/L)
T                             = 298.15 # Temperature in Kelvin
calc_energy    = 2
calc_coulombic = 1
[../]

How to create the options.prm file

You can create the file using any text editor (e.g., nano, vim, gedit, or a code editor like VSCode).

Example using the terminal:

nano options.prm

Then paste the content into the editor, save (Ctrl+o), and exit (Ctrl+x).

Alternatively, you can create it with a redirect:

cat > options.prm << EOF
[input]
filename = 1CCM.pqr
[../]
EOF

Replace the block with the actual content you need.

What are perfil1 and perfil2?

The perfil parameters are filling ratios: they define what fraction of each mesh region is occupied by the molecule.

  • perfil1 is the filling ratio of the fine (core) region — how much of the fine domain box is taken up by the molecule. A value of 0.95 means the molecule spans 95% of that region.
  • perfil2 is the filling ratio of the coarse (outer) region — the molecule occupies a smaller fraction here, resulting in a larger, more spread-out box with lower resolution.

This means:

  • A higher perfil1 keeps the fine region tightly sized around the molecule, increasing accuracy near the surface.
  • A lower perfil2 allows the outer region to extend further, reducing boundary effects without adding too many elements.

The mesh gradually transitions from the fine region (perfil1) to the coarse one (perfil2), allowing accurate resolution where needed while keeping the overall number of elements manageable.

Figure 1: Mesh visualization


Step 2 – Run the Solver

Now launch the simulation using Apptainer:

apptainer exec --pwd /App --bind .:/App ../NextGenPB.sif mpirun -np 4 ngpb --prmfile options.prm

Step 3 – Output and Results

At the end of the execution, you will see a log similar to this:

================ [ Electrostatic Energy ] =================
  Net charge [e]:                                 7.327471962526033e-15
  Flux charge [e]:                                -4.859124220152702e-11
  Polarization energy [kT]:                       -384.6169807703798
  Direct ionic energy [kT]:                       -0.2516508616874018
  Coulombic energy [kT]:                          -10097.24155852403
  Sum of electrostatic energy contributions [kT]: -10482.11019015609
===========================================================
compute energy
Elapsed time : 141.198ms

Timing Report:
...

This includes the timing report and the electrostatic energy of the system. These outputs confirm that NextGenPB is functioning correctly and that your configuration is valid.


➡️ Go to the next exercise.