diff options
author | Magnus Lundborg <magnus.lundborg@scilifelab.se> | 2012-12-03 16:14:06 (GMT) |
---|---|---|
committer | Magnus Lundborg <magnus.lundborg@scilifelab.se> | 2012-12-03 16:14:06 (GMT) |
commit | 2742db93246135f910c74255dbd935bcf8438650 (patch) | |
tree | e056f4d609fab131f869675234a2135988791750 /src/tests | |
parent | 8bb519b429a75ffd52526ba86fe89057e99f7840 (diff) |
Changed name from trg to tng
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/tests/tng_io_testing.c (renamed from src/tests/trg_io_testing.c) | 134 |
2 files changed, 69 insertions, 69 deletions
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index ea5a644..9b9afe5 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -1,5 +1,5 @@ include_directories(${TRAJECTORY_SOURCE_DIR}/src/lib) link_directories(${TRAJECTORY_BINARY_DIR}/src/lib) -add_executable(trg_testing trg_io_testing.c) -target_link_libraries(trg_testing trg_io)
\ No newline at end of file +add_executable(tng_testing tng_io_testing.c) +target_link_libraries(tng_testing tng_io)
\ No newline at end of file diff --git a/src/tests/trg_io_testing.c b/src/tests/tng_io_testing.c index 08a2b90..85a7294 100644 --- a/src/tests/trg_io_testing.c +++ b/src/tests/tng_io_testing.c @@ -1,92 +1,92 @@ #include <inttypes.h> #include <stdlib.h> #include <string.h> -#include "trg_io.h" +#include "tng_io.h" -static trg_function_status trg_setup_test_molecules(struct trg_trajectory *traj) +static tng_function_status tng_setup_test_molecules(struct tng_trajectory *traj) { - struct trg_molecule *molecule; - struct trg_chain *chain; - struct trg_residue *residue; - struct trg_atom *atom; + struct tng_molecule *molecule; + struct tng_chain *chain; + struct tng_residue *residue; + struct tng_atom *atom; int64_t cnt; // int i; - trg_add_molecule(traj, "water", &molecule); - trg_add_chain_to_molecule(traj, molecule, "W", &chain); - trg_add_residue_to_chain(traj, chain, "WAT", &residue); - if(trg_add_atom_to_residue(traj, residue, "O", "O", &atom) == TRG_CRITICAL) + tng_add_molecule(traj, "water", &molecule); + tng_add_chain_to_molecule(traj, molecule, "W", &chain); + tng_add_residue_to_chain(traj, chain, "WAT", &residue); + if(tng_add_atom_to_residue(traj, residue, "O", "O", &atom) == TRG_CRITICAL) { return(TRG_CRITICAL); } - if(trg_add_atom_to_residue(traj, residue, "HO1", "H", &atom) == TRG_CRITICAL) + if(tng_add_atom_to_residue(traj, residue, "HO1", "H", &atom) == TRG_CRITICAL) { return(TRG_CRITICAL); } - if(trg_add_atom_to_residue(traj, residue, "HO2", "H", &atom) == TRG_CRITICAL) + if(tng_add_atom_to_residue(traj, residue, "HO2", "H", &atom) == TRG_CRITICAL) { return(TRG_CRITICAL); } - trg_set_molecule_cnt(traj, molecule, 200); - trg_get_molecule_cnt(traj, molecule, &cnt); + tng_set_molecule_cnt(traj, molecule, 200); + tng_get_molecule_cnt(traj, molecule, &cnt); printf("Created %"PRId64" %s molecules.\n", cnt, molecule->name); // traj->molecule_cnt_list[traj->n_molecules-1] = 5; -// trg_set_molecule_name(traj, &traj->molecules[1], "ligand"); -// trg_set_molecule_name(traj, &traj->molecules[2], "water"); -// trg_set_molecule_name(traj, &traj->molecules[3], "dummy"); +// tng_set_molecule_name(traj, &traj->molecules[1], "ligand"); +// tng_set_molecule_name(traj, &traj->molecules[2], "water"); +// tng_set_molecule_name(traj, &traj->molecules[3], "dummy"); // traj->molecules[0].id = 0; // traj->molecules[1].id = 1; // traj->molecules[2].id = 2; // traj->molecules[3].id = 3; -// if(trg_add_atom_to_molecule(traj, &traj->molecules[0], "atom1", "type1") == TRG_CRITICAL) +// if(tng_add_atom_to_molecule(traj, &traj->molecules[0], "atom1", "type1") == TRG_CRITICAL) // { // return(TRG_CRITICAL); // } -// if(trg_add_atom_to_molecule(traj, &traj->molecules[0], "atom2", "type1") == TRG_CRITICAL) +// if(tng_add_atom_to_molecule(traj, &traj->molecules[0], "atom2", "type1") == TRG_CRITICAL) // { // return(TRG_CRITICAL); // } -// if(trg_add_atom_to_molecule(traj, &traj->molecules[0], "atom3", "type1") == TRG_CRITICAL) +// if(tng_add_atom_to_molecule(traj, &traj->molecules[0], "atom3", "type1") == TRG_CRITICAL) // { // return(TRG_CRITICAL); // } -// if(trg_add_atom_to_molecule(traj, &traj->molecules[0], "atom4", "type2") == TRG_CRITICAL) +// if(tng_add_atom_to_molecule(traj, &traj->molecules[0], "atom4", "type2") == TRG_CRITICAL) // { // return(TRG_CRITICAL); // } -// if(trg_add_atom_to_molecule(traj, &traj->molecules[0], "atom5", "type2") == TRG_CRITICAL) +// if(tng_add_atom_to_molecule(traj, &traj->molecules[0], "atom5", "type2") == TRG_CRITICAL) // { // return(TRG_CRITICAL); // } -// if(trg_add_atom_to_molecule(traj, &traj->molecules[0], "atom6", "type2") == TRG_CRITICAL) +// if(tng_add_atom_to_molecule(traj, &traj->molecules[0], "atom6", "type2") == TRG_CRITICAL) // { // return(TRG_CRITICAL); // } -// if(trg_add_atom_to_molecule(traj, &traj->molecules[0], "atom7", "type3") == TRG_CRITICAL) +// if(tng_add_atom_to_molecule(traj, &traj->molecules[0], "atom7", "type3") == TRG_CRITICAL) // { // return(TRG_CRITICAL); // } -// if(trg_add_atom_to_molecule(traj, &traj->molecules[1], "C1", "C") == TRG_CRITICAL) +// if(tng_add_atom_to_molecule(traj, &traj->molecules[1], "C1", "C") == TRG_CRITICAL) // { // return(TRG_CRITICAL); // } -// if(trg_add_atom_to_molecule(traj, &traj->molecules[1], "O1", "O") == TRG_CRITICAL) +// if(tng_add_atom_to_molecule(traj, &traj->molecules[1], "O1", "O") == TRG_CRITICAL) // { // return(TRG_CRITICAL); // } -// if(trg_add_atom_to_molecule(traj, &traj->molecules[1], "H11", "H") == TRG_CRITICAL) +// if(tng_add_atom_to_molecule(traj, &traj->molecules[1], "H11", "H") == TRG_CRITICAL) // { // return(TRG_CRITICAL); // } -// if(trg_add_atom_to_molecule(traj, &traj->molecules[1], "H12", "H") == TRG_CRITICAL) +// if(tng_add_atom_to_molecule(traj, &traj->molecules[1], "H12", "H") == TRG_CRITICAL) // { // return(TRG_CRITICAL); // } -// if(trg_add_atom_to_molecule(traj, &traj->molecules[1], "H13", "H") == TRG_CRITICAL) +// if(tng_add_atom_to_molecule(traj, &traj->molecules[1], "H13", "H") == TRG_CRITICAL) // { // return(TRG_CRITICAL); // } @@ -94,17 +94,17 @@ static trg_function_status trg_setup_test_molecules(struct trg_trajectory *traj) return(TRG_SUCCESS); } -static trg_function_status trg_test_read_and_write_file - (struct trg_trajectory *traj) +static tng_function_status tng_test_read_and_write_file + (struct tng_trajectory *traj) { - trg_function_status stat; + tng_function_status stat; - stat = trg_read_file_headers(traj, TRG_KEEP_FILE_OPEN); + stat = tng_read_file_headers(traj, TRG_KEEP_FILE_OPEN); if(stat == TRG_CRITICAL) { return(stat); } - stat = trg_write_file_headers(traj, TRG_KEEP_FILE_OPEN); + stat = tng_write_file_headers(traj, TRG_KEEP_FILE_OPEN); if(stat == TRG_CRITICAL) { return(stat); @@ -113,42 +113,42 @@ static trg_function_status trg_test_read_and_write_file while(stat != TRG_CRITICAL && traj->input_file_pos < traj->input_file_len && traj->current_trajectory_frame_set.next_frame_set_file_pos != -1UL) { - stat = trg_read_next_frame_set(traj, TRG_KEEP_FILE_OPEN); + stat = tng_read_next_frame_set(traj, TRG_KEEP_FILE_OPEN); if(stat == TRG_CRITICAL) { return(stat); } - stat = trg_write_frame_set(traj, TRG_KEEP_FILE_OPEN); + stat = tng_write_frame_set(traj, TRG_KEEP_FILE_OPEN); } return(stat); } -static trg_function_status trg_test_write_and_read_traj(struct trg_trajectory *traj) +static tng_function_status tng_test_write_and_read_traj(struct tng_trajectory *traj) { int i, j, k, nr, tot_n_mols, cnt; float *data, *molpos; - trg_function_status stat; + tng_function_status stat; /* Create molecules */ - if(trg_setup_test_molecules(traj) == TRG_CRITICAL) + if(tng_setup_test_molecules(traj) == TRG_CRITICAL) { return(TRG_CRITICAL); } - if(trg_init_block(&traj->non_trajectory_blocks[traj->n_non_trajectory_blocks]) == TRG_CRITICAL) + if(tng_init_block(&traj->non_trajectory_blocks[traj->n_non_trajectory_blocks]) == TRG_CRITICAL) { return(TRG_CRITICAL); } traj->non_trajectory_blocks[traj->n_non_trajectory_blocks].id = TRG_MOLECULES; - if(trg_set_block_name(traj, + if(tng_set_block_name(traj, &traj->non_trajectory_blocks[traj->n_non_trajectory_blocks++], "MOLECULES") == TRG_CRITICAL) { return(TRG_CRITICAL); } - if(trg_write_file_headers(traj, TRG_KEEP_FILE_OPEN) == TRG_CRITICAL) + if(tng_write_file_headers(traj, TRG_KEEP_FILE_OPEN) == TRG_CRITICAL) { return(TRG_CRITICAL); } @@ -204,7 +204,7 @@ static trg_function_status trg_test_write_and_read_traj(struct trg_trajectory *t data[cnt++] = molpos[nr + 2] - 1; } } - if(trg_new_frame_set(traj, i * traj->frame_set_n_frames, + if(tng_new_frame_set(traj, i * traj->frame_set_n_frames, traj->frame_set_n_frames) != TRG_SUCCESS) { printf("Error creating frame set %d. %s: %d\n", @@ -214,7 +214,7 @@ static trg_function_status trg_test_write_and_read_traj(struct trg_trajectory *t return(TRG_CRITICAL); } - if(trg_add_particle_data_block(traj, TRG_TRAJ_POSITIONS, + if(tng_add_particle_data_block(traj, TRG_TRAJ_POSITIONS, "POSITIONS", TRG_FLOAT_DATA, traj->frame_set_n_frames, 3, @@ -227,7 +227,7 @@ static trg_function_status trg_test_write_and_read_traj(struct trg_trajectory *t free(data); return(TRG_CRITICAL); } - if(trg_write_frame_set(traj, TRG_KEEP_FILE_OPEN) != TRG_SUCCESS) + if(tng_write_frame_set(traj, TRG_KEEP_FILE_OPEN) != TRG_SUCCESS) { printf("Error writing frame set. %s: %d\n", __FILE__, __LINE__); free(molpos); @@ -236,24 +236,24 @@ static trg_function_status trg_test_write_and_read_traj(struct trg_trajectory *t } } -// trg_add_ids_names_pair(traj, TRG_TRAJ_VELOCITIES, "BOX SHAPE"); -// trg_add_ids_names_pair(traj, TRG_TRAJ_POSITIONS, "TRAJECTORY POSITIONS"); -// trg_add_ids_names_pair(traj, TRG_TRAJ_VELOCITIES, "TRAJECTORY VELOCITIES"); -// trg_add_ids_names_pair(traj, TRG_TRAJ_FORCES, "TRAJECTORY FORCES"); -// trg_add_ids_names_pair(traj, 11000, "TEST DATA"); +// tng_add_ids_names_pair(traj, TRG_TRAJ_VELOCITIES, "BOX SHAPE"); +// tng_add_ids_names_pair(traj, TRG_TRAJ_POSITIONS, "TRAJECTORY POSITIONS"); +// tng_add_ids_names_pair(traj, TRG_TRAJ_VELOCITIES, "TRAJECTORY VELOCITIES"); +// tng_add_ids_names_pair(traj, TRG_TRAJ_FORCES, "TRAJECTORY FORCES"); +// tng_add_ids_names_pair(traj, 11000, "TEST DATA"); free(molpos); free(data); - trg_destroy_trajectory(traj); - trg_set_input_file(traj, "/tmp/trg_test.trg"); + tng_destroy_trajectory(traj); + tng_set_input_file(traj, "/tmp/tng_test.tng"); - stat = trg_read_file_headers(traj, TRG_KEEP_FILE_OPEN); + stat = tng_read_file_headers(traj, TRG_KEEP_FILE_OPEN); while(stat != TRG_CRITICAL && traj->input_file_pos < traj->input_file_len && traj->current_trajectory_frame_set.next_frame_set_file_pos != -1ULL) { - stat = trg_read_next_frame_set(traj, TRG_KEEP_FILE_OPEN); + stat = tng_read_next_frame_set(traj, TRG_KEEP_FILE_OPEN); if(stat == TRG_CRITICAL) { return(stat); @@ -265,31 +265,31 @@ static trg_function_status trg_test_write_and_read_traj(struct trg_trajectory *t int main() { - struct trg_trajectory traj; + struct tng_trajectory traj; char time_str[TRG_MAX_DATE_STR_LEN]; - if(trg_init_trajectory(&traj) != TRG_SUCCESS) + if(tng_init_trajectory(&traj) != TRG_SUCCESS) { - trg_destroy_trajectory(&traj); + tng_destroy_trajectory(&traj); printf("Test Init trajectory:\t\t\t\tFailed. %s: %d.\n", __FILE__, __LINE__); exit(1); } printf("Test Init trajectory:\t\t\t\tSucceeded.\n"); - trg_get_time_str(&traj, time_str); + tng_get_time_str(&traj, time_str); printf("Creation time: %s\n", time_str); - trg_set_input_file(&traj, "trg_example.trg"); - trg_set_output_file(&traj, "/tmp/trg_example_test.trg"); + tng_set_input_file(&traj, "tng_example.tng"); + tng_set_output_file(&traj, "/tmp/tng_example_test.tng"); -// if(trg_test_endianness(&traj) != TRG_SUCCESS) +// if(tng_test_endianness(&traj) != TRG_SUCCESS) // { // printf("Test failed: Endianness. %s: %d\n", __FILE__, __LINE__); // } - if(trg_test_read_and_write_file(&traj) == TRG_CRITICAL) + if(tng_test_read_and_write_file(&traj) == TRG_CRITICAL) { printf("Test Read and write file:\t\t\tFailed. %s: %d\n", __FILE__, __LINE__); @@ -299,8 +299,8 @@ int main() printf("Test Read and write file:\t\t\tSucceeded.\n"); } - if(trg_destroy_trajectory(&traj) == TRG_CRITICAL || - trg_init_trajectory(&traj) == TRG_CRITICAL) + if(tng_destroy_trajectory(&traj) == TRG_CRITICAL || + tng_init_trajectory(&traj) == TRG_CRITICAL) { printf("Test Destroy and init trajectory:\t\tFailed. %s: %d\n", __FILE__, __LINE__); @@ -311,9 +311,9 @@ int main() } - trg_set_output_file(&traj, "/tmp/trg_test.trg"); + tng_set_output_file(&traj, "/tmp/tng_test.tng"); - if(trg_test_write_and_read_traj(&traj) == TRG_CRITICAL) + if(tng_test_write_and_read_traj(&traj) == TRG_CRITICAL) { printf("Test Write and read file:\t\t\tFailed. %s: %d\n", __FILE__, __LINE__); @@ -323,7 +323,7 @@ int main() printf("Test Write and read file:\t\t\tSucceeded.\n"); } - if(trg_destroy_trajectory(&traj) == TRG_CRITICAL) + if(tng_destroy_trajectory(&traj) == TRG_CRITICAL) { printf("Test Destroy trajectory:\t\t\tFailed. %s: %d.\n", __FILE__, __LINE__); |