Exemple #1
0
/**
 * set all obligatory parameters for an FCS solver
 */
FCSResult fcs_set_common(FCS handle, fcs_int near_field_flag, const fcs_float *box_a, const fcs_float *box_b, const fcs_float *box_c, const fcs_float *box_origin, const fcs_int *periodicity, fcs_int total_particles)
{
  const char *fnc_name = "fcs_set_common";
  FCSResult result;

  CHECK_HANDLE_RETURN_RESULT(handle, fnc_name);

  result = fcs_set_near_field_flag(handle, near_field_flag);
  if (result != FCS_RESULT_SUCCESS) return result;

  result = fcs_set_box_a(handle, box_a);
  if (result != FCS_RESULT_SUCCESS) return result;

  result = fcs_set_box_b(handle, box_b);
  if (result != FCS_RESULT_SUCCESS) return result;

  result = fcs_set_box_c(handle, box_c);
  if (result != FCS_RESULT_SUCCESS) return result;

  result = fcs_set_box_origin(handle, box_origin);
  if (result != FCS_RESULT_SUCCESS) return result;

  result = fcs_set_periodicity(handle, periodicity);
  if (result != FCS_RESULT_SUCCESS) return result;

  result = fcs_set_total_particles(handle, total_particles);
  if (result != FCS_RESULT_SUCCESS) return result;

  return FCS_RESULT_SUCCESS;
}
Exemple #2
0
void calc_forces_fcs(int steps) {
  FCSResult result;
  fcs_float BoxX[3] = { box_x.x, box_x.y, box_x.z };
  fcs_float BoxY[3] = { box_y.x, box_y.y, box_y.z };
  fcs_float BoxZ[3] = { box_z.x, box_z.y, box_z.z };

#ifdef HOMDEF
  if ((lindef_int > 0) && (0 == steps % lindef_int)) {
    result = fcs_set_box_a(handle, BoxX);
    ASSERT_FCS(result);
    result = fcs_set_box_b(handle, BoxY);
    ASSERT_FCS(result);
    result = fcs_set_box_c(handle, BoxZ);
    ASSERT_FCS(result);
  }
#endif
  pack_fcs();
  /* dump_config_fcs( pos, chg, nloc, steps, myid ); */
  result = fcs_run(handle, nloc, nloc_max, pos, chg, field, pot);
  ASSERT_FCS(result);
  unpack_fcs();
}