Exemple #1
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)
atoms, qm_spacing, gpts = poissonsolver.cut_cell(atoms, vacuum=2.50)
Exemple #2
0
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]]

# 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',
Exemple #3
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(
Exemple #4
0
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},
Exemple #5
0
# Permittivity of Gold
# J. Chem. Phys. 135, 084121 (2011); http://dx.doi.org/10.1063/1.3626549
eps_gold = 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]])

# 1) Nanosphere only
classical_material = PolarizableMaterial()
classical_material.add_component(PolarizableSphere(center=sphere_center,
                                                   radius=radius,
                                                   permittivity=eps_gold))

qsfdtd = QSFDTD(classical_material=classical_material,
                atoms=None,
                cells=simulation_cell,
                spacings=[2.0, 0.5],
                remove_moments=(1, 1))

energy = qsfdtd.ground_state('gs.gpw',
                             nbands=1)

qsfdtd.time_propagation('gs.gpw',
                        kick_strength=[0.001, 0.000, 0.000],
                        time_step=10,
                        iterations=1500,
Exemple #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, convergence={'energy': energy_eps})
equal(qsfdtd.energy, -0.631881, energy_eps * qsfdtd.gs_calc.get_number_of_electrons())
qsfdtd.time_propagation('gs.gpw', kick_strength=[0.000, 0.000, 0.001], time_step=10, iterations=5, dipole_moment_file='dm.dat', restart_file='td.gpw')
qsfdtd.time_propagation('td.gpw', kick_strength=None, time_step=10, iterations=5, dipole_moment_file='dm.dat')
Exemple #7
0
atoms = Atoms('Na2',
              atom_center + np.array([[-1.5, 0.0, 0.0], [1.5, 0.0, 0.0]]))

# Permittivity of Gold
# J. Chem. Phys. 135, 084121 (2011); http://dx.doi.org/10.1063/1.3626549
eps_gold = 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]])

# 3) Nanosphere + Na2
classical_material = PolarizableMaterial()
classical_material.add_component(
    PolarizableSphere(center=sphere_center,
                      radius=radius,
                      permittivity=eps_gold))

# Combined Poisson solver
poissonsolver = FDTDPoissonSolver(classical_material=classical_material,
                                  qm_spacing=0.5,
                                  cl_spacing=2.0,
                                  cell=simulation_cell,
                                  communicator=world,
                                  remove_moments=(1, 1))
poissonsolver.set_calculation_mode('iterate')

# Combined system
atoms.set_cell(simulation_cell)
atoms, qm_spacing, gpts = poissonsolver.cut_cell(atoms, vacuum=4.0)