Commit 7399abff authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Check for meningful fractional radii when creating ScattererConfiguration...

Check for meningful fractional radii when creating ScattererConfiguration instances and throw exceptions in case of errors
parent e57dc298
Loading
Loading
Loading
Loading
+20 −0
Original line number Original line Diff line number Diff line
@@ -414,6 +414,26 @@ ScattererConfiguration::ScattererConfiguration(
    }
    }
  }
  }
  _rcf = rcf_vector;
  _rcf = rcf_vector;
  for (int ci = 0; ci < _configurations; ci++) {
    int num_layers = _nshl_vec[ci];
    double last_rcf = -1.0;
    for (int cj = 0; cj < num_layers; cj++) {
      if (rcf_vector[ci][cj] < last_rcf) {
	string message = "ERROR: invalid radius in layer " + to_string(cj + 1) +
	  " for spheres of type " + to_string(ci + 1) + "!\n";
	throw(UnrecognizedConfigurationException(message));
      } else {
	last_rcf = rcf_vector[ci][cj];
      }
    }
    if (ci == 0 && _use_external_sphere) {
      if (rcf_vector[0][num_layers] < 1.0) {
	string message = "ERROR: invalid radius in layer " + to_string(num_layers + 1) +
	  " for sphere of type 1!\n";
	throw(UnrecognizedConfigurationException(message));
      }
    }
  }
  _idfc = dielectric_func_type;
  _idfc = dielectric_func_type;
  _dc0_matrix = dc_matrix;
  _dc0_matrix = dc_matrix;
  _exdc = ex;
  _exdc = ex;