deepmodeling/dpdata

[BUG] OUTCAR transformation

mukui123 opened this issue · 4 comments

Bug summary

I encountered an error converting OUTCAR data using DPData

IndexError: list index out of range

DeePMD-kit Version

2.0.4

TensorFlow Version

2.8.2

How did you download the software?

conda

Input Files, Running Commands, Error Log, etc.

Running Commands:

import dpdata
dsys = dpdata.LabeledSystem('OUTCAR')

Error Log:
Traceback (most recent call last):
File "", line 1, in
File "/home/wangchenyang/anaconda3/envs/deepmd/lib/python3.9/site-packages/dpdata/system.py", line 227, in init
self.from_fmt(file_name, fmt, type_map=type_map, begin= begin, step=step, **kwargs)
File "/home/wangchenyang/anaconda3/envs/deepmd/lib/python3.9/site-packages/dpdata/system.py", line 253, in from_fmt
return self.from_fmt_obj(load_format(fmt), file_name, **kwargs)
File "/home/wangchenyang/anaconda3/envs/deepmd/lib/python3.9/site-packages/dpdata/system.py", line 1013, in from_fmt_obj
data = fmtobj.from_labeled_system(file_name, **kwargs)
File "/home/wangchenyang/anaconda3/envs/deepmd/lib/python3.9/site-packages/dpdata/plugins/vasp.py", line 68, in from_labeled_system
= dpdata.vasp.outcar.get_frames(file_name, begin=begin, step=step, ml=ml)
File "/home/wangchenyang/anaconda3/envs/deepmd/lib/python3.9/site-packages/dpdata/vasp/outcar.py", line 71, in get_frames
coord, cell, energy, force, virial, is_converge = analyze_block(blk, ntot, nelm, ml)
File "/home/wangchenyang/anaconda3/envs/deepmd/lib/python3.9/site-packages/dpdata/vasp/outcar.py", line 134, in analyze_block
virial[0][2] = tmp_v[5]
IndexError: list index out of range

Steps to Reproduce

There is no steps

Further Information, Files, and Links

No response

Could you provide OUTCAR to help reproduce the problem?

Now the dpdata searches the 14th line below stress label "FORCE on cell =-STRESS in cart. coord. units (eV):" for the stress in unit kB.

However, in the provided OUTCAR, an additional line begin with vdW is printed in the contributions of the stress :

  FORCE on cell =-STRESS in cart. coord.  units (eV):
  Direction    XX          YY          ZZ          XY          YZ          ZX
  --------------------------------------------------------------------------------------
  Alpha Z   492.80899   492.80899   492.80899
  Ewald    8536.18391 11867.57817 -4214.23543  2306.51812  1745.66620  2480.45947
  Hartree 20289.49802 23931.98883  7587.98364  2034.10041  1430.79791  1905.44248
  E(xc)   -3960.71383 -3962.47977 -3959.61876     0.47636     0.91488     2.27594
  Local  -38904.62986-46019.60530-13477.98151 -4305.04525 -3138.43928 -4313.69686
  n-local -2525.59193 -2550.73776 -2554.78727     4.06867     7.95989     3.44983
  augment   330.50066   341.68472   329.89722    -4.05644    -3.65497    -3.86779
  Kinetic 15929.30340 16070.55648 15954.89871   -60.96604   -52.75084   -29.43102
  Fock        0.00000     0.00000     0.00000     0.00000     0.00000     0.00000
  vdW        -8.07804    -9.17877    -8.44233    -0.32112    -0.11783    -0.15559
  -------------------------------------------------------------------------------------
  Total     179.28132   162.61559   150.52327   -25.22529    -9.62402    44.47645
  in kB      35.90506    32.56738    30.14562    -5.05192    -1.92742     8.90740

thus the line index shift should be 15 for this OUTCAR.

@njzjz have any suggestion on how to fix? Searching for the first line below the stress label and begin with "in kB"?

Thank you very much!!!