[ase-users] Unable to read the created .nc file

Jakob Blomqvist Jakob.Blomqvist at mah.se
Fri Mar 25 15:26:04 CET 2011


This might be silly question but how do I try out locally installed trunk through Torque? I have set PATH and PYTHONPATH to first point to trunk version and when I try to print version using a test script like from ase.version import version; print version:
$ python test.py
i get 
"3.5.0"

but if i send my script through qsub I get 
"3.4.1"


Another issue is that when I try to run a simple bulk script below using
$ python albulk.py
i get 
expected output

but with
$mpirun -np 2 albulk.py

I get
################
Traceback (most recent call last):
  File "albulk.py", line 18, in 
    atoms=bulk)
  File "/home/jakob/ase/ase/calculators/jacapo/jacapo.py", line 302, in __init__
    self.set(**kwargs) #if nothing changes, nothing will be done
  File "/home/jakob/ase/ase/calculators/jacapo/jacapo.py", line 336, in set
    notchanged = not eval('%s(self,kwargs[key])' % changef)
  File "", line 1, in 
  File "/home/jakob/ase/ase/calculators/jacapo/changed.py", line 40, in kpts_changed
    grid = calc.get_kpts()
  File "/home/jakob/ase/ase/calculators/jacapo/jacapo.py", line 2154, in get_kpts
    nc = netCDF(self.nc, 'r')
  File "/usr/lib/python2.6/dist-packages/Scientific/IO/NetCDF.py", line 177, in NetCDFFile
    return apply(_NetCDFFile, args)
IOError: netcdf: NetCDF: Unknown file format
[-0.142687   -0.142687   -0.142687    0.00839633  0.00839633  0.00839633]

################
So, it still seems to get the correct result in the end, however I wonder if it even ran it in parallel?
What is the easiest way to check if a dacapo/jacapo job has run properly in parallel? I can't see anything in output-txt file.

albulk.py:
*************************
#!/usr/bin/env python
from ase import Atom, Atoms
from ase.calculators.jacapo import *


a = 3.8  # approximate lattice constant
b = a / 2.
bulk = Atoms([Atom('Al',(0.0,0.0,0.0))], 
             cell=[(0,b,b),
                   (b,0,b),
                   (b,b,0)])

calc = Jacapo('2.2.1-Al.nc',
              pw=350,
              kpts=(4,4,4),
              calculate_stress=True,
              atoms=bulk)

print bulk.get_stress()
***************************




Dr. Jakob Blomquist
IMP, School of Technology
Malmo University
SWEDEN
+46(0)40 6657626
jakob.blomqvist at mah.se
>>> Marcin Dulak  03/25/11 10:59 AM >>>
Hi,

the jacapo handling of restart has been fixed in the development version 
of ase: https://wiki.fysik.dtu.dk/ase/download.html#id8
Please use the ase trunk.

Best regards,

Marcin

c cook wrote:
> Hello again,
>
> I started to do some simple testing:
>
> http://beowulf.cheme.cmu.edu/jacapo/2-bulk/2.2-unitcell-optimization/2.2.0-unit-cell-optimization.html#simple-total-energy-calculation
>
>
> the first step to calculate the energy seen below worked 
> #!/usr/bin/env python
> from ase import *
> from ase.calculators.jacapo import *
>
>
> a = 3.8  # approximate lattice constant
> b = a / 2.
> bulk = Atoms([Atom('Al',(0.0,0.0,0.0))], 
>              cell=[(0,b,b),
>                    (b,0,b),
>                    (b,b,0)])
>
> calc = Jacapo('2.2.1-Al.nc ',
>               pw=350,
>               kpts=(4,4,4),
>               calculate_stress=True,
>               atoms=bulk)
>
> print bulk.get_stress()
> the 2.2.1-Al.nc  and the corresponding .txt  file 
> were created,
>
> but when I went further to:
>
> #!/usr/bin/env python
> from ase.calculators.jacapo import *
>
> bulk = Jacapo.read_atoms('2.2.1-Al.nc ')
>
> print  'energy: ' ,bulk.get_potential_energy()
>
>
> sxx, syy, szz, syz, sxz, sxy = bulk.get_stress()
>
> import numpy as np
> from ase.units import GPa
> print 'Stress (GPa) = '
> print np.array([[sxx, sxy, sxz],
>                 [sxy, syy, syz],
>                 [sxz, syz, szz]])/GPa
> I' ve got the following error:
>
> File "./bulkAl2.sh", line 4, in 
>     bulk = Jacapo.read_atoms('2.2.1-Al.nc ')
>   File "/home/csaba/ase/ase/calculators/jacapo/jacapo.py", line 3059, 
> in read_atoms
>     calc = Jacapo(filename)
>   File "/home/csaba/ase/ase/calculators/jacapo/jacapo.py", line 231, 
> in __init__
>     self.set_nc(nc)
>   File "/home/csaba/ase/ase/calculators/jacapo/jacapo.py", line 1135, 
> in set_nc
>     self.update_input_parameters()
>   File "/home/csaba/ase/ase/calculators/jacapo/jacapo.py", line 383, 
> in update_input_parameters
>     self.pars[key] = eval(getf)
>   File "", line 1, in 
>   File "/home/csaba/ase/ase/calculators/jacapo/jacapo.py", line 2257, 
> in get_psp
>     raise Exception, 'You can only specify Z or sym!'
> Exception: You can only specify Z or sym!
>
>
> I've checked in the jacapo.py and the only reference to the error is this:
>
> *def set_psp(self,*
> *                sym=None,*
> *                z=None,*
> *                psp=None):*
> *        '''*
> *        set the pseudopotential file for a species or an atomic number.*
> *
> *
> *        :Parameters:*
> *
> *
> *         sym : string*
> *           chemical symbol of the species*
> *
> *
> *          z : integer*
> *            the atomic number of the species*
> *
> *
> *          psp : string*
> *            filename of the pseudopotential*
> *
> *
> *        *
> *        you can only set sym or z.*
> *
> *
> *        examples::*
> *        *
> *          set_psp('N',psp='pspfile')*
> *          set_psp(z=6,psp='pspfile')*
> *        '''*
> *        log.debug(str([sym, z, psp]))*
> *        if (sym, z, psp) == (None, None, None):*
> *            return*
> *        *
> *        if (sym is None and z is not None):*
> *            from ase.data import chemical_symbols*
> *            sym = chemical_symbols[z]*
> *        elif (sym is not None and z is None):*
> *            pass*
> *        else:*
> *            raise Exception, 'You can only specify Z or sym!'*
>
>
> But, I am stuck here. The DACAPOPATH is correctly pointing to the psp 
> directory, and anyways, why it didn't complain when he did the energy 
> calculation?
>
> And this is happening every time there is a need to read an already 
> created .nc file (I 've tried couple of more examples and I got the 
> same error)
>
> What am I doing wrong?
>
> Thanks,
> Csaba 
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users

-- 
***********************************
 
Marcin Dulak
Technical University of Denmark
Department of Physics
Building 307, Room 229
DK-2800 Kongens Lyngby
Denmark
Tel.: (+45) 4525 3157
Fax.: (+45) 4593 2399
email: Marcin.Dulak at fysik.dtu.dk

***********************************

_______________________________________________
ase-users mailing list
ase-users at listserv.fysik.dtu.dk
https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20110325/e1fd4f92/attachment.html>


More information about the ase-users mailing list