Skip to content

Commit

Permalink
Merge pull request #23 from ZLI-afk/devel
Browse files Browse the repository at this point in the history
add gamma-line calculations for bcc and fcc
  • Loading branch information
kevinwenminion authored Jul 13, 2022
2 parents 8e1db56 + 37b2cdb commit 3f9add2
Show file tree
Hide file tree
Showing 38 changed files with 961 additions and 856 deletions.
34 changes: 13 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,8 @@ The bold notation of key (such aas **type_map**) means that it's a necessary key
| **use_ele_temp** | int | 0 | Currently only support fp_style vasp. 0(default): no electron temperature. 1: eletron temperature as frame parameter. 2: electron temperature as atom parameter.
| *#Data*
| init_data_prefix | String | "/sharedext4/.../data/" | Prefix of initial data directories
| ***init_data_sys*** | List of string|["CH4.POSCAR.01x01x01/.../deepmd"] |Directories of initial data. You may use either absolute or relative path here.
| ***init_data_sys*** | List of string|["CH4.POSCAR.01x01x01/.../deepmd"] |Directories of initial data. You may use either absolute or relative path here. Systems will be detected recursively in the directories.
| ***sys_format*** | String | "vasp/poscar" | Format of initial data. It will be `vasp/poscar` if not set.
| init_multi_systems | Boolean | false | If set to `true`, `init_data_sys` directories should contain sub-directories of various systems. DP-GEN will regard all of these sub-directories as inital data systems.
| init_batch_size | String of integer | [8] | Each number is the batch_size of corresponding system for training in `init_data_sys`. One recommended rule for setting the `sys_batch_size` and `init_batch_size` is that `batch_size` mutiply number of atoms ot the stucture should be larger than 32. If set to `auto`, batch size will be 32 divided by number of atoms. |
| sys_configs_prefix | String | "/sharedext4/.../data/" | Prefix of `sys_configs`
| **sys_configs** | List of list of string | [<br />["/sharedext4/.../POSCAR"], <br />["....../POSCAR"]<br />] | Containing directories of structures to be explored in iterations.Wildcard characters are supported here. |
Expand Down Expand Up @@ -571,7 +570,7 @@ The bold notation of key (such aas **type_map**) means that it's a necessary key
| **user_fp_params** | Dict | |Parameters for cp2k calculation. find detail in manual.cp2k.org. only the kind section must be set before use. we assume that you have basic knowledge for cp2k input.
| **external_input_path** | String | | Conflict with key:user_fp_params, use the template input provided by user, some rules should be followed, read the following text in detail.
| *fp_style == ABACUS*
| **user_fp_params** | Dict | |Parameters for ABACUS INPUT. find detail [Here](https://github.com/deepmodeling/abacus-develop/blob/develop/docs/input-main.md#out-descriptor). If `deepks_model` is set, the model file should be in the pseudopotential directory.
| **user_fp_params** | Dict | |Parameters for ABACUS INPUT. find detail [Here](https://github.com/deepmodeling/abacus-develop/blob/develop/docs/input-main.md#out-descriptor). If `deepks_model` is set, the model file should be in the pseudopotential directory. You can also set `KPT` file by adding `k_points` that corresponds to a list of six integers in this dictionary.
| **fp_orb_files** | List | |List of atomic orbital files. The files should be in pseudopotential directory.
| **fp_dpks_descriptor** | String | |DeePKS descriptor file name. The file should be in pseudopotential directory.

Expand Down Expand Up @@ -1086,7 +1085,6 @@ Here is an example of `param.json` for QM7 dataset:
},
"_comment": "that's all"
},
"use_clusters": true,
"fp_style": "gaussian",
"shuffle_poscar": false,
"fp_task_max": 1000,
Expand All @@ -1109,7 +1107,7 @@ Here is an example of `param.json` for QM7 dataset:
}
```

Here `pick_data` is the data to simplify and currently only supports `MultiSystems` containing `System` with `deepmd/npy` format, and `use_clusters` should always be `true`. `init_pick_number` and `iter_pick_number` are the numbers of picked frames. `e_trust_lo`, `e_trust_hi` mean the range of the deviation of the frame energy, and `f_trust_lo` and `f_trust_hi` mean the range of the max deviation of atomic forces in a frame. `fp_style` can only be `gaussian` currently. Other parameters are as the same as those of generator.
Here `pick_data` is the directory to data to simplify where the program recursively detects systems `System` with `deepmd/npy` format. `init_pick_number` and `iter_pick_number` are the numbers of picked frames. `e_trust_lo`, `e_trust_hi` mean the range of the deviation of the frame energy, and `f_trust_lo` and `f_trust_hi` mean the range of the max deviation of atomic forces in a frame. `fp_style` can only be `gaussian` currently. Other parameters are as the same as those of generator.


## Set up machine
Expand Down Expand Up @@ -1139,7 +1137,7 @@ an example of new dpgen's machine.json
```json
{
"api_version": "1.0",
"train": [
"train":
{
"command": "dp",
"machine": {
Expand All @@ -1163,9 +1161,8 @@ an example of new dpgen's machine.json
"para_deg": 3,
"source_list": ["/home/user1234/deepmd.1.2.4.env"]
}
}
],
"model_devi":[
},
"model_devi":
{
"command": "lmp",
"machine":{
Expand All @@ -1186,9 +1183,8 @@ an example of new dpgen's machine.json
"group_size": 5,
"source_list": ["/home/user1234/deepmd.1.2.4.env"]
}
}
],
"fp":[
},
"fp":
{
"command": "vasp_std",
"machine":{
Expand All @@ -1210,7 +1206,6 @@ an example of new dpgen's machine.json
"source_list": ["~/vasp.env"]
}
}
]
}
```
note1: the key "local_root" in dpgen's machine.json is always `./`
Expand All @@ -1222,7 +1217,7 @@ When switching into a new machine, you may modifying the `MACHINE`, according to
An example for `MACHINE` is:
```json
{
"train": [
"train":
{
"machine": {
"batch": "slurm",
Expand All @@ -1245,9 +1240,8 @@ An example for `MACHINE` is:
"qos": "data"
},
"command": "USERPATH/dp"
}
],
"model_devi": [
},
"model_devi":
{
"machine": {
"batch": "slurm",
Expand All @@ -1271,9 +1265,8 @@ An example for `MACHINE` is:
},
"command": "lmp_serial",
"group_size": 1
}
],
"fp": [
},
"fp":
{
"machine": {
"batch": "slurm",
Expand All @@ -1300,7 +1293,6 @@ An example for `MACHINE` is:
"command": "vasp_gpu",
"group_size": 1
}
]
}
```
Following table illustrates which key is needed for three types of machine: `train`,`model_devi` and `fp`. Each of them is a list of dicts. Each dict can be considered as an independent environmnet for calculation.
Expand Down
2 changes: 2 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@

extensions = [
'deepmodeling_sphinx',
'dargs.sphinx',
"sphinx_rtd_theme",
'myst_parser',
'sphinx.ext.autosummary',
'sphinx.ext.viewcode',
'sphinxarg.ext',
]


Expand Down
7 changes: 7 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ DPGEN's documentation
.. toctree::
:maxdepth: 2
:caption: Overview

overview/cli


.. _installation::
Expand All @@ -32,6 +34,9 @@ DPGEN's documentation
:maxdepth: 2
:caption: Init

init/init-bulk-mdata
init/init-surf-mdata
init/init-reaction-mdata

.. _autotest::

Expand All @@ -46,6 +51,8 @@ DPGEN's documentation
:maxdepth: 2
:caption: Simplify

simplify/simplify-mdata


.. _tutorial:

Expand Down
6 changes: 6 additions & 0 deletions doc/init/init-bulk-mdata.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dpgen init_bulk machine parameters
==================================

.. dargs::
:module: dpgen.data.arginfo
:func: init_bulk_mdata_arginfo
6 changes: 6 additions & 0 deletions doc/init/init-reaction-mdata.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dpgen init_reaction machine parameters
======================================

.. dargs::
:module: dpgen.data.arginfo
:func: init_reaction_mdata_arginfo
6 changes: 6 additions & 0 deletions doc/init/init-surf-mdata.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dpgen init_surf machine parameters
==================================

.. dargs::
:module: dpgen.data.arginfo
:func: init_surf_mdata_arginfo
7 changes: 7 additions & 0 deletions doc/overview/cli.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Command line interface
======================

.. argparse::
:module: dpgen.main
:func: main_parser
:prog: dpgen
1 change: 1 addition & 0 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ sphinx>=4.0.2
recommonmark
sphinx_rtd_theme
sphinx_markdown_tables
sphinx-argparse
myst-parser
deepmodeling_sphinx
.
11 changes: 4 additions & 7 deletions doc/run/example-of-machine.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ In this section, we will show you how to perform train task at a local workstati
In this example, we perform the `train` task on a local workstation.

```json
"train": [
"train":
{
"command": "dp",
"machine": {
Expand All @@ -36,8 +36,7 @@ In this example, we perform the `train` task on a local workstation.
"group_size": 1,
"source_list": ["/home/user1234/deepmd.env"]
}
}
],
},
```

The "command" for the train task in the DeePMD-kit is "dp".
Expand All @@ -51,7 +50,7 @@ In the resources parameter, "number_node", "cpu_per_node", and "gpu_per_node" sp
In this example, we perform the model_devi task at a local Slurm workstation.

```json
"model_devi": [
"model_devi":
{
"command": "lmp",
"machine": {
Expand All @@ -70,7 +69,6 @@ In this example, we perform the model_devi task at a local Slurm workstation.
"source_list": ["/home/user1234/lammps.env"]
}
}
],
```

The "command" for the model_devi task in the LAMMPS is "lmp".
Expand All @@ -84,7 +82,7 @@ In the resources parameter, we specify the name of the queue to which the task i
In this example, we perform the fp task at a remote PBS cluster that can be accessed via SSH.

```json
"fp": [
"fp":
{
"command": "mpirun -n 32 vasp_std",
"machine": {
Expand All @@ -106,7 +104,6 @@ In this example, we perform the fp task at a remote PBS cluster that can be acce
"source_list": ["/home/user1234/vasp.env"]
}
}
],
```

VASP code is used for fp task and mpi is used for parallel computing, so "mpirun -n 32" is added to specify the number of parallel threads.
Expand Down
6 changes: 6 additions & 0 deletions doc/simplify/simplify-mdata.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dpgen simplify machine parameters
=================================

.. dargs::
:module: dpgen.simplify.arginfo
:func: simplify_mdata_arginfo
9 changes: 9 additions & 0 deletions doc/toymodels/JiamengHuang_pr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
A new parameter "vol_abs" is added. If you want to use absolute volume to get EOS, you can add

"vol_abs": true,

in the "eos" part of property.json
if it's not mentioned, "False" is set defaultly
when you are using absolute volume, there will be a notation in the last line of output during "make" process, which is like

treat vol_start and vol_end as absolute volume
35 changes: 35 additions & 0 deletions dpgen/arginfo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from typing import Tuple

from dargs import Argument

from dpgen.dispatcher.Dispatcher import mdata_arginfo


def general_mdata_arginfo(name: str, tasks: Tuple[str]) -> Argument:
"""Generate arginfo for general mdata.
Parameters
----------
name : str
mdata name
tasks : tuple[str]
tuple of task keys, e.g. ("train", "model_devi", "fp")
Returns
-------
Argument
arginfo
"""

doc_api_version = "Please set to 1.0"
doc_run_mdata = "machine.json file"
arg_api_version = Argument("api_version", str, optional=False, doc=doc_api_version)

sub_fields = [arg_api_version]
doc_mdata = "Parameters of command, machine, and resources for %s"
for task in tasks:
sub_fields.append(Argument(
task, dict, optional=False, sub_fields=mdata_arginfo(),
doc=doc_mdata % task,
))
return Argument(name, dict, sub_fields=sub_fields, doc=doc_run_mdata)
15 changes: 13 additions & 2 deletions dpgen/auto_test/EOS.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def __init__(self,
self.vol_start = parameter['vol_start']
self.vol_end = parameter['vol_end']
self.vol_step = parameter['vol_step']
parameter['vol_abs'] = parameter.get('vol_abs', False)
self.vol_abs = parameter['vol_abs']
parameter['cal_type'] = parameter.get('cal_type', 'relaxation')
self.cal_type = parameter['cal_type']
default_cal_setting = {"relax_pos": True,
Expand Down Expand Up @@ -117,6 +119,10 @@ def make_confs(self,

else:
print('gen eos from ' + str(self.vol_start) + ' to ' + str(self.vol_end) + ' by every ' + str(self.vol_step))
if self.vol_abs :
dlog.info('treat vol_start and vol_end as absolute volume')
else :
dlog.info('treat vol_start and vol_end as relative volume')
equi_contcar = os.path.join(path_to_equi, 'CONTCAR')
if not os.path.exists(equi_contcar):
raise RuntimeError("please do relaxation first")
Expand All @@ -138,8 +144,13 @@ def make_confs(self,
task_list.append(output_task)
os.symlink(os.path.relpath(equi_contcar), 'POSCAR.orig')
# scale = (vol / vol_to_poscar) ** (1. / 3.)
scale = vol ** (1. / 3.)
eos_params = {'volume': vol * vol_to_poscar, 'scale': scale}

if self.vol_abs :
scale = (vol / vol_to_poscar) ** (1. / 3.)
eos_params = {'volume': vol, 'scale': scale}
else :
scale = vol ** (1. / 3.)
eos_params = {'volume': vol * vol_to_poscar, 'scale': scale}
dumpfn(eos_params, 'eos.json', indent=4)
self.parameter['scale2equi'].append(scale) # 06/22
vasp.poscar_scale('POSCAR.orig', 'POSCAR', scale)
Expand Down
Loading

0 comments on commit 3f9add2

Please sign in to comment.