model_devi | sort models in default&support user-defined order #610
+19
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
current behavior:
1)the list of models written in input.lammps for model_devi is created by "glob" without "sort" --> may give different (random) orders in different machine environments --> would randomly alter the model being used to sample configurations (always use the first model written in imput.lammps)
---> could lead to unexpected performance, such as, when using together with "model_devi_activation_func" that allows four models to be nonequivalent.
2)when preparing input.lammps from iuser-provided template, the line begin with "pair_style deepmd" will be overwritten by dpgen, thus overwrites the user defined order of models ---> could lead to unexpected performance, such as, when using together with "model_devi_activation_func" that allows four models to be nonequivalent and users indeed expected a specific order of models.
changes:
1)sorted the list of models in default, thus always use graph.000.pb to sample configurations;
2)check weather user writes the full line of begin with "pair_style deepmd" (by checking the number of non-space words in this line), if yes, leave it be; if not, overwrites with the default settings (use graph.000.pb to sample); besides, the original error trigger is retained if key words "pair_style deepmd" are not provided in the template.