Esempio n. 1
0
        [0.4411, 0.1480, -12.55],
        [0.7603, 1.946, -40.89],
        [1.161, 1.396, 17.22],
        [2.946, 1.183, 15.76],
        [4.161, 1.964, 36.63],
        [5.747, 1.958, 22.55],
        [7.912, 1.361, 81.04]]

# Initialize classical material
classical_material = PolarizableMaterial()

# Classical nanosphere
classical_material.add_component(
    PolarizableSphere(center=0.5 * large_cell,
                      radius=radius,
                      permittivity=PermittivityPlus(data=gold)))

# Quasistatic FDTD
qsfdtd = QSFDTD(classical_material=classical_material,
                atoms=None,
                cells=large_cell,
                spacings=[8.0, 1.0],
                communicator=world,
                remove_moments=(4, 1))

# Run ground state
energy = qsfdtd.ground_state('gs.gpw', nbands=-1)

# Run time evolution
qsfdtd.time_propagation('gs.gpw',
                        time_step=10,
Esempio n. 2
0
File: ed.py Progetto: thonmaker/gpaw
atom_center = np.array([10.0, 10.0, 20.0])
atoms = Atoms(
    'Na2', [atom_center + [0.0, 0.0, -1.50], atom_center + [0.0, 0.0, +1.50]])

# Permittivity file
if world.rank == 0:
    fo = open('ed.txt', 'w')
    fo.writelines(['1.20 0.20 25.0'])
    fo.close()
world.barrier()

# Classical subsystem
classical_material = PolarizableMaterial()
sphere_center = np.array([10.0, 10.0, 10.0])
classical_material.add_component(
    PolarizableSphere(permittivity=PermittivityPlus('ed.txt'),
                      center=sphere_center,
                      radius=5.0))

# Combined Poisson solver
poissonsolver = FDTDPoissonSolver(classical_material=classical_material,
                                  qm_spacing=0.40,
                                  cl_spacing=0.40 * 4,
                                  cell=large_cell,
                                  remove_moments=(1, 4),
                                  communicator=world,
                                  potential_coupler='Refiner')
poissonsolver.set_calculation_mode('iterate')

# Combined system
atoms.set_cell(large_cell)
Esempio n. 3
0
import pylab as plt
from ase.units import Hartree, Bohr
from gpaw.fdtd.polarizable_material import PermittivityPlus, _eps0_au

# Nanosphere radius (Angstroms)
radius = 50.0

# Permittivity of Gold
# J. Chem. Phys. 135, 084121 (2011); http://dx.doi.org/10.1063/1.3626549
gold = [[0.2350, 0.1551, 95.62], [0.4411, 0.1480, -12.55],
        [0.7603, 1.946, -40.89], [1.161, 1.396, 17.22], [2.946, 1.183, 15.76],
        [4.161, 1.964, 36.63], [5.747, 1.958, 22.55], [7.912, 1.361, 81.04]]

# Plot calculated spectrum and compare with Mie theory
spec = np.loadtxt('spec.dat')
perm = PermittivityPlus(data=gold).value(spec[:, 0] / Hartree)
plt.figure()
plt.plot(spec[:, 0], spec[:, 1], 'r', label='QSFDTD')
plt.plot(spec[:, 0],
         3. * (4. / 3. * np.pi * (radius / Bohr)**3) * (spec[:, 0] / Hartree) /
         (2. * np.pi**2) / Hartree * np.imag(
             (perm - _eps0_au) / (perm + 2. * _eps0_au)),
         'b',
         label='Mie theory')
plt.legend(loc=2)
plt.xlabel('Energy [eV]', fontsize=12)
plt.ylabel('Dipole strength [1/eV]', fontsize=12)
plt.xlim((0, 5.0))
plt.ylim((-1, 3500))
plt.savefig('qsfdtd_vs_mie.png')
Esempio n. 4
0
    plt.subplot(1, 2, 2)
    plt.plot(energy_j, eps_j.imag, 'bv')
    plt.plot(energy_e, fiteps_e.imag, 'b-')
    plt.xlim(energy_e.min(), energy_e.max())
    # plt.ylim(fiteps_e.imag.min(), fiteps_e.imag.max())
    plt.ylim(0, 7)
    plt.xlabel('Energy (eV)')
    plt.ylabel('Imaginary($\epsilon$)')
    plt.tight_layout()
    plt.savefig('%s.png' % fname)

# Permittivity of Gold
# Source:
# http://refractiveindex.info/?shelf=main&book=Au&page=Johnson
# Direct download link:
# wget http://refractiveindex.info/database/main/Au/Johnson.yml -O Au.yml
ymlfname = 'Au.yml'

# Fit to the permittivity
# J. Chem. Phys. 135, 084121 (2011); http://dx.doi.org/10.1063/1.3626549
fiteps = PermittivityPlus(data=[[0.2350, 0.1551, 95.62],
                                [0.4411, 0.1480, -12.55],
                                [0.7603, 1.946, -40.89],
                                [1.161, 1.396, 17.22],
                                [2.946, 1.183, 15.76],
                                [4.161, 1.964, 36.63],
                                [5.747, 1.958, 22.55],
                                [7.912, 1.361, 81.04]])
plot(ymlfname, fiteps)
Esempio n. 5
0
from gpaw.fdtd.poisson_fdtd import QSFDTD
from gpaw.fdtd.polarizable_material import PermittivityPlus, PolarizableMaterial, \
    PolarizableSphere, PolarizableBox, \
    PolarizableEllipsoid, PolarizableRod, \
    PolarizableTetrahedron
from gpaw.test import equal

# Whole simulation cell (Angstroms)
cell = [40, 40, 20]

# Classical subsystem
classical_material = PolarizableMaterial()
classical_material.add_component(
    PolarizableSphere(permittivity=PermittivityPlus(data=[[1.20, 0.20, 25.0]]),
                      center=[10, 10, 10],
                      radius=4.5))
classical_material.add_component(
    PolarizableBox(permittivity=PermittivityPlus(data=[[1.40, 0.20, 25.0]]),
                   corner1=[18.1, 5.1, 5.1],
                   corner2=[22.9, 14.9, 14.9]))
classical_material.add_component(
    PolarizableEllipsoid(
        permittivity=PermittivityPlus(data=[[1.60, 0.20, 25.0]]),
        center=[30.0, 10.0, 10.0],
        radii=[3.9, 5.9, 4.9]))
classical_material.add_component(
    PolarizableRod(permittivity=PermittivityPlus(data=[[1.80, 0.20, 25.0]]),
                   corners=[[10.0, 21.5, 10.0], [10.0, 33.5, 10.0]],
                   round_corners=True,
                   radius=3.9))
classical_material.add_component(
Esempio n. 6
0
# Accuracy
energy_eps = 0.0005

# Whole simulation cell (Angstroms)
cell = [20, 20, 30]

# Quantum subsystem
atom_center = np.array([10.0, 10.0, 20.0])
atoms = Atoms(
    'Na2', [atom_center + [0.0, 0.0, -1.50], atom_center + [0.0, 0.0, +1.50]])

# Classical subsystem
sphere_center = np.array([10.0, 10.0, 10.0])
classical_material = PolarizableMaterial()
classical_material.add_component(
    PolarizableSphere(permittivity=PermittivityPlus(data=[[1.20, 0.20, 25.0]]),
                      center=sphere_center,
                      radius=5.0))

# Wrap calculators
qsfdtd = QSFDTD(classical_material=classical_material,
                atoms=atoms,
                cells=(cell, 2.50),
                spacings=[1.60, 0.40],
                remove_moments=(1, 4),
                communicator=world)

# Run
qsfdtd.ground_state('gs.gpw',
                    eigensolver='cg',
                    nbands=-1,
Esempio n. 7
0
# Accuracy
energy_eps = 0.0005

# Whole simulation cell (Angstroms)
cell = [20, 20, 30];

# Quantum subsystem
atom_center = np.array([10.0, 10.0, 20.0])
atoms = Atoms('Na2', [atom_center + [0.0, 0.0, -1.50],
                      atom_center + [0.0, 0.0, +1.50]])

# Classical subsystem
sphere_center = np.array([10.0, 10.0, 10.0])
classical_material = PolarizableMaterial()
classical_material.add_component(PolarizableSphere(permittivity = PermittivityPlus(data = [[1.20, 0.20, 25.0]]),
                                                   center = sphere_center,
                                                   radius = 5.0
                                                   ))

# Wrap calculators
qsfdtd = QSFDTD(classical_material = classical_material,
                atoms              = atoms,
                cells              = (cell, 2.50),
                spacings           = [1.60, 0.40],
                remove_moments     = (1, 4),
                communicator       = world)

# Run
qsfdtd.ground_state('gs.gpw', eigensolver='cg', nbands=-1, convergence={'energy': energy_eps})
equal(qsfdtd.energy, -0.631881, energy_eps * qsfdtd.gs_calc.get_number_of_electrons())
Esempio n. 8
0
from gpaw.fdtd.poisson_fdtd import QSFDTD
from gpaw.fdtd.polarizable_material import PermittivityPlus, PolarizableMaterial, \
                                           PolarizableSphere, PolarizableBox, \
                                           PolarizableEllipsoid, PolarizableRod, \
                                           PolarizableTetrahedron
from gpaw.mpi import world
from gpaw.tddft import photoabsorption_spectrum, units
from gpaw.test import equal
import numpy as np

# Whole simulation cell (Angstroms)
cell = [40, 40, 20];

# Classical subsystem
classical_material = PolarizableMaterial()
classical_material.add_component(PolarizableSphere(permittivity = PermittivityPlus(data = [[1.20, 0.20, 25.0]]),
                                                   center = [10, 10, 10],
                                                   radius = 4.5))
classical_material.add_component(PolarizableBox(permittivity = PermittivityPlus(data = [[1.40, 0.20, 25.0]]),
                                                corner1 = [18.1, 5.1, 5.1],
                                                corner2 = [22.9, 14.9, 14.9]))
classical_material.add_component(PolarizableEllipsoid(permittivity = PermittivityPlus(data = [[1.60, 0.20, 25.0]]),
                                                center  = [30.0, 10.0, 10.0],
                                                radii   = [ 3.9, 5.9, 4.9]))
classical_material.add_component(PolarizableRod(permittivity = PermittivityPlus(data = [[1.80, 0.20, 25.0]]),
                                                corners = [[10.0, 21.5, 10.0], [10.0, 33.5, 10.0]],
                                                round_corners = True,
                                                radius = 3.9))
classical_material.add_component(PolarizableRod(permittivity = PermittivityPlus(data = [[1.00, 0.20, 25.0]]),
                                                corners = [[20.0, 21.5, 10.0], [25.0, 33.5, 10.0]],
                                                round_corners = False,