139 if (this_proj -> modelgl -> custom_map != NULL)
img -> color_map[0] += 10;
140 if (fwrite (
img -> color_map,
sizeof(
int), 2,
fp) != 2)
return ERROR_RW;
141 if (this_proj -> modelgl -> custom_map != NULL)
143 img -> color_map[0] -= 10;
144 colormap * map = this_proj -> modelgl -> custom_map;
145 if (fwrite (& map -> points,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
146 if (fwrite (& map -> cmax,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
147 if (fwrite (& map -> cmin,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
148 if (fwrite (map -> positions,
sizeof(
float), map -> points,
fp) != map -> points)
return ERROR_RW;
149 if (fwrite (map -> values,
sizeof(
ColRGBA), map -> points,
fp) != map -> points)
return ERROR_RW;
150 for (i=0; i<this_proj -> steps; i++)
152 if (fwrite (map -> data[i],
sizeof(
float), this_proj -> natomes,
fp) != this_proj -> natomes)
return ERROR_RW;
158 if (fwrite (
img -> sphererad,
sizeof(
double), sid*2,
fp) != sid*2)
return ERROR_RW;
159 if (fwrite (
img -> pointrad,
sizeof(
double), sid*2,
fp) != sid*2)
return ERROR_RW;
160 if (fwrite (
img -> atomicrad,
sizeof(
double), sid*2,
fp) != sid*2)
return ERROR_RW;
162 for (i=0; i<sid*2; i++)
164 if (fwrite (
img -> bondrad[i],
sizeof(
double), 2*sid,
fp) != 2*sid)
return ERROR_RW;
165 if (fwrite (
img -> linerad[i],
sizeof(
double), 2*sid,
fp) != 2*sid)
return ERROR_RW;
167 if (fwrite (
img -> radall,
sizeof(
double), 2,
fp) != 2)
return ERROR_RW;
168 if (fwrite (&
img -> draw_clones,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
169 if (fwrite (
img -> labels_position,
sizeof(
int), 5,
fp) != 5)
return ERROR_RW;
170 if (fwrite (
img -> labels_render,
sizeof(
int), 5,
fp) != 5)
return ERROR_RW;
171 if (fwrite (
img -> labels_scale,
sizeof(
int), 5,
fp) != 5)
return ERROR_RW;
172 if (fwrite (
img -> labels_format,
sizeof(
int), 2,
fp) != 2)
return ERROR_RW;
175 if (fwrite (
img -> labels_shift[i],
sizeof(
double), 3,
fp) != 3)
return ERROR_RW;
176 if (
img -> labels_color[i] != NULL)
179 if (fwrite (&
val,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
200 if (fwrite (&
val,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
206 if (fwrite (&
img -> mtilt,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
207 if (fwrite (&
img -> mpattern,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
208 if (fwrite (&
img -> mfactor,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
209 if (fwrite (&
img -> mwidth,
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
210 if (fwrite (&
img -> m_is_pressed,
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
213 if (fwrite (
img -> box_axis,
sizeof(
int), 2,
fp) != 2)
return ERROR_RW;
214 if (fwrite (
img -> box_axis_rad,
sizeof(
double), 2,
fp) != 2)
return ERROR_RW;
215 if (fwrite (
img -> box_axis_line,
sizeof(
double), 2,
fp) != 2)
return ERROR_RW;
217 if (fwrite (
img -> extra_cell,
sizeof(
int), 3,
fp) != 3)
return ERROR_RW;
220 if (fwrite (&
img -> axispos,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
221 if (fwrite (&
img -> axis_length,
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
222 if (fwrite (
img -> axis_pos,
sizeof(
double), 3,
fp) != 3)
return ERROR_RW;
223 if (
img -> axis_color != NULL)
231 if (fwrite (&
val,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
239 if (fwrite (&
img -> axis_labels,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
245 if (fwrite (&
img -> p_depth,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
246 if (fwrite (&
img -> gnear,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
247 if (fwrite (&
img -> gfar,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
248 if (fwrite (&
img -> gleft,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
249 if (fwrite (&
img -> gright,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
250 if (fwrite (&
img -> gtop,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
251 if (fwrite (&
img -> gbottom,
sizeof(GLdouble), 1,
fp) != 1)
return ERROR_RW;
253 if (fwrite (&
img -> rotation_mode,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
255 if (fwrite (
img -> c_shift,
sizeof(GLdouble), 2,
fp) != 2)
return ERROR_RW;
256 if (fwrite (&
img -> style,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
257 if (fwrite (&
img -> quality,
sizeof(GLint), 1,
fp) != 1)
return ERROR_RW;
259 if (fwrite (&
img -> lights,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
260 for (i=0; i<
img -> lights; i++)
262 if (fwrite (&
img -> l_ght[i].type,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
263 if (fwrite (&
img -> l_ght[i].fix,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
264 if (fwrite (&
img -> l_ght[i].show,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
271 if (fwrite (&
img -> m_terial.predefine,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
273 if (fwrite (
img -> m_terial.param,
sizeof(GLfloat), 6,
fp) != 6)
return ERROR_RW;
274 if (fwrite (&
img -> f_g.mode,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
275 if (fwrite (&
img -> f_g.based,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
276 if (fwrite (&
img -> f_g.density,
sizeof(
float), 1,
fp) != 1)
return ERROR_RW;
277 if (fwrite (
img -> f_g.depth,
sizeof(
float), 2,
fp) != 2)
return ERROR_RW;
280 if (fwrite (&
img -> filled_type,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
287 for (j=0; j<sid; j++)
289 if (fwrite (
img -> spcolor[i][j],
sizeof(
ColRGBA), this_proj -> coord -> ntg[i][j],
fp) != this_proj -> coord -> ntg[i][j])
return ERROR_RW;
294 j = (this_proj -> modelgl -> adv_bonding[i-2] && this_proj -> coord -> totcoord[i]) ? this_proj -> coord -> totcoord[i] : 0;
295 if (fwrite (& j,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
298 if (fwrite (
img -> spcolor[i][0],
sizeof(
ColRGBA), this_proj -> coord -> totcoord[i],
fp) != this_proj -> coord -> totcoord[i])
return ERROR_RW;
302 if (fwrite (& this_proj -> modelgl -> rings,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
303 if (this_proj -> modelgl -> rings)
308 this_proj -> modelgl -> ring_max[i],
309 this_proj -> modelgl -> num_rings[i],
310 this_proj -> modelgl -> show_rpoly[i],
311 this_proj -> modelgl -> all_rings[i]) !=
OK)
return ERROR_RINGS;
314 if (fwrite (& this_proj -> modelgl ->
chains,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
315 if (this_proj -> modelgl ->
chains)
318 this_proj -> modelgl -> chain_max,
319 this_proj -> modelgl -> num_chains,
323 if (this_proj -> modelgl ->
volumes)
326 if (fwrite (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
329 if (fwrite (this_proj -> modelgl -> atoms_volume[i],
sizeof(
double), this_proj -> steps,
fp) != this_proj -> steps)
return ERROR_RW;
330 if (fwrite (this_proj -> modelgl -> atoms_ppvolume[i],
sizeof(
double), this_proj -> steps,
fp) != this_proj -> steps)
return ERROR_RW;
331 for (j=0; j<this_proj -> steps; j++)
333 if (fwrite (this_proj -> modelgl -> volume_box[i][j],
sizeof(
double), 9,
fp) != 9)
return ERROR_RW;
339 if (this_proj -> modelgl -> adv_bonding[0])
341 if (fwrite (& this_proj -> coord -> totcoord[2],
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
345 for (k=0; k<this_proj -> steps; k++)
347 for (l=0; l<this_proj -> coord -> totcoord[2]; l++)
349 if (this_proj -> modelgl -> fm_comp_vol[0][i][k][l]) j++;
352 if (fwrite (& j,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
355 for (k=0; k<this_proj -> steps; k++)
357 for (l=0; l<this_proj -> coord -> totcoord[2]; l++)
359 if (this_proj -> modelgl -> fm_comp_vol[0][i][k][l])
361 if (fwrite (& k,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
362 if (fwrite (& l,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
363 if (fwrite (& this_proj -> modelgl -> frag_mol_ppvolume[0][i][k][l],
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
364 if (fwrite (this_proj -> modelgl -> frag_box[i][k][l],
sizeof(
double), 9,
fp) != 9)
return ERROR_RW;
368 if (fwrite (
img -> fm_show_vol[0][i],
sizeof(gboolean), this_proj -> coord -> totcoord[2],
fp) != this_proj -> coord -> totcoord[2])
return ERROR_RW;
369 if (fwrite (
img -> fm_vol_col[0][i],
sizeof(
ColRGBA), this_proj -> coord -> totcoord[2],
fp) != this_proj -> coord -> totcoord[2])
return ERROR_RW;
372 if (this_proj -> modelgl -> adv_bonding[1])
374 if (fwrite (& this_proj -> coord -> totcoord[3],
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
378 for (k=0; k<this_proj -> steps; k++)
380 for (l=0; l<this_proj -> coord -> totcoord[3]; l++)
382 if (this_proj -> modelgl -> fm_comp_vol[1][i][k][l]) j++;
385 if (fwrite (& j,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
388 for (k=0; k<this_proj -> steps; k++)
390 for (l=0; l<this_proj -> coord -> totcoord[3]; l++)
392 if (this_proj -> modelgl -> fm_comp_vol[1][i][k][l])
394 if (fwrite (& k,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
395 if (fwrite (& l,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
396 if (fwrite (& this_proj -> modelgl -> frag_mol_ppvolume[1][i][k][l],
sizeof(
double), 1,
fp) != 1)
return ERROR_RW;
400 if (fwrite (
img -> fm_show_vol[1][i],
sizeof(gboolean), this_proj -> coord -> totcoord[3],
fp) != this_proj -> coord -> totcoord[3])
return ERROR_RW;
401 if (fwrite (
img -> fm_vol_col[1][i],
sizeof(
ColRGBA), this_proj -> coord -> totcoord[3],
fp) != this_proj -> coord -> totcoord[3])
return ERROR_RW;
408 if (fwrite (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
414 if (fwrite (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
420 if (fwrite (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
423 for (i=0; i<this_proj -> steps; i++)
425 for (j=0; j< this_proj -> natomes; j++)
434 if (fwrite (&
img -> selected[i] -> selected,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
435 if (
img -> selected[i] -> selected)
438 for (j=0; j<
img -> selected[i] -> selected; j++)
440 if (fwrite (& at ->
id,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
441 if (at -> next) at = at -> next;
443 if (
img -> selected[i] -> selected >= 2 &&
img -> selected[i] -> selected <= 20)
446 if (fwrite (
img -> selected[i] -> selected_bonds,
sizeof(
int), j,
fp) != j)
return ERROR_RW;
447 if (
img -> selected[i] -> selected >= 3)
450 if (fwrite (
img -> selected[i] -> selected_angles,
sizeof(
int), j,
fp) != j)
return ERROR_RW;
451 if (
img -> selected[i] -> selected >= 4 &&
img -> selected[i] -> selected <= 10)
454 if (fwrite (
img -> selected[i] -> selected_dihedrals,
sizeof(
int), j,
fp) != j)
return ERROR_RW;