Skip to content

Commit

Permalink
Adding doc dumped from web and 2 example scripts for ASE
Browse files Browse the repository at this point in the history
  • Loading branch information
farhi2 committed Jul 28, 2016
1 parent e7537d8 commit 35e8ba0
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 0 deletions.
Binary file added doc/QE-ASE-doc.pdf
Binary file not shown.
Binary file added doc/QE-ASE-example1.pdf
Binary file not shown.
Binary file added doc/QE-ASE-example2.pdf
Binary file not shown.
Binary file added doc/QE-ASE-example3.pdf
Binary file not shown.
Binary file added doc/QE-ASE-example4.pdf
Binary file not shown.
Binary file added doc/QE-ASE-example6.pdf
Binary file not shown.
Binary file added doc/QE-ASE-example7.pdf
Binary file not shown.
Binary file added doc/QE-ASE-example8.pdf
Binary file not shown.
Binary file added doc/QE-ASE-example9.pdf
Binary file not shown.
62 changes: 62 additions & 0 deletions examples/crystal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Import the basic libraries

# ASE system
import ase
from ase import Atom, Atoms
from ase import io
from ase.lattice.spacegroup import crystal

# Spacegroup/symmetry library
from pyspglib import spglib

# The qe-util package
from qeutil import QuantumEspresso

# iPython utility function
from IPython.core.display import Image

# Configure qe-util for local execution of the Quantum Espresso on four processors
# QuantumEspresso.pw_cmd='mpiexec -n 4 pw.x < pw.in > pw.out'

a=4.3596 # Lattice constant in Angstrom
cryst = crystal(['Si', 'C'], # Atoms in the crystal
[(0, 0, 0), (0.25, 0.25, 0.25)], # Atomic positions (fractional coordinates)
spacegroup=216, # International number of the spacegroup of the crystal
cellpar=[a, a, a, 90, 90, 90]) # Unit cell (a, b, c, alpha, beta, gamma) in Angstrom, Degrees

# Write the image to disk file
ase.io.write('crystal.png', # The file where the picture get stored
cryst, # The object holding the crystal definition
format='png', # Format of the file
show_unit_cell=2, # Draw the unit cell boundaries
rotation='115y,15x', # Rotate the scene by 115deg around Y axis and 15deg around X axis
scale=30) # Scale of the picture

# Display the image
Image(filename='crystal.png')

print 'Space group:', spglib.get_spacegroup(cryst)

# Create a Quantum Espresso calculator for our work.
# This object encapsulates all parameters of the calculation,
# not the system we are investigating.
qe=QuantumEspresso(label='SiC', # Label for calculations
wdir='.', # Working directory
pseudo_dir='/usr/share/espresso/pseudo', # Directory with pseudopotentials
kpts=[2,2,2], # K-space sampling for the SCF calculation
xc='pz', # Exchange functional type in the name of the pseudopotentials
pp_type='vbc', # Variant of the pseudopotential
pp_format='UPF', # Format of the pseudopotential files
ecutwfc=20, # Energy cut-off (in Rydberg)
use_symmetry=False, procs=8) # Use symmetry in the calculation ?

print qe.directory

# Assign the calculator to our system
cryst.set_calculator(qe)

# Run the calculation to get stress tensor (Voigt notation, in eV/A^3) and pressure (in kBar)
print "Stress tensor (Voigt notation eV/A^3):", cryst.get_stress()
# print "External pressure (kBar):", cryst.get_isotropic_pressure(cryst.get_stress())*1e-3

print 'All done and functional: QE, stress.'
36 changes: 36 additions & 0 deletions examples/phonons.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from ase.lattice import bulk
from ase.dft.kpoints import ibz_points, get_bandpath
from ase.phonons import Phonons

# The qe-util package
from qeutil import QuantumEspresso

# Setup crystal and EMT calculator
atoms = bulk('Al', 'fcc', a=4.05)

qe=QuantumEspresso(label='Al', # Label for calculations
wdir='.', # Working directory
pseudo_dir='/usr/share/espresso/pseudo', # Directory with pseudopotentials
kpts=[2,2,2], # K-space sampling for the SCF calculation
xc='pz', # Exchange functional type in the name of the pseudopotentials
pp_type='vbc', # Variant of the pseudopotential
pp_format='UPF', # Format of the pseudopotential files
ecutwfc=15, # Energy cut-off (in Rydberg)
occupations='smearing',
smearing='methfessel-paxton',
degauss=0.0198529,
mixing_beta=0.7, mixing_mode = 'plain', diagonalization = 'cg',
restart_mode='from_scratch', tstress=False,
use_symmetry=False, procs=8) # Use symmetry in the calculation ?

print qe.directory

# Assign the calculator to our system
atoms.set_calculator(qe)

ph = Phonons(atoms, qe, supercell=(2,2,2), delta=0.05)
ph.run()
# Read forces and assemble the dynamical matrix
ph.read(acoustic=True)

print 'All done and functional: QE, phonons.'

0 comments on commit 35e8ba0

Please sign in to comment.