Segmentation Fault during Force Matching

88 views
Skip to first unread message

Rajorshi Chattopadhyay

unread,
Dec 17, 2021, 5:48:33 AM12/17/21
to cp2k
Dear All,
I am trying to run the cp2k exercise on fitting empirical potential for water molecule using Force Fitting. However, I get a 'Program received signal SIGSEGV: Segmentation fault - invalid memory reference" error. The details of my system and simulation are as follows:

1. Version - cp2k 2.6.2
2. Input files - attached
3. Output -
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  0x7F8BC0B7CE08
#1  0x7F8BC0B7BF90
#2  0x7F8BC02AD4BF
#3  0xD08D8C
#4  0x42D9F9
#5  0x4316B5
#6  0x42AD3B
#7  0x42A47C
#8  0x7F8BC029883F
#9  0x42A4D8
#10  0xFFFFFFFFFFFFFFFF
Segmentation fault (core dumped)

4. Hardware - Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz with 24 CPUs and 2 threads per core (Architecture : x86_64), 32GB RAM and Ubuntu 16.04LTS

My knowledge of FORTRAN is not good. Any suggestions to get over this error will be very helpful.

ff_match.in
ff.in

Hervé Bulou

unread,
Apr 7, 2022, 10:00:19 AM4/7/22
to cp2k
Hello,

I got a similar message and identified that the problem was with line 222 in the optimize_input.F file.

...
214 IF (ASSOCIATED(cell_traj_read)) ALLOCATE (cell_traj(3, 3, n_frames))
215
216 n_frames = 0
217 DO i_frame = oi_env%fm_env%frame_start, oi_env%fm_env%frame_stop, oi_env%fm_env%frame_stride
218 n_frames = n_frames + 1
219 force_traj(:, :, n_frames) = force_traj_read(:, :, i_frame)
220 pos_traj(:, :, n_frames) = pos_traj_read(:, :, i_frame)
221 energy_traj(n_frames) = energy_traj_read(i_frame)
222 IF (ASSOCIATED(cell_traj)) cell_traj(:, :, n_frames) = cell_traj_read(:, :, i_frame)
223 ENDDO
...


In the above version of the code, line 214 allows cell_traj to be allocated if cell_traj_read is allocated.
But this doesn't guarantee that if cell_traj_read is not allocated, cell_traj is not allocated, , which leads to a memory access problems line 222 (if cell_traj is allocated then we try to write in an array which is not allocated which leads to the error)
I fixed the problem by adding cell_traj to the NULLIFY command line 200 :
...
 200 NULLIFY (cell_traj_read, force_traj_read, pos_traj_read, energy_traj_read,cell_traj)
...

regards,

Hervé Bulou
Reply all
Reply to author
Forward
0 new messages