[ase-users] valence electrons in new dacapo/ase3

Jens Jørgen Mortensen jensj at fysik.dtu.dk
Mon Jan 5 15:32:23 CET 2009


On Mon, 2008-12-22 at 21:45 -0500, John Kitchin wrote:
> I noticed that the valence electrons in the new dacapo/ase3
> interface are calculated from a dictionary at the bottom of dacapo.py.
> I think this is problematic for a few reasons:
> 1. the dictionary is incomplete
> 2. the number of valence electrons is actually pseudopotential
> dependent, so the dictionary could be wrong in some cases.
>  
> I propose someone add the following function to the new dacapo
> interface. This function calculates the number of valence electrons
> directly from the binary pseudopotential files. :
>  
>     def get_valence(self,atoms): 
>         '''return the total number of valence electrons for the
> atoms''' 
>         import os 
>         from struct import unpack 
>          
>         dacapopath = os.environ.get('DACAPOPATH') 
>         an = atoms.get_atomic_numbers() 
>         totval = 0.0 
>         for n in an: 
>             psp = self.calc.GetPseudoPotential(n) 
>             fullpsp = os.path.join(dacapopath,psp) 
>             if os.path.exists(fullpsp): 
>                 f = open(fullpsp) 
>                 # read past version numbers and text information 
>                 buf = f.read(64) 
>                 # read number valence electrons 
>                 buf = f.read(8) 
>                 fmt = ">d" 
>                 nvalence = unpack(fmt,buf)[0] 
>                 f.close() 
>                 totval += float(nvalence) 
>             else: 
>                 raise Exception, "%s does not exist" % fullpsp 
>  
>         return totval 
>  
>  
> and then, in the update method replace 
> n = sum([valence[atom.symbol] for atom in atoms]) 
> 
> with
>  
> n = self.get_valence(atoms) 

Thanks!  I'll add this to the new interface - unless you want to do it?

> alternatively, this function could go in a uspp module. It would be
> nice if the right default psp were automatically selected when the xc
> was selected.

How would you like to do this?  One directory for each functional?

>  this module might also provide an interface to constructing
> vanderbilt uspp's. 
>  
> comments are welcome.
>  
> j
> 
> -----------------------------------
> John Kitchin
> Assistant Professor
> NETL-IAES Resident Institute Fellow
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> http://kitchingroup.cheme.cmu.edu
> 
> 
> 
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users




More information about the ase-users mailing list