Skip to content

Commit 3634014

Browse files
author
Han Wang
committed
pass ref rather than copy fparam
1 parent 6bbeaac commit 3634014

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

source/lib/include/NNPInter.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class NNPInter
6464
const vector<int> & atype,
6565
const vector<VALUETYPE> & box,
6666
const int nghost = 0,
67-
const vector<VALUETYPE> fparam = vector<VALUETYPE>());
67+
const vector<VALUETYPE> & fparam = vector<VALUETYPE>());
6868
void compute (ENERGYTYPE & ener,
6969
vector<VALUETYPE> & force,
7070
vector<VALUETYPE> & virial,
@@ -73,7 +73,7 @@ class NNPInter
7373
const vector<VALUETYPE> & box,
7474
const int nghost,
7575
const LammpsNeighborList & lmp_list,
76-
const vector<VALUETYPE> fparam = vector<VALUETYPE>());
76+
const vector<VALUETYPE> & fparam = vector<VALUETYPE>());
7777
void compute (ENERGYTYPE & ener,
7878
vector<VALUETYPE> & force,
7979
vector<VALUETYPE> & virial,
@@ -82,7 +82,7 @@ class NNPInter
8282
const vector<VALUETYPE> & coord,
8383
const vector<int> & atype,
8484
const vector<VALUETYPE> & box,
85-
const vector<VALUETYPE> fparam = vector<VALUETYPE>());
85+
const vector<VALUETYPE> & fparam = vector<VALUETYPE>());
8686
void compute (ENERGYTYPE & ener,
8787
vector<VALUETYPE> & force,
8888
vector<VALUETYPE> & virial,
@@ -93,7 +93,7 @@ class NNPInter
9393
const vector<VALUETYPE> & box,
9494
const int nghost,
9595
const LammpsNeighborList & lmp_list,
96-
const vector<VALUETYPE> fparam = vector<VALUETYPE>());
96+
const vector<VALUETYPE> & fparam = vector<VALUETYPE>());
9797
VALUETYPE cutoff () const {assert(inited); return rcut;};
9898
int numb_types () const {assert(inited); return ntypes;};
9999
int dim_fparam () const {assert(inited); return dfparam;};
@@ -125,7 +125,7 @@ class NNPInterModelDevi
125125
const vector<VALUETYPE> & coord,
126126
const vector<int> & atype,
127127
const vector<VALUETYPE> & box,
128-
const vector<VALUETYPE> fparam = vector<VALUETYPE>());
128+
const vector<VALUETYPE> & fparam = vector<VALUETYPE>());
129129
void compute (vector<ENERGYTYPE> & all_ener,
130130
vector<vector<VALUETYPE> > & all_force,
131131
vector<vector<VALUETYPE> > & all_virial,
@@ -134,7 +134,7 @@ class NNPInterModelDevi
134134
const vector<VALUETYPE> & box,
135135
const int nghost,
136136
const LammpsNeighborList & lmp_list,
137-
const vector<VALUETYPE> fparam = vector<VALUETYPE>());
137+
const vector<VALUETYPE> & fparam = vector<VALUETYPE>());
138138
void compute (vector<ENERGYTYPE> & all_ener,
139139
vector<vector<VALUETYPE> > & all_force,
140140
vector<vector<VALUETYPE> > & all_virial,
@@ -145,7 +145,7 @@ class NNPInterModelDevi
145145
const vector<VALUETYPE> & box,
146146
const int nghost,
147147
const LammpsNeighborList & lmp_list,
148-
const vector<VALUETYPE> fparam = vector<VALUETYPE>());
148+
const vector<VALUETYPE> & fparam = vector<VALUETYPE>());
149149
VALUETYPE cutoff () const {assert(inited); return rcut;};
150150
int numb_types () const {assert(inited); return ntypes;};
151151
int dim_fparam () const {assert(inited); return dfparam;};

