void free_atomgrps (struct atomgrp** ress) { int resn = 0; while (ress[resn] != NULL) { free_atomgrp (ress[resn]); resn++; } free (ress); }
void replace_coordinates(struct atomgrp* ag, const char* pdb_path) { struct atomgrp* ag_new = read_pdb_nopar(pdb_path); if (ag_new->natoms != ag->natoms) { _mol_error("new atomgroup has %d atoms, old has %d atoms", ag_new->natoms, ag->natoms); exit(EXIT_FAILURE); } int list[ag->natoms]; for (int i=0; i<ag->natoms; i++) { list[i] = i; } setup_subag(ag, ag_new, ag->natoms, list); free_atomgrp(ag_new); }