TEST_CASE("Test solver for the IEFPCM with NH3 molecule and a GePol cavity", "[solver][iefpcm][iefpcm_gepol-NH3]") { Molecule molec = NH3(); double area = 0.4; double probeRadius = 0.0; double minRadius = 100.0; GePolCavity cavity = GePolCavity(molec, area, probeRadius, minRadius); cavity.saveCavity("nh3.npz"); double permittivity = 78.39; Vacuum<AD_directional, CollocationIntegrator> gfInside = Vacuum<AD_directional, CollocationIntegrator>(); UniformDielectric<AD_directional, CollocationIntegrator> gfOutside = UniformDielectric<AD_directional, CollocationIntegrator>(permittivity); bool symm = true; IEFSolver solver(symm); solver.buildSystemMatrix(cavity, gfInside, gfOutside); double Ncharge = 7.0; double Hcharge = 1.0; size_t size = cavity.size(); Eigen::VectorXd fake_mep = computeMEP(molec, cavity.elements()); // The total ASC for a dielectric is -Q*(epsilon-1)/epsilon Eigen::VectorXd fake_asc = Eigen::VectorXd::Zero(size); fake_asc = solver.computeCharge(fake_mep); double totalASC = - (Ncharge + 3.0 * Hcharge) * (permittivity - 1) / permittivity; double totalFakeASC = fake_asc.sum(); CAPTURE(totalASC - totalFakeASC); REQUIRE(totalASC == Approx(totalFakeASC).epsilon(1.0e-03)); }
{ double area = 0.3 / convertBohr2ToAngstrom2; double probeRadius = 1.385 / convertBohrToAngstrom; // Addition of spheres is enabled, but will not happen in this particular case double minRadius = 10.0 / convertBohrToAngstrom; Molecule molec = C6H6(); GePolCavity cavity = GePolCavity(molec, area, probeRadius, minRadius, "c6h6"); cavity.saveCavity("c6h6.npz"); /*! \class GePolCavity * \test \b GePolCavityC6H6AddTest_size tests GePol cavity size for C6H6 in C1 symmetry with added spheres */ SECTION("Test size") { int size = 644; size_t actualSize = cavity.size(); REQUIRE(size == actualSize); } /*! \class GePolCavity * \test \b GePolCavityC6H6AddTest_area tests GePol cavity surface area for C6H6 in C1 symmetry with added spheres */ SECTION("Test surface area") { double area = 391.06094362589062; double actualArea = cavity.elementArea().sum(); REQUIRE(area == Approx(actualArea)); } /*! \class GePolCavity * \test \b GePolCavityC6H6AddTest_volume tests GePol cavity volume for C6H6 in C1 symmetry with added spheres
* The point charge is at the origin. */ WHEN("the point group is C1") { Molecule point = dummy<0>(2.929075493); double area = 0.4; double probeRadius = 0.0; double minRadius = 100.0; GePolCavity cavity(point, area, probeRadius, minRadius, "C1"); IEFSolver aniso_solver(symm); aniso_solver.buildAnisotropicMatrix(cavity, gf_i, gf_o, op); IEFSolver iso_solver(symm); iso_solver.buildIsotropicMatrix(cavity, gf_i, gf_o, op); int size = cavity.size(); Eigen::VectorXd fake_mep = computeMEP(cavity.elements(), charge); THEN("the total apparent surface charge is") { Eigen::VectorXd aniso_fake_asc = aniso_solver.computeCharge(fake_mep); Eigen::VectorXd iso_fake_asc = iso_solver.computeCharge(fake_mep); int nr_irrep = cavity.pointGroup().nrIrrep(); double totalAnisoASC = aniso_fake_asc.sum() * nr_irrep; double totalIsoASC = iso_fake_asc.sum() * nr_irrep; CAPTURE(totalASC); CAPTURE(totalAnisoASC); CAPTURE(totalASC - totalAnisoASC); REQUIRE(totalIsoASC == Approx(totalAnisoASC)); REQUIRE(totalASC == Approx(totalAnisoASC).epsilon(1.0e-03));
using dielectric_profile::OneLayerTanh; using green::SphericalDiffuse; using green::SphericalSharp; using green::UniformDielectric; using green::Vacuum; SCENARIO("A collocation integrator with approximate diagonal elements", "[bi_operators][bi_operators_collocation]") { GIVEN("A GePol cavity for a single sphere in the origin") { double radius = 1.44; Eigen::Vector3d offset; offset << 1.0, 2.0, 3.0; Molecule molec = dummy<0>(1.44 / bohrToAngstrom(), offset); double area = 10.0; GePolCavity cavity = GePolCavity(molec, area, 0.0, 100.0); Eigen::MatrixXd results = Eigen::MatrixXd::Zero(cavity.size(), cavity.size()); Eigen::MatrixXd reference = Eigen::MatrixXd::Zero(cavity.size(), cavity.size()); Collocation op; /*! \class Collocation * \test \b CollocationTest_vacuum tests the evaluation by collocation * of the vacuum matrix representations of S and D */ WHEN("the vacuum Green's function is used") { Vacuum<> gf; THEN("the matrix elements of S are") { results = op.computeS(cavity, gf); reference = cnpy::custom::npy_load<double>("vacuum_S_collocation.npy"); for (int i = 0; i < cavity.size(); ++i) { for (int j = 0; j < cavity.size(); ++j) { REQUIRE(reference(i, j) == Approx(results(i, j)));