In addition to being used as the behavioral model in the verification testbench, the flexible SystemC RSCE model can also be used for precision analysis. This section describes how the precision of the B-Spline calculation and the 3D-FFT calculation affects the errors of the reciprocal energy and force calculations. Furthermore, this section also states the required B-Spline and 3D-FFT calculation precision to achieve the relative energy and force error goal of less than 10-5. The errors in the energy and forces calculations are derived by Equation 29, Equation 30, and Equation 31.
Equation 29 – Absolute Error
Equation 30 – Energy Relative Error
Equation 31 – Force RMS Relative Error
The “GOLDEN” subscript indicates that the reciprocal energy or forces are calculated with the SPME software package [8]; while the “FXPT_SC” subscript indicates that the reciprocal energy or forces are calculated with the fixed-pointed SystemC RSCE model. Equation 30 is used for calculating the relative error in energy computation. On the other hand, Equation 31 is used for calculating the RMS relative error in forces computation.
To derive the relationship between the calculation precision and the magnitude of the relative force and energy errors, 10 single-timestep MD simulations are carried out for each precision setting and each simulation setting (K, P, and the Ewald Coefficient). A script is written to automate this precision analysis simulation process. The pseudo code of the script is shown in Figure 60. The forces and energy error in these simulations are recorded, averaged, and plotted to show the effect of calculation precision on the energy and forces errors. The system being simulated is charge-neutral and it contains 100 randomly located particles with randomized charge within the range of [5.0, -5.0]. The simulation box is orthogonal with dimensions 16.0Ao x 16.0Ao x 16.0Ao.
Ewald Coefficient E = 0.30
Interpolation order P = 4
Grid size K = 16
NumSet = 3
NumRunInSet = 10
for each FFT precision {14.18, 14.22, 14.26, 14.30}:
for each FFT precision {1.21, 1.24, 1.27, 1.30}:
Recompile the RSCE SystemC model with the corresponding precision.
for 1 to NumSet
Set E, P and K
for 1 to NumRunInSet
Randomize coordinates within 16.0Aox16.0Aox 16.0Ao box
Randomize charges with range [-5.0, 5.0]
Regenerate PDB file
Run single-timestep MD simulation
Record the errors
end for
increment E by 0.05
increment P by 2
increment K to the next power of 2
end for
end for
end for
Figure 60 - Pseudo Code for the FC Block
In addition to deriving the relationship between the calculation precision and the magnitude of the relative errors, these simulations runs are also used to find out the preliminary minimum precision requirement to achieve the 10-5 relative error goal which is stated in Section 3.6. Since the simulation time will be very lengthy if hundreds of precision simulations are done for each possible precision setting, the effort to find the minimum precision requirement is done in two passes. In the first pass, 10 single-timestep simulations are performed for different simulation settings on each calculation precision to screen out those precision settings that are not likely to achieve the 10-5 relative error goal. Then, in the second pass, for those leftover precision settings that are likely to achieve the relative error goal, another 200 single-timestep simulations for each simulation setting are performed on them to iron out the minimum precision requirement that should be able to achieve the relative error goal reliably.
The results for the 10 single-timestep simulation runs are shown in Tables 25 and 26. As shown in Table 26, with P=8 and K=64, a FFT precision of {14.26} and a B-Spline precision of {1.21} is found to be the preliminary minimum precision requirement to achieve the 10-5 relative error goal. Those precision settings which are not as precise as this preliminary minimum precision requirement are not likely to achieve the 10-5 relative error goal reliably. To iron out the minimum precision requirement, another 200 simulation runs are performed on those precision settings that are more precise than the preliminary minimum precision requirement. After the 200 simulation runs are carried out, it is found that a FFT calculation precision of {14.30} and a B-Spline calculation precision of {1.27} can achieve the relative error goal in all 200 simulation runs. The result for these 200 simulation runs for P=8 and K=64 is summarized in Table 27. In this table, only the average and the maximum relative force and energy error are shown.
One thing worthwhile to notice is that the input coordinate precision of {8.21} and the input charge precision of {5.21} are not varying in these simulations. To investigate the effect of these input precisions on the relative error, the script can be modified to perform such precision analysis. However, due to the time constraint to finish this thesis on time, the input precision analysis is not done for this thesis and is left for future work. In the following sections, the individual effect of the B-Spline precision and the FFT precision on the output relative error is investigated.
Table 25 - Average Error Result of Ten Single-Timestep Simulation Runs (P=4 , K=32)
FFT
(SFXP)
|
BSP
(SFXP)
|
Energy
ABS Err
|
Energy
Rel. Err
|
Force
ABS Err
|
Force
RMS Rel Err
|
Rel. Error
< 1e-5
|
{14.18}
|
{1.21}
|
3.47E-05
|
3.46E-07
|
5.40E-04
|
2.92E-05
|
FALSE
|
{14.18}
|
{1.24}
|
5.86E-05
|
5.83E-07
|
5.23E-04
|
2.90E-05
|
FALSE
|
{14.18}
|
{1.27}
|
8.11E-05
|
8.07E-07
|
5.24E-04
|
2.90E-05
|
FALSE
|
{14.18}
|
{1.30}
|
7.80E-05
|
7.76E-07
|
5.24E-04
|
2.90E-05
|
FALSE
|
|
|
|
|
|
|
|
{14.22}
|
{1.21}
|
5.02E-05
|
4.99E-07
|
3.51E-05
|
2.78E-06
|
TRUE
|
{14.22}
|
{1.24}
|
1.81E-05
|
1.80E-07
|
3.13E-05
|
2.55E-06
|
TRUE
|
{14.22}
|
{1.27}
|
1.84E-05
|
1.83E-07
|
2.87E-05
|
2.47E-06
|
TRUE
|
{14.22}
|
{1.30}
|
1.97E-05
|
1.96E-07
|
2.81E-05
|
2.48E-06
|
TRUE
|
|
|
|
|
|
|
|
{14.26}
|
{1.21}
|
6.92E-05
|
6.88E-07
|
2.71E-05
|
1.00E-06
|
TRUE
|
{14.26}
|
{1.24}
|
4.09E-05
|
4.07E-07
|
2.38E-06
|
1.56E-07
|
TRUE
|
{14.26}
|
{1.27}
|
3.96E-05
|
3.93E-07
|
2.32E-06
|
1.67E-07
|
TRUE
|
{14.26}
|
{1.30}
|
3.95E-05
|
3.93E-07
|
2.30E-06
|
1.65E-07
|
TRUE
|
|
|
|
|
|
|
|
{14.30}
|
{1.21}
|
6.96E-05
|
6.92E-07
|
2.67E-05
|
9.77E-07
|
TRUE
|
{14.30}
|
{1.24}
|
4.24E-05
|
4.22E-07
|
1.23E-06
|
9.98E-08
|
TRUE
|
{14.30}
|
{1.27}
|
3.98E-05
|
3.95E-07
|
1.04E-06
|
9.60E-08
|
TRUE
|
{14.30}
|
{1.30}
|
4.04E-05
|
4.01E-07
|
1.05E-06
|
9.72E-08
|
TRUE
|
Table 26 - Average Error Result of Ten Single-Timestep Simulation Runs (P=8, K=64)
FFT
(SFXP)
|
BSP
(SFXP)
|
Energy
ABS Err
|
Energy
Rel. Err
|
Force
ABS Err
|
Force
RMS Rel. Err
|
Rel. Error
< 1e-5
|
{14.18}
|
{1.21}
|
1.22E-03
|
1.63E-05
|
3.75E-04
|
6.74E-05
|
FALSE
|
{14.18}
|
{1.24}
|
1.30E-03
|
1.73E-05
|
3.81E-04
|
6.79E-05
|
FALSE
|
{14.18}
|
{1.27}
|
1.33E-03
|
1.77E-05
|
3.81E-04
|
6.75E-05
|
FALSE
|
{14.18}
|
{1.30}
|
1.34E-03
|
1.78E-05
|
3.81E-04
|
6.75E-05
|
FALSE
|
|
|
|
|
|
|
|
{14.22}
|
{1.21}
|
1.21E-04
|
1.61E-06
|
7.57E-05
|
2.05E-05
|
FALSE
|
{14.22}
|
{1.24}
|
1.14E-04
|
1.51E-06
|
4.03E-05
|
1.70E-05
|
FALSE
|
{14.22}
|
{1.27}
|
1.13E-04
|
1.51E-06
|
4.10E-05
|
1.69E-05
|
FALSE
|
{14.22}
|
{1.30}
|
1.15E-04
|
1.54E-06
|
4.10E-05
|
1.69E-05
|
FALSE
|
|
|
|
|
|
|
|
{14.26}
|
{1.21}
|
6.75E-05
|
8.99E-07
|
5.47E-05
|
6.99E-06
|
TRUE
|
{14.26}
|
{1.24}
|
4.15E-05
|
5.53E-07
|
9.13E-06
|
1.49E-06
|
TRUE
|
{14.26}
|
{1.27}
|
4.45E-05
|
5.93E-07
|
3.15E-06
|
9.30E-07
|
TRUE
|
{14.26}
|
{1.30}
|
4.54E-05
|
6.05E-07
|
2.57E-06
|
8.65E-07
|
TRUE
|
|
|
|
|
|
|
|
{14.30}
|
{1.21}
|
6.54E-05
|
8.71E-07
|
5.49E-05
|
6.64E-06
|
TRUE
|
{14.30}
|
{1.24}
|
3.68E-05
|
4.90E-07
|
9.97E-06
|
1.21E-06
|
TRUE
|
{14.30}
|
{1.27}
|
3.85E-05
|
5.12E-07
|
1.60E-06
|
6.69E-07
|
TRUE
|
{14.30}
|
{1.30}
|
3.89E-05
|
5.19E-07
|
1.55E-06
|
6.14E-07
|
TRUE
|
Table 27 - Error Result of 200 Single-Timestep Simulation Runs (P=8, K=64)
FFT
(SFXP)
|
BSP
(SFXP)
|
Avg. Energy
Rel. Err
|
Max. Energy
Rel. Err
|
Avg. Force
RMS Rel. Err
|
Max. Force
RMS Rel. Err
|
Rel. Error
< 1e-5
|
{14.26}
|
{1.21}
|
7.55E-07
|
2.12E-06
|
3.67E-05
|
4.76E-04
|
FALSE
|
{14.26}
|
{1.24}
|
6.87E-07
|
1.45E-06
|
4.01E-06
|
3.92E-05
|
FALSE
|
{14.26}
|
{1.27}
|
6.11E-07
|
1.17E-06
|
3.35E-06
|
2.08E-05
|
FALSE
|
{14.26}
|
{1.30}
|
6.01E-07
|
1.03E-06
|
2.06E-06
|
1.12E-05
|
FALSE
|
|
|
|
|
|
|
|
{14.30}
|
{1.21}
|
7.16E-07
|
1.78E-06
|
5.29E-06
|
8.27E-04
|
FALSE
|
{14.30}
|
{1.24}
|
5.81E-07
|
1.00E-06
|
3.98E-06
|
3.89E-05
|
FALSE
|
{14.30}
|
{1.27}
|
5.99E-07
|
1.28E-06
|
1.98E-06
|
9.80E-06
|
TRUE
|
{14.30}
|
{1.30}
|
5.70E-07
|
1.01E-06
|
1.70E-06
|
7.80E-06
|
TRUE
|
7.2.1.Effect of the B-Spline Calculation Precision
This section shows the effect of the B-Spline coefficient and derivative calculation precision on the magnitude of the reciprocal energy and forces error. Three precision analysis plots with a constant FFT calculation precision of {14.30} are shown in Figure 61 to Figure 63. These graphs are plotted with the simulation data shown in Tables 25 and 26 and the BSP_FRAC in these plots represents the number of fractional bits used in the B-Spline calculation. In these plots, the effect of increasing B-Spline calculation precision on the magnitude of the relative error is shown. Figure 61 shows the effect on the relative error of the energy, Figure 62 shows the effect on the maximum absolute error of the forces, and Figure 63 shows the effect on the RMS relative error of the forces.
As seen from the plots, an increase in the B-Spline calculation precision leads to an increase in the relative accuracy of the energy and forces calculation. However, the increase is saturated at a minimum relative error of ~1x10-6. This accuracy limitation can be caused by the input variables precision and also by the FFT calculation precision. Also observed from the plots is that a higher interpolation order and a larger grid size can lead to a higher relative error in both energy and forces. This is because the higher interpolation order and the larger grid size would mean more calculations are carried out and thus, the accumulated error will increase.
Figure 61 - Effect of the B-Spline Precision on Energy Relative Error
Figure 62 - Effect of the B-Spline Precision on Force ABS Error
Figure 63 - Effect of the B-Spline Precision on Force RMS Relative Error
7.2.2.Effect of the FFT Calculation Precision
Similar to Section 5.2.1, this section shows the effect of the FFT calculation precision on the magnitude of the reciprocal energy and forces error. Three precision analysis plots with a constant B-Spline calculation precision of {1.27} are shown in Figure 64 to Figure 66. These graphs are plotted with the simulation data shown in Tables 25 and 26 and the FFT_FRAC in these plots represents the number of fractional bits used in the FFT calculation. In these plots, the effect of increasing FFT calculation precision on the magnitude of the relative error is shown. Figure 64 shows the effect on the relative error of the energy, Figure 65 shows the effect on the maximum absolute error of the forces, and Figure 66 shows the effect on the RMS relative error of the forces.
As seen from the plots, increasing the FFT calculation precision decreases the relative error of the energy and forces calculation down to a minimum relative error of ~1x10-6. This accuracy limitation can be caused by the input variable precision.
Figure 64 - Effect of the FFT Precision on Energy Relative Error
Figure 65 - Effect of the FFT Precision on Force Max ABS Error
Figure 66 - Effect of the FFT Precision on Force RMS Relative Error
Share with your friends: |