Skip to content

Commit 5a88334

Browse files
authored
Merge pull request #9 from deepmodeling/devel
devel update
2 parents f0453ff + 6cceef0 commit 5a88334

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+5547
-1157
lines changed

examples/water/train/polar.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131

3232
"learning_rate" :{
3333
"type": "exp",
34-
"start_lr": 0.001,
3534
"decay_steps": 5000,
36-
"decay_rate": 0.95,
35+
"start_lr": 0.001,
36+
"stop_lr": 3.51e-8,
3737
"_comment": "that's all"
3838
},
3939

examples/water/train/polar_se_a.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"_comment": " model parameters",
44
"model":{
55
"type_map": ["O", "H"],
6-
"data_stat_nbatch": 1,
6+
"data_stat_nbatch": 10,
77
"descriptor" :{
88
"type": "se_a",
99
"sel": [46, 92],
@@ -18,7 +18,7 @@
1818
"fitting_net": {
1919
"type": "polar",
2020
"sel_type": [0],
21-
"fit_diag": true,
21+
"fit_diag": false,
2222
"neuron": [100, 100, 100],
2323
"resnet_dt": true,
2424
"seed": 1,
@@ -29,9 +29,9 @@
2929

3030
"learning_rate" :{
3131
"type": "exp",
32-
"start_lr": 0.01,
3332
"decay_steps": 5000,
34-
"decay_rate": 0.95,
33+
"start_lr": 0.01,
34+
"stop_lr": 3.51e-7,
3535
"_comment": "that's all"
3636
},
3737

examples/water/train/wannier.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232

3333
"learning_rate" :{
3434
"type": "exp",
35-
"start_lr": 0.001,
3635
"decay_steps": 5000,
37-
"decay_rate": 0.95,
36+
"start_lr": 0.001,
37+
"stop_lr": 3.51e-8,
3838
"_comment": "that's all"
3939
},
4040

examples/water/train/water.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"_comment": " model parameters",
44
"model":{
55
"type_map": ["O", "H"],
6+
"data_stat_nbatch": 10,
67
"descriptor": {
78
"type": "loc_frame",
89
"sel_a": [16, 32],
@@ -28,9 +29,9 @@
2829

2930
"learning_rate" :{
3031
"type": "exp",
31-
"start_lr": 0.001,
3232
"decay_steps": 5000,
33-
"decay_rate": 0.95,
33+
"start_lr": 0.001,
34+
"stop_lr": 3.51e-8,
3435
"_comment": "that's all"
3536
},
3637

examples/water/train/water_se_a.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424

2525
"learning_rate" :{
2626
"type": "exp",
27-
"start_lr": 0.001,
2827
"decay_steps": 5000,
29-
"decay_rate": 0.95,
28+
"start_lr": 0.001,
29+
"stop_lr": 3.51e-8,
3030
"_comment": "that's all"
3131
},
3232

examples/water/train/water_se_ar.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535

3636
"learning_rate" :{
3737
"type": "exp",
38-
"start_lr": 0.005,
3938
"decay_steps": 5000,
40-
"decay_rate": 0.95,
39+
"start_lr": 0.005,
40+
"stop_lr": 1.76e-7,
4141
"_comment": "that's all"
4242
},
4343

examples/water/train/water_se_r.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323
},
2424

2525
"learning_rate" : {
26-
"start_lr": 0.005,
26+
"type": "exp",
2727
"decay_steps": 5000,
28-
"decay_rate": 0.95,
28+
"start_lr": 0.005,
29+
"stop_lr": 1.76e-7,
2930
"_comment": " that's all"
3031
},
3132

examples/water/train/water_srtab_example.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232

3333
"learning_rate" :{
3434
"type": "exp",
35-
"start_lr": 0.001,
3635
"decay_steps": 5000,
37-
"decay_rate": 0.95,
36+
"start_lr": 0.001,
37+
"stop_lr": 3.51e-8,
3838
"_comment": "that's all"
3939
},
4040

source/lib/include/DataModifier.h

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#pragma once
2+
3+
#include "NNPInter.h"
4+
5+
class DataModifier
6+
{
7+
public:
8+
DataModifier();
9+
DataModifier(const string & model,
10+
const int & gpu_rank = 0,
11+
const string & name_scope = "");
12+
~DataModifier () {};
13+
void init (const string & model,
14+
const int & gpu_rank = 0,
15+
const string & name_scope = "");
16+
void print_summary(const string &pre) const;
17+
public:
18+
void compute (vector<VALUETYPE> & dfcorr_,
19+
vector<VALUETYPE> & dvcorr_,
20+
const vector<VALUETYPE> & dcoord_,
21+
const vector<int> & datype_,
22+
const vector<VALUETYPE> & dbox,
23+
const vector<pair<int,int>> & pairs,
24+
const vector<VALUETYPE> & delef_,
25+
const int nghost,
26+
const LammpsNeighborList & lmp_list);
27+
VALUETYPE cutoff () const {assert(inited); return rcut;};
28+
int numb_types () const {assert(inited); return ntypes;};
29+
vector<int> sel_types () const {assert(inited); return sel_type;};
30+
private:
31+
Session* session;
32+
string name_scope, name_prefix;
33+
int num_intra_nthreads, num_inter_nthreads;
34+
GraphDef graph_def;
35+
bool inited;
36+
VALUETYPE rcut;
37+
VALUETYPE cell_size;
38+
int ntypes;
39+
string model_type;
40+
vector<int> sel_type;
41+
template<class VT> VT get_scalar(const string & name) const;
42+
template<class VT> void get_vector(vector<VT> & vec, const string & name) const;
43+
void run_model (vector<VALUETYPE> & dforce,
44+
vector<VALUETYPE> & dvirial,
45+
Session * session,
46+
const std::vector<std::pair<string, Tensor>> & input_tensors,
47+
const NNPAtomMap<VALUETYPE> & nnpmap,
48+
const int nghost);
49+
};
50+

source/lib/include/DeepTensor.h

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#pragma once
2+
3+
#include "NNPInter.h"
4+
5+
class DeepTensor
6+
{
7+
public:
8+
DeepTensor();
9+
DeepTensor(const string & model,
10+
const int & gpu_rank = 0,
11+
const string &name_scope = "");
12+
void init (const string & model,
13+
const int & gpu_rank = 0,
14+
const string &name_scope = "");
15+
void print_summary(const string &pre) const;
16+
public:
17+
void compute (vector<VALUETYPE> & value,
18+
const vector<VALUETYPE> & coord,
19+
const vector<int> & atype,
20+
const vector<VALUETYPE> & box,
21+
const int nghost = 0);
22+
void compute (vector<VALUETYPE> & value,
23+
const vector<VALUETYPE> & coord,
24+
const vector<int> & atype,
25+
const vector<VALUETYPE> & box,
26+
const int nghost,
27+
const LammpsNeighborList & lmp_list);
28+
VALUETYPE cutoff () const {assert(inited); return rcut;};
29+
int numb_types () const {assert(inited); return ntypes;};
30+
int output_dim () const {assert(inited); return odim;};
31+
const vector<int> & sel_types () const {assert(inited); return sel_type;};
32+
private:
33+
Session* session;
34+
string name_scope;
35+
int num_intra_nthreads, num_inter_nthreads;
36+
GraphDef graph_def;
37+
bool inited;
38+
VALUETYPE rcut;
39+
VALUETYPE cell_size;
40+
int ntypes;
41+
string model_type;
42+
int odim;
43+
vector<int> sel_type;
44+
template<class VT> VT get_scalar(const string & name) const;
45+
template<class VT> void get_vector (vector<VT> & vec, const string & name) const;
46+
void run_model (vector<VALUETYPE> & d_tensor_,
47+
Session * session,
48+
const std::vector<std::pair<string, Tensor>> & input_tensors,
49+
const NNPAtomMap<VALUETYPE> & nnpmap,
50+
const int nghost = 0);
51+
void compute_inner (vector<VALUETYPE> & value,
52+
const vector<VALUETYPE> & coord,
53+
const vector<int> & atype,
54+
const vector<VALUETYPE> & box,
55+
const int nghost = 0);
56+
void compute_inner (vector<VALUETYPE> & value,
57+
const vector<VALUETYPE> & coord,
58+
const vector<int> & atype,
59+
const vector<VALUETYPE> & box,
60+
const int nghost,
61+
const InternalNeighborList&lmp_list);
62+
};
63+

0 commit comments

Comments
 (0)