jochym / Elastic

A module for ASE for elastic constants calculation.
GNU General Public License v3.0
35 stars 23 forks source link

Elastic constant calculation for zirconia #2

Open lim520 opened 10 years ago

lim520 commented 10 years ago

Dear Dr. Jochym

I was trying to calculate the elastic constant for Zirconia and was facing these this error.

Can you please help in solving this

In [1]:

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

iPython utility function

from IPython.core.display import Image

Import the qe-util package

from qeutil import RemoteQE

Access info

import hostj

In [2]:

Import additional library for elastic constants calculations

import elastic

In [3]:

Stup the SiC crystal

Create a cubic crystal with a spacegroup F-43m (216)

a=5.010767

cryst = crystal(['Zr','O','O'],

            [(0, 0, 0), (0.25, 0.25, 0.25),(-0.25,-0.25,-0.25)],

            spacegroup=225,

            cellpar=[a, a, a, 90, 90, 90])

/home/lim520/miniconda/envs/nipy/lib/python2.7/site-packages/ase/lattice/spacegroup/spacegroup.py:380: UserWarning: scaled_positions 1 and 2 are equivalent 'are equivalent'%(kinds[ind], kind))

In [4]:

Check the spacegroup (symmetry) of our creation

spglib.get_spacegroup(cryst)

Out[4]:

'Fm-3m (225)'

In [5]:

Create a Quantum Espresso calculator for our work.

This object encapsulates all parameters of the calculation,

not the system we are investigating.

qe=RemoteQE(label='Zirconia',

           kpts=[4,4,4],

           xc='pz',         # Exchange functional type in the name of the pseudopotentials

           pp_type='hgh',   # Variant of the pseudopotential

           pp_format='UPF', # Format of the pseudopotential files

           ecutwfc=70,

           pseudo_dir='../pspot',

           use_symmetry=True,

           procs=8)         # Use 8 cores for the calculation

Check where the calculation files will reside on the local machine.

print qe.directory

calc/Zirconia.MeFc1O

In [6]:

Assign the calculator to our system

cryst.set_calculator(qe)

In [7]:

Run the calculation to get stress tensor (in Voigt notation, GPa) and pressure (in GPa)

print "Stress tensor (GPa):", cryst.get_stress()/ase.units.GPa

print "External pressure (GPa):", cryst.get_pressure()/ase.units.GPa

Stress tensor (GPa): [ 0.208 0.208 0.208 -0. -0. -0. ] External pressure (GPa): -0.208

In [8]:

fit=cryst.get_BM_EOS(lo=0.96, # lower bound of the volumes range

                 hi=1.04,    # higher bound of the volumes range

                 n=5)        # number of volume points used in the fit

print "\nA0=%.4f A ; B0=%.1f GPa ; B0'=%.2f " % (fit[0]**(1.0/3), fit[1]/ase.units.GPa, fit[2])

Launching: 1 2 3 4 5 Done: 1 2 3 4 5

A0=5.0085 A ; B0=245.8 GPa ; B0'=3.78

In [9]:

deformations=cryst.get_elastic_tensor(mode='deformations')

In [10]:

elastic.ParCalculate(deformations,qe);

Launching:


NotImplementedError Traceback (most recent call last)

in () ----> 1 elastic.ParCalculate(deformations,qe); /home/lim520/miniconda/envs/nipy/lib/python2.7/site-packages/elastic/**init**.pyc in ParCalculate(systems, calc) 240 for s in systems: 241 s.set_calculator(calc.copy()) --> 242 calc.ParallelCalculate(systems,properties=['stress']) 243 return systems 244 /home/lim520/miniconda/envs/nipy/lib/python2.7/site-packages/qeutil/**init**.pyc in ParallelCalculate(cls, syslst, properties, system_changes) 483 try : 484 s.calc.block=False --> 485 s.calc.calculate(atoms=s,properties=properties,system_changes=system_changes) 486 except CalcNotReadyError: 487 s.calc.block=True /home/lim520/miniconda/envs/nipy/lib/python2.7/site-packages/qeutil/**init**.pyc in calculate(self, atoms, properties, system_changes) 165 166 self.command=self.build_command(properties,self.parameters) --> 167 self.run_calculation(atoms, properties, system_changes) 168 169 # if {'energy','stress'} & set(properties) : /home/lim520/miniconda/envs/nipy/lib/python2.7/site-packages/qeutil/**init**.pyc in run_calculation(self, atoms, properties, system_changes) 403 ''' 404 Calculator.calculate(self, atoms, properties, system_changes) --> 405 self.write_input(self.atoms, properties, system_changes) 406 if self.command is None: 407 raise RuntimeError('Please configure RemoteQE calculator!') /home/lim520/miniconda/envs/nipy/lib/python2.7/site-packages/qeutil/**init**.pyc in write_input(self, atoms, properties, system_changes) 363 def write_input(self, atoms=None, properties=['energy'], system_changes=all_changes): 364 '''Write input file(s).''' --> 365 QuantumEspresso.write_input(self, atoms, properties, system_changes) 366 self.write_pbs_in(properties) 367 subprocess.call(self.copy_out_cmd % { /home/lim520/miniconda/envs/nipy/lib/python2.7/site-packages/qeutil/**init**.pyc in write_input(self, atoms, properties, system_changes) 196 197 if set(['energy','stress','forces','bands','edos']) & set(properties) : --> 198 write_pw_in(self.directory, atoms, self.parameters) 199 if 'bands' in properties : 200 write_bands_in(self.directory, atoms, self.parameters) /home/lim520/miniconda/envs/nipy/lib/python2.7/site-packages/qeutil/writers.pyc in write_pw_in(d, a, p) 207 # Need to use symmetry properly 208 # create a dummy atoms object for primitive cell --> 209 primcell=write_cell_params(fh,a,p) 210 if primcell : 211 # primitive cell has been found - let us use it /home/lim520/miniconda/envs/nipy/lib/python2.7/site-packages/qeutil/writers.pyc in write_cell_params(fh, a, p) 164 fh.write(' C = %f,\n' % (C,)) 165 elif sgn >= 75 : --> 166 raise NotImplementedError 167 elif sgn ==1 : 168 # P1 symmetry - no special primitive cell signal to the caller NotImplementedError: With regards Linu