#include "TestingMolecules.hpp" #include "UniformDielectric.hpp" #include "IEFSolver.hpp" #include "Symmetry.hpp" /*! \class IEFSolver * \test \b NH3GePol tests IEFSolver using ammonia and a GePol cavity */ 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
double totalASC = -charge * (permittivity - 1) / permittivity; /*! \class IEFSolver * \test \b pointChargeGePolC1 tests IEFSolver using a point charge with a GePol * cavity in C1 symmetry * We are forcing the usage of the buildAnisotropicMatrix method. * The results are compared with Gauss' theorem and the results from the * buildIsotropicMatrix method * 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();
#include <Eigen/Core> #include "GePolCavity.hpp" #include "Molecule.hpp" #include "PhysicalConstants.hpp" #include "Symmetry.hpp" #include "TestingMolecules.hpp" TEST_CASE("GePol cavity for the benzene molecule", "[gepol][gepol_C6H6]") { 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 */
Vacuum<AD_directional, CollocationIntegrator>(); bool symm = true; double charge = 8.0; double totalASC = - charge * (eps1 - 1) / eps1; /*! \class IEFSolver * \test \b pointChargeDiffuseGePol tests IEFSolver using a point charge with a GePol cavity and a spherical diffuse interface * The spherical diffuse interface is centered at the origin, while the point charge is away from the origin. */ WHEN("the spherical diffuse layer is centered at the origin and the charge is away from the origin") { Molecule point = dummy<0>(2.929075493, origin); double area = 1.0; double probeRadius = 0.0; double minRadius = 100.0; GePolCavity cavity = GePolCavity(point, area, probeRadius, minRadius); SphericalDiffuse<CollocationIntegrator, OneLayerTanh> gfOutside = SphericalDiffuse<CollocationIntegrator, OneLayerTanh>(eps1, eps2, width, center, Eigen::Vector3d::Zero(), 3); IEFSolver solver(symm); solver.buildSystemMatrix(cavity, gfInside, gfOutside); size_t size = cavity.size(); Eigen::VectorXd fake_mep = computeMEP(cavity.elements(), charge, origin); for (size_t i = 0; i < size; ++i) { INFO("fake_mep(" << i << ") = " << fake_mep(i)); } THEN("the apparent surface charge is") { Eigen::VectorXd fake_asc = Eigen::VectorXd::Zero(size); fake_asc = solver.computeCharge(fake_mep); double totalFakeASC = fake_asc.sum();
#include "Molecule.hpp" #include "Vacuum.hpp" #include "UniformDielectric.hpp" #include "CPCMSolver.hpp" #include "TestingMolecules.hpp" /*! \class CPCMSolver * \test \b C2H4GePolD2h tests CPCMSolver using C2H4 with a GePol cavity in D2h symmetry */ TEST_CASE("Test solver for the CPCM and the C2H4 molecule in D2h symmetry", "[cpcm][cpcm_symmetry][cpcm_gepol-C2H4_D2h]") { Molecule molec = C2H4(); double area = 0.2 / convertBohr2ToAngstrom2; double probeRadius = 1.385 / convertBohrToAngstrom; double minRadius = 100.0 / convertBohrToAngstrom; GePolCavity cavity = GePolCavity(molec, area, probeRadius, minRadius, "cpcm_d2h_noadd"); 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; double correction = 0.0; CPCMSolver solver(symm, correction); solver.buildSystemMatrix(cavity, gfInside, gfOutside); double Ccharge = 6.0; double Hcharge = 1.0; size_t size = cavity.size(); Eigen::VectorXd fake_mep = computeMEP(molec, cavity.elements());
using dielectric_profile::OneLayerErf; 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) {