Skip to content

Commit

Permalink
Merge updates to examples and documentation by E. Bosoni
Browse files Browse the repository at this point in the history
Updated the examples/ directory. Now it contains 14 informative
examples that are well referenced in the documentation and clear to
read and run.

The documentation for the Siesta plugin has been updated.
  • Loading branch information
albgar authored and Alberto committed Nov 18, 2019
2 parents f9a3a1a + b351049 commit b56d39c
Show file tree
Hide file tree
Showing 44 changed files with 974 additions and 13,865 deletions.
3 changes: 2 additions & 1 deletion aiida_siesta/docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ directory:
As a pre-requisite, this will install an appropriate version of the
aiida_core python framework.

.. important:: Next, do not forget to run the following command
.. important:: Next, do not forget to run the following commands

::

reentry scan -r aiida
verdi daemon restart

482 changes: 340 additions & 142 deletions aiida_siesta/docs/plugins/siesta.rst

Large diffs are not rendered by default.

Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function

import os.path as op
import sys
from aiida.tools import get_explicit_kpoints_path

#In this example we will calculate the band structure of Si.
#Thanks to SeeK-path we can automatically generate the
Expand All @@ -14,13 +12,14 @@

################################################################


from aiida.engine import submit
from aiida.orm import load_code
from aiida.orm import (Dict, StructureData, KpointsData)
from aiida_siesta.calculations.siesta import SiestaCalculation
from aiida.plugins import DataFactory
from aiida_siesta.data.psf import PsfData
from aiida.tools import get_explicit_kpoints_path

PsfData = DataFactory('siesta.psf')

try:
dontsend = sys.argv[1]
Expand All @@ -41,11 +40,13 @@
except IndexError:
codename = 'Siesta4.0.1@kelvin'

#The code
code = load_code(codename)

##-------------------Structure-----------------------------------
##Manually set the structure, all the quantities must be in Ang.
##Then, we pass through SeeK-path, to get the standardized cell,
##necessary for the automatic choice of the bands path.

