add ML labeling option for vasp ml-aimd OUTCAR#282
Conversation
| ml = False | ||
| if kwargs is not None: | ||
| for key, value in kwargs.items(): | ||
| if key=="ml": | ||
| ml = value |
There was a problem hiding this comment.
These lines can be written as one line
ml = kwargs.get("ml", False)or it can be directly written in the def line
There was a problem hiding this comment.
changed the code into one line
| data['forces'], \ | ||
| tmp_virial, \ | ||
| = dpdata.vasp.outcar.get_frames(file_name, begin=begin, step=step) | ||
| = dpdata.vasp.outcar.get_frames(file_name, begin=begin, step=step,ml=ml) |
There was a problem hiding this comment.
added whitespace after the comma
|
|
||
| # we assume that the force is printed ... | ||
| def get_frames (fname, begin = 0, step = 1) : | ||
| def get_frames (fname, begin = 0, step = 1,ml = False) : |
| # all_coords.append(coord) | ||
| # all_cells.append(cell) | ||
| # all_energies.append(energy) | ||
| # all_forces.append(force) | ||
| # if virial is not None : | ||
| # all_virials.append(virial) |
There was a problem hiding this comment.
The unrelated comment block should be removed.
| energy = None | ||
| force = [] | ||
| virial = None | ||
| for idx,ii in enumerate(lines) : |
| coord, cell, energy, force, virial = analyze_block_ml(blk, ntot) | ||
| if len(coord) == 0: | ||
| break | ||
| break |
There was a problem hiding this comment.
The number of the indent is wrong.
There was a problem hiding this comment.
changed the indent into four spaces
| coord, cell, energy, force, virial = analyze_block_ml(blk, ntot) | ||
| if len(coord) == 0: | ||
| break | ||
| break |
There was a problem hiding this comment.
The number of the indent is wrong.
wanghan-iapcm
left a comment
There was a problem hiding this comment.
What is the difference between the analyze_block and analyze_block_ml. It seems that the only differences are the keyword and the number of shifted lines. If so it is recommended to merge the two functions.
Codecov Report
@@ Coverage Diff @@
## devel #282 +/- ##
==========================================
+ Coverage 81.57% 81.61% +0.03%
==========================================
Files 62 62
Lines 5173 5183 +10
==========================================
+ Hits 4220 4230 +10
Misses 953 953
Continue to review full report at Codecov.
|
|
I fixed bugs in the previous PR #278.
I also added test cases for vasp machine learning force fields MD OUTCAR
This PR intends to add labeling option for VASP machine learning force field AIMD, the default setting is the same with the original repo, which selects the first principle calculation among the MD frames as energy, force and viral labels. But one can also add option in the LabeledSystem like
to use the machine learned energy, force and viral labels.
This option obviously is not as accurate as the default fp labels, but the motivation for adding this option (for me) is mainly to sample the structures rather than use the labeled system as training set. And you only need to change a little bit to realize the function. Also, since the default setting is the same as the original one, there is little worry to use this option in a wrong way.