Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gamma line calculation for bcc and fcc #801

Merged
merged 66 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from 59 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
3aba792
Merge pull request #16 from deepmodeling/devel
kevinwenminion Oct 14, 2021
69120dd
Merge pull request #17 from deepmodeling/devel
kevinwenminion Oct 16, 2021
e7de746
Merge pull request #18 from deepmodeling/devel
kevinwenminion Apr 7, 2022
c0e561c
metal testing for alloys and pair_coeff compatible with the latest la…
Apr 7, 2022
bd91e06
add bcc self interstitial calculations
Apr 8, 2022
df65f37
bcc interstitial optimization and change some default parameters in lmp
Apr 9, 2022
81b50c2
fix lmp default parameters
Apr 9, 2022
fc531a8
bcc interstitial optimization
Apr 10, 2022
a3df4a8
add bcc interstitial unittest
Apr 12, 2022
da1f6c9
change default parameters in lmp
Apr 20, 2022
1ee2207
Merge pull request #20 from deepmodeling/devel
kevinwenminion May 19, 2022
d0e885e
add Gamma.py test1
ZLI-afk Jun 6, 2022
49fdc8e
add test version 1
ZLI-afk Jun 6, 2022
26820bd
add test version2
ZLI-afk Jun 7, 2022
5947113
add test version2
ZLI-afk Jun 7, 2022
d55eec1
add test version4
ZLI-afk Jun 7, 2022
bf086ab
add test version5
ZLI-afk Jun 7, 2022
a9e29b5
add Gamma.py v1.0
ZLI-afk Jun 7, 2022
f9b178a
add Gamma.py v1.1 half z judgement
ZLI-afk Jun 7, 2022
8b3848d
add pos fix function
ZLI-afk Jun 11, 2022
1a43ccd
update pos fix function to post_process
ZLI-afk Jun 11, 2022
0492ab9
update pos fix function to post_process
ZLI-afk Jun 16, 2022
dd67e3a
add supercell function for md calculation
ZLI-afk Jun 18, 2022
f292258
add supercell function for md calculation
ZLI-afk Jun 18, 2022
172ee2a
fix bugs
ZLI-afk Jun 22, 2022
7a01cb6
change modelling method from pymatgen to ase
ZLI-afk Jun 24, 2022
cd4760f
fix bugs and add slab centralization function
ZLI-afk Jun 25, 2022
aa91cc6
revise workflow for different input structure
ZLI-afk Jun 25, 2022
1ffa2b3
fix bugs
ZLI-afk Jun 25, 2022
1844c4b
fix bugs and beta version
ZLI-afk Jun 25, 2022
c997450
change add_fix input format
ZLI-afk Jun 27, 2022
8dc0546
fix bugs
ZLI-afk Jun 27, 2022
26368cc
fix bugs
ZLI-afk Jun 28, 2022
badcd37
Merge pull request #21 from ZLI-afk/devel
kevinwenminion Jul 3, 2022
42f1369
add unittest for Gamma.py
ZLI-afk Jul 3, 2022
28a3f97
fix bugs
ZLI-afk Jul 3, 2022
93351c8
some optimizations in gamma line
Jul 3, 2022
8e1db56
Merge branch 'devel' into devel
ZLI-afk Jul 3, 2022
f52ff48
Merge pull request #1 from kevinwenminion/devel
ZLI-afk Jul 4, 2022
4948c81
refactor simplify (#730)
njzjz Jun 9, 2022
8a27df3
supports non-list mdata (#748)
njzjz Jun 9, 2022
a0c7333
upgrade all tasks to dpdispatcher (#749)
njzjz Jun 9, 2022
f5feb9c
update: add a new option of absolute volume in /dpgen/dpgen/auto_test…
HuangJiameng Jun 12, 2022
7d986d9
fix a bug in make_abacus_scf_input (#754)
Liu-RX Jun 14, 2022
ec16005
init_reaction: fix compatibility with new dpdispatcher (#755)
njzjz Jun 14, 2022
d43fb52
generate machine parameter docs for simplify and init (#751)
njzjz Jun 19, 2022
4a5557e
add auto cli docs (#759)
njzjz Jun 21, 2022
5ed5fa1
correct the wrong spelling of 'failure' (#764)
HuangJiameng Jun 29, 2022
3dec4b8
upgrade machine examples to new dpdispatcher (#762)
njzjz Jul 1, 2022
9cace60
fix ‘post_fp_cp2k’, add param rfailed (#765)
HuangJiameng Jul 1, 2022
4fbc171
Merge branch 'deepmodeling:devel' into devel
ZLI-afk Jul 4, 2022
3cb8b90
improve direction dictionary
ZLI-afk Jul 4, 2022
26823b7
fix typos
ZLI-afk Jul 5, 2022
479df75
fix 111 directions and post bugs
ZLI-afk Jul 12, 2022
37b2cdb
fix post bugs
ZLI-afk Jul 12, 2022
3f9add2
Merge pull request #23 from ZLI-afk/devel
kevinwenminion Jul 13, 2022
a64a536
fix typo
Jul 13, 2022
8200dca
fix left-hand coords bugs of fcc 110 direction gamma line slab genera…
ZLI-afk Jul 13, 2022
b00f46a
Merge pull request #24 from ZLI-afk/devel
kevinwenminion Jul 13, 2022
ec27b96
improve the gamma line code
Jul 28, 2022
b9155d7
fix typo
Jul 13, 2022
e64d041
improve the gamma line code
Jul 28, 2022
cfe6a83
add unitest for Gamma._compute_lower
ZLI-afk Jul 29, 2022
bb492b1
Merge pull request #25 from ZLI-afk/devel
kevinwenminion Jul 29, 2022
bcd94c4
decrease the number of files in unittest gamma line
Jul 29, 2022
5646f1d
delete files in unittest
Jul 29, 2022
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
383 changes: 383 additions & 0 deletions dpgen/auto_test/Gamma.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dpgen/auto_test/Lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ def make_input_file(self,

# dumpfn(task_param, os.path.join(output_dir, 'task.json'), indent=4)

etol = 1e-12
ftol = 1e-6
etol = 0
ftol = 1e-10
maxiter = 5000
maxeval = 500000
B0 = 70
Expand Down
17 changes: 10 additions & 7 deletions dpgen/auto_test/common_prop.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from dpgen.auto_test.Interstitial import Interstitial
from dpgen.auto_test.Surface import Surface
from dpgen.auto_test.Vacancy import Vacancy
from dpgen.auto_test.Gamma import Gamma
from dpgen.auto_test.calculator import make_calculator
from dpgen.dispatcher.Dispatcher import make_dispatcher
from dpgen.dispatcher.Dispatcher import make_submission
Expand All @@ -19,21 +20,23 @@
lammps_task_type = ['deepmd', 'meam', 'eam_fs', 'eam_alloy']


def make_property_instance(paramters):
def make_property_instance(parameters):
"""
Make an instance of Property
"""
prop_type = paramters['type']
prop_type = parameters['type']
if prop_type == 'eos':
return EOS(paramters)
return EOS(parameters)
elif prop_type == 'elastic':
return Elastic(paramters)
return Elastic(parameters)
elif prop_type == 'vacancy':
return Vacancy(paramters)
return Vacancy(parameters)
elif prop_type == 'interstitial':
return Interstitial(paramters)
return Interstitial(parameters)
elif prop_type == 'surface':
return Surface(paramters)
return Surface(parameters)
elif prop_type == 'gamma':
return Gamma(parameters)
else:
raise RuntimeError(f'unknown property type {prop_type}')

Expand Down
13 changes: 13 additions & 0 deletions tests/auto_test/confs/hp-Mo/POSCAR
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Mo2
1.0000000000000000
3.1623672675177916 -0.0000000000000000 -0.0000000000000000
-0.0000000000000000 3.1623672675177916 -0.0000000000000000
0.0000000000000000 0.0000000000000000 3.1623672675177916
Mo
2
Direct
0.0000000000000000 0.0000000000000000 0.0000000000000000
0.5000000000000000 0.5000000000000000 0.5000000000000000

0.00000000E+00 0.00000000E+00 0.00000000E+00
0.00000000E+00 0.00000000E+00 0.00000000E+00
12 changes: 12 additions & 0 deletions tests/auto_test/confs/std-fcc/relaxation/relax_task/CONTCAR
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Mo4
1.0
4.0028914311881421e+00 0.0000000000000000e+00 0.0000000000000000e+00
-3.3847683075468209e-17 4.0028914311881421e+00 0.0000000000000000e+00
-2.3607623963217771e-17 -2.9295144479997265e-17 4.0028914311881421e+00
Mo
4
Cartesian
4.0028914312 4.0028914312 4.0028914312
4.0028914312 2.0014457156 2.0014457156
2.0014457156 4.0028914312 2.0014457156
2.0014457156 2.0014457156 4.0028914312
10 changes: 10 additions & 0 deletions tests/auto_test/equi/vasp/CONTCAR_Mo_bcc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Mo2
1.0
3.1617699325125632e+00 0.0000000000000000e+00 0.0000000000000000e+00
-2.9607253805968378e-17 3.1617699325125632e+00 0.0000000000000000e+00
-6.1517551630255350e-18 -4.3742379676789617e-17 3.1617699325125632e+00
Mo
2
Cartesian
0.0000000000 0.0000000000 0.0000000000
1.5808849663 1.5808849663 1.5808849663
101 changes: 101 additions & 0 deletions tests/auto_test/test_gamma.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import os, sys, json, glob, shutil
import dpdata
import numpy as np
import unittest
import dpdata

from monty.serialization import loadfn, dumpfn
from pymatgen.core.structure import Structure
from pymatgen.core.surface import SlabGenerator
from pymatgen.io.vasp import Incar
from pymatgen.io.ase import AseAtomsAdaptor
from ase.lattice.cubic import BodyCenteredCubic as bcc
from ase.lattice.cubic import FaceCenteredCubic as fcc
from ase.lattice.hexagonal import HexagonalClosedPacked as hcp

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
__package__ = 'auto_test'

from .context import make_kspacing_kpoints
from .context import setUpModule

from dpgen.auto_test.Gamma import Gamma

class TestGamma(unittest.TestCase):

def setUp(self):
_jdata = {
"structures": ["confs/std-fcc"],
"interaction": {
"type": "vasp",
"incar": "vasp_input/INCAR_Mo",
"potcar_prefix": "vasp_input",
"potcars": {"Mo": "POTCAR_Mo"}
},
"properties": [
{
"type": "gamma",
"lattice_type": "fcc",
"miller_index": [1, 1, 1],
"displace_direction": [1, 1, 0],
"min_supercell_size": [1, 1, 10],
"min_vacuum_size": 10,
"add_fix": ["true", "true", "false"],
"n_steps": 20
}
]
}

self.equi_path = 'confs/hp-Mo/relaxation/relax_task'
self.source_path = 'equi/vasp'
self.target_path = 'confs/hp-Mo/gamma_00'
if not os.path.exists(self.equi_path):
os.makedirs(self.equi_path)
if not os.path.exists(self.target_path):
os.makedirs(self.target_path)

self.confs = _jdata["structures"]
self.inter_param = _jdata["interaction"]
self.prop_param = _jdata['properties']

self.gamma = Gamma(_jdata['properties'][0])

def tearDown(self):
if os.path.exists(self.equi_path):
shutil.rmtree(self.equi_path)
if os.path.exists(self.target_path):
shutil.rmtree(self.target_path)

def test_task_type(self):
self.assertEqual('gamma', self.gamma.task_type())

def test_task_param(self):
self.assertEqual(self.prop_param[0], self.gamma.task_param())

def test_make_confs_bcc(self):
if not os.path.exists(os.path.join(self.equi_path, 'CONTCAR')):
with self.assertRaises(RuntimeError):
self.gamma.make_confs(self.target_path, self.equi_path)
shutil.copy(os.path.join(self.source_path, 'CONTCAR_Mo_bcc'), os.path.join(self.equi_path, 'CONTCAR'))
task_list = self.gamma.make_confs(self.target_path, self.equi_path)
dfm_dirs = glob.glob(os.path.join(self.target_path, 'task.*'))
self.assertEqual(len(dfm_dirs), self.gamma.n_steps+1)

incar0 = Incar.from_file(os.path.join('vasp_input', 'INCAR.rlx'))
incar0['ISIF'] = 4

self.assertEqual(os.path.realpath(os.path.join(self.equi_path, 'CONTCAR')),
os.path.realpath(os.path.join(self.target_path, 'POSCAR')))
ref_st = Structure.from_file(os.path.join(self.target_path, 'POSCAR'))
dfm_dirs.sort()
for ii in dfm_dirs:
st_file = os.path.join(ii, 'POSCAR')
self.assertTrue(os.path.isfile(st_file))
st0 = Structure.from_file(st_file)
st1_file = os.path.join(ii, 'POSCAR.tmp')
self.assertTrue(os.path.isfile(st1_file))
st1 = Structure.from_file(st1_file)
with open(st1_file, mode='r') as f:
z_coord_str = f.readlines()[-1].split()[-2]
z_coord = float(z_coord_str)
self.assertTrue(z_coord <= 1)
33 changes: 33 additions & 0 deletions tests/auto_test/vasp_input/INCAR_Mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#Parameters
SYSTEM = Mo_hcp
PREC = Accurate
ISTART = 0
ICHARG = 2
#Electronic Relaxation
ENCUT = 800 # test
NELM = 100
NELMIN = 6
NELMDL = -5
EDIFF = 1e-06 # test
LREAL = False
ALGO = Normal # or normal
#Ionic relaxation
IBRION = 2
#POTIM = 0.3
ISIF = 3
EDIFFG = -0.01 # test
#ISYM = 0
NSW = 100
ISMEAR = 1
SIGMA = 0.1 # test
# Write flags
LWAVE = False
LCHARG = False
#parallel related
#KPAR = 16
NPAR = 4
#KPAR = 1
KSPACING = 0.1 # test
KGAMMA = False

PSTRESS = 0.0
Loading