alat = 5.430 # angstrom
cell = [
[
Expand Down Expand Up @@ -80,8 +81,7 @@
result = get_explicit_kpoints_path(s, **seekpath_parameters.get_dict())
structure = result['primitive_structure']

code = load_code(codename)

#The parameters
parameters = Dict(
dict={
'xc-functional': 'LDA',
Expand All @@ -92,64 +92,66 @@
'dm-tolerance': 1.e-3,
'Solution-method': 'diagon',
'electronic-temperature': '25 meV',
'md-typeofrun': 'cg',
'md-numcgsteps': 3,
'md-maxcgdispl': '0.1 Ang',
'md-maxforcetol': '0.04 eV/Ang',
'write-forces': True,
# 'xml-write': True
})

basis = Dict(
dict={
'pao-energy-shift': '300 meV',
'%block pao-basis-sizes': """
#The basis
basis = Dict(dict={
'pao-energy-shift': '300 meV',
'%block pao-basis-sizes': """
Si DZP
%endblock pao-basis-sizes""",
})

#The kpoints mesh
kpoints = KpointsData()
kpoints.set_kpoints_mesh([4, 4, 4])

##-------------------K-points for bands --------------------
bandskpoints = KpointsData()
##Uncomment your favourite, two options:

##Uncomment your favourite, three options:
##1)
##.....Making use of SeeK-path for the automatic path......
##The choice of the distance between kpoints is in the call seekpath_parameters
##All high symmetry points included, labels already included
##This calls BandLine in siesta
bandskpoints = result['explicit_kpoints']

##2)
##.....Only points, no labels.......
##Mandatory to set cell and pbc
##.................Only discrete points.............
##Mandatory to set cell and pbc. Do not set labels!
##This calls BandsPoint
#kpp = [(0.500, 0.250, 0.750), (0.500, 0.500, 0.500), (0., 0., 0.)]
#bandskpoints.set_cell(structure.cell, structure.pbc)
#bandskpoints.set_kpoints(kpp)

#Note: The option to define a path touching specific kpoints
#for instance:
##3)
##...The option to define a path touching specific kpoints...
##It make use of a legacy function. Mandatory to set cell and pbc
#from aiida.tools.data.array.kpoints.legacy import get_explicit_kpoints_path as legacy_path
#kpp = [('W', (0.500, 0.250, 0.750), 'L', (0.500, 0.500, 0.500), 40),
# ('L', (0.500, 0.500, 0.500), 'G', (0., 0., 0.), 40)]
#Now is not easy to set. I'll study more on that
#tmp=legacy_path(kpp)
#bandskpoints.set_cell(structure.cell, structure.pbc)
#bandskpoints.set_kpoints(tmp[3])
#bandskpoints.labels=tmp[4]

pseudos_list = []
raw_pseudos = [("Si.psf", 'Si')]
for fname, kind in raw_pseudos:
#The pseudopotentials
pseudos_dict = {}
raw_pseudos = [("Si.psf", ['Si'])]
for fname, kinds in raw_pseudos:
absname = op.realpath(
op.join(op.dirname(__file__), "data/sample-psf-family", fname))
pseudo, created = PsfData.get_or_create(absname, use_first=True)
if created:
print("\nCreated the pseudo for {}".format(kind))
print("\nCreated the pseudo for {}".format(kinds))
else:
print("\nUsing the pseudo for {} from DB: {}".format(kind, pseudo.pk))
pseudos_list.append(pseudo)
print("\nUsing the pseudo for {} from DB: {}".format(kinds, pseudo.pk))
for j in kinds:
pseudos_dict[j]=pseudo

#Resources
options = {
"max_wallclock_seconds": 600,
# "withmpi" : True,
"resources": {
"num_machines": 1,
"num_mpiprocs_per_machine": 1,
Expand All @@ -163,11 +165,9 @@
'basis': basis,
'kpoints': kpoints,
'bandskpoints': bandskpoints,
'pseudos': {
'Si': pseudos_list[0],
},
'pseudos': pseudos_dict,
'metadata': {
"label": "TestOnSiliconBandsLines",
"label": "TestOnSiliconBands",
'options': options,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@

from __future__ import absolute_import
from __future__ import print_function

import sys

import pymatgen as mg
import ase.io

from aiida.engine import submit
from aiida.orm import load_code
Expand All @@ -19,6 +18,8 @@
# a cif file.
# The band structure is calculated and the kpoint path is automatically
# generated using seekpath.
# The pseudopotential is taken from a family, please refer to 00_README
# and example_psf_family.py for better understanding

PsfData = DataFactory('siesta.psf')
Dict = DataFactory('dict')
Expand All @@ -42,11 +43,9 @@
try:
codename = sys.argv[2]
except IndexError:
codename = 'siesta4.0.1@parsons'
codename = 'Siesta4.0.1@kelvin'

#
#------------------Code and computer options ---------------------------
#
code = load_code(codename)

options = {
Expand All @@ -58,56 +57,41 @@
}
}
#
settings_dict = {'additional_retrieve_list': ['aiida.BONDS', 'aiida.EIG']}
settings = Dict(dict=settings_dict)
#settings_dict = {'additional_retrieve_list': ['aiida.BONDS', 'aiida.EIG']}
#settings = Dict(dict=settings_dict)
#---------------------------------------------------------------------

#
# Structure -----------------------------------------
#
# Passing through SeeK-path first, to get the standardized cell.
# Two choices for importing the .cif, pymatgen or ase. Then
# passing through SeeK-path to get the standardized cell.
# Necessary for the automatic choice of the bands path.
#
structure = mg.Structure.from_file("data/O2_ICSD_173933.cif", primitive=False)
s = StructureData(pymatgen_structure=structure)
#structure =ase.io.read("data/O2_ICSD_173933.cif")
#s = StructureData(ase=structure)

seekpath_parameters = {'reference_distance': 0.02, 'symprec': 0.0001}
result = get_explicit_kpoints_path(s, **seekpath_parameters)
newstructure = result['primitive_structure']

#
# Parameters ---------------------------------------------------
#
params_dict = {
'xc-functional': 'LDA',
'xc-authors': 'CA',
'spin-polarized': True,
'noncollinearspin': False,
'mesh-cutoff': '200.000 Ry',
'max-scfiterations': 1000,
'dm-numberpulay': 5,
'dm-mixingweight': 0.050,
'dm-tolerance': 1.e-4,
'dm-mixscf1': True,
'negl-nonoverlap-int': False,
'solution-method': 'diagon',
'electronic-temperature': '100.000 K',
'md-typeofrun': 'cg',
'md-numcgsteps': 2,
'md-maxcgdispl': '0.200 bohr',
'md-maxforcetol': '0.050 eV/Ang',
'writeforces': True,
'writecoorstep': True,
'write-mulliken-pop': 1
}
#
parameters = Dict(dict=params_dict)

#----------------------------------------------------------
#
# Basis Set Info ------------------------------------------
# The basis dictionary follows the 'parameters' convention
#
basis_dict = {
'pao-basistype': 'split',
'pao-splitnorm': 0.150,
Expand All @@ -118,7 +102,6 @@
}
#
basis = Dict(dict=basis_dict)
#--------------------------------------------------------------

#--------------------- Pseudopotentials ---------------------------------
#
Expand Down Expand Up @@ -154,7 +137,7 @@
'pseudos': pseudos_dict,
'metadata': {
'options': options,
'label': "O_el_cell_spin from CIF"
'label': "O_el_cell_from_CIF"
}
}

Expand Down
Loading

0 comments on commit b56d39c

Please sign in to comment.