[ase-users] Lammps Reader

Tom Daff tdd20 at cam.ac.uk
Fri Dec 29 13:08:18 CET 2017


Jon,

Have you tried adding style='atomic' as an argument to io.read?

Tom


On 19/12/17 13:24, Jonathan via ase-users wrote:
> It seems that it originates from the lammpsdata.py file not being able
> to parse it.
> 
> I think I have an older version of ASE than you as there was a change to
> this file in Nov, but the error seems to be in the same place.
> 
> Jon
> 
> On 19/12/2017 13:08, Ask Hjorth Larsen wrote:
>> Hi Jonathan, (please reply to list)
>>
>> 2017-12-19 14:04 GMT+01:00 Jonathan <jonathan.bean at york.ac.uk>:
>>> Hi Ask
>>>
>>> Below is the trace
>>>
>>> Traceback (most recent call last):
>>>    File "greens_function_probe.py", line 80, in <module>
>>>      a = read(str(abs(x1+3)) + str(abs(y1+3)) + str(abs(z1+3)) +
>>> "GFprobe" +
>>> suffix)
>>>    File
>>> "/home/jb2191/.local/lib/python2.7/site-packages/ase/io/formats.py",
>>> line 428, in read
>>>      parallel=parallel, **kwargs))
>>>    File
>>> "/home/jb2191/.local/lib/python2.7/site-packages/ase/io/formats.py",
>>> line 485, in _iread
>>>      for dct in io.read(fd, *args, **kwargs):
>>>    File
>>> "/home/jb2191/.local/lib/python2.7/site-packages/ase/io/formats.py",
>>> line 313, in wrap_read_function
>>>      yield read(filename, **kwargs)
>>>    File
>>> "/home/jb2191/.local/lib/python2.7/site-packages/ase/io/lammpsdata.py",
>>> line
>>> 167, in read_lammps_data
>>>      (style, len(fields)))
>>> TypeError: %d format: a number is required, not str
>>>
>>>
>>> The name of the file is not hard-coded but is called
>>> "000GFprobe.lammps-data"
>> I get this error instead:
>>
>> askhl at jormungandr:~$ ase -T gui 000GFprobe.lammps-data
>> Traceback (most recent call last):
>>    File "/home/askhl/src/ase/bin/ase", line 3, in <module>
>>      main()
>>    File "/home/askhl/src/ase/ase/cli/main.py", line 69, in main
>>      f(args)
>>    File "/home/askhl/src/ase/ase/gui/ag.py", line 67, in run
>>      images.read(args.filenames, string2index(args.image_number))
>>    File "/home/askhl/src/ase/ase/gui/images.py", line 145, in read
>>      i = read(filename, index, filetype)
>>    File "/home/askhl/src/ase/ase/io/formats.py", line 435, in read
>>      **kwargs))
>>    File "/home/askhl/src/ase/ase/io/formats.py", line 496, in _iread
>>      for dct in io.read(fd, *args, **kwargs):
>>    File "/home/askhl/src/ase/ase/io/formats.py", line 322, in
>> wrap_read_function
>>      yield read(filename, **kwargs)
>>    File "/home/askhl/src/ase/ase/io/lammpsdata.py", line 167, in
>> read_lammps_data
>>      "".format(style, len(fields)))
>> RuntimeError: Style 'full' not supported or invalid number of fields 5
>>
>>
>> (I probably can't help much with lammps, but maybe someone else on the
>> list can, if the full scripts/error messages are available)
>>
>> Best regards
>> Ask
>>
>>> Jonathan
>>>
>>>
>>> On 19/12/2017 13:00, Ask Hjorth Larsen wrote:
>>>> Hi,
>>>>
>>>> 2017-12-18 20:11 GMT+01:00 Jonathan via ase-users
>>>> <ase-users at listserv.fysik.dtu.dk>:
>>>>> Hello All
>>>>>
>>>>> I've just been trying to read in a lammp-data type file into the ASE
>>>>> reader
>>>>> but I am getting the following error message
>>>>>
>>>>> "TypeError: %d format: a number is required, not str"
>>>> Please provide the full stack trace and the exact command or script to
>>>> reproduce it.
>>>>
>>>> Best regards
>>>> Ask
>>>>
>>>>> But this file (see below) works fine with LAMMPS
>>>>>
>>>>> "LAMMPS Description
>>>>>
>>>>> 4 atoms
>>>>> 1 atom types
>>>>> -33.100000 33.100000 xlo xhi
>>>>> -33.100000 33.100000 ylo yhi
>>>>> -33.100000 33.100000 zlo zhi
>>>>>
>>>>> Atoms
>>>>>
>>>>> 1 1    -33.10000000   -33.10000000   -33.10000000
>>>>> 2 1    -31.44500000   -31.44500000   -31.44500000
>>>>> 3 1    -33.10000000   -33.10000000   -29.79000000
>>>>> 4 1    -31.44500000   -31.44500000   -28.13500000"
>>>>>
>>>>> Not sure whether anyone has any insights into this.
>>>>>
>>>>> Jonathan
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> ase-users mailing list
>>>>> 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
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users


More information about the ase-users mailing list