Skip to content

[BUG] could not convert string to float #611

Description

@TongaoY

Bug summary

Traceback (most recent call last):
File "d:\work\keti\dm\dptrain\2024-3-3-Mg\data.py", line 5, in
data = dpdata.LabeledSystem('2024-3-3-Mg\OUTCAR', fmt = 'vasp/outcar')
File "C:\Users\13706\AppData\Roaming\Python\Python310\site-packages\dpdata\system.py", line 183, in init
self.from_fmt(
File "C:\Users\13706\AppData\Roaming\Python\Python310\site-packages\dpdata\system.py", line 220, in from_fmt
return self.from_fmt_obj(load_format(fmt), file_name, **kwargs)
File "C:\Users\13706\AppData\Roaming\Python\Python310\site-packages\dpdata\system.py", line 1113, in from_fmt_obj
data = fmtobj.from_labeled_system(file_name, **kwargs)
File "C:\Users\13706\AppData\Roaming\Python\Python310\site-packages\dpdata\plugins\vasp.py", line 79, in from_labeled_system
) = dpdata.vasp.outcar.get_frames(
File "C:\Users\13706\AppData\Roaming\Python\Python310\site-packages\dpdata\vasp\outcar.py", line 76, in get_frames
coord, cell, energy, force, virial, is_converge = analyze_block(
File "C:\Users\13706\AppData\Roaming\Python\Python310\site-packages\dpdata\vasp\outcar.py", line 174, in analyze_block
info = [float(ss) for ss in tmp_l.split()]
File "C:\Users\13706\AppData\Roaming\Python\Python310\site-packages\dpdata\vasp\outcar.py", line 174, in
info = [float(ss) for ss in tmp_l.split()]
ValueError: could not convert string to float: '-----------------------------------------------------------------------------------'
有时还会出现IndexError: list index out of range
dp.zip

dpdata Version

0.2.17

Input Files, Running Commands, Error Log, etc.

Traceback (most recent call last):
File "d:\work\keti\dm\dptrain\2024-3-3-Mg\data.py", line 5, in
data = dpdata.LabeledSystem('2024-3-3-Mg\OUTCAR', fmt = 'vasp/outcar')
File "C:\Users\13706\AppData\Roaming\Python\Python310\site-packages\dpdata\system.py", line 183, in init
self.from_fmt(
File "C:\Users\13706\AppData\Roaming\Python\Python310\site-packages\dpdata\system.py", line 220, in from_fmt
return self.from_fmt_obj(load_format(fmt), file_name, **kwargs)
File "C:\Users\13706\AppData\Roaming\Python\Python310\site-packages\dpdata\system.py", line 1113, in from_fmt_obj
data = fmtobj.from_labeled_system(file_name, **kwargs)
File "C:\Users\13706\AppData\Roaming\Python\Python310\site-packages\dpdata\plugins\vasp.py", line 79, in from_labeled_system
) = dpdata.vasp.outcar.get_frames(
File "C:\Users\13706\AppData\Roaming\Python\Python310\site-packages\dpdata\vasp\outcar.py", line 76, in get_frames
coord, cell, energy, force, virial, is_converge = analyze_block(
File "C:\Users\13706\AppData\Roaming\Python\Python310\site-packages\dpdata\vasp\outcar.py", line 174, in analyze_block
info = [float(ss) for ss in tmp_l.split()]
File "C:\Users\13706\AppData\Roaming\Python\Python310\site-packages\dpdata\vasp\outcar.py", line 174, in
info = [float(ss) for ss in tmp_l.split()]
ValueError: could not convert string to float: '-----------------------------------------------------------------------------------'
有时还会出现IndexError: list index out of range
dp.zip

Steps to Reproduce

import dpdata
import numpy as np

data = dpdata.LabeledSystem('OUTCAR', fmt = 'vasp/outcar')
print('# the data contains %d frames' % len(data))

Further Information, Files, and Links

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingvasp

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions