Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

model_devi | sort models in default&support user-defined order #610

Merged
merged 3 commits into from Dec 8, 2021

Conversation

Vibsteamer
Copy link
Collaborator

@Vibsteamer Vibsteamer commented Dec 7, 2021

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.

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 length),  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.
@codecov-commenter
Copy link

codecov-commenter commented Dec 7, 2021

Codecov Report

Merging #610 (19b681d) into devel (5c8faa6) will increase coverage by 0.02%.
The diff coverage is 71.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##            devel     #610      +/-   ##
==========================================
+ Coverage   33.14%   33.16%   +0.02%     
==========================================
  Files          86       86              
  Lines       14826    14837      +11     
==========================================
+ Hits         4914     4921       +7     
- Misses       9912     9916       +4     
Impacted Files Coverage Δ
dpgen/generator/run.py 65.61% <71.42%> (-0.01%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5c8faa6...19b681d. Read the comment docs.

@AnguseZhang
Copy link
Collaborator

AnguseZhang commented Dec 7, 2021

Could you please upload or update the examples for revmat-mode? Thanks!

@Vibsteamer
Copy link
Collaborator Author

Could you please upload or update the examples for revmat-mode? Thanks!

will be uploaded afterwards

@wanghan-iapcm
Copy link
Contributor

There can be any number of space between "pair_style" and "deepmd", so the length check may fail.

@Vibsteamer
Copy link
Collaborator Author

Vibsteamer commented Dec 8, 2021

There can be any number of space between "pair_style" and "deepmd", so the length check may fail.

Sorry for the misleading description of the pr.

It actually checks the 【numbers of non-space words in the line】 by 【.split()】,
thought this works for any number of space in the line

if len(lmp_lines[template_pair_deepmd_idx].split()) !=  (len(models) + len(["pair_style","deepmd","10", "model_devi.out"])):

The description of this pr is correspondingly revised.

@wanghan-iapcm wanghan-iapcm merged commit 6de10d0 into deepmodeling:devel Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants