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

DecohesionEnergy + Lat_param_T (property+report + unittest) update 27 Aug #79

Open
wants to merge 16 commits into
base: devel-1.2.0
Choose a base branch
from
Open
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
13 changes: 13 additions & 0 deletions .github/workflows/mirror_gitee.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Mirror to Gitee Repository

on: [ push, delete, create ]

# Ensures that only one mirror task will run at a time.
concurrency:
group: git-mirror

jobs:
git-mirror:
uses: deepmodeling/workflows/.github/workflows/mirror_gitee.yml@main
secrets:
SYNC_GITEE_PRIVATE_KEY: ${{ secrets.SYNC_GITEE_PRIVATE_KEY }}
6 changes: 6 additions & 0 deletions apex/core/calculator/Lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,13 +518,17 @@ def _prepare_result_dict(self, atom_numbs, type_map_list, type_list, box, coord,
def forward_files(self, property_type="relaxation"):
if self.inter_type in ["meam", "snap"]:
return ["conf.lmp", "in.lammps"] + list(map(os.path.basename, self.model))
elif property_type == "Lat_param_T":
return ["in.lammps", "variable_Lat_param_T.in", os.path.basename(self.model)]
else:
return ["conf.lmp", "in.lammps", os.path.basename(self.model)]

def forward_common_files(self, property_type="relaxation"):
if property_type not in ["eos"]:
if self.inter_type in ["meam", "snap"]:
return ["in.lammps"] + list(map(os.path.basename, self.model))
elif property_type == "Lat_param_T":
return ["in.lammps", "variable_Lat_param_T.in", os.path.basename(self.model)]
else:
return ["in.lammps", os.path.basename(self.model)]
else:
Expand All @@ -536,6 +540,8 @@ def forward_common_files(self, property_type="relaxation"):
def backward_files(self, property_type="relaxation"):
if property_type == "phonon":
return ["outlog", "FORCE_CONSTANTS"]
elif property_type == "Lat_param_T":
return ["log.lammps", "outlog", "dump.relax", "average_box.txt"]
else:
return ["log.lammps", "outlog", "dump.relax"]

57 changes: 57 additions & 0 deletions apex/core/calculator/lib/lammps_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,63 @@ def make_lammps_elastic(
ret += 'print "Final Stress (xx yy zz xy xz yz) = ${Pxx} ${Pyy} ${Pzz} ${Pxy} ${Pxz} ${Pyz}"\n'
return ret

def make_lammps_Lat_param_T(conf, type_map, interaction, param):
type_map_list = element_list(type_map)
deepmd_version = param.get("deepmd_version", None)
dump_step = 100
# detour sychronizing problem of dumping in new version of deepmd-kit >=2.1.5
tdamp = 100
ret = ""
ret += "include variable_Lat_param_T.in\n"
ret += "clear\n"
ret += "units metal\n"
ret += "dimension 3\n"
ret += "boundary p p p\n"
ret += "atom_style atomic\n"
ret += "box tilt large\n"
ret += "read_data %s\n" % conf
ret += "replicate ${nx} ${ny} ${nz}\n"
for ii in range(len(type_map)):
ret += "mass %d %.3f\n" % (ii + 1, Element(type_map_list[ii]).mass)
ret += "neigh_modify every 1 delay 0 check no\n"
ret += interaction(param)
ret += "compute mype all pe\n"
ret += "thermo 100\n"
ret += (
"thermo_style custom step pe pxx pyy pzz pxy pxz pyz lx ly lz vol c_mype\n"
)
ret += "velocity all create ${temperature} 12345 mom yes rot yes dist gaussian\n"
ret += f"fix 1 all npt temp ${{temperature}} ${{temperature}} {tdamp} x 1.0 1.0 1000 y 1.0 1.0 1000 xy 1.0 1.0 1000\n"
ret += "run ${equi_step}\n"
ret += "reset_timestep 0 \n"
ret += f"dump 1 all custom {dump_step} dump.relax id type xs ys zs fx fy fz\n"
ret += "variable lx equal lx \n"
ret += "variable ly equal ly \n"
ret += "variable lz equal lz \n"
ret += "fix 2 all ave/time ${N_every} ${N_repeat} ${N_freq} v_lx v_ly v_lz ave running file average_box.txt\n"
ret += "run ${ave_step} \n"
ret += "variable N equal count(all)\n"
ret += "variable V equal vol\n"
ret += "variable E equal \"c_mype\"\n"
ret += "variable tmplx equal lx\n"
ret += "variable tmply equal ly\n"
ret += "variable Pxx equal pxx\n"
ret += "variable Pyy equal pyy\n"
ret += "variable Pzz equal pzz\n"
ret += "variable Pxy equal pxy\n"
ret += "variable Pxz equal pxz\n"
ret += "variable Pyz equal pyz\n"
ret += "variable Epa equal ${E}/${N}\n"
ret += "variable Vpa equal ${V}/${N}\n"
ret += "variable AA equal (${tmplx}*${tmply})\n"
ret += "print \"All done\"\n"
ret += "print \"Total number of atoms = ${N}\"\n"
ret += "print \"Final energy per atoms = ${Epa}\"\n"
ret += "print \"Final volume per atoms = ${Vpa}\"\n"
ret += "print \"Final Base area = ${AA}\"\n"
ret += "print \"Final Stress (xx yy zz xy xz yz) = ${Pxx} ${Pyy} ${Pzz} ${Pxy} ${Pxz} ${Pyz}\"\n"
ret += "print \"Final Length (box_x box_y box_z) = ${lx} ${ly} ${lz}\"\n"
return ret

def make_lammps_press_relax(
conf,
Expand Down
6 changes: 6 additions & 0 deletions apex/core/common_prop.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from apex.core.property.Surface import Surface
from apex.core.property.Vacancy import Vacancy
from apex.core.property.Phonon import Phonon
from apex.core.property.DecohesionEnergy import DecohesionEnergy
from apex.core.property.Lat_param_T import Lat_param_T
from apex.core.lib.utils import create_path
from apex.core.lib.util import collect_task
from apex.core.lib.dispatcher import make_submission
Expand Down Expand Up @@ -39,6 +41,10 @@ def make_property_instance(parameters, inter_param):
return Gamma(parameters, inter_param)
elif prop_type == "phonon":
return Phonon(parameters, inter_param)
elif prop_type == "DecohesionEnergy":
return DecohesionEnergy(parameters, inter_param)
elif prop_type == "Lat_param_T":
return Lat_param_T(parameters, inter_param)
else:
raise RuntimeError(f"unknown APEX type {prop_type}")

Expand Down
Loading