diff --git a/doc/autotest/Auto-test-to-do-list.md b/doc/autotest/Auto-test-to-do-list.md new file mode 100644 index 000000000..cf5d0a37c --- /dev/null +++ b/doc/autotest/Auto-test-to-do-list.md @@ -0,0 +1,37 @@ +## Auto-test-to-do-list + +For the implementation, one should do : +1. Clearly know the input/output of the function/class. How to handle exceptions. +2. Finish coding +3. Provide Unittest +4. Provide Document: what does the user provide in each section of the parameter file (json format) + +common.py +- make_* +- run_* +- post_* + +Property +- EOS +- Elastic +- Vacancy +- Interstitial +- Surface + + + +Task: +- VASP +- DEEPMD_LMP +- MEAM_LMP + + +Specific functions: +1. Property.make_confs : Make configurations needed to compute the property. + The tasks directory will be named as path_to_work/task.xxxxxx + IMPORTANT: handel the case when the directory exists. +2. Property.cmpt : Compute the property. +3. Task.make_input_file(Property.task_type): Prepare input files for a computational task. + For example, the VASP prepares INCAR. + LAMMPS (including DeePMD, MEAM...) prepares in.lammps. + The parameter of this task will be stored in 'output_dir/task.json' diff --git a/doc/autotest/Auto-test.md b/doc/autotest/Auto-test.md new file mode 100644 index 000000000..9db12748b --- /dev/null +++ b/doc/autotest/Auto-test.md @@ -0,0 +1,124 @@ +## Auto-test Overview + +Suppose that we have a potential (can be DFT, DP, MEAM ...), `autotest` helps us automatically calculate M porperties on N configurations. The folder where the `autotest` runs is called the `autotest`'s working directory. Different potentials should be tested in different working directories. + +A property is tested in three stages: `make`, `run` and `post`. `make` prepare all computational tasks that are needed to calculate the property. For example to calculate EOS, `autotest` prepare a series of tasks, each of which has a scaled configuration with certain volume, and all necessary input files necessary for starting a VAPS or LAMMPS relaxation. `run` sends all the computational tasks to remote computational resources defined in a machine configuration file like `machine.json`, and automatically collect the results when remote calculations finish. `post` calculates the desired property from the collected results. + +### Relaxation + +The relaxation of a structure should be carried out before calculating all other properties: +```bash +dpgen autotest make equi.json +dpgen autotest run relax.json machine.json +dpgen autotest post equi.json +``` +If, for some reason, the main program terminated at stage `run`, one can easily restart with the same command. +`relax.json` is the parameter file. An example for `deepmd` relaxation is given as: +```json +{ + "structures": "confs/mp-*", + "interaction": { + "type": "deepmd", + "model": "frozen_model.pb", + "type_map": {"Al": 0, "Mg": 1} + }, + "relaxation": { + } +} +``` + +where the key `structures` provides the structures to relax. `interaction` is provided with `deepmd`, and other options are `vasp`, `eam`, `meam`... + +Yuzhi: + +1. We should notice that the `interaction` here should always be considered as a unified abstract class, which means that we should avoid repeating identifing which interaction we're using in the main code. +2. The structures here should always considered as a list, and the wildcard should be supported by using `glob`. Before all calculations , there is a stage where we generate the configurations. + +The outputs of the relaxation are stored in the `mp-*/00.relaxation` directory. +```bash +ls mp-* +mp-1/relaxation mp-2/relaxation mp-3/relaxation +``` + +### Other properties + +Other properties can be computed in parallel: +```bash +dpgen autotest make properties.json +dpgen autotest run properties.json machine.json +dpgen autotest post properties.json +``` +where an example of `properties.json` is given by +```json +{ + "structures": "confs/mp-*", + "interaction": { + "type": "vasp", + "incar": "vasp_input/INCAR", + "potcar_prefix":"vasp_input", + "potcars": {"Al": "POTCAR.al", "Mg": "POTCAR.mg"} + }, + "properties": [ + { + "type": "eos", + "vol_start": 10, + "vol_end": 30, + "vol_step": 0.5 + }, + { + "type": "elastic", + "norm_deform": 2e-2, + "shear_deform": 5e-2 + } + ] +} +``` + + +The `dpgen` packed all `eos` and `elastic` task and sends them to corresponding computational resources defined in `machine.json`. The outputs of a property, taking `eos` for example, are stored in +```bash +ls mp-*/ | grep eos +mp-1/eos_00 mp-2/eos_00 mp-3/eos_00 +``` +where `00` are suffix of the task. + +### Refine the calculation of a property + +Some times we want to refine the calculation of a property from previous results. For example, when higher convergence criteria `EDIFF` and `EDIFFG` are necessary, and the new VASP calculation is desired to start from the previous output configration, rather than starting from scratch. +```bash +dpgen autotest make refine.json +dpgen autotest run refine.json machine.json +``` +with `refine.json` +```json +{ + "properties": { + "eos" : { + "init_from_suffix": "00", + "output_suffix": "01", + "vol_start": 10, + "vol_end": 30, + "vol_step": 0.5 + } + } +} +``` + + + +### Configuration filter + +Some times the configurations automatically generated are problematic. For example, the distance between the interstitial atom and the lattic is too small, then these configurations should be filtered out. One can set filters of configurations by +```json +{ + "properties": { + "intersitital" : { + "supercell": [3,3,3], + "insert_atom": ["Al"], + "conf_filters": [ + { "min_dist": 2 } + ] + } + } +} +``` diff --git a/doc/autotest/EOS-get-started-and-input-examples.md b/doc/autotest/EOS-get-started-and-input-examples.md new file mode 100644 index 000000000..e4a34226a --- /dev/null +++ b/doc/autotest/EOS-get-started-and-input-examples.md @@ -0,0 +1,28 @@ +## EOS-get-started-and-input-examples + +Equation of State (EOS) here calculates the energies of the most stable structures as a function of volume. Users can refer to Figure 4 of the [dpgen JCPC paper](https://www.sciencedirect.com/science/article/pii/S001046552030045X?via%3Dihub) for more information of EOS. + +#### An example of the input file for EOS by VASP: + +```json +{ + "structures": ["confs/mp-*","confs/std-*","confs/test-*"], + "interaction": { + "type": "vasp", + "incar": "vasp_input/INCAR", + "potcar_prefix":"vasp_input", + "potcars": {"Al": "POTCAR.al", "Mg": "POTCAR.mg"} + }, + "properties": [ + { + "type": "eos", + "vol_start": 10, + "vol_end": 30, + "vol_step": 0.5, + "change_box": true + } + ] +} +``` + +`vol_start` is the starting volume per atom in Å^3/atom, `vol_step` is the increasing step of volume and the biggest volume is smaller than `vol_end`. In the above example, 40 tasks would be generated as `task.000000` to `task.000039` with the volume `10.00, 10.50, 11.00, ..., 29.50` Å^3/atom, respectively. diff --git a/doc/autotest/EOS-make.md b/doc/autotest/EOS-make.md new file mode 100644 index 000000000..345546039 --- /dev/null +++ b/doc/autotest/EOS-make.md @@ -0,0 +1,112 @@ +## EOS-make + +**Step 1.** Before `make` in EOS, the equilibrium configuration `CONTCAR` must be present in `confs/mp-*/relaxation`. + +**Step 2.** For the input example in the previous section, when we do `make`, 40 tasks would be generated as `confs/mp-*/eos_00/task.000000, confs/mp-*/eos_00/task.000001, ... , confs/mp-*/eos_00/task.000039`. The suffix `00` is used for possible `refine` later. + +**Step 3.** If the task directory, for example `confs/mp-*/eos_00/task.000000` is not empty, the old input files in it including `INCAR`, `POSCAR`, `POTCAR`, `conf.lmp`, `in.lammps` would be deleted. + +**Step 4.** In each task directory, `POSCAR.orig` would link to `confs/mp-*/relaxation/CONTCAR`. Then the `scale` parameter can be calculated as: + +```txt +scale = (vol_current / vol_equi) ** (1. / 3.) +``` + +`vol_current` is the corresponding volume per atom of the current task and `vol_equi` is the volume per atom of the equilibrium configuration. Then the `poscar_scale` function in `dpgen.auto_test.lib.vasp` module would help to generate `POSCAR` file with `vol_current` in `confs/mp-*/eos_00/task.[0-9]*[0-9]`. + +**Step 5.** According to the task type, the input file including `INCAR`, `POTCAR` or `conf.lmp`, `in.lammps` would be written in every `confs/mp-*/eos_00/task.[0-9]*[0-9]`. + +For EOS calculations by VASP, if `change_box` is `True`, `ISIF` in VASP would be 4, else `ISIF` would be 2. The default value of `change_box` is `True`. For further information of the use of `ISIF` in VASP, we refer users to [ISIF command](https://www.vasp.at/wiki/index.php/ISIF). + +For EOS calculations by LAMMPS, when `change_box` is `True`, an example of `in.lammps` for AlMg is given as below and the `scale` parameter in line 5 is calculated by the equation above. + +```txt +clear +variable GPa2bar equal 1e4 +variable B0 equal 70 +variable bp equal 0 +variable xx equal scale +variable yeta equal 1.5*(${bp}-1) +variable Px0 equal 3*${B0}*(1-${xx})/${xx}^2*exp(${yeta}*(1-${xx})) +variable Px equal ${Px0}*${GPa2bar} +units metal +dimension 3 +boundary p p p +atom_style atomic +box tilt large +read_data conf.lmp +mass 1 1 +mass 2 1 +neigh_modify every 1 delay 0 check no +pair_style deepmd frozen_model.pb +pair_coeff +compute mype all pe +thermo 100 +thermo_style custom step pe pxx pyy pzz pxy pxz pyz lx ly lz vol c_mype +dump 1 all custom 100 dump.relax id type xs ys zs fx fy fz +min_style cg +fix 1 all box/relax iso ${Px} +minimize 1.000000e-12 1.000000e-06 5000 500000 +fix 1 all box/relax aniso ${Px} +minimize 1.000000e-12 1.000000e-06 5000 500000 +variable N equal count(all) +variable V equal vol +variable E equal "c_mype" +variable Pxx equal pxx +variable Pyy equal pyy +variable Pzz equal pzz +variable Pxy equal pxy +variable Pxz equal pxz +variable Pyz equal pyz +variable Epa equal ${E}/${N} +variable Vpa equal ${V}/${N} +print "All done" +print "Total number of atoms = ${N}" +print "Relax at Press = ${Px} Bar" +print "Final energy per atoms = ${Epa} eV" +print "Final volume per atoms = ${Vpa} A^3" +print "Final Stress (xx yy zz xy xz yz) = ${Pxx} ${Pyy} ${Pzz} ${Pxy} ${Pxz} ${Pyz}" +``` + +when `change_box` is `False`, an example of `in.lammps` for AlMg is given as: +```txt +clear +units metal +dimension 3 +boundary p p p +atom_style atomic +box tilt large +read_data conf.lmp +mass 1 1 +mass 2 1 +neigh_modify every 1 delay 0 check no +pair_style deepmd frozen_model.pb +pair_coeff +compute mype all pe +thermo 100 +thermo_style custom step pe pxx pyy pzz pxy pxz pyz lx ly lz vol c_mype +dump 1 all custom 100 dump.relax id type xs ys zs fx fy fz +min_style cg +minimize 1.000000e-12 1.000000e-06 5000 500000 +variable N equal count(all) +variable V equal vol +variable E equal "c_mype" +variable tmplx equal lx +variable tmply equal ly +variable Pxx equal pxx +variable Pyy equal pyy +variable Pzz equal pzz +variable Pxy equal pxy +variable Pxz equal pxz +variable Pyz equal pyz +variable Epa equal ${E}/${N} +variable Vpa equal ${V}/${N} +variable AA equal (${tmplx}*${tmply}) +print "All done" +print "Total number of atoms = ${N}" +print "Final energy per atoms = ${Epa}" +print "Final volume per atoms = ${Vpa}" +print "Final Base area = ${AA}" +print "Final Stress (xx yy zz xy xz yz) = ${Pxx} ${Pyy} ${Pzz} ${Pxy} ${Pxz} ${Pyz}" +``` + diff --git a/doc/autotest/EOS-post.md b/doc/autotest/EOS-post.md new file mode 100644 index 000000000..49aea8f4c --- /dev/null +++ b/doc/autotest/EOS-post.md @@ -0,0 +1,35 @@ +## EOS-post + +The post processing of EOS would go to every directory in `confs/mp-*/eos_00` and do the post processing. Let's suppose we are now in `confs/mp-100/eos_00` and there are `task.000000, task.000001,..., task.000039` in this directory. By reading `inter.json` file in every task directory, the task type can be determined and the energy and force information of every task can further be obtained. By appending the `dict` of energy and force into a list, an example of the list with 1 atom is given as: +```txt +[ + {"energy": E1, "force": [fx1, fy1, fz1]}, + {"energy": E2, "force": [fx2, fy2, fz2]}, + ... + {"energy": E40, "force": [fx40, fy40, fz40]} +] +``` +Then the volume can be calculated from the task id and the corresponding energy can be obtained from the list above. Finally, there would be `result.json` in json format and `result.out` in txt format in `confs/mp-100/eos_00` containing the EOS results. + +An example of `result.json` is give as: +```txt +{ + 10.00: -3.0245, + 10.50: -3.0216, + ... + 29.50: -7.9740 +} +``` + +An example of `result.out` is given below: + +```txt +conf_dir: confs/mp-100/eos_00 + VpA(A^3) EpA(eV) + 10.000 -3.0245 + 10.500 -3.0216 + ... ... + 29.500 -7.9740 +``` + + diff --git a/doc/autotest/EOS-run.md b/doc/autotest/EOS-run.md new file mode 100644 index 000000000..faea5a34d --- /dev/null +++ b/doc/autotest/EOS-run.md @@ -0,0 +1,5 @@ +## EOS-run + +The work path of each task should be in the form like `confs/mp-*/eos_00` and all task is in the form like `confs/mp-*/eos_00/task.[0-9]*[0-9]`. + +When we dispatch tasks, we would go through every individual work path in the list `confs/mp-*/eos_00`, and then submit `task.[0-9]*[0-9]` in each work path. diff --git a/doc/autotest/Elastic-get-started-and-input-examples.md b/doc/autotest/Elastic-get-started-and-input-examples.md new file mode 100644 index 000000000..8c93eae4b --- /dev/null +++ b/doc/autotest/Elastic-get-started-and-input-examples.md @@ -0,0 +1,30 @@ +## Elastic-get-started-and-input-examples + +Here we calculate the mechanical properties which include elastic constants (C11 to C66), bulk modulus Bv, shear modulus Gv, Youngs modulus Ev, and Poission ratio Uv of a certain crystal structure. + +#### An example of the input file for Elastic by deepmd: + +```json +{ + "structures": ["confs/mp-*","confs/std-*","confs/test-*"], + "interaction": { + "type": "deepmd", + "model": "frozen_model.pb", + "type_map": {"Al": 0, "Mg": 1} + }, + "properties": [ + { + "type": "elastic", + "norm_deform": 2e-2, + "shear_deform": 5e-2 + } + ] +} +``` + +Here the default values of `norm_deform` and `shear_deform` are **2e-3** and **5e-3**, respectively. A list of `norm_strains` and `shear_strains` would be generated as below: + +```bash +[-norm_def, -0.5 * norm_def, 0.5 * norm_def, norm_def] +[-shear_def, -0.5 * shear_def, 0.5 * shear_def, shear_def] +``` diff --git a/doc/autotest/Elastic-make.md b/doc/autotest/Elastic-make.md new file mode 100644 index 000000000..4980b5b90 --- /dev/null +++ b/doc/autotest/Elastic-make.md @@ -0,0 +1,43 @@ +## Elastic-make + +**Step 1.** The `DeformedStructureSet` module in [pymatgen.analysis.elasticity.strain](https://pymatgen.org/pymatgen.analysis.elasticity.strain.html) is used to generate a set of independently deformed structures. `equi.stress.out` file is written to record the equilibrium stress in the Elastic directory. For the example in the previous section, `equi.stress.out` should be in `confs/mp-*/elastic_00`. + +**Step 2.** If there are `init_from_suffix` and `output_suffix` parameter in the `properties` part, the [refine process](https://github.com/deepmodeling/dpgen/wiki/Refine:-get-started-and-input-examples) follows. Else, the deformed structure (`POSCAR`) and strain information (`strain.out`) are written in the task directory, for example, in `confs/mp-*/elastic_00/task.000000`. + +**Step 3.** When doing `elastic` by VASP, `ISIF=2`. When doing by LAMMPS, the following `in.lammps` would be written. + +```txt +units metal +dimension 3 +boundary p p p +atom_style atomic +box tilt large +read_data conf.lmp +mass 1 1 +mass 2 1 +neigh_modify every 1 delay 0 check no +pair_style deepmd frozen_model.pb +pair_coeff +compute mype all pe +thermo 100 +thermo_style custom step pe pxx pyy pzz pxy pxz pyz lx ly lz vol c_mype +dump 1 all custom 100 dump.relax id type xs ys zs fx fy fz +min_style cg +minimize 1.000000e-12 1.000000e-06 5000 500000 +variable N equal count(all) +variable V equal vol +variable E equal "c_mype" +variable Pxx equal pxx +variable Pyy equal pyy +variable Pzz equal pzz +variable Pxy equal pxy +variable Pxz equal pxz +variable Pyz equal pyz +variable Epa equal ${E}/${N} +variable Vpa equal ${V}/${N} +print "All done" +print "Total number of atoms = ${N}" +print "Final energy per atoms = ${Epa}" +print "Final volume per atoms = ${Vpa}" +print "Final Stress (xx yy zz xy xz yz) = ${Pxx} ${Pyy} ${Pzz} ${Pxy} ${Pxz} ${Pyz}" +``` diff --git a/doc/autotest/Elastic-post.md b/doc/autotest/Elastic-post.md new file mode 100644 index 000000000..c95a293ca --- /dev/null +++ b/doc/autotest/Elastic-post.md @@ -0,0 +1,36 @@ +## Elastic-post + +The `ElasticTensor` module in [pymatgen.analysis.elasticity.elastic](https://pymatgen.org/pymatgen.analysis.elasticity.elastic.html) is used to get the elastic tensor, Bv, and Gv. The mechanical properties of a crystal structure would be written in `result.json` in json format and `result.out` in txt format. The example of the output file is give below. + +#### result.json + +```json +{ + "elastic_tensor": [ + 130.24, 114.43, 96.89, 0.00, 0.00, 0.00, 112.91, 132.64, 97.92, 0.00, 0.00, -0.00, 96.10, 96.10, 263.48, + 0.00, 0.00, 0.00, 0.00, -0.00, -0.00, 33.50, 0.00, 0.00, 0.00, -0.00, -0.00, 0.00, 33.29, 0.00, 0.00, 0.00, + -0.00, -0.00, -0.00, 18.70], + "BV": 126.75, + "GV": 31.57, + "EV": 87.46, + "uv": 0.38 +} +``` + +The order of `elastic_tensor` is C11, C12, ..., C16, C21, C22, ..., C26, ..., C66 and the unit of Bv, Gv, Ev, and uv is GPa. + +#### result.out + +```txt +conf_dir: confs/mp-100/elastic_00 + 130.24 114.43 96.89 0.00 0.00 0.00 + 112.91 132.64 97.92 0.00 0.00 -0.00 + 96.10 96.10 263.48 0.00 0.00 0.00 + 0.00 -0.00 -0.00 33.50 0.00 0.00 + 0.00 -0.00 -0.00 0.00 33.29 0.00 + 0.00 0.00 -0.00 -0.00 -0.00 18.70 +# Bulk Modulus BV = 126.75 GPa +# Shear Modulus GV = 31.57 GPa +# Youngs Modulus EV = 87.46 GPa +# Poission Ratio uV = 0.38 +``` diff --git a/doc/autotest/Elastic-run.md b/doc/autotest/Elastic-run.md new file mode 100644 index 000000000..13e84122e --- /dev/null +++ b/doc/autotest/Elastic-run.md @@ -0,0 +1,3 @@ +## Elastic-run + +Very similar to the `run` operation of `EOS` except for in different directories. Now the work path of each task should be in the form like `confs/mp-*/elastic_00` and all task is in the form like `confs/mp-*/elastic_00/task.[0-9]*[0-9]`. diff --git a/doc/autotest/Interstitial-get-started-and-input-examples.md b/doc/autotest/Interstitial-get-started-and-input-examples.md new file mode 100644 index 000000000..37f99c43b --- /dev/null +++ b/doc/autotest/Interstitial-get-started-and-input-examples.md @@ -0,0 +1,26 @@ +## Interstitial-get-started-and-input-examples + +`Interstitial` calculates the energy difference when adding an atom into the crystal structure. We need to give the information of `supercell` (default value is [1, 1, 1]) and `insert_ele` list for the element types of the atoms added in. + +#### An example of the input file for Interstitial by deepmd: + +```json +{ + "structures": "confs/mp-*", + "interaction": { + "type": "deepmd", + "model": "frozen_model.pb", + "type_map": {"Al": 0, "Mg": 1} + }, + "properties": [ + { + "type": "interstitial", + "supercell": [1, 1, 1], + "insert_ele": ["Al","Mg"], + "conf_filters": {"min_dist": 1.5} + } + ] +} +``` + +We add a `conf_filters` parameter in `properties` part and this parameter can help to eliminate undesirable structure which can render rather difficult convergence in calculations. In the example above, **"min_dist": 1.5** means if the smallest atomic distance in the structure is less than 1.5 angstrom, the configuration would be eliminated and not used in calculations. diff --git a/doc/autotest/Interstitial-make.md b/doc/autotest/Interstitial-make.md new file mode 100644 index 000000000..fd6e6da6c --- /dev/null +++ b/doc/autotest/Interstitial-make.md @@ -0,0 +1,7 @@ +## Interstitial-make + +**Step 1.** For each element in `insert_ele` list, `InterstitialGenerator` module in [pymatgen.analysis.defects.generators](https://pymatgen.org/pymatgen.analysis.defects.generators.html) would help to generate interstitial structure. The structure would be appended into a list if it can meet the requirements in `conf_filters`. + +**Step 2.** If `refine` is `True`, we do [refine process](https://github.com/deepmodeling/dpgen/wiki/Refine:-get-started-and-input-examples). If `reprod-opt` is `True` (the default is **False**), we do [reproduce process](https://github.com/deepmodeling/dpgen/wiki/Reproduce:-get-started-and-input-examples). Else, the vacancy structure (`POSCAR`) and supercell information (`supercell.out`) are written in the task directory, for example, in `confs/mp-*/interstitial_00/task.000000` with the check and possible removing of the old input files like before. + +**Step 3.** In `interstitial` by VASP, `ISIF = 3`. In `interstitial` by LAMMPS, the same `in.lammps` as that in [EOS (change_box is True)](https://github.com/deepmodeling/dpgen/wiki/EOS:-make) would be generated with `scale` set to one. diff --git a/doc/autotest/Interstitial-post.md b/doc/autotest/Interstitial-post.md new file mode 100644 index 000000000..539e6db8a --- /dev/null +++ b/doc/autotest/Interstitial-post.md @@ -0,0 +1,21 @@ +## Interstitial-post + +For `Interstitial`, we need to calculate the energy difference between a crystal structure with and without atom added in. +The examples of the output files `result.json` in json format and `result.out` in txt format are given below. + +#### result.json +```txt +{ + "task.000000": [1.137 -297.162 -298.299], + "task.000001": [1.600 -296.699 -298.299], + ... +} +``` + +#### result.out +```txt +conf_dir: confs/mp-100/interstitial_00 +Insert_ele-Struct: Inter_E(eV) E(eV) equi_E(eV) +task.000000: 1.137 -297.162 -298.299 +task.000001: 1.600 -296.699 -298.299 +``` diff --git a/doc/autotest/Interstitial-run.md b/doc/autotest/Interstitial-run.md new file mode 100644 index 000000000..7deb8f5da --- /dev/null +++ b/doc/autotest/Interstitial-run.md @@ -0,0 +1,3 @@ +## Interstitial-run + +Very similar to the `run` operation of `EOS` except for in different directories. Now the work path of each task should be in the form like `confs/mp-*/interstitial_00` and all task is in the form like `confs/mp-*/interstitial_00/task.[0-9]*[0-9]`. diff --git a/doc/autotest/Make-run-and-post.md b/doc/autotest/Make-run-and-post.md new file mode 100644 index 000000000..fe20c1394 --- /dev/null +++ b/doc/autotest/Make-run-and-post.md @@ -0,0 +1,21 @@ +## Make-run-and-post + +There are three operations in auto test package, namely `make`, `run`, and `post`. Here we take `eos` property as an example for property type. + +### Make +The `INCAR`, `POSCAR`, `POTCAR` input files for VASP or `in.lammps`, `conf.lmp`, and the interatomic potential files for LAMMPS will be generated in the directory `confs/mp-*/relaxation/relax_task` for relaxation or `confs/mp-*/eos_00/task.[0-9]*[0-9]` for EOS. The `machine.json` file is not needed for `make`. Example: +```bash +dpgen autotest make relaxation.json +``` + +### Run +The jobs would be dispatched according to the parameter in `machine.json` file and the calculation results would be sent back. Example: +```bash +dpgen autotest run relaxation.json machine.json +``` + +### Post +The post process of calculation results would be performed. `result.json` in json format will be generated in `confs/mp-*/relaxation/relax_task` for relaxation and `result.json` in json format and `result.out` in txt format in `confs/mp-*/eos_00` for EOS. The `machine.json` file is also not needed for `post`. Example: +```bash +dpgen autotest post relaxation.json +``` diff --git a/doc/autotest/Property-get-started-and-input-examples.md b/doc/autotest/Property-get-started-and-input-examples.md new file mode 100644 index 000000000..141f85dcd --- /dev/null +++ b/doc/autotest/Property-get-started-and-input-examples.md @@ -0,0 +1,97 @@ +## Property-get-started-and-input-examples + +Here we take deepmd for example and the input file for other task types is similar. + +```json +{ + "structures": ["confs/std-*"], + "interaction": { + "type": "deepmd", + "model": "frozen_model.pb", + "deepmd_version":"1.2.0", + "type_map": {"Al": 0} + }, + "properties": [ + { + "type": "eos", + "vol_start": 0.9, + "vol_end": 1.1, + "vol_step": 0.01 + }, + { + "type": "elastic", + "norm_deform": 2e-2, + "shear_deform": 5e-2 + }, + { + "type": "vacancy", + "supercell": [3, 3, 3], + "start_confs_path": "../vasp/confs" + }, + { + "type": "interstitial", + "supercell": [3, 3, 3], + "insert_ele": ["Al"], + "conf_filters":{"min_dist": 1.5}, + "cal_setting": {"input_prop": "lammps_input/lammps_high"} + }, + { + "type": "surface", + "min_slab_size": 10, + "min_vacuum_size":11, + "max_miller": 2, + "cal_type": "static" + } + ] +} +``` +Universal key words for properties + +Key words | data structure | example | description +---|---|---|--- +**type** | String | "eos" | specifying the property type +skip | Boolean | true | whether to skip current property or not +start_confs_path | String | "../vasp/confs" | starting from the equilibrium configuration in other path only for the current property type +cal_setting["input_prop"] | String | "lammps_input/lammps_high" |input commands file for lammps +cal_setting["overwrite_interaction"] | Dict | | overwrite the interaction in the `interaction` part only for the current property type + +other parameters in `cal_setting` and `cal_type` in `relaxation` also apply in `property`. + +Key words for **EOS** + +Key words | data structure | example | description +---|---|---|--- +**vol_start** | Float | 0.9 | the starting volume related to the equilibrium structure +**vol_end** | Float | 1.1 | the biggest volume related to the equilibrium structure +**vol_step** | Float | 0.01 | the volume increment related to the equilibrium structure +**vol_abs** | Boolean | false | whether to treat vol_start and vol_end as absolute volume or not (as relative volume), default = false + +Key words for **Elastic** + +Key words | data structure | example | description +---|---|---|--- +norm_deform | Float | 2e-2 | specifying the deformation in xx, yy, zz, default = 2e-3 +shear_deform | Float | 5e-2 | specifying the deformation in other directions, default = 5e-3 + +Key words for **Vacancy** + +Key words | data structure | example | description +---|---|---|--- +supercell | Lisf of Int | [3,3,3] | the supercell to be constructed, default = [1,1,1] + +Key words for **Interstitial** + +Key words | data structure | example | description +---|---|---|--- +**insert_ele** | Lisf of String | ["Al"] | the element to be inserted +supercell | Lisf of Int | [3,3,3] | the supercell to be constructed, default = [1,1,1] +conf_filters | Dict | "min_dist": 1.5 | filter out the undesirable configuration + +Key words for **Surface** + +Key words | data structure | example | description +---|---|---|--- +**min_slab_size** | Int | 10 | minimum size of slab thickness +**min_vacuum_size** | Int | 11 | minimum size of vacuum width +pert_xz | Float | 0.01 | perturbation through xz direction used to compute surface energy, default = 0.01 +max_miller | Int | 2 | the maximum miller index diff --git a/doc/autotest/Property-make.md b/doc/autotest/Property-make.md new file mode 100644 index 000000000..935351217 --- /dev/null +++ b/doc/autotest/Property-make.md @@ -0,0 +1,163 @@ +## Property-make + +```bash +dpgen autotest make property.json +``` +**EOS output:** + +``` +confs/std-fcc/eos_00/ +|-- frozen_model.pb -> ../../../frozen_model.pb +|-- task.000000 +| |-- conf.lmp +| |-- eos.json +| |-- frozen_model.pb -> ../frozen_model.pb +| |-- in.lammps +| |-- inter.json +| |-- POSCAR +| |-- POSCAR.orig -> ../../relaxation/relax_task/CONTCAR +| `-- task.json +|-- task.000001 +| |-- conf.lmp +| |-- eos.json +| |-- frozen_model.pb -> ../frozen_model.pb +| |-- in.lammps +| |-- inter.json +| |-- POSCAR +| |-- POSCAR.orig -> ../../relaxation/relax_task/CONTCAR +| `-- task.json +... +`-- task.000019 + |-- conf.lmp + |-- eos.json + |-- frozen_model.pb -> ../frozen_model.pb + |-- in.lammps + |-- inter.json + |-- POSCAR + |-- POSCAR.orig -> ../../relaxation/relax_task/CONTCAR + `-- task.json +``` + +`eos.json` records the `volume` and `scale` of the corresponding task. + +**Elastic output:** + +``` +confs/std-fcc/elastic_00/ +|-- equi.stress.json +|-- frozen_model.pb -> ../../../frozen_model.pb +|-- in.lammps +|-- POSCAR -> ../relaxation/relax_task/CONTCAR +|-- task.000000 +| |-- conf.lmp +| |-- frozen_model.pb -> ../frozen_model.pb +| |-- in.lammps -> ../in.lammps +| |-- inter.json +| |-- POSCAR +| |-- strain.json +| `-- task.json +|-- task.000001 +| |-- conf.lmp +| |-- frozen_model.pb -> ../frozen_model.pb +| |-- in.lammps -> ../in.lammps +| |-- inter.json +| |-- POSCAR +| |-- strain.json +| `-- task.json +... +`-- task.000023 + |-- conf.lmp + |-- frozen_model.pb -> ../frozen_model.pb + |-- in.lammps -> ../in.lammps + |-- inter.json + |-- POSCAR + |-- strain.json + `-- task.json +``` + +`equi.stress.json` records the stress information of the equilibrium task and `strain.json` records the deformation information of the corresponding task. + +**Vacancy output:** + +``` +confs/std-fcc/vacancy_00/ +|-- frozen_model.pb -> ../../../frozen_model.pb +|-- in.lammps +|-- POSCAR -> ../relaxation/relax_task/CONTCAR +`-- task.000000 + |-- conf.lmp + |-- frozen_model.pb -> ../frozen_model.pb + |-- in.lammps -> ../in.lammps + |-- inter.json + |-- POSCAR + |-- supercell.json + `-- task.json +``` +`supercell.json` records the supercell size information of the corresponding task. + +**Interstitial output:** + +``` +confs/std-fcc/interstitial_00/ +|-- element.out +|-- frozen_model.pb -> ../../../frozen_model.pb +|-- in.lammps +|-- POSCAR -> ../relaxation/relax_task/CONTCAR +|-- task.000000 +| |-- conf.lmp +| |-- frozen_model.pb -> ../frozen_model.pb +| |-- in.lammps -> ../in.lammps +| |-- inter.json +| |-- POSCAR +| |-- supercell.json +| `-- task.json +`-- task.000001 + |-- conf.lmp + |-- frozen_model.pb -> ../frozen_model.pb + |-- in.lammps -> ../in.lammps + |-- inter.json + |-- POSCAR + |-- supercell.json + `-- task.json +``` + +`element.out` records the inserted element type of each task and `supercell.json` records the supercell size information of the corresponding task. + +**Surface output:** + +``` +confs/std-fcc/surface_00/ +|-- frozen_model.pb -> ../../../frozen_model.pb +|-- in.lammps +|-- POSCAR -> ../relaxation/relax_task/CONTCAR +|-- task.000000 +| |-- conf.lmp +| |-- frozen_model.pb -> ../frozen_model.pb +| |-- in.lammps -> ../in.lammps +| |-- inter.json +| |-- miller.json +| |-- POSCAR +| |-- POSCAR.tmp +| `-- task.json +|-- task.000001 +| |-- conf.lmp +| |-- frozen_model.pb -> ../frozen_model.pb +| |-- in.lammps -> ../in.lammps +| |-- inter.json +| |-- miller.json +| |-- POSCAR +| |-- POSCAR.tmp +| `-- task.json +... +`-- task.000008 + |-- conf.lmp + |-- frozen_model.pb -> ../frozen_model.pb + |-- in.lammps -> ../in.lammps + |-- inter.json + |-- miller.json + |-- POSCAR + |-- POSCAR.tmp + `-- task.json +``` + +`miller.json` records the miller index of the corresponding task. diff --git a/doc/autotest/Property-post.md b/doc/autotest/Property-post.md new file mode 100644 index 000000000..f58a9e491 --- /dev/null +++ b/doc/autotest/Property-post.md @@ -0,0 +1,247 @@ +## Property-post + +```bash +dpgen autotest post property.json +``` +**EOS output:** + +`reult.out:` + +``` +conf_dir: /root/auto_test_example/deepmd/confs/std-fcc/eos_00 + VpA(A^3) EpA(eV) + 14.808 -3.7194 + 14.973 -3.7242 + 15.138 -3.7285 + 15.302 -3.7323 + 15.467 -3.7356 + 15.631 -3.7385 + 15.796 -3.7409 + 15.960 -3.7428 + 16.125 -3.7442 + 16.289 -3.7451 + 16.454 -3.7454 + 16.618 -3.7451 + 16.783 -3.7440 + 16.947 -3.7423 + 17.112 -3.7396 + 17.277 -3.7360 + 17.441 -3.7314 + 17.606 -3.7254 + 17.770 -3.7180 + 17.935 -3.7088 + ``` + + `result.json:` + + ```json + { + "14.808453313267595": -3.7194474, + "14.972991683415014": -3.7242038, + "15.13753005356243": -3.7284845, + "15.30206842370985": -3.7322877, + "15.466606793857267": -3.7356189, + "15.631145164004685": -3.7384827, + "15.7956835341521": -3.7408759, + "15.96022190429952": -3.7427885, + "16.12476027444694": -3.7441995, + "16.289298644594354": -3.7450777, + "16.453837014741772": -3.7453815, + "16.61837538488919": -3.7450585, + "16.782913755036606": -3.7440445, + "16.947452125184025": -3.7422635, + "17.111990495331444": -3.7396287, + "17.276528865478863": -3.736038, + "17.441067235626278": -3.7313635, + "17.605605605773697": -3.7254247, + "17.770143975921115": -3.7179689, + "17.934682346068534": -3.7087655 +} +``` + +**Elastic output:** + +`result.out:` + +``` +/root/auto_test_example/deepmd/confs/std-fcc/elastic_00 + 134.91 54.33 51.80 3.57 -0.00 -0.00 + 54.56 134.60 51.80 -3.54 0.00 0.00 + 51.91 51.91 137.02 -0.00 0.00 0.00 + 3.88 -3.77 -1.28 35.41 0.00 0.00 + -0.00 0.00 0.00 0.00 35.38 3.86 + 0.00 0.00 0.00 0.00 4.03 38.38 +# Bulk Modulus BV = 80.32 GPa +# Shear Modulus GV = 38.41 GPa +# Youngs Modulus EV = 99.38 GPa +# Poission Ratio uV = 0.29 +``` + +`result.json:` + +```json +{ + "elastic_tensor": [ + 134.90955999999997, + 54.329958699999985, + 51.802386099999985, + 3.5745279599999993, + -1.3886325999999648e-05, + -1.9638233999999486e-05, + 54.55840299999999, + 134.59654699999996, + 51.7972336, + -3.53972684, + 1.839568799999963e-05, + 8.756799399999951e-05, + 51.91324859999999, + 51.913292199999994, + 137.01763799999998, + -5.090339399999969e-05, + 6.99251629999996e-05, + 3.736478699999946e-05, + 3.8780564440000007, + -3.770445632, + -1.2766205999999956, + 35.41343199999999, + 2.2479590800000023e-05, + 1.3837692000000172e-06, + -4.959999999495933e-06, + 2.5800000003918792e-06, + 1.4800000030874965e-06, + 2.9000000008417968e-06, + 35.375960199999994, + 3.8608356, + 0.0, + 0.0, + 0.0, + 0.0, + 4.02554856, + 38.375018399999995 + ], + "BV": 80.3153630222222, + "GV": 38.40582656, + "EV": 99.37716395728943, + "uV": 0.2937771799031088 +} +``` + +**Vacancy output:** + +`result.out:` + +``` +/root/auto_test_example/deepmd/confs/std-fcc/vacancy_00 +Structure: Vac_E(eV) E(eV) equi_E(eV) +[3, 3, 3]-task.000000: 0.735 -96.645 -97.380 +``` + +`result.json:` + +```json +{ + "[3, 3, 3]-task.000000": [ + 0.7352769999999964, + -96.644642, + -97.379919 + ] +} +``` + +**Interstitial output:** + +`result.out:` + +``` +/root/auto_test_example/deepmd/confs/std-fcc/interstitial_00 +Insert_ele-Struct: Inter_E(eV) E(eV) equi_E(eV) +Al-[3, 3, 3]-task.000000: 4.023 -100.848 -104.871 +Al-[3, 3, 3]-task.000001: 2.783 -102.088 -104.871 +``` + +`result.json:` + +```json +{ + "Al-[3, 3, 3]-task.000000": [ + 4.022952000000004, + -100.84773, + -104.870682 + ], + "Al-[3, 3, 3]-task.000001": [ + 2.7829520000000088, + -102.08773, + -104.870682 + ] +} +``` + +**Surface output:** + +`result.out:` + +``` +/root/auto_test_example/deepmd/confs/std-fcc/surface_00 +Miller_Indices: Surf_E(J/m^2) EpA(eV) equi_EpA(eV) +[1, 1, 1]-task.000000: 0.805 -3.604 -3.745 +[2, 2, 1]-task.000001: 0.991 -3.578 -3.745 +[1, 1, 0]-task.000002: 0.946 -3.553 -3.745 +[2, 2, -1]-task.000003: 0.987 -3.559 -3.745 +[2, 1, 1]-task.000004: 1.014 -3.563 -3.745 +[2, 1, -1]-task.000005: 1.066 -3.543 -3.745 +[2, 1, -2]-task.000006: 1.034 -3.551 -3.745 +[2, 0, -1]-task.000007: 0.957 -3.569 -3.745 +[2, -1, -1]-task.000008: 0.943 -3.577 -3.745 +``` + +`result.json:` + +```json +{ + "[1, 1, 1]-task.000000": [ + 0.8051037974207992, + -3.6035018, + -3.7453815 + ], + "[2, 2, 1]-task.000001": [ + 0.9913881928811771, + -3.5781115999999997, + -3.7453815 + ], + "[1, 1, 0]-task.000002": [ + 0.9457333586026173, + -3.5529366000000002, + -3.7453815 + ], + "[2, 2, -1]-task.000003": [ + 0.9868013100872397, + -3.5590607142857142, + -3.7453815 + ], + "[2, 1, 1]-task.000004": [ + 1.0138239046484236, + -3.563035875, + -3.7453815 + ], + "[2, 1, -1]-task.000005": [ + 1.0661817319108005, + -3.5432459166666668, + -3.7453815 + ], + "[2, 1, -2]-task.000006": [ + 1.034003253044026, + -3.550884125, + -3.7453815 + ], + "[2, 0, -1]-task.000007": [ + 0.9569958287615818, + -3.5685403333333334, + -3.7453815 + ], + "[2, -1, -1]-task.000008": [ + 0.9432935501134583, + -3.5774615714285716, + -3.7453815 + ] +} +``` diff --git a/doc/autotest/Property-run.md b/doc/autotest/Property-run.md new file mode 100644 index 000000000..95927e8ba --- /dev/null +++ b/doc/autotest/Property-run.md @@ -0,0 +1,6 @@ +## Property-run + +```bash +nohup dpgen autotest run property.json machine-ali.json > run.result 2>&1 & +``` +the result file `log.lammps`, `dump.relax`, and `outlog` would be sent back. diff --git a/doc/autotest/Property-type.md b/doc/autotest/Property-type.md new file mode 100644 index 000000000..16369b7e0 --- /dev/null +++ b/doc/autotest/Property-type.md @@ -0,0 +1,18 @@ +## Property-type + +Now the supported property types are `eos`, `elastic`, `vacancy`, `interstitial`, and `surface`. Before property tests, `relaxation` should be done first or the relaxation results should be present in the corresponding directory `confs/mp-*/relaxation/relax_task`. A file named `task.json` in json format containing the property parameter will be written in the directory of each task. Multiple property tests can be performed simultaneously and are written in the `"properties"` part of the input file. An example of `EOS` and `Elastic` tests can be given as follows (please refer to [Property](https://github.com/deepmodeling/dpgen/wiki/Property:-get-started-and-input-examples) for further information of the property parameters): +```json +"properties": [ + { + "type": "eos", + "vol_start": 0.8, + "vol_end": 1.2, + "vol_step": 0.01 + }, + { + "type": "elastic", + "norm_deform": 2e-2, + "shear_deform": 5e-2 + } + ] +``` diff --git a/doc/autotest/Refine-get-started-and-input-examples.md b/doc/autotest/Refine-get-started-and-input-examples.md new file mode 100644 index 000000000..8bce1af27 --- /dev/null +++ b/doc/autotest/Refine-get-started-and-input-examples.md @@ -0,0 +1,24 @@ +## Refine-get-started-and-input-examples + +In some cases, we want to refine the calculation results of a property based on previous results by using different convergence criteria like `EDIFF` and `EDIFFG` or higher `ENCUT`. If the parameter of `init_from_suffix` and `output_suffix` are both provided in the input file, `refine` would start based on the results in `init_from_suffix` directory and output the results to `output_suffix` directory. Otherwise, the calculation results would be output to the default suffix `00`. An example of the input file is given below: +```json +{ + "structures": ["confs/std-*"], + "interaction": { + "type": "deepmd", + "model": "frozen_model.pb", + "deepmd_version":"1.2.0", + "type_map": {"Al": 0} + }, + "properties": [ + { + "type": "vacancy", + "init_from_suffix": "00", + "output_suffix": "01", + "cal_setting": {"input_prop": "lammps_input/lammps_high"} + } + ] +} +``` + +In this example, `refine` would output the results to `vacancy_01` based on the previous results in `vacancy_00` by using a different input commands file for lammps. diff --git a/doc/autotest/Refine-make.md b/doc/autotest/Refine-make.md new file mode 100644 index 000000000..d1e058434 --- /dev/null +++ b/doc/autotest/Refine-make.md @@ -0,0 +1,23 @@ +## Refine-make + +```bash +dpgen autotest make refine.json +tree confs/std-fcc/vacancy_01/ +``` +the output will be: + +``` +confs/std-fcc/vacancy_01/ +|-- frozen_model.pb -> ../../../frozen_model.pb +|-- in.lammps +`-- task.000000 + |-- conf.lmp + |-- frozen_model.pb -> ../frozen_model.pb + |-- in.lammps -> ../in.lammps + |-- inter.json + |-- POSCAR -> ../../vacancy_00/task.000000/CONTCAR + |-- supercell.json -> ../../vacancy_00/task.000000/supercell.json + `-- task.json +``` + +an new directory `vacancy_01` would be established and the starting configuration links to previous results. diff --git a/doc/autotest/Refine-post.md b/doc/autotest/Refine-post.md new file mode 100644 index 000000000..20c7e8f92 --- /dev/null +++ b/doc/autotest/Refine-post.md @@ -0,0 +1,6 @@ +## Refine-post + +```bash +dpgen autotest post refine.json +``` +the post process of `refine` is similar to the corresponding property. diff --git a/doc/autotest/Refine-run.md b/doc/autotest/Refine-run.md new file mode 100644 index 000000000..66bb04ed9 --- /dev/null +++ b/doc/autotest/Refine-run.md @@ -0,0 +1,6 @@ +## Refine-run + +```bash +nohup dpgen autotest run refine.json machine-ali.json > run.result 2>&1 & +``` +the run process of `refine` is similar to before. diff --git a/doc/autotest/Relaxation-get-started-and-input-examples.md b/doc/autotest/Relaxation-get-started-and-input-examples.md new file mode 100644 index 000000000..288ac33da --- /dev/null +++ b/doc/autotest/Relaxation-get-started-and-input-examples.md @@ -0,0 +1,85 @@ +## Relaxation-get-started-and-input-examples + +All the property tests should be based on the equilibrium state calculated either by `VASP` or `LAMMPS`. The structure after relaxation is supposed to exist as the file like `confs/mp-*/relaxation/relax_task/CONTCAR` and the further property tests would normally start from this configuration. + +### Input example +#### An example of the input file for relaxation by VASP: + +```json +{ + "structures": ["confs/std-*"], + "interaction": { + "type": "vasp", + "incar": "vasp_input/INCAR", + "potcar_prefix": "vasp_input", + "potcars": {"Al": "POTCAR.al"} + }, + "relaxation": { + "cal_type": "relaxation", + "cal_setting": {"relax_pos": true, + "relax_shape": true, + "relax_vol": true, + "ediff": 1e-6, + "ediffg": -0.01, + "encut": 650, + "kspacing": 0.1, + "kgamma": false} + } +} +``` +For VASP relaxation and all the property calculations, **the initial INCAR file must be given by user** and the package would change the `ISIF` and `NSW` parameter according to the property type. Besides, users can also set the `cal_setting` dictionary in the `relaxation` part to make the final changes on INCAR. + +Key words | data structure | example | description +---|---|---|--- +**structures** | List of String | ["confs/std-*"] | path of different structures +**interaction** | Dict | See above | description of the task type and atomic interaction +**type** | String | "vasp" | task type +**incar** | String | "vasp_input/INCAR" | the path for INCAR file in vasp +potcar_prefix | String | "vasp_input" | the prefix of path for POTCAR file in vasp, default = "" +**potcars** | Dict | {"Al": "POTCAR.al"} | key is element type and value is potcar name +**relaxation** | Dict | See above | the calculation type and setting for relaxation +cal_type | String | "relaxation" or "static" | calculation type +cal_setting | Dict | See above | calculation setting +relax_pos | Boolean | true | relax atomic position or not, default = true for relaxation +relax_shape | Boolean | true | relax box shape or not, default = true for relaxation +relax_vol | Boolean | true | relax box volume or not, default = true for relaxation +ediff | Float | 1e-6 | set `EDIFF` parameter in INCAR files +ediffg | Float | -0.01 | set `EDIFFG` parameter in INCAR files +encut | Int | 650 | set `encut` parameter in INCAR files +kspacing | Float | 0.1 | set `KSPACING` parameter in INCAR files +kgamma | Boolean | false | set `KGAMMA` parameter in INCAR files + +#### An example of the input file for relaxation by LAMMPS: + +```json +{ + "structures": ["confs/std-*"], + "interaction": { + "type": "deepmd", + "model": "frozen_model.pb", + "in_lammps": "lammps_input/in.lammps", + "type_map": {"Al": 0} + }, + "relaxation": { + "cal_setting":{"etol": 1e-12, + "ftol": 1e-6, + "maxiter": 5000, + "maximal": 500000} + } +} +``` +**Other key words different from vasp:** + +Key words | data structure | example | description +---|---|---|--- +**model** | String or List of String | "frozen_model.pb" | model file for atomic interaction +in_lammps | String | "lammps_input/in.lammps" | input file for lammps commands +**type_map** | Dict | {"Al": 0} | key is element type and value is type number. DP starts from 0, others starts from 1 +etol | Float | 1e-12 | stopping tolerance for energy +ftol | Float | 1e-6 | stopping tolerance for force +maxiter | Int | 5000 | max iterations of minimizer +maxeval | Int | 500000 | max number of force/energy evaluations + +For LAMMPS relaxation and all the property calculations, **package will help to generate `in.lammps` file for user automatically** according to the property type. We can also make the final changes in the `minimize` setting (`minimize etol ftol maxiter maxeval`) in `in.lammps`. In addition, users can apply the input file for lammps commands in the `interaction` part. For further information of the LAMMPS relaxation, we refer users to [minimize command](https://lammps.sandia.gov/doc/minimize.html). + + diff --git a/doc/autotest/Relaxation-make.md b/doc/autotest/Relaxation-make.md new file mode 100644 index 000000000..9d80c2ec5 --- /dev/null +++ b/doc/autotest/Relaxation-make.md @@ -0,0 +1,102 @@ +## Relaxation-make + +The list of the directories storing structures are `["confs/std-*"]` in the previous example. For single element system, if `POSCAR` doesn't exist in the directories: `std-fcc`, `std-hcp`, `std-dhcp`, `std-bcc`, `std-diamond`, and `std-sc`, the package will automatically generate the standard crystal structures **`fcc`**, **`hcp`**, **`dhcp`**, **`bcc`**, **`diamond`**, and **`sc`** in the corresponding directories, respectively. In other conditions and for multi-component system (more than 1), if `POSCAR` doesn't exist, the package will terminate and print the error **"no configuration for autotest"**. + +### VASP relaxation +Take the input example of Al in the previous section, when we do `make` as follows: +```bash +dpgen autotest make relaxation.json +``` +the following files would be generated: +```bash +tree confs/std-fcc/relaxation/ +``` + +``` +confs/std-fcc/relaxation/ +|-- INCAR +|-- POTCAR +`-- relax_task + |-- INCAR -> ../INCAR + |-- inter.json + |-- KPOINTS + |-- POSCAR -> ../../POSCAR + |-- POTCAR -> ../POTCAR + `-- task.json +``` +`inter.json` records the information in the `interaction` dictionary and `task.json` records the information in the `relaxation` dictionary. + +### LAMMPS relaxation +```bash +dpgen autotest make relaxation.json +tree confs/std-fcc/ +``` +the output would be: +``` +confs/std-fcc/ +|-- POSCAR +`-- relaxation + |-- frozen_model.pb -> ../../../frozen_model.pb + |-- in.lammps + `-- relax_task + |-- conf.lmp + |-- frozen_model.pb -> ../frozen_model.pb + |-- in.lammps -> ../in.lammps + |-- inter.json + |-- POSCAR -> ../../POSCAR + `-- task.json +``` +the `conf.lmp` is the input configuration and `in.lammps` is the input command file for lammps. + +**in.lammps**: the package would generate the file `confs/mp-*/relaxation/in.lammps` as follows and we refer the user to the further information of [fix box/relax](https://lammps.sandia.gov/doc/fix_box_relax.html) function in lammps: + +```txt +clear +units metal +dimension 3 +boundary p p p +atom_style atomic +box tilt large +read_data conf.lmp +mass 1 26.982 +neigh_modify every 1 delay 0 check no +pair_style deepmd frozen_model.pb +pair_coeff +compute mype all pe +thermo 100 +thermo_style custom step pe pxx pyy pzz pxy pxz pyz lx ly lz vol c_mype +dump 1 all custom 100 dump.relax id type xs ys zs fx fy fz +min_style cg +fix 1 all box/relax iso 0.0 +minimize 1.000000e-12 1.000000e-06 5000 500000 +fix 1 all box/relax aniso 0.0 +minimize 1.000000e-12 1.000000e-06 5000 500000 +variable N equal count(all) +variable V equal vol +variable E equal "c_mype" +variable tmplx equal lx +variable tmply equal ly +variable Pxx equal pxx +variable Pyy equal pyy +variable Pzz equal pzz +variable Pxy equal pxy +variable Pxz equal pxz +variable Pyz equal pyz +variable Epa equal ${E}/${N} +variable Vpa equal ${V}/${N} +variable AA equal (${tmplx}*${tmply}) +print "All done" +print "Total number of atoms = ${N}" +print "Final energy per atoms = ${Epa}" +print "Final volume per atoms = ${Vpa}" +print "Final Base area = ${AA}" +print "Final Stress (xx yy zz xy xz yz) = ${Pxx} ${Pyy} ${Pzz} ${Pxy} ${Pxz} ${Pyz}" +``` + +If user provides lammps input command file `in.lammps`, the `thermo_style` and `dump` commands should be the same as the above file. + +**interatomic potential model**: the `frozen_model.pb` in `confs/mp-*/relaxation` would link to the `frozen_model.pb` file given in the input. + + + + diff --git a/doc/autotest/Relaxation-post.md b/doc/autotest/Relaxation-post.md new file mode 100644 index 000000000..0f1c7fe77 --- /dev/null +++ b/doc/autotest/Relaxation-post.md @@ -0,0 +1,302 @@ +## Relaxation-post + +Take `deepmd` post for example: +```bash +dpgen autotest post relaxation.json +tree confs/std-fcc/relaxation/ +``` +the output will be: +``` +confs/std-fcc/relaxation/ +|-- frozen_model.pb -> ../../../frozen_model.pb +|-- in.lammps +|-- jr.json +`-- relax_task + |-- conf.lmp + |-- CONTCAR + |-- dump.relax + |-- frozen_model.pb -> ../frozen_model.pb + |-- in.lammps -> ../in.lammps + |-- inter.json + |-- log.lammps + |-- outlog + |-- POSCAR -> ../../POSCAR + |-- result.json + `-- task.json +``` +`result.json` stores the box cell, coordinates, energy, force, virial,... information of each frame in the relaxation trajectory and `CONTCAR` is the final equilibrium configuration. + +`result.json`: + +```json +{ + "@module": "dpdata.system", + "@class": "LabeledSystem", + "data": { + "atom_numbs": [ + 1 + ], + "atom_names": [ + "Al" + ], + "atom_types": { + "@module": "numpy", + "@class": "array", + "dtype": "int64", + "data": [ + 0 + ] + }, + "orig": { + "@module": "numpy", + "@class": "array", + "dtype": "int64", + "data": [ + 0, + 0, + 0 + ] + }, + "cells": { + "@module": "numpy", + "@class": "array", + "dtype": "float64", + "data": [ + [ + [ + 2.8637824638, + 0.0, + 0.0 + ], + [ + 1.4318912319, + 2.4801083646, + 0.0 + ], + [ + 1.4318912319, + 0.8267027882, + 2.3382685902 + ] + ], + [ + [ + 2.8549207998018438, + 0.0, + 0.0 + ], + [ + 1.4274603999009239, + 2.472433938457684, + 0.0 + ], + [ + 1.4274603999009212, + 0.8241446461525599, + 2.331033071844216 + ] + ], + [ + [ + 2.854920788303194, + 0.0, + 0.0 + ], + [ + 1.427460394144466, + 2.472433928487206, + 0.0 + ], + [ + 1.427460394154763, + 0.8241446428350139, + 2.331033062460779 + ] + ] + ] + }, + "coords": { + "@module": "numpy", + "@class": "array", + "dtype": "float64", + "data": [ + [ + [ + 0.0, + 0.0, + 0.0 + ] + ], + [ + [ + 5.709841595683707e-25, + -4.3367974740910857e-19, + 0.0 + ] + ], + [ + [ + -8.673606219968035e-19, + 8.673619637565944e-19, + 8.673610853102186e-19 + ] + ] + ] + }, + "energies": { + "@module": "numpy", + "@class": "array", + "dtype": "float64", + "data": [ + -3.745029, + -3.7453815, + -3.7453815 + ] + }, + "forces": { + "@module": "numpy", + "@class": "array", + "dtype": "float64", + "data": [ + [ + [ + 0.0, + -6.93889e-18, + -3.46945e-18 + ] + ], + [ + [ + 1.38778e-17, + 6.93889e-18, + -1.73472e-17 + ] + ], + [ + [ + 1.38778e-17, + 1.73472e-17, + -4.51028e-17 + ] + ] + ] + }, + "virials": { + "@module": "numpy", + "@class": "array", + "dtype": "float64", + "data": [ + [ + [ + -0.07534992071654338, + 1.2156615579052586e-17, + 1.3904892126132796e-17 + ], + [ + 1.2156615579052586e-17, + -0.07534992071654338, + 4.61571024026576e-12 + ], + [ + 1.3904892126132796e-17, + 4.61571024026576e-12, + -0.07534992071654338 + ] + ], + [ + [ + -9.978994290457664e-08, + -3.396452753975288e-15, + 8.785831629151552e-16 + ], + [ + -3.396452753975288e-15, + -9.991375413666671e-08, + 5.4790751628409565e-12 + ], + [ + 8.785831629151552e-16, + 5.4790751628409565e-12, + -9.973497959053003e-08 + ] + ], + [ + [ + 1.506940521266962e-11, + 1.1152016233536118e-11, + -8.231900529157644e-12 + ], + [ + 1.1152016233536118e-11, + -6.517665029355618e-11, + -6.33706710415926e-12 + ], + [ + -8.231900529157644e-12, + -6.33706710415926e-12, + 5.0011471096530724e-11 + ] + ] + ] + }, + "stress": { + "@module": "numpy", + "@class": "array", + "dtype": "float64", + "data": [ + [ + [ + -7.2692250000000005, + 1.1727839e-15, + 1.3414452e-15 + ], + [ + 1.1727839e-15, + -7.2692250000000005, + 4.4529093000000003e-10 + ], + [ + 1.3414452e-15, + 4.4529093000000003e-10, + -7.2692250000000005 + ] + ], + [ + [ + -9.71695e-06, + -3.3072633e-13, + 8.5551193e-14 + ], + [ + -3.3072633e-13, + -9.729006000000001e-06, + 5.3351969e-10 + ], + [ + 8.5551193e-14, + 5.3351969e-10, + -9.711598e-06 + ] + ], + [ + [ + 1.4673689e-09, + 1.0859169e-09, + -8.0157343e-10 + ], + [ + 1.0859169e-09, + -6.3465139e-09, + -6.1706584e-10 + ], + [ + -8.0157343e-10, + -6.1706584e-10, + 4.8698191e-09 + ] + ] + ] + } + } +} +``` diff --git a/doc/autotest/Relaxation-run.md b/doc/autotest/Relaxation-run.md new file mode 100644 index 000000000..439f05bf8 --- /dev/null +++ b/doc/autotest/Relaxation-run.md @@ -0,0 +1,30 @@ +## Relaxation-run + +The work path of each task should be in the form like `confs/mp-*/relaxation` and all task is in the form like `confs/mp-*/relaxation/relax_task`. + +The `machine.json` file should be applied in this process and the machine parameters (eg. GPU or CPU) are determined according to the task type (VASP or LAMMPS). Then in each work path, the corresponding tasks would be submitted and the results would be sent back through [make_dispatcher](https://github.com/deepmodeling/dpgen/blob/devel/dpgen/dispatcher/Dispatcher.py). + +Take `deepmd` run for example: +```bash +nohup dpgen autotest run relaxation.json machine-ali.json > run.result 2>&1 & +tree confs/std-fcc/relaxation/ +``` + +the output would be: +``` +confs/std-fcc/relaxation/ +|-- frozen_model.pb -> ../../../frozen_model.pb +|-- in.lammps +|-- jr.json +`-- relax_task + |-- conf.lmp + |-- dump.relax + |-- frozen_model.pb -> ../frozen_model.pb + |-- in.lammps -> ../in.lammps + |-- inter.json + |-- log.lammps + |-- outlog + |-- POSCAR -> ../../POSCAR + `-- task.json +``` +`dump.relax` is the file storing configurations and `log.lammps` is the output file for lammps. diff --git a/doc/autotest/Reproduce-get-started-and-input-examples.md b/doc/autotest/Reproduce-get-started-and-input-examples.md new file mode 100644 index 000000000..bf71cbe04 --- /dev/null +++ b/doc/autotest/Reproduce-get-started-and-input-examples.md @@ -0,0 +1,29 @@ +## Reproduce-get-started-and-input-examples + +Some times we want to reproduce the initial results with the same configurations for cross validation. This version of auto-test package can accomplish this successfully in all property types except for `Elastic`. An input example for using `deepmd` to reproduce the `VASP` Interstitial results is given as below: +```json +{ + "structures": ["confs/std-*"], + "interaction": { + "type": "deepmd", + "model": "frozen_model.pb", + "deepmd_version":"1.2.0", + "type_map": {"Al": 0} + }, + "properties": [ + { + "type": "interstitial", + "reproduce": true, + "init_from_suffix": "00", + "init_data_path": "../vasp/confs", + "reprod_last_frame": false + } + ] +} +``` + +`reproduce` denotes whether to do `reproduce` or not and the default value is False. + +`init_data_path` is the path of VASP or LAMMPS initial data to be reproduced. `init_from_suffix` is the suffix of the initial data and the default value is "00". In this case, the VASP Interstitial results are stored in `../vasp/confs/std-*/interstitial_00` and the reproduced Interstitial results would be in `deepmd/confs/std-*/interstitial_reprod`. + +`reprod_last_frame` denotes if only the last frame is used in reproduce. The default value is True for eos and surface, but is False for vacancy and interstitial. diff --git a/doc/autotest/Reproduce-make.md b/doc/autotest/Reproduce-make.md new file mode 100644 index 000000000..aa9860559 --- /dev/null +++ b/doc/autotest/Reproduce-make.md @@ -0,0 +1,76 @@ +## Reproduce-make + +```bash +dpgen autotest make reproduce.json +tree confs/std-fcc/interstitial_reprod/ +``` +the output will be: + +``` +confs/std-fcc/interstitial_reprod/ +|-- frozen_model.pb -> ../../../frozen_model.pb +|-- in.lammps +|-- task.000000 +| |-- conf.lmp +| |-- frozen_model.pb -> ../frozen_model.pb +| |-- in.lammps -> ../in.lammps +| |-- inter.json +| |-- POSCAR +| `-- task.json +|-- task.000001 +| |-- conf.lmp +| |-- frozen_model.pb -> ../frozen_model.pb +| |-- in.lammps -> ../in.lammps +| |-- inter.json +| |-- POSCAR +| `-- task.json +... +`-- task.000038 + |-- conf.lmp + |-- frozen_model.pb -> ../frozen_model.pb + |-- in.lammps -> ../in.lammps + |-- inter.json + |-- POSCAR + `-- task.json +``` + +every singe frame in the initial data is split into each task and the following `in.lammps` would help to do the `static` calculation: + +```txt +clear +units metal +dimension 3 +boundary p p p +atom_style atomic +box tilt large +read_data conf.lmp +mass 1 26.982 +neigh_modify every 1 delay 0 check no +pair_style deepmd frozen_model.pb +pair_coeff +compute mype all pe +thermo 100 +thermo_style custom step pe pxx pyy pzz pxy pxz pyz lx ly lz vol c_mype +dump 1 all custom 100 dump.relax id type xs ys zs fx fy fz +run 0 +variable N equal count(all) +variable V equal vol +variable E equal "c_mype" +variable tmplx equal lx +variable tmply equal ly +variable Pxx equal pxx +variable Pyy equal pyy +variable Pzz equal pzz +variable Pxy equal pxy +variable Pxz equal pxz +variable Pyz equal pyz +variable Epa equal ${E}/${N} +variable Vpa equal ${V}/${N} +variable AA equal (${tmplx}*${tmply}) +print "All done" +print "Total number of atoms = ${N}" +print "Final energy per atoms = ${Epa}" +print "Final volume per atoms = ${Vpa}" +print "Final Base area = ${AA}" +print "Final Stress (xx yy zz xy xz yz) = ${Pxx} ${Pyy} ${Pzz} ${Pxy} ${Pxz} ${Pyz}" +``` diff --git a/doc/autotest/Reproduce-post.md b/doc/autotest/Reproduce-post.md new file mode 100644 index 000000000..f32ef5d90 --- /dev/null +++ b/doc/autotest/Reproduce-post.md @@ -0,0 +1,72 @@ +## Reproduce-post + +```bash +dpgen autotest post reproduce.json +``` + +the output will be: + +`result.out:` + +``` +/root/auto_test_example/deepmd/confs/std-fcc/interstitial_reprod +Reproduce: Initial_path Init_E(eV/atom) Reprod_E(eV/atom) Difference(eV/atom) +.../vasp/confs/std-fcc/interstitial_00/task.000000 -3.020 -3.240 -0.220 +.../vasp/confs/std-fcc/interstitial_00/task.000000 -3.539 -3.541 -0.002 +.../vasp/confs/std-fcc/interstitial_00/task.000000 -3.582 -3.582 -0.001 +.../vasp/confs/std-fcc/interstitial_00/task.000000 -3.582 -3.581 0.001 +.../vasp/confs/std-fcc/interstitial_00/task.000000 -3.594 -3.593 0.001 +.../vasp/confs/std-fcc/interstitial_00/task.000000 -3.594 -3.594 0.001 +.../vasp/confs/std-fcc/interstitial_00/task.000000 -3.598 -3.597 0.001 +.../vasp/confs/std-fcc/interstitial_00/task.000000 -3.600 -3.600 0.001 +.../vasp/confs/std-fcc/interstitial_00/task.000000 -3.600 -3.600 0.001 +.../vasp/confs/std-fcc/interstitial_00/task.000000 -3.601 -3.600 0.001 +.../vasp/confs/std-fcc/interstitial_00/task.000000 -3.602 -3.601 0.001 +.../vasp/confs/std-fcc/interstitial_00/task.000000 -3.603 -3.602 0.001 +.../vasp/confs/std-fcc/interstitial_00/task.000000 -3.603 -3.602 0.001 +.../vasp/confs/std-fcc/interstitial_00/task.000000 -3.603 -3.602 0.001 +.../vasp/confs/std-fcc/interstitial_00/task.000000 -3.603 -3.602 0.001 +.../vasp/confs/std-fcc/interstitial_00/task.000000 -3.603 -3.602 0.001 +.../vasp/confs/std-fcc/interstitial_00/task.000000 -3.603 -3.602 0.001 +.../vasp/confs/std-fcc/interstitial_00/task.000000 -3.603 -3.602 0.001 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.345 -3.372 -0.027 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.546 -3.556 -0.009 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.587 -3.593 -0.007 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.593 -3.599 -0.006 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.600 -3.606 -0.006 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.600 -3.606 -0.006 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.624 -3.631 -0.006 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.634 -3.640 -0.007 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.637 -3.644 -0.007 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.637 -3.644 -0.007 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.638 -3.645 -0.007 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.638 -3.645 -0.007 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.639 -3.646 -0.007 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.639 -3.646 -0.007 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.639 -3.646 -0.007 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.639 -3.646 -0.007 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.639 -3.646 -0.007 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.639 -3.646 -0.007 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.639 -3.646 -0.007 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.639 -3.646 -0.007 +.../vasp/confs/std-fcc/interstitial_00/task.000001 -3.639 -3.646 -0.007 +``` + +the comparison of the initial and reproduced results as well as the absolute path of the initial data is recorded. + +`result.json:` + +```json +{ + "/root/auto_test_example/vasp/confs/std-fcc/interstitial_00/task.000000": { + "nframes": 18, + "error": 0.0009738182472213228 + }, + "/root/auto_test_example/vasp/confs/std-fcc/interstitial_00/task.000001": { + "nframes": 21, + "error": 0.0006417039154057605 + } +} +``` + +the error analysis corresponding to the initial data is recorded and the error of the first frame is disregarded when all the frames are considered in reproduce. diff --git a/doc/autotest/Reproduce-run.md b/doc/autotest/Reproduce-run.md new file mode 100644 index 000000000..3172ab03a --- /dev/null +++ b/doc/autotest/Reproduce-run.md @@ -0,0 +1,7 @@ +## Reproduce-run + +```bash +nohup dpgen autotest run reproduce.json machine-ali.json > run.result 2>&1 & +``` + +the run process of `reproduce` is similar to before. diff --git a/doc/autotest/Surface-get-started-and-input-examples.md b/doc/autotest/Surface-get-started-and-input-examples.md new file mode 100644 index 000000000..be2f98ef5 --- /dev/null +++ b/doc/autotest/Surface-get-started-and-input-examples.md @@ -0,0 +1,26 @@ +## Surface-get-started-and-input-examples + +`Surface` calculates the surface energy. We need to give the information of `min_slab_size`, `min_vacuum_size`, `max_miller` (default value is 2), and `pert_xz` which means perturbations in xz and will help work around vasp bug. If `static-opt` parameter is given and is `True`, the static calculations of surface energies would be performed. + +#### An example of the input file for Surface by deepmd: + +```json +{ + "structures": "confs/mp-*", + "interaction": { + "type": "deepmd", + "model": "frozen_model.pb", + "type_map": {"Al": 0, "Mg": 1} + }, + "properties": [ + { + "type": "surface", + "min_slab_size": 10, + "min_vacuum_size":11, + "pert_xz": 0.01, + "max_miller": 1, + "static-opt": false + } + ] +} +``` diff --git a/doc/autotest/Surface-make.md b/doc/autotest/Surface-make.md new file mode 100644 index 000000000..c40e54d06 --- /dev/null +++ b/doc/autotest/Surface-make.md @@ -0,0 +1,7 @@ +## Surface-make + +**Step 1.** Based on the equilibrium configuration, `generate_all_slabs` module in [pymatgen.core.surface](https://pymatgen.org/pymatgen.core.surface.html) would help to generate surface structure list with using `max_miller`, `min_slab_size`, and `min_vacuum_size` parameters. + +**Step 2.** If `refine` is True, we do [refine process](https://github.com/deepmodeling/dpgen/wiki/Refine:-get-started-and-input-examples). If `reprod-opt` is True (the default is False), we do [reproduce process](https://github.com/deepmodeling/dpgen/wiki/Reproduce:-get-started-and-input-examples). Otherwise, the surface structure (`POSCAR`) with perturbations in xz and miller index information (`miller.out`) are written in the task directory, for example, in `confs/mp-*/interstitial_00/task.000000` with the check and possible removing of the old input files like before. + +**Step 3.** In `surface` by VASP, if `change_box` is True (default value is True), `ISIF=4`, if False, `ISIF=2`, and if `static-opt` is True, `NSW=0`. For `surface` by LAMMPS, when `static-opt` is False, `in.lammps` is the same as that in [Relaxation: make](https://github.com/deepmodeling/dpgen/wiki/Relaxation:-make) when `change_box` is True or the same as that in [EOS: make](https://github.com/deepmodeling/dpgen/wiki/EOS:-make) when `change_box` is False. When `static-opt` is True, the same `in.lammps` as that in `VASP to LAMMPS` of [Reproduce: make](https://github.com/deepmodeling/dpgen/wiki/Reproduce:-make) would be written. diff --git a/doc/autotest/Surface-post.md b/doc/autotest/Surface-post.md new file mode 100644 index 000000000..af27241aa --- /dev/null +++ b/doc/autotest/Surface-post.md @@ -0,0 +1,22 @@ +## Surface-post + +For `Surface`, we need to calculate the energy difference between a crystal structure with and without a surface with a certain miller index divided by the surface area. + +The examples of the output files `result.json` in json format and `result.out` in txt format are given below. + +#### result.json +```txt +{ + [1,1,1]: [1.200 -297.099 -298.299], + [1,2,1]: [1.400 -296.899 -298.299], + ... +} +``` + +#### result.out +```txt +conf_dir: confs/mp-100/surface_00 +Miller_Indices: Surf_E(J/m^2) EpA(eV) equi_EpA(eV) +[1,1,1]: 1.200 -297.099 -298.299 +[1,2,1]: 1.400 -296.899 -298.299 +``` diff --git a/doc/autotest/Surface-run.md b/doc/autotest/Surface-run.md new file mode 100644 index 000000000..5f0b84bc9 --- /dev/null +++ b/doc/autotest/Surface-run.md @@ -0,0 +1,3 @@ +## Surface-run + +Very similar to the `run` operation of `EOS` except for in different directories. Now the work path of each task should be in the form like `confs/mp-*/surface_00` and all task is in the form like `confs/mp-*/surface_00/task.[0-9]*[0-9]`. diff --git a/doc/autotest/Task-type.md b/doc/autotest/Task-type.md new file mode 100644 index 000000000..53fff9ff3 --- /dev/null +++ b/doc/autotest/Task-type.md @@ -0,0 +1,46 @@ +## Task-type + +There are now five task types implemented in the package: `vasp`, `deepmd`, `meam`, `eam_fs`, and `eam_alloy`. An `inter.json` file in json format containing the interaction parameters will be written in the directory of each task. The input examples of the `"interaction"` part of each type can be found below: + +### VASP: + +The default of `potcar_prefix` is "". +```json + "interaction": { + "type": "vasp", + "incar": "vasp_input/INCAR", + "potcar_prefix":"vasp_input", + "potcars": {"Al": "POTCAR.al", "Mg": "POTCAR.mg"} + } +``` +### deepmd: + +**Only 1** model can be used in autotest in one working directory and the default `"deepmd_version"` is **1.2.0**. + +```json + "interaction": { + "type": "deepmd", + "model": "frozen_model.pb", + "type_map": {"Al": 0, "Mg": 1}, + "deepmd_version":"1.2.0" + } +``` +### meam: +Please make sure the [USER-MEAMC package](https://lammps.sandia.gov/doc/Packages_details.html#pkg-user-meamc) has already been installed in LAMMPS. +```json + "interaction": { + "type": "meam", + "model": ["meam.lib","AlMg.meam"], + "type_map": {"Al": 1, "Mg": 2} + } +``` +### eam_fs & eam_alloy: +Please make sure the [MANYBODY package](https://lammps.sandia.gov/doc/Packages_details.html#pkg-manybody) has already been installed in LAMMPS +```json + "interaction": { + "type": "eam_fs (eam_alloy)", + "model": "AlMg.eam.fs (AlMg.eam.alloy)", + "type_map": {"Al": 1, "Mg": 2} + } +``` + diff --git a/doc/autotest/Vacancy-get-started-and-input-examples.md b/doc/autotest/Vacancy-get-started-and-input-examples.md new file mode 100644 index 000000000..b4410dddb --- /dev/null +++ b/doc/autotest/Vacancy-get-started-and-input-examples.md @@ -0,0 +1,22 @@ +## Vacancy-get-started-and-input-examples + +`Vacancy` calculates the energy difference when removing an atom from the crystal structure. We only need to give the information of `supercell` to help calculate the vacancy energy and the default value of `supercell` is [1, 1, 1]. + +#### An example of the input file for Vacancy by deepmd: + +```json +{ + "structures": "confs/mp-*", + "interaction": { + "type": "deepmd", + "model": "frozen_model.pb", + "type_map": {"Al": 0, "Mg": 1} + }, + "properties": [ + { + "type": "vacancy", + "supercell": [1, 1, 1] + } + ] +} +``` diff --git a/doc/autotest/Vacancy-make.md b/doc/autotest/Vacancy-make.md new file mode 100644 index 000000000..7b9eb0c42 --- /dev/null +++ b/doc/autotest/Vacancy-make.md @@ -0,0 +1,7 @@ +## Vacancy-make + +**Step 1.** The `VacancyGenerator` module in [pymatgen.analysis.defects.generators](https://pymatgen.org/pymatgen.analysis.defects.generators.html) is used to generate a set of structures with vacancy. + +**Step 2.** If there are `init_from_suffix` and `output_suffix` parameter in the `properties` part, the [refine process](https://github.com/deepmodeling/dpgen/wiki/Refine:-get-started-and-input-examples) follows. If reproduce is evoked, the [reproduce process](https://github.com/deepmodeling/dpgen/wiki/Reproduce:-get-started-and-input-examples) follows. Otherwise, the vacancy structure (`POSCAR`) and supercell information (`supercell.out`) are written in the task directory, for example, in `confs/mp-*/vacancy_00/task.000000` with the check and possible removing of the old input files like before. + +**Step 3.** When doing `vacancy` by VASP, `ISIF = 3`. When doing `vacancy` by LAMMPS, the same `in.lammps` as that in [EOS (change_box is True)](https://github.com/deepmodeling/dpgen/wiki/EOS:-make) would be generated with `scale` set to one. diff --git a/doc/autotest/Vacancy-post.md b/doc/autotest/Vacancy-post.md new file mode 100644 index 000000000..879e8f983 --- /dev/null +++ b/doc/autotest/Vacancy-post.md @@ -0,0 +1,21 @@ +## Vacancy-post + +For `Vacancy`, we need to calculate the energy difference between a crystal structure with and without a vacancy. +The examples of the output files `result.json` in json format and `result.out` in txt format are given below. + +#### result.json +```txt +{ + "task.000000": [2.137 -296.162 -298.299], + "task.000001": [1.500 -296.799 -298.299], + ... +} +``` + +#### result.out +```txt +conf_dir: confs/mp-100/vacancy_00 +Structure: Vac_E(eV) E(eV) equi_E(eV) +task.000000: 2.137 -296.162 -298.299 +task.000001: 1.500 -296.799 -298.299 +``` diff --git a/doc/autotest/Vacancy-run.md b/doc/autotest/Vacancy-run.md new file mode 100644 index 000000000..81b793978 --- /dev/null +++ b/doc/autotest/Vacancy-run.md @@ -0,0 +1,3 @@ +## Vacancy-run + +Very similar to the `run` operation of `EOS` except for in different directories. Now the work path of each task should be in the form like `confs/mp-*/vacancy_00` and all task is in the form like `confs/mp-*/vacancy_00/task.[0-9]*[0-9]`. diff --git a/doc/autotest/autotest.md b/doc/autotest/autotest.md new file mode 100644 index 000000000..a8cfe8c10 --- /dev/null +++ b/doc/autotest/autotest.md @@ -0,0 +1,104 @@ +## autotest + +Suppose that we have a potential (can be DFT, DP, MEAM ...), autotest helps us automatically calculate M porperties on N configurations. The folder where the autotest runs is called the autotest's working directory. Different potentials should be tested in different working directories. + +A property is tested in three stages: make, run and post. make prepare all computational tasks that are needed to calculate the property. For example to calculate EOS, autotest prepare a series of tasks, each of which has a scaled configuration with certain volume, and all necessary input files necessary for starting a VAPS or LAMMPS relaxation. run sends all the computational tasks to remote computational resources defined in a machine configuration file like machine.json, and automatically collect the results when remote calculations finish. post calculates the desired property from the collected results. + +Relaxation +The relaxation of a structure should be carried out before calculating all other properties: + +dpgen autotest make equi.json +dpgen autotest run relax.json machine.json +dpgen autotest post equi.json +If, for some reason, the main program terminated at stage run, one can easily restart with the same command. relax.json is the parameter file. An example for deepmd relaxation is given as: + +{ + "structures": "confs/mp-*", + "interaction": { + "type": "deepmd", + "model": "frozen_model.pb", + "type_map": {"Al": 0, "Mg": 1} + }, + "relaxation": { + } +} +where the key structures provides the structures to relax. interaction is provided with deepmd, and other options are vasp, eam, meam... + +Yuzhi: + +We should notice that the interaction here should always be considered as a unified abstract class, which means that we should avoid repeating identifing which interaction we're using in the main code. +The structures here should always considered as a list, and the wildcard should be supported by using glob. Before all calculations , there is a stage where we generate the configurations. +The outputs of the relaxation are stored in the mp-*/00.relaxation directory. + +ls mp-* +mp-1/relaxation mp-2/relaxation mp-3/relaxation +Other properties +Other properties can be computed in parallel: + +dpgen autotest make properties.json +dpgen autotest run properties.json machine.json +dpgen autotest post properties.json +where an example of properties.json is given by + +{ + "structures": "confs/mp-*", + "interaction": { + "type": "vasp", + "incar": "vasp_input/INCAR", + "potcar_prefix":"vasp_input", + "potcars": {"Al": "POTCAR.al", "Mg": "POTCAR.mg"} + }, + "properties": [ + { + "type": "eos", + "vol_start": 10, + "vol_end": 30, + "vol_step": 0.5 + }, + { + "type": "elastic", + "norm_deform": 2e-2, + "shear_deform": 5e-2 + } + ] +} +The dpgen packed all eos and elastic task and sends them to corresponding computational resources defined in machine.json. The outputs of a property, taking eos for example, are stored in + +ls mp-*/ | grep eos +mp-1/eos_00 mp-2/eos_00 mp-3/eos_00 +where 00 are suffix of the task. + +Refine the calculation of a property +Some times we want to refine the calculation of a property from previous results. For example, when higher convergence criteria EDIFF and EDIFFG are necessary, and the new VASP calculation is desired to start from the previous output configration, rather than starting from scratch. + +dpgen autotest make refine.json +dpgen autotest run refine.json machine.json +with refine.json + +{ + "properties": { + "eos" : { + "init_from_suffix": "00", + "output_suffix": "01", + "vol_start": 10, + "vol_end": 30, + "vol_step": 0.5 + } + } +} +Configuration filter +Some times the configurations automatically generated are problematic. For example, the distance between the interstitial atom and the lattic is too small, then these configurations should be filtered out. One can set filters of configurations by + +{ + "properties": { + "intersitital" : { + "supercell": [3,3,3], + "insert_atom": ["Al"], + "conf_filters": [ + { "min_dist": 2 } + ] + } + } +} +Footer + diff --git a/doc/autotest/index.rst b/doc/autotest/index.rst new file mode 100644 index 000000000..fbe944656 --- /dev/null +++ b/doc/autotest/index.rst @@ -0,0 +1,67 @@ +========================== +Auto test +========================== + +.. _Guidelines:: + +.. toctree:: + :maxdepth: 2 + :caption: Guidelines + + Auto-test + Auto-test-to-do-list + + +.. _Main-components:: + +.. toctree:: + :maxdepth: 2 + :caption: Main components + + Task-type + Property-type + Make-run-and-post + +.. _Structure-relaxation:: + +.. toctree:: + :maxdepth: 2 + :caption: Structure relaxation + + Relaxation-get-started-and-input-examples + Relaxation-make + Relaxation-run + Relaxation-post + +.. _Property:: + +.. toctree:: + :maxdepth: 2 + :caption: Property + + Property-get-started-and-input-examples + Property-make + Property-run + Property-post + +.. _Refine:: + +.. toctree:: + :maxdepth: 2 + :caption: Refine + + Refine-get-started-and-input-examples + Refine-make + Refine-run + Refine-post + +.. _Reproduce:: + +.. toctree:: + :maxdepth: 2 + :caption: Reproduce + + Reproduce-get-started-and-input-examples + Reproduce-make + Reproduce-run + Reproduce-post diff --git a/doc/index.rst b/doc/index.rst index 65161739d..94aa22847 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -46,6 +46,7 @@ DPGEN's documentation :maxdepth: 2 :caption: Autotest + autotest/index.rst .. _simplify::