diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/tng_io.c | 371 | ||||
-rw-r--r-- | src/lib/tng_io.h | 106 | ||||
-rw-r--r-- | src/tests/tng_io_testing.c | 66 |
3 files changed, 242 insertions, 301 deletions
diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c index d6b6729..d99b06b 100644 --- a/src/lib/tng_io.c +++ b/src/lib/tng_io.c @@ -255,7 +255,7 @@ static tng_function_status tng_read_block_header { printf("Cannot read header size. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -285,7 +285,7 @@ static tng_function_status tng_read_block_header { printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", block->header_contents_size, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -296,7 +296,7 @@ static tng_function_status tng_read_block_header tng_data->input_file) == 0) { printf("Cannot read header. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -345,7 +345,7 @@ static tng_function_status tng_read_block_header { printf("Cannot allocate memory (%d bytes). %s: %d\n", len, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } strncpy(block->name, block->header_contents+offset, len); @@ -531,7 +531,7 @@ static tng_function_status tng_read_general_info_block { printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", block->block_contents_size, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -541,7 +541,7 @@ static tng_function_status tng_read_general_info_block tng_data->input_file) == 0) { printf("Cannot read block. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -570,7 +570,7 @@ static tng_function_status tng_read_general_info_block { printf("Cannot allocate memory (%d bytes). %s: %d\n", len, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } strncpy(tng_data->program_name, block->block_contents, len); @@ -582,7 +582,7 @@ static tng_function_status tng_read_general_info_block { printf("Cannot allocate memory (%d bytes). %s: %d\n", len, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } strncpy(tng_data->forcefield_name, block->block_contents+offset, len); @@ -594,7 +594,7 @@ static tng_function_status tng_read_general_info_block { printf("Cannot allocate memory (%d bytes). %s: %d\n", len, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } strncpy(tng_data->user_name, block->block_contents+offset, len); @@ -722,7 +722,7 @@ static tng_function_status tng_write_general_info_block { printf("Cannot allocate memory (1 byte). %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } tng_data->program_name[0] = 0; @@ -734,7 +734,7 @@ static tng_function_status tng_write_general_info_block { printf("Cannot allocate memory (1 byte). %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } tng_data->forcefield_name[0] = 0; @@ -746,7 +746,7 @@ static tng_function_status tng_write_general_info_block { printf("Cannot allocate memory (1 byte). %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } tng_data->user_name[0] = 0; @@ -758,7 +758,7 @@ static tng_function_status tng_write_general_info_block { printf("Cannot allocate memory (1 byte). %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } tng_data->computer_name[0] = 0; @@ -770,7 +770,7 @@ static tng_function_status tng_write_general_info_block { printf("Cannot allocate memory (1 byte). %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } tng_data->pgp_signature[0] = 0; @@ -795,7 +795,7 @@ static tng_function_status tng_write_general_info_block { printf("Cannot write header of file %s. %s: %d\n", tng_data->output_file_path, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -836,7 +836,7 @@ static tng_function_status tng_write_general_info_block { printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", block->block_contents_size, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -939,7 +939,7 @@ static tng_function_status tng_write_general_info_block { printf("Cannot write header of file %s. %s: %d\n", tng_data->output_file_path, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -947,7 +947,7 @@ static tng_function_status tng_write_general_info_block tng_data->output_file) != 1) { printf("Could not write all block data. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -970,7 +970,7 @@ static tng_function_status tng_read_molecules_block if(tng_init_input_file(tng_data, FALSE) != TNG_SUCCESS) { - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -984,7 +984,7 @@ static tng_function_status tng_read_molecules_block { printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", block->block_contents_size, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -1043,7 +1043,7 @@ static tng_function_status tng_read_molecules_block printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", tng_data->n_molecules * sizeof(struct tng_molecule), __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -1060,7 +1060,7 @@ static tng_function_status tng_read_molecules_block printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", tng_data->n_molecules * sizeof(struct tng_molecule), __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } } @@ -1167,7 +1167,7 @@ static tng_function_status tng_read_molecules_block printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", molecule->n_chains * sizeof(struct tng_chain), __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -1181,7 +1181,7 @@ static tng_function_status tng_read_molecules_block printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", molecule->n_residues * sizeof(struct tng_residue), __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -1194,7 +1194,7 @@ static tng_function_status tng_read_molecules_block printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", molecule->n_atoms * sizeof(struct tng_atom), __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -1330,7 +1330,7 @@ static tng_function_status tng_read_molecules_block printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", molecule->n_bonds * sizeof(struct tng_bond), __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -1387,7 +1387,7 @@ static tng_function_status tng_write_molecules_block if(tng_init_output_file(tng_data, FALSE) != TNG_SUCCESS) { - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -1409,7 +1409,7 @@ static tng_function_status tng_write_molecules_block { printf("Cannot allocate memory (1 byte). %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } molecule->name[0] = 0; @@ -1428,7 +1428,7 @@ static tng_function_status tng_write_molecules_block { printf("Cannot allocate memory (1 byte). %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } chain->name[0] = 0; @@ -1452,7 +1452,7 @@ static tng_function_status tng_write_molecules_block { printf("Cannot allocate memory (1 byte). %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } residue->name[0] = 0; @@ -1475,7 +1475,7 @@ static tng_function_status tng_write_molecules_block { printf("Cannot allocate memory (1 byte). %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } atom->name[0] = 0; @@ -1489,7 +1489,7 @@ static tng_function_status tng_write_molecules_block { printf("Cannot allocate memory (1 byte). %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } atom->atom_type[0] = 0; @@ -1514,7 +1514,7 @@ static tng_function_status tng_write_molecules_block { printf("Cannot write header of file %s. %s: %d\n", tng_data->output_file_path, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -1528,7 +1528,7 @@ static tng_function_status tng_write_molecules_block { printf("Could not write all block data. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } return(TNG_SUCCESS); @@ -1558,7 +1558,7 @@ static tng_function_status tng_write_molecules_block { printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", block->block_contents_size, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -1824,7 +1824,7 @@ static tng_function_status tng_write_molecules_block { printf("Cannot write header of file %s. %s: %d\n", tng_data->output_file_path, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -1833,7 +1833,7 @@ static tng_function_status tng_write_molecules_block { printf("Could not write all block data. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -1855,7 +1855,7 @@ static tng_function_status tng_read_frame_set_block if(tng_init_input_file(tng_data, FALSE) != TNG_SUCCESS) { - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -1869,7 +1869,7 @@ static tng_function_status tng_read_frame_set_block { printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", block->block_contents_size, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -1879,7 +1879,7 @@ static tng_function_status tng_read_frame_set_block tng_data->input_file) == 0) { printf("Cannot read block. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -1972,7 +1972,7 @@ static tng_function_status tng_read_frame_set_block printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", sizeof(int64_t) * tng_data->n_molecules, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } } @@ -2075,7 +2075,7 @@ static tng_function_status tng_read_frame_set_block return(TNG_SUCCESS); } -static tng_function_status tng_write_frame_set_block +static tng_function_status tng_frame_set_write_block (tng_trajectory_t tng_data, struct tng_gen_block *block, const tng_write_mode mode, @@ -2089,7 +2089,7 @@ static tng_function_status tng_write_frame_set_block if(tng_init_output_file(tng_data, FALSE) != TNG_SUCCESS) { - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -2101,7 +2101,7 @@ static tng_function_status tng_write_frame_set_block { printf("Cannot write header of file %s. %s: %d\n", tng_data->output_file_path, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -2115,7 +2115,7 @@ static tng_function_status tng_write_frame_set_block { printf("Could not write all block data. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } return(TNG_SUCCESS); @@ -2130,7 +2130,7 @@ static tng_function_status tng_write_frame_set_block { printf("Cannot allocate memory (%d bytes). %s: %d\n", name_len+1, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } block->name = temp_name; @@ -2152,7 +2152,7 @@ static tng_function_status tng_write_frame_set_block { printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", block->block_contents_size, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -2268,7 +2268,7 @@ static tng_function_status tng_write_frame_set_block { printf("Cannot write header of file %s. %s: %d\n", tng_data->output_file_path, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -2276,7 +2276,7 @@ static tng_function_status tng_write_frame_set_block tng_data->output_file) != 1) { printf("Could not write all block data. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -2296,7 +2296,7 @@ static tng_function_status tng_read_trajectory_toc_block if(tng_init_input_file(tng_data, FALSE) != TNG_SUCCESS) { - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -2310,7 +2310,7 @@ static tng_function_status tng_read_trajectory_toc_block { printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", block->block_contents_size, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -2320,7 +2320,7 @@ static tng_function_status tng_read_trajectory_toc_block tng_data->input_file) == 0) { printf("Cannot read block. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -2375,7 +2375,7 @@ static tng_function_status tng_read_trajectory_toc_block { printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", toc->n_blocks * sizeof(int64_t), __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } } @@ -2414,7 +2414,7 @@ static tng_function_status tng_write_trajectory_toc_block if(tng_init_output_file(tng_data, FALSE) != TNG_SUCCESS) { - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -2426,7 +2426,7 @@ static tng_function_status tng_write_trajectory_toc_block { printf("Cannot write header of file %s. %s: %d\n", tng_data->output_file_path, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -2440,7 +2440,7 @@ static tng_function_status tng_write_trajectory_toc_block { printf("Could not write all block data. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } return(TNG_SUCCESS); @@ -2455,7 +2455,7 @@ static tng_function_status tng_write_trajectory_toc_block { printf("Cannot allocate memory (%d bytes). %s: %d\n", name_len+1, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } block->name = temp_name; @@ -2478,7 +2478,7 @@ static tng_function_status tng_write_trajectory_toc_block { printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", block->block_contents_size, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -2507,7 +2507,7 @@ static tng_function_status tng_write_trajectory_toc_block { printf("Cannot write header of file %s. %s: %d\n", tng_data->output_file_path, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -2516,7 +2516,7 @@ static tng_function_status tng_write_trajectory_toc_block { printf("Could not write all block data. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -2538,7 +2538,7 @@ static tng_function_status tng_read_trajectory_mapping_block if(tng_init_input_file(tng_data, FALSE) != TNG_SUCCESS) { - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -2552,7 +2552,7 @@ static tng_function_status tng_read_trajectory_mapping_block { printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", block->block_contents_size, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -2562,7 +2562,7 @@ static tng_function_status tng_read_trajectory_mapping_block tng_data->input_file) == 0) { printf("Cannot read block. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -2593,7 +2593,7 @@ static tng_function_status tng_read_trajectory_mapping_block { printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", block->block_contents_size, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } frame_set->mappings = mappings; @@ -2640,7 +2640,7 @@ static tng_function_status tng_read_trajectory_mapping_block { printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", mapping->n_particles * sizeof(int64_t), __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } } @@ -2683,13 +2683,13 @@ static tng_function_status tng_write_trajectory_mapping_block { printf("Mapping block index out of bounds. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } if(tng_init_output_file(tng_data, FALSE) != TNG_SUCCESS) { - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -2701,7 +2701,7 @@ static tng_function_status tng_write_trajectory_mapping_block { printf("Cannot write header of file %s. %s: %d\n", tng_data->output_file_path, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -2715,7 +2715,7 @@ static tng_function_status tng_write_trajectory_mapping_block { printf("Could not write all block data. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } return(TNG_SUCCESS); @@ -2730,7 +2730,7 @@ static tng_function_status tng_write_trajectory_mapping_block { printf("Cannot allocate memory (%d bytes). %s: %d\n", name_len+1, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } block->name = temp_name; @@ -2748,7 +2748,7 @@ static tng_function_status tng_write_trajectory_mapping_block { printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", block->block_contents_size, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -2802,7 +2802,7 @@ static tng_function_status tng_write_trajectory_mapping_block { printf("Cannot write header of file %s. %s: %d\n", tng_data->output_file_path, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -2810,7 +2810,7 @@ static tng_function_status tng_write_trajectory_mapping_block tng_data->output_file) != 1) { printf("Could not write all block data. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -3035,7 +3035,7 @@ static tng_function_status tng_read_particle_data { printf("Cannot allocate memory (%d bytes). %s: %d\n", (int)strlen(block->name)+1, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } strcpy(data->block_name, block->name); @@ -3177,7 +3177,7 @@ static tng_function_status tng_write_particle_data_block if(tng_init_output_file(tng_data, FALSE) != TNG_SUCCESS) { - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -3216,7 +3216,7 @@ static tng_function_status tng_write_particle_data_block { printf("Cannot write header of file %s. %s: %d\n", tng_data->output_file_path, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -3230,7 +3230,7 @@ static tng_function_status tng_write_particle_data_block { printf("Could not write all block data. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } return(TNG_SUCCESS); @@ -3243,7 +3243,7 @@ static tng_function_status tng_write_particle_data_block { printf("Cannot allocate memory (%d bytes). %s: %d\n", len, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } block->name = temp_name; @@ -3314,7 +3314,7 @@ static tng_function_status tng_write_particle_data_block { printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", block->block_contents_size, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -3520,7 +3520,7 @@ static tng_function_status tng_write_particle_data_block { printf("Cannot write header of file %s. %s: %d\n", tng_data->output_file_path, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -3528,7 +3528,7 @@ static tng_function_status tng_write_particle_data_block tng_data->output_file) != 1) { printf("Could not write all block data. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -3739,7 +3739,7 @@ static tng_function_status tng_read_data(tng_trajectory_t tng_data, { printf("Cannot allocate memory (%d bytes). %s: %d\n", (int)strlen(block->name)+1, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } strcpy(data->block_name, block->name); @@ -3871,7 +3871,7 @@ static tng_function_status tng_write_data_block(tng_trajectory_t tng_data, if(tng_init_output_file(tng_data, FALSE) != TNG_SUCCESS) { - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -3908,7 +3908,7 @@ static tng_function_status tng_write_data_block(tng_trajectory_t tng_data, { printf("Cannot write header of file %s. %s: %d\n", tng_data->output_file_path, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -3922,7 +3922,7 @@ static tng_function_status tng_write_data_block(tng_trajectory_t tng_data, { printf("Could not write all block data. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } return(TNG_SUCCESS); @@ -3937,7 +3937,7 @@ static tng_function_status tng_write_data_block(tng_trajectory_t tng_data, { printf("Cannot allocate memory (%d bytes). %s: %d\n", len+1, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } block->name = temp_name; @@ -3989,7 +3989,7 @@ static tng_function_status tng_write_data_block(tng_trajectory_t tng_data, { printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", block->block_contents_size, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -4150,7 +4150,7 @@ static tng_function_status tng_write_data_block(tng_trajectory_t tng_data, { printf("Cannot write header of file %s. %s: %d\n", tng_data->output_file_path, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -4159,7 +4159,7 @@ static tng_function_status tng_write_data_block(tng_trajectory_t tng_data, { printf("Could not write all block data. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -4180,7 +4180,7 @@ static tng_function_status tng_read_data_block_contents if(tng_init_input_file(tng_data, FALSE) != TNG_SUCCESS) { - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -4194,7 +4194,7 @@ static tng_function_status tng_read_data_block_contents { printf("Cannot allocate memory (%"PRId64" bytes). %s: %d\n", block->block_contents_size, __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -4204,7 +4204,7 @@ static tng_function_status tng_read_data_block_contents tng_data->input_file) == 0) { printf("Cannot read block. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(block); + tng_block_destroy(block); return(TNG_CRITICAL); } @@ -4437,7 +4437,7 @@ static tng_function_status tng_update_header_pointers tng_data->input_file = tng_data->output_file; - tng_init_block(&block); + tng_block_init(&block); tng_data->output_file_pos = ftell(tng_data->output_file); fseek(tng_data->output_file, 0, SEEK_SET); @@ -4446,7 +4446,7 @@ static tng_function_status tng_update_header_pointers { printf("Cannot read general info header. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(&block); + tng_block_destroy(&block); tng_data->input_file = temp; return(TNG_CRITICAL); } @@ -4475,7 +4475,7 @@ static tng_function_status tng_update_header_pointers if(fwrite(&pos, sizeof(int64_t), 1, tng_data->output_file) != 1) { - tng_destroy_block(&block); + tng_block_destroy(&block); return(TNG_CRITICAL); } @@ -4496,7 +4496,7 @@ static tng_function_status tng_update_header_pointers if(fwrite(&pos, sizeof(int64_t), 1, tng_data->output_file) != 1) { - tng_destroy_block(&block); + tng_block_destroy(&block); return(TNG_CRITICAL); } @@ -4507,7 +4507,7 @@ static tng_function_status tng_update_header_pointers fseek(tng_data->output_file, tng_data->output_file_pos, SEEK_SET); - tng_destroy_block(&block); + tng_block_destroy(&block); return(TNG_SUCCESS); } @@ -4527,7 +4527,7 @@ static tng_function_status tng_update_frame_set_pointers return(TNG_CRITICAL); } - tng_init_block(&block); + tng_block_init(&block); tng_data->output_file_pos = ftell(tng_data->output_file); tng_data->input_file = tng_data->output_file; @@ -4545,7 +4545,7 @@ static tng_function_status tng_update_frame_set_pointers { printf("Cannot read frame header. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(&block); + tng_block_destroy(&block); tng_data->input_file = temp; return(TNG_CRITICAL); } @@ -4572,7 +4572,7 @@ static tng_function_status tng_update_frame_set_pointers if(fwrite(&pos, sizeof(int64_t), 1, tng_data->output_file) != 1) { - tng_destroy_block(&block); + tng_block_destroy(&block); tng_data->input_file = temp; return(TNG_CRITICAL); } @@ -4597,7 +4597,7 @@ static tng_function_status tng_update_frame_set_pointers { printf("Cannot read frame header. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(&block); + tng_block_destroy(&block); tng_data->input_file = temp; return(TNG_CRITICAL); } @@ -4620,7 +4620,7 @@ static tng_function_status tng_update_frame_set_pointers if(fwrite(&pos, sizeof(int64_t), 1, tng_data->output_file) != 1) { - tng_destroy_block(&block); + tng_block_destroy(&block); tng_data->input_file = temp; return(TNG_CRITICAL); } @@ -4636,13 +4636,13 @@ static tng_function_status tng_update_frame_set_pointers fseek(tng_data->output_file, tng_data->output_file_pos, SEEK_SET); tng_data->input_file = temp; - tng_destroy_block(&block); + tng_block_destroy(&block); return(TNG_SUCCESS); } -tng_function_status tng_set_block_name(tng_trajectory_t tng_data, +tng_function_status tng_block_name_set(tng_trajectory_t tng_data, struct tng_gen_block *block, const char *new_name) { @@ -4671,9 +4671,9 @@ tng_function_status tng_set_block_name(tng_trajectory_t tng_data, return(TNG_SUCCESS); } -tng_function_status tng_init_block(struct tng_gen_block *block) +tng_function_status tng_block_init(struct tng_gen_block *block) { -// printf("In tng_init_block\n"); +// printf("In tng_block_init\n"); block->id = -1; /* block->hash_type = TNG_NO_HASH; @@ -4690,7 +4690,7 @@ tng_function_status tng_init_block(struct tng_gen_block *block) } -tng_function_status tng_destroy_block(struct tng_gen_block *block) +tng_function_status tng_block_destroy(struct tng_gen_block *block) { // printf("Destroying block\n"); /* if(block->hash_name) @@ -4722,7 +4722,7 @@ tng_function_status tng_destroy_block(struct tng_gen_block *block) return(TNG_SUCCESS); } -tng_function_status tng_set_atom_name(tng_trajectory_t tng_data, +tng_function_status tng_atom_name_set(tng_trajectory_t tng_data, tng_atom_t atom, const char *new_name) { @@ -4751,7 +4751,7 @@ tng_function_status tng_set_atom_name(tng_trajectory_t tng_data, return(TNG_SUCCESS); } -tng_function_status tng_set_atom_type(tng_trajectory_t tng_data, +tng_function_status tng_atom_type_set(tng_trajectory_t tng_data, tng_atom_t atom, const char *new_type) { @@ -4804,7 +4804,7 @@ tng_function_status tng_destroy_atom(tng_atom_t atom) return(TNG_SUCCESS); } -tng_function_status tng_add_molecule(tng_trajectory_t tng_data, +tng_function_status tng_molecule_add(tng_trajectory_t tng_data, const char *name, tng_molecule_t *molecule) { @@ -4842,8 +4842,8 @@ tng_function_status tng_add_molecule(tng_trajectory_t tng_data, *molecule = &new_molecules[tng_data->n_molecules]; - tng_init_molecule(*molecule); - tng_set_molecule_name(tng_data, *molecule, name); + tng_molecule_init(*molecule); + tng_molecule_name_set(tng_data, *molecule, name); /* FIXME: Should this be a function argument instead? */ tng_data->molecule_cnt_list[tng_data->n_molecules] = 0; @@ -4874,7 +4874,7 @@ tng_function_status tng_add_molecule(tng_trajectory_t tng_data, return(TNG_SUCCESS); } -tng_function_status tng_set_molecule_name(tng_trajectory_t tng_data, +tng_function_status tng_molecule_name_set(tng_trajectory_t tng_data, tng_molecule_t molecule, const char *new_name) { @@ -4903,7 +4903,7 @@ tng_function_status tng_set_molecule_name(tng_trajectory_t tng_data, return(TNG_SUCCESS); } -tng_function_status tng_get_molecule_cnt(tng_trajectory_t tng_data, +tng_function_status tng_molecule_cnt_get(tng_trajectory_t tng_data, tng_molecule_t molecule, int64_t *cnt) { @@ -4926,7 +4926,7 @@ tng_function_status tng_get_molecule_cnt(tng_trajectory_t tng_data, return(TNG_SUCCESS); } -tng_function_status tng_set_molecule_cnt(tng_trajectory_t tng_data, +tng_function_status tng_molecule_cnt_set(tng_trajectory_t tng_data, tng_molecule_t molecule, const int64_t cnt) { @@ -4953,7 +4953,7 @@ tng_function_status tng_set_molecule_cnt(tng_trajectory_t tng_data, return(TNG_SUCCESS); } -tng_function_status tng_add_chain_to_molecule(tng_trajectory_t tng_data, +tng_function_status tng_molecule_chain_add(tng_trajectory_t tng_data, tng_molecule_t molecule, const char *name, tng_chain_t *chain) @@ -4977,7 +4977,7 @@ tng_function_status tng_add_chain_to_molecule(tng_trajectory_t tng_data, *chain = &new_chains[molecule->n_chains]; (*chain)->name = 0; - tng_set_chain_name(tng_data, *chain, name); + tng_chain_name_set(tng_data, *chain, name); (*chain)->molecule = molecule; (*chain)->id = molecule->n_chains; @@ -4988,7 +4988,7 @@ tng_function_status tng_add_chain_to_molecule(tng_trajectory_t tng_data, return(TNG_SUCCESS); } -tng_function_status tng_set_chain_name(tng_trajectory_t tng_data, +tng_function_status tng_chain_name_set(tng_trajectory_t tng_data, tng_chain_t chain, const char *new_name) { @@ -5017,7 +5017,7 @@ tng_function_status tng_set_chain_name(tng_trajectory_t tng_data, return(TNG_SUCCESS); } -tng_function_status tng_add_residue_to_chain(tng_trajectory_t tng_data, +tng_function_status tng_chain_residue_add(tng_trajectory_t tng_data, tng_chain_t chain, const char *name, tng_residue_t *residue) @@ -5081,7 +5081,7 @@ tng_function_status tng_add_residue_to_chain(tng_trajectory_t tng_data, } (*residue)->name = 0; - tng_set_residue_name(tng_data, *residue, name); + tng_residue_name_set(tng_data, *residue, name); (*residue)->chain = chain; (*residue)->id = chain->n_residues; @@ -5094,7 +5094,7 @@ tng_function_status tng_add_residue_to_chain(tng_trajectory_t tng_data, return(TNG_SUCCESS); } -tng_function_status tng_set_residue_name(tng_trajectory_t tng_data, +tng_function_status tng_residue_name_set(tng_trajectory_t tng_data, tng_residue_t residue, const char *new_name) { @@ -5123,7 +5123,7 @@ tng_function_status tng_set_residue_name(tng_trajectory_t tng_data, return(TNG_SUCCESS); } -tng_function_status tng_add_atom_to_residue(tng_trajectory_t tng_data, +tng_function_status tng_residue_atom_add(tng_trajectory_t tng_data, tng_residue_t residue, const char *atom_name, const char *atom_type, @@ -5188,8 +5188,8 @@ tng_function_status tng_add_atom_to_residue(tng_trajectory_t tng_data, } tng_init_atom(*atom); - tng_set_atom_name(tng_data, *atom, atom_name); - tng_set_atom_type(tng_data, *atom, atom_type); + tng_atom_name_set(tng_data, *atom, atom_name); + tng_atom_type_set(tng_data, *atom, atom_type); (*atom)->residue = residue; (*atom)->id = molecule->n_atoms; @@ -5201,7 +5201,7 @@ tng_function_status tng_add_atom_to_residue(tng_trajectory_t tng_data, } -tng_function_status tng_init_molecule(tng_molecule_t molecule) +tng_function_status tng_molecule_init(tng_molecule_t molecule) { molecule->name = 0; molecule->n_chains = 0; @@ -5216,7 +5216,7 @@ tng_function_status tng_init_molecule(tng_molecule_t molecule) return(TNG_SUCCESS); } -tng_function_status tng_destroy_molecule(tng_molecule_t molecule) +tng_function_status tng_molecule_destroy(tng_molecule_t molecule) { int i; @@ -5277,7 +5277,7 @@ tng_function_status tng_destroy_molecule(tng_molecule_t molecule) return(TNG_SUCCESS); } -tng_function_status tng_init_trajectory(tng_trajectory_t tng_data) +tng_function_status tng_trajectory_init(tng_trajectory_t tng_data) { time_t seconds; struct tng_trajectory_frame_set *frame_set = @@ -5418,9 +5418,9 @@ tng_function_status tng_init_trajectory(tng_trajectory_t tng_data) - tng_init_block(&tng_data->non_trajectory_blocks[0]); + tng_block_init(&tng_data->non_trajectory_blocks[0]); tng_data->non_trajectory_blocks[0].id = TNG_GENERAL_INFO; - tng_set_block_name(tng_data, &tng_data->non_trajectory_blocks[0], + tng_block_name_set(tng_data, &tng_data->non_trajectory_blocks[0], "GENERAL INFO"); tng_data->current_trajectory_frame_set.next_frame_set_file_pos = -1; @@ -5433,7 +5433,7 @@ tng_function_status tng_init_trajectory(tng_trajectory_t tng_data) return(TNG_SUCCESS); } -tng_function_status tng_destroy_trajectory(tng_trajectory_t tng_data) +tng_function_status tng_trajectory_destroy(tng_trajectory_t tng_data) { int64_t n_frames, n_particles; int i, j, k, l; @@ -5530,7 +5530,7 @@ tng_function_status tng_destroy_trajectory(tng_trajectory_t tng_data) for(i=tng_data->n_non_trajectory_blocks; i--;) { - tng_destroy_block(&tng_data->non_trajectory_blocks[i]); + tng_block_destroy(&tng_data->non_trajectory_blocks[i]); } tng_data->n_trajectory_blocks = 0; @@ -5743,7 +5743,7 @@ tng_function_status tng_destroy_trajectory(tng_trajectory_t tng_data) { for(i=tng_data->n_molecules; i--;) { - tng_destroy_molecule(&tng_data->molecules[i]); + tng_molecule_destroy(&tng_data->molecules[i]); } free(tng_data->molecules); tng_data->molecules = 0; @@ -5757,7 +5757,7 @@ tng_function_status tng_destroy_trajectory(tng_trajectory_t tng_data) return(TNG_SUCCESS); } -tng_function_status tng_set_input_file(tng_trajectory_t tng_data, +tng_function_status tng_input_file_set(tng_trajectory_t tng_data, const char *file_name) { int len; @@ -5789,7 +5789,7 @@ tng_function_status tng_set_input_file(tng_trajectory_t tng_data, return(tng_init_input_file(tng_data, FALSE)); } -tng_function_status tng_set_output_file(tng_trajectory_t tng_data, +tng_function_status tng_output_file_set(tng_trajectory_t tng_data, const char *file_name) { int len; @@ -5822,7 +5822,7 @@ tng_function_status tng_set_output_file(tng_trajectory_t tng_data, } -tng_function_status tng_set_program_name(tng_trajectory_t tng_data, +tng_function_status tng_program_name_set(tng_trajectory_t tng_data, const char *new_name) { int len; @@ -5850,7 +5850,7 @@ tng_function_status tng_set_program_name(tng_trajectory_t tng_data, return(TNG_SUCCESS); } -tng_function_status tng_set_forcefield_name(tng_trajectory_t tng_data, +tng_function_status tng_forcefield_name_set(tng_trajectory_t tng_data, const char *new_name) { int len; @@ -5878,7 +5878,7 @@ tng_function_status tng_set_forcefield_name(tng_trajectory_t tng_data, return(TNG_SUCCESS); } -tng_function_status tng_set_user_name(tng_trajectory_t tng_data, +tng_function_status tng_user_name_set(tng_trajectory_t tng_data, const char *new_name) { int len; @@ -5906,7 +5906,7 @@ tng_function_status tng_set_user_name(tng_trajectory_t tng_data, return(TNG_SUCCESS); } -tng_function_status tng_set_computer_name(tng_trajectory_t tng_data, +tng_function_status tng_computer_name_set(tng_trajectory_t tng_data, const char *new_name) { int len; @@ -5934,7 +5934,7 @@ tng_function_status tng_set_computer_name(tng_trajectory_t tng_data, return(TNG_SUCCESS); } -tng_function_status tng_set_signature(tng_trajectory_t tng_data, +tng_function_status tng_signature_set(tng_trajectory_t tng_data, const char *signature) { int len; @@ -5962,7 +5962,7 @@ tng_function_status tng_set_signature(tng_trajectory_t tng_data, return(TNG_SUCCESS); } -tng_function_status tng_read_file_headers(tng_trajectory_t tng_data, +tng_function_status tng_file_headers_read(tng_trajectory_t tng_data, const tng_hash_mode hash_mode) { int i, cnt = 0, prev_pos = 0; @@ -5984,13 +5984,13 @@ tng_function_status tng_read_file_headers(tng_trajectory_t tng_data, for(i = tng_data->n_non_trajectory_blocks; i--;) { - tng_destroy_block(block++); + tng_block_destroy(block++); } tng_data->n_non_trajectory_blocks = 0; block = tng_data->non_trajectory_blocks; - tng_init_block(block); + tng_block_init(block); /* Non trajectory blocks (they come before the trajectory * blocks in the file) */ while (prev_pos < tng_data->input_file_len && @@ -6000,21 +6000,21 @@ tng_function_status tng_read_file_headers(tng_trajectory_t tng_data, tng_data->n_non_trajectory_blocks < 32) { // printf("Reading block header %d: %s\n", (int)block->id, block->name); - if(tng_read_next_block(tng_data, block, + if(tng_block_read_next(tng_data, block, hash_mode) == TNG_SUCCESS) { // printf("Read block %s\n", block->name); block++; cnt++; tng_data->n_non_trajectory_blocks++; - if(tng_init_block(block) != TNG_SUCCESS) + if(tng_block_init(block) != TNG_SUCCESS) { return(TNG_CRITICAL); } } else { - tng_destroy_block(block); + tng_block_destroy(block); } prev_pos = ftell(tng_data->input_file); } @@ -6022,14 +6022,14 @@ tng_function_status tng_read_file_headers(tng_trajectory_t tng_data, /* Go back if a trajectory block was encountered */ if(block->id == TNG_TRAJECTORY_FRAME_SET) { - tng_destroy_block(block); + tng_block_destroy(block); fseek(tng_data->input_file, prev_pos, SEEK_SET); } return(TNG_SUCCESS); } -tng_function_status tng_write_file_headers(tng_trajectory_t tng_data, +tng_function_status tng_file_headers_write(tng_trajectory_t tng_data, const tng_hash_mode hash_mode) { int i; @@ -6077,7 +6077,7 @@ tng_function_status tng_write_file_headers(tng_trajectory_t tng_data, /* FIXME: Currently writing non-trajectory data blocks here. * Should perhaps be moved. */ - tng_init_block(&data_block); + tng_block_init(&data_block); for(i = 0; i < tng_data->n_data_blocks; i++) { data_block.id = tng_data->non_tr_data[i].block_id; @@ -6092,12 +6092,12 @@ tng_function_status tng_write_file_headers(tng_trajectory_t tng_data, i, 0, TNG_NORMAL_WRITE, hash_mode); } - tng_destroy_block(&data_block); + tng_block_destroy(&data_block); return(TNG_SUCCESS); } -tng_function_status tng_read_next_block(tng_trajectory_t tng_data, +tng_function_status tng_block_read_next(tng_trajectory_t tng_data, struct tng_gen_block *block, const tng_hash_mode hash_mode) { @@ -6139,7 +6139,7 @@ tng_function_status tng_read_next_block(tng_trajectory_t tng_data, // switch(block->id) // { // case TNG_TRAJECTORY_FRAME_SET: -// return(tng_write_frame_set_block(tng_data, block, TNG_NORMAL_WRITE)); +// return(tng_frame_set_write_block(tng_data, block, TNG_NORMAL_WRITE)); // break; // case TNG_BLOCK_TABLE_OF_CONTENTS: // return(tng_write_trajectory_toc_block(tng_data, block, @@ -6185,7 +6185,7 @@ tng_function_status tng_read_next_block(tng_trajectory_t tng_data, // return(TNG_SUCCESS); // } -tng_function_status tng_read_next_frame_set(tng_trajectory_t tng_data, +tng_function_status tng_frame_set_read_next(tng_trajectory_t tng_data, const tng_hash_mode hash_mode) { long int file_pos; @@ -6197,7 +6197,7 @@ tng_function_status tng_read_next_frame_set(tng_trajectory_t tng_data, return(TNG_CRITICAL); } - tng_init_block(&block); + tng_block_init(&block); file_pos = tng_data->current_trajectory_frame_set.next_frame_set_file_pos; @@ -6227,7 +6227,7 @@ tng_function_status tng_read_next_frame_set(tng_trajectory_t tng_data, tng_data->current_trajectory_frame_set_input_file_pos = file_pos; - if(tng_read_next_block(tng_data, &block, + if(tng_block_read_next(tng_data, &block, hash_mode) == TNG_SUCCESS) { file_pos = ftell(tng_data->input_file); @@ -6237,7 +6237,7 @@ tng_function_status tng_read_next_frame_set(tng_trajectory_t tng_data, stat != TNG_CRITICAL && block.id != TNG_TRAJECTORY_FRAME_SET) { - stat = tng_read_next_block(tng_data, &block, + stat = tng_block_read_next(tng_data, &block, hash_mode) == TNG_SUCCESS; if(stat != TNG_CRITICAL) @@ -6262,12 +6262,12 @@ tng_function_status tng_read_next_frame_set(tng_trajectory_t tng_data, tng_data->input_file_pos=ftell(tng_data->input_file); - tng_destroy_block(&block); + tng_block_destroy(&block); return(TNG_SUCCESS); } -tng_function_status tng_write_frame_set(tng_trajectory_t tng_data, +tng_function_status tng_frame_set_write(tng_trajectory_t tng_data, const tng_hash_mode hash_mode) { int i, j; @@ -6289,10 +6289,10 @@ tng_function_status tng_write_frame_set(tng_trajectory_t tng_data, tng_data->output_file_pos; } - tng_init_block(&block); + tng_block_init(&block); block.id = TNG_TRAJECTORY_FRAME_SET; - tng_write_frame_set_block(tng_data, &block, TNG_NORMAL_WRITE, hash_mode); + tng_frame_set_write_block(tng_data, &block, TNG_NORMAL_WRITE, hash_mode); if(frame_set->contents.n_blocks > 0) { @@ -6344,12 +6344,12 @@ tng_function_status tng_write_frame_set(tng_trajectory_t tng_data, stat = tng_update_frame_set_pointers(tng_data, hash_mode); } - tng_destroy_block(&block); + tng_block_destroy(&block); return(stat); } -tng_function_status tng_new_frame_set(tng_trajectory_t tng_data, +tng_function_status tng_frame_set_new(tng_trajectory_t tng_data, const int64_t first_frame, const int64_t n_frames) { @@ -6409,7 +6409,7 @@ tng_function_status tng_new_frame_set(tng_trajectory_t tng_data, if(frame_set->long_stride_prev_frame_set_file_pos != -1 && frame_set->long_stride_prev_frame_set_file_pos != 0) { - tng_init_block(&block); + tng_block_init(&block); tng_data->input_file = tng_data->output_file; curr_pos = ftell(tng_data->output_file); @@ -6421,7 +6421,7 @@ tng_function_status tng_new_frame_set(tng_trajectory_t tng_data, { printf("Cannot read frame header. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(&block); + tng_block_destroy(&block); tng_data->input_file = temp; return(TNG_CRITICAL); } @@ -6435,7 +6435,7 @@ tng_function_status tng_new_frame_set(tng_trajectory_t tng_data, 1, tng_data->output_file) == 0) { printf("Cannot read block. %s: %d\n", __FILE__, __LINE__); - tng_destroy_block(&block); + tng_block_destroy(&block); tng_data->input_file = temp; return(TNG_CRITICAL); } @@ -6452,7 +6452,7 @@ tng_function_status tng_new_frame_set(tng_trajectory_t tng_data, } } - tng_destroy_block(&block); + tng_block_destroy(&block); tng_data->input_file = temp; fseek(tng_data->output_file, curr_pos, SEEK_SET); } @@ -6658,7 +6658,7 @@ tng_function_status tng_add_data_block(tng_trajectory_t tng_data, } -tng_function_status tng_add_particle_data_block(tng_trajectory_t tng_data, +tng_function_status tng_particle_data_block_add(tng_trajectory_t tng_data, const int64_t id, const char *block_name, const char datatype, @@ -6850,48 +6850,27 @@ tng_function_status tng_add_particle_data_block(tng_trajectory_t tng_data, return(TNG_SUCCESS); } - -tng_function_status tng_read_next_traj_block(tng_trajectory_t tng_data) -{ - /* STUB */ - return(TNG_SUCCESS); -} - -tng_function_status tng_write_next_traj_block(tng_trajectory_t tng_data) -{ - /* STUB */ - return(TNG_SUCCESS); -} - -tng_function_status tng_read_traj_block(tng_trajectory_t tng_data, +tng_function_status tng_traj_block_read(tng_trajectory_t tng_data, int64_t block_id) { /* STUB */ return(TNG_SUCCESS); } -tng_function_status tng_write_traj_block(tng_trajectory_t tng_data, +tng_function_status tng_traj_block_write(tng_trajectory_t tng_data, int64_t block_id) { /* STUB */ return(TNG_SUCCESS); } -tng_function_status tng_read_frame_nr(tng_trajectory_t tng_data, - int64_t frame_nr) -{ - /* STUB */ - return(TNG_SUCCESS); -} - -tng_function_status tng_write_frame_nr(tng_trajectory_t tng_data, - int64_t frame_nr) +tng_function_status tng_frame_set_read_nr(tng_trajectory_t tng_data, + int64_t frame_set_nr) { - /* STUB */ return(TNG_SUCCESS); } -tng_function_status tng_read_frame_nrs(tng_trajectory_t tng_data, +tng_function_status tng_frame_read_interval(tng_trajectory_t tng_data, int64_t start_frame_nr, int64_t end_frame_nr) { @@ -6899,7 +6878,7 @@ tng_function_status tng_read_frame_nrs(tng_trajectory_t tng_data, return(TNG_SUCCESS); } -tng_function_status tng_write_frame_nrs(tng_trajectory_t tng_data, +tng_function_status tng_frame_write_interval(tng_trajectory_t tng_data, int64_t start_frame_nr, int64_t end_frame_nr) { @@ -6907,12 +6886,6 @@ tng_function_status tng_write_frame_nrs(tng_trajectory_t tng_data, return(TNG_SUCCESS); } -tng_function_status tng_read_frame_set_nr(tng_trajectory_t tng_data, - int64_t frame_set_nr) -{ - return(TNG_SUCCESS); -} - tng_function_status tng_get_time_str(tng_trajectory_t tng_data, char *time) diff --git a/src/lib/tng_io.h b/src/lib/tng_io.h index cfb95d5..59b8265 100644 --- a/src/lib/tng_io.h +++ b/src/lib/tng_io.h @@ -352,25 +352,25 @@ struct tng_trajectory { *tng_data is a pointer to pre-allocated memory. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_init_trajectory(tng_trajectory_t tng_data); +tng_function_status tng_trajectory_init(tng_trajectory_t tng_data); /* Clean up a trajectory data container. *tng_data is a pointer to pre-allocated memory containing trajectory data. All allocated memory in the data structure is freed. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_destroy_trajectory(tng_trajectory_t tng_data); +tng_function_status tng_trajectory_destroy(tng_trajectory_t tng_data); /* Set the name of the input file. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_set_input_file(tng_trajectory_t tng_data, +tng_function_status tng_input_file_set(tng_trajectory_t tng_data, const char *file_name); /* Set the name of the output file. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_set_output_file(tng_trajectory_t tng_data, +tng_function_status tng_output_file_set(tng_trajectory_t tng_data, const char *file_name); /* Set the program name used when creating the trajectory. @@ -378,7 +378,7 @@ tng_function_status tng_set_output_file(tng_trajectory_t tng_data, *new_name is a pointer to the string containing the wanted name. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_set_program_name(tng_trajectory_t tng_data, +tng_function_status tng_program_name_set(tng_trajectory_t tng_data, const char *new_name); /* Set the name of the forcefield used in the trajectory. @@ -386,7 +386,7 @@ tng_function_status tng_set_program_name(tng_trajectory_t tng_data, *new_name is a pointer to the string containing the wanted name. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_set_forcefield_name(tng_trajectory_t tng_data, +tng_function_status tng_forcefield_name_set(tng_trajectory_t tng_data, const char *new_name); /* Set the name of the user creating the trajectory. @@ -394,7 +394,7 @@ tng_function_status tng_set_forcefield_name(tng_trajectory_t tng_data, *new_name is a pointer to the string containing the wanted name. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_set_user_name(tng_trajectory_t tng_data, +tng_function_status tng_user_name_set(tng_trajectory_t tng_data, const char *new_name); /* Set the name of the computer used when creating the trajectory. @@ -402,7 +402,7 @@ tng_function_status tng_set_user_name(tng_trajectory_t tng_data, *new_name is a pointer to the string containing the wanted name. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_set_computer_name(tng_trajectory_t tng_data, +tng_function_status tng_computer_name_set(tng_trajectory_t tng_data, const char *new_name); /* Set the pgp_signature of the trajectory. @@ -410,34 +410,34 @@ tng_function_status tng_set_computer_name(tng_trajectory_t tng_data, *signature is a pointer to the string containing the pgp_signature. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_set_signature(tng_trajectory_t tng_data, +tng_function_status tng_signature_set(tng_trajectory_t tng_data, const char *signature); /* Setup a molecule container. *molecule is a pointer to pre-allocated memory. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_init_molecule(tng_molecule_t molecule); +tng_function_status tng_molecule_init(tng_molecule_t molecule); /* Clean up a molecule container. *molecule is a pointer to pre-allocated memory containing a molecule. All allocated memory in the data structure is freed. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_destroy_molecule(tng_molecule_t molecule); +tng_function_status tng_molecule_destroy(tng_molecule_t molecule); /* Setup a data block. *block is a pointer to pre-allocated memory. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_init_block(struct tng_gen_block *block); +tng_function_status tng_block_init(struct tng_gen_block *block); /* Clean up a data block. *block is a pointer to pre-allocated memory. All allocated memory in the data structure is freed. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_destroy_block(struct tng_gen_block *block); +tng_function_status tng_block_destroy(struct tng_gen_block *block); /* Set the name of a data block. tng_data is the trajectory data container containing the block.. @@ -445,7 +445,7 @@ tng_function_status tng_destroy_block(struct tng_gen_block *block); *new_name is a string containing the wanted name. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_set_block_name(tng_trajectory_t tng_data, +tng_function_status tng_block_name_set(tng_trajectory_t tng_data, struct tng_gen_block *block, const char *new_name); @@ -455,7 +455,7 @@ tng_function_status tng_set_block_name(tng_trajectory_t tng_data, **molecule is a pointer to a pointer to the newly created molecule. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_add_molecule(tng_trajectory_t tng_data, +tng_function_status tng_molecule_add(tng_trajectory_t tng_data, const char *name, tng_molecule_t *molecule); @@ -465,7 +465,7 @@ tng_function_status tng_add_molecule(tng_trajectory_t tng_data, *new_name is a string containing the wanted name. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_set_molecule_name(tng_trajectory_t tng_data, +tng_function_status tng_molecule_name_set(tng_trajectory_t tng_data, tng_molecule_t molecule, const char *new_name); @@ -475,7 +475,7 @@ tng_function_status tng_set_molecule_name(tng_trajectory_t tng_data, *cnt is a pointer to the variable to be populated with the count. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_get_molecule_cnt(tng_trajectory_t tng_data, +tng_function_status tng_molecule_cnt_get(tng_trajectory_t tng_data, tng_molecule_t molecule, int64_t *cnt); @@ -485,7 +485,7 @@ tng_function_status tng_get_molecule_cnt(tng_trajectory_t tng_data, cnt is the number of instances of this molecule. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_set_molecule_cnt(tng_trajectory_t tng_data, +tng_function_status tng_molecule_cnt_set(tng_trajectory_t tng_data, tng_molecule_t molecule, int64_t cnt); @@ -496,7 +496,7 @@ tng_function_status tng_set_molecule_cnt(tng_trajectory_t tng_data, **chain is a pointer to a pointer to the newly created chain. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_add_chain_to_molecule(tng_trajectory_t tng_data, +tng_function_status tng_molecule_chain_add(tng_trajectory_t tng_data, tng_molecule_t molecule, const char *name, tng_chain_t *chain); @@ -507,7 +507,7 @@ tng_function_status tng_add_chain_to_molecule(tng_trajectory_t tng_data, *new_name is a string containing the wanted name. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_set_chain_name(tng_trajectory_t tng_data, +tng_function_status tng_chain_name_set(tng_trajectory_t tng_data, tng_chain_t chain, const char *new_name); @@ -518,7 +518,7 @@ tng_function_status tng_set_chain_name(tng_trajectory_t tng_data, **residue is a pointer to a pointer to the newly created residue. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_add_residue_to_chain(tng_trajectory_t tng_data, +tng_function_status tng_chain_residue_add(tng_trajectory_t tng_data, tng_chain_t chain, const char *name, tng_residue_t *residue); @@ -529,7 +529,7 @@ tng_function_status tng_add_residue_to_chain(tng_trajectory_t tng_data, *new_name is a string containing the wanted name. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_set_residue_name(tng_trajectory_t tng_data, +tng_function_status tng_residue_name_set(tng_trajectory_t tng_data, tng_residue_t residue, const char *new_name); @@ -541,7 +541,7 @@ tng_function_status tng_set_residue_name(tng_trajectory_t tng_data, **atom is a pointer to a pointer to the newly created atom. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_add_atom_to_residue(tng_trajectory_t tng_data, +tng_function_status tng_residue_atom_add(tng_trajectory_t tng_data, tng_residue_t residue, const char *atom_name, const char *atom_type, @@ -553,7 +553,7 @@ tng_function_status tng_add_atom_to_residue(tng_trajectory_t tng_data, *new_name is a string containing the wanted name. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_set_atom_name(tng_trajectory_t tng_data, +tng_function_status tng_atom_name_set(tng_trajectory_t tng_data, tng_atom_t atom, const char *new_name); @@ -563,7 +563,7 @@ tng_function_status tng_set_atom_name(tng_trajectory_t tng_data, *new_name is a string containing the atom type. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_set_atom_type(tng_trajectory_t tng_data, +tng_function_status tng_atom_type_set(tng_trajectory_t tng_data, tng_atom_t atom, const char *new_type); @@ -576,7 +576,7 @@ tng_function_status tng_set_atom_type(tng_trajectory_t tng_data, compared to the md5 hash of the read contents to ensure valid data. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_read_file_headers(tng_trajectory_t tng_data, +tng_function_status tng_file_headers_read(tng_trajectory_t tng_data, const tng_hash_mode hash_mode); /* Write the header blocks to the output_file of tng_data. @@ -587,7 +587,7 @@ tng_function_status tng_read_file_headers(tng_trajectory_t tng_data, If hash_mode == TNG_USE_HASH an md5 hash for each header block will be generated. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_write_file_headers(tng_trajectory_t tng_data, +tng_function_status tng_file_headers_write(tng_trajectory_t tng_data, const tng_hash_mode hash_mode); @@ -601,7 +601,7 @@ tng_function_status tng_write_file_headers(tng_trajectory_t tng_data, compared to the md5 hash of the read contents to ensure valid data. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_read_next_block(tng_trajectory_t tng_data, +tng_function_status tng_block_read_next(tng_trajectory_t tng_data, struct tng_gen_block *block_data, const tng_hash_mode hash_mode); @@ -614,7 +614,7 @@ tng_function_status tng_read_next_block(tng_trajectory_t tng_data, compared to the md5 hash of the read contents to ensure valid data. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_read_next_frame_set(tng_trajectory_t tng_data, +tng_function_status tng_frame_set_read_next(tng_trajectory_t tng_data, const tng_hash_mode hash_mode); /* Write one frame set, including toc, mapping and related data blocks @@ -624,14 +624,14 @@ tng_function_status tng_read_next_frame_set(tng_trajectory_t tng_data, If hash_mode == TNG_USE_HASH an md5 hash for each block will be generated. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_write_frame_set(tng_trajectory_t tng_data, +tng_function_status tng_frame_set_write(tng_trajectory_t tng_data, const tng_hash_mode hash_mode); -tng_function_status tng_new_frame_set(tng_trajectory_t tng_data, +tng_function_status tng_frame_set_new(tng_trajectory_t tng_data, const int64_t first_frame, const int64_t n_frames); -tng_function_status tng_add_particle_data_block(tng_trajectory_t tng_data, +tng_function_status tng_particle_data_block_add(tng_trajectory_t tng_data, const int64_t id, const char *block_name, const char datatype, @@ -644,27 +644,13 @@ tng_function_status tng_add_particle_data_block(tng_trajectory_t tng_data, void *new_data); -/* Read one (the next) trajectory block from the input_file of tng_data. - tng_data is a trajectory data container. tng_data->input_file_path specifies which - file to read from. If the file (input_file) is not open it will be opened. - Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error - has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_read_next_traj_block(tng_trajectory_t tng_data); - -/* Write one trajectory block to the output_file of tng_data. - tng_data is a trajectory data container. tng_data->output_file_path specifies which - file to write to. If the file (output_file) is not open it will be opened. - Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error - has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_write_next_traj_block(tng_trajectory_t tng_data); - /* Read one trajectory block from the input_file of tng_data. tng_data is a trajectory data container. tng_data->input_file_path specifies which file to read from. If the file (input_file) is not open it will be opened. block_id is the ID of the block to read. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_read_traj_block(tng_trajectory_t tng_data, +tng_function_status tng_traj_block_read(tng_trajectory_t tng_data, int64_t block_id); /* Write one trajectory block to the output_file of tng_data. @@ -673,7 +659,7 @@ tng_function_status tng_read_traj_block(tng_trajectory_t tng_data, block_id is the ID of the block to write. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_write_traj_block(tng_trajectory_t tng_data, +tng_function_status tng_traj_block_write(tng_trajectory_t tng_data, int64_t block_id); /* Read a requested frame set. @@ -682,27 +668,9 @@ tng_function_status tng_write_traj_block(tng_trajectory_t tng_data, frame_set_nr is the number of the frame set to return (starting from 0). Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_read_frame_set_nr(tng_trajectory_t tng_data, +tng_function_status tng_frame_set_read_nr(tng_trajectory_t tng_data, int64_t frame_set_nr); -/* Read one trajectory frame from the input_file of tng_data. - tng_data is a trajectory data container. tng_data->input_file_path specifies which - file to read from. If the file (input_file) is not open it will be opened. - frame_nr is the index number of the frame to read. - Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error - has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_read_frame_nr(tng_trajectory_t tng_data, - int64_t frame_nr); - -/* Write one trajectory frame to the output_file of tng_data. - tng_data is a trajectory data container. tng_data->output_file_path specifies which - file to write to. If the file (output_file) is not open it will be opened. - frame_nr is the index number of the frame to write. - Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error - has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_write_frame_nr(tng_trajectory_t tng_data, - int64_t frame_nr); - /* Read a number of consecutive trajectory frames from the input_file of tng_data. tng_data is a trajectory data container. tng_data->input_file_path specifies which file to read from. If the file (input_file) is not open it will be opened. @@ -710,7 +678,7 @@ tng_function_status tng_write_frame_nr(tng_trajectory_t tng_data, end_frame_nr is the index number of the last frame to read. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_read_frame_nrs(tng_trajectory_t tng_data, +tng_function_status tng_frame_read_interval(tng_trajectory_t tng_data, int64_t start_frame_nr, int64_t end_frame_nr); @@ -721,7 +689,7 @@ tng_function_status tng_read_frame_nrs(tng_trajectory_t tng_data, end_frame_nr is the index number of the last frame to write. Returns TNG_SUCCESS (0) if successful, TNG_FAILURE (1) if a minor error has occurred or TNG_CRITICAL (2) if a major error has occured. */ -tng_function_status tng_write_frame_nrs(tng_trajectory_t tng_data, +tng_function_status tng_frame_write_interval(tng_trajectory_t tng_data, int64_t start_frame_nr, int64_t end_frame_nr); diff --git a/src/tests/tng_io_testing.c b/src/tests/tng_io_testing.c index 7ee3628..65406f0 100644 --- a/src/tests/tng_io_testing.c +++ b/src/tests/tng_io_testing.c @@ -15,28 +15,28 @@ static tng_function_status tng_setup_test_molecules(tng_trajectory_t traj) int64_t cnt; // int i; - 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) == TNG_CRITICAL) + tng_molecule_add(traj, "water", &molecule); + tng_molecule_chain_add(traj, molecule, "W", &chain); + tng_chain_residue_add(traj, chain, "WAT", &residue); + if(tng_residue_atom_add(traj, residue, "O", "O", &atom) == TNG_CRITICAL) { return(TNG_CRITICAL); } - if(tng_add_atom_to_residue(traj, residue, "HO1", "H", &atom) == TNG_CRITICAL) + if(tng_residue_atom_add(traj, residue, "HO1", "H", &atom) == TNG_CRITICAL) { return(TNG_CRITICAL); } - if(tng_add_atom_to_residue(traj, residue, "HO2", "H", &atom) == TNG_CRITICAL) + if(tng_residue_atom_add(traj, residue, "HO2", "H", &atom) == TNG_CRITICAL) { return(TNG_CRITICAL); } - tng_set_molecule_cnt(traj, molecule, 200); - tng_get_molecule_cnt(traj, molecule, &cnt); + tng_molecule_cnt_set(traj, molecule, 200); + tng_molecule_cnt_get(traj, molecule, &cnt); printf("Created %"PRId64" %s molecules.\n", cnt, molecule->name); // traj->molecule_cnt_list[traj->n_molecules-1] = 5; -// 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"); +// tng_molecule_name_set(traj, &traj->molecules[1], "ligand"); +// tng_molecule_name_set(traj, &traj->molecules[2], "water"); +// tng_molecule_name_set(traj, &traj->molecules[3], "dummy"); // traj->molecules[0].id = 0; // traj->molecules[1].id = 1; // traj->molecules[2].id = 2; @@ -99,12 +99,12 @@ static tng_function_status tng_test_read_and_write_file { tng_function_status stat; - stat = tng_read_file_headers(traj, TNG_USE_HASH); + stat = tng_file_headers_read(traj, TNG_USE_HASH); if(stat == TNG_CRITICAL) { return(stat); } - stat = tng_write_file_headers(traj, TNG_USE_HASH); + stat = tng_file_headers_write(traj, TNG_USE_HASH); if(stat == TNG_CRITICAL) { return(stat); @@ -113,12 +113,12 @@ static tng_function_status tng_test_read_and_write_file while(stat != TNG_CRITICAL && traj->input_file_pos < traj->input_file_len && traj->current_trajectory_frame_set.next_frame_set_file_pos != -1UL) { - stat = tng_read_next_frame_set(traj, TNG_USE_HASH); + stat = tng_frame_set_read_next(traj, TNG_USE_HASH); if(stat == TNG_CRITICAL) { return(stat); } - stat = tng_write_frame_set(traj, TNG_USE_HASH); + stat = tng_frame_set_write(traj, TNG_USE_HASH); } return(stat); @@ -136,19 +136,19 @@ static tng_function_status tng_test_write_and_read_traj(tng_trajectory_t traj) return(TNG_CRITICAL); } - if(tng_init_block(&traj->non_trajectory_blocks[traj->n_non_trajectory_blocks]) == TNG_CRITICAL) + if(tng_block_init(&traj->non_trajectory_blocks[traj->n_non_trajectory_blocks]) == TNG_CRITICAL) { return(TNG_CRITICAL); } traj->non_trajectory_blocks[traj->n_non_trajectory_blocks].id = TNG_MOLECULES; - if(tng_set_block_name(traj, + if(tng_block_name_set(traj, &traj->non_trajectory_blocks[traj->n_non_trajectory_blocks++], "MOLECULES") == TNG_CRITICAL) { return(TNG_CRITICAL); } - if(tng_write_file_headers(traj, TNG_SKIP_HASH) == TNG_CRITICAL) + if(tng_file_headers_write(traj, TNG_SKIP_HASH) == TNG_CRITICAL) { return(TNG_CRITICAL); } @@ -204,7 +204,7 @@ static tng_function_status tng_test_write_and_read_traj(tng_trajectory_t traj) data[cnt++] = molpos[nr + 2] - 1; } } - if(tng_new_frame_set(traj, i * traj->frame_set_n_frames, + if(tng_frame_set_new(traj, i * traj->frame_set_n_frames, traj->frame_set_n_frames) != TNG_SUCCESS) { printf("Error creating frame set %d. %s: %d\n", @@ -214,7 +214,7 @@ static tng_function_status tng_test_write_and_read_traj(tng_trajectory_t traj) return(TNG_CRITICAL); } - if(tng_add_particle_data_block(traj, TNG_TRAJ_POSITIONS, + if(tng_particle_data_block_add(traj, TNG_TRAJ_POSITIONS, "POSITIONS", TNG_FLOAT_DATA, traj->frame_set_n_frames, 3, @@ -227,7 +227,7 @@ static tng_function_status tng_test_write_and_read_traj(tng_trajectory_t traj) free(data); return(TNG_CRITICAL); } - if(tng_write_frame_set(traj, TNG_SKIP_HASH) != TNG_SUCCESS) + if(tng_frame_set_write(traj, TNG_SKIP_HASH) != TNG_SUCCESS) { printf("Error writing frame set. %s: %d\n", __FILE__, __LINE__); free(molpos); @@ -245,15 +245,15 @@ static tng_function_status tng_test_write_and_read_traj(tng_trajectory_t traj) free(molpos); free(data); - tng_destroy_trajectory(traj); - tng_set_input_file(traj, "/tmp/tng_test.tng"); + tng_trajectory_destroy(traj); + tng_input_file_set(traj, "/tmp/tng_test.tng"); - stat = tng_read_file_headers(traj, TNG_SKIP_HASH); + stat = tng_file_headers_read(traj, TNG_SKIP_HASH); while(stat != TNG_CRITICAL && traj->input_file_pos < traj->input_file_len && traj->current_trajectory_frame_set.next_frame_set_file_pos != -1ULL) { - stat = tng_read_next_frame_set(traj, TNG_SKIP_HASH); + stat = tng_frame_set_read_next(traj, TNG_SKIP_HASH); if(stat == TNG_CRITICAL) { return(stat); @@ -268,9 +268,9 @@ int main() struct tng_trajectory traj; char time_str[TNG_MAX_DATE_STR_LEN]; - if(tng_init_trajectory(&traj) != TNG_SUCCESS) + if(tng_trajectory_init(&traj) != TNG_SUCCESS) { - tng_destroy_trajectory(&traj); + tng_trajectory_destroy(&traj); printf("Test Init trajectory:\t\t\t\tFailed. %s: %d.\n", __FILE__, __LINE__); exit(1); @@ -281,8 +281,8 @@ int main() printf("Creation time: %s\n", time_str); - tng_set_input_file(&traj, "tng_example.tng"); - tng_set_output_file(&traj, "/tmp/tng_example_out.tng"); + tng_input_file_set(&traj, "tng_example.tng"); + tng_output_file_set(&traj, "/tmp/tng_example_out.tng"); // if(tng_test_endianness(&traj) != TNG_SUCCESS) // { @@ -299,8 +299,8 @@ int main() printf("Test Read and write file:\t\t\tSucceeded.\n"); } - if(tng_destroy_trajectory(&traj) == TNG_CRITICAL || - tng_init_trajectory(&traj) == TNG_CRITICAL) + if(tng_trajectory_destroy(&traj) == TNG_CRITICAL || + tng_trajectory_init(&traj) == TNG_CRITICAL) { printf("Test Destroy and init trajectory:\t\tFailed. %s: %d\n", __FILE__, __LINE__); @@ -311,7 +311,7 @@ int main() } - tng_set_output_file(&traj, "/tmp/tng_test.tng"); + tng_output_file_set(&traj, "/tmp/tng_test.tng"); if(tng_test_write_and_read_traj(&traj) == TNG_CRITICAL) { @@ -323,7 +323,7 @@ int main() printf("Test Write and read file:\t\t\tSucceeded.\n"); } - if(tng_destroy_trajectory(&traj) == TNG_CRITICAL) + if(tng_trajectory_destroy(&traj) == TNG_CRITICAL) { printf("Test Destroy trajectory:\t\t\tFailed. %s: %d.\n", __FILE__, __LINE__); |