diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tests/md_openmp.c | 7 | ||||
-rw-r--r-- | src/tests/md_openmp.f | 35 |
2 files changed, 31 insertions, 11 deletions
diff --git a/src/tests/md_openmp.c b/src/tests/md_openmp.c index 596d80d..b432462 100644 --- a/src/tests/md_openmp.c +++ b/src/tests/md_openmp.c @@ -80,7 +80,7 @@ int main ( int argc, char *argv[] ) int step_print_index; int step_print_num; int step_save; - int sparse_save; + int64_t sparse_save; double *vel; double wtime; tng_trajectory_t traj; @@ -269,7 +269,10 @@ int main ( int argc, char *argv[] ) printf("Error adding data. %s: %d\n", __FILE__, __LINE__); exit(1); } - /* There is no standard ID for potential energy. Pick one. */ + + /* There is no standard ID for potential energy. Pick one. The + potential energy will not be saved every frame - it is sparsely + saved. */ if(tng_data_block_add(traj, 10101, "POTENTIAL ENERGY", TNG_DOUBLE_DATA, diff --git a/src/tests/md_openmp.f b/src/tests/md_openmp.f index 82be0eb..de05ca2 100644 --- a/src/tests/md_openmp.f +++ b/src/tests/md_openmp.f @@ -67,6 +67,7 @@ c integer step_print_index integer step_print_num integer step_save + integer*8 sparse_save integer thread_num double precision vel(nd,np) double precision wtime @@ -218,6 +219,7 @@ c step_print = 0 step_print_index = 0 step_print_num = 10 + sparse_save = 10 frames_saved_cnt = 0 @@ -262,17 +264,26 @@ c call tng_particle_data_block_add(traj, TNG_TRAJ_POSITIONS, & "POSITIONS", TNG_DOUBLE_DATA, TNG_TRAJECTORY_BLOCK, & n_frames_per_frame_set, int(3, 8), int(1, 8), int(0, 8), - & tng_n_particles, TNG_UNCOMPRESSED, %VAL(0)) + & tng_n_particles, TNG_UNCOMPRESSED, %VAL(int(0, 8))) call tng_particle_data_block_add(traj, TNG_TRAJ_VELOCITIES, & "VELOCITIES", TNG_DOUBLE_DATA, TNG_TRAJECTORY_BLOCK, & n_frames_per_frame_set, int(3, 8), int(1, 8), int(0, 8), - & tng_n_particles, TNG_UNCOMPRESSED, %VAL(0)) + & tng_n_particles, TNG_UNCOMPRESSED, %VAL(int(0, 8))) call tng_particle_data_block_add(traj, TNG_TRAJ_FORCES, & "FORCES", TNG_DOUBLE_DATA, TNG_TRAJECTORY_BLOCK, & n_frames_per_frame_set, int(3, 8), int(1, 8), int(0, 8), - & tng_n_particles, TNG_UNCOMPRESSED, %VAL(0)) + & tng_n_particles, TNG_UNCOMPRESSED, %VAL(int(0, 8))) + +c +c The potential energy data block is saved sparsely. +c + call tng_data_block_add(traj, int(10101, 8), + & "POTENTIAL ENERGY", TNG_DOUBLE_DATA, TNG_TRAJECTORY_BLOCK, + & n_frames_per_frame_set, int(1, 8), sparse_save, + & TNG_UNCOMPRESSED, %VAL(int(0, 8))) + c c Write the frame set to disk @@ -301,15 +312,21 @@ c Output to TNG file at regular intervals, specified by step_save c if ( step_save .EQ. 0 .OR. mod(step, step_save) .EQ. 0 ) then call tng_frame_particle_data_write(traj, frames_saved_cnt, - & TNG_TRAJ_POSITIONS, int(0, 8), tng_n_particles, pos, - & TNG_USE_HASH) + & TNG_TRAJ_POSITIONS, int(0, 8), tng_n_particles, pos, + & TNG_USE_HASH) call tng_frame_particle_data_write(traj, frames_saved_cnt, - & TNG_TRAJ_VELOCITIES, int(0, 8), tng_n_particles, vel, - & TNG_USE_HASH) + & TNG_TRAJ_VELOCITIES, int(0, 8), tng_n_particles, vel, + & TNG_USE_HASH) call tng_frame_particle_data_write(traj, frames_saved_cnt, - & TNG_TRAJ_FORCES, int(0, 8), tng_n_particles, force, - & TNG_USE_HASH) + & TNG_TRAJ_FORCES, int(0, 8), tng_n_particles, force, + & TNG_USE_HASH) frames_saved_cnt = frames_saved_cnt + 1 + + if (mod(step, step_save * sparse_save) .EQ. 0) then + call tng_frame_data_write(traj, frames_saved_cnt, + & int(10101, 8), potential, TNG_USE_HASH) + end if + end if call update ( np, nd, pos, vel, force, acc, mass, dt ) |