use nullptr instead of NULL or 0 where applicable
This commit is contained in:
@ -487,7 +487,7 @@ vec_type dist_av(Vector_3 *va1,Vector_3 *va2,int n);
|
||||
/*e optionally gives the indexes for maximal and minimal difference
|
||||
va2 can be nullptr, then the norm of va1 is used */
|
||||
|
||||
vec_type diff_av(Vector_3 *va1,Vector_3 *va2,int n, int *minind=0, int *maxind=0);
|
||||
vec_type diff_av(Vector_3 *va1,Vector_3 *va2,int n, int *minind=nullptr, int *maxind=nullptr);
|
||||
|
||||
//e finds suitable perpendicular to a vector
|
||||
Vector_3 FindPerp(const Vector_3 &vAB);
|
||||
@ -507,7 +507,7 @@ Vector_3 GetIScopei(const Vector_3 *varr,int *indarr,int n,Vector_3* box_min,Vec
|
||||
// neue Funktionen
|
||||
|
||||
//e clears vector array with optional integer index
|
||||
void clear_vecarri(int n,Vector_3 *vec, int *ind=0);
|
||||
void clear_vecarri(int n,Vector_3 *vec, int *ind=nullptr);
|
||||
|
||||
//e reflects the vector ini+dir*t+0.5*force*t^2 to be inside a box limited by 0 and box sizes
|
||||
//e changes dir according to the final state
|
||||
|
||||
@ -132,6 +132,6 @@ Body* NewBody(int type){
|
||||
case PARTICLE : // A Particle
|
||||
return new Particle;
|
||||
default : // error
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ using namespace std;
|
||||
|
||||
ColMatMap::ColMatMap(){
|
||||
numrows = 0;
|
||||
elements = 0;
|
||||
elements = nullptr;
|
||||
}
|
||||
|
||||
ColMatMap::~ColMatMap(){
|
||||
@ -33,7 +33,7 @@ ColMatMap::~ColMatMap(){
|
||||
|
||||
ColMatMap::ColMatMap(const ColMatMap& A){ // copy constructor
|
||||
numrows = 0;
|
||||
elements = 0;
|
||||
elements = nullptr;
|
||||
Dim(A.numrows);
|
||||
for(int i=0;i<numrows;i++)
|
||||
elements[i] = A.elements[i];
|
||||
@ -41,7 +41,7 @@ ColMatMap::ColMatMap(const ColMatMap& A){ // copy constructor
|
||||
|
||||
ColMatMap::ColMatMap(ColMatrix& A){ // copy constructor
|
||||
numrows = 0;
|
||||
elements = 0;
|
||||
elements = nullptr;
|
||||
Dim(A.GetNumRows());
|
||||
for(int i=0;i<numrows;i++)
|
||||
elements[i] = A.GetElementPointer(i);
|
||||
@ -63,7 +63,7 @@ ColMatrix::ColMatrix(const VirtualMatrix& A){ // copy constructor
|
||||
|
||||
ColMatMap::ColMatMap(int m){ // size constructor
|
||||
numrows = 0;
|
||||
elements = 0;
|
||||
elements = nullptr;
|
||||
Dim(m);
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ using namespace std;
|
||||
|
||||
ColMatrix::ColMatrix(){
|
||||
numrows = 0;
|
||||
elements = 0;
|
||||
elements = nullptr;
|
||||
}
|
||||
|
||||
ColMatrix::~ColMatrix(){
|
||||
@ -34,7 +34,7 @@ ColMatrix::~ColMatrix(){
|
||||
|
||||
ColMatrix::ColMatrix(const ColMatrix& A){ // copy constructor
|
||||
numrows = 0;
|
||||
elements = 0;
|
||||
elements = nullptr;
|
||||
Dim(A.numrows);
|
||||
for(int i=0;i<numrows;i++)
|
||||
elements[i] = A.elements[i];
|
||||
@ -42,7 +42,7 @@ ColMatrix::ColMatrix(const ColMatrix& A){ // copy constructor
|
||||
|
||||
ColMatrix::ColMatrix(const VirtualColMatrix& A){ // copy constructor
|
||||
numrows = 0;
|
||||
elements = 0;
|
||||
elements = nullptr;
|
||||
Dim(A.GetNumRows());
|
||||
for(int i=0;i<numrows;i++)
|
||||
elements[i] = A.BasicGet(i);
|
||||
@ -54,7 +54,7 @@ ColMatrix::ColMatrix(const VirtualMatrix& A){ // copy constructor
|
||||
exit(1);
|
||||
}
|
||||
numrows = 0;
|
||||
elements = 0;
|
||||
elements = nullptr;
|
||||
Dim(A.GetNumRows());
|
||||
for(int i=0;i<numrows;i++)
|
||||
elements[i] = A.BasicGet(i,0);
|
||||
@ -62,7 +62,7 @@ ColMatrix::ColMatrix(const VirtualMatrix& A){ // copy constructor
|
||||
|
||||
ColMatrix::ColMatrix(int m){ // size constructor
|
||||
numrows = 0;
|
||||
elements = 0;
|
||||
elements = nullptr;
|
||||
Dim(m);
|
||||
}
|
||||
|
||||
|
||||
@ -27,8 +27,8 @@
|
||||
using namespace std;
|
||||
|
||||
Joint::Joint(){
|
||||
body1 = body2 = 0;
|
||||
point1 = point2 = 0;
|
||||
body1 = body2 = nullptr;
|
||||
point1 = point2 = nullptr;
|
||||
pk_C_ko.Identity();
|
||||
pk_C_k.Identity();
|
||||
}
|
||||
@ -165,7 +165,7 @@ Body* Joint::GetBody2(){
|
||||
Body* Joint::OtherBody(Body* body){
|
||||
if(body1 == body) return body2;
|
||||
if(body2 == body) return body1;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Vect3* Joint::GetR12(){
|
||||
@ -243,6 +243,6 @@ Joint* NewJoint(int type){
|
||||
case SPHERICALJOINT : return new SphericalJoint;
|
||||
case BODY23JOINT : return new Body23Joint;
|
||||
case MIXEDJOINT : return new MixedJoint;
|
||||
default : return 0; // error
|
||||
default : return nullptr; // error
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,8 +24,8 @@ using namespace std;
|
||||
|
||||
Matrix::Matrix(){
|
||||
numrows = numcols = 0;
|
||||
rows = 0;
|
||||
elements = 0;
|
||||
rows = nullptr;
|
||||
elements = nullptr;
|
||||
}
|
||||
|
||||
Matrix::~Matrix(){
|
||||
@ -35,8 +35,8 @@ Matrix::~Matrix(){
|
||||
|
||||
Matrix::Matrix(const Matrix& A){
|
||||
numrows = numcols = 0;
|
||||
rows = 0;
|
||||
elements = 0;
|
||||
rows = nullptr;
|
||||
elements = nullptr;
|
||||
Dim(A.numrows,A.numcols);
|
||||
for(int i=0;i<numrows*numcols;i++)
|
||||
elements[i] = A.elements[i];
|
||||
@ -44,8 +44,8 @@ Matrix::Matrix(const Matrix& A){
|
||||
|
||||
Matrix::Matrix(const VirtualMatrix& A){
|
||||
numrows = numcols = 0;
|
||||
rows = 0;
|
||||
elements = 0;
|
||||
rows = nullptr;
|
||||
elements = nullptr;
|
||||
Dim(A.GetNumRows(),A.GetNumCols());
|
||||
for(int i=0;i<numrows;i++)
|
||||
for(int j=0;j<numcols;j++)
|
||||
@ -54,8 +54,8 @@ Matrix::Matrix(const VirtualMatrix& A){
|
||||
|
||||
Matrix::Matrix(int m, int n){
|
||||
numrows = numcols = 0;
|
||||
rows = 0;
|
||||
elements = 0;
|
||||
rows = nullptr;
|
||||
elements = nullptr;
|
||||
this->Dim(m,n);
|
||||
}
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ VirtualMatrix* NewMatrix(int type){
|
||||
case MAT4X4 : return new Mat4x4;
|
||||
case VECT3 : return new Vect3;
|
||||
case VECT4 : return new Vect4;
|
||||
default : return 0; // error!
|
||||
default : return nullptr; // error!
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -30,9 +30,9 @@ using namespace std;
|
||||
|
||||
|
||||
OnBody::OnBody(){
|
||||
system_body = 0;
|
||||
system_joint = 0;
|
||||
parent = 0;
|
||||
system_body = nullptr;
|
||||
system_joint = nullptr;
|
||||
parent = nullptr;
|
||||
|
||||
// these terms have zeros which are NEVER overwritten
|
||||
sI.Zeros();
|
||||
|
||||
@ -28,8 +28,8 @@ using namespace std;
|
||||
|
||||
OnSolver::OnSolver(){
|
||||
numbodies = 0;
|
||||
bodyarray = 0;
|
||||
q=0;u=0; qdot=0; udot=0; qdotdot=0;
|
||||
bodyarray = nullptr;
|
||||
q=nullptr;u=nullptr; qdot=nullptr; udot=nullptr; qdotdot=nullptr;
|
||||
type = ONSOLVER;
|
||||
}
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ template<class T> ListElement<T>::ListElement(){
|
||||
}
|
||||
|
||||
template<class T> ListElement<T>::ListElement(T* v){
|
||||
next = prev = 0;
|
||||
next = prev = nullptr;
|
||||
value = v;
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ template<class T> ListElement<T>::~ListElement(){
|
||||
//
|
||||
|
||||
template<class S> List<S>::List(){
|
||||
head = tail = 0;
|
||||
head = tail = nullptr;
|
||||
numelements = 0;
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ template<class S> S** List<S>::CreateArray(){
|
||||
S** array = new S* [numelements];
|
||||
|
||||
ListElement<S>* ele = head;
|
||||
for(int i=0;ele != 0;i++){
|
||||
for(int i=0;ele != nullptr;i++){
|
||||
array[i] = ele->value;
|
||||
ele = ele->next;
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
#include <cstring>
|
||||
|
||||
POEMSObject::POEMSObject(){
|
||||
name = 0;
|
||||
name = nullptr;
|
||||
ChangeName((const char*)"unnamed");
|
||||
ID = -1;
|
||||
}
|
||||
|
||||
@ -96,8 +96,8 @@ public:
|
||||
// constructor
|
||||
Tree::Tree()
|
||||
{
|
||||
root = 0;
|
||||
current = 0;
|
||||
root = nullptr;
|
||||
current = nullptr;
|
||||
size = 0;
|
||||
DeleteAuxData = nullptr;
|
||||
}
|
||||
|
||||
@ -39,6 +39,6 @@ Point* NewPoint(int type){
|
||||
case FIXEDPOINT : // A Fixed Point
|
||||
return new FixedPoint();
|
||||
default : // error
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ using namespace std;
|
||||
|
||||
RowMatrix::RowMatrix(){
|
||||
numcols = 0;
|
||||
elements = 0;
|
||||
elements = nullptr;
|
||||
}
|
||||
|
||||
RowMatrix::~RowMatrix(){
|
||||
@ -33,7 +33,7 @@ RowMatrix::~RowMatrix(){
|
||||
|
||||
RowMatrix::RowMatrix(const RowMatrix& A){ // copy constructor
|
||||
numcols = 0;
|
||||
elements = 0;
|
||||
elements = nullptr;
|
||||
Dim(A.numcols);
|
||||
for(int i=0;i<numcols;i++)
|
||||
elements[i] = A.elements[i];
|
||||
@ -41,7 +41,7 @@ RowMatrix::RowMatrix(const RowMatrix& A){ // copy constructor
|
||||
|
||||
RowMatrix::RowMatrix(const VirtualRowMatrix& A){ // copy constructor
|
||||
numcols = 0;
|
||||
elements = 0;
|
||||
elements = nullptr;
|
||||
Dim(A.GetNumCols());
|
||||
for(int i=0;i<numcols;i++)
|
||||
elements[i] = A.BasicGet(i);
|
||||
@ -53,7 +53,7 @@ RowMatrix::RowMatrix(const VirtualMatrix& A){ // copy constructor
|
||||
exit(1);
|
||||
}
|
||||
numcols = 0;
|
||||
elements = 0;
|
||||
elements = nullptr;
|
||||
Dim(A.GetNumCols());
|
||||
for(int i=0;i<numcols;i++)
|
||||
elements[i] = A.BasicGet(i,0);
|
||||
@ -61,7 +61,7 @@ RowMatrix::RowMatrix(const VirtualMatrix& A){ // copy constructor
|
||||
|
||||
RowMatrix::RowMatrix(int n){ // size constructor
|
||||
numcols = 0;
|
||||
elements = 0;
|
||||
elements = nullptr;
|
||||
Dim(n);
|
||||
}
|
||||
|
||||
|
||||
@ -179,7 +179,7 @@ void System::WriteOut(ostream& out){
|
||||
int i = 0;
|
||||
Body* body;
|
||||
ListElement<Body>* b_ele = bodies.GetHeadElement();
|
||||
while(b_ele !=0){
|
||||
while(b_ele !=nullptr){
|
||||
out << i << ' ';
|
||||
|
||||
body = b_ele->value;
|
||||
@ -200,7 +200,7 @@ void System::WriteOut(ostream& out){
|
||||
i = 0;
|
||||
Joint* joint;
|
||||
ListElement<Joint>* j_ele = joints.GetHeadElement();
|
||||
while(j_ele !=0){
|
||||
while(j_ele !=nullptr){
|
||||
out << i << ' ';
|
||||
joint = j_ele->value;
|
||||
|
||||
|
||||
@ -604,7 +604,7 @@ xdrstdio_create (XDR *xdrs, FILE *file, enum xdr_op op)
|
||||
xdrs->x_ops = (struct xdr_ops *) &xdrstdio_ops;
|
||||
xdrs->x_private = (char *) file;
|
||||
xdrs->x_handy = 0;
|
||||
xdrs->x_base = 0;
|
||||
xdrs->x_base = nullptr;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -77,7 +77,7 @@ FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) :
|
||||
nzgrid = utils::inumeric(FLERR,arg[12],false,lmp);
|
||||
|
||||
tinit = 0.0;
|
||||
infile = outfile = NULL;
|
||||
infile = outfile = nullptr;
|
||||
|
||||
int iarg = 13;
|
||||
while (iarg < narg) {
|
||||
|
||||
@ -148,7 +148,7 @@ PairKIM::PairKIM(LAMMPS *lmp) :
|
||||
PairKIM::~PairKIM()
|
||||
{
|
||||
// clean up kim_modelname
|
||||
if (kim_modelname != 0) delete [] kim_modelname;
|
||||
if (kim_modelname != nullptr) delete [] kim_modelname;
|
||||
|
||||
// clean up lammps atom species number to unique particle names mapping
|
||||
if (lmps_unique_elements)
|
||||
@ -169,7 +169,7 @@ PairKIM::~PairKIM()
|
||||
// clean up lmps_stripped_neigh_ptr
|
||||
if (lmps_stripped_neigh_ptr) {
|
||||
delete [] lmps_stripped_neigh_ptr;
|
||||
lmps_stripped_neigh_ptr = 0;
|
||||
lmps_stripped_neigh_ptr = nullptr;
|
||||
}
|
||||
|
||||
// clean up allocated memory for standard Pair class usage
|
||||
@ -184,7 +184,7 @@ PairKIM::~PairKIM()
|
||||
// clean up neighborlist pointers
|
||||
if (neighborLists) {
|
||||
delete [] neighborLists;
|
||||
neighborLists = 0;
|
||||
neighborLists = nullptr;
|
||||
}
|
||||
|
||||
// clean up KIM interface (if necessary)
|
||||
@ -330,9 +330,9 @@ void PairKIM::settings(int narg, char **arg)
|
||||
set_lmps_flags();
|
||||
|
||||
// set KIM Model name
|
||||
if (kim_modelname != 0) {
|
||||
if (kim_modelname != nullptr) {
|
||||
delete [] kim_modelname;
|
||||
kim_modelname = 0;
|
||||
kim_modelname = nullptr;
|
||||
}
|
||||
kim_modelname = utils::strdup(arg[0]);
|
||||
|
||||
@ -385,7 +385,7 @@ void PairKIM::coeff(int narg, char **arg)
|
||||
delete [] lmps_unique_elements;
|
||||
}
|
||||
lmps_unique_elements = new char*[atom->ntypes];
|
||||
for (i = 0; i < atom->ntypes; i++) lmps_unique_elements[i] = 0;
|
||||
for (i = 0; i < atom->ntypes; i++) lmps_unique_elements[i] = nullptr;
|
||||
|
||||
// Assume all species arguments are valid
|
||||
// errors will be detected by below
|
||||
|
||||
@ -166,7 +166,7 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl
|
||||
int ipotx,modex; double pnx;
|
||||
double vol0;
|
||||
|
||||
double *vatab,*vbtab,*vctab,*vdtab,*vetab,*p1tab,*altab,*vpairtab = 0;
|
||||
double *vatab,*vbtab,*vctab,*vdtab,*vetab,*p1tab,*altab,*vpairtab = nullptr;
|
||||
double *r0rwstab,*evol0tab;
|
||||
double (*C)[4];
|
||||
double *y,*dy;
|
||||
|
||||
@ -320,7 +320,7 @@ struct potdata2 {
|
||||
tdeppot.devol0 = maketempspline(ntemp,potlist,&(potlist[0].devol0));
|
||||
|
||||
|
||||
tdeppot.ddl[0] = 0;
|
||||
tdeppot.ddl[0] = nullptr;
|
||||
for(int k = 1; k<=4; k++)
|
||||
tdeppot.ddl[k] = maketempspline(ntemp,potlist,&(potlist[0].ddl[k]));
|
||||
|
||||
|
||||
@ -222,8 +222,8 @@ PairMGPT::triplet_data *PairMGPT::get_triplet(const double xx[][3],int i,int j,i
|
||||
|
||||
double t0,t1;
|
||||
|
||||
bond_data *bij = 0,*bik = 0;
|
||||
triplet_data *tptr = 0;
|
||||
bond_data *bij = nullptr,*bik = nullptr;
|
||||
triplet_data *tptr = nullptr;
|
||||
|
||||
t0 = gettime();
|
||||
if (recompute == 0) {
|
||||
@ -231,7 +231,7 @@ PairMGPT::triplet_data *PairMGPT::get_triplet(const double xx[][3],int i,int j,i
|
||||
bik = bhash->Lookup(Doublet(i,k));
|
||||
}
|
||||
|
||||
if (bij == 0) {
|
||||
if (bij == nullptr) {
|
||||
if (recompute == 0)
|
||||
bij = bhash->Insert(Doublet(i,j));
|
||||
else
|
||||
@ -242,7 +242,7 @@ PairMGPT::triplet_data *PairMGPT::get_triplet(const double xx[][3],int i,int j,i
|
||||
make_bond(xx,j,i,bij);
|
||||
}
|
||||
|
||||
if (bik == 0) {
|
||||
if (bik == nullptr) {
|
||||
if (recompute == 0)
|
||||
bik = bhash->Insert(Doublet(i,k));
|
||||
else
|
||||
@ -256,7 +256,7 @@ PairMGPT::triplet_data *PairMGPT::get_triplet(const double xx[][3],int i,int j,i
|
||||
t_make_b += t1-t0;
|
||||
|
||||
t0 = gettime();
|
||||
if (bij != 0 && bij != 0) {
|
||||
if (bij != nullptr && bij != nullptr) {
|
||||
tptr = twork;
|
||||
make_triplet(bij,bik,tptr);
|
||||
*dvir_ij_p = bij->fl_deriv_sum;
|
||||
@ -933,7 +933,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist,
|
||||
const int ski = (k < i) ? 1 : -1;
|
||||
|
||||
|
||||
T12 = T23 = T31 = 0;
|
||||
T12 = T23 = T31 = nullptr;
|
||||
|
||||
mj = first[j];
|
||||
/*
|
||||
@ -1042,7 +1042,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist,
|
||||
accumulate_forces_3(w3);
|
||||
}
|
||||
|
||||
if (T12 != 0) {
|
||||
if (T12 != nullptr) {
|
||||
//printf("T12 i,j,k = %d,%d,%d\n",i,j,k);
|
||||
mcount++;
|
||||
if (three_body_energies && evflag) {
|
||||
@ -1098,7 +1098,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist,
|
||||
accumulate_forces_3(w3);
|
||||
}
|
||||
|
||||
if (T23 != 0) {
|
||||
if (T23 != nullptr) {
|
||||
//printf("T23 i,j,k = %d,%d,%d\n",i,j,k);
|
||||
mcount++;
|
||||
if (three_body_energies && evflag) {
|
||||
@ -1154,7 +1154,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist,
|
||||
|
||||
}
|
||||
|
||||
if (T31 != 0) {
|
||||
if (T31 != nullptr) {
|
||||
//printf("T31 i,j,k = %d,%d,%d\n",i,j,k);
|
||||
mcount++;
|
||||
if (three_body_energies && evflag) {
|
||||
@ -1327,15 +1327,15 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist,
|
||||
tr1 = tr2 = tr3 = 0.0;
|
||||
|
||||
dvir_im = dvir_jm = dvir_km = 0.0;
|
||||
T45 = T56 = T64 = 0;
|
||||
if (T12 != 0 && c_km && c_im)
|
||||
T45 = T56 = T64 = nullptr;
|
||||
if (T12 != nullptr && c_km && c_im)
|
||||
T45 = get_triplet(xx,m,i,k,&bond_hash,&T45work,&dvir_im,&dvir_km);
|
||||
if (T23 != 0 && c_im && c_jm)
|
||||
if (T23 != nullptr && c_im && c_jm)
|
||||
T56 = get_triplet(xx,m,i,j,&bond_hash,&T56work,&dvir_im,&dvir_jm);
|
||||
if (T31 != 0 && c_jm && c_km)
|
||||
if (T31 != nullptr && c_jm && c_km)
|
||||
T64 = get_triplet(xx,m,j,k,&bond_hash,&T64work,&dvir_jm,&dvir_km);
|
||||
|
||||
if (T12 != 0 && T45 != 0) {
|
||||
if (T12 != nullptr && T45 != nullptr) {
|
||||
if (four_body_energies && evflag) {
|
||||
tr1 = transtrace(T12->H1H2,T45->H1H2);
|
||||
double dvir = ( (dvir_ij + dvir_jk + dvir_im + dvir_km)*splinepot.ve +
|
||||
@ -1364,7 +1364,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist,
|
||||
accumulate_forces_4(w4);
|
||||
}
|
||||
|
||||
if (T23 != 0 && T56 != 0) {
|
||||
if (T23 != nullptr && T56 != nullptr) {
|
||||
if (four_body_energies && evflag) {
|
||||
tr2 = transtrace(T23->H1H2,T56->H1H2);
|
||||
double dvir = ( (dvir_ki + dvir_jk + dvir_im + dvir_jm)*splinepot.ve +
|
||||
@ -1394,7 +1394,7 @@ void PairMGPT::compute_x(const int *nnei,const int * const *nlist,
|
||||
|
||||
}
|
||||
|
||||
if (T31 != 0 && T64 != 0) {
|
||||
if (T31 != nullptr && T64 != nullptr) {
|
||||
if (four_body_energies && evflag) {
|
||||
tr3 = transtrace(T31->H1H2,T64->H1H2);
|
||||
double dvir = ( (dvir_ki + dvir_ij + dvir_jm + dvir_km)*splinepot.ve +
|
||||
|
||||
@ -146,7 +146,7 @@ public:
|
||||
|
||||
table = new Link *[size];
|
||||
for(int i = 0; i<size; i++)
|
||||
table[i] = 0;
|
||||
table[i] = nullptr;
|
||||
|
||||
/* Counters for statistics */
|
||||
maxlength = 0;
|
||||
@ -157,7 +157,7 @@ public:
|
||||
~Hash() {
|
||||
for(int i = 0; i<size; i++) {
|
||||
Link *p = table[i];
|
||||
while(p != 0) {
|
||||
while(p != nullptr) {
|
||||
Link *q = p->next;
|
||||
delete p;
|
||||
p = q;
|
||||
@ -188,9 +188,9 @@ public:
|
||||
return &table[idx]->data;
|
||||
} else { /* This is for threading... and incomplete */
|
||||
typedef Link *LinkPtr;
|
||||
LinkPtr ptr = table[idx],last = 0,dataptr = new Link(key,0);
|
||||
LinkPtr ptr = table[idx],last = nullptr,dataptr = new Link(key,nullptr);
|
||||
|
||||
while(ptr != 0) {
|
||||
while(ptr != nullptr) {
|
||||
last = ptr;
|
||||
ptr = ptr->next;
|
||||
}
|
||||
@ -241,7 +241,7 @@ public:
|
||||
|
||||
|
||||
p = table[idx];
|
||||
while(p != 0 && !(p->key == key)) {
|
||||
while(p != nullptr && !(p->key == key)) {
|
||||
p = p->next;
|
||||
count = count + 1;
|
||||
}
|
||||
@ -251,9 +251,9 @@ public:
|
||||
nsearch = nsearch + 1;
|
||||
nstep = nstep + count;
|
||||
|
||||
if(p != 0) p->hits++;
|
||||
if(p != nullptr) p->hits++;
|
||||
|
||||
return (p == 0) ? 0 : &p->data;
|
||||
return (p == nullptr) ? nullptr : &p->data;
|
||||
}
|
||||
};
|
||||
|
||||
@ -469,8 +469,8 @@ public:
|
||||
return 0;
|
||||
}
|
||||
double get_weight(const int triclinic,
|
||||
const double a[3] = 0,const double b[3] = 0,
|
||||
const double c[3] = 0,const double d[3] = 0) {
|
||||
const double a[3] = nullptr,const double b[3] = nullptr,
|
||||
const double c[3] = nullptr,const double d[3] = nullptr) {
|
||||
const double
|
||||
*s0 = triclinic ? domain->sublo_lamda : domain->sublo,
|
||||
*s1 = triclinic ? domain->subhi_lamda : domain->subhi;
|
||||
@ -479,10 +479,10 @@ public:
|
||||
|
||||
for(int p = 0; p<3; p++) {
|
||||
double cog = 0.0,q,w,n = 0.0;
|
||||
if(a != 0) { cog = cog + a[p]; n = n + 1; }
|
||||
if(b != 0) { cog = cog + b[p]; n = n + 1; }
|
||||
if(c != 0) { cog = cog + c[p]; n = n + 1; }
|
||||
if(d != 0) { cog = cog + d[p]; n = n + 1; }
|
||||
if(a != nullptr) { cog = cog + a[p]; n = n + 1; }
|
||||
if(b != nullptr) { cog = cog + b[p]; n = n + 1; }
|
||||
if(c != nullptr) { cog = cog + c[p]; n = n + 1; }
|
||||
if(d != nullptr) { cog = cog + d[p]; n = n + 1; }
|
||||
cog = cog * (1.0/n);
|
||||
|
||||
if(cog < 0.5*(s0[p]+s1[p])) q = cog - s0[p];
|
||||
|
||||
@ -62,7 +62,7 @@ MLIAPModelPython::MLIAPModelPython(LAMMPS *lmp, char *coefffilename) :
|
||||
|
||||
// if LAMMPS_POTENTIALS environment variable is set, add it to PYTHONPATH as well
|
||||
const char *potentials_path = getenv("LAMMPS_POTENTIALS");
|
||||
if (potentials_path != NULL) { PyList_Append(py_path, PY_STRING_FROM_STRING(potentials_path)); }
|
||||
if (potentials_path != nullptr) { PyList_Append(py_path, PY_STRING_FROM_STRING(potentials_path)); }
|
||||
PyGILState_Release(gstate);
|
||||
|
||||
if (coefffilename) read_coeffs(coefffilename);
|
||||
|
||||
@ -20,7 +20,7 @@ namespace LAMMPS_NS {
|
||||
|
||||
class MLIAPModelPython : public MLIAPModel {
|
||||
public:
|
||||
MLIAPModelPython(LAMMPS *, char * = NULL);
|
||||
MLIAPModelPython(LAMMPS *, char * = nullptr);
|
||||
~MLIAPModelPython();
|
||||
virtual int get_nparams();
|
||||
virtual int get_gamma_nnz(class MLIAPData *);
|
||||
|
||||
@ -77,26 +77,26 @@ bool Fingerprint_bond::parse_values(std::string constant,std::vector<std::string
|
||||
int nwords,l;
|
||||
nwords=line1.size();
|
||||
if (constant.compare("re")==0) {
|
||||
re = strtod(line1[0].c_str(),NULL);
|
||||
re = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("rc")==0) {
|
||||
rc = strtod(line1[0].c_str(),NULL);
|
||||
rc = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("alphak")==0) {
|
||||
delete[] alpha_k;
|
||||
alpha_k = new double[nwords];
|
||||
for (l=0;l<nwords;l++) {
|
||||
alpha_k[l]=strtod(line1[l].c_str(),NULL);
|
||||
alpha_k[l]=strtod(line1[l].c_str(),nullptr);
|
||||
}
|
||||
}
|
||||
else if (constant.compare("dr")==0) {
|
||||
dr = strtod(line1[0].c_str(),NULL);
|
||||
dr = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("k")==0) {
|
||||
kmax = strtol(line1[0].c_str(),NULL,10);
|
||||
kmax = strtol(line1[0].c_str(),nullptr,10);
|
||||
}
|
||||
else if (constant.compare("m")==0) {
|
||||
mlength = strtol(line1[0].c_str(),NULL,10);
|
||||
mlength = strtol(line1[0].c_str(),nullptr,10);
|
||||
}
|
||||
else pair->errorf(FLERR,"Undefined value for bond power");
|
||||
if (re!=0.0 && rc!=0.0 && alpha_k[0]!=-1 && dr!=0.0 && mlength!=0 && kmax!=0)return true;
|
||||
|
||||
@ -78,26 +78,26 @@ bool Fingerprint_bondscreened::parse_values(std::string constant,std::vector<std
|
||||
int nwords,l;
|
||||
nwords=line1.size();
|
||||
if (constant.compare("re")==0) {
|
||||
re = strtod(line1[0].c_str(),NULL);
|
||||
re = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("rc")==0) {
|
||||
rc = strtod(line1[0].c_str(),NULL);
|
||||
rc = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("alphak")==0) {
|
||||
delete[] alpha_k;
|
||||
alpha_k = new double[nwords];
|
||||
for (l=0;l<nwords;l++) {
|
||||
alpha_k[l]=strtod(line1[l].c_str(),NULL);
|
||||
alpha_k[l]=strtod(line1[l].c_str(),nullptr);
|
||||
}
|
||||
}
|
||||
else if (constant.compare("dr")==0) {
|
||||
dr = strtod(line1[0].c_str(),NULL);
|
||||
dr = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("k")==0) {
|
||||
kmax = strtol(line1[0].c_str(),NULL,10);
|
||||
kmax = strtol(line1[0].c_str(),nullptr,10);
|
||||
}
|
||||
else if (constant.compare("m")==0) {
|
||||
mlength = strtol(line1[0].c_str(),NULL,10);
|
||||
mlength = strtol(line1[0].c_str(),nullptr,10);
|
||||
}
|
||||
else pair->errorf(FLERR,"Undefined value for bond power");
|
||||
if (re!=0.0 && rc!=0.0 && alpha_k[0]!=-1 && dr!=0.0 && mlength!=0 && kmax!=0)return true;
|
||||
|
||||
@ -79,26 +79,26 @@ bool Fingerprint_bondscreenedspin::parse_values(std::string constant,std::vector
|
||||
int nwords,l;
|
||||
nwords=line1.size();
|
||||
if (constant.compare("re")==0) {
|
||||
re = strtod(line1[0].c_str(),NULL);
|
||||
re = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("rc")==0) {
|
||||
rc = strtod(line1[0].c_str(),NULL);
|
||||
rc = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("alphak")==0) {
|
||||
delete[] alpha_k;
|
||||
alpha_k = new double[nwords];
|
||||
for (l=0;l<nwords;l++) {
|
||||
alpha_k[l]=strtod(line1[l].c_str(),NULL);
|
||||
alpha_k[l]=strtod(line1[l].c_str(),nullptr);
|
||||
}
|
||||
}
|
||||
else if (constant.compare("dr")==0) {
|
||||
dr = strtod(line1[0].c_str(),NULL);
|
||||
dr = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("k")==0) {
|
||||
kmax = strtol(line1[0].c_str(),NULL,10);
|
||||
kmax = strtol(line1[0].c_str(),nullptr,10);
|
||||
}
|
||||
else if (constant.compare("m")==0) {
|
||||
mlength = strtol(line1[0].c_str(),NULL,10);
|
||||
mlength = strtol(line1[0].c_str(),nullptr,10);
|
||||
}
|
||||
else pair->errorf(FLERR,"Undefined value for bond power");
|
||||
if (re!=0.0 && rc!=0.0 && alpha_k[0]!=-1 && dr!=0.0 && mlength!=0 && kmax!=0)return true;
|
||||
|
||||
@ -78,26 +78,26 @@ bool Fingerprint_bondspin::parse_values(std::string constant,std::vector<std::st
|
||||
int nwords,l;
|
||||
nwords=line1.size();
|
||||
if (constant.compare("re")==0) {
|
||||
re = strtod(line1[0].c_str(),NULL);
|
||||
re = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("rc")==0) {
|
||||
rc = strtod(line1[0].c_str(),NULL);
|
||||
rc = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("alphak")==0) {
|
||||
delete[] alpha_k;
|
||||
alpha_k = new double[nwords];
|
||||
for (l=0;l<nwords;l++) {
|
||||
alpha_k[l]=strtod(line1[l].c_str(),NULL);
|
||||
alpha_k[l]=strtod(line1[l].c_str(),nullptr);
|
||||
}
|
||||
}
|
||||
else if (constant.compare("dr")==0) {
|
||||
dr = strtod(line1[0].c_str(),NULL);
|
||||
dr = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("k")==0) {
|
||||
kmax = strtol(line1[0].c_str(),NULL,10);
|
||||
kmax = strtol(line1[0].c_str(),nullptr,10);
|
||||
}
|
||||
else if (constant.compare("m")==0) {
|
||||
mlength = strtol(line1[0].c_str(),NULL,10);
|
||||
mlength = strtol(line1[0].c_str(),nullptr,10);
|
||||
}
|
||||
else pair->errorf(FLERR,"Undefined value for bond power");
|
||||
if (re!=0.0 && rc!=0.0 && alpha_k[0]!=-1 && dr!=0.0 && mlength!=0 && kmax!=0)return true;
|
||||
|
||||
@ -67,30 +67,30 @@ bool Fingerprint_radial::parse_values(std::string constant,std::vector<std::stri
|
||||
int l;
|
||||
int nwords=line1.size();
|
||||
if (constant.compare("re")==0) {
|
||||
re = strtod(line1[0].c_str(),NULL);
|
||||
re = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("rc")==0) {
|
||||
rc = strtod(line1[0].c_str(),NULL);
|
||||
rc = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("alpha")==0) {
|
||||
delete[] alpha;
|
||||
alpha = new double[nwords];
|
||||
for (l=0;l<nwords;l++) {
|
||||
alpha[l]=strtod(line1[l].c_str(),NULL);
|
||||
alpha[l]=strtod(line1[l].c_str(),nullptr);
|
||||
}
|
||||
}
|
||||
else if (constant.compare("dr")==0) {
|
||||
dr = strtod(line1[0].c_str(),NULL);
|
||||
dr = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("n")==0) {
|
||||
nmax = strtol(line1[0].c_str(),NULL,10);
|
||||
nmax = strtol(line1[0].c_str(),nullptr,10);
|
||||
}
|
||||
else if (constant.compare("o")==0) {
|
||||
omin = strtol(line1[0].c_str(),NULL,10);
|
||||
omin = strtol(line1[0].c_str(),nullptr,10);
|
||||
}
|
||||
else pair->errorf(FLERR,"Undefined value for radial power");
|
||||
//code will run with default o=0 if o is never specified. All other values must be defined in potential file.
|
||||
if (re!=0 && rc!=0 && alpha!=0 && dr!=0 && nmax!=0)return true;
|
||||
if (re!=0 && rc!=0 && alpha!=nullptr && dr!=0 && nmax!=0)return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -68,30 +68,30 @@ bool Fingerprint_radialscreened::parse_values(std::string constant,std::vector<s
|
||||
int l;
|
||||
int nwords=line1.size();
|
||||
if (constant.compare("re")==0) {
|
||||
re = strtod(line1[0].c_str(),NULL);
|
||||
re = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("rc")==0) {
|
||||
rc = strtod(line1[0].c_str(),NULL);
|
||||
rc = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("alpha")==0) {
|
||||
delete[] alpha;
|
||||
alpha = new double[nwords];
|
||||
for (l=0;l<nwords;l++) {
|
||||
alpha[l]=strtod(line1[l].c_str(),NULL);
|
||||
alpha[l]=strtod(line1[l].c_str(),nullptr);
|
||||
}
|
||||
}
|
||||
else if (constant.compare("dr")==0) {
|
||||
dr = strtod(line1[0].c_str(),NULL);
|
||||
dr = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("n")==0) {
|
||||
nmax = strtol(line1[0].c_str(),NULL,10);
|
||||
nmax = strtol(line1[0].c_str(),nullptr,10);
|
||||
}
|
||||
else if (constant.compare("o")==0) {
|
||||
omin = strtol(line1[0].c_str(),NULL,10);
|
||||
omin = strtol(line1[0].c_str(),nullptr,10);
|
||||
}
|
||||
else pair->errorf(FLERR,"Undefined value for radial power");
|
||||
//code will run with default o=0 if o is never specified. All other values must be defined in potential file.
|
||||
if (re!=0 && rc!=0 && alpha!=0 && dr!=0 && nmax!=0)return true;
|
||||
if (re!=0 && rc!=0 && alpha!=nullptr && dr!=0 && nmax!=0)return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -69,30 +69,30 @@ bool Fingerprint_radialscreenedspin::parse_values(std::string constant,std::vect
|
||||
int l;
|
||||
int nwords=line1.size();
|
||||
if (constant.compare("re")==0) {
|
||||
re = strtod(line1[0].c_str(),NULL);
|
||||
re = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("rc")==0) {
|
||||
rc = strtod(line1[0].c_str(),NULL);
|
||||
rc = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("alpha")==0) {
|
||||
delete[] alpha;
|
||||
alpha = new double[nwords];
|
||||
for (l=0;l<nwords;l++) {
|
||||
alpha[l]=strtod(line1[l].c_str(),NULL);
|
||||
alpha[l]=strtod(line1[l].c_str(),nullptr);
|
||||
}
|
||||
}
|
||||
else if (constant.compare("dr")==0) {
|
||||
dr = strtod(line1[0].c_str(),NULL);
|
||||
dr = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("n")==0) {
|
||||
nmax = strtol(line1[0].c_str(),NULL,10);
|
||||
nmax = strtol(line1[0].c_str(),nullptr,10);
|
||||
}
|
||||
else if (constant.compare("o")==0) {
|
||||
omin = strtol(line1[0].c_str(),NULL,10);
|
||||
omin = strtol(line1[0].c_str(),nullptr,10);
|
||||
}
|
||||
else pair->errorf(FLERR,"Undefined value for radial power");
|
||||
//code will run with default o=0 if o is never specified. All other values must be defined in potential file.
|
||||
if (re!=0 && rc!=0 && alpha!=0 && dr!=0 && nmax!=0)return true;
|
||||
if (re!=0 && rc!=0 && alpha!=nullptr && dr!=0 && nmax!=0)return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -68,30 +68,30 @@ bool Fingerprint_radialspin::parse_values(std::string constant,std::vector<std::
|
||||
int l;
|
||||
int nwords=line1.size();
|
||||
if (constant.compare("re")==0) {
|
||||
re = strtod(line1[0].c_str(),NULL);
|
||||
re = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("rc")==0) {
|
||||
rc = strtod(line1[0].c_str(),NULL);
|
||||
rc = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("alpha")==0) {
|
||||
delete[] alpha;
|
||||
alpha = new double[nwords];
|
||||
for (l=0;l<nwords;l++) {
|
||||
alpha[l]=strtod(line1[l].c_str(),NULL);
|
||||
alpha[l]=strtod(line1[l].c_str(),nullptr);
|
||||
}
|
||||
}
|
||||
else if (constant.compare("dr")==0) {
|
||||
dr = strtod(line1[0].c_str(),NULL);
|
||||
dr = strtod(line1[0].c_str(),nullptr);
|
||||
}
|
||||
else if (constant.compare("n")==0) {
|
||||
nmax = strtol(line1[0].c_str(),NULL,10);
|
||||
nmax = strtol(line1[0].c_str(),nullptr,10);
|
||||
}
|
||||
else if (constant.compare("o")==0) {
|
||||
omin = strtol(line1[0].c_str(),NULL,10);
|
||||
omin = strtol(line1[0].c_str(),nullptr,10);
|
||||
}
|
||||
else pair->errorf(FLERR,"Undefined value for radial power");
|
||||
//code will run with default o=0 if o is never specified. All other values must be defined in potential file.
|
||||
if (re!=0 && rc!=0 && alpha!=0 && dr!=0 && nmax!=0)return true;
|
||||
if (re!=0 && rc!=0 && alpha!=nullptr && dr!=0 && nmax!=0)return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@ static int solve_cyc_tridiag( const double diag[], size_t d_stride,
|
||||
double * c = (double *) malloc (N * sizeof (double));
|
||||
double * z = (double *) malloc (N * sizeof (double));
|
||||
|
||||
if (delta == 0 || gamma == 0 || alpha == 0 || c == 0 || z == 0) {
|
||||
if (delta == nullptr || gamma == nullptr || alpha == nullptr || c == nullptr || z == nullptr) {
|
||||
if (warn)
|
||||
fprintf(stderr,"Internal Cyclic Spline Error: failed to allocate working space\n");
|
||||
|
||||
|
||||
@ -113,7 +113,7 @@ class MolfileInterface {
|
||||
// inquire on interface status
|
||||
|
||||
// true if file stream is active.
|
||||
bool is_open() const { return (_ptr != 0); };
|
||||
bool is_open() const { return (_ptr != nullptr); };
|
||||
// true if file format requires or provides atom properties
|
||||
bool has_props() const { return (_mode & (M_RSTRUCT | M_WSTRUCT)) != 0; };
|
||||
// true if file format can read or write velocities
|
||||
|
||||
@ -332,7 +332,7 @@ void PairBuckLongCoulLongOMP::compute_inner()
|
||||
loop_setup_thr(ifrom, ito, tid, inum, nthreads);
|
||||
ThrData *thr = fix->get_thr(tid);
|
||||
thr->timer(Timer::START);
|
||||
ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr);
|
||||
ev_setup_thr(0, 0, nall, nullptr, nullptr, nullptr, thr);
|
||||
eval_inner(ifrom, ito, thr);
|
||||
thr->timer(Timer::PAIR);
|
||||
|
||||
@ -357,7 +357,7 @@ void PairBuckLongCoulLongOMP::compute_middle()
|
||||
loop_setup_thr(ifrom, ito, tid, inum, nthreads);
|
||||
ThrData *thr = fix->get_thr(tid);
|
||||
thr->timer(Timer::START);
|
||||
ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr);
|
||||
ev_setup_thr(0, 0, nall, nullptr, nullptr, nullptr, thr);
|
||||
eval_middle(ifrom, ito, thr);
|
||||
thr->timer(Timer::PAIR);
|
||||
|
||||
@ -810,7 +810,7 @@ void PairBuckLongCoulLongOMP::eval_inner(int iifrom, int iito, ThrData * const t
|
||||
const double qqrd2e = force->qqrd2e;
|
||||
|
||||
const double *x0 = x[0];
|
||||
double *f0 = f[0], *fi = 0;
|
||||
double *f0 = f[0], *fi = nullptr;
|
||||
|
||||
int *ilist = list->ilist_inner;
|
||||
|
||||
@ -903,7 +903,7 @@ void PairBuckLongCoulLongOMP::eval_middle(int iifrom, int iito, ThrData * const
|
||||
const double qqrd2e = force->qqrd2e;
|
||||
|
||||
const double *x0 = x[0];
|
||||
double *f0 = f[0], *fi = 0;
|
||||
double *f0 = f[0], *fi = nullptr;
|
||||
|
||||
int *ilist = list->ilist_middle;
|
||||
|
||||
|
||||
@ -331,7 +331,7 @@ void PairLJLongCoulLongOMP::compute_inner()
|
||||
loop_setup_thr(ifrom, ito, tid, inum, nthreads);
|
||||
ThrData *thr = fix->get_thr(tid);
|
||||
thr->timer(Timer::START);
|
||||
ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr);
|
||||
ev_setup_thr(0, 0, nall, nullptr, nullptr, nullptr, thr);
|
||||
eval_inner(ifrom, ito, thr);
|
||||
thr->timer(Timer::PAIR);
|
||||
|
||||
@ -356,7 +356,7 @@ void PairLJLongCoulLongOMP::compute_middle()
|
||||
loop_setup_thr(ifrom, ito, tid, inum, nthreads);
|
||||
ThrData *thr = fix->get_thr(tid);
|
||||
thr->timer(Timer::START);
|
||||
ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr);
|
||||
ev_setup_thr(0, 0, nall, nullptr, nullptr, nullptr, thr);
|
||||
eval_middle(ifrom, ito, thr);
|
||||
thr->timer(Timer::PAIR);
|
||||
|
||||
@ -805,7 +805,7 @@ void PairLJLongCoulLongOMP::eval_inner(int iifrom, int iito, ThrData * const thr
|
||||
const double qqrd2e = force->qqrd2e;
|
||||
|
||||
const double *x0 = x[0];
|
||||
double *f0 = f[0], *fi = 0;
|
||||
double *f0 = f[0], *fi = nullptr;
|
||||
|
||||
int *ilist = list->ilist_inner;
|
||||
|
||||
@ -896,7 +896,7 @@ void PairLJLongCoulLongOMP::eval_middle(int iifrom, int iito, ThrData * const th
|
||||
const double qqrd2e = force->qqrd2e;
|
||||
|
||||
const double *x0 = x[0];
|
||||
double *f0 = f[0], *fi = 0;
|
||||
double *f0 = f[0], *fi = nullptr;
|
||||
|
||||
int *ilist = list->ilist_middle;
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* -------------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -17,8 +16,8 @@
|
||||
per-thread data management for LAMMPS
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
#include "thr_data.h"
|
||||
|
||||
@ -29,21 +28,20 @@ using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ThrData::ThrData(int tid, Timer *t)
|
||||
: _f(0),_torque(0),_erforce(0),_de(0),_drho(0),_mu(0),_lambda(0),_rhoB(0),
|
||||
_D_values(0),_rho(0),_fp(0),_rho1d(0),_drho1d(0),_rho1d_6(0),_drho1d_6(0),
|
||||
_tid(tid), _timer(t)
|
||||
ThrData::ThrData(int tid, Timer *t) :
|
||||
_f(nullptr), _torque(nullptr), _erforce(nullptr), _de(nullptr), _drho(nullptr), _mu(nullptr),
|
||||
_lambda(nullptr), _rhoB(nullptr), _D_values(nullptr), _rho(nullptr), _fp(nullptr),
|
||||
_rho1d(nullptr), _drho1d(nullptr), _rho1d_6(nullptr), _drho1d_6(nullptr), _tid(tid), _timer(t)
|
||||
{
|
||||
_timer_active = 0;
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ThrData::check_tid(int tid)
|
||||
{
|
||||
if (tid != _tid)
|
||||
fprintf(stderr,"WARNING: external and internal tid mismatch %d != %d\n",tid,_tid);
|
||||
fprintf(stderr, "WARNING: external and internal tid mismatch %d != %d\n", tid, _tid);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -53,9 +51,7 @@ void ThrData::_stamp(enum Timer::ttype flag)
|
||||
// do nothing until it gets set to 0 in ::setup()
|
||||
if (_timer_active < 0) return;
|
||||
|
||||
if (flag == Timer::START) {
|
||||
_timer_active = 1;
|
||||
}
|
||||
if (flag == Timer::START) { _timer_active = 1; }
|
||||
|
||||
if (_timer_active) _timer->stamp(flag);
|
||||
}
|
||||
@ -72,44 +68,49 @@ double ThrData::get_time(enum Timer::ttype flag)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void ThrData::init_force(int nall, double **f, double **torque,
|
||||
double *erforce, double *de, double *drho)
|
||||
void ThrData::init_force(int nall, double **f, double **torque, double *erforce, double *de,
|
||||
double *drho)
|
||||
{
|
||||
eng_vdwl=eng_coul=eng_bond=eng_angle=eng_dihed=eng_imprp=eng_kspce=0.0;
|
||||
memset(virial_pair,0,6*sizeof(double));
|
||||
memset(virial_bond,0,6*sizeof(double));
|
||||
memset(virial_angle,0,6*sizeof(double));
|
||||
memset(virial_dihed,0,6*sizeof(double));
|
||||
memset(virial_imprp,0,6*sizeof(double));
|
||||
memset(virial_kspce,0,6*sizeof(double));
|
||||
eng_vdwl = eng_coul = eng_bond = eng_angle = eng_dihed = eng_imprp = eng_kspce = 0.0;
|
||||
memset(virial_pair, 0, 6 * sizeof(double));
|
||||
memset(virial_bond, 0, 6 * sizeof(double));
|
||||
memset(virial_angle, 0, 6 * sizeof(double));
|
||||
memset(virial_dihed, 0, 6 * sizeof(double));
|
||||
memset(virial_imprp, 0, 6 * sizeof(double));
|
||||
memset(virial_kspce, 0, 6 * sizeof(double));
|
||||
|
||||
eatom_pair=eatom_bond=eatom_angle=eatom_dihed=eatom_imprp=eatom_kspce=nullptr;
|
||||
vatom_pair=vatom_bond=vatom_angle=vatom_dihed=vatom_imprp=vatom_kspce=nullptr;
|
||||
eatom_pair = eatom_bond = eatom_angle = eatom_dihed = eatom_imprp = eatom_kspce = nullptr;
|
||||
vatom_pair = vatom_bond = vatom_angle = vatom_dihed = vatom_imprp = vatom_kspce = nullptr;
|
||||
|
||||
if (nall >= 0 && f) {
|
||||
_f = f + _tid*nall;
|
||||
memset(&(_f[0][0]),0,nall*3*sizeof(double));
|
||||
} else _f = nullptr;
|
||||
_f = f + _tid * nall;
|
||||
memset(&(_f[0][0]), 0, nall * 3 * sizeof(double));
|
||||
} else
|
||||
_f = nullptr;
|
||||
|
||||
if (nall >= 0 && torque) {
|
||||
_torque = torque + _tid*nall;
|
||||
memset(&(_torque[0][0]),0,nall*3*sizeof(double));
|
||||
} else _torque = nullptr;
|
||||
_torque = torque + _tid * nall;
|
||||
memset(&(_torque[0][0]), 0, nall * 3 * sizeof(double));
|
||||
} else
|
||||
_torque = nullptr;
|
||||
|
||||
if (nall >= 0 && erforce) {
|
||||
_erforce = erforce + _tid*nall;
|
||||
memset(&(_erforce[0]),0,nall*sizeof(double));
|
||||
} else _erforce = nullptr;
|
||||
_erforce = erforce + _tid * nall;
|
||||
memset(&(_erforce[0]), 0, nall * sizeof(double));
|
||||
} else
|
||||
_erforce = nullptr;
|
||||
|
||||
if (nall >= 0 && de) {
|
||||
_de = de + _tid*nall;
|
||||
memset(&(_de[0]),0,nall*sizeof(double));
|
||||
} else _de = nullptr;
|
||||
_de = de + _tid * nall;
|
||||
memset(&(_de[0]), 0, nall * sizeof(double));
|
||||
} else
|
||||
_de = nullptr;
|
||||
|
||||
if (nall >= 0 && drho) {
|
||||
_drho = drho + _tid*nall;
|
||||
memset(&(_drho[0]),0,nall*sizeof(double));
|
||||
} else _drho = nullptr;
|
||||
_drho = drho + _tid * nall;
|
||||
memset(&(_drho[0]), 0, nall * sizeof(double));
|
||||
} else
|
||||
_drho = nullptr;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -119,8 +120,8 @@ void ThrData::init_force(int nall, double **f, double **torque,
|
||||
void ThrData::init_eam(int nall, double *rho)
|
||||
{
|
||||
if (nall >= 0 && rho) {
|
||||
_rho = rho + _tid*nall;
|
||||
memset(_rho, 0, nall*sizeof(double));
|
||||
_rho = rho + _tid * nall;
|
||||
memset(_rho, 0, nall * sizeof(double));
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,10 +132,10 @@ void ThrData::init_adp(int nall, double *rho, double **mu, double **lambda)
|
||||
init_eam(nall, rho);
|
||||
|
||||
if (nall >= 0 && mu && lambda) {
|
||||
_mu = mu + _tid*nall;
|
||||
_lambda = lambda + _tid*nall;
|
||||
memset(&(_mu[0][0]), 0, nall*3*sizeof(double));
|
||||
memset(&(_lambda[0][0]), 0, nall*6*sizeof(double));
|
||||
_mu = mu + _tid * nall;
|
||||
_lambda = lambda + _tid * nall;
|
||||
memset(&(_mu[0][0]), 0, nall * 3 * sizeof(double));
|
||||
memset(&(_lambda[0][0]), 0, nall * 6 * sizeof(double));
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,8 +146,8 @@ void ThrData::init_eim(int nall, double *rho, double *fp)
|
||||
init_eam(nall, rho);
|
||||
|
||||
if (nall >= 0 && fp) {
|
||||
_fp = fp + _tid*nall;
|
||||
memset(_fp,0,nall*sizeof(double));
|
||||
_fp = fp + _tid * nall;
|
||||
memset(_fp, 0, nall * sizeof(double));
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,18 +167,18 @@ void ThrData::init_pppm(int order, Memory *memory)
|
||||
if (order > 0) {
|
||||
rho1d = static_cast<FFT_SCALAR **>(_rho1d);
|
||||
drho1d = static_cast<FFT_SCALAR **>(_drho1d);
|
||||
if (rho1d) memory->destroy2d_offset(rho1d,-order/2);
|
||||
if (drho1d) memory->destroy2d_offset(drho1d,-order/2);
|
||||
memory->create2d_offset(rho1d,3,-order/2,order/2,"thr_data:rho1d");
|
||||
memory->create2d_offset(drho1d,3,-order/2,order/2,"thr_data:drho1d");
|
||||
if (rho1d) memory->destroy2d_offset(rho1d, -order / 2);
|
||||
if (drho1d) memory->destroy2d_offset(drho1d, -order / 2);
|
||||
memory->create2d_offset(rho1d, 3, -order / 2, order / 2, "thr_data:rho1d");
|
||||
memory->create2d_offset(drho1d, 3, -order / 2, order / 2, "thr_data:drho1d");
|
||||
_rho1d = static_cast<void *>(rho1d);
|
||||
_drho1d = static_cast<void *>(drho1d);
|
||||
} else {
|
||||
order = -order;
|
||||
rho1d = static_cast<FFT_SCALAR **>(_rho1d);
|
||||
drho1d = static_cast<FFT_SCALAR **>(_drho1d);
|
||||
if (rho1d) memory->destroy2d_offset(rho1d,-order/2);
|
||||
if (drho1d) memory->destroy2d_offset(drho1d,-order/2);
|
||||
if (rho1d) memory->destroy2d_offset(rho1d, -order / 2);
|
||||
if (drho1d) memory->destroy2d_offset(drho1d, -order / 2);
|
||||
_rho1d = nullptr;
|
||||
_drho1d = nullptr;
|
||||
}
|
||||
@ -199,18 +200,18 @@ void ThrData::init_pppm_disp(int order_6, Memory *memory)
|
||||
if (order_6 > 0) {
|
||||
rho1d_6 = static_cast<FFT_SCALAR **>(_rho1d_6);
|
||||
drho1d_6 = static_cast<FFT_SCALAR **>(_drho1d_6);
|
||||
if (rho1d_6) memory->destroy2d_offset(rho1d_6,-order_6/2);
|
||||
if (drho1d_6) memory->destroy2d_offset(drho1d_6,-order_6/2);
|
||||
memory->create2d_offset(rho1d_6,3,-order_6/2,order_6/2,"thr_data:rho1d_6");
|
||||
memory->create2d_offset(drho1d_6,3,-order_6/2,order_6/2,"thr_data:drho1d_6");
|
||||
if (rho1d_6) memory->destroy2d_offset(rho1d_6, -order_6 / 2);
|
||||
if (drho1d_6) memory->destroy2d_offset(drho1d_6, -order_6 / 2);
|
||||
memory->create2d_offset(rho1d_6, 3, -order_6 / 2, order_6 / 2, "thr_data:rho1d_6");
|
||||
memory->create2d_offset(drho1d_6, 3, -order_6 / 2, order_6 / 2, "thr_data:drho1d_6");
|
||||
_rho1d_6 = static_cast<void *>(rho1d_6);
|
||||
_drho1d_6 = static_cast<void *>(drho1d_6);
|
||||
} else {
|
||||
order_6 = -order_6;
|
||||
rho1d_6 = static_cast<FFT_SCALAR **>(_rho1d_6);
|
||||
drho1d_6 = static_cast<FFT_SCALAR **>(_drho1d_6);
|
||||
if (rho1d_6) memory->destroy2d_offset(rho1d_6,-order_6/2);
|
||||
if (drho1d_6) memory->destroy2d_offset(drho1d_6,-order_6/2);
|
||||
if (rho1d_6) memory->destroy2d_offset(rho1d_6, -order_6 / 2);
|
||||
if (drho1d_6) memory->destroy2d_offset(drho1d_6, -order_6 / 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -227,35 +228,35 @@ void ThrData::virial_fdotr_compute(double **x, int nlocal, int nghost, int nfirs
|
||||
if (nfirst < 0) {
|
||||
int nall = nlocal + nghost;
|
||||
for (int i = 0; i < nall; i++) {
|
||||
virial_pair[0] += _f[i][0]*x[i][0];
|
||||
virial_pair[1] += _f[i][1]*x[i][1];
|
||||
virial_pair[2] += _f[i][2]*x[i][2];
|
||||
virial_pair[3] += _f[i][1]*x[i][0];
|
||||
virial_pair[4] += _f[i][2]*x[i][0];
|
||||
virial_pair[5] += _f[i][2]*x[i][1];
|
||||
virial_pair[0] += _f[i][0] * x[i][0];
|
||||
virial_pair[1] += _f[i][1] * x[i][1];
|
||||
virial_pair[2] += _f[i][2] * x[i][2];
|
||||
virial_pair[3] += _f[i][1] * x[i][0];
|
||||
virial_pair[4] += _f[i][2] * x[i][0];
|
||||
virial_pair[5] += _f[i][2] * x[i][1];
|
||||
}
|
||||
|
||||
// neighbor includegroup flag is set
|
||||
// sum over force on initial nfirst particles and ghosts
|
||||
// neighbor includegroup flag is set
|
||||
// sum over force on initial nfirst particles and ghosts
|
||||
|
||||
} else {
|
||||
int nall = nfirst;
|
||||
for (int i = 0; i < nall; i++) {
|
||||
virial_pair[0] += _f[i][0]*x[i][0];
|
||||
virial_pair[1] += _f[i][1]*x[i][1];
|
||||
virial_pair[2] += _f[i][2]*x[i][2];
|
||||
virial_pair[3] += _f[i][1]*x[i][0];
|
||||
virial_pair[4] += _f[i][2]*x[i][0];
|
||||
virial_pair[5] += _f[i][2]*x[i][1];
|
||||
virial_pair[0] += _f[i][0] * x[i][0];
|
||||
virial_pair[1] += _f[i][1] * x[i][1];
|
||||
virial_pair[2] += _f[i][2] * x[i][2];
|
||||
virial_pair[3] += _f[i][1] * x[i][0];
|
||||
virial_pair[4] += _f[i][2] * x[i][0];
|
||||
virial_pair[5] += _f[i][2] * x[i][1];
|
||||
}
|
||||
nall = nlocal + nghost;
|
||||
for (int i = nlocal; i < nall; i++) {
|
||||
virial_pair[0] += _f[i][0]*x[i][0];
|
||||
virial_pair[1] += _f[i][1]*x[i][1];
|
||||
virial_pair[2] += _f[i][2]*x[i][2];
|
||||
virial_pair[3] += _f[i][1]*x[i][0];
|
||||
virial_pair[4] += _f[i][2]*x[i][0];
|
||||
virial_pair[5] += _f[i][2]*x[i][1];
|
||||
virial_pair[0] += _f[i][0] * x[i][0];
|
||||
virial_pair[1] += _f[i][1] * x[i][1];
|
||||
virial_pair[2] += _f[i][2] * x[i][2];
|
||||
virial_pair[3] += _f[i][1] * x[i][0];
|
||||
virial_pair[4] += _f[i][2] * x[i][0];
|
||||
virial_pair[5] += _f[i][2] * x[i][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -264,9 +265,9 @@ void ThrData::virial_fdotr_compute(double **x, int nlocal, int nghost, int nfirs
|
||||
|
||||
double ThrData::memory_usage()
|
||||
{
|
||||
double bytes = (7 + 6*6) * sizeof(double);
|
||||
bytes += (double)2 * sizeof(double*);
|
||||
bytes += (double)4 * sizeof(int);
|
||||
double bytes = (7 + 6 * 6) * sizeof(double);
|
||||
bytes += (double) 2 * sizeof(double *);
|
||||
bytes += (double) 4 * sizeof(int);
|
||||
|
||||
return bytes;
|
||||
}
|
||||
@ -287,10 +288,10 @@ void LAMMPS_NS::data_reduce_thr(double *dall, int nall, int nthreads, int ndim,
|
||||
if (nthreads == 1) return;
|
||||
#pragma omp barrier
|
||||
{
|
||||
const int nvals = ndim*nall;
|
||||
const int idelta = nvals/nthreads + 1;
|
||||
const int ifrom = tid*idelta;
|
||||
const int ito = ((ifrom + idelta) > nvals) ? nvals : (ifrom + idelta);
|
||||
const int nvals = ndim * nall;
|
||||
const int idelta = nvals / nthreads + 1;
|
||||
const int ifrom = tid * idelta;
|
||||
const int ito = ((ifrom + idelta) > nvals) ? nvals : (ifrom + idelta);
|
||||
|
||||
#if defined(USER_OMP_NO_UNROLL)
|
||||
if (ifrom < nvals) {
|
||||
@ -298,8 +299,8 @@ void LAMMPS_NS::data_reduce_thr(double *dall, int nall, int nthreads, int ndim,
|
||||
|
||||
for (m = ifrom; m < ito; ++m) {
|
||||
for (int n = 1; n < nthreads; ++n) {
|
||||
dall[m] += dall[n*nvals + m];
|
||||
dall[n*nvals + m] = 0.0;
|
||||
dall[m] += dall[n * nvals + m];
|
||||
dall[n * nvals + m] = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -313,47 +314,47 @@ void LAMMPS_NS::data_reduce_thr(double *dall, int nall, int nthreads, int ndim,
|
||||
// contiguous values in the array at a time
|
||||
// -- modify this code based on the size of the cache line
|
||||
double t0, t1, t2, t3, t4, t5, t6, t7;
|
||||
for (m = ifrom; m < (ito-7); m+=8) {
|
||||
t0 = dall[m ];
|
||||
t1 = dall[m+1];
|
||||
t2 = dall[m+2];
|
||||
t3 = dall[m+3];
|
||||
t4 = dall[m+4];
|
||||
t5 = dall[m+5];
|
||||
t6 = dall[m+6];
|
||||
t7 = dall[m+7];
|
||||
for (m = ifrom; m < (ito - 7); m += 8) {
|
||||
t0 = dall[m];
|
||||
t1 = dall[m + 1];
|
||||
t2 = dall[m + 2];
|
||||
t3 = dall[m + 3];
|
||||
t4 = dall[m + 4];
|
||||
t5 = dall[m + 5];
|
||||
t6 = dall[m + 6];
|
||||
t7 = dall[m + 7];
|
||||
for (int n = 1; n < nthreads; ++n) {
|
||||
t0 += dall[n*nvals + m ];
|
||||
t1 += dall[n*nvals + m+1];
|
||||
t2 += dall[n*nvals + m+2];
|
||||
t3 += dall[n*nvals + m+3];
|
||||
t4 += dall[n*nvals + m+4];
|
||||
t5 += dall[n*nvals + m+5];
|
||||
t6 += dall[n*nvals + m+6];
|
||||
t7 += dall[n*nvals + m+7];
|
||||
dall[n*nvals + m ] = 0.0;
|
||||
dall[n*nvals + m+1] = 0.0;
|
||||
dall[n*nvals + m+2] = 0.0;
|
||||
dall[n*nvals + m+3] = 0.0;
|
||||
dall[n*nvals + m+4] = 0.0;
|
||||
dall[n*nvals + m+5] = 0.0;
|
||||
dall[n*nvals + m+6] = 0.0;
|
||||
dall[n*nvals + m+7] = 0.0;
|
||||
t0 += dall[n * nvals + m];
|
||||
t1 += dall[n * nvals + m + 1];
|
||||
t2 += dall[n * nvals + m + 2];
|
||||
t3 += dall[n * nvals + m + 3];
|
||||
t4 += dall[n * nvals + m + 4];
|
||||
t5 += dall[n * nvals + m + 5];
|
||||
t6 += dall[n * nvals + m + 6];
|
||||
t7 += dall[n * nvals + m + 7];
|
||||
dall[n * nvals + m] = 0.0;
|
||||
dall[n * nvals + m + 1] = 0.0;
|
||||
dall[n * nvals + m + 2] = 0.0;
|
||||
dall[n * nvals + m + 3] = 0.0;
|
||||
dall[n * nvals + m + 4] = 0.0;
|
||||
dall[n * nvals + m + 5] = 0.0;
|
||||
dall[n * nvals + m + 6] = 0.0;
|
||||
dall[n * nvals + m + 7] = 0.0;
|
||||
}
|
||||
dall[m ] = t0;
|
||||
dall[m+1] = t1;
|
||||
dall[m+2] = t2;
|
||||
dall[m+3] = t3;
|
||||
dall[m+4] = t4;
|
||||
dall[m+5] = t5;
|
||||
dall[m+6] = t6;
|
||||
dall[m+7] = t7;
|
||||
dall[m] = t0;
|
||||
dall[m + 1] = t1;
|
||||
dall[m + 2] = t2;
|
||||
dall[m + 3] = t3;
|
||||
dall[m + 4] = t4;
|
||||
dall[m + 5] = t5;
|
||||
dall[m + 6] = t6;
|
||||
dall[m + 7] = t7;
|
||||
}
|
||||
// do the last < 8 values
|
||||
for (; m < ito; m++) {
|
||||
for (int n = 1; n < nthreads; ++n) {
|
||||
dall[m] += dall[n*nvals + m];
|
||||
dall[n*nvals + m] = 0.0;
|
||||
dall[m] += dall[n * nvals + m];
|
||||
dall[n * nvals + m] = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -349,8 +349,8 @@ void PairEAMOpt::eval()
|
||||
ff[i].z += tmpfz;
|
||||
}
|
||||
|
||||
free(fast_alpha); fast_alpha = 0;
|
||||
free(fast_gamma); fast_gamma = 0;
|
||||
free(fast_alpha); fast_alpha = nullptr;
|
||||
free(fast_gamma); fast_gamma = nullptr;
|
||||
|
||||
if (vflag_fdotr) virial_fdotr_compute();
|
||||
}
|
||||
|
||||
@ -333,7 +333,7 @@ void PairLJCharmmCoulLongOpt::eval()
|
||||
ff[i].z += tmpfz;
|
||||
}
|
||||
|
||||
free(fast_alpha); fast_alpha = 0;
|
||||
free(fast_alpha); fast_alpha = nullptr;
|
||||
|
||||
if (vflag_fdotr) virial_fdotr_compute();
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ void PairLJCutOpt::eval()
|
||||
ff[i].z += tmpfz;
|
||||
}
|
||||
|
||||
free(fast_alpha); fast_alpha = 0;
|
||||
free(fast_alpha); fast_alpha = nullptr;
|
||||
|
||||
if (vflag_fdotr) virial_fdotr_compute();
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ void PairMorseOpt::eval()
|
||||
ff[i].z += tmpfz;
|
||||
}
|
||||
|
||||
free(fast_alpha); fast_alpha = 0;
|
||||
free(fast_alpha); fast_alpha = nullptr;
|
||||
|
||||
if (vflag_fdotr) virial_fdotr_compute();
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ void PairUFMOpt::eval()
|
||||
ff[i].z += tmpfz;
|
||||
}
|
||||
|
||||
free(fast_alpha); fast_alpha = 0;
|
||||
free(fast_alpha); fast_alpha = nullptr;
|
||||
|
||||
if (vflag_fdotr) virial_fdotr_compute();
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
static double calculate_interatomic_distance(int type, double scale) {
|
||||
assert(type >= 1 && type <= 8);
|
||||
|
||||
@ -1481,7 +1481,7 @@ static int ismetachar(char c);
|
||||
int re_matchp(const char *text, re_t pattern, int *matchlen)
|
||||
{
|
||||
*matchlen = 0;
|
||||
if (pattern != 0) {
|
||||
if (pattern != nullptr) {
|
||||
if (pattern[0].type == RX_BEGIN) {
|
||||
return ((matchpattern(&pattern[1], text, matchlen)) ? 0 : -1);
|
||||
} else {
|
||||
@ -1595,7 +1595,7 @@ re_t re_compile(re_ctx_t context, const char *pattern)
|
||||
i += 1; /* Increment i to avoid including '^' in the char-buffer */
|
||||
if (pattern[i + 1] == 0) /* incomplete pattern, missing non-zero char after '^' */
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
re_compiled[j].type = RX_CHAR_CLASS;
|
||||
@ -1605,20 +1605,20 @@ re_t re_compile(re_ctx_t context, const char *pattern)
|
||||
while ((pattern[++i] != ']') && (pattern[i] != '\0')) {
|
||||
/* Missing ] */
|
||||
if (pattern[i] == '\\') {
|
||||
if (ccl_bufidx >= MAX_CHAR_CLASS_LEN - 1) { return 0; }
|
||||
if (ccl_bufidx >= MAX_CHAR_CLASS_LEN - 1) { return nullptr; }
|
||||
if (pattern[i + 1] == 0) /* incomplete pattern, missing non-zero char after '\\' */
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
ccl_buf[ccl_bufidx++] = pattern[i++];
|
||||
} else if (ccl_bufidx >= MAX_CHAR_CLASS_LEN) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
ccl_buf[ccl_bufidx++] = pattern[i];
|
||||
}
|
||||
if (ccl_bufidx >= MAX_CHAR_CLASS_LEN) {
|
||||
/* Catches cases such as [00000000000000000000000000000000000000][ */
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
/* Null-terminate string end */
|
||||
ccl_buf[ccl_bufidx++] = 0;
|
||||
@ -1633,7 +1633,7 @@ re_t re_compile(re_ctx_t context, const char *pattern)
|
||||
}
|
||||
/* no buffer-out-of-bounds access on invalid patterns -
|
||||
* see https://github.com/kokke/tiny-regex-c/commit/1a279e04014b70b0695fba559a7c05d55e6ee90b */
|
||||
if (pattern[i] == 0) { return 0; }
|
||||
if (pattern[i] == 0) { return nullptr; }
|
||||
|
||||
i += 1;
|
||||
j += 1;
|
||||
|
||||
Reference in New Issue
Block a user