Skip to content

Commit

Permalink
SOF-7194: merge main and resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
pranabdas committed Jan 23, 2024
2 parents 7c2f8d1 + a7e6a5d commit e24cf15
Show file tree
Hide file tree
Showing 22 changed files with 233 additions and 3 deletions.
1 change: 1 addition & 0 deletions applications/application_data.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
deepmd: !include 'applications/deepmd.yml'
espresso: !include 'applications/espresso.yml'
exabyteml: !include 'applications/exabyteml.yml'
jupyterLab: !include 'applications/jupyterLab.yml'
Expand Down
7 changes: 7 additions & 0 deletions applications/deepmd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: deepmd
shortName: deepmd
summary: DeePMD
defaultVersion: '2.0.2'
versions:
- version: '2.0.2'
isDefault: true
67 changes: 67 additions & 0 deletions assets/deepmd/dp_train_se_e2_r.j2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"model": {
"type_map": [
"O",
"H"
],
"descriptor": {
"type": "se_e2_r",
"sel": [
23,
46
],
"rcut_smth": 0.50,
"rcut": 5.00,
"neuron": [
5,
5,
5
],
"resnet_dt": false,
"seed": 1
},
"fitting_net": {
"neuron": [
60,
60,
60
],
"resnet_dt": true,
"seed": 1
}
},
"learning_rate": {
"type": "exp",
"decay_steps": 1000,
"start_lr": 0.005,
"stop_lr": 3.51e-6
},
"loss": {
"start_pref_e": 0.02,
"limit_pref_e": 1,
"start_pref_f": 1000,
"limit_pref_f": 1,
"start_pref_v": 0,
"limit_pref_v": 0
},
"training": {
"training_data": {
"systems": [
"./training/"
],
"batch_size": "auto"
},
"validation_data": {
"systems": [
"./validation/"
],
"batch_size": "auto"
},
"numb_steps": 301,
"seed": 1,
"disp_file": "lcurve.out",
"disp_freq": 10,
"numb_test": 1,
"save_freq": 100
}
}
23 changes: 23 additions & 0 deletions assets/deepmd/espresso_cp_to_deepmd.j2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import dpdata
import numpy as np

# https://docs.deepmodeling.com/projects/dpdata/en/master/formats/QECPTrajFormat.html
data = dpdata.LabeledSystem("cp", fmt="qe/cp/traj")
print("Dataset contains total {0} frames".format(len(data)))

# randomly choose 20% index for validation_data
size = len(data)
size_validation = round(size * 0.2)

index_validation = np.random.choice(size, size=size_validation, replace=False)
index_training = list(set(range(size)) - set(index_validation))

data_training = data.sub_system(index_training)
data_validation = data.sub_system(index_validation)

print("Using {0} frames as training set".format(len(data_training)))
print("Using {0} frames as validation set".format(len(data_validation)))

# save training and validation sets
data_training.to_deepmd_npy("./training")
data_validation.to_deepmd_npy("./validation")
10 changes: 10 additions & 0 deletions assets/deepmd/espresso_to_lammps_structure.j2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import dpdata

# load cp data files
# https://docs.deepmodeling.com/projects/dpdata/en/master/formats/QECPTrajFormat.html
system = dpdata.LabeledSystem("cp", fmt="qe/cp/traj")

# convert dpdata to lammps format
# below procedure will convert input QE structure to lammps format, user may
# want to generate supercell or other complex structure for lammps calculation
system.to_lmp("system.lmp")
25 changes: 25 additions & 0 deletions assets/deepmd/in.lammps
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# LAMMPS input, deepmd-kit version. Built from bulk water calculation.

units metal
boundary p p p
atom_style atomic

neighbor 2.0 bin
neigh_modify every 10 delay 0 check no

read_data system.lmp
mass 1 16
mass 2 2

pair_style deepmd ./graph.pb
pair_coeff * *

velocity all create 330.0 23456789

fix 1 all nvt temp 330.0 330.0 0.5
timestep 0.0005
thermo_style custom step pe ke etotal temp press vol
thermo 100
dump 1 all custom 100 system.dump id type x y z

