74 if (fread (& cpmd_input -> fixat,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
75 if (cpmd_input -> fixat)
77 if (fread (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
80 cpmd_input -> fixlist =
allocint (cpmd_input -> fixat);
81 if (fread (cpmd_input -> fixlist,
sizeof(
int), cpmd_input -> fixat,
fp) != cpmd_input -> fixat)
return ERROR_RW;
83 if (fread (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
86 cpmd_input -> fixcoord =
allocdint (cpmd_input -> fixat, 3);
87 for (i=0; i<cpmd_input -> fixat; i++)
if (fread (cpmd_input -> fixcoord[i],
sizeof(
int), 3,
fp) != 3)
return ERROR_RW;
105 if (fread (& cp2k_input -> fixat[idf],
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
106 if (cp2k_input -> fixat[idf])
108 if (fread (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
111 cp2k_input -> fixlist[idf] =
allocint (cp2k_input -> fixat[idf]);
112 if (fread (cp2k_input -> fixlist[idf],
sizeof(
int), cp2k_input -> fixat[idf],
fp) != cp2k_input -> fixat[idf])
return ERROR_RW;
114 if (fread (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
117 cp2k_input -> fixcoord[idf] =
allocdint (cp2k_input -> fixat[idf], 3);
118 for (i=0; i<cp2k_input -> fixat[idf]; i++)
if (fread (cp2k_input -> fixcoord[idf][i],
sizeof(
int), 3,
fp) != 3)
return ERROR_RW;
136 if (fread (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
138 this_proj -> cpmd_input[cid] = g_malloc0 (
sizeof*this_proj -> cpmd_input[cid]);
139 if (fread (& this_proj -> cpmd_input[cid] -> calc_type,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
141 if (fread (this_proj -> cpmd_input[cid] ->
calc_opts,
sizeof(
double), 24,
fp) != 24)
return ERROR_RW;
142 if (fread (& this_proj -> cpmd_input[cid] -> thermostats,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
143 if (this_proj -> cpmd_input[cid] -> thermostats)
145 this_proj -> cpmd_input[cid] -> ions_thermostat = g_malloc0 (
sizeof*this_proj -> cpmd_input[cid] -> ions_thermostat);
146 thermostat * thermo = this_proj -> cpmd_input[cid] -> ions_thermostat;
147 for (i=0; i<this_proj -> cpmd_input[cid] -> thermostats; i++)
150 if (i < this_proj -> cpmd_input[cid] -> thermostats - 1)
152 thermo -> next = g_malloc0 (
sizeof*thermo -> next);
153 thermo -> next -> prev = thermo;
154 thermo = thermo -> next;
157 if (fread (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
160 this_proj -> cpmd_input[cid] -> elec_thermostat = g_malloc0 (
sizeof*this_proj -> cpmd_input[cid] -> elec_thermostat);
168 if (fread (& this_proj -> cpmd_input[cid] -> dummies,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
169 if (this_proj -> cpmd_input[cid] -> dummies)
171 this_proj -> cpmd_input[cid] ->
dummy = g_malloc0 (
sizeof*this_proj -> cpmd_input[cid] ->
dummy);
173 for (i=0; i < this_proj -> cpmd_input[cid] -> dummies; i ++)
177 if (fread (&
dummy -> show,
sizeof(gboolean), 1,
fp) != 1)
return ERROR_RW;
180 if (fread (&
dummy -> natoms,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
186 if (i < this_proj -> cpmd_input[cid] -> dummies - 1)
188 dummy -> next = g_malloc0 (
sizeof*
dummy -> next);
194 this_proj -> cpmd_input[cid] -> pp =
allocdint (this_proj -> nspec, 2);
195 for (i=0; i<this_proj -> nspec; i++)
197 if (fread (this_proj -> cpmd_input[cid] -> pp[i],
sizeof(
int), 2,
fp) != 2)
return ERROR_RW;
203 if (this_proj -> cpmd_input[cid] -> info == NULL)
return ERROR_RW;
219 if (fread (& i,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
221 this_proj -> cp2k_input[cid] = g_malloc0 (
sizeof*this_proj -> cp2k_input[cid]);
222 if (fread (& this_proj -> cp2k_input[cid] -> input_type,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
223 if (fread (this_proj -> cp2k_input[cid] -> opts,
sizeof(
double), 42,
fp) != 42)
return ERROR_RW;
226 if (fread (this_proj -> cp2k_input[cid] -> extra_opts[i],
sizeof(
double), 4,
fp) != 4)
return ERROR_RW;
228 if (fread (& this_proj -> cp2k_input[cid] -> thermostats,
sizeof(
int), 1,
fp) != 1)
return ERROR_RW;
229 if (this_proj -> cp2k_input[cid] -> thermostats)
231 this_proj -> cp2k_input[cid] -> ions_thermostat = g_malloc0 (
sizeof*this_proj -> cp2k_input[cid] -> ions_thermostat);
232 thermostat * thermo = this_proj -> cp2k_input[cid] -> ions_thermostat;
233 for (i=0; i<this_proj -> cp2k_input[cid] -> thermostats; i++)
236 if (i < this_proj -> cp2k_input[cid] -> thermostats - 1)
238 thermo -> next = g_malloc0 (
sizeof*thermo -> next);
239 thermo -> next -> prev = thermo;
240 thermo = thermo -> next;
251 this_proj -> cp2k_input[cid] -> spec_data =
allocdint (this_proj -> nspec, 2);
252 this_proj -> cp2k_input[cid] -> spec_files = g_malloc0 (this_proj -> nspec*
sizeof*this_proj -> cp2k_input[cid] -> spec_files);
253 for (i=0; i<this_proj -> nspec; i++)
255 if (fread (this_proj -> cp2k_input[cid] -> spec_data[i],
sizeof(
int), 2,
fp) != 2)
return ERROR_RW;
256 this_proj -> cp2k_input[cid] -> spec_files[i] = g_malloc0 (2*
sizeof*this_proj -> cp2k_input[cid] -> spec_files[i]);
267 if (this_proj -> cp2k_input[cid] -> info == NULL)
return ERROR_RW;