Ejemplo n.º 1
0
        [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,
                        iterations=1000,
                        kick_strength=[0.001, 0.000, 0.000],
                        dipole_moment_file='dm.dat')
# Spectrum
photoabsorption_spectrum('dm.dat', 'spec.dat', width=0.0)
Ejemplo n.º 2
0
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
energy = qsfdtd.ground_state('gs.gpw', eigensolver = 'cg', nbands = -1)
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')

# Test
ref_cl_dipole_moment = [ -5.16149623e-14, -5.89090408e-14,  3.08450150e-02]
ref_qm_dipole_moment = [ -2.63340461e-11,  2.61812794e-12, -9.35619772e-02]
tol = 0.0001
equal(qsfdtd.td_calc.hamiltonian.poisson.get_classical_dipole_moment(), ref_cl_dipole_moment, tol)
equal(qsfdtd.td_calc.hamiltonian.poisson.get_quantum_dipole_moment(), ref_qm_dipole_moment, tol)
                                    [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,
                        dipole_moment_file='dm.dat')

photoabsorption_spectrum('dm.dat', 'spec.1.dat', width=0.15)

Ejemplo n.º 4
0
                   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,
                   radius=2.9))
classical_material.add_component(
    PolarizableTetrahedron(
        permittivity=PermittivityPlus(data=[[0.80, 0.20, 25.0]]),
        corners=[[24.1, 16.1, 5.1], [30.1, 36.1, 6.1], [36.4, 27.6, 7.1],
                 [30.0, 25.0, 14.9]]))

# Wrap calculators
qsfdtd = QSFDTD(classical_material=classical_material,
                atoms=None,
                cells=(cell, 2.00),
                spacings=[1.60, 0.40],
                remove_moments=(1, 1))

# Run
energy = qsfdtd.ground_state('gs.gpw', eigensolver='cg', nbands=-1)
qsfdtd.time_propagation('gs.gpw',
                        kick_strength=[0.000, 0.000, 0.001],
                        time_step=10,
                        iterations=5,
                        dipole_moment_file='dmCl.dat')

# Restart and run
qsfdtd.write('td.gpw', mode='all')
qsfdtd.time_propagation('td.gpw',
                        kick_strength=None,
Ejemplo n.º 5
0
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},
                    experimental={'niter_fixdensity': 2})
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,
Ejemplo n.º 6
0
                                  [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,
                        dipole_moment_file='dm.dat')

photoabsorption_spectrum('dm.dat', 'spec.1.dat', width=0.15)

    [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, iterations=1000, kick_strength=[0.001, 0.000, 0.000], dipole_moment_file="dm.dat"
)
# Spectrum
photoabsorption_spectrum("dm.dat", "spec.dat", width=0.0)
Ejemplo n.º 8
0
        corners=[[20.0, 21.5, 10.0], [25.0, 33.5, 10.0]],
        round_corners=False,
        radius=2.9,
    )
)
classical_material.add_component(
    PolarizableTetrahedron(
        permittivity=PermittivityPlus(data=[[0.80, 0.20, 25.0]]),
        corners=[[24.1, 16.1, 5.1], [30.1, 36.1, 6.1], [36.4, 27.6, 7.1], [30.0, 25.0, 14.9]],
    )
)


# Wrap calculators
qsfdtd = QSFDTD(
    classical_material=classical_material, atoms=None, cells=(cell, 2.00), spacings=[1.60, 0.40], remove_moments=(1, 1)
)

# Run
energy = qsfdtd.ground_state("gs.gpw", eigensolver="cg", nbands=-1)
qsfdtd.time_propagation(
    "gs.gpw", kick_strength=[0.000, 0.000, 0.001], time_step=10, iterations=5, dipole_moment_file="dmCl.dat"
)

# Restart and run
qsfdtd.write("td.gpw", mode="all")
qsfdtd.time_propagation("td.gpw", kick_strength=None, time_step=10, iterations=5, dipole_moment_file="dmCl.dat")

# Test
ref_cl_dipole_moment = [-1.01218372e-04, -3.03603352e-05, 1.86063694e-01]
tol = 0.0001