-
Notifications
You must be signed in to change notification settings - Fork 177
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
Calypso #663
Calypso #663
Conversation
wangzyphysics
commented
Mar 10, 2022
- reorganize code structure
- add unitteset
- give some necessary explainations about new keys
- fix pbs script of gpu : from '#PBS -l nodes=%d:ppn=%d:gpus=%d\n' to '#PBS -l select=%d:ncpus=%d:ngpus=%d\n'
Merge devel into master
fix typo in github actions release to conda
Change-Id: I17774bee345634e4e72bd783e8112eefaaf9f0d3 Co-authored-by: Zhengju Sha <[email protected]>
Merge recent devel into master
Merge 'calypso' from origin into 'calypso'
Codecov Report
@@ Coverage Diff @@
## devel #663 +/- ##
==========================================
+ Coverage 33.16% 33.30% +0.13%
==========================================
Files 86 92 +6
Lines 14837 16270 +1433
==========================================
+ Hits 4921 5418 +497
- Misses 9916 10852 +936
Continue to review full report at Codecov.
|
@amcadmus Should I start the code review? |
No. I have personally contacted the contributor to clarify how to improve the PR. |
dpgen/dispatcher/PBS.py
Outdated
@@ -94,7 +94,7 @@ def sub_script_head(self, res): | |||
if res['numb_gpu'] == 0: | |||
ret += '#PBS -l nodes=%d:ppn=%d\n' % (res['numb_node'], res['task_per_node']) | |||
else : | |||
ret += '#PBS -l nodes=%d:ppn=%d:gpus=%d\n' % (res['numb_node'], res['task_per_node'], res['numb_gpu']) | |||
ret += '#PBS -l select=%d:ncpus=%d:ngpus=%d\n' % (res['numb_node'], res['task_per_node'], res['numb_gpu']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not recommend change the PBS resource list here. Moreover, it is better to use deepmodeling/dpdispatcher package instead of the dispatcher in dpgen.
dpgen/generator/lib/modd_calypso.py
Outdated
f.close() | ||
os.chdir(cwd) | ||
|
||
def Analysis(iter_index,jdata,calypso_run_opt_path,calypso_model_devi_path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function names should be in lower case. Analysis
-> analysis
dpgen/generator/lib/modd_calypso.py
Outdated
calypso_run_opt_name = 'gen_stru_analy' | ||
calypso_model_devi_name = 'model_devi_results' | ||
|
||
def GenStructures(iter_index,jdata,mdata): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function names should be in lower case. GenStructures
-> gen_structures
dpgen/generator/lib/modd_calypso.py
Outdated
@@ -0,0 +1,424 @@ | |||
""" | |||
calypso model devi: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend changing the name of the file to "model_devi_calypso.py"
, so the name is self-explanatory. modd
is not a standard abbreviation in dpgen
.
dpgen/generator/lib/modd.py
Outdated
return devi | ||
|
||
|
||
def Modd(all_models,type_map): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function names should be in lower case. Modd
-> model_devi
dpgen/generator/lib/modd.py
Outdated
return devi | ||
|
||
|
||
def Modd(all_models,type_map): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that Modd
only works for the case of calypso. Please move it to module model_devi_calypso
dpgen/generator/run.py
Outdated
if model_devi_engine != 'calypso': | ||
sys_batch_size = ["auto" for aa in range(len(jdata['sys_configs']))] | ||
else: | ||
sys_batch_size = ["auto" for aa in range(3000)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does the "3000" come from?
dpgen/generator/run.py
Outdated
else: | ||
try: | ||
maxiter = max(model_devi_jobs[-1].get('times')) | ||
except Exception as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to specify which exception you want to catch.
dpgen/generator/run.py
Outdated
all_sys.append(_sys) | ||
try: | ||
all_sys.append(_sys) | ||
except: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to specify which exception you want to catch.
dpgen/generator/run.py
Outdated
try: | ||
all_sys.append(_sys) | ||
except: | ||
dlog.info('%s has different formula, so pass in line 3518'%oo) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not a good idea to hard coding the line number.
Please check the solutions : https://stackoverflow.com/questions/3056048/filename-and-line-number-of-python-script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wangzyphysics @wanghan-iapcm Please see my comments. Actually I have a lot of concerns. We may have a talk if necessary.
README.md
Outdated
@@ -378,7 +378,7 @@ In each iteration, there are three stages of work, namely, `00.train 01.model_d | |||
|
|||
+ 00.train: DP-GEN will train several (default 4) models based on initial and generated data. The only difference between these models is the random seed for neural network initialization. | |||
|
|||
+ 01.model_devi : represent for model-deviation. DP-GEN will use models obtained from 00.train to run Molecular Dynamics(default LAMMPS). Larger deviation for structure properties (default is force of atoms) means less accuracy of the models. Using this criterion, a few fructures will be selected and put into next stage `02.fp` for more accurate calculation based on First Principles. | |||
+ 01.model_devi : represent for model-deviation. Model-deviation engine in `01.model_devi` can be chosen between Molecular Dynamics(default LAMMPS) or Structures Prediction(CALYPSO). DP-GEN will use models obtained from 00.train to run Molecular Dynamics or to run structure optimization with ASE in CALYPSO. Larger deviation for structure properties (default is force of atoms) means less accuracy of the models. Using this criterion, a few fructures will be selected and put into next stage `02.fp` for more accurate calculation based on First Principles. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please change "default LAMMPS" to "LAMMPS and GROMACS" ?
dpgen/generator/lib/calypso.py
Outdated
ret+=" f.write('in kB') \n" | ||
ret+=" f.write('%15.6f' % stress[0]) \n" | ||
ret+=" f.write('%15.6f' % stress[1]) \n" | ||
ret+=" f.write('%15.6f' % stress[2]) \n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I strongly suggest put these codes in a complete script, like lib/xxx.py
, instead of making them strings like you did. On the one hand, the code is easier to read and maintain. On the other hand, users can directly run the script if they have needs.
If you need to execute the script, you can copy the script to you current path.
You can refer to
Line 1911 in 93b833a
shutil.copyfile(cvasp_file, 'cvasp.py') |
dpgen/generator/run.py
Outdated
from dpgen.generator.lib.calypso import make_run_opt_script,make_check_outcar_script | ||
from dpgen.generator.lib.calypso import _make_model_devi_native_calypso,write_model_devi_out,_make_model_devi_buffet | ||
from dpgen.generator.lib.model_devi_calypso import gen_structures,analysis | ||
from dpgen.generator.lib.write_modd import write_modd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @amcadmus suggests, such functions should be named write_model_devi_calypso
, etc.
calypso_model_devi_path = os.path.join(work_path,calypso_model_devi_name) | ||
# | ||
|
||
calypso_path = jdata.get('calypso_path') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameters about machines and environment variables should be added to machine.json
, not param.json
# write_model_devi_out(Devis,'Model_Devi.out') | ||
# os.chdir(cwd) | ||
# | ||
# os.chdir(work_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please delete all commented codes.
@@ -1327,6 +1385,68 @@ def run_model_devi (iter_index, | |||
errlog = 'model_devi.log') | |||
submission.run_submission() | |||
|
|||
def run_model_devi(iter_index,jdata,mdata): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These codes will fundamentally change DP-GEN
's protocol by adding a while
loop in run_model_devi
. Is it possible to put all calypso
commands to one single script, instead of DP-GEN
's main process?
- rename model_devi_calypso.py run_calypso.py - rename calypso.py make_calypso.py - add new file calypso_check_outcar.py calypso_run_opt.py - add new file calypso_run_model_devi.py - delete write_modd.py - modify README.md and run.py
…fy test_calypso.py
dpgen/generator/run.py
Outdated
@@ -2537,8 +2708,13 @@ def post_fp_vasp (iter_index, | |||
if all_sys is None: | |||
all_sys = _sys | |||
else: | |||
#try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to remove the commented code.
dpgen/generator/run.py
Outdated
# save ele_temp, if any | ||
# need to check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is needed to check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only a few comments are left. I agree the merging of this PR.
… fix bug in runopt script
Please fix the failure in the UTs. |