[gpaw-users] [ase-users] Any calculator add-ons?

Jess Wellendorff Pedersen jesswe at fysik.dtu.dk
Thu Apr 7 12:38:39 CEST 2011


Hi augustus,

I'm not really certain what you are aiming at with this script, but 
there are at least a few issues with it:

Augustus Low wrote:
> Hi Jess,
>
> This is my script:
>
> from ase import Atoms
> from ase.visualize import view
> from ase.calculators.emt import EMT
> from ase.constraints import FixAtoms
> from ase.optimize import QuasiNewton
> from ase.lattice.cubic import BodyCenteredCubic
>
> a = 3.61
> bcc = BodyCenteredCubic(size=(1,1,1), symbol='Cu', pbc=(1,1,0), 
> latticeconstant=3.61)
this creates a bcc unit cell for you with two atoms in it and periodic 
boundary conditions in the x and y directions but not in the z 
direction. Doesn't really apply for an infinitely extended solid, for 
which pbc should be (1,1,1). pbc = (1,1,0) is mostly applicable to 
surface slab models and the likes.
>
> bcc.append(29)
> bcc.positions[2]=(a,a,a)
> bcc.append(29)
> bcc.positions[3]=(a,0,0)
> bcc.append(29)
> bcc.positions[4]=(0,0,a)
> bcc.append(29)
> bcc.positions[5]=(a,0,a)
> bcc.append(29)
> bcc.positions[6]=(0,a,0)
> bcc.append(29)
> bcc.positions[7]=(0,a,a)
> bcc.append(29)
> bcc.positions[8]=(a,a,0)
this is where it gets really problematic. All the above appends are bad, 
because the periodic boundary conditions "translate" the unit cell for 
you in the pbc=1 directions. Therefore, with a manual translation in say 
the x direction, you now put two atoms exactly on top of each other in 
the pbc=True directions.
>
> constraint = FixAtoms(mask=[a.symbol !='Cu' for a in bcc])
> bcc.set_constraint(constraint)
>
> view(bcc)
>
> bcc.set_calculator(EMT())
> dyn = QuasiNewton(bcc)
> dyn.run(fmax=0.05)
>
> print bcc.get_potential_energy()
>
> from gpaw import GPAW
> calc = GPAW(nbands= -10)
> bcc.set_calculator(calc)
> bcc.get_potential_energy()
I hope you realize that this would be an extremely crude DFT 
calculation, with default real-space density grid spacing, LDA 
exchange-correlation, and only a single k-point (the gamma point) in 
reciprocal space, meaning that even though you a using periodic boundary 
conditions such as to model an extended lattice you are not taking this 
periodicity into account in the electronic structure calculation.

/Jess
>
> On Thu, Apr 7, 2011 at 5:47 PM, Jess Wellendorff Pedersen 
> <jesswe at fysik.dtu.dk <mailto:jesswe at fysik.dtu.dk>> wrote:
>
>     could you send me the script you try to run?
>
>     /Jess
>
>
>     Jess Wellendorff Pedersen wrote:
>
>         did you run the GPAW test suite ?
>
>         Augustus Low wrote:
>          
>
>             Hi Jess,
>
>             Thanks for the great tip! =) But now after doing what you
>             do, I don't have that error anymore. However this was
>             returned:
>
>              File "<stdin>", line 1, in <module>
>              File "/home/lowt0008/ase/ase/atoms.py", line 494, in
>             get_potential_energy
>                return self.calc.get_potential_energy(self)
>              File
>             "/home/lowt0008/python-2.7/lib/python2.7/site-packages/gpaw/aseinterface.py",
>             line 32, in get_potential_energy
>                self.calculate(atoms, converge=True)
>              File
>             "/home/lowt0008/python-2.7/lib/python2.7/site-packages/gpaw/paw.py",
>             line 226, in calculate
>                self.set_positions(atoms)
>              File
>             "/home/lowt0008/python-2.7/lib/python2.7/site-packages/gpaw/paw.py",
>             line 301, in set_positions
>                spos_ac = self.initialize_positions(atoms)
>              File
>             "/home/lowt0008/python-2.7/lib/python2.7/site-packages/gpaw/paw.py",
>             line 293, in initialize_positions
>                self.wfs.set_positions(spos_ac)
>              File
>             "/home/lowt0008/python-2.7/lib/python2.7/site-packages/gpaw/wavefunctions/fd.py",
>             line 45, in set_positions
>                FDPWWaveFunctions.set_positions(self, spos_ac)
>              File
>             "/home/lowt0008/python-2.7/lib/python2.7/site-packages/gpaw/wavefunctions/fdpw.py",
>             line 41, in set_positions
>                WaveFunctions.set_positions(self, spos_ac)
>              File
>             "/home/lowt0008/python-2.7/lib/python2.7/site-packages/gpaw/wavefunctions/base.py",
>             line 226, in set_positions
>                rank_a = self.gd.get_ranks_from_positions(spos_ac)
>              File
>             "/home/lowt0008/python-2.7/lib/python2.7/site-packages/gpaw/domain.py",
>             line 102, in get_ranks_from_positions
>                assert (rnk_ac >= 0).all() and (rnk_ac <
>             self.parsize_c).all()
>             AssertionError
>
>
>             On Thu, Apr 7, 2011 at 5:32 PM, Jess Wellendorff Pedersen
>             <jesswe at fysik.dtu.dk <mailto:jesswe at fysik.dtu.dk>
>             <mailto:jesswe at fysik.dtu.dk <mailto:jesswe at fysik.dtu.dk>>>
>             wrote:
>
>                slight correction: nbands of course concerns only the
>             valence
>                electrons, i.e. those not included in the GPAW setups...
>
>                /Jess
>
>                Augustus Low wrote:
>
>                    Hi ZhenHua,
>
>                    When I ran GPAW and tried to calculate the
>             potential energy,
>                    giving it nbands = 10, the computer returned this.
>
>                     File "<stdin>", line 1, in <module>
>                     File "/home/lowt0008/ase/ase/atoms.py", line 494, in
>                    get_potential_energy
>                       return self.calc.get_potential_energy(self)
>                     File
>                  
>              "/home/lowt0008/python-2.7/lib/python2.7/site-packages/gpaw/aseinterface.py",
>                    line 32, in get_potential_energy
>                       self.calculate(atoms, converge=True)
>                     File
>                  
>              "/home/lowt0008/python-2.7/lib/python2.7/site-packages/gpaw/paw.py",
>                    line 225, in calculate
>                       self.initialize(atoms)
>                     File
>                  
>              "/home/lowt0008/python-2.7/lib/python2.7/site-packages/gpaw/paw.py",
>                    line 441, in initialize
>                       % (nvalence, nbands))
>                    ValueError: Too few bands!  Electrons: 99, bands: 10
>
>                    Any idea what this means? Also, what does the
>             nbands in the
>                    GPAW mean?
>                    I just want to thank you in advance.
>
>                    Regards,
>                    Augustus
>
>
>                    Sorry to trouble you again.
>                    On Mon, Apr 4, 2011 at 12:23 AM, ZhenHua Zeng
>                    <zhenhua.zeng at fysik.dtu.dk
>             <mailto:zhenhua.zeng at fysik.dtu.dk>
>             <mailto:zhenhua.zeng at fysik.dtu.dk
>             <mailto:zhenhua.zeng at fysik.dtu.dk>>
>                    <mailto:zhenhua.zeng at fysik.dtu.dk
>             <mailto:zhenhua.zeng at fysik.dtu.dk>
>                    <mailto:zhenhua.zeng at fysik.dtu.dk
>             <mailto:zhenhua.zeng at fysik.dtu.dk>>>> wrote:
>
>                       Hi Augustus,
>
>                       Yes. You need to install the calculators in ASE
>             before using
>                       except EMT, which is like a toy included in the
>             ASE package.
>
>                       Dacapo  (Jacapo in ase3) is a total energy
>             program based on
>                       density functional theory.
>                       It uses a plane wave basis for the valence
>             electronic
>                    states and
>                       describes the core-electron interactions with
>                       Vanderbilt ultrasoft pseudo-potentials (USPP).
>             Dacapo has been
>                       implemented widely in the studies of surface
>                       physics/chemistry, condensed physics, catalysis
>             etc. It
>                    have been
>                       proved to be a reliable code to describe
>                       the properties in these relevant field.
>
>                       Besides,  GPAW, another DFT code, is a more
>             promising code
>                    In ASE
>                       interface.
>                       It is based on the projector-augmented wave
>             (PAW), which is
>                    more
>                       sophisticated than USPP method used in Dacapo.
>
>                       So for Dacapo and GPAW, we would like to
>              recommend  the latter
>                       for your study.
>                       For more detail, please refer the link below.
>                            
>              https://wiki.fysik.dtu.dk/ase/ase/calculators/calculators.html#module-calculators
>
>                       Best wishes!
>                       ZhenHua             On 2011/4/2 4:12, Augustus
>             Low wrote:
>
>                           Hi Zhenhua,
>
>                           Meaning with whatever calculators I need, I
>             need to
>                        install them?
>                           Besides EMT, are there any other calculators
>             that are
>                        included in
>                           the python ase package?
>
>                           Regards,
>                           Augustus
>
>                           On Fri, Apr 1, 2011 at 4:43 AM, ZhenHua Zeng
>                           <zhenhua.zeng at fysik.dtu.dk
>             <mailto:zhenhua.zeng at fysik.dtu.dk>
>                        <mailto:zhenhua.zeng at fysik.dtu.dk
>             <mailto:zhenhua.zeng at fysik.dtu.dk>>
>                        <mailto:zhenhua.zeng at fysik.dtu.dk
>             <mailto:zhenhua.zeng at fysik.dtu.dk>
>                        <mailto:zhenhua.zeng at fysik.dtu.dk
>             <mailto:zhenhua.zeng at fysik.dtu.dk>>>> wrote:
>
>                               Hi Augustus,
>
>                               You need to install them before
>             importing and using
>                        them.
>                               You can find the introduction of
>             installment in the
>                        website
>                               of codes,
>                               which are also linked from front page of ase
>                               https://wiki.fysik.dtu.dk/ase/.
>
>                               Best wishes!
>                               ZhenHua
>
>
>                               On 2011/3/31 17:18, Augustus Low wrote:
>
>                                   Hi ZhengHua,
>
>                                   Thank you for your help. Any idea
>             how I can
>                            import these
>                                   calculators and use them? Meaning
>             like the
>                            command codes?
>
>                                   Grateful,
>                                   Augustus
>
>                                   On Thu, Mar 31, 2011 at 4:06 PM,
>             ZhenHua Zeng
>                                   <zhenhua.zeng at fysik.dtu.dk
>             <mailto:zhenhua.zeng at fysik.dtu.dk>
>                            <mailto:zhenhua.zeng at fysik.dtu.dk
>             <mailto:zhenhua.zeng at fysik.dtu.dk>>
>                                   <mailto:zhenhua.zeng at fysik.dtu.dk
>             <mailto:zhenhua.zeng at fysik.dtu.dk>
>                            <mailto:zhenhua.zeng at fysik.dtu.dk
>             <mailto:zhenhua.zeng at fysik.dtu.dk>>>> wrote:
>
>                                       Hi Augustus,
>
>                                       As much as i know, there are few
>             empirical
>                            potential
>                                       codes working on ionic crystal.
>                                       DFT codes are supposed to work
>             well on
>                            ionic crystal.
>                                       And there is so much variety,
>             such as GPAW
>                            or Dacapo etc
>                                       in ASE.
>
>                                       Best wishes!
>                                       ZhenHua
>
>                                       On 2011/3/31 4:23, Augustus Low
>             wrote:
>
>                                           Dear all,
>
>                                           I'm trying to simulate the
>             potential
>                                energies for both
>                                           hydroxyapatite and fluorapatite.
>                                However I'm unable to
>                                           calculate their potential
>             energies
>                                because the EMT
>                                           calculator does not support the
>                                calculations of the P,
>                                           F and Ca elements. Any idea
>             if other
>                                calculators can
>                                           help solve this problem?
>
>                                           Regards,
>                                           Augustus
>
>
>                                                            
>              _______________________________________________
>                                           ase-users mailing list
>                                          
>             ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>
>                                <mailto:ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>>
>                                <mailto:ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>
>                                <mailto:ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>>>
>
>                                                            
>              https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>
>
>
>                                       --             ZhenHua Zeng
>                                       Technical University of Denmark
>                                       Department of Physics
>                                       Building 307, Room 242
>                                       DK-2800 Kongens Lyngby
>                                       Denmark
>                                       Mob.: (+45) 5278 0888
>             <tel:%28%2B45%29%205278%200888>
>                            <tel:%28%2B45%29%205278%200888>
>                            <tel:%28%2B45%29%205278%200888>
>                                       Tel.: (+45) 4525 3234
>             <tel:%28%2B45%29%204525%203234>
>                            <tel:%28%2B45%29%204525%203234>
>                            <tel:%28%2B45%29%204525%203234>
>                                       Fax.: (+45) 4593 2399
>             <tel:%28%2B45%29%204593%202399>
>                            <tel:%28%2B45%29%204593%202399>
>                            <tel:%28%2B45%29%204593%202399>
>                                       Email: Zhenhua.Zeng at fysik.dtu.dk
>             <mailto:Zhenhua.Zeng at fysik.dtu.dk>
>                            <mailto:Zhenhua.Zeng at fysik.dtu.dk
>             <mailto:Zhenhua.Zeng at fysik.dtu.dk>>
>                            <mailto:Zhenhua.Zeng at fysik.dtu.dk
>             <mailto:Zhenhua.Zeng at fysik.dtu.dk>
>                            <mailto:Zhenhua.Zeng at fysik.dtu.dk
>             <mailto:Zhenhua.Zeng at fysik.dtu.dk>>>
>
>                                       ---------------------------------
>
>
>                                      
>             _______________________________________________
>                                       ase-users mailing list
>                                       ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>
>                            <mailto:ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>>
>                                      
>             <mailto:ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>
>                            <mailto:ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>>>
>
>                                                    
>              https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>
>
>
>                                  
>             _______________________________________________
>                                   ase-users mailing list
>                                   ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>
>                            <mailto:ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>>
>                            <mailto:ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>
>                            <mailto:ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>>>
>
>                                                
>              https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>
>
>                              
>             _______________________________________________
>                               ase-users mailing list
>                               ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>
>                        <mailto:ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>>
>                               <mailto:ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>
>                        <mailto:ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>>>
>
>                                        
>              https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>
>
>
>                           _______________________________________________
>                           ase-users mailing list
>                           ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>
>                        <mailto:ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>>
>                        <mailto:ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>
>                        <mailto:ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>>>
>
>                          
>             https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>
>
>                       _______________________________________________
>                       ase-users mailing list
>                       ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>
>                    <mailto:ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>>
>                       <mailto:ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>
>                    <mailto:ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>>>
>
>                      
>             https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>
>
>                  
>              ------------------------------------------------------------------------
>
>                    _______________________________________________
>                    ase-users mailing list
>                    ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>
>                    <mailto:ase-users at listserv.fysik.dtu.dk
>             <mailto:ase-users at listserv.fysik.dtu.dk>>
>                  
>              https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>
>
>                --     Jess Wellendorff Pedersen
>
>                ph.d student
>                Center for Atomic-scale Materials Design (CAMD)
>                Department of Physics
>                Technical University of Denmark (DTU)
>
>
>                
>
>
>          
>
>
>     -- 
>     Jess Wellendorff Pedersen
>
>     ph.d student
>     Center for Atomic-scale Materials Design (CAMD)
>     Department of Physics
>     Technical University of Denmark (DTU)
>
>

-- 
Jess Wellendorff Pedersen

ph.d student
Center for Atomic-scale Materials Design (CAMD)
Department of Physics
Technical University of Denmark (DTU)



More information about the gpaw-users mailing list