54 if (fread (& thermo ->
id,
sizeof(
int), 1,
fp) != 1)
return signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
55 if (fread (& thermo -> type,
sizeof(
int), 1,
fp) != 1)
return signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
56 if (fread (& thermo -> sys,
sizeof(
int), 1,
fp) != 1)
return signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
57 if (fread (& thermo -> show,
sizeof(gboolean), 1,
fp) != 1)
return signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
58 if (fread (thermo -> params,
sizeof(
double), 4,
fp) != 4)
return signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
59 if (fread (& thermo -> natoms,
sizeof(
int), 1,
fp) != 1)
return signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
74 if (fread (& cpmd_input -> fixat,
sizeof(
int), 1,
fp) != 1)
return signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
75 if (cpmd_input -> fixat)
80 cpmd_input -> fixlist =
allocint (cpmd_input -> fixat);
81 if (fread (cpmd_input -> fixlist,
sizeof(
int), cpmd_input -> fixat,
fp) != cpmd_input -> fixat)
return signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
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 signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
105 if (fread (& cp2k_input -> fixat[idf],
sizeof(
int), 1,
fp) != 1)
return signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
106 if (cp2k_input -> fixat[idf])
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 signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
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 signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
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 signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
142 if (fread (& this_proj -> cpmd_input[cid] -> thermostats,
sizeof(
int), 1,
fp) != 1)
return signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
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++)
154 if (i < this_proj -> cpmd_input[cid] -> thermostats - 1)
156 thermo -> next = g_malloc0(
sizeof*thermo -> next);
157 thermo -> next -> prev = thermo;
158 thermo = thermo -> next;
164 this_proj -> cpmd_input[cid] -> elec_thermostat = g_malloc0(
sizeof*this_proj -> cpmd_input[cid] -> elec_thermostat);
165 if (
read_thermo (
fp, this_proj -> cpmd_input[cid] -> elec_thermostat) !=
OK)
177 if (fread (& this_proj -> cpmd_input[cid] -> dummies,
sizeof(
int), 1,
fp) != 1)
return signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
178 if (this_proj -> cpmd_input[cid] -> dummies)
180 this_proj -> cpmd_input[cid] ->
dummy = g_malloc0(
sizeof*this_proj -> cpmd_input[cid] ->
dummy);
182 for (i=0; i < this_proj -> cpmd_input[cid] -> dummies; i ++)
195 if (i < this_proj -> cpmd_input[cid] -> dummies - 1)
197 dummy -> next = g_malloc0(
sizeof*
dummy -> next);
203 this_proj -> cpmd_input[cid] -> pp =
allocdint (this_proj -> nspec, 2);
204 for (i=0; i<this_proj -> nspec; i++)
206 if (fread (this_proj -> cpmd_input[cid] -> pp[i],
sizeof(
int), 2,
fp) != 2)
return signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
212 if (this_proj -> cpmd_input[cid] -> info == NULL)
return signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
230 this_proj -> cp2k_input[cid] = g_malloc0(
sizeof*this_proj -> cp2k_input[cid]);
231 if (fread (& this_proj -> cp2k_input[cid] -> input_type,
sizeof(
int), 1,
fp) != 1)
return signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
232 if (fread (this_proj -> cp2k_input[cid] -> opts,
sizeof(
double), 42,
fp) != 42)
return signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
235 if (fread (this_proj -> cp2k_input[cid] -> extra_opts[i],
sizeof(
double), 4,
fp) != 4)
return signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
237 if (fread (& this_proj -> cp2k_input[cid] -> thermostats,
sizeof(
int), 1,
fp) != 1)
return signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
238 if (this_proj -> cp2k_input[cid] -> thermostats)
240 this_proj -> cp2k_input[cid] -> ions_thermostat = g_malloc0(
sizeof*this_proj -> cp2k_input[cid] -> ions_thermostat);
241 thermostat * thermo = this_proj -> cp2k_input[cid] -> ions_thermostat;
242 for (i=0; i<this_proj -> cp2k_input[cid] -> thermostats; i++)
249 if (i < this_proj -> cp2k_input[cid] -> thermostats - 1)
251 thermo -> next = g_malloc0(
sizeof*thermo -> next);
252 thermo -> next -> prev = thermo;
253 thermo = thermo -> next;
265 this_proj -> cp2k_input[cid] -> spec_data =
allocdint (this_proj -> nspec, 2);
266 this_proj -> cp2k_input[cid] -> spec_files = g_malloc0(this_proj -> nspec*
sizeof*this_proj -> cp2k_input[cid] -> spec_files);
267 for (i=0; i<this_proj -> nspec; i++)
269 if (fread (this_proj -> cp2k_input[cid] -> spec_data[i],
sizeof(
int), 2,
fp) != 2)
return signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);
270 this_proj -> cp2k_input[cid] -> spec_files[i] = g_malloc0(2*
sizeof*this_proj -> cp2k_input[cid] -> spec_files[i]);
281 if (this_proj -> cp2k_input[cid] -> info == NULL)
return signal_error (__FILE__, __func__, __LINE__,
ERROR_QM);