Skip to content

Commit

Permalink
Merge pull request #2 from BaozCWJ/master
Browse files Browse the repository at this point in the history
Fix
  • Loading branch information
amcadmus authored Jun 21, 2019
2 parents dd30a47 + 05031c5 commit 996a053
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 6 deletions.
42 changes: 41 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,42 @@
# dpgen
<span style="font-size:larger;">dpgen Manual</span>
========

# Table of contents
- [About dpgen](#About-dpgen)
- [genenrator](#generator)
- [auto_test](#auto_test)
- [How to write `param.json`](##How-to-write-`param.json`)
- [How to write `machine.json`](##How-to-write-`machine.json`)
- [Troubleshooting](#Troubleshooting)
# About dpgen
The deep potential generator
# generator
# auto_test
At this step, we assume that you have prepared some graph files like `graph.*.pb` and the particular pseudopotential `POTCAR`.
Then you only need one command to achieve automatic testing of physical properties.
```
python run.py param.json machine.json
```
## How to write `param.json`
We take Cu as an example to show the parameter settings of `param.json`.

The first part is the fundamental setting for particular alloy system.
```
"_comment": "models",
"potcar_map" : {
"Cu" : "/somewhere/POTCAR",
"Zr" : "/elsewhere/POTCAR"
},
"conf_dir":"the folder of configuration",
"task_type":"deepmd",
"task":"eos",
```
You need to add the specified paths of necessary `POTCAR` files in "potcar_map". The different `POTCAR` paths are separated by commas.
Then you also need to add the folder path of particular configuration, which contains `POSCAR` file. For your convenience, we recommend that you use `gen_confs.py` to generate configurations by the following command.
```
python gen_confs.py Cu
```
It will store the various configurations of the given element or alloy in **confs** folder.
## How to write `machine.json`

# Troubleshooting
49 changes: 0 additions & 49 deletions auto_test/lib/ovito_file_convert.py

This file was deleted.

48 changes: 48 additions & 0 deletions auto_test/lib/ovito_file_convert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env ovitos
'''
This Script is adapted from Alexander Stukowski, the author of OVITO.
See: http://forum.ovito.org/index.php?topic=131.0 for details.
'''
import os
import sys
import argparse
import numpy as np

from ovito.io import *

supp_ofmt = ['lammps_dump', 'lammps_data', 'vasp']
supp_exts = ['dump', 'lmp', 'poscar/POSCAR']

parser = argparse.ArgumentParser()
parser.add_argument("-m", "--ofmt", type=str,
help="the output format, supported: " + str(supp_ofmt))
parser.add_argument("INPUT", type=str,
help="the input file")
parser.add_argument("OUTPUT", type=str,
help="the output file, supported ext: " + str(supp_exts))
args = parser.parse_args()

fin = args.INPUT
fout = args.OUTPUT
if args.ofmt is not None :
ofmt = args.ofmt
else :
ext = fout.split('.')[-1]
if ext == 'dump' :
ofmt = 'lammps_dump'
elif ext == 'lmp' :
ofmt = 'lammps_data'
elif ext == 'poscar' or ext == 'POSCAR' :
ofmt = 'vasp'
if not ofmt in supp_ofmt :
raise RuntimeError ("output format " + ofmt + " is not supported. use one of " + str(supp_ofmt))

columns = None
if ofmt == "lammps_dump" :
columns=["Particle Identifier", "Particle Type", "Position.X", "Position.Y", "Position.Z"]

node = import_file(fin)
if columns is not None :
export_file(node, fout, ofmt, columns = columns)
else :
export_file(node, fout, ofmt)
4 changes: 2 additions & 2 deletions auto_test/machine.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"hostname" : "localhost",
"port" : 22,
"username": "username",
"password": "password",
"password": "password",
"work_path" : "the path of workplace",
"_comment" : "that's all"
},
Expand All @@ -28,7 +28,7 @@
"hostname" : "localhost",
"port" : 22,
"username": "username",
"password": "password",
"password": "password",
"work_path" : "the path of workplace",
"_comment" : "that's all"
},
Expand Down
4 changes: 2 additions & 2 deletions auto_test/param.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"Cu" : "/somewhere/POTCAR"
},
"conf_dir":"the folder of configuration",
"task_type":1,
"task":2,
"task_type":"deepmd",
"task":"eos",

"vasp_params": {
"ecut": 520,
Expand Down

0 comments on commit 996a053

Please sign in to comment.