Fix doc folder

parent 6ac6255b
Pipeline #98254553 passed with stage
in 3 minutes and 17 seconds
......@@ -17,7 +17,7 @@ class Box:
self.owns = []
self.position = None
def set_position(self, position):
self.position = np.asarray(position)
......@@ -46,7 +46,7 @@ class MPL:
def plot(self):
a4 = 100 * np.array([2**-1.75, 2**-2.25])
inch = 2.54
self.fig = plt.figure(1, a4 / inch)
self.ax = ax = self.fig.add_axes([0, 0, 1, 1], frameon=False)
ax.set_xlim(0, a4[0])
......@@ -84,7 +84,7 @@ class MPL:
bbox = b.text.get_window_extent()
t = b.text.get_transform()
b.size = t.inverted().transform(bbox.size)
for b in self.boxes:
for other, name, s, style in b.owns:
d = other.position - b.position
......@@ -116,6 +116,7 @@ def box(*args, **kwargs):
boxes.append(b)
return b
atoms = box('Atoms', [''], ['positions, numbers, cell, pbc'],
color='white')
paw = box('PAW', [], [], 'green')
......@@ -153,7 +154,10 @@ fd = box('FDWaveFunctions',
[], 'magenta')
pt = box('LFC', r'$\tilde{p}_i^a(\mathbf{r})$', [], 'red')
lcao = box('LCAOWaveFunctions',
r"$\tilde{\psi}_{\sigma\mathbf{k}n}(\mathbf{r})=\sum_{\mu\mathbf{R}} C_{\sigma\mathbf{k}n\mu} \Phi_\mu(\mathbf{r} - \mathbf{R}) \exp(i\mathbf{k}\cdot\mathbf{R})$",
r"$\tilde{\psi}_{\sigma\mathbf{k}n}(\mathbf{r})=" +
r"\sum_{\mu\mathbf{R}} " +
r"C_{\sigma\mathbf{k}n\mu} \Phi_\mu(\mathbf{r} - \mathbf{R}) " +
r"\exp(i\mathbf{k}\cdot\mathbf{R})$",
['S_qMM, T_qMM, P_aqMi'], 'magenta')
atoms0 = box('Atoms', '(copy)', ['positions, numbers, cell, pbc'],
color='grey')
......@@ -162,8 +166,9 @@ forces = box('ForceCalculator')
occupations = box(
'OccupationNumbers',
r'$\epsilon_{\sigma\mathbf{k}n} \rightarrow f_{\sigma\mathbf{k}n}$')
poisson = box('PoissonSolver',
r'$\nabla^2 \tilde{v}_H(\mathbf{r}) = -4\pi \tilde{\rho}(\mathbf{r})$')
poisson = box(
'PoissonSolver',
r'$\nabla^2 \tilde{v}_H(\mathbf{r}) = -4\pi \tilde{\rho}(\mathbf{r})$')
eigensolver = box('EigenSolver')
symmetry = box('Symmetry')
restrictor = box('Transformer', '(fine -> coarse)',
......@@ -175,7 +180,7 @@ kin = box('FDOperator', r'$-\frac{1}{2}\nabla^2$')
hsoperator = box('HSOperator',
[r"$\langle \psi_n | A | \psi_{n'} \rangle$",
r"$\sum_{n'}U_{nn'}|\tilde{\psi}_{n'}\rangle$"])
overlap = box('Overlap')
basisfunctions = box('BasisFunctions', r'$\Phi_\mu(\mathbf{r})$',
color='red')
......
......@@ -6,6 +6,7 @@ machine = os.environ.get('MACHINE', 'TEST')
ncores = os.environ.get('NCORES', 8)
if rank == 0:
os.chdir(machine)
os.system('python ../memory_bandwidth.py --runs=5 --startcores='+str(ncores))
#os.system('python ../memory_bandwidth.py --runs=5') # full memory benchmark
shutil.copy('memory_bandwidth_'+machine+'_py.png', '..')
os.system(
'python ../memory_bandwidth.py --runs=5 --startcores=' +
str(ncores))
shutil.copy('memory_bandwidth_' + machine + '_py.png', '..')
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import Numeric as num
from gpaw import GPAW
from gpaw.spherical_harmonics import Y
......@@ -60,10 +59,12 @@ for n in paw.nuclei:
p.plot(X + x, num.dot(P_i, phi_i), C + '-', lw=2,
label=r'$\psi^%s$' % s.symbol)
C = 'r'
p.plot([-d / 2], [0], 'go', ms=2*0.8*4*80/a*1.0*0.53, mfc=None, label='_nolegend_')
p.plot([d / 2], [0], 'ro', ms=2*0.8*4*80/a*1.2*0.53, mfc=None, label='_nolegend_')
p.plot([-d / 2], [0], 'go', ms=2*0.8*4*80/a*1.0*0.53, mfc=None,
label='_nolegend_')
p.plot([d / 2], [0], 'ro', ms=2*0.8*4*80/a*1.2*0.53, mfc=None,
label='_nolegend_')
p.legend(loc='best')
p.xlabel(u'x [Å]')
p.ylabel(r'$\psi$')
#p.show()
# p.show()
p.savefig('co_wavefunctions.png', dpi=dpi)
# Creates: cl_field.ind_Ffe.png, qm_field.ind_Ffe.png, tot_field.ind_Ffe.png
# -*- coding: utf-8 -*-
from gpaw.mpi import world
assert world.size == 1, 'This script should be run in serial mode (with one process).'
import numpy as np
import matplotlib.pyplot as plt
......@@ -9,6 +8,8 @@ import matplotlib.pyplot as plt
from gpaw.inducedfield.inducedfield_base import BaseInducedField
from gpaw.tddft.units import aufrequency_to_eV
assert world.size == 1, 'This script should be run in serial mode.'
# Helper function
def do_plot(d_g, ng, box, atoms):
......@@ -38,6 +39,7 @@ def do_plot(d_g, ng, box, atoms):
plt.ylim([y[0], y[-1]])
ax.set_aspect('equal')
for fname, name in zip(['cl_field.ind', 'qm_field.ind', 'tot_field.ind'],
['Classical subsystem', 'Quantum subsystem',
'Total hybrid system']):
......
# Creates: field.ind_Ffe.png
# -*- coding: utf-8 -*-
from gpaw.mpi import world
assert world.size == 1, 'This script should be run in serial mode (with one process).'
import numpy as np
import matplotlib.pyplot as plt
......@@ -9,6 +8,8 @@ import matplotlib.pyplot as plt
from gpaw.inducedfield.inducedfield_base import BaseInducedField
from gpaw.tddft.units import aufrequency_to_eV
assert world.size == 1, 'This script should be run in serial mode.'
# Helper function
def do_plot(d_g, ng, box, atoms):
......@@ -38,6 +39,7 @@ def do_plot(d_g, ng, box, atoms):
plt.ylim([y[0], y[-1]])
ax.set_aspect('equal')
for fname, name in zip(['field.ind'], ['Classical system']):
# Read InducedField object
ind = BaseInducedField(fname, readmode='all')
......
......@@ -48,4 +48,6 @@ f2 = lr.lr_transitions.get_transition_contributions(0)
for (ip, val) in enumerate(f2):
if (val > 1e-3):
parprint(' %5d => %5d %lf %%\n ' %
(lr.ks_singles.kss_list[ip].occ_ind, lr.ks_singles.kss_list[ip].unocc_ind, val / 2. * 100))
(lr.ks_singles.kss_list[ip].occ_ind,
lr.ks_singles.kss_list[ip].unocc_ind,
val / 2. * 100))
......@@ -7,7 +7,9 @@ manually instead of using gpawtransport, which currently does not work
from ase import Atoms
from gpaw import GPAW, Mixer, FermiDirac
from gpaw.lcao.tools import remove_pbc, get_lcao_hamiltonian, get_lead_lcao_hamiltonian
from gpaw.lcao.tools import (remove_pbc,
get_lcao_hamiltonian,
get_lead_lcao_hamiltonian)
import pickle as pickle
a = 2.41 # Pt binding length
......@@ -48,7 +50,7 @@ H -= Ef * S
remove_pbc(atoms, H, S, 0)
# Dump the Hamiltonian and Scattering matrix to a pickle file
pickle.dump((H.astype(complex), S.astype(complex)),
pickle.dump((H.astype(complex), S.astype(complex)),
open('scat_hs.pickle', 'wb'), 2)
########################
......
......@@ -6,7 +6,8 @@ Lattice="4.12605070262 0.0 0.0 -2.06302535131 3.57326472577 0.0 0.0 0.0 18.13127
V 0.00000000 -0.00000000 9.06563772 1.00000000 23 0.00000000 0.00000000 0.00000003 2.63358805 -0.00000000
I 2.06302535 1.19108824 10.63303664 0.10000000 53 0.00000000 0.00000000 0.00792029 -0.03990743 0.00000000
I -0.00000000 2.38217648 7.49823879 0.10000000 53 -0.00000000 0.00000000 -0.00792046 -0.03990743 -0.00000000
""")
""") # noqa
Path('CrI3.xyz').write_text("""\
8
Lattice="7.00794410138 5.69308307302e-19 0.0 -3.50397205069 6.0690576201 0.0 -7.55612427101e-19 0.0 18.0635365764" Properties=species:S:1:pos:R:3:initial_magmoms:R:1:Z:I:1:forces:R:3:magmoms:R:1 energy=-31.3985425600531 dipole="-0.00239032749259 0.00138005621976 3.42821467339e-07" free_energy=-31.3985446012773 pbc="T T F" magmom=6.00000000876689 stress="-6.01056204961e-05 0.0 -6.48091502334e-21 0.0 -6.01056204961e-05 -2.59236600933e-20 -6.48091502334e-21 -2.59236600933e-20 6.05488486747e-05"
......@@ -18,4 +19,4 @@ I -2.24281648 3.88469895 7.46488009 1.00000000 53
I 2.52228800 -0.00001162 10.59865633 1.00000000 53 -0.00469075 0.00014771 0.00214167 -0.05825936
I 2.24281799 3.88469794 10.59865633 1.00000000 53 0.00247329 0.00398846 0.00214167 -0.05825936
I -1.26113394 2.18437130 10.59865633 1.00000000 53 0.00221746 -0.00413616 0.00214167 -0.05825936
""")
""") # noqa
......@@ -7,12 +7,13 @@ from gpaw.solvation import (
SolvationGPAW, # the solvation calculator
EffectivePotentialCavity, # cavity using an effective potential
Power12Potential, # a specific effective potential
LinearDielectric, # rule to construct permittivity function from the cavity
GradientSurface, # rule to calculate the surface area from the cavity
SurfaceInteraction # rule to calculate non-electrostatic interactions
LinearDielectric, # rule to construct permittivity func from the cavity
GradientSurface, # rule to calculate the surface area from the cavity
SurfaceInteraction # rule to calculate non-electrostatic interactions
)
# all parameters on the user side of the solvation API follow the ASE unit conventions (eV, Angstrom, ...)
# all parameters on the user side of the solvation API follow the ASE
# unit conventions (eV, Angstrom, ...)
# non-solvent related DFT parameters
h = 0.2
......@@ -21,14 +22,20 @@ vac = 5.0
# solvent parameters for water from J. Chem. Phys. 141, 174108 (2014)
u0 = 0.180 # eV
epsinf = 78.36 # dimensionless
gamma = 18.4 * 1e-3 * Pascal * m # convert from dyne / cm to eV / Angstrom ** 2
gamma = 18.4 * 1e-3 * Pascal * m # convert from dyne / cm to eV / Angstrom**2
T = 298.15 # Kelvin
vdw_radii = vdw_radii.copy()
vdw_radii[1] = 1.09
# atomic_radii expected by gpaw.solvation.Power12Potential have to be a callable
# mapping an Atoms object to an iterable of floats representing the atomic radii of
# the atoms in the same order as in the Atoms object (in Angstrom)
atomic_radii = lambda atoms: [vdw_radii[n] for n in atoms.numbers]
# atomic_radii expected by gpaw.solvation.Power12Potential have to be a
# callable mapping an Atoms object to an iterable of floats representing
# the atomic radii of the atoms in the same order as in the Atoms object
# (in Angstrom)
def atomic_radii(atoms):
return [vdw_radii[n] for n in atoms.numbers]
# create Atoms object for ethanol and add vacuum
atoms = molecule('CH3CH2OH')
......@@ -38,7 +45,8 @@ atoms.center(vacuum=vac)
atoms.calc = GPAW(xc='PBE', h=h, txt='gasphase.txt')
Egasphase = atoms.get_potential_energy()
# perform calculation with continuum solvent model from J. Chem. Phys. 141, 174108 (2014)
# perform calculation with continuum solvent model from
# J. Chem. Phys. 141, 174108 (2014)
atoms.calc = SolvationGPAW(
xc='PBE', h=h, txt='water.txt',
cavity=EffectivePotentialCavity(
......
......@@ -3,14 +3,17 @@ from gpaw import GPAW
from gpaw.response.df import DielectricFunction
# Part 1: Ground state calculation
atoms = bulk('Si', 'diamond', a=5.431) # Generate diamond crystal structure for silicon
calc = GPAW(mode='pw', kpts=(4,4,4)) # GPAW calculator initialization
atoms = bulk('Si', 'diamond', a=5.431)
calc = GPAW(mode='pw', kpts=(4, 4, 4))
atoms.set_calculator(calc)
atoms.get_potential_energy() # Ground state calculation is performed
calc.write('si.gpw', 'all') # Use 'all' option to write wavefunction
atoms.get_potential_energy() # Ground state calculation is performed
calc.write('si.gpw', 'all') # Use 'all' option to write wavefunction
# Part 2 : Spectrum calculation # DF: dielectric function object
df = DielectricFunction(calc='si.gpw', # Ground state gpw file (with wavefunction) as input
# Part 2 : Spectrum calculation
# DF: dielectric function object
# Ground state gpw file (with wavefunction) as input
df = DielectricFunction(calc='si.gpw',
domega0=0.05) # Using nonlinear frequency grid
df.get_dielectric_function() # By default, a file called 'df.csv' is generated
# By default, a file called 'df.csv' is generated
df.get_dielectric_function()
......@@ -3,14 +3,16 @@ import numpy as np
import pickle
import matplotlib.pyplot as plt
result = pickle.load(open('BN_GW0_results.pckl','rb'))
result = pickle.load(open('BN_GW0_results.pckl', 'rb'))
nite = result['iqp'].shape[0]
gap = []
for i in range(nite):
gap = np.append(gap,np.min(result['iqp'][i,0,:,3])-np.max(result['iqp'][i,0,:,2]))
gap = np.append(gap,
np.min(result['iqp'][i, 0, :, 3]) -
np.max(result['iqp'][i, 0, :, 2]))
plt.figure()
plt.plot(range(nite),gap,'ko-')
plt.plot(range(nite), gap, 'ko-')
plt.ylabel('Band gap (eV)')
plt.xlabel('Iteration')
plt.savefig('BN_GW0.png')
......
# Creates: gaps.csv
from __future__ import print_function
from ase.io import read
......@@ -9,6 +8,7 @@ for name in ['no_u', 'normalized_u', 'not_normalized_u']:
n = read(name + '.txt')
gap = n.calc.get_eigenvalues(spin=1)[1] - n.calc.get_eigenvalues(spin=0)[1]
gaps.append(gap)
print('%s, %.3f' % (name.replace('_', ' ').replace('u', 'U'), gap), file=fd)
print('%s, %.3f' % (name.replace('_', ' ').replace('u', 'U'), gap),
file=fd)
assert abs(gaps[1] - gaps[0] - 6.0) < 0.8
......@@ -5,7 +5,8 @@ from gpaw.xc.rpa import RPACorrelation
f = paropen('con_freq.dat', 'w')
for N in [4, 6, 8, 12, 16, 24, 32]:
rpa = RPACorrelation('N2.gpw', txt='rpa_N2_frequencies.txt', nfrequencies=N)
rpa = RPACorrelation('N2.gpw', txt='rpa_N2_frequencies.txt',
nfrequencies=N)
E = rpa.calculate(ecut=[50])
print(N, E[0], file=f)
if N == 16:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment