def calculator(): # Obviously this calculator should be adapted return SJM( poissonsolver={'dipolelayer': 'xy'}, gpts=(48, 32, 168), kpts=(4, 6, 1), xc='PBE', spinpol=False, potential=potential, occupations=FermiDirac(0.1), maxiter=400, cavity=EffectivePotentialCavity( effective_potential=SJMPower12Potential(atomic_radii, u0, H2O_layer=True), temperature=T, surface_calculator=GradientSurface()), dielectric=LinearDielectric(epsinf=epsinf), interactions=[SurfaceInteraction(surface_tension=gamma)], )
solvent.calc = calc solvent.get_potential_energy() #converge WFs with PBE calc.set(xc=beef) solvent.calc = calc E_sv = solvent.get_potential_energy() #BEEF best fit energy ense = BEEFEnsemble(calc) dE_sv = ense.get_ensemble_energies( ) #N=2000 non-self-consist calculation to generate uncertainty spread #Perform solvent-only (solvated phase) calculation scalc = SolvationGPAW(xc=xc, gpts=h2gpts(h, solvent.get_cell(), idiv=16), cavity=EffectivePotentialCavity( effective_potential=Power12Potential( atomic_radii, u0), temperature=T, surface_calculator=GradientSurface()), dielectric=LinearDielectric(epsinf=epsinf), interactions=[SurfaceInteraction(surface_tension=gamma)]) solvent.calc = scalc solvent.get_potential_energy() scalc.set(xc=beef) solvent.calc = scalc E_sv_sol = solvent.get_potential_energy() ense = BEEFEnsemble(scalc) dE_sv_sol = ense.get_ensemble_energies() ''' #Perform single-ion (gas phase) calculation ion = Atoms(sym)
T = 298.15 vdw_radii = vdw_radii.copy() vdw_radii[1] = 1.09 atomic_radii = lambda atoms: [vdw_radii[n] for n in atoms.numbers] convergence = { 'energy': 0.05 / 8., 'density': 10., 'eigenstates': 10., } atoms = Cluster(molecule('H2O')) atoms.minimal_box(vac, h) atoms.pbc = True with warnings.catch_warnings(): # ignore production code warning for ADM12PoissonSolver warnings.simplefilter("ignore") psolver = ADM12PoissonSolver(eps=1e-7) atoms.calc = SolvationGPAW( xc='LDA', h=h, convergence=convergence, cavity=EffectivePotentialCavity( effective_potential=Power12Potential(atomic_radii=atomic_radii, u0=u0), temperature=T ), dielectric=LinearDielectric(epsinf=epsinf), poissonsolver=psolver ) atoms.get_potential_energy() atoms.get_forces()
def print_results(atoms): parprint('E = %.3f eV' % (atoms.get_potential_energy(), )) parprint('V = %.3f Ang ** 3' % (atoms.calc.get_cavity_volume(), )) parprint('A = %.3f Ang ** 2' % (atoms.calc.get_cavity_surface(), )) parprint('Forces:') parprint(atoms.get_forces()) parprint('') # Cavity from 1 / r ** 12 effective potential atoms.calc = SolvationGPAW( xc=xc, h=h, cavity=EffectivePotentialCavity( effective_potential=Power12Potential(atomic_radii=atomic_radii, u0=u0), temperature=T, surface_calculator=GradientSurface(), volume_calculator=KB51Volume(compressibility=kappa_T, temperature=T)), dielectric=LinearDielectric(epsinf=epsinf), interactions=[ SurfaceInteraction(surface_tension=gamma), VolumeInteraction(pressure=p), LeakedDensityInteraction(voltage=V_leak) ]) print_results(atoms) # Cavity from electron density a la ADM12 atoms.calc = SolvationGPAW(xc=xc, h=h, poissonsolver=ADM12PoissonSolver(), cavity=ADM12SmoothStepCavity(