run 100
3 changes: 3 additions & 0 deletions assets/espresso/cp.j2.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
electron_dynamics = 'verlet'
electron_velocities = 'zero'
emass = {{ dynamics.electronMass }}
!! consider the below parameters if orthogonalization fails
! orthogonalization = 'ortho'
! ortho_eps = 1d-11
/
&IONS
ion_dynamics = 'verlet'
Expand Down
13 changes: 13 additions & 0 deletions executables/deepmd/dp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
isDefault: false
monitors:
- standard_output
results: []
flavors:
dp_train_se_e2_r:
input:
- name: dp_train_se_e2_r.json
results: []
monitors:
- standard_output
applicationName: deepmd
executableName: dp # dp train dp_train_se_e2_r.json && dp freeze -o graph.pb
13 changes: 13 additions & 0 deletions executables/deepmd/lmp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
isDefault: false
monitors:
- standard_output
results: []
flavors:
lammps_md:
input:
- name: in.lammps
results: []
monitors:
- standard_output
applicationName: deepmd
executableName: lmp # mpirun -np $NP lmp -in in.lammps
24 changes: 24 additions & 0 deletions executables/deepmd/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
isDefault: true
monitors:
- standard_output
results: []
flavors:
espresso_cp_to_deepmd:
isDefault: true
input:
- name: espresso_cp_to_deepmd.py
results: []
monitors:
- standard_output
applicationName: deepmd
executableName: python

espresso_to_lammps_structure:
isDefault: false
input:
- name: espresso_to_lammps_structure.py
results: []
monitors:
- standard_output
applicationName: deepmd
executableName: python
1 change: 1 addition & 0 deletions executables/espresso/cp.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ monitors:
results: []
flavors:
cp:
isDefault: true
input:
- name: cp.in
results: []
Expand Down
4 changes: 4 additions & 0 deletions executables/tree.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
deepmd:
dp: !include 'executables/deepmd/dp.yml'
lmp: !include 'executables/deepmd/lmp.yml'
python: !include 'executables/deepmd/python.yml'
espresso:
average.x: !include 'executables/espresso/average.x.yml'
bands.x: !include 'executables/espresso/bands.x.yml'
Expand Down
2 changes: 1 addition & 1 deletion src/js/data/application_data.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/js/data/templates.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/js/data/tree.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const allApplications = [
"espresso",
"jupyterLab",
"exabyteml",
"deepmd",
"nwchem",
"python",
"shell",
Expand Down
5 changes: 5 additions & 0 deletions templates/deepmd/dp_create_lmp_structure.py.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- content: !readFile 'assets/deepmd/espresso_to_lammps_structure.j2.py'
name: espresso_to_lammps_structure.py
contextProviders: []
applicationName: deepmd
executableName: python
5 changes: 5 additions & 0 deletions templates/deepmd/dp_lmp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- content: !readFile 'assets/deepmd/in.lammps'
name: in.lammps
contextProviders: []
applicationName: deepmd
executableName: lmp
5 changes: 5 additions & 0 deletions templates/deepmd/dp_prepare.py.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- content: !readFile 'assets/deepmd/espresso_cp_to_deepmd.j2.py'
name: espresso_cp_to_deepmd.py
contextProviders: []
applicationName: deepmd
executableName: python
5 changes: 5 additions & 0 deletions templates/deepmd/dp_train.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- content: !readFile 'assets/deepmd/dp_train_se_e2_r.j2.json'
name: dp_train_se_e2_r.json
contextProviders: []
applicationName: deepmd
executableName: dp
6 changes: 6 additions & 0 deletions templates/templates.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
!flatten
# deepmd
- !include 'templates/deepmd/dp_create_lmp_structure.py.yml'
- !include 'templates/deepmd/dp_lmp.yml'
- !include 'templates/deepmd/dp_prepare.py.yml'
- !include 'templates/deepmd/dp_train.yml'
# espresso
- !include 'templates/espresso/average.x.yml'
- !include 'templates/espresso/bands.x.yml'
- !include 'templates/espresso/cp.x.yml'
Expand Down
12 changes: 12 additions & 0 deletions tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@ describe("assets for all executables", () => {
templates = getAllAppTemplates();
});

it("exists at least 1 asset for each tree entry for deepmd tree", () => {
const tree = APP_TREE.deepmd;

Object.keys(tree).forEach((treeItemName) => {
const treeItemTemplates = templates.filter(
(template) => template.executableName === treeItemName,
);

assert(treeItemTemplates.length > 0);
});
});

it("exists at least 1 asset for each tree entry for espresso tree", () => {
const tree = APP_TREE.espresso;

Expand Down

0 comments on commit e24cf15

Please sign in to comment.