source/lib/src/NNPInter.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ make_input_tensors (std::vector<std::pair<string, Tensor>> & input_tensors,
6666
const vector<int> & datype_,
6767
const vector<VALUETYPE> & dbox,
6868
const VALUETYPE & cell_size,
69-
const vector<VALUETYPE> fparam_,
69+
const vector<VALUETYPE> & fparam_,
7070
const NNPAtomMap<VALUETYPE>&nnpmap,
7171
const int nghost = 0)
7272
{
@@ -213,7 +213,7 @@ make_input_tensors (std::vector<std::pair<string, Tensor>> & input_tensors,
213213
const vector<int> & datype_,
214214
const vector<VALUETYPE> & dbox,
215215
InternalNeighborList & dlist,
216-
const vector<VALUETYPE> fparam_,
216+
const vector<VALUETYPE> & fparam_,
217217
const NNPAtomMap<VALUETYPE>&nnpmap,
218218
const int nghost)
219219
{
@@ -592,7 +592,7 @@ compute (ENERGYTYPE & dener,
592592
const vector<int> & datype_,
593593
const vector<VALUETYPE> & dbox,
594594
const int nghost,
595-
const vector<VALUETYPE> fparam)
595+
const vector<VALUETYPE> & fparam)
596596
{
597597
int nall = dcoord_.size() / 3;
598598
int nloc = nall - nghost;
@@ -619,7 +619,7 @@ compute (ENERGYTYPE & dener,
619619
const vector<VALUETYPE> & dbox,
620620
const int nghost,
621621
const LammpsNeighborList & lmp_list,
622-
const vector<VALUETYPE> fparam)
622+
const vector<VALUETYPE> & fparam)
623623
{
624624
int nall = dcoord_.size() / 3;
625625
int nloc = nall - nghost;
@@ -651,7 +651,7 @@ compute (ENERGYTYPE & dener,
651651
const vector<VALUETYPE> & dcoord_,
652652
const vector<int> & datype_,
653653
const vector<VALUETYPE> & dbox,
654-
const vector<VALUETYPE> fparam)
654+
const vector<VALUETYPE> & fparam)
655655
{
656656
NNPAtomMap<VALUETYPE> nnpmap (datype_.begin(), datype_.end());
657657
if (fparam.size() != dfparam) {
@@ -678,7 +678,7 @@ compute (ENERGYTYPE & dener,
678678
const vector<VALUETYPE> & dbox,
679679
const int nghost,
680680
const LammpsNeighborList & lmp_list,
681-
const vector<VALUETYPE> fparam)
681+
const vector<VALUETYPE> & fparam)
682682
{
683683
int nall = dcoord_.size() / 3;
684684
int nloc = nall - nghost;
@@ -824,7 +824,7 @@ compute (ENERGYTYPE & dener,
824824
const vector<VALUETYPE> & dcoord_,
825825
const vector<int> & datype_,
826826
const vector<VALUETYPE> & dbox,
827-
const vector<VALUETYPE> fparam)
827+
const vector<VALUETYPE> & fparam)
828828
{
829829
if (numb_models == 0) return;
830830
if (fparam.size() != dfparam) {
@@ -873,7 +873,7 @@ compute (vector<ENERGYTYPE> & all_energy,
873873
const vector<VALUETYPE> & dbox,
874874
const int nghost,
875875
const LammpsNeighborList & lmp_list,
876-
const vector<VALUETYPE> fparam)
876+
const vector<VALUETYPE> & fparam)
877877
{
878878
if (numb_models == 0) return;
879879
if (fparam.size() != dfparam) {
@@ -914,7 +914,7 @@ compute (vector<ENERGYTYPE> & all_energy,
914914
const vector<VALUETYPE> & dbox,
915915
const int nghost,
916916
const LammpsNeighborList & lmp_list,
917-
const vector<VALUETYPE> fparam)
917+
const vector<VALUETYPE> & fparam)
918918
{
919919
if (numb_models == 0) return;
920920
if (fparam.size() != dfparam) {

0 commit comments

Comments
 (0)