[ase-users] ase.Atoms set_initial_charges() issue

Noel Jakse noel.jakse at grenoble-inp.fr
Sun Dec 20 07:49:00 CET 2020


Hello everyone !

I got the two following problems in loading a Lammps dump file for 2400 
atoms of Alumina (Al203) which is a charged system, using the 
ase.io.lammpsrun module.

** *first problem :* It produces the following error:

_______________
     self.new_array(name, a, dtype, shape)
   File "/home/noel/.local/lib/python3.6/site-packages/ase/atoms.py", 
line 477, in new_array
     (a.name, a.shape, (a.shape[0:1] + shape)))
AttributeError: 'numpy.ndarray' object has no attribute 'name'
_________________

I found that this is a problem with set_initial_charges()  in "atoms.py" 
and the solution which works fine is changing

self.set_array('initial_charges', charges, float, ())

to

self.set_array('initial_charges', charges, float, charges.shape[1:])

I think it could be worth making the correction in the next release and 
I can provide all the necessary files to ASE developers for testing purpose.

** *second problem:* after loading successfully  the dump.file I got the 
list of 1000 Atoms objects. But all of them stayed with  pbc= [False, 
False, False] even if the system is purely periodic (see the dump file 
below)

For sure I can correct this manually by applying to all Atoms objects 
set_pbc([True,True,True] )

Please let me know if I missed something when calling the 
read_lammps_dump_text() module (see Python code below) or there is 
another error ?

All the best

Noel

Here is the dump file header :

____________________
ITEM: TIMESTEP
0
ITEM: NUMBER OF ATOMS
2400
ITEM: BOX BOUNDS pp pp pp
-1.7262580576050883e+00 3.1158258057573136e+01
-1.7262580576050883e+00 3.1158258057573136e+01
-1.7262580576050883e+00 3.1158258057573136e+01
ITEM: ATOMS id type q x y z
313 2 1.8 2.7509 0.333675 0.636952
665 2 1.8 4.2387 3.46046 0.192756
...
____________________


here are the python command lines :

_____________________________________

specorder = ['Ca', 'Al', 'O', 'Ti']
dump_file = 'Dump.pos'
dfile = open(dump_file, 'r')
atom_list=lmpdump.read_lammps_dump_text(dfile,slice(0, -1, 
None),specorder=specorder)




-- 
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20201220/a57808a0/attachment-0001.htm>


More information about the ase-users mailing list