Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ Following is an example for `PARAM`, which generates data from a typical structu
2,
2
],
"z_min": 9,
"layer_numb": 3,
"vacuum_max": 9,
"vacuum_resol": [
0.5,
Expand Down Expand Up @@ -251,7 +251,7 @@ The bold notation of key (such as **Elements**) means that it's a necessary key.
| **Elements** | List of String | ["Mg"] | Atom types
| **cell_type** | String | "hcp" | Specifying which typical structure to be generated. **Options** include fcc, hcp, bcc, sc, diamond.
| **latt** | Float | 4.479 | Lattice constant for single cell.
| **z_min** | Float | 9 | Thickness of slab (Angstrom).
| **layer_numb** | Integer | 3 | Number of equavilent layers of slab.
| **vacuum_max** | Float | 9 | Maximal thickness of vacuum (Angstrom).
| **vacuum_resol** | List of float | [0.5, 1 ] | Interval of thichness of vacuum. If size of `vacuum_resol` is 1, the interval is fixed to its value. If size of `vacuum_resol` is 2, the interval is `vacuum_resol[0]` before `mid_point`, otherwise `vacuum_resol[1]` after `mid_point`.
| **millers** | List of list of Integer | [[1,0,0]] | Miller indices.
Expand Down
Empty file added dpgen/auto_test/__init__.py
Empty file.
Empty file added dpgen/auto_test/lib/__init__.py
Empty file.
25 changes: 19 additions & 6 deletions dpgen/data/surf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
from dpgen.remote.RemoteJob import SSHSession, JobStatus, SlurmJob, PBSJob, CloudMachineJob
from pymatgen.core.surface import SlabGenerator,generate_all_slabs, Structure
from pymatgen.io.vasp import Poscar
#-----ASE-------
from pymatgen.io.ase import AseAtomsAdaptor
from ase.io import read
from ase.build import general_surface


def create_path (path) :
path += '/'
Expand Down Expand Up @@ -195,10 +200,16 @@ def make_super_cell_pymatgen (jdata) :
from_path = path_uc
from_file = os.path.join(from_path, 'POSCAR.unit')
ss = Structure.from_file(from_file)
# ase only support X type element
for i in range(len(ss)):
ss[i]='X'
ss=AseAtomsAdaptor.get_atoms(ss)


all_millers = jdata['millers']
path_sc = os.path.join(out_dir, global_dirname_02)
z_min = jdata['z_min']
#z_min = jdata['z_min']
layer_numb = jdata['layer_numb']
super_cell = jdata['super_cell']

cwd = os.getcwd()
Expand All @@ -211,11 +222,13 @@ def make_super_cell_pymatgen (jdata) :
miller_str += str(ii)
path_cur_surf = create_path('surf-'+miller_str)
os.chdir(path_cur_surf)
slabgen = SlabGenerator(ss, miller, z_min, 1e-3)
all_slabs = slabgen.get_slabs()
#slabgen = SlabGenerator(ss, miller, z_min, 1e-3)
slab=general_surface.surface(ss,indices=miller,vacuum=1e-3,layers=layer_numb)
#all_slabs = slabgen.get_slabs()
dlog.info(os.getcwd())
dlog.info("Miller %s: The slab has %s termination, use the first one" %(str(miller), len(all_slabs)))
all_slabs[0].to('POSCAR', 'POSCAR')
#dlog.info("Miller %s: The slab has %s termination, use the first one" %(str(miller), len(all_slabs)))
#all_slabs[0].to('POSCAR', 'POSCAR')
slab.write('POSCAR',vasp5=True)
if super_cell[0] > 1 or super_cell[1] > 1 :
st=Structure.from_file('POSCAR')
st.make_supercell([super_cell[0], super_cell[1], 1])
Expand Down Expand Up @@ -408,7 +421,7 @@ def pert_scaled(jdata) :
tail_elongs = np.arange(mid_point, vacuum_max, vacuum_resol[1]).tolist()
elongs = np.unique(head_elongs+tail_elongs).tolist()
else:
raise RuntimeError("the length of vacuum_resol must equal 2")
raise RuntimeError("the length of vacuum_resol must equal 1 or 2")

else:
vacuum_num = jdata['vacuum_numb']
Expand Down
Empty file added dpgen/data/tools/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion dpgen/data/tools/bcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def gen_box () :
def poscar_unit (latt) :
box = gen_box()
ret = ""
ret += "FCC : a = %f \n" % latt
ret += "BCC : a = %f \n" % latt
ret += "%.16f\n" % (latt)
ret += "%.16f %.16f %.16f\n" % (box[0][0], box[0][1], box[0][2])
ret += "%.16f %.16f %.16f\n" % (box[1][0], box[1][1], box[1][2])
Expand Down
Empty file added dpgen/dispatcher/__init__.py
Empty file.
4 changes: 2 additions & 2 deletions dpgen/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ def main():
help="Collecting data from Deep Generator.")
parser_db.add_argument('PATH', type=str,
help="root path for dpgen modeling")
parser_db.add_argument('CALCULATOR', type=str,
help="calculator used for labeling: vasp/pwscf/gaussian")
parser_db.add_argument('ENGINE', type=str,
help="engine used for labeling: vasp/pwscf/cp2k/gaussian/siesta")
parser_db.add_argument('OUTPUT', type=str,
help="output filename : file.json/file.yaml")
parser_db.add_argument("ID_PREFIX", type=str, default=None,
Expand Down
32 changes: 19 additions & 13 deletions tests/data/surf-100.POSCAR
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
Type6
1.0
2.899138 0.000000 0.000000
0.000000 2.899138 0.000000
0.000000 0.000000 16.400000
X
1.0000000000000000
4.0999999999999996 0.0000000000000000 0.0000000000000000
0.0000000000000000 4.0999999999999996 0.0000000000000000
0.0000000000000000 0.0000000000000000 10.2520000000000007
Al
6
direct
0.000000 0.000000 0.812500 Type0+
0.000000 0.000000 0.312500 Type0+
0.500000 0.500000 0.937500 Type0+
0.000000 0.000000 0.562500 Type0+
0.500000 0.500000 0.687500 Type0+
0.500000 0.500000 0.437500 Type0+
12
Cartesian
2.0499999999999998 2.0499999999999998 4.1010000000000000
0.0000000000000000 2.0499999999999998 6.1509999999999998
0.0000000000000000 0.0000000000000000 4.1010000000000000
0.0000000000000000 0.0000000000000000 8.2010000000000005
2.0499999999999998 2.0499999999999998 8.2010000000000005
2.0499999999999998 0.0000000000000000 10.2510000000000012
2.0499999999999998 0.0000000000000000 2.0510000000000002
0.0000000000000000 2.0499999999999998 10.2510000000000012
2.0499999999999998 0.0000000000000000 6.1509999999999998
2.0499999999999998 2.0499999999999998 0.0010000000000003
0.0000000000000000 2.0499999999999998 2.0510000000000002
0.0000000000000000 0.0000000000000000 0.0010000000000003
2 changes: 1 addition & 1 deletion tests/data/surf.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
1,
1
],
"z_min": 9,
"layer_numb": 3,
"vacuum_max": 9,
"vacuum_resol": [
0.5,
Expand Down