forked from dptech-corp/dpgen2
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* implementing template lmp and plm * implement plm * add make task group from config * implement task_group from config to submit * add aliases for template fnames * fix bugs in submit * fix bugs in submit * update example * docs and examples * add missing file Co-authored-by: Han Wang <wang_han@iapcm.ac.cn>
- Loading branch information
1 parent
b9f392e
commit b3b3bb1
Showing
19 changed files
with
811 additions
and
129 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
DPGEN2 configurations | ||
===================== | ||
|
||
Op configs | ||
---------- | ||
|
||
RunDPTrain | ||
^^^^^^^^^^ | ||
.. _rundptrainargs: | ||
.. dargs:: | ||
:module: dpgen2.op.run_dp_train | ||
:func: config_args | ||
|
||
RunLmp | ||
^^^^^^ | ||
.. _runlmpargs: | ||
.. dargs:: | ||
:module: dpgen2.op.run_lmp | ||
:func: config_args | ||
|
||
RunVasp | ||
^^^^^^^ | ||
.. _runvaspargs: | ||
.. dargs:: | ||
:module: dpgen2.op.run_vasp | ||
:func: config_args | ||
|
||
|
||
Alloy configs | ||
------------- | ||
.. _alloy configs: | ||
.. dargs:: | ||
:module: dpgen2.utils.alloy_conf | ||
:func: generate_alloy_conf_args | ||
|
||
|
||
Task group configs | ||
------------------ | ||
.. _task_group_configs: | ||
.. dargs:: | ||
:module: dpgen2.exploration.task | ||
:func: task_group_args | ||
|
||
|
||
Step configs | ||
------------ | ||
.. _stepconfigargs: | ||
.. dargs:: | ||
:module: dpgen2.utils.step_config | ||
:func: step_conf_args |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import itertools, random | ||
from typing import ( | ||
List, | ||
) | ||
from . import ( | ||
ExplorationTask, | ||
ExplorationTaskGroup, | ||
) | ||
from dpgen2.constants import ( | ||
lmp_conf_name, | ||
lmp_input_name, | ||
model_name_pattern, | ||
) | ||
|
||
class ConfSamplingTaskGroup(ExplorationTaskGroup): | ||
def __init__( | ||
self, | ||
): | ||
super().__init__() | ||
self.conf_set = False | ||
|
||
def set_conf( | ||
self, | ||
conf_list : List[str], | ||
n_sample : int = None, | ||
random_sample : bool = False, | ||
): | ||
""" | ||
Set the configurations of exploration | ||
Parameters | ||
---------- | ||
conf_list str | ||
A list of file contents | ||
n_sample int | ||
Number of samples drawn from the conf list each time | ||
`make_task` is called. If set to `None`, | ||
`n_sample` is set to length of the conf_list. | ||
random_sample bool | ||
If true the confs are randomly sampled, otherwise are | ||
consecutively sampled from the conf_list | ||
""" | ||
self.conf_list = conf_list | ||
if n_sample is None: | ||
self.n_sample = len(self.conf_list) | ||
else: | ||
self.n_sample = n_sample | ||
self.random_sample = random_sample | ||
self.conf_queue = [] | ||
self.conf_set = True | ||
|
||
def _sample_confs( | ||
self, | ||
): | ||
confs = [] | ||
for ii in range(self.n_sample): | ||
if len(self.conf_queue) == 0: | ||
add_list = self.conf_list.copy() | ||
if self.random_sample: | ||
random.shuffle(add_list) | ||
self.conf_queue += add_list | ||
confs.append(self.conf_queue.pop(0)) | ||
return confs |
Oops, something went wrong.