diff --git a/lib/atc/ATC_Coupling.cpp b/lib/atc/ATC_Coupling.cpp index db72b0cb0c9796e4a3a9a86361f4c203658fe0f6..552bb9bb37e4c6a0b94c623f5774114538e98d61 100644 --- a/lib/atc/ATC_Coupling.cpp +++ b/lib/atc/ATC_Coupling.cpp @@ -30,26 +30,26 @@ namespace ATC { useFeMdMassMatrix_(false), trackCharge_(false), temperatureDef_(NONE), - prescribedDataMgr_(NULL), - physicsModel_(NULL), + prescribedDataMgr_(nullptr), + physicsModel_(nullptr), extrinsicModelManager_(this), - atomicRegulator_(NULL), + atomicRegulator_(nullptr), atomQuadForInternal_(true), - elementMask_(NULL), - elementMaskMass_(NULL), - elementMaskMassMd_(NULL), - nodalAtomicMass_(NULL), - nodalAtomicCount_(NULL), - nodalAtomicHeatCapacity_(NULL), - internalToMask_(NULL), - internalElement_(NULL), - ghostElement_(NULL), - nodalGeometryType_(NULL), + elementMask_(nullptr), + elementMaskMass_(nullptr), + elementMaskMassMd_(nullptr), + nodalAtomicMass_(nullptr), + nodalAtomicCount_(nullptr), + nodalAtomicHeatCapacity_(nullptr), + internalToMask_(nullptr), + internalElement_(nullptr), + ghostElement_(nullptr), + nodalGeometryType_(nullptr), bndyIntType_(NO_QUADRATURE), - bndyFaceSet_(NULL), - atomicWeightsMask_(NULL), - shpFcnMask_(NULL), - shpFcnDerivsMask_(NULL), + bndyFaceSet_(nullptr), + atomicWeightsMask_(nullptr), + shpFcnMask_(nullptr), + shpFcnDerivsMask_(nullptr), sourceIntegration_(FULL_DOMAIN) { // size the field mask @@ -68,7 +68,7 @@ namespace ATC { ATC_Coupling::~ATC_Coupling() { interscaleManager_.clear(); - if (feEngine_) { delete feEngine_; feEngine_ = NULL; } + if (feEngine_) { delete feEngine_; feEngine_ = nullptr; } if (physicsModel_) delete physicsModel_; if (atomicRegulator_) delete atomicRegulator_; if (prescribedDataMgr_) delete prescribedDataMgr_; @@ -127,7 +127,7 @@ namespace ATC { argIdx++; parse_field(arg,argIdx,thisField,thisIndex); string nsetName(arg[argIdx++]); - XT_Function * f = NULL; + XT_Function * f = nullptr; // parse constant if (narg == argIdx+1) { f = XT_Function_Mgr::instance()->constant_function(atof(arg[argIdx])); @@ -164,7 +164,7 @@ namespace ATC { argIdx++; parse_field(arg,argIdx,thisField,thisIndex); string nsetName(arg[argIdx++]); - XT_Function * f = NULL; + XT_Function * f = nullptr; // fix current value if (narg == argIdx) { set nodeSet = (feEngine_->fe_mesh())->nodeset(nsetName); @@ -258,7 +258,7 @@ namespace ATC { argIdx++; parse_field(arg,argIdx,thisField,thisIndex); string esetName(arg[argIdx++]); - XT_Function * f = NULL; + XT_Function * f = nullptr; // parse constant if (narg == argIdx+1) { string a(arg[argIdx]); @@ -367,7 +367,7 @@ namespace ATC { argIdx++; parse_field(arg,argIdx,thisField,thisIndex); string fsetName(arg[argIdx++]); - XT_Function * f = NULL; + XT_Function * f = nullptr; // parse constant if (narg == argIdx+1) { f = XT_Function_Mgr::instance()->constant_function(atof(arg[argIdx])); @@ -529,7 +529,7 @@ namespace ATC { argIdx++; parse_field(arg,argIdx,thisField,thisIndex); string fsetName(arg[argIdx++]); - UXT_Function * f = NULL; + UXT_Function * f = nullptr; // parse linear if (narg == argIdx+2) { f = UXT_Function_Mgr::instance()->linear_function(atof(arg[argIdx]),atof(arg[argIdx+1])); @@ -760,7 +760,7 @@ namespace ATC { WeakEquation::PDE_Type ATC_Coupling::pde_type(const FieldName fieldName) const { const WeakEquation * weakEq = physicsModel_->weak_equation(fieldName); - if (weakEq == NULL) return WeakEquation::PROJECTION_PDE; + if (weakEq == nullptr) return WeakEquation::PROJECTION_PDE; return weakEq->type(); } //-------------------------------------------------- @@ -768,7 +768,7 @@ namespace ATC { bool ATC_Coupling::is_dynamic(const FieldName fieldName) const { const WeakEquation * weakEq = physicsModel_->weak_equation(fieldName); - if (weakEq == NULL) return false; + if (weakEq == nullptr) return false; return (physicsModel_->weak_equation(fieldName)->type() == WeakEquation::DYNAMIC_PDE); } diff --git a/lib/atc/ATC_Coupling.h b/lib/atc/ATC_Coupling.h index 9f406febbef6e6093dae5857ccb9f6f2901ed8ff..e119b687380ea69da74c104fb64e4bd56d890d24 100644 --- a/lib/atc/ATC_Coupling.h +++ b/lib/atc/ATC_Coupling.h @@ -114,10 +114,10 @@ namespace ATC { FIELDS &rhs, const Array< std::set > atomMaterialGroups, const VectorDependencyManager * shpFcnDerivs, - const SPAR_MAN * shpFcn = NULL, - const DIAG_MAN * atomicWeights = NULL, - const MatrixDependencyManager * elementMask = NULL, - const SetDependencyManager * nodeSet = NULL); + const SPAR_MAN * shpFcn = nullptr, + const DIAG_MAN * atomicWeights = nullptr, + const MatrixDependencyManager * elementMask = nullptr, + const SetDependencyManager * nodeSet = nullptr); /** access to full right hand side / forcing vector */ FIELDS &rhs() {return rhs_;}; Array2D rhs_mask() const { @@ -152,14 +152,14 @@ namespace ATC { const FIELDS &fields, FIELDS &rhs, const IntegrationDomainType domain, // = FULL_DOMAIN - const PhysicsModel * physicsModel=NULL); + const PhysicsModel * physicsModel=nullptr); /** wrapper for FE_Engine's compute_tangent_matrix */ void compute_rhs_tangent(const std::pair row_col, const RHS_MASK & rhsMask, const FIELDS & fields, SPAR_MAT & stiffness, const IntegrationDomainType integrationType, - const PhysicsModel * physicsModel=NULL); + const PhysicsModel * physicsModel=nullptr); void tangent_matrix(const std::pair row_col, const RHS_MASK & rhsMask, const PhysicsModel * physicsModel, @@ -197,7 +197,7 @@ namespace ATC { return & (it->second).quantity(); } else { - return NULL; + return nullptr; } } else { @@ -206,7 +206,7 @@ namespace ATC { return & (it->second).quantity(); } else { - return NULL; + return nullptr; } } } @@ -233,7 +233,7 @@ namespace ATC { /** access to time integrator */ const TimeIntegrator * time_integrator(const FieldName & field) const { _ctiIt_ = timeIntegrators_.find(field); - if (_ctiIt_ == timeIntegrators_.end()) return NULL; + if (_ctiIt_ == timeIntegrators_.end()) return nullptr; return _ctiIt_->second; }; @@ -322,7 +322,7 @@ namespace ATC { void compute_flux(const Array2D & rhs_mask, const FIELDS &fields, GRAD_FIELD_MATS &flux, - const PhysicsModel * physicsModel=NULL, + const PhysicsModel * physicsModel=nullptr, const bool normalize = false); /** evaluate rhs on the atomic domain which is near the FE region */ void masked_atom_domain_rhs_integral(const Array2D & rhs_mask, @@ -334,7 +334,7 @@ namespace ATC { const FIELDS &fields, FIELDS &rhs, const IntegrationDomainType domain, - const PhysicsModel * physicsModel=NULL); + const PhysicsModel * physicsModel=nullptr); /** access to boundary fluxes */ DENS_MAT &get_boundary_flux(FieldName thisField){return boundaryFlux_[thisField].set_quantity();}; DENS_MAN &boundary_flux(FieldName thisField){return boundaryFlux_[thisField];}; @@ -352,7 +352,7 @@ namespace ATC { // mass matrix filtering void delete_mass_mat_time_filter(FieldName thisField); /** compute mass matrix for requested field */ - void compute_mass_matrix(FieldName thisField, PhysicsModel * physicsModel = NULL); + void compute_mass_matrix(FieldName thisField, PhysicsModel * physicsModel = nullptr); /** updates filtering of MD contributions */ void update_mass_matrix(FieldName thisField); /** compute the mass matrix components coming from MD integration */ diff --git a/lib/atc/ATC_CouplingEnergy.cpp b/lib/atc/ATC_CouplingEnergy.cpp index c3b07c242de83d2721dfe67fd34ad6d07bde1f40..8fae1f07034a955c413707223dc97c5b21b99172 100644 --- a/lib/atc/ATC_CouplingEnergy.cpp +++ b/lib/atc/ATC_CouplingEnergy.cpp @@ -30,8 +30,8 @@ namespace ATC { string matParamFile, ExtrinsicModelType extrinsicModel) : ATC_Coupling(groupName,perAtomArray,thisFix), - nodalAtomicKineticTemperature_(NULL), - nodalAtomicConfigurationalTemperature_(NULL) + nodalAtomicKineticTemperature_(nullptr), + nodalAtomicConfigurationalTemperature_(nullptr) { // Allocate PhysicsModel create_physics_model(THERMAL, matParamFile); @@ -103,7 +103,7 @@ namespace ATC { // always need kinetic energy AtomicEnergyForTemperature * atomicTwiceKineticEnergy = new TwiceKineticEnergy(this); - AtomicEnergyForTemperature * atomEnergyForTemperature = NULL; + AtomicEnergyForTemperature * atomEnergyForTemperature = nullptr; // Appropriate per-atom quantity based on desired temperature definition if (temperatureDef_==KINETIC) { diff --git a/lib/atc/ATC_CouplingMomentumEnergy.cpp b/lib/atc/ATC_CouplingMomentumEnergy.cpp index 1fc29319770f09579c0b7ef2682443e551a7f727..32df5fd7b90be4b2facdb89fcd2e5ace0b1d2e9b 100644 --- a/lib/atc/ATC_CouplingMomentumEnergy.cpp +++ b/lib/atc/ATC_CouplingMomentumEnergy.cpp @@ -32,8 +32,8 @@ namespace ATC { string matParamFile, ExtrinsicModelType extrinsicModel) : ATC_Coupling(groupName,perAtomArray,thisFix), - nodalAtomicKineticTemperature_(NULL), - nodalAtomicConfigurationalTemperature_(NULL), + nodalAtomicKineticTemperature_(nullptr), + nodalAtomicConfigurationalTemperature_(nullptr), refPE_(0) { // Allocate PhysicsModel @@ -190,7 +190,7 @@ namespace ATC { FieldManager fieldManager(this); PerAtomQuantity * fluctuatingAtomicVelocity = fieldManager.per_atom_quantity("AtomicFluctuatingVelocity"); // also creates ProlongedVelocity AtomicEnergyForTemperature * atomicTwiceKineticEnergy = new TwiceKineticEnergy(this,fluctuatingAtomicVelocity); - AtomicEnergyForTemperature * atomEnergyForTemperature = NULL; + AtomicEnergyForTemperature * atomEnergyForTemperature = nullptr; // Appropriate per-atom quantity based on desired temperature definition if (temperatureDef_==KINETIC) { diff --git a/lib/atc/ATC_Method.cpp b/lib/atc/ATC_Method.cpp index f2173e9575f72ba84933f5e645f41e74d8a3c100..113d175e26da7b8d2d1cd20a49cad741a6f83941 100644 --- a/lib/atc/ATC_Method.cpp +++ b/lib/atc/ATC_Method.cpp @@ -35,37 +35,37 @@ using std::pair; namespace ATC { ATC_Method::ATC_Method(string groupName, double ** & perAtomArray, LAMMPS_NS::Fix * thisFix) : - nodalAtomicVolume_(NULL), + nodalAtomicVolume_(nullptr), needReset_(true), lammpsInterface_(LammpsInterface::instance()), interscaleManager_(this), timeFilterManager_(this), integrateInternalAtoms_(false), - atomTimeIntegrator_(NULL), + atomTimeIntegrator_(nullptr), ghostManager_(this), - feEngine_(NULL), + feEngine_(nullptr), initialized_(false), meshDataInitialized_(false), localStep_(0), sizeComm_(8), // 3 positions + 1 material id * 2 for output - atomCoarseGrainingPositions_(NULL), - atomGhostCoarseGrainingPositions_(NULL), - atomProcGhostCoarseGrainingPositions_(NULL), - atomReferencePositions_(NULL), + atomCoarseGrainingPositions_(nullptr), + atomGhostCoarseGrainingPositions_(nullptr), + atomProcGhostCoarseGrainingPositions_(nullptr), + atomReferencePositions_(nullptr), nNodes_(0), nsd_(lammpsInterface_->dimension()), - xref_(NULL), + xref_(nullptr), readXref_(false), needXrefProcessorGhosts_(false), trackDisplacement_(false), needsAtomToElementMap_(true), - atomElement_(NULL), - atomGhostElement_(NULL), + atomElement_(nullptr), + atomGhostElement_(nullptr), internalElementSet_(""), - atomMasses_(NULL), - atomPositions_(NULL), - atomVelocities_(NULL), - atomForces_(NULL), + atomMasses_(nullptr), + atomPositions_(nullptr), + atomVelocities_(nullptr), + atomForces_(nullptr), parallelConsistency_(true), outputNow_(false), outputTime_(true), @@ -79,13 +79,13 @@ namespace ATC { sizeVector_(0), scalarVectorFreq_(0), sizePerAtomCols_(4), - perAtomOutput_(NULL), + perAtomOutput_(nullptr), perAtomArray_(perAtomArray), extScalar_(0), extVector_(0), - extList_(NULL), + extList_(nullptr), thermoEnergyFlag_(0), - atomVolume_(NULL), + atomVolume_(nullptr), atomicWeightsWriteFlag_(false), atomicWeightsWriteFrequency_(0), atomWeightType_(LATTICE), @@ -103,12 +103,12 @@ namespace ATC { mdMassNormalization_(false), kernelBased_(false), kernelOnTheFly_(false), - kernelFunction_(NULL), + kernelFunction_(nullptr), bondOnTheFly_(false), - accumulant_(NULL), - accumulantMol_(NULL), - accumulantMolGrad_(NULL), - accumulantWeights_(NULL), + accumulant_(nullptr), + accumulantMol_(nullptr), + accumulantMolGrad_(nullptr), + accumulantWeights_(nullptr), accumulantInverseVolumes_(&invNodeVolumes_), accumulantBandwidth_(0), useRestart_(false), @@ -117,7 +117,7 @@ namespace ATC { setRefPEvalue_(false), refPEvalue_(0.), readRefPE_(false), - nodalRefPotentialEnergy_(NULL), + nodalRefPotentialEnergy_(nullptr), simTime_(0.0), stepCounter_(0) { @@ -1122,7 +1122,7 @@ pecified FieldName & thisField, int & thisIndex) { string thisName = args[argIdx++]; - if (args[argIdx] == NULL) { + if (args[argIdx] == nullptr) { throw ATC_Error("Need to give field '"+thisName+"' more args"); } thisField = string_to_field(thisName); @@ -1282,7 +1282,7 @@ pecified if (this->reset_methods()) { // clear memory manager interscaleManager_.clear_temporary_data(); - atomVolume_ = NULL; + atomVolume_ = nullptr; // reference positions and energy if (!initialized_) { @@ -1517,7 +1517,7 @@ pecified } else { // set variables to compute atomic weights - DENS_MAN * nodalVolume(NULL); + DENS_MAN * nodalVolume(nullptr); switch (atomWeightType_) { case USER: atomVolume_ = new AtomVolumeUser(this,Valpha_); diff --git a/lib/atc/ATC_Method.h b/lib/atc/ATC_Method.h index e356243e03b4d07506ab835e83f12e297491f391..0779990a99f9cf0fa2413a80e2a9827fb913d95b 100644 --- a/lib/atc/ATC_Method.h +++ b/lib/atc/ATC_Method.h @@ -423,7 +423,7 @@ namespace ATC { bool use_md_mass_normalization() const { return mdMassNormalization_;} bool kernel_based() { return kernelBased_; } bool kernel_on_the_fly() const { return kernelOnTheFly_;} - bool has_kernel_function() { return kernelFunction_ != NULL; } + bool has_kernel_function() { return kernelFunction_ != nullptr; } KernelFunction * kernel_function() { return kernelFunction_; } std::vector & type_list() { return typeList_; } std::vector & group_list() { return groupList_; } diff --git a/lib/atc/ATC_Transfer.cpp b/lib/atc/ATC_Transfer.cpp index 833e1d1f2792c825705071cc4445a3b4bb9209ae..a9e87e3ff978b60fcdba54bdf5be23c8f712a1d0 100644 --- a/lib/atc/ATC_Transfer.cpp +++ b/lib/atc/ATC_Transfer.cpp @@ -68,19 +68,19 @@ namespace ATC { LAMMPS_NS::Fix * thisFix, string matParamFile) : ATC_Method(groupName,perAtomArray,thisFix), - xPointer_(NULL), + xPointer_(nullptr), outputStepZero_(true), neighborReset_(false), - pairMap_(NULL), - bondMatrix_(NULL), - pairVirial_(NULL), - pairHeatFlux_(NULL), + pairMap_(nullptr), + bondMatrix_(nullptr), + pairVirial_(nullptr), + pairHeatFlux_(nullptr), nComputes_(0), hasPairs_(true), hasBonds_(false), resetKernelFunction_(false), dxaExactMode_(true), - cauchyBornStress_(NULL) + cauchyBornStress_(nullptr) { nTypes_ = lammpsInterface_->ntypes(); @@ -114,7 +114,7 @@ namespace ATC { rateFlags_ = false; outputFields_.resize(NUM_TOTAL_FIELDS); - for (int i = 0; i < NUM_TOTAL_FIELDS; i++) { outputFields_[i] = NULL; } + for (int i = 0; i < NUM_TOTAL_FIELDS; i++) { outputFields_[i] = nullptr; } // Hardy requires ref positions for processor ghosts for bond list @@ -491,7 +491,7 @@ namespace ATC { ComputedAtomQuantity * c = new ComputedAtomQuantity(this, tag); interscaleManager_.add_per_atom_quantity(c,tag); int projection = iter->second; - DIAG_MAN * w = NULL; + DIAG_MAN * w = nullptr; if (projection == VOLUME_NORMALIZATION ) { w = accumulantInverseVolumes_; } else if (projection == NUMBER_NORMALIZATION ) @@ -976,7 +976,7 @@ namespace ATC { DENS_MAT & H = hardyData_["displacement_gradient"].set_quantity(); DENS_MAT E(H.nRows(),1); ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature"); - const DENS_MAT *temp = tfield==hardyData_.end() ? NULL : &((tfield->second).quantity()); + const DENS_MAT *temp = tfield==hardyData_.end() ? nullptr : &((tfield->second).quantity()); //DENS_MAT & T = hardyData_["temperature"]; //cauchy_born_entropic_energy(H,E,T); E += hardyData_["internal_energy"]; cauchy_born_energy(H, E, temp); @@ -988,14 +988,14 @@ namespace ATC { // compute: cauchy born stress if (fieldFlags_(CAUCHY_BORN_STRESS)) { ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature"); - const DENS_MAT *temp = tfield==hardyData_.end() ? NULL : &((tfield->second).quantity()); + const DENS_MAT *temp = tfield==hardyData_.end() ? nullptr : &((tfield->second).quantity()); cauchy_born_stress(hardyData_["displacement_gradient"].quantity(), hardyData_["cauchy_born_stress"].set_quantity(), temp); } // compute: cauchy born energy if (fieldFlags_(CAUCHY_BORN_ENERGY)) { ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature"); - const DENS_MAT *temp = tfield==hardyData_.end() ? NULL : &((tfield->second).quantity()); + const DENS_MAT *temp = tfield==hardyData_.end() ? nullptr : &((tfield->second).quantity()); cauchy_born_energy(hardyData_["displacement_gradient"].quantity(), hardyData_["cauchy_born_energy"].set_quantity(), temp); } diff --git a/lib/atc/Array.h b/lib/atc/Array.h index 21e66a95512b4b73b2e66e482312d8dd09110d19..c29729d320d94fc375a038a80be266efd93ce524 100644 --- a/lib/atc/Array.h +++ b/lib/atc/Array.h @@ -78,7 +78,7 @@ protected: template Array::Array(void) { len_ = 0; - data_ = NULL; + data_ = nullptr; } template @@ -90,8 +90,8 @@ Array::Array(int len) { template Array::Array(const Array& A) { len_ = A.len_; - if (A.data_==NULL) - data_ = NULL; + if (A.data_==nullptr) + data_ = nullptr; else { data_ = new T[len_]; for(int i=0;i::Array(const Array& A) { template Array::~Array() { - if (data_ != NULL) delete[] data_; + if (data_ != nullptr) delete[] data_; } template @@ -111,12 +111,12 @@ void Array::reset(int len) { } else { // size change, realloc memory len_ = len; - if (data_ != NULL) + if (data_ != nullptr) delete[] data_; if (len_ > 0) data_ = new T[len_]; else { - data_ = NULL; + data_ = nullptr; len_ = 0; } } @@ -130,7 +130,7 @@ void Array::resize(int len, bool copy) { else { // size change, realloc memory len_ = len; if (len_ > 0) { - if (copy && data_ != NULL) { + if (copy && data_ != nullptr) { Array temp(*this); delete[] data_; data_ = new T[len_]; @@ -140,12 +140,12 @@ void Array::resize(int len, bool copy) { } } else { - if (data_ != NULL) delete[] data_; + if (data_ != nullptr) delete[] data_; data_ = new T[len_]; } } else { - data_ = NULL; + data_ = nullptr; len_ = 0; } } @@ -158,10 +158,10 @@ T& Array::operator() (int i) { template Array& Array::operator= (const Array &other) { - if (data_ == NULL) { // initialize my internal storage to match LHS + if (data_ == nullptr) { // initialize my internal storage to match LHS len_ = other.len_; - if (other.data_==NULL) - data_ = NULL; + if (other.data_==nullptr) + data_ = nullptr; else data_ = new T[len_]; } @@ -250,7 +250,7 @@ T* Array::ptr() const { template void Array::print(std::string name) const { std::cout << "------- Begin "<::AliasArray(const Array& A) { template AliasArray::~AliasArray(void) { len_ = 0; - data_ = NULL; // trick base class into not deleting parent data + data_ = nullptr; // trick base class into not deleting parent data } template diff --git a/lib/atc/Array2D.h b/lib/atc/Array2D.h index 25f895f72ccbaa82323ca1617d66f2fe8d519aba..37b7dcb3c99acb6b8af32d24e61338a86f0f7d7e 100644 --- a/lib/atc/Array2D.h +++ b/lib/atc/Array2D.h @@ -57,7 +57,7 @@ template Array2D::Array2D() { nrows_ = 0; ncols_ = 0; - data_ = NULL; + data_ = nullptr; } template @@ -71,8 +71,8 @@ template Array2D::Array2D(const Array2D& A) { nrows_ = A.nrows_; ncols_ = A.ncols_; - if (A.data_==NULL) - data_ = NULL; + if (A.data_==nullptr) + data_ = nullptr; else { data_ = new T[nrows_ * ncols_]; for(int i=0;i::reset(int nrows, int ncols) { else { // size changed; realloc memory nrows_ = nrows; ncols_ = ncols; - if (data_ != NULL) + if (data_ != nullptr) delete [] data_; if (ncols_ > 0 && nrows_ > 0) data_ = new T[nrows_ * ncols_]; else { - data_ = NULL; + data_ = nullptr; nrows_ = 0; ncols_ = 0; } @@ -120,11 +120,11 @@ AliasArray Array2D::column(int col) const { template Array2D& Array2D::operator= (const Array2D& other) { - if (data_ == NULL) { // initialize my internal storage to match LHS + if (data_ == nullptr) { // initialize my internal storage to match LHS nrows_ = other.nrows_; ncols_ = other.ncols_; - if (other.data_==NULL) - data_ = NULL; + if (other.data_==nullptr) + data_ = nullptr; else data_ = new T[nrows_ * ncols_]; } @@ -170,14 +170,14 @@ void Array2D::write_restart(FILE *f) const { template Array2D::~Array2D() { - if (data_ != NULL) + if (data_ != nullptr) delete[] data_; } template void Array2D::print(std::string name) const { std::cout << "------- Begin "< >::iterator it = regulatorData_.find(tag); if (it == regulatorData_.end()) { data = new DENS_MAN(nNodes_,nCols); @@ -115,14 +115,14 @@ namespace ATC { //-------------------------------------------------------- // get_regulator_data: - // gets a pointer to the requested data, or NULL if + // gets a pointer to the requested data, or nullptr if // if doesn't exist //-------------------------------------------------------- const DENS_MAN * AtomicRegulator::regulator_data(const string tag) const { map >::const_iterator it = regulatorData_.find(tag); if (it == regulatorData_.end()) { - return NULL; + return nullptr; } else { return const_cast((it->second).second); @@ -521,7 +521,7 @@ namespace ATC { fieldMask_(NUM_FIELDS,NUM_FLUX), nNodes_(atomicRegulator_->num_nodes()), regulatorPrefix_(atomicRegulator->regulator_prefix()+regulatorPrefix), - shpFcnDerivs_(NULL) + shpFcnDerivs_(nullptr) { fieldMask_ = false; } @@ -552,21 +552,21 @@ namespace ATC { RegulatorShapeFunction::RegulatorShapeFunction(AtomicRegulator * atomicRegulator, const string & regulatorPrefix) : RegulatorMethod(atomicRegulator,regulatorPrefix), - lambda_(NULL), - atomLambdas_(NULL), - shapeFunctionMatrix_(NULL), + lambda_(nullptr), + atomLambdas_(nullptr), + shapeFunctionMatrix_(nullptr), linearSolverType_(AtomicRegulator::NO_SOLVE), maxIterations_(atomicRegulator->max_iterations()), tolerance_(atomicRegulator->tolerance()), - matrixSolver_(NULL), - regulatedNodes_(NULL), - applicationNodes_(NULL), - boundaryNodes_(NULL), - shpFcn_(NULL), - atomicWeights_(NULL), - elementMask_(NULL), - lambdaAtomMap_(NULL), - weights_(NULL), + matrixSolver_(nullptr), + regulatedNodes_(nullptr), + applicationNodes_(nullptr), + boundaryNodes_(nullptr), + shpFcn_(nullptr), + atomicWeights_(nullptr), + elementMask_(nullptr), + lambdaAtomMap_(nullptr), + weights_(nullptr), nsd_(atomicRegulator_->nsd()), nLocal_(atomicRegulator_->nlocal()) { diff --git a/lib/atc/AtomicRegulator.h b/lib/atc/AtomicRegulator.h index b9fccb902c4fe1455fe28915e776f84c8a1ff4eb..360af3a4f6c48121adc4f5a727bce99c1b80d44f 100644 --- a/lib/atc/AtomicRegulator.h +++ b/lib/atc/AtomicRegulator.h @@ -143,7 +143,7 @@ namespace ATC { /** can externally set regulator dynamic contributions */ virtual void reset_lambda_contribution(const DENS_MAT & /* target */, const FieldName /* field */) {}; virtual void reset_lambda_contribution(const DENS_MAT & target) { reset_lambda_contribution(target,NUM_TOTAL_FIELDS); } - /** returns a const pointer to the DENS_MAN associated with the tag, or NULL */ + /** returns a const pointer to the DENS_MAN associated with the tag, or nullptr */ const DENS_MAN * regulator_data(const std::string tag) const; /** return the maximum number of iterations */ int max_iterations() {return maxIterations_;}; diff --git a/lib/atc/CauchyBorn.cpp b/lib/atc/CauchyBorn.cpp index 85b100ca64ace66d3fbba2e4999cf18d87232407..81f7b4e1a868975b9fd18ad6b4ebca7fec42c092 100644 --- a/lib/atc/CauchyBorn.cpp +++ b/lib/atc/CauchyBorn.cpp @@ -426,7 +426,7 @@ namespace ATC { for (INDEX j=i; j<3; j++) s(i,j) += factor * dd(i,j); - // If f_W is not NULL then append thermal contribution. + // If f_W is not nullptr then append thermal contribution. if (F_w) *F_w += 0.5*kb*T*log(detD); } //============================================================================ diff --git a/lib/atc/ChargeRegulator.cpp b/lib/atc/ChargeRegulator.cpp index bae78a76138acb1e7d8fe7993d242551944e29cf..972530829c3fdbd239c5e648702e8814725e92b4 100644 --- a/lib/atc/ChargeRegulator.cpp +++ b/lib/atc/ChargeRegulator.cpp @@ -164,7 +164,7 @@ namespace ATC { chargeRegulator_(chargeRegulator), lammpsInterface_(LammpsInterface::instance()), rC_(0), rCsq_(0), - targetValue_(NULL), + targetValue_(nullptr), targetPhi_(p.value), surface_(p.faceset), atomGroupBit_(p.groupBit), diff --git a/lib/atc/CloneVector.h b/lib/atc/CloneVector.h index 02db700f279b0e08c099d0d350c87ce027aec84a..63d11636b30a6e2fcb8f5030a2bad9b5be4abd32 100644 --- a/lib/atc/CloneVector.h +++ b/lib/atc/CloneVector.h @@ -52,7 +52,7 @@ private: //----------------------------------------------------------------------------- template CloneVector::CloneVector(const Vector &c) - : Vector(), _baseV(const_cast*>(&c)), _baseM(NULL) + : Vector(), _baseV(const_cast*>(&c)), _baseM(nullptr) {} //----------------------------------------------------------------------------- // Construct from a matrix, the const_cast isn't pretty @@ -65,7 +65,7 @@ CloneVector::CloneVector(const Vector &c) //----------------------------------------------------------------------------- template CloneVector::CloneVector(const Matrix &c, int dim, INDEX idx) - : Vector(), _baseV(NULL), _baseM(const_cast*>(&c)) + : Vector(), _baseV(nullptr), _baseM(const_cast*>(&c)) , _clone_type(dim), _idx(idx) {} //----------------------------------------------------------------------------- @@ -73,7 +73,7 @@ CloneVector::CloneVector(const Matrix &c, int dim, INDEX idx) //----------------------------------------------------------------------------- template CloneVector::CloneVector(const DiagonalMatrix &c, INDEX /* idx */) - : Vector(), _baseV(NULL), _baseM(const_cast*>(&c)) + : Vector(), _baseV(nullptr), _baseM(const_cast*>(&c)) , _clone_type(CLONE_DIAG), _idx(0) {} //----------------------------------------------------------------------------- diff --git a/lib/atc/ConcentrationRegulator.cpp b/lib/atc/ConcentrationRegulator.cpp index 4255b919b937bcf6ecdc3b9606c864d3ed73b55e..499a5501c1775db8d462837545ee94be403a2b02 100644 --- a/lib/atc/ConcentrationRegulator.cpp +++ b/lib/atc/ConcentrationRegulator.cpp @@ -186,14 +186,14 @@ const double kMinScale_ = 10000.; ConcentrationRegulator::ConcentrationRegulatorParameters & p) : ConcentrationRegulatorMethod(concReg), concentrationRegulator_(concReg), - interscaleManager_(NULL), + interscaleManager_(nullptr), lammpsInterface_(LammpsInterface::instance()), - list_(NULL), + list_(nullptr), targetConcentration_(p.value), targetCount_(0), elemset_(p.elemset), - p_(NULL), - randomNumberGenerator_(NULL), + p_(nullptr), + randomNumberGenerator_(nullptr), q0_(0), controlType_(p.type), controlIndex_(0), diff --git a/lib/atc/DenseMatrix.h b/lib/atc/DenseMatrix.h index e585289aaa824041adbf1993fb8c9d7e0498b0bd..e4759f02d41c8753a18371b631d2adba95cec8ca 100644 --- a/lib/atc/DenseMatrix.h +++ b/lib/atc/DenseMatrix.h @@ -16,10 +16,10 @@ template class DenseMatrix : public Matrix { public: - DenseMatrix(INDEX rows=0, INDEX cols=0, bool z=1): _data(NULL){ _create(rows, cols, z); } - DenseMatrix(const DenseMatrix& c) : Matrix(), _data(NULL){ _copy(c); } - DenseMatrix(const SparseMatrix& c): Matrix(), _data(NULL){ c.dense_copy(*this);} - DenseMatrix(const Matrix& c) : Matrix(), _data(NULL){ _copy(c); } + DenseMatrix(INDEX rows=0, INDEX cols=0, bool z=1): _data(nullptr){ _create(rows, cols, z); } + DenseMatrix(const DenseMatrix& c) : Matrix(), _data(nullptr){ _copy(c); } + DenseMatrix(const SparseMatrix& c): Matrix(), _data(nullptr){ c.dense_copy(*this);} + DenseMatrix(const Matrix& c) : Matrix(), _data(nullptr){ _copy(c); } // const SparseMatrix * p = sparse_cast(&c); // (p) ? p->dense_copy(*this) : _copy(c); } ~DenseMatrix() { _delete();} @@ -261,7 +261,7 @@ void DenseMatrix::_delete() _nRows = _nCols = 0; if (_data){ delete [] _data; - _data = NULL; + _data = nullptr; } } //---------------------------------------------------------------------------- @@ -273,7 +273,7 @@ void DenseMatrix::_create(INDEX rows, INDEX cols, bool zero) _nRows=rows; _nCols=cols; - _data = (this->size() ? new T [_nCols*_nRows] : NULL); + _data = (this->size() ? new T [_nCols*_nRows] : nullptr); if (zero) this->zero(); } //---------------------------------------------------------------------------- diff --git a/lib/atc/DenseVector.h b/lib/atc/DenseVector.h index 38ed68f937d048191afa159ba1f4242f9f5b0851..bab90bf3ffc170c041e6c35ad1b9539c7f8e85a9 100644 --- a/lib/atc/DenseVector.h +++ b/lib/atc/DenseVector.h @@ -16,9 +16,9 @@ class DenseVector : public Vector { public: explicit DenseVector(INDEX n=0, bool z=1) { _create(n,z); } - DenseVector(const DenseVector &c) : Vector(), _data(NULL) { _copy(c); } - DenseVector(const Vector &c) : Vector(), _data(NULL) { _copy(c); } - DenseVector(const T * ptr, INDEX nrows) : Vector(), _data(NULL) { copy(ptr,nrows); } + DenseVector(const DenseVector &c) : Vector(), _data(nullptr) { _copy(c); } + DenseVector(const Vector &c) : Vector(), _data(nullptr) { _copy(c); } + DenseVector(const T * ptr, INDEX nrows) : Vector(), _data(nullptr) { copy(ptr,nrows); } virtual ~DenseVector() { _delete(); } //* resizes the Vector, ignores nCols, optionally copys what fits @@ -123,7 +123,7 @@ template inline void DenseVector::_create(INDEX n, bool zero) { _size=n; - _data = _size ? new T [_size] : NULL ; + _data = _size ? new T [_size] : nullptr ; if (zero) this->zero(); } /////////////////////////////////////////////////////////////////////////////// diff --git a/lib/atc/DiagonalMatrix.h b/lib/atc/DiagonalMatrix.h index ca3001f225392be58b44dd3ac33ff15dfdcdd6ca..b24e19dd4eae59719a10c1d2c7d15e23f95f32ad 100644 --- a/lib/atc/DiagonalMatrix.h +++ b/lib/atc/DiagonalMatrix.h @@ -205,7 +205,7 @@ DiagonalMatrix operator-(const DiagonalMatrix &A, const DiagonalMatrix //----------------------------------------------------------------------------- template DiagonalMatrix::DiagonalMatrix(INDEX rows, bool zero) - : _data(NULL) + : _data(nullptr) { reset(rows, zero); } @@ -214,7 +214,7 @@ DiagonalMatrix::DiagonalMatrix(INDEX rows, bool zero) //----------------------------------------------------------------------------- template DiagonalMatrix::DiagonalMatrix(const DiagonalMatrix& c) - : Matrix(), _data(NULL) + : Matrix(), _data(nullptr) { reset(c); } @@ -223,7 +223,7 @@ DiagonalMatrix::DiagonalMatrix(const DiagonalMatrix& c) //----------------------------------------------------------------------------- template DiagonalMatrix::DiagonalMatrix(const Vector& v) - : Matrix(), _data(NULL) + : Matrix(), _data(nullptr) { reset(v); } diff --git a/lib/atc/DislocationExtractor.h b/lib/atc/DislocationExtractor.h index c2bfe27e047389398ffa46c58d75075f803d8438..a0ba3aa9957851052eeda58bd8177a3fcc922160 100644 --- a/lib/atc/DislocationExtractor.h +++ b/lib/atc/DislocationExtractor.h @@ -197,7 +197,7 @@ protected: a.pos.Y = atom->x[i][1]; a.pos.Z = atom->x[i][2]; a.flags = 0; - a.cluster = NULL; + a.cluster = nullptr; a.numNeighbors = 0; a.setFlag(ATOM_IS_LOCAL_ATOM); } @@ -290,7 +290,7 @@ protected: currentAtom->pos.Y = atom->x[i][1]; currentAtom->pos.Z = atom->x[i][2]; currentAtom->flags = 0; - currentAtom->cluster = NULL; + currentAtom->cluster = nullptr; currentAtom->numNeighbors = 0; currentAtom->setFlag(ATOM_IS_LOCAL_ATOM); } @@ -302,7 +302,7 @@ protected: // Receive atoms from other processors. for(int iproc = 1; iproc < comm->nprocs; iproc++) { MPI_Status status; - MPI_Recv(buffer.empty() ? NULL : &buffer.front(), nlocalatoms_max * 3, MPI_DOUBLE, iproc, 0, world, &status); + MPI_Recv(buffer.empty() ? nullptr : &buffer.front(), nlocalatoms_max * 3, MPI_DOUBLE, iproc, 0, world, &status); int ndoubles; MPI_Get_count(&status, MPI_DOUBLE, &ndoubles); int nReceived = ndoubles / 3; @@ -314,7 +314,7 @@ protected: currentAtom->pos.Y = *data++; currentAtom->pos.Z = *data++; currentAtom->flags = 0; - currentAtom->cluster = NULL; + currentAtom->cluster = nullptr; currentAtom->numNeighbors = 0; currentAtom->setFlag(ATOM_IS_LOCAL_ATOM); } @@ -332,11 +332,11 @@ protected: *data++ = atom->x[i][2]; } // Send local atom coordinates to master proc. - MPI_Send(buffer.empty() ? NULL : &buffer.front(), buffer.size(), MPI_DOUBLE, 0, 0, world); + MPI_Send(buffer.empty() ? nullptr : &buffer.front(), buffer.size(), MPI_DOUBLE, 0, 0, world); } // Make sure all input atoms are wrapped at periodic boundary conditions. - wrapInputAtoms(NULL_VECTOR); + wrapInputAtoms(nullptr_VECTOR); // Build nearest neighbor lists. buildNearestNeighborLists(); @@ -376,7 +376,7 @@ protected: } } // Broadcast segments. - MPI_Bcast(segmentBuffer.empty() ? NULL : &segmentBuffer.front(), segmentBuffer.size() * sizeof(segmentBuffer[0]), MPI_CHAR, 0, world); + MPI_Bcast(segmentBuffer.empty() ? nullptr : &segmentBuffer.front(), segmentBuffer.size() * sizeof(segmentBuffer[0]), MPI_CHAR, 0, world); if(processor != 0) { // Extract segments from receive buffer. @@ -402,7 +402,7 @@ protected: DISLOCATIONS_ASSERT(sendItem == pointBuffer.end()); } // Broadcast segments. - MPI_Bcast(pointBuffer.empty() ? NULL : &pointBuffer.front(), pointBuffer.size() * sizeof(pointBuffer[0]), MPI_CHAR, 0, world); + MPI_Bcast(pointBuffer.empty() ? nullptr : &pointBuffer.front(), pointBuffer.size() * sizeof(pointBuffer[0]), MPI_CHAR, 0, world); if(processor != 0) { // Extract points from receive buffer. diff --git a/lib/atc/ElasticTimeIntegrator.cpp b/lib/atc/ElasticTimeIntegrator.cpp index 5e11f1584c091204d472ca0a3a5820a7cf52aeb7..785568cbb2d3ba8a8bddc63f3545260d5de501cb 100644 --- a/lib/atc/ElasticTimeIntegrator.cpp +++ b/lib/atc/ElasticTimeIntegrator.cpp @@ -184,8 +184,8 @@ namespace ATC { displacement_(atc_->field(DISPLACEMENT)), nodalAtomicDisplacementOut_(atc_->nodal_atomic_field(DISPLACEMENT)), nodalAtomicForceFiltered_(momentumTimeIntegrator->nodal_atomic_force_filtered()), - nodalAtomicDisplacement_(NULL), - nodalAtomicForce_(NULL) + nodalAtomicDisplacement_(nullptr), + nodalAtomicForce_(nullptr) { // do nothing } @@ -410,9 +410,9 @@ namespace ATC { displacement_(atc_->field(DISPLACEMENT)), nodalAtomicDisplacementOut_(atc_->nodal_atomic_field(DISPLACEMENT)), nodalAtomicForceFiltered_(momentumTimeIntegrator->nodal_atomic_force_filtered()), - nodalAtomicMomentum_(NULL), + nodalAtomicMomentum_(nullptr), nodalAtomicMomentumFiltered_(momentumTimeIntegrator->nodal_atomic_momentum_filtered()), - nodalAtomicDisplacement_(NULL), + nodalAtomicDisplacement_(nullptr), nodalAtomicMomentumOld_(atc_->num_nodes(),atc_->nsd()), nodalAtomicVelocityOld_(atc_->num_nodes(),atc_->nsd()) { @@ -633,7 +633,7 @@ namespace ATC { FluidsTimeIntegratorGear::FluidsTimeIntegratorGear(MomentumTimeIntegrator * momentumTimeIntegrator) : MomentumIntegrationMethod(momentumTimeIntegrator), nodalAtomicForceFiltered_(momentumTimeIntegrator->nodal_atomic_force_filtered()), - nodalAtomicMomentum_(NULL), + nodalAtomicMomentum_(nullptr), nodalAtomicMomentumFiltered_(momentumTimeIntegrator->nodal_atomic_momentum_filtered()), atomicVelocityDelta_(atc_->num_nodes(),atc_->nsd()), nodalAtomicMomentumOld_(atc_->num_nodes(),atc_->nsd()), diff --git a/lib/atc/ElectronHeatFlux.h b/lib/atc/ElectronHeatFlux.h index d0bc2a44f2032a7c6710b13487ab53dc36bc97b9..4c5b6200d3e87d2874ff021906bd79e06c9e2e47 100644 --- a/lib/atc/ElectronHeatFlux.h +++ b/lib/atc/ElectronHeatFlux.h @@ -17,7 +17,7 @@ namespace ATC { class ElectronHeatFlux { public: - ElectronHeatFlux(/*const*/ ElectronHeatCapacity * electronHeatCapacity = NULL); + ElectronHeatFlux(/*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr); virtual ~ElectronHeatFlux() {}; /** computes heat flux */ virtual void electron_heat_flux(const FIELD_MATS &fields, @@ -68,7 +68,7 @@ namespace ATC { { public: ElectronHeatFluxLinear(std::fstream &matfile,std::map & parameters, - /*const*/ ElectronHeatCapacity * electronHeatCapacity = NULL); + /*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr); virtual ~ElectronHeatFluxLinear() {}; virtual void electron_heat_flux(const FIELD_MATS & /* fields */, const GRAD_FIELD_MATS &gradFields, @@ -95,7 +95,7 @@ namespace ATC { { public: ElectronHeatFluxPowerLaw(std::fstream &matfile,std::map ¶meters, - /*const*/ ElectronHeatCapacity * electronHeatCapacity = NULL); + /*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr); virtual ~ElectronHeatFluxPowerLaw() {}; virtual void electron_heat_flux(const FIELD_MATS &fields, const GRAD_FIELD_MATS &gradFields, @@ -134,8 +134,8 @@ ctivity proportional to the ratio of the electron and phonon temperatures with t public: ElectronHeatFluxThermopower(std::fstream &matfile, std::map & parameters, - /*const*/ ElectronFlux * electronFlux = NULL, - /*const*/ ElectronHeatCapacity * electronHeatCapacity = NULL); + /*const*/ ElectronFlux * electronFlux = nullptr, + /*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr); virtual ~ElectronHeatFluxThermopower() {}; virtual void electron_heat_flux(const FIELD_MATS &fields, const GRAD_FIELD_MATS &gradFields, diff --git a/lib/atc/ExtrinsicModel.cpp b/lib/atc/ExtrinsicModel.cpp index b20b2a26d17ffa72d6e77064780d3c13df2a4fff..8e0079d965bd671bf4faa7cb2f8647c480efd109 100644 --- a/lib/atc/ExtrinsicModel.cpp +++ b/lib/atc/ExtrinsicModel.cpp @@ -114,7 +114,7 @@ namespace ATC { ATC::LammpsInterface::instance()->print_msg_once(ss.str()); myModel = new ExtrinsicModelElectrostatic (this,modelType,matFileName); - } else myModel = NULL; + } else myModel = nullptr; extrinsicModels_.push_back(myModel); // add new fields to fields data @@ -157,7 +157,7 @@ namespace ATC { for(imodel=extrinsicModels_.begin(); imodel!=extrinsicModels_.end(); imodel++) { if ((*imodel)->model_type()==type) return *imodel; } - return NULL; + return nullptr; } @@ -343,7 +343,7 @@ namespace ATC { atc_(modelManager->atc()), modelManager_(modelManager), modelType_(modelType), - physicsModel_(NULL) + physicsModel_(nullptr) { rhsMaskIntrinsic_.reset(NUM_FIELDS,NUM_FLUX); rhsMaskIntrinsic_ = false; diff --git a/lib/atc/ExtrinsicModelDriftDiffusion.cpp b/lib/atc/ExtrinsicModelDriftDiffusion.cpp index f9b93a147a87bf527024684c37410e2314e0988c..a9d8f27604c6100e9928cc1e8ec502a94203ef97 100644 --- a/lib/atc/ExtrinsicModelDriftDiffusion.cpp +++ b/lib/atc/ExtrinsicModelDriftDiffusion.cpp @@ -38,17 +38,17 @@ namespace ATC { ExtrinsicModelType modelType, string matFileName) : ExtrinsicModelTwoTemperature(modelManager,modelType,matFileName), - continuityIntegrator_(NULL), + continuityIntegrator_(nullptr), poissonSolverType_(DIRECT), // ITERATIVE | DIRECT - poissonSolver_(NULL), + poissonSolver_(nullptr), baseSize_(0), electronDensityEqn_(ELECTRON_CONTINUITY), fluxUpdateFreq_(1), schrodingerSolverType_(DIRECT), // ITERATIVE | DIRECT - schrodingerSolver_(NULL), + schrodingerSolver_(nullptr), schrodingerPoissonMgr_(), - schrodingerPoissonSolver_(NULL), + schrodingerPoissonSolver_(nullptr), maxConsistencyIter_(0), maxConstraintIter_(1), safe_dEf_(0.1), Ef_shift_(0.0), oneD_(false), oneDcoor_(0), oneDconserve_(0) @@ -351,7 +351,7 @@ namespace ATC { ExtrinsicModelType modelType, string matFileName) : ExtrinsicModelDriftDiffusion(modelManager,modelType,matFileName), - cddmPoissonSolver_(NULL), + cddmPoissonSolver_(nullptr), baseSize_(0) { // delete base class's version of the physics model diff --git a/lib/atc/ExtrinsicModelElectrostatic.cpp b/lib/atc/ExtrinsicModelElectrostatic.cpp index ef3aa52dee397038998ea5d2e7384fc3340cae0b..d0aa56d67d629871d3b28c7ee6b3cb2fc0e63987 100644 --- a/lib/atc/ExtrinsicModelElectrostatic.cpp +++ b/lib/atc/ExtrinsicModelElectrostatic.cpp @@ -38,15 +38,15 @@ namespace ATC { poissonSolverType_(DIRECT), // ITERATIVE | DIRECT poissonSolverTol_(0), poissonSolverMaxIter_(0), - poissonSolver_(NULL), + poissonSolver_(nullptr), maxSolves_(0), baseSize_(0), - chargeRegulator_(NULL), + chargeRegulator_(nullptr), useSlab_(false), includeShortRange_(true), - atomForces_(NULL), - nodalAtomicCharge_(NULL), - nodalAtomicGhostCharge_(NULL) + atomForces_(nullptr), + nodalAtomicCharge_(nullptr), + nodalAtomicGhostCharge_(nullptr) { physicsModel_ = new PhysicsModelSpeciesElectrostatic(matFileName); // set up correct masks for coupling diff --git a/lib/atc/ExtrinsicModelTwoTemperature.cpp b/lib/atc/ExtrinsicModelTwoTemperature.cpp index 2be6cfeb3c263be9a228f796c5e7255f718cb8e1..35846fe4964b1c2ba64006bc651e32b12ed7f436 100644 --- a/lib/atc/ExtrinsicModelTwoTemperature.cpp +++ b/lib/atc/ExtrinsicModelTwoTemperature.cpp @@ -26,7 +26,7 @@ namespace ATC { string matFileName) : ExtrinsicModel(modelManager,modelType,matFileName), electronTimeIntegration_(TimeIntegrator::IMPLICIT), - temperatureIntegrator_(NULL), + temperatureIntegrator_(nullptr), nsubcycle_(1), exchangeFlag_(true), baseSize_(0) @@ -164,7 +164,7 @@ namespace ATC { rhsMask(ELECTRON_TEMPERATURE,i) = atc_->fieldMask_(ELECTRON_TEMPERATURE,i); } if (electronTimeIntegration_ == TimeIntegrator::NONE) { - temperatureIntegrator_ = NULL; + temperatureIntegrator_ = nullptr; return; } if (temperatureIntegrator_) delete temperatureIntegrator_; diff --git a/lib/atc/FE_Element.cpp b/lib/atc/FE_Element.cpp index 0d2fc036c73582c8298f58ba096b2367129cb810..299b9f191dcca8f9557d72800cc50ced262be851 100644 --- a/lib/atc/FE_Element.cpp +++ b/lib/atc/FE_Element.cpp @@ -36,7 +36,7 @@ static const double localCoordinatesTolerance = 1.e-09; tolerance_(localCoordinatesTolerance), projectionGuess_(COORDINATE_ALIGNED) { - feInterpolate_ = NULL; + feInterpolate_ = nullptr; } FE_Element::~FE_Element() diff --git a/lib/atc/FE_Engine.cpp b/lib/atc/FE_Engine.cpp index 5e01709b19465f542f8eaede0cf1944c6398fd7f..9e3c5180e2bf268dbc917896e333dfa7f5521786 100644 --- a/lib/atc/FE_Engine.cpp +++ b/lib/atc/FE_Engine.cpp @@ -32,7 +32,7 @@ namespace ATC{ //----------------------------------------------------------------- FE_Engine::FE_Engine(MPI_Comm comm) : communicator_(comm), - feMesh_(NULL), + feMesh_(nullptr), initialized_(false), outputManager_() { diff --git a/lib/atc/FE_Engine.h b/lib/atc/FE_Engine.h index eb59f04eeffcb74de149e591528eba6375c394cc..ade7626f80390645fc644483dfbf187997851dd7 100644 --- a/lib/atc/FE_Engine.h +++ b/lib/atc/FE_Engine.h @@ -90,7 +90,7 @@ namespace ATC { /** write data: data is arrayed over _unique_ nodes and then mapped by the engine */ - void write_data(double time, FIELDS &soln, OUTPUT_LIST *data=NULL); + void write_data(double time, FIELDS &soln, OUTPUT_LIST *data=nullptr); void write_data(double time, OUTPUT_LIST *data); void write_restart_file(std::string fileName, RESTART_LIST *data) @@ -150,7 +150,7 @@ namespace ATC { const PhysicsModel *physicsModel, const Array &elementMaterials, SPAR_MAT &tangent, - const DenseMatrix *elementMask=NULL) const; + const DenseMatrix *elementMask=nullptr) const; /** compute tangent matrix for a pair of fields - given quadrature */ void compute_tangent_matrix(const RHS_MASK &rhsMask, @@ -162,7 +162,7 @@ namespace ATC { const SPAR_MAT &N, const SPAR_MAT_VEC &dN, SPAR_MAT &tangent, - const DenseMatrix *elementMask=NULL) const; + const DenseMatrix *elementMask=nullptr) const; /** compute a consistent mass matrix for a field */ void compute_mass_matrix( @@ -171,7 +171,7 @@ namespace ATC { const PhysicsModel *physicsModel, const Array &elementMaterials, CON_MASS_MATS &mass_matrix, - const DenseMatrix *elementMask=NULL) const; + const DenseMatrix *elementMask=nullptr) const; /** compute a dimensionless mass matrix */ void compute_mass_matrix(SPAR_MAT &mass_matrix) const; @@ -191,7 +191,7 @@ namespace ATC { const PhysicsModel *physicsModel, const Array &elementMaterials, MASS_MATS &mass_matrix, - const DenseMatrix *elementMask=NULL) const; + const DenseMatrix *elementMask=nullptr) const; /** compute dimensional lumped mass matrix using given quadrature */ void compute_lumped_mass_matrix( @@ -212,7 +212,7 @@ namespace ATC { const PhysicsModel *physicsModel, const Array &elementMaterials, FIELD_MATS &energy, - const DenseMatrix *elementMask=NULL, + const DenseMatrix *elementMask=nullptr, const IntegrationDomainType domain=FULL_DOMAIN) const; /** compute residual or RHS of the dynamic weak eqn */ @@ -223,7 +223,7 @@ namespace ATC { const Array &elementMaterials, FIELDS &rhs, bool freeOnly=false, - const DenseMatrix *elementMask=NULL) const; + const DenseMatrix *elementMask=nullptr) const; /** compute RHS for given quadrature */ void compute_rhs_vector(const RHS_MASK &rhsMask, @@ -251,7 +251,7 @@ namespace ATC { const PhysicsModel *physicsModel, const Array &elementMaterials, GRAD_FIELD_MATS &flux, - const DenseMatrix *elementMask=NULL) const; + const DenseMatrix *elementMask=nullptr) const; /** compute the flux on the MD/FE boundary */ void compute_boundary_flux(const RHS_MASK &rhsMask, @@ -272,8 +272,8 @@ namespace ATC { const SPAR_MAT_VEC &dN, const DIAG_MAT &flux_mask, FIELDS &rhs, - const DenseMatrix *elementMask=NULL, - const std::set *nodeSet=NULL) const; + const DenseMatrix *elementMask=nullptr, + const std::set *nodeSet=nullptr) const; /** compute prescribed flux given an array of functions of x & t */ void add_fluxes(const Array &fieldMask, @@ -465,7 +465,7 @@ namespace ATC { int nsd() const { return feMesh_->num_spatial_dimensions(); } /** return if the FE mesh has been created */ - int has_mesh() const { return feMesh_!=NULL; } + int has_mesh() const { return feMesh_!=nullptr; } /** get nodal coordinates for a given element */ void element_coordinates(const int eltIdx, DENS_MAT &coords) diff --git a/lib/atc/FE_Mesh.cpp b/lib/atc/FE_Mesh.cpp index 4ea10a681af5cc62a843ad98307705637506d993..6af29ee37e59088769c5babd8578123beed31766 100644 --- a/lib/atc/FE_Mesh.cpp +++ b/lib/atc/FE_Mesh.cpp @@ -46,7 +46,7 @@ namespace ATC { partitioned_(false), nNodes_(0), nNodesUnique_(0), - feElement_(NULL), + feElement_(nullptr), twoDimensional_(false), hasPlanarFaces_(false) @@ -1708,7 +1708,7 @@ namespace ATC { const Array< pair< string, set > > *nodeSets): FE_Mesh(), minEltSize_(0), - tree_(NULL) + tree_(nullptr) { // Pick which element class to make if (elementType == "HEX8") { @@ -1774,7 +1774,7 @@ namespace ATC { } // Insert nodes and elements into KD-tree for PIE search. - if (tree_ == NULL) { + if (tree_ == nullptr) { tree_ = KD_Tree::create_KD_tree(feElement_->num_elt_nodes(), nNodes_, &nodalCoords_, nElts_, connectivity_); } @@ -2107,7 +2107,7 @@ namespace ATC { // use the KD tree for partitioning, getting more blocks than // processors - if (tree_ == NULL) { + if (tree_ == nullptr) { tree_ = KD_Tree::create_KD_tree(feElement_->num_elt_nodes(), nNodes_, &nodalCoords_, nElts_, connectivity_); @@ -2519,7 +2519,7 @@ namespace ATC { const double zscale) : hx_(hx), hy_(hy), hz_(hz) { - tree_ = NULL; + tree_ = nullptr; hasPlanarFaces_ = true; xscale_ = xscale; yscale_ = yscale; @@ -2820,7 +2820,7 @@ namespace ATC { const double zscale) { hasPlanarFaces_ = true; - tree_ = NULL; + tree_ = nullptr; xscale_ = xscale; yscale_ = yscale; zscale_ = zscale; diff --git a/lib/atc/FieldEulerIntegrator.cpp b/lib/atc/FieldEulerIntegrator.cpp index 0abc71cbaba6dd1dd2200e86cce99855b3b37a4f..ba23af40c9b3f2bc7078fdb538a4978491e2aaf2 100644 --- a/lib/atc/FieldEulerIntegrator.cpp +++ b/lib/atc/FieldEulerIntegrator.cpp @@ -112,7 +112,7 @@ FieldImplicitDirectEulerIntegrator::FieldImplicitDirectEulerIntegrator( const Array2D< bool > & rhsMask, // copy const double alpha ) : FieldEulerIntegrator(fieldName,physicsModel,feEngine,atc,rhsMask), - alpha_(alpha),solver_(NULL) + alpha_(alpha),solver_(nullptr) { rhsMask_(fieldName_,FLUX) = false; // handle laplacian term with stiffness const BC_SET & bcs = (atc_->prescribed_data_manager()->bcs(fieldName_))[0]; diff --git a/lib/atc/FieldManager.cpp b/lib/atc/FieldManager.cpp index 338f06acad81395cef3188acf8d1893e6fcefe67..8a7fb0d50b5a9dc96b428ab8924e8cf89e7ba6dd 100644 --- a/lib/atc/FieldManager.cpp +++ b/lib/atc/FieldManager.cpp @@ -271,7 +271,7 @@ typedef PerAtomQuantity PAQ; u = new AtfShapeFunctionMdProjection(atc_,restricted,VELOCITY); } else { - DENS_MAN * q = NULL; + DENS_MAN * q = nullptr; if (atc_->kernel_on_the_fly()) { if (atc_->kernel_based()) { q = new OnTheFlyKernelAccumulationNormalized(atc_, atomic, diff --git a/lib/atc/FieldManager.h b/lib/atc/FieldManager.h index 9a9867641752c1678ac79129a50383570baedcc2..b12db230c54275eda8e4e152547e60ee8998e042 100644 --- a/lib/atc/FieldManager.h +++ b/lib/atc/FieldManager.h @@ -47,7 +47,7 @@ namespace ATC { case SPECIES_FLUX: return species_flux(name); case INTERNAL_ENERGY: return internal_energy(name); case ENERGY: return energy(name); - default: throw ATC_Error("FieldManager:: unknown field"); return NULL; + default: throw ATC_Error("FieldManager:: unknown field"); return nullptr; } } CanonicalName string_to_canonical_name(std::string name){ @@ -83,11 +83,11 @@ namespace ATC { case PROLONGED_VELOCITY: return prolonged_field(VELOCITY); default: - throw ATC_Error("FieldManager:: unknown PAQ"); return NULL; + throw ATC_Error("FieldManager:: unknown PAQ"); return nullptr; } } /** this function returns a restriction of atomic data */ - DENS_MAN * restricted_atom_quantity(FieldName field, std::string name = "default", PAQ * atomi = NULL); + DENS_MAN * restricted_atom_quantity(FieldName field, std::string name = "default", PAQ * atomi = nullptr); protected: ATC_Method * atc_; InterscaleManager & interscaleManager_; @@ -120,10 +120,10 @@ namespace ATC { PAQ * atomic_species_vector(); // internal functions - DENS_MAN * projected_atom_quantity(FieldName field,std::string name, PAQ * atomic, DIAG_MAN * normalization = NULL); - DENS_MAN * scaled_projected_atom_quantity(FieldName field,std::string name, PAQ * atomic, double scale, DIAG_MAN * normalization = NULL); - DENS_MAN * referenced_projected_atom_quantity(FieldName field, std::string name, PAQ * atomic, DENS_MAN * reference, DIAG_MAN * normalization = NULL); - DENS_MAN * inferred_atom_quantity(FieldName /* field */, std::string /* name */, PAQ * /* atomic */){return NULL;}; + DENS_MAN * projected_atom_quantity(FieldName field,std::string name, PAQ * atomic, DIAG_MAN * normalization = nullptr); + DENS_MAN * scaled_projected_atom_quantity(FieldName field,std::string name, PAQ * atomic, double scale, DIAG_MAN * normalization = nullptr); + DENS_MAN * referenced_projected_atom_quantity(FieldName field, std::string name, PAQ * atomic, DENS_MAN * reference, DIAG_MAN * normalization = nullptr); + DENS_MAN * inferred_atom_quantity(FieldName /* field */, std::string /* name */, PAQ * /* atomic */){return nullptr;}; PAQ * prolonged_field(FieldName field); private: FieldManager(void); diff --git a/lib/atc/Function.cpp b/lib/atc/Function.cpp index 062cbcb9b27a2ff6a87acd4fd15bfdd122825881..e73d64aaea423c2261ca36d56efa563ec04294fa 100644 --- a/lib/atc/Function.cpp +++ b/lib/atc/Function.cpp @@ -26,13 +26,13 @@ namespace ATC { //==================================================================== // UXT_Function_Mgr //==================================================================== - UXT_Function_Mgr * UXT_Function_Mgr::myInstance_ = NULL; + UXT_Function_Mgr * UXT_Function_Mgr::myInstance_ = nullptr; // ----------------------------------------------------------------- // instance() // ----------------------------------------------------------------- UXT_Function_Mgr * UXT_Function_Mgr::instance() { - if (myInstance_ == NULL) { + if (myInstance_ == nullptr) { myInstance_ = new UXT_Function_Mgr(); } return myInstance_; @@ -90,7 +90,7 @@ namespace ATC { { string tag = other->tag(); - UXT_Function * returnFunction = NULL; + UXT_Function * returnFunction = nullptr; if (tag=="linear") { ScalarLinearFunction * other_cast = (ScalarLinearFunction*) other; returnFunction = new ScalarLinearFunction(*other_cast); @@ -144,14 +144,14 @@ namespace ATC { // XT_Function_Mgr //-------------------------------------------------------------------- //-------------------------------------------------------------------- -XT_Function_Mgr * XT_Function_Mgr::myInstance_ = NULL; +XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr; // ----------------------------------------------------------------- // instance() // ----------------------------------------------------------------- XT_Function_Mgr * XT_Function_Mgr::instance() { - if (myInstance_ == NULL) { + if (myInstance_ == nullptr) { myInstance_ = new XT_Function_Mgr(); } return myInstance_; @@ -227,7 +227,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = NULL; { string tag = other->tag(); - XT_Function * returnFunction = NULL; + XT_Function * returnFunction = nullptr; if (tag=="linear") { LinearFunction * other_cast = (LinearFunction*) other; returnFunction = new LinearFunction(*other_cast); diff --git a/lib/atc/FundamentalAtomicQuantity.cpp b/lib/atc/FundamentalAtomicQuantity.cpp index 0ebb54e16803803d4e2a4546f0b1dc74bbdc981d..63824bd0dd0731a9055d9b22ab34128d6d6f4142 100644 --- a/lib/atc/FundamentalAtomicQuantity.cpp +++ b/lib/atc/FundamentalAtomicQuantity.cpp @@ -126,7 +126,7 @@ namespace ATC { double unitsConversion, AtomType atomType) : ShallowAtomQuantity(atc,0,atomType), - computePointer_(NULL), + computePointer_(nullptr), computeTag_(tag), unitsConversion_(unitsConversion) { diff --git a/lib/atc/FundamentalAtomicQuantity.h b/lib/atc/FundamentalAtomicQuantity.h index 5fb525cd6f60847b45b949eb8045c8196134bbad..d5cf9f8a2138241e48578c1d7caf17a52ae80471 100644 --- a/lib/atc/FundamentalAtomicQuantity.h +++ b/lib/atc/FundamentalAtomicQuantity.h @@ -131,11 +131,11 @@ namespace ATC { /** gets appropriate pointer for lammps data */ virtual double * lammps_scalar() const - {return NULL;}; + {return nullptr;}; /** gets appropriate pointer for lammps data */ virtual double ** lammps_vector() const - {return NULL;}; + {return nullptr;}; private: diff --git a/lib/atc/GhostManager.cpp b/lib/atc/GhostManager.cpp index 77594ec406360a7fa03312f1eeb97a0485ce6fb6..1482a5a47db240198f707fa3854b0891fe062d1b 100644 --- a/lib/atc/GhostManager.cpp +++ b/lib/atc/GhostManager.cpp @@ -23,7 +23,7 @@ namespace ATC { // Constructor //-------------------------------------------------------- GhostManager::GhostManager(ATC_Method * atc) : - ghostModifier_(NULL), + ghostModifier_(nullptr), atc_(atc), boundaryDynamics_(NO_BOUNDARY_DYNAMICS), needReset_(true) @@ -116,7 +116,7 @@ namespace ATC { { if (ghostModifier_) { delete ghostModifier_; - ghostModifier_ = NULL; + ghostModifier_ = nullptr; } if (!atc_->groupbit_ghost()) { @@ -252,7 +252,7 @@ namespace ATC { //-------------------------------------------------------- GhostModifier::GhostModifier(GhostManager * ghostManager) : ghostManager_(ghostManager), - atomTimeIntegrator_(NULL), + atomTimeIntegrator_(nullptr), integrateAtoms_(false) { // do nothing @@ -321,9 +321,9 @@ namespace ATC { //-------------------------------------------------------- GhostModifierPrescribed::GhostModifierPrescribed(GhostManager * ghostManager) : GhostModifier(ghostManager), - atomPositions_(NULL), - atomFeDisplacement_(NULL), - atomRefPositions_(NULL) + atomPositions_(nullptr), + atomFeDisplacement_(nullptr), + atomRefPositions_(nullptr) { // do nothing } @@ -382,9 +382,9 @@ namespace ATC { const vector & gamma, const vector & mu) : GhostModifierPrescribed(ghostManager), - atomVelocities_(NULL), - atomFeVelocity_(NULL), - atomForces_(NULL), + atomVelocities_(nullptr), + atomFeVelocity_(nullptr), + atomForces_(nullptr), kappa_(kappa), gamma_(gamma), mu_(mu) @@ -486,8 +486,8 @@ namespace ATC { const vector & gamma, const vector & mu) : GhostModifierDampedHarmonic(ghostManager,kappa,gamma,mu), - ghostToBoundaryDistance_(NULL), - layerId_(NULL) + ghostToBoundaryDistance_(nullptr), + layerId_(nullptr) { // do nothing @@ -731,8 +731,8 @@ namespace ATC { GhostModifier(ghostManager), lammpsInterface_(LammpsInterface::instance()), elementSet_((((ghostManager_->atc())->fe_engine())->fe_mesh())->elementset((ghostManager_->atc())->internal_element_set())), - atomElement_(NULL), - atomGhostElement_(NULL), + atomElement_(nullptr), + atomGhostElement_(nullptr), internalToAtom_((ghostManager_->atc())->internal_to_atom_map()), ghostToAtom_((ghostManager_->atc())->ghost_to_atom_map()), groupbit_((ghostManager_->atc())->groupbit()), diff --git a/lib/atc/InterscaleOperators.cpp b/lib/atc/InterscaleOperators.cpp index f1e5607b6edbd8c5e6e80084073dd4eb0a6edad2..eeac14adf814b91160acb69e502ea159691bd46e 100644 --- a/lib/atc/InterscaleOperators.cpp +++ b/lib/atc/InterscaleOperators.cpp @@ -30,7 +30,7 @@ namespace ATC{ for (unsigned int i = 0; i < NUM_ATOM_TYPES; i++) { fundamentalAtomQuantities_[i].resize(LammpsInterface::NUM_FUNDAMENTAL_ATOM_QUANTITIES); for (unsigned int j = 0; j < LammpsInterface::NUM_FUNDAMENTAL_ATOM_QUANTITIES; j++) - fundamentalAtomQuantities_[i][j] = NULL; + fundamentalAtomQuantities_[i][j] = nullptr; } } @@ -126,7 +126,7 @@ namespace ATC{ if (fundamentalAtomQuantities_[i][j]) { index = dfs_visit(fundamentalAtomQuantities_[i][j],index); if ((fundamentalAtomQuantities_[i][j])->memory_type()==TEMPORARY) { - fundamentalAtomQuantities_[i][j] = NULL; + fundamentalAtomQuantities_[i][j] = nullptr; } } } @@ -453,7 +453,7 @@ namespace ATC{ DependencyManager * InterscaleManager::find(const string & tag) { // REFACTOR add check for duplicate entries - DependencyManager * quantity = NULL; + DependencyManager * quantity = nullptr; quantity = find_in_list(perAtomQuantities_,tag); if (quantity) return quantity; @@ -482,7 +482,7 @@ namespace ATC{ quantity = find_in_list(smallMoleculeSets_,tag); if (quantity) return quantity; - return NULL; + return nullptr; } //-------------------------------------------------------- diff --git a/lib/atc/InterscaleOperators.h b/lib/atc/InterscaleOperators.h index 3a4d81212e3603ed38d68ebc98cdf785d5ab4421..40c5144bf8ffd03675deb998bacfc279a20f1596 100644 --- a/lib/atc/InterscaleOperators.h +++ b/lib/atc/InterscaleOperators.h @@ -277,7 +277,7 @@ namespace ATC { data * return_quantity(std::map & list, const std::string & tag) { typename std::map::iterator it = list.find(tag); - if (it==list.end()) return NULL; + if (it==list.end()) return nullptr; return it->second; } @@ -310,7 +310,7 @@ namespace ATC { { typename std::map::iterator it = list.find(tag); if (it!=list.end()) return it->second; - return NULL; + return nullptr; } /** helper function to force the reset of all data in a list */ diff --git a/lib/atc/KD_Tree.cpp b/lib/atc/KD_Tree.cpp index 1432663e8064b60b8862e707d99aa010fb0245c1..181be27dc5c50c471ac419cb6384930a2eef6727 100644 --- a/lib/atc/KD_Tree.cpp +++ b/lib/atc/KD_Tree.cpp @@ -83,17 +83,17 @@ KD_Tree::KD_Tree(vector *points, vector *elements, if (foundElemRight) rightElems->push_back(*elit); } - // Create child tree, or NULL if there's nothing to create + // Create child tree, or nullptr if there's nothing to create if (candElems_->size() - leftElems->size() < 4 || leftElems->size() == 0) { - leftChild_ = NULL; + leftChild_ = nullptr; delete leftPts; delete leftElems; } else { leftChild_ = new KD_Tree(leftPts, leftElems, (dimension+1) % 3); } - // Create child tree, or NULL if there's nothing to create + // Create child tree, or nullptr if there's nothing to create if (candElems_->size() - rightElems->size() < 4 || rightElems->size() == 0) { - rightChild_ = NULL; + rightChild_ = nullptr; delete rightPts; delete rightElems; } else { @@ -109,7 +109,7 @@ vector KD_Tree::find_nearest_elements(Node query, int dimension) { // tree, either recurse to the left or return this node's elements // if there is no left child. if (query.lessThanInDimension(value_, dimension)) { - if (leftChild_ == NULL) { + if (leftChild_ == nullptr) { vector result = vector(); for (vector::iterator elem = candElems_->begin(); elem != candElems_->end(); elem++) { @@ -119,7 +119,7 @@ vector KD_Tree::find_nearest_elements(Node query, int dimension) { } return leftChild_->find_nearest_elements(query, (dimension+1) % 3); } else { - if (rightChild_ == NULL) { + if (rightChild_ == nullptr) { vector result = vector(); for (vector::iterator elem = candElems_->begin(); elem != candElems_->end(); elem++) { @@ -147,7 +147,7 @@ vector > KD_Tree::getElemIDs(int depth) { sort(candElemIDs.begin(), candElemIDs.end()); result.push_back(candElemIDs); - } else if (leftChild_ == NULL || rightChild_ == NULL) { + } else if (leftChild_ == nullptr || rightChild_ == nullptr) { // Insert all nodes at this level once, // then insert a bunch of empty vectors. temp = this->getElemIDs(0); diff --git a/lib/atc/KernelFunction.cpp b/lib/atc/KernelFunction.cpp index 70a1616e0162ff1284ebf3f23c5b540c77400a96..6095c14284a13194e7926e8d1fabb23ef7d88312 100644 --- a/lib/atc/KernelFunction.cpp +++ b/lib/atc/KernelFunction.cpp @@ -20,13 +20,13 @@ namespace ATC { //======================================================================== // KernelFunctionMgr //======================================================================== - KernelFunctionMgr * KernelFunctionMgr::myInstance_ = NULL; + KernelFunctionMgr * KernelFunctionMgr::myInstance_ = nullptr; //------------------------------------------------------------------------ // instance //------------------------------------------------------------------------ KernelFunctionMgr * KernelFunctionMgr::instance() { - if (myInstance_ == NULL) { + if (myInstance_ == nullptr) { myInstance_ = new KernelFunctionMgr(); } return myInstance_; @@ -65,7 +65,7 @@ namespace ATC { No default */ int argIdx = 0; - KernelFunction * ptr = NULL; + KernelFunction * ptr = nullptr; char* type = arg[argIdx++]; if (strcmp(type,"step")==0) { double parameters[1] = {atof(arg[argIdx])}; // cutoff radius diff --git a/lib/atc/KinetoThermostat.cpp b/lib/atc/KinetoThermostat.cpp index c10f7eb4581c06e4857e2d3af3d1e597cc7fa007..89d598c1027b2760642f92137263bf355eb0184e 100644 --- a/lib/atc/KinetoThermostat.cpp +++ b/lib/atc/KinetoThermostat.cpp @@ -151,7 +151,7 @@ namespace ATC { VelocityRescaleCombined::VelocityRescaleCombined(AtomicRegulator * kinetostat) : VelocityGlc(kinetostat), velocity_(atc_->field(VELOCITY)), - thermostatCorrection_(NULL) + thermostatCorrection_(nullptr) { // do nothing } @@ -188,7 +188,7 @@ namespace ATC { //-------------------------------------------------------- ThermostatRescaleCombined::ThermostatRescaleCombined(AtomicRegulator * thermostat) : ThermostatRescale(thermostat), - kinetostatCorrection_(NULL) + kinetostatCorrection_(nullptr) { // do nothing } @@ -226,14 +226,14 @@ namespace ATC { KinetoThermostatRescale::KinetoThermostatRescale(AtomicRegulator * kinetoThermostat, int couplingMaxIterations) : KinetoThermostatShapeFunction(kinetoThermostat,couplingMaxIterations), - atomVelocities_(NULL), + atomVelocities_(nullptr), nodalVelocities_(atc_->field(VELOCITY)), - lambdaMomentum_(NULL), - lambdaEnergy_(NULL), - atomicFluctuatingVelocityRescaled_(NULL), - atomicStreamingVelocity_(NULL), - thermostat_(NULL), - kinetostat_(NULL) + lambdaMomentum_(nullptr), + lambdaEnergy_(nullptr), + atomicFluctuatingVelocityRescaled_(nullptr), + atomicStreamingVelocity_(nullptr), + thermostat_(nullptr), + kinetostat_(nullptr) { thermostat_ = this->construct_rescale_thermostat(); kinetostat_ = new VelocityRescaleCombined(kinetoThermostat); @@ -389,7 +389,7 @@ namespace ATC { //-------------------------------------------------------- ThermostatRescaleMixedKePeCombined::ThermostatRescaleMixedKePeCombined(AtomicRegulator * thermostat) : ThermostatRescaleMixedKePe(thermostat), - kinetostatCorrection_(NULL) + kinetostatCorrection_(nullptr) { // do nothing } @@ -458,21 +458,21 @@ namespace ATC { velocity_(atc_->field(VELOCITY)), temperature_(atc_->field(TEMPERATURE)), timeFilter_(atomicRegulator_->time_filter()), - nodalAtomicLambdaForce_(NULL), - lambdaForceFiltered_(NULL), - nodalAtomicLambdaPower_(NULL), - lambdaPowerFiltered_(NULL), - atomRegulatorForces_(NULL), - atomThermostatForces_(NULL), - atomMasses_(NULL), - atomVelocities_(NULL), + nodalAtomicLambdaForce_(nullptr), + lambdaForceFiltered_(nullptr), + nodalAtomicLambdaPower_(nullptr), + lambdaPowerFiltered_(nullptr), + atomRegulatorForces_(nullptr), + atomThermostatForces_(nullptr), + atomMasses_(nullptr), + atomVelocities_(nullptr), isFirstTimestep_(true), - nodalAtomicMomentum_(NULL), - nodalAtomicEnergy_(NULL), - atomPredictedVelocities_(NULL), - nodalAtomicPredictedMomentum_(NULL), - nodalAtomicPredictedEnergy_(NULL), - firstHalfAtomForces_(NULL), + nodalAtomicMomentum_(nullptr), + nodalAtomicEnergy_(nullptr), + atomPredictedVelocities_(nullptr), + nodalAtomicPredictedMomentum_(nullptr), + nodalAtomicPredictedEnergy_(nullptr), + firstHalfAtomForces_(nullptr), dtFactor_(0.) { // construct/obtain data corresponding to stage 3 of ATC_Method::initialize diff --git a/lib/atc/Kinetostat.cpp b/lib/atc/Kinetostat.cpp index 7f95398dcbd59d80ae5af1af3571ea85699559b3..676896a2f9a03c14c1047300028dac8c3f8bf969 100644 --- a/lib/atc/Kinetostat.cpp +++ b/lib/atc/Kinetostat.cpp @@ -307,11 +307,11 @@ namespace ATC { RegulatorShapeFunction(kinetostat,regulatorPrefix), mdMassMatrix_(atc_->set_mass_mat_md(VELOCITY)), timeFilter_(atomicRegulator_->time_filter()), - nodalAtomicLambdaForce_(NULL), - lambdaForceFiltered_(NULL), - atomKinetostatForce_(NULL), - atomVelocities_(NULL), - atomMasses_(NULL) + nodalAtomicLambdaForce_(nullptr), + lambdaForceFiltered_(nullptr), + atomKinetostatForce_(nullptr), + atomVelocities_(nullptr), + atomMasses_(nullptr) { // data associated with stage 3 in ATC_Method::initialize lambda_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaMomentum",nsd_); @@ -376,7 +376,7 @@ namespace ATC { //-------------------------------------------------------- GlcKinetostat::GlcKinetostat(AtomicRegulator *kinetostat) : KinetostatShapeFunction(kinetostat), - atomPositions_(NULL) + atomPositions_(nullptr) { // do nothing } @@ -462,7 +462,7 @@ namespace ATC { //-------------------------------------------------------- DisplacementGlc::DisplacementGlc(AtomicRegulator * kinetostat) : GlcKinetostat(kinetostat), - nodalAtomicMassWeightedDisplacement_(NULL), + nodalAtomicMassWeightedDisplacement_(nullptr), nodalDisplacements_(atc_->field(DISPLACEMENT)) { // do nothing @@ -763,7 +763,7 @@ namespace ATC { //-------------------------------------------------------- VelocityGlc::VelocityGlc(AtomicRegulator * kinetostat) : GlcKinetostat(kinetostat), - nodalAtomicMomentum_(NULL), + nodalAtomicMomentum_(nullptr), nodalVelocities_(atc_->field(VELOCITY)) { // do nothing @@ -1095,8 +1095,8 @@ namespace ATC { StressFlux::StressFlux(AtomicRegulator * kinetostat) : GlcKinetostat(kinetostat), nodalForce_(atc_->field_rhs(VELOCITY)), - nodalAtomicForce_(NULL), - nodalGhostForce_(NULL), + nodalAtomicForce_(nullptr), + nodalGhostForce_(nullptr), momentumSource_(atc_->atomic_source(VELOCITY)) { // flag for performing boundary flux calculation @@ -1540,14 +1540,14 @@ namespace ATC { KinetostatShapeFunction(kinetostat,regulatorPrefix), velocity_(atc_->field(VELOCITY)), //timeFilter_(atomicRegulator_->time_filter()), - //nodalAtomicLambdaForce_(NULL), - //lambdaPowerFiltered_(NULL), - //atomKinetostatForces_(NULL), - //atomMasses_(NULL), - nodalAtomicMomentum_(NULL), + //nodalAtomicLambdaForce_(nullptr), + //lambdaPowerFiltered_(nullptr), + //atomKinetostatForces_(nullptr), + //atomMasses_(nullptr), + nodalAtomicMomentum_(nullptr), isFirstTimestep_(true), - atomPredictedVelocities_(NULL), - nodalAtomicPredictedMomentum_(NULL), + atomPredictedVelocities_(nullptr), + nodalAtomicPredictedMomentum_(nullptr), dtFactor_(0.) { // constuct/obtain data corresponding to stage 3 of ATC_Method::initialize @@ -1796,8 +1796,8 @@ namespace ATC { const string & regulatorPrefix) : KinetostatGlcFs(kinetostat,regulatorPrefix), momentumSource_(atc_->atomic_source(VELOCITY)), - nodalGhostForce_(NULL), - nodalGhostForceFiltered_(NULL) + nodalGhostForce_(nullptr), + nodalGhostForceFiltered_(nullptr) { // flag for performing boundary flux calculation fieldMask_(VELOCITY,FLUX) = true; @@ -2403,9 +2403,9 @@ namespace ATC { KinetostatFluxFixed::KinetostatFluxFixed(AtomicRegulator * kinetostat, bool constructKinetostats) : RegulatorMethod(kinetostat), - kinetostatFlux_(NULL), - kinetostatFixed_(NULL), - kinetostatBcs_(NULL) + kinetostatFlux_(nullptr), + kinetostatFixed_(nullptr), + kinetostatBcs_(nullptr) { if (constructKinetostats) { if (kinetostat->coupling_mode(VELOCITY) == AtomicRegulator::GHOST_FLUX) { diff --git a/lib/atc/LammpsInterface.cpp b/lib/atc/LammpsInterface.cpp index 9964a1c4bb28593bf97701cacc04dad4b24e352e..5727af1904ed6637c2a4304cd39a948226d6a850 100644 --- a/lib/atc/LammpsInterface.cpp +++ b/lib/atc/LammpsInterface.cpp @@ -58,14 +58,14 @@ const static int MAX_GROUP_BIT = 2147483647; //4294967295; // pow(2,31)-1; double norm(double * v) {return sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]); } -LammpsInterface * LammpsInterface::myInstance_ = NULL; +LammpsInterface * LammpsInterface::myInstance_ = nullptr; // ----------------------------------------------------------------- // instance() // ----------------------------------------------------------------- LammpsInterface * LammpsInterface::instance() { - if (myInstance_ == NULL) { + if (myInstance_ == nullptr) { myInstance_ = new LammpsInterface(); } return myInstance_; @@ -77,7 +77,7 @@ LammpsInterface * LammpsInterface::instance() void LammpsInterface::Destroy() { if (myInstance_) delete myInstance_; - myInstance_ = NULL; + myInstance_ = nullptr; } @@ -85,13 +85,13 @@ void LammpsInterface::Destroy() // constructor // ----------------------------------------------------------------- LammpsInterface::LammpsInterface() - : lammps_(NULL), - fixPointer_(NULL), + : lammps_(nullptr), + fixPointer_(nullptr), commRank_(0), - atomPE_(NULL), + atomPE_(nullptr), refBoxIsSet_(false), - random_(NULL), - globalrandom_(NULL) + random_(nullptr), + globalrandom_(nullptr) { } @@ -225,7 +225,7 @@ void LammpsInterface::sparse_allsum(SparseMatrix &toShare) const std::string LammpsInterface::read_file(std::string filename) const { - FILE *fp = NULL; + FILE *fp = nullptr; if (! comm_rank()) { fp = fopen(filename.c_str(),"r"); if (!fp) throw ATC_Error("can't open file: "+filename); @@ -343,7 +343,7 @@ double * LammpsInterface::atom_scalar(FundamentalAtomQuantity quantityType) cons } else throw ATC_Error("BAD type requested in atom_scalar"); - return NULL; + return nullptr; } double ** LammpsInterface::atom_vector(FundamentalAtomQuantity quantityType) const @@ -356,7 +356,7 @@ double ** LammpsInterface::atom_vector(FundamentalAtomQuantity quantityType) con return fatom(); else throw ATC_Error("BAD type requested in atom_vector"); - return NULL; + return nullptr; } int LammpsInterface::atom_quantity_ndof(FundamentalAtomQuantity quantityType) const @@ -948,10 +948,10 @@ POTENTIAL LammpsInterface::potential() const "lj/cut/coul/long", "lj/cut/coul/cut", "lj/charmm/coul/long"}; - LAMMPS_NS::Pair *pair = NULL; + LAMMPS_NS::Pair *pair = nullptr; for (int i = 0; i < nStyles; i++){ pair = lammps_->force->pair_match(pairStyles[i].c_str(),1); - if (pair != NULL) break; + if (pair != nullptr) break; } return pair; } @@ -979,8 +979,8 @@ bool LammpsInterface::epsilons(int itype, POTENTIAL pair, double * epsilon0) con int dim = 2; // a return value for extract double ** epsilons = (double**) ( pair->extract(pair_parameter,dim) ); delete [] pair_parameter; - if (epsilons == NULL) return false; - //if (epsilons == NULL) error->all(FLERR,"Fix concentration adapted pair style parameter not supported"); + if (epsilons == nullptr) return false; + //if (epsilons == nullptr) error->all(FLERR,"Fix concentration adapted pair style parameter not supported"); int i1,i2; for (int i=1; i < ntypes()+1; i++) { if (i < itype) { i1 = i; i2 = itype; } @@ -998,8 +998,8 @@ bool LammpsInterface::set_epsilons(int itype, POTENTIAL pair, double * epsilon) int dim = 2; // a return value for extract double ** epsilons = (double**) ( pair->extract(pair_parameter,dim) ); delete [] pair_parameter; - if (epsilons == NULL) return false; - //if (epsilons == NULL) error->all(FLERR,"Fix concentration adapted pair style parameter not supported"); + if (epsilons == nullptr) return false; + //if (epsilons == nullptr) error->all(FLERR,"Fix concentration adapted pair style parameter not supported"); // scale interactions int i1,i2; for (int i = 1; i < ntypes()+1; i++) { @@ -1498,7 +1498,7 @@ double * LammpsInterface::compute_pe_peratom(void) const return atomPE_->vector_atom; } else { - return NULL; + return nullptr; } } @@ -1542,7 +1542,7 @@ LAMMPS_NS::PairEAM* LammpsInterface::pair_eam() const // return lammps_->force->pair; //} LAMMPS_NS::PairEAM* pair_eam = dynamic_cast (lammps_->force->pair); - if (pair_eam != NULL) { + if (pair_eam != nullptr) { return pair_eam; } else { diff --git a/lib/atc/LammpsInterface.h b/lib/atc/LammpsInterface.h index 2032571da5df99e642da3b761eb1464c176ed098..6883a9ca0bfb500a8d84547d9dcbc1b387b527cb 100644 --- a/lib/atc/LammpsInterface.h +++ b/lib/atc/LammpsInterface.h @@ -534,7 +534,7 @@ class LammpsInterface { /** Dulong-Petit heat capacity per volume in M,L,T,t units */ double heat_capacity(void) const; /** mass per volume in reference configuraturation in M,L units */ - double mass_density(int* numPerType=NULL) const; + double mass_density(int* numPerType=nullptr) const; /** permittivity of free space, converts from LAMMPS potential units implied by the electric field units to LAMMPS charge units/LAMMPS length units (e.g., V to elemental charge/A) */ double epsilon0(void) const; double coulomb_constant(void) const; diff --git a/lib/atc/LinearSolver.cpp b/lib/atc/LinearSolver.cpp index 655d6130c4530b1ba818c141be64fed5b568f8d5..0204ddd9381d56801c4034a9dc6c365ae687849c 100644 --- a/lib/atc/LinearSolver.cpp +++ b/lib/atc/LinearSolver.cpp @@ -35,9 +35,9 @@ LinearSolver::LinearSolver( allowReinitialization_(false), homogeneousBCs_(false), bcs_(&bcs), - rhs_(NULL), + rhs_(nullptr), rhsDense_(), - b_(NULL), + b_(nullptr), matrix_(A), matrixDense_(), matrixFreeFree_(), matrixFreeFixed_(),matrixInverse_(), @@ -65,9 +65,9 @@ LinearSolver::LinearSolver( matrixModified_(false), allowReinitialization_(false), homogeneousBCs_(false), - bcs_(NULL), // null implies no constraints will be added later - rhs_(NULL), - rhsDense_(), b_(NULL), + bcs_(nullptr), // null implies no constraints will be added later + rhs_(nullptr), + rhsDense_(), b_(nullptr), matrix_(A), matrixDense_(), matrixFreeFree_(), matrixFreeFixed_(),matrixInverse_(), @@ -343,7 +343,7 @@ void LinearSolver::set_fixed_values(VECTOR & X) void LinearSolver::eigen_system( DENS_MAT & eigenvalues, DENS_MAT & eigenvectors, const DENS_MAT * M) /* const */ { initialize_matrix(); // no inverse needed - const DENS_MAT * Kp = NULL; + const DENS_MAT * Kp = nullptr; const DENS_MAT * Mp =M; DENS_MAT MM; DENS_MAT KM; @@ -388,7 +388,7 @@ void LinearSolver::eigen_system( DENS_MAT & eigenvalues, DENS_MAT & eigenvectors bool LinearSolver::solve(VECTOR & x, const VECTOR & b) { - SPAR_MAT * A = NULL; + SPAR_MAT * A = nullptr; rhs_ = &b; initialized_ = false; @@ -479,7 +479,7 @@ bool LinearSolver::solve(VECTOR & x, const VECTOR & b) void LinearSolver::greens_function(int I, VECTOR & G_I) { - SPAR_MAT * A = NULL; + SPAR_MAT * A = nullptr; diff --git a/lib/atc/LinearSolver.h b/lib/atc/LinearSolver.h index 5f456b9a1d6a8026d0ff903b69f9698be5691dbb..1d429d8816784c96fa3eb0a855ad6d648f944141 100644 --- a/lib/atc/LinearSolver.h +++ b/lib/atc/LinearSolver.h @@ -64,7 +64,7 @@ class LinearSolver { allow_reinitialization must be called before first solve, etc */ void allow_reinitialization(void); // depending on method save a copy of A void set_homogeneous_bcs(void) { homogeneousBCs_ = true;} // for nonlinear solver, solve for increment - void initialize(const BC_SET * bcs = NULL); + void initialize(const BC_SET * bcs = nullptr); /** solve - solves A x = b @@ -80,7 +80,7 @@ class LinearSolver { - returns the e-values & e-vectors for constrained system Ax + v x = 0 - if M is provided the eval problem : ( A + v M ) x = 0 is solved*/ void eigen_system(DENS_MAT & eigenvalues, DENS_MAT & eigenvectors, - const DENS_MAT * M = NULL); + const DENS_MAT * M = nullptr); /** access to penalty coefficient - if a penalty method is not being used this returns zero */ diff --git a/lib/atc/Material.cpp b/lib/atc/Material.cpp index 676a87524f0d2bd5d5140745f2b58d766adde8d8..64673d799347aad335be98def26703436d47efb0 100644 --- a/lib/atc/Material.cpp +++ b/lib/atc/Material.cpp @@ -28,21 +28,21 @@ namespace ATC { Material::Material() : rhoCp_(0), heatCapacity_(0), - electronHeatCapacity_(NULL), + electronHeatCapacity_(nullptr), massDensity_(0), heatConductivity_(0), - electronHeatFlux_(NULL), - stress_(NULL), - viscousStress_(NULL), - bodyForce_(NULL), - electronPhononExchange_(NULL), - electronDragPower_(NULL), - electronFlux_(NULL), + electronHeatFlux_(nullptr), + stress_(nullptr), + viscousStress_(nullptr), + bodyForce_(nullptr), + electronPhononExchange_(nullptr), + electronDragPower_(nullptr), + electronFlux_(nullptr), permittivity_(1.), invEffectiveMass_(1.), electronEquilibriumDensity_(0), electronRecombinationInvTau_(0), - electronChargeDensity_(NULL) + electronChargeDensity_(nullptr) { } //-------------------------------------------------------------- @@ -70,21 +70,21 @@ namespace ATC { : tag_(tag), rhoCp_(0), heatCapacity_(0), - electronHeatCapacity_(NULL), + electronHeatCapacity_(nullptr), massDensity_(0), heatConductivity_(0), - electronHeatFlux_(NULL), - stress_(NULL), - viscousStress_(NULL), - bodyForce_(NULL), - electronPhononExchange_(NULL), - electronDragPower_(NULL), - electronFlux_(NULL), + electronHeatFlux_(nullptr), + stress_(nullptr), + viscousStress_(nullptr), + bodyForce_(nullptr), + electronPhononExchange_(nullptr), + electronDragPower_(nullptr), + electronFlux_(nullptr), permittivity_(1.), invEffectiveMass_(1.), electronEquilibriumDensity_(0), electronRecombinationInvTau_(0), - electronChargeDensity_(NULL) + electronChargeDensity_(nullptr) { /*! \page man_material material \section syntax diff --git a/lib/atc/MoleculeSet.h b/lib/atc/MoleculeSet.h index cffafd950d18189659686b70c5fbd59bd9a74f9f..763f08ef4d163a3f152a42598b27c86d965a5bb0 100644 --- a/lib/atc/MoleculeSet.h +++ b/lib/atc/MoleculeSet.h @@ -33,7 +33,7 @@ namespace ATC { virtual void clear(); /** initialize global data */ - virtual void initialize(std::map * globalAtomsPerMolecule = NULL); + virtual void initialize(std::map * globalAtomsPerMolecule = nullptr); /** reset the number of atoms/molecules on this processor */ void reset_nlocal() {this->set_reset();}; @@ -108,8 +108,8 @@ namespace ATC { public: SmallMoleculeSet(ATC_Method * atc, int groupBit, - PerAtomQuantity * bondList = NULL, - PerAtomQuantity * numBond = NULL); + PerAtomQuantity * bondList = nullptr, + PerAtomQuantity * numBond = nullptr); virtual ~SmallMoleculeSet(); @@ -117,7 +117,7 @@ namespace ATC { virtual void clear(); /** initialize global data */ - virtual void initialize(std::map * globalAtomsPerMolecule = NULL); + virtual void initialize(std::map * globalAtomsPerMolecule = nullptr); /** access molecule atoms by lammps id */ std::set atoms_by_global_molecule(int id) const; diff --git a/lib/atc/NonLinearSolver.h b/lib/atc/NonLinearSolver.h index 010e3ee72e80924861511050dfd238807ed5a037..299408c4c3709b58f6617e82830acca86f08176d 100644 --- a/lib/atc/NonLinearSolver.h +++ b/lib/atc/NonLinearSolver.h @@ -43,7 +43,7 @@ class NonLinearSolver { /** Constructor */ NonLinearSolver( TangentOperator * f, // provides f and f' at x, pointer for polymorphism - const BC_SET * bcs = NULL, + const BC_SET * bcs = nullptr, const int dof = 0, bool parallel = false ); diff --git a/lib/atc/OutputManager.cpp b/lib/atc/OutputManager.cpp index 066c240cabddaf7a0e36e0471f2993b8477259d3..83257a3d21a42b59a0b2663089d37aa2cc00adab 100644 --- a/lib/atc/OutputManager.cpp +++ b/lib/atc/OutputManager.cpp @@ -48,8 +48,8 @@ OutputManager::OutputManager(string outputPrefix, set & otypes) firstStep_(true), firstGlobalsWrite_(true), writeGlobalsHeader_(true), - coordinates_(NULL), - connectivities_(NULL), + coordinates_(nullptr), + connectivities_(nullptr), dataType_(POINT), outputPrefix_(outputPrefix), ensightOutput_(otypes.count(ENSIGHT)), @@ -68,8 +68,8 @@ OutputManager::OutputManager() firstStep_(true), firstGlobalsWrite_(true), writeGlobalsHeader_(true), - coordinates_(NULL), - connectivities_(NULL), + coordinates_(nullptr), + connectivities_(nullptr), dataType_(POINT), outputPrefix_("NULL"), ensightOutput_(true), @@ -132,7 +132,7 @@ void OutputManager::print_custom_names() { // Dump text-based fields to disk for later restart void OutputManager::write_restart_file(string fileName, RESTART_LIST *data) { - FILE * fp=NULL; + FILE * fp=nullptr; fp=fopen(fileName.c_str(),"wb"); // open RESTART_LIST::iterator iter; for (iter = data->begin(); iter != data->end(); iter++) { @@ -153,7 +153,7 @@ void OutputManager::write_restart_file(string fileName, RESTART_LIST *data) void OutputManager::read_restart_file(string fileName, RESTART_LIST *data) { - FILE * fp=NULL; + FILE * fp=nullptr; fp=fopen(fileName.c_str(),"rb"); // open RESTART_LIST::iterator iter; for (iter = data->begin(); iter != data->end(); iter++) { @@ -230,7 +230,7 @@ void OutputManager::write_geometry_ensight(void) string geom_file_name = outputPrefix_ + ".geo"; // open file - FILE * fp=NULL; + FILE * fp=nullptr; char buffer[80]; if ( ! initialized_ ) { fp=fopen(geom_file_name.c_str(),"wb"); // open @@ -240,7 +240,7 @@ void OutputManager::write_geometry_ensight(void) else { fp=fopen(geom_file_name.c_str(),"ab"); // append } - if (fp == NULL) { + if (fp == nullptr) { throw ATC_Error("can not create Ensight geometry file"); } @@ -491,14 +491,14 @@ void OutputManager::write_data_ensight(string field_name, const MATRIX *field_da // open or append data file string data_file_name = filenames[ifile]; - FILE * fp=NULL; + FILE * fp=nullptr; if ( outputTimes_.size() == 1 ) { fp=fopen(data_file_name.c_str(),"wb"); // open } else { fp=fopen(data_file_name.c_str(),"ab"); // append } - if (fp == NULL) { + if (fp == nullptr) { throw ATC_Error("can not create Ensight data file: "+data_file_name); } @@ -799,8 +799,8 @@ void OutputManager::write_dictionary(double /* time */, OUTPUT_LIST *data) string geom_file_name = outputPrefix_ + ".geo"; // open file - FILE * fp=NULL; - if ((fp=fopen(dict_file_name.c_str(),"w")) == NULL) + FILE * fp=nullptr; + if ((fp=fopen(dict_file_name.c_str(),"w")) == nullptr) { throw ATC_Error("can not create Ensight case file"); } diff --git a/lib/atc/OutputManager.h b/lib/atc/OutputManager.h index c5a901e9f450858c6962454bea0a67373086a681..4454d652656724d611ad8fd3c9ddaa00cbb8425d 100644 --- a/lib/atc/OutputManager.h +++ b/lib/atc/OutputManager.h @@ -52,13 +52,13 @@ namespace ATC { coordinates : num _total_ points/nodes X num spatial dim connectivities : num elements X num nodes per element*/ void write_geometry(const MATRIX *coordinates, - const Array2D *connectivity=NULL); + const Array2D *connectivity=nullptr); /** write data from a time step specify node_map to handle periodic soln & data */ - void write_data(double time, OUTPUT_LIST *data, const int *node_map=NULL); + void write_data(double time, OUTPUT_LIST *data, const int *node_map=nullptr); void write_data(double time, FIELDS *soln, OUTPUT_LIST *data, - const int *node_map=NULL); + const int *node_map=nullptr); /** add custom names for any field */ void add_field_names(const std::string& name, const std::vector& list) { diff --git a/lib/atc/PaqAtcUtility.cpp b/lib/atc/PaqAtcUtility.cpp index b6a2ed287177a968d603506c8076c776791d84d0..bdcf26962666c4bc2d4f32e0decf066a7289762e 100644 --- a/lib/atc/PaqAtcUtility.cpp +++ b/lib/atc/PaqAtcUtility.cpp @@ -18,7 +18,7 @@ namespace ATC { AtomType atomType) : atc_(atc), atomType_(atomType), - myNlocal(NULL) + myNlocal(nullptr) { switch (atomType_) { case ALL: diff --git a/lib/atc/ParDenseMatrix.h b/lib/atc/ParDenseMatrix.h index 1c9e75f1711a2e042d894b84b4f878b84a75cabc..873bf0f41069dea013ab665d3244101c37af01df 100644 --- a/lib/atc/ParDenseMatrix.h +++ b/lib/atc/ParDenseMatrix.h @@ -148,7 +148,7 @@ namespace ATC_matrix { #endif // Clear out the local matrix's pointer so we don't double-free - A_local._data = NULL; + A_local._data = nullptr; delete [] majorCounts; delete [] offsets; diff --git a/lib/atc/ParSparseMatrix.cpp b/lib/atc/ParSparseMatrix.cpp index 69ab2453e17a52fb8e11ae1a023c040e8ffddae8..77c8eb33d54ffff16bb2d5b689b3697e7595ea99 100644 --- a/lib/atc/ParSparseMatrix.cpp +++ b/lib/atc/ParSparseMatrix.cpp @@ -233,8 +233,8 @@ DenseMatrix ParSparseMatrix::transMat( SparseMatrix C_local = ((SparseMatrix)A_local) * B; // destroy newA intelligently - A_local._val = NULL; - A_local._ja = NULL; + A_local._val = nullptr; + A_local._ja = nullptr; // Add all the result vectors together on each processor. sumSparse(C_local, C); @@ -285,8 +285,8 @@ void ParSparseMatrix::partition( // Prepare an A_local matrix for deletion after it has been loaded with // data members from another matrix. void ParSparseMatrix::finalize() { - _val = NULL; - _ja = NULL; + _val = nullptr; + _ja = nullptr; } void ParSparseMatrix::operator=(const SparseMatrix &source) diff --git a/lib/atc/ParSparseMatrix.h b/lib/atc/ParSparseMatrix.h index 0985115d07725c4b1fdf8d8f1d7bbb5eb57624cd..b2642e87bee39f41bfe0c8b3463a570e77f82fa7 100644 --- a/lib/atc/ParSparseMatrix.h +++ b/lib/atc/ParSparseMatrix.h @@ -135,9 +135,9 @@ namespace ATC_matrix { Avar.hasTemplate_ = Ap.hasTemplate_; // Avoid catastrophe - Ap._val = NULL; - Ap._ja = NULL; - Ap._ia = NULL; + Ap._val = nullptr; + Ap._ja = nullptr; + Ap._ia = nullptr; } diff --git a/lib/atc/PerAtomQuantity-inl.h b/lib/atc/PerAtomQuantity-inl.h index f95e5d306d19c8f5a91bd569809bb4c786107064..b570e7645b2ca12a715a4479fcee79a8bcb84816 100644 --- a/lib/atc/PerAtomQuantity-inl.h +++ b/lib/atc/PerAtomQuantity-inl.h @@ -24,8 +24,8 @@ namespace ATC { atomType_(atomType), nCols_(nCols), quantityToLammps_(atc_.atc_to_lammps_map()), - lammpsScalar_(NULL), - lammpsVector_(NULL) + lammpsScalar_(nullptr), + lammpsVector_(nullptr) { // do nothing } @@ -452,7 +452,7 @@ namespace ATC { lammpsInterface_(LammpsInterface::instance()), atomType_(atomType), quantityToLammps_(atc_.atc_to_lammps_map()), - lammpsScalar_(NULL) + lammpsScalar_(nullptr) { // do nothing } @@ -610,8 +610,8 @@ namespace ATC { nCols_(nCols), maxEntriesPerRow_(maxEntriesPerRow), quantityToLammps_(atc_.atc_to_lammps_map()), - lammpsVector_(NULL), - lammpsColIndices_(NULL) + lammpsVector_(nullptr), + lammpsColIndices_(nullptr) { // do nothing } diff --git a/lib/atc/PerAtomQuantity.h b/lib/atc/PerAtomQuantity.h index e6cb19981a7e1f34149f83bcf39180700bd588e7..a822b6a9b628dd2e738f3e78c42e1b0e55d1c025 100644 --- a/lib/atc/PerAtomQuantity.h +++ b/lib/atc/PerAtomQuantity.h @@ -441,10 +441,10 @@ namespace ATC { virtual void set_lammps_to_quantity() const {}; /** gets appropriate pointer for lammps data */ - virtual T * lammps_scalar() const {return NULL;}; + virtual T * lammps_scalar() const {return nullptr;}; /** gets appropriate pointer for lammps data */ - virtual T ** lammps_vector() const {return NULL;}; + virtual T ** lammps_vector() const {return nullptr;}; private: @@ -1452,10 +1452,10 @@ namespace ATC { virtual void set_quantity_to_lammps() const {}; /** gets appropriate data for lammps pointer */ - virtual T ** lammps_vector() const {return NULL;}; + virtual T ** lammps_vector() const {return nullptr;}; /** gets appropriate data for lammps pointer to column indices */ - virtual int ** lammps_column_indices() const {return NULL;}; + virtual int ** lammps_column_indices() const {return nullptr;}; private: diff --git a/lib/atc/PerAtomQuantityLibrary.h b/lib/atc/PerAtomQuantityLibrary.h index 0089df7855a178010ed3b52a2ba824dc54b5feeb..3e3cb78e95325e1b4ed660813918189b901cca69 100644 --- a/lib/atc/PerAtomQuantityLibrary.h +++ b/lib/atc/PerAtomQuantityLibrary.h @@ -125,7 +125,7 @@ namespace ATC { // constructor AtomToElementMap(ATC_Method * atc, - PerAtomQuantity * atomPositions = NULL, + PerAtomQuantity * atomPositions = nullptr, AtomType atomType = INTERNAL); // destructor @@ -304,7 +304,7 @@ namespace ATC { // constructor AtomVolumeElement(ATC_Method * atc, - PerAtomQuantity * atomElement = NULL, + PerAtomQuantity * atomElement = nullptr, AtomType atomType = INTERNAL); // destructor @@ -349,7 +349,7 @@ namespace ATC { // constructor AtomVolumeRegion(ATC_Method * atc, - DENS_MAN * atomCoarseGrainingPositions = NULL, + DENS_MAN * atomCoarseGrainingPositions = nullptr, AtomType atomType = INTERNAL); // destructor @@ -422,9 +422,9 @@ namespace ATC { // constructor AtomicMassWeightedDisplacement(ATC_Method * atc, - PerAtomQuantity * atomPositions = NULL, - PerAtomQuantity * atomMasses = NULL, - PerAtomQuantity * atomReferencePositions = NULL, + PerAtomQuantity * atomPositions = nullptr, + PerAtomQuantity * atomMasses = nullptr, + PerAtomQuantity * atomReferencePositions = nullptr, AtomType atomType = INTERNAL); // destructor @@ -462,8 +462,8 @@ namespace ATC { // constructor FluctuatingVelocity(ATC_Method * atc, - PerAtomQuantity * atomVelocities = NULL, - PerAtomQuantity * atomMeanVelocities = NULL, + PerAtomQuantity * atomVelocities = nullptr, + PerAtomQuantity * atomMeanVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -497,8 +497,8 @@ namespace ATC { // constructor ChargeVelocity(ATC_Method * atc, - PerAtomQuantity * fluctuatingVelocities = NULL, - FundamentalAtomQuantity * atomCharges = NULL, + PerAtomQuantity * fluctuatingVelocities = nullptr, + FundamentalAtomQuantity * atomCharges = nullptr, AtomType atomType = INTERNAL); // destructor @@ -532,8 +532,8 @@ namespace ATC { // constructor SpeciesVelocity(ATC_Method * atc, - PerAtomQuantity * fluctuatingVelocities = NULL, - PerAtomQuantity * atomTypeVector = NULL, + PerAtomQuantity * fluctuatingVelocities = nullptr, + PerAtomQuantity * atomTypeVector = nullptr, AtomType atomType = INTERNAL); // destructor @@ -567,8 +567,8 @@ namespace ATC { // constructor AtomicMomentum(ATC_Method * atc, - PerAtomQuantity * atomVelocities = NULL, - PerAtomQuantity * atomMasses = NULL, + PerAtomQuantity * atomVelocities = nullptr, + PerAtomQuantity * atomMasses = nullptr, AtomType atomType = INTERNAL); // destructor @@ -631,8 +631,8 @@ namespace ATC { // constructor TwiceKineticEnergy(ATC_Method * atc, - PerAtomQuantity * atomVelocities = NULL, - PerAtomQuantity * atomMasses = NULL, + PerAtomQuantity * atomVelocities = nullptr, + PerAtomQuantity * atomMasses = nullptr, AtomType atomType = INTERNAL); // destructor @@ -670,8 +670,8 @@ namespace ATC { // constructor KineticTensor(ATC_Method * atc, - PerAtomQuantity * atomVelocities = NULL, - PerAtomQuantity * atomMasses = NULL, + PerAtomQuantity * atomVelocities = nullptr, + PerAtomQuantity * atomMasses = nullptr, AtomType atomType = INTERNAL); // destructor @@ -707,9 +707,9 @@ namespace ATC { // constructor FluctuatingKineticTensor(ATC_Method * atc, - PerAtomQuantity * atomVelocities = NULL, - PerAtomQuantity * atomMasses = NULL, - PerAtomQuantity * atomMeanVelocities = NULL, + PerAtomQuantity * atomVelocities = nullptr, + PerAtomQuantity * atomMasses = nullptr, + PerAtomQuantity * atomMeanVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -747,9 +747,9 @@ namespace ATC { // constructor TwiceFluctuatingKineticEnergy(ATC_Method * atc, - PerAtomQuantity * atomVelocities = NULL, - PerAtomQuantity * atomMasses = NULL, - PerAtomQuantity * atomMeanVelocities = NULL, + PerAtomQuantity * atomVelocities = nullptr, + PerAtomQuantity * atomMasses = nullptr, + PerAtomQuantity * atomMeanVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -793,8 +793,8 @@ namespace ATC { MixedKePeEnergy(ATC_Method * atc, double keMultiplier, double peMultiplier, - PerAtomQuantity * twiceKineticEnergy = NULL, - PerAtomQuantity * potentialEnergy = NULL, + PerAtomQuantity * twiceKineticEnergy = nullptr, + PerAtomQuantity * potentialEnergy = nullptr, AtomType atomType = INTERNAL); // destructor @@ -838,8 +838,8 @@ namespace ATC { // constructor TotalEnergy(ATC_Method * atc, - PerAtomQuantity * twiceKineticEnergy = NULL, - PerAtomQuantity * potentialEnergy = NULL, + PerAtomQuantity * twiceKineticEnergy = nullptr, + PerAtomQuantity * potentialEnergy = nullptr, AtomType atomType = INTERNAL); // destructor @@ -871,8 +871,8 @@ namespace ATC { // constructor FluctuatingPotentialEnergy(ATC_Method * atc, - PerAtomQuantity * potentialEnergy = NULL, - PerAtomQuantity * referencePotential = NULL, + PerAtomQuantity * potentialEnergy = nullptr, + PerAtomQuantity * referencePotential = nullptr, AtomType atomType = INTERNAL); // destructor @@ -911,8 +911,8 @@ namespace ATC { // constructor DotTwiceKineticEnergy(ATC_Method * atc, - PerAtomQuantity * atomForces = NULL, - PerAtomQuantity * atomVelocities = NULL, + PerAtomQuantity * atomForces = nullptr, + PerAtomQuantity * atomVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -948,7 +948,7 @@ namespace ATC { // constructor VelocitySquared(ATC_Method *atc, - PerAtomQuantity * atomVelocities = NULL, + PerAtomQuantity * atomVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -981,9 +981,9 @@ namespace ATC { // constructor LambdaSquared(ATC_Method *atc, - PerAtomQuantity * atomMasses = NULL, - PerAtomQuantity * atomVelocitiesSquared = NULL, - PerAtomQuantity * atomLambdas = NULL, + PerAtomQuantity * atomMasses = nullptr, + PerAtomQuantity * atomVelocitiesSquared = nullptr, + PerAtomQuantity * atomLambdas = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1149,7 +1149,7 @@ namespace ATC { // constructor AtomToNodeset(ATC_Method * atc, SetDependencyManager * subsetNodes, - PerAtomQuantity * atomElement = NULL, + PerAtomQuantity * atomElement = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1194,7 +1194,7 @@ namespace ATC { // constructor AtomToElementset(ATC_Method * atc, MatrixDependencyManager * elementMask, - PerAtomQuantity * atomElement = NULL, + PerAtomQuantity * atomElement = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1273,7 +1273,7 @@ namespace ATC { // constructor VelocitySquaredMapped(ATC_Method *atc, MatrixDependencyManager * atomMap, - PerAtomQuantity * atomVelocities = NULL, + PerAtomQuantity * atomVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1307,9 +1307,9 @@ namespace ATC { // constructor LambdaSquaredMapped(ATC_Method *atc, MatrixDependencyManager * atomMap, - PerAtomQuantity * atomMasses = NULL, - PerAtomQuantity * atomVelocitiesSquared = NULL, - PerAtomQuantity * atomLambdas = NULL, + PerAtomQuantity * atomMasses = nullptr, + PerAtomQuantity * atomVelocitiesSquared = nullptr, + PerAtomQuantity * atomLambdas = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1371,7 +1371,7 @@ namespace ATC { // constructor AtomicVelocityRescaleFactor(ATC_Method * atc, - PerAtomQuantity * atomLambdas = NULL, + PerAtomQuantity * atomLambdas = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1403,8 +1403,8 @@ namespace ATC { // constructor AtomicFluctuatingVelocityRescaled(ATC_Method * atc, - PerAtomQuantity * atomRescaleFactor = NULL, - PerAtomQuantity * atomFluctuatingVelocity = NULL, + PerAtomQuantity * atomRescaleFactor = nullptr, + PerAtomQuantity * atomFluctuatingVelocity = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1439,10 +1439,10 @@ namespace ATC { // constructor AtomicCombinedRescaleThermostatError(ATC_Method * atc, - PerAtomQuantity * atomFluctuatingMomentumRescaled = NULL, - PerAtomQuantity * atomMeanVelocity = NULL, - PerAtomQuantity * atomStreamingVelocity = NULL, - PerAtomQuantity * atomMass = NULL, + PerAtomQuantity * atomFluctuatingMomentumRescaled = nullptr, + PerAtomQuantity * atomMeanVelocity = nullptr, + PerAtomQuantity * atomStreamingVelocity = nullptr, + PerAtomQuantity * atomMass = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1483,8 +1483,8 @@ namespace ATC { // constructor AtomicThermostatForce(ATC_Method * atc, - PerAtomQuantity * atomLambdas = NULL, - PerAtomQuantity * atomVelocities = NULL, + PerAtomQuantity * atomLambdas = nullptr, + PerAtomQuantity * atomVelocities = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1519,8 +1519,8 @@ namespace ATC { // constructor AtomicKinetostatForceDisplacement(ATC_Method * atc, - PerAtomQuantity * atomLambda = NULL, - PerAtomQuantity * atomMass = NULL, + PerAtomQuantity * atomLambda = nullptr, + PerAtomQuantity * atomMass = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1558,8 +1558,8 @@ namespace ATC { // constructor AtomicKinetostatForceVelocity(ATC_Method * atc, - PerAtomQuantity * atomLambda = NULL, - PerAtomQuantity * atomMass = NULL, + PerAtomQuantity * atomLambda = nullptr, + PerAtomQuantity * atomMass = nullptr, AtomType atomType = INTERNAL) : AtomicKinetostatForceDisplacement(atc,atomLambda,atomMass,atomType) {}; @@ -1589,7 +1589,7 @@ namespace ATC { // constructor AtomicKinetostatForceStress(ATC_Method * atc, - PerAtomQuantity * atomLambda = NULL, + PerAtomQuantity * atomLambda = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1621,7 +1621,7 @@ namespace ATC { // constructor PerAtomKernelFunction(ATC_Method * atc, - PerAtomQuantity * atomPositions = NULL, + PerAtomQuantity * atomPositions = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1656,8 +1656,8 @@ namespace ATC { // constructor PerAtomShapeFunction(ATC_Method * atc, - PerAtomQuantity * atomPositions = NULL, - PerAtomQuantity * atomElements = NULL, + PerAtomQuantity * atomPositions = nullptr, + PerAtomQuantity * atomElements = nullptr, AtomType atomType = INTERNAL); // destructor @@ -1695,8 +1695,8 @@ namespace ATC { // constructor LambdaCouplingMatrix(ATC_Method * atc, - MatrixDependencyManager * nodeToOverlapMap = NULL, - SPAR_MAN * shapeFunction = NULL); + MatrixDependencyManager * nodeToOverlapMap = nullptr, + SPAR_MAN * shapeFunction = nullptr); // destructor virtual ~LambdaCouplingMatrix() { @@ -1734,9 +1734,9 @@ namespace ATC { // constructor LocalLambdaCouplingMatrix(ATC_Method * atc, - MatrixDependencyManager * lambdaAtomMap = NULL, - MatrixDependencyManager * nodeToOverlapMap = NULL, - SPAR_MAN * shapeFunction = NULL); + MatrixDependencyManager * lambdaAtomMap = nullptr, + MatrixDependencyManager * nodeToOverlapMap = nullptr, + SPAR_MAN * shapeFunction = nullptr); // destructor virtual ~LocalLambdaCouplingMatrix() { @@ -1771,7 +1771,7 @@ namespace ATC { GhostCouplingMatrix(ATC_Method * atc, SPAR_MAN * shapeFunction, SetDependencyManager * subsetNodes, - MatrixDependencyManager * nodeToOverlapMap = NULL); + MatrixDependencyManager * nodeToOverlapMap = nullptr); // destructor virtual ~GhostCouplingMatrix() { diff --git a/lib/atc/PerPairQuantity.cpp b/lib/atc/PerPairQuantity.cpp index 3632a87aa93c3d043fab5e86888f930e1f21fe2a..01308e4b395d63cfe495f2b1ae02cf9b3893889f 100644 --- a/lib/atc/PerPairQuantity.cpp +++ b/lib/atc/PerPairQuantity.cpp @@ -272,7 +272,7 @@ BondMatrixKernel::BondMatrixKernel(LammpsInterface * lammpsInterface, BondMatrix(lammpsInterface,pairMap,x,feMesh), kernelFunction_(kernelFunction) { - if (kernelFunction_ == NULL) + if (kernelFunction_ == nullptr) throw ATC_Error("No AtC kernel function initialized"); }; void BondMatrixKernel::reset(void) const diff --git a/lib/atc/PhysicsModel.h b/lib/atc/PhysicsModel.h index 50b327ce0b64b18bfe9adcca27402c8861500bdf..8479727a89bf96ac90af2326c1813fa2fd9516c6 100644 --- a/lib/atc/PhysicsModel.h +++ b/lib/atc/PhysicsModel.h @@ -105,7 +105,7 @@ namespace ATC const WeakEquation * weak_equation(FieldName field) const { std::map::const_iterator itr = weakEqns_.find(field); - if (itr == weakEqns_.end()) return NULL; + if (itr == weakEqns_.end()) return nullptr; return (weakEqns_.find(field))->second; } diff --git a/lib/atc/PoissonSolver.cpp b/lib/atc/PoissonSolver.cpp index 86670ae218ed507e5a6ec5d4281e2cbca9699925..52909fc454c296f916b7f92532b0a292c5f98b4a 100644 --- a/lib/atc/PoissonSolver.cpp +++ b/lib/atc/PoissonSolver.cpp @@ -33,9 +33,9 @@ PoissonSolver::PoissonSolver( fieldName_(fieldName), rhsMask_(rhsMask), linear_(false), - solver_(NULL), - solverNL_(NULL), - tangent_(NULL), + solver_(nullptr), + solverNL_(nullptr), + tangent_(nullptr), solverType_(solverType), solverTol_(0), solverMaxIter_(0), diff --git a/lib/atc/PrescribedDataManager.cpp b/lib/atc/PrescribedDataManager.cpp index bd649c8ace07621d9192d0cae3faaa4c5b39df45..947191a0e4f204b22d2fdb716bfa230ad6c11cfc 100644 --- a/lib/atc/PrescribedDataManager.cpp +++ b/lib/atc/PrescribedDataManager.cpp @@ -34,8 +34,8 @@ namespace ATC { bcs_[thisField].reset(nNodes_,thisSize); for (int inode = 0; inode < nNodes_ ; ++inode) { for (int idof = 0; idof < thisSize ; ++idof) { - ics_[thisField](inode,idof) = NULL; - bcs_[thisField](inode,idof) = NULL; + ics_[thisField](inode,idof) = nullptr; + bcs_[thisField](inode,idof) = nullptr; } } // compact inode, value lists @@ -44,7 +44,7 @@ namespace ATC { elementSources_[thisField].reset(nElems_,thisSize); for (int ielem = 0; ielem < nElems_ ; ++ielem) { for (int idof = 0; idof < thisSize ; ++idof) { - elementSources_[thisField](ielem,idof) = NULL; + elementSources_[thisField](ielem,idof) = nullptr; } } // node based sources @@ -76,8 +76,8 @@ namespace ATC { bcs_[fieldName].reset(nNodes_,size); for (int inode = 0; inode < nNodes_ ; ++inode) { for (int idof = 0; idof < size ; ++idof) { - ics_[fieldName](inode,idof) = NULL; - bcs_[fieldName](inode,idof) = NULL; + ics_[fieldName](inode,idof) = nullptr; + bcs_[fieldName](inode,idof) = nullptr; } } @@ -85,7 +85,7 @@ namespace ATC { elementSources_[fieldName].reset(nElems_,size); for (int ielem = 0; ielem < nElems_ ; ++ielem) { for (int idof = 0; idof < size ; ++idof) { - elementSources_[fieldName](ielem,idof) = NULL; + elementSources_[fieldName](ielem,idof) = nullptr; } } } @@ -159,7 +159,7 @@ namespace ATC { set::const_iterator iset; for (iset = nodeSet.begin(); iset != nodeSet.end(); iset++) { int inode = *iset; - bcs_[thisField](inode,thisIndex) = NULL; + bcs_[thisField](inode,thisIndex) = nullptr; } } @@ -182,7 +182,7 @@ namespace ATC { const FieldName thisField, const int thisIndex) { - bcs_[thisField](nodeId,thisIndex) = NULL; + bcs_[thisField](nodeId,thisIndex) = nullptr; } //------------------------------------------------------------------------- // fix_flux @@ -203,7 +203,7 @@ namespace ATC { if (dof.size() == 0) { int ndof = (fieldSizes_.find(thisField))->second; dof.reset(ndof); - for(int i = 0; i < ndof; i++) dof(i) = NULL; + for(int i = 0; i < ndof; i++) dof(i) = nullptr; } dof(thisIndex) = (XT_Function*) f; } @@ -222,7 +222,7 @@ namespace ATC { for (iset = fset->begin(); iset != fset->end(); iset++) { pair face = *iset; Array < XT_Function * > & dof = faceSources_[thisField][face]; - dof(thisIndex) = NULL; + dof(thisIndex) = nullptr; } } //------------------------------------------------------------------------- @@ -244,7 +244,7 @@ namespace ATC { if (dof.size() == 0) { int ndof = (fieldSizes_.find(thisField))->second; dof.reset(ndof); - for(int i = 0; i < ndof; i++) dof(i) = NULL; + for(int i = 0; i < ndof; i++) dof(i) = nullptr; } dof(thisIndex) = (UXT_Function*) f; } @@ -263,7 +263,7 @@ namespace ATC { for (iset = fset->begin(); iset != fset->end(); iset++) { pair face = *iset; Array < UXT_Function * > & dof = faceSourcesRobin_[thisField][face]; - dof(thisIndex) = NULL; + dof(thisIndex) = nullptr; } } //------------------------------------------------------------------------- @@ -342,7 +342,7 @@ namespace ATC { set::const_iterator iset; for (iset = elemSet.begin(); iset != elemSet.end(); iset++) { int ielem = *iset; - elementSources_[thisField](ielem,thisIndex) = NULL; + elementSources_[thisField](ielem,thisIndex) = nullptr; } } //------------------------------------------------------------------------- diff --git a/lib/atc/Quadrature.cpp b/lib/atc/Quadrature.cpp index 8efe0e29698239dc895ef19dcfe524934ccdf6bb..94fe4a701cbe966042c6256d45b4aee381146fae 100644 --- a/lib/atc/Quadrature.cpp +++ b/lib/atc/Quadrature.cpp @@ -5,14 +5,14 @@ using namespace std; namespace ATC { -Quadrature * Quadrature::myInstance_ = NULL; +Quadrature * Quadrature::myInstance_ = nullptr; // ----------------------------------------------------------------- // instance() // ----------------------------------------------------------------- Quadrature * Quadrature::instance() { - if (myInstance_ == NULL) { + if (myInstance_ == nullptr) { myInstance_ = new Quadrature(); } return myInstance_; @@ -24,7 +24,7 @@ Quadrature * Quadrature::instance() void Quadrature::Destroy() { if (myInstance_) delete myInstance_; - myInstance_ = NULL; + myInstance_ = nullptr; } diff --git a/lib/atc/SchrodingerSolver.cpp b/lib/atc/SchrodingerSolver.cpp index d79fa85595427a39a536a96b14995f057a0f7920..3819562a7004d7d2657132369e0ad1de88ca143f 100644 --- a/lib/atc/SchrodingerSolver.cpp +++ b/lib/atc/SchrodingerSolver.cpp @@ -646,7 +646,7 @@ double fermi_dirac(const double E, const double T) double mu, double D ) : SliceSchrodingerPoissonSolver(atc,schrodingerSolver,poissonSolver,physicsModel,maxConsistencyIter,maxConstraintIter,oneDconserve,0,0), - solver_(NULL), + solver_(nullptr), mobility_(mu),diffusivity_(D) { Ef0_ = Ef0; diff --git a/lib/atc/SparseMatrix-inl.h b/lib/atc/SparseMatrix-inl.h index 36867ad8dee572c846d5c36ead8477dbc18ee283..2923d6daa570199be94ef3c8365cfe7eedd3f819 100644 --- a/lib/atc/SparseMatrix-inl.h +++ b/lib/atc/SparseMatrix-inl.h @@ -17,14 +17,14 @@ TRI_COORD::TRI_COORD(INDEX row, INDEX col, T val, bool add_to) //----------------------------------------------------------------------------- template SparseMatrix::SparseMatrix(INDEX rows, INDEX cols) - : _val(NULL), _ia(NULL), _ja(NULL), _size(0), _nRowsCRS(0), hasTemplate_(false), + : _val(nullptr), _ia(nullptr), _ja(nullptr), _size(0), _nRowsCRS(0), hasTemplate_(false), _nRows(rows),_nCols(cols) {} //----------------------------------------------------------------------------- // copy constructor //----------------------------------------------------------------------------- template SparseMatrix::SparseMatrix(const SparseMatrix& C) - : Matrix(), _val(NULL), _ia(NULL), _ja(NULL), hasTemplate_(false) + : Matrix(), _val(nullptr), _ia(nullptr), _ja(nullptr), hasTemplate_(false) { _copy(C); } @@ -33,7 +33,7 @@ SparseMatrix::SparseMatrix(const SparseMatrix& C) //----------------------------------------------------------------------------- template SparseMatrix::SparseMatrix(const DenseMatrix& C) -: Matrix(), _val(NULL), _ia(NULL), _ja(NULL), hasTemplate_(false) +: Matrix(), _val(nullptr), _ia(nullptr), _ja(nullptr), hasTemplate_(false) { reset(C); } @@ -67,9 +67,9 @@ void SparseMatrix::_create(INDEX size, INDEX nrows) // assign memory to hold matrix try { - _val = (_size && nrows) ? new T [_size] : NULL; - _ia = (_size && nrows) ? new INDEX [_nRowsCRS+1] : NULL; - _ja = (_size && nrows) ? new INDEX [_size] : NULL; + _val = (_size && nrows) ? new T [_size] : nullptr; + _ia = (_size && nrows) ? new INDEX [_nRowsCRS+1] : nullptr; + _ja = (_size && nrows) ? new INDEX [_size] : nullptr; } catch (std::exception &e) { @@ -94,8 +94,8 @@ void SparseMatrix::_delete() if (_ia) delete [] _ia; if (_ja) delete [] _ja; _size = _nRowsCRS = 0; - _val = NULL; - _ia = _ja = NULL; + _val = nullptr; + _ia = _ja = nullptr; } //----------------------------------------------------------------------------- // full memory copy of C into this diff --git a/lib/atc/SparseVector.h b/lib/atc/SparseVector.h index 5cb16af5275b5f5da0824763ae9e58cd080d6d04..d387b45b6695152d2bc72c0b263b4ab79715f4bc 100644 --- a/lib/atc/SparseVector.h +++ b/lib/atc/SparseVector.h @@ -88,7 +88,7 @@ protected: //@{ SparseVector(const Matrix &c); SparseVector& operator=(Matrix &c); - T* ptr() const {return NULL; } + T* ptr() const {return nullptr; } //@} STORE data_; //*> sparse data structure diff --git a/lib/atc/SpeciesTimeIntegrator.cpp b/lib/atc/SpeciesTimeIntegrator.cpp index 3a196e745af207b4de1cade45e16a803154c9f6f..3215b159f8ef6ac333d5b519740a09dba8e8135d 100644 --- a/lib/atc/SpeciesTimeIntegrator.cpp +++ b/lib/atc/SpeciesTimeIntegrator.cpp @@ -108,9 +108,9 @@ namespace ATC { timeFilter_(speciesTimeIntegrator->time_filter()), massDensity_(atc_->field(MASS_DENSITY)), nodalAtomicMassDensityOut_(atc_->nodal_atomic_field(MASS_DENSITY)), - nodalAtomicMassDensity_(NULL), + nodalAtomicMassDensity_(nullptr), speciesConcentration_(atc_->field(SPECIES_CONCENTRATION)), - nodalAtomicSpeciesConcentration_(NULL), + nodalAtomicSpeciesConcentration_(nullptr), nodalAtomicSpeciesConcentrationFiltered_(speciesTimeIntegrator->nodal_atomic_species_concentration_filtered()), moleculeIds_(moleculeIds) { diff --git a/lib/atc/SpeciesTimeIntegrator.h b/lib/atc/SpeciesTimeIntegrator.h index c8fbe97c5e83b90b72267e0ee3f1efe2418b0a36..64cc07022cf4705dcd5bb186bf41ee1731bd027f 100644 --- a/lib/atc/SpeciesTimeIntegrator.h +++ b/lib/atc/SpeciesTimeIntegrator.h @@ -71,7 +71,7 @@ namespace ATC { const std::map > & moleculeIds); // destructor - virtual ~SpeciesIntegrationMethod() {nodalAtomicMassDensity_=NULL;}; + virtual ~SpeciesIntegrationMethod() {nodalAtomicMassDensity_=nullptr;}; /** create and get necessary transfer operators */ virtual void construct_transfers(); diff --git a/lib/atc/Stress.cpp b/lib/atc/Stress.cpp index 72656c21edbe6c4af0447be6079288e6b5d9d845..a1445bd8ea0a8bc04a6eaada9297abefd4f0d604 100644 --- a/lib/atc/Stress.cpp +++ b/lib/atc/Stress.cpp @@ -299,10 +299,10 @@ void StressCubicElasticDamped::stress(const FIELD_MATS &fields, // cauchy born model //============================================================================== StressCauchyBorn::StressCauchyBorn(fstream &fileId, CbData &cb) - : cblattice_(NULL), - potential_(NULL), + : cblattice_(nullptr), + potential_(nullptr), makeLinear_(false), - cubicMat_(NULL), + cubicMat_(nullptr), initialized_(false), fixed_temperature_(0.), cbdata_(cb) diff --git a/lib/atc/Stress.h b/lib/atc/Stress.h index 513cdb2d973ceaf0b629f83742bcdda170b0529d..5a7c9e30a3ecc012d73e77bf8111ee6af1bc5215 100644 --- a/lib/atc/Stress.h +++ b/lib/atc/Stress.h @@ -149,7 +149,7 @@ namespace ATC { DENS_VEC elasticity_tensor(const VECTOR &Fv, MATRIX &C, const ElasticityTensorType type=FIRST_ELASTICITY_TENSOR) const; DENS_VEC elasticity_tensor(const MATRIX &F, MATRIX &C, const ElasticityTensorType type=FIRST_ELASTICITY_TENSOR) const; protected: - void linearize(MATRIX *F=NULL); + void linearize(MATRIX *F=nullptr); CBLattice *cblattice_; //*> CbLattice -> makes atom clusters. CbPotential *potential_; //*> CbPotential -> interatomic forces. bool makeLinear_; diff --git a/lib/atc/ThermalTimeIntegrator.cpp b/lib/atc/ThermalTimeIntegrator.cpp index e74d46a20c5bf0348ac37cc26e4b13eb3abb2214..8c0b8d6dae169b5bfe54f2fa8a973b10295a51b0 100644 --- a/lib/atc/ThermalTimeIntegrator.cpp +++ b/lib/atc/ThermalTimeIntegrator.cpp @@ -150,7 +150,7 @@ namespace ATC { temperatureRoc_(atc_->field_roc(TEMPERATURE)), temperature2Roc_(atc_->field_2roc(TEMPERATURE)), nodalAtomicTemperatureOut_(atc_->nodal_atomic_field(TEMPERATURE)), - nodalAtomicTemperature_(NULL), + nodalAtomicTemperature_(nullptr), temperatureRhs_(atc_->field_rhs(TEMPERATURE)), nodalAtomicPowerOut_(atc_->nodal_atomic_field_roc(TEMPERATURE)) { @@ -384,7 +384,7 @@ namespace ATC { nodalAtomicEnergyFiltered_(thermalTimeIntegrator->nodal_atomic_energy_filtered()), nodalAtomicPowerFiltered_(thermalTimeIntegrator->nodal_atomic_power_filtered()), atomicTemperatureDelta_(atc_->num_nodes(),1), - nodalAtomicEnergy_(NULL), + nodalAtomicEnergy_(nullptr), nodalAtomicEnergyOld_(atc_->num_nodes(),1), nodalAtomicTemperatureOld_(atc_->num_nodes(),1) { diff --git a/lib/atc/Thermostat.cpp b/lib/atc/Thermostat.cpp index a602105854162d8e0919c766238cb23e081cbb1b..217f2394e272f0ee876e6e8d37835d4b28ebf6ee 100644 --- a/lib/atc/Thermostat.cpp +++ b/lib/atc/Thermostat.cpp @@ -367,7 +367,7 @@ namespace ATC { const string & regulatorPrefix) : RegulatorShapeFunction(thermostat,regulatorPrefix), mdMassMatrix_(atc_->set_mass_mat_md(TEMPERATURE)), - atomVelocities_(NULL) + atomVelocities_(nullptr) { fieldMask_(TEMPERATURE,FLUX) = true; lambda_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaEnergy",1); // data associated with stage 3 in ATC_Method::initialize @@ -425,7 +425,7 @@ namespace ATC { ThermostatRescale::ThermostatRescale(AtomicRegulator * thermostat) : ThermostatShapeFunction(thermostat), nodalTemperature_(atc_->field(TEMPERATURE)), - atomVelocityRescalings_(NULL) + atomVelocityRescalings_(nullptr) { // do nothing } @@ -535,7 +535,7 @@ namespace ATC { //-------------------------------------------------------- ThermostatRescaleMixedKePe::ThermostatRescaleMixedKePe(AtomicRegulator * thermostat) : ThermostatRescale(thermostat), - nodalAtomicFluctuatingPotentialEnergy_(NULL) + nodalAtomicFluctuatingPotentialEnergy_(nullptr) { // do nothing } @@ -607,7 +607,7 @@ namespace ATC { const string & regulatorPrefix) : RegulatorShapeFunction(thermostat,regulatorPrefix), lambdaMaxIterations_(lambdaMaxIterations), - rhsLambdaSquared_(NULL), + rhsLambdaSquared_(nullptr), dtFactor_(1.) { fieldMask_(TEMPERATURE,FLUX) = true; @@ -741,21 +741,21 @@ namespace ATC { int /* lambdaMaxIterations */, const string & regulatorPrefix) : RegulatorMethod(thermostat,regulatorPrefix), - lambdaSolver_(NULL), + lambdaSolver_(nullptr), mdMassMatrix_(atc_->set_mass_mat_md(TEMPERATURE)), - atomVelocities_(NULL), + atomVelocities_(nullptr), temperature_(atc_->field(TEMPERATURE)), timeFilter_(atomicRegulator_->time_filter()), - nodalAtomicLambdaPower_(NULL), - lambdaPowerFiltered_(NULL), - atomLambdas_(NULL), - atomThermostatForces_(NULL), - atomMasses_(NULL), + nodalAtomicLambdaPower_(nullptr), + lambdaPowerFiltered_(nullptr), + atomLambdas_(nullptr), + atomThermostatForces_(nullptr), + atomMasses_(nullptr), isFirstTimestep_(true), - nodalAtomicEnergy_(NULL), - atomPredictedVelocities_(NULL), - nodalAtomicPredictedEnergy_(NULL), - firstHalfAtomForces_(NULL) + nodalAtomicEnergy_(nullptr), + atomPredictedVelocities_(nullptr), + nodalAtomicPredictedEnergy_(nullptr), + firstHalfAtomForces_(nullptr) { // construct/obtain data corresponding to stage 3 of ATC_Method::initialize nodalAtomicLambdaPower_ = thermostat->regulator_data(regulatorPrefix_+"NodalAtomicLambdaPower",1); @@ -1389,7 +1389,7 @@ namespace ATC { int lambdaMaxIterations, const string & regulatorPrefix) : ThermostatGlcFs(thermostat,lambdaMaxIterations,regulatorPrefix), - atomThermostatForcesPredVel_(NULL), + atomThermostatForcesPredVel_(nullptr), filterCoefficient_(1.) { lambdaSolver_ = new ThermostatSolverFixed(thermostat, @@ -1887,9 +1887,9 @@ namespace ATC { int lambdaMaxIterations, bool constructThermostats) : RegulatorMethod(thermostat), - thermostatFlux_(NULL), - thermostatFixed_(NULL), - thermostatBcs_(NULL) + thermostatFlux_(nullptr), + thermostatFixed_(nullptr), + thermostatBcs_(nullptr) { if (constructThermostats) { thermostatFlux_ = new ThermostatIntegratorFlux(thermostat,lambdaMaxIterations,regulatorPrefix_+"Flux"); @@ -2022,10 +2022,10 @@ namespace ATC { ThermostatGlc::ThermostatGlc(AtomicRegulator * thermostat) : ThermostatShapeFunction(thermostat), timeFilter_(atomicRegulator_->time_filter()), - lambdaPowerFiltered_(NULL), - atomThermostatForces_(NULL), + lambdaPowerFiltered_(nullptr), + atomThermostatForces_(nullptr), prescribedDataMgr_(atc_->prescribed_data_manager()), - atomMasses_(NULL) + atomMasses_(nullptr) { // consistent with stage 3 of ATC_Method::initialize lambdaPowerFiltered_= atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaPowerFiltered",1); @@ -2080,8 +2080,8 @@ namespace ATC { ThermostatGlc(thermostat), nodalTemperatureRoc_(atc_->field_roc(TEMPERATURE)), heatSource_(atc_->atomic_source(TEMPERATURE)), - nodalAtomicPower_(NULL), - nodalAtomicLambdaPower_(NULL) + nodalAtomicPower_(nullptr), + nodalAtomicLambdaPower_(nullptr) { // do nothing } @@ -2287,8 +2287,8 @@ namespace ATC { //-------------------------------------------------------- ThermostatHooverVerlet::ThermostatHooverVerlet(AtomicRegulator * thermostat) : ThermostatPowerVerlet(thermostat), - lambdaHoover_(NULL), - nodalAtomicHooverLambdaPower_(NULL) + lambdaHoover_(nullptr), + nodalAtomicHooverLambdaPower_(nullptr) { // set up data consistent with stage 3 of ATC_Method::initialize lambdaHoover_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaHoover",1); @@ -2505,8 +2505,8 @@ namespace ATC { //-------------------------------------------------------- ThermostatHooverVerletFiltered::ThermostatHooverVerletFiltered(AtomicRegulator * thermostat) : ThermostatPowerVerletFiltered(thermostat), - lambdaHoover_(NULL), - nodalAtomicHooverLambdaPower_(NULL) + lambdaHoover_(nullptr), + nodalAtomicHooverLambdaPower_(nullptr) { // consistent with stage 3 of ATC_Method::initialize lambdaHoover_ = atomicRegulator_->regulator_data("LambdaHoover",1); diff --git a/lib/atc/TimeFilter.cpp b/lib/atc/TimeFilter.cpp index 08cb64c8fe9310ed9ab9e7d1c9664ad9c2332910..ece3429c86c2683e42ac37f9685b9eff3608bbf1 100644 --- a/lib/atc/TimeFilter.cpp +++ b/lib/atc/TimeFilter.cpp @@ -210,7 +210,7 @@ namespace ATC { } else if (filterType_ == STEP_FILTER) { newTimeFilter = new TimeFilterStep(*this); - } else newTimeFilter = NULL; + } else newTimeFilter = nullptr; } else { // default to return base class newTimeFilter = new TimeFilter(*this); diff --git a/lib/atc/TimeIntegrator.cpp b/lib/atc/TimeIntegrator.cpp index 4e8dec8c6299f256e0a85a6f121aefc4e1bbb1db..f370d17170e38d701184640aab9e1878c225d639 100644 --- a/lib/atc/TimeIntegrator.cpp +++ b/lib/atc/TimeIntegrator.cpp @@ -17,10 +17,10 @@ namespace ATC { AtomTimeIntegratorType::AtomTimeIntegratorType(ATC_Method * atc, AtomType atomType) : atc_(atc), atomType_(atomType), - mass_(NULL), - position_(NULL), - velocity_(NULL), - force_(NULL) + mass_(nullptr), + position_(nullptr), + velocity_(nullptr), + force_(nullptr) { // do nothing } @@ -90,9 +90,9 @@ namespace ATC { //-------------------------------------------------------- TimeIntegrator::TimeIntegrator(ATC_Coupling * atc, TimeIntegrationType timeIntegrationType) : - timeIntegrationMethod_(NULL), + timeIntegrationMethod_(nullptr), atc_(atc), - timeFilter_(NULL), + timeFilter_(nullptr), timeFilterManager_(atc_->time_filter_manager()), timeIntegrationType_(timeIntegrationType), needReset_(true) diff --git a/lib/atc/TransferLibrary.cpp b/lib/atc/TransferLibrary.cpp index d0db0076d77b4581521dcc3f9463450f8e34cdb1..b77a91fd2e9d72198cba87e31cd8e516a3bb8116 100644 --- a/lib/atc/TransferLibrary.cpp +++ b/lib/atc/TransferLibrary.cpp @@ -816,7 +816,7 @@ namespace ATC { for (unsigned i = 0; i < quantity_.size(); ++i) { if (quantity_[i]) delete quantity_[i]; } - quantity_.resize(source.size(),NULL); + quantity_.resize(source.size(),nullptr); for (unsigned i = 0; i < source.size(); i++) { quantity_[i] = new SPAR_MAT(map_->size(),source[i]->nCols()); } @@ -1363,7 +1363,7 @@ namespace ATC { { pointToElementMap_->register_dependence(this); pointPositions_->register_dependence(this); - quantity_.resize(atc->nsd(),NULL); + quantity_.resize(atc->nsd(),nullptr); for (int i = 0; i < atc->nsd(); ++i) { quantity_[i] = new SPAR_MAT(); } @@ -1428,7 +1428,7 @@ namespace ATC { atomPositions_->register_dependence(this); // storage container - matrices_.resize(atc->nsd(),NULL); + matrices_.resize(atc->nsd(),nullptr); for (int i = 0; i < atc->nsd(); ++i) { matrices_[i] = new AtcAtomSparseMatrix(atc,feEngine_->num_nodes(), feEngine_->num_nodes_per_element(), @@ -1440,7 +1440,7 @@ namespace ATC { matrices_[i]->register_dependence(this); } - quantity_.resize(atc->nsd(),NULL); + quantity_.resize(atc->nsd(),nullptr); } //-------------------------------------------------------- @@ -1926,7 +1926,7 @@ namespace ATC { VectorTransfer(), feEngine_(atc->fe_engine()) { - quantity_.resize(atc->nsd(),NULL); + quantity_.resize(atc->nsd(),nullptr); for (int i = 0; i < atc->nsd(); ++i) { quantity_[i] = new SPAR_MAT(); } diff --git a/lib/atc/TransferLibrary.h b/lib/atc/TransferLibrary.h index 3a0f420f37069b079ac5a1d1962d807df91deee2..d1f27e5e6d7ce1af04785173b49c82db2245a50c 100644 --- a/lib/atc/TransferLibrary.h +++ b/lib/atc/TransferLibrary.h @@ -115,7 +115,7 @@ namespace ATC { // constructor NodalAtomVolumeElement(ATC_Method * atc, SPAR_MAN * shapeFunction, - PerAtomQuantity * atomElement=NULL); + PerAtomQuantity * atomElement=nullptr); // destructor virtual ~NodalAtomVolumeElement() { @@ -173,7 +173,7 @@ namespace ATC { // constructor AtomTypeElement(ATC_Coupling * atc, - PerAtomQuantity * atomElement = NULL); + PerAtomQuantity * atomElement = nullptr); // destructor virtual ~AtomTypeElement() { @@ -211,8 +211,8 @@ namespace ATC { // constructor ElementMask(ATC_Coupling * atc, - MatrixDependencyManager * hasInternal = NULL, - MatrixDependencyManager * hasGhost = NULL); + MatrixDependencyManager * hasInternal = nullptr, + MatrixDependencyManager * hasGhost = nullptr); // destructor virtual ~ElementMask() { @@ -251,7 +251,7 @@ namespace ATC { // constructor AtomElementMask(ATC_Coupling * atc, - MatrixDependencyManager * hasAtoms = NULL); + MatrixDependencyManager * hasAtoms = nullptr); // destructor virtual ~AtomElementMask() { @@ -287,8 +287,8 @@ namespace ATC { // constructor NodalGeometryType(ATC_Coupling * atc, - MatrixDependencyManager * hasInternal = NULL, - MatrixDependencyManager * hasGhost = NULL); + MatrixDependencyManager * hasInternal = nullptr, + MatrixDependencyManager * hasGhost = nullptr); // destructor virtual ~NodalGeometryType() { @@ -338,7 +338,7 @@ namespace ATC { // constructor NodalGeometryTypeElementSet(ATC_Coupling * atc, - MatrixDependencyManager * hasInternal = NULL); + MatrixDependencyManager * hasInternal = nullptr); // destructor virtual ~NodalGeometryTypeElementSet() { @@ -659,7 +659,7 @@ namespace ATC { // constructor RegulatedNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL); + MatrixDependencyManager * nodalGeometryType = nullptr); // destructor virtual ~RegulatedNodes() { @@ -721,7 +721,7 @@ namespace ATC { // constructor FluxNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL) : + MatrixDependencyManager * nodalGeometryType = nullptr) : RegulatedNodes(atc,fieldName,nodalGeometryType) {}; // destructor @@ -751,7 +751,7 @@ namespace ATC { // constructor BoundaryNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL) : + MatrixDependencyManager * nodalGeometryType = nullptr) : RegulatedNodes(atc,fieldName,nodalGeometryType) {}; // destructor @@ -781,7 +781,7 @@ namespace ATC { // constructor FluxBoundaryNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL) : + MatrixDependencyManager * nodalGeometryType = nullptr) : FluxNodes(atc,fieldName,nodalGeometryType) {}; // destructor @@ -811,7 +811,7 @@ namespace ATC { // constructor AllRegulatedNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL) : + MatrixDependencyManager * nodalGeometryType = nullptr) : FluxBoundaryNodes(atc,fieldName,nodalGeometryType) {}; // destructor @@ -841,7 +841,7 @@ namespace ATC { // constructor FixedNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL) : + MatrixDependencyManager * nodalGeometryType = nullptr) : RegulatedNodes(atc,fieldName,nodalGeometryType) {}; // destructor @@ -871,7 +871,7 @@ namespace ATC { // constructor FixedBoundaryNodes(ATC_Coupling * atc, FieldName fieldName = NUM_TOTAL_FIELDS, - MatrixDependencyManager * nodalGeometryType = NULL) : + MatrixDependencyManager * nodalGeometryType = nullptr) : FixedNodes(atc,fieldName,nodalGeometryType) {}; // destructor @@ -1052,8 +1052,8 @@ namespace ATC { // constructor PerAtomShapeFunctionGradient(ATC_Method * atc, - MatrixDependencyManager* atomToElementMap = NULL, - DENS_MAN* atomPositions = NULL, + MatrixDependencyManager* atomToElementMap = nullptr, + DENS_MAN* atomPositions = nullptr, const std::string & tag = "AtomicShapeFunctionGradient", AtomType atomType = INTERNAL); diff --git a/lib/atc/TransferOperator.h b/lib/atc/TransferOperator.h index 5f776d04ca6697403a032a36b15f295426367290..5cf578b77c45fcc029c23116207bf87cfb8d1836 100644 --- a/lib/atc/TransferOperator.h +++ b/lib/atc/TransferOperator.h @@ -542,7 +542,7 @@ namespace ATC { AtfProjection(ATC_Method * atc, PerAtomQuantity * source, SPAR_MAN * accumulant, - DIAG_MAN * weights = NULL); + DIAG_MAN * weights = nullptr); // destructor virtual ~AtfProjection(); @@ -587,7 +587,7 @@ namespace ATC { PerAtomQuantity * source, SPAR_MAN * accumulant, const double scale, - DIAG_MAN * weights = NULL); + DIAG_MAN * weights = nullptr); // destructor virtual ~AtfProjectionScaled(); @@ -620,7 +620,7 @@ namespace ATC { PerAtomQuantity * source, SPAR_MAN * accumulant, DENS_MAN * reference, - DIAG_MAN * weights = NULL); + DIAG_MAN * weights = nullptr); // destructor virtual ~AtfProjectionReferenced(); diff --git a/lib/atc/Utility.h b/lib/atc/Utility.h index 2c0ea7270f78d4b30e2e4eefa4f7bc51bc58a626..6693df9323314ad202980b5821a0ba288d0ff8b3 100644 --- a/lib/atc/Utility.h +++ b/lib/atc/Utility.h @@ -226,7 +226,7 @@ namespace ATC_Utility { char *endptr; strtod(s.c_str(), &endptr); - if(endptr != NULL && *endptr == '\0') return true; + if(endptr != nullptr && *endptr == '\0') return true; return false; } diff --git a/lib/awpmd/ivutils/include/logexc.h b/lib/awpmd/ivutils/include/logexc.h index 7bf6125bc6f5fab4e488748510cb9b440de144a0..2eebfcc0cecc60f01463fdff9c3bbe754a1bbe75 100644 --- a/lib/awpmd/ivutils/include/logexc.h +++ b/lib/awpmd/ivutils/include/logexc.h @@ -129,7 +129,7 @@ public: message_logger(const string &descriptor_="", int out_level=vblALLBAD|vblMESS1, int stop_level=vblFATAL, int throw_exceptions=0, int use_globally=0) - :descriptor(descriptor_),prev(NULL),next(NULL){ + :descriptor(descriptor_),prev(nullptr),next(nullptr){ set_throw(throw_exceptions); set_levels(out_level,stop_level); extra_levels(0,0); @@ -157,8 +157,8 @@ public: return -1; glogp=prev; if(glogp) - glogp->next=NULL; - prev=NULL; + glogp->next=nullptr; + prev=nullptr; } return 1; } @@ -244,7 +244,7 @@ public: FILE *out=stdout, FILE *err=stderr, int out_level=vblALLBAD|vblMESS1,int stop_level=vblFATAL, int use_globally=0) - : message_logger(descriptor_,out_level,stop_level,throw_exceptions,use_globally),fout(NULL), ferr(NULL){ + : message_logger(descriptor_,out_level,stop_level,throw_exceptions,use_globally),fout(nullptr), ferr(nullptr){ set_out(out); set_err(err); } diff --git a/lib/awpmd/ivutils/include/pairhash.h b/lib/awpmd/ivutils/include/pairhash.h index c29f72773fe8da14d65afdd86cf65408a9d111c7..401b7b91e39f936b5a5ad487223db6050bae809c 100644 --- a/lib/awpmd/ivutils/include/pairhash.h +++ b/lib/awpmd/ivutils/include/pairhash.h @@ -146,7 +146,7 @@ public: public: iterator(const iterator &other):ptr(other.ptr),incr(other.incr){ } - iterator():ptr(NULL),incr(0){} + iterator():ptr(nullptr),incr(0){} iterator &operator++(){ // prefix ptr+=incr; return *this; @@ -173,13 +173,13 @@ public: size_t sizex, sizey; //e default constructor - recmatrix(): parr(NULL,1) { + recmatrix(): parr(nullptr,1) { sizey=sizex=0; - arr=NULL; + arr=nullptr; } //e copy constructor: makes a managed copy - recmatrix(const recmatrix &other):sizex(0),sizey(0),arr(NULL){ + recmatrix(const recmatrix &other):sizex(0),sizey(0),arr(nullptr){ *this=other; } @@ -222,7 +222,7 @@ public: virtual int init(size_t nx, size_t ny, int smanaged=-1){ int managed=parr.managed(); if(managed && (sizex!=nx || sizey!=ny)){ - parr.reset(NULL,0); + parr.reset(nullptr,0); } if(smanaged>=0){ // for changing the managed flag? parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0 ); @@ -355,7 +355,7 @@ public: public: iterator(const iterator &other):ptr(other.ptr),incr(other.incr){ } - iterator():ptr(NULL),incr(0){} + iterator():ptr(nullptr),incr(0){} iterator &operator++(){ // prefix ptr+=incr; return *this; @@ -382,13 +382,13 @@ public: size_t size; //e default constructor - sqmatrix(): parr(NULL,1) { + sqmatrix(): parr(nullptr,1) { size=0; - arr=NULL; + arr=nullptr; } //e copy constructor: makes a managed copy - sqmatrix(const sqmatrix &other):size(0),arr(NULL){ + sqmatrix(const sqmatrix &other):size(0),arr(nullptr){ *this=other; } @@ -430,7 +430,7 @@ public: virtual int init(size_t n, int smanaged=-1){ int managed=parr.managed(); if(managed && size!=n){ - parr.reset(NULL,0); + parr.reset(nullptr,0); } if(smanaged>=0){ // for changing the managed flag? parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0 ); @@ -600,9 +600,9 @@ class PairHash{ public: //e find the value with indexes i, j //e @return 0 if not found, 1 otherwise - //e if retval is not NULL, puts the found value there - virtual int Find(long i, long j, T *retval=NULL)=0; - virtual int Find(long i, long j, T **retval=NULL)=0; + //e if retval is not a null pointer, puts the found value there + virtual int Find(long i, long j, T *retval=nullptr)=0; + virtual int Find(long i, long j, T **retval=nullptr)=0; virtual int Del(long i, long j)=0; virtual int Put(long i, long j, const T *value)=0; virtual int Put(long i, long j, const T& value)=0; @@ -621,7 +621,7 @@ public: indm.Set(-1); arr= new T[n*(n+1)/2]; } - int Find(long i, long j, T *retval=NULL){ + int Find(long i, long j, T *retval=nullptr){ long ind=indm(i,j); if(ind>=0){ if(retval){ diff --git a/lib/awpmd/ivutils/include/refobj.h b/lib/awpmd/ivutils/include/refobj.h index a1a4feb0ffbdba0762d453ee2b503cab12344f30..8e5fc7df45f981fd0e1730a1726b01d3249e5e21 100644 --- a/lib/awpmd/ivutils/include/refobj.h +++ b/lib/awpmd/ivutils/include/refobj.h @@ -158,7 +158,7 @@ public: using base_t::second; using base_t::first; - mngptr(T* ptr=NULL, int managed=0): pair(ptr,managed){ + mngptr(T* ptr=nullptr, int managed=0): pair(ptr,managed){ //if(managed==2)ptr= new T(*ptr); } mngptr(const mngarg &arg): pair(arg.first,arg.second){} @@ -166,7 +166,7 @@ public: reset(arg.first,arg.second); return *this; } - void reset(T* ptr=NULL, int managed=0){ + void reset(T* ptr=nullptr, int managed=0){ if(second && first && first!=ptr){ if(second&0x8)delete [] first; else delete first; @@ -313,7 +313,7 @@ template > class shptr{ template friend class shptr; T *p; - int *num; //if num==NULL than p is not managed (as in mngptr) + int *num; //if num==nullptr than p is not managed (as in mngptr) void set(T *p_, int managed){ p=p_; @@ -321,7 +321,7 @@ class shptr{ num=new int; *num=1; } - else num=NULL; + else num=nullptr; } template void set(const Y &other){ @@ -330,7 +330,7 @@ class shptr{ num=other.num; if(num)(*num)++; } - else num=NULL; + else num=nullptr; } void set(const shptr &other){ p=other.p; @@ -338,11 +338,11 @@ class shptr{ num=other.num; if(num)(*num)++; } - else num=NULL; + else num=nullptr; } public: - shptr(T* p=NULL, int managed=1){ + shptr(T* p=nullptr, int managed=1){ set(p,managed); } shptr(const mngarg &arg){ @@ -398,14 +398,14 @@ public: delete_t()(p); delete num; } - num=NULL; + num=nullptr; } - p=NULL; + p=nullptr; } } bool valid() const { - return p!=NULL; + return p!=nullptr; } T* ptr() const { diff --git a/lib/awpmd/ivutils/include/vector_3.h b/lib/awpmd/ivutils/include/vector_3.h index 468abbda998f263170208cf82a51f182c945cb32..5711d3bf35f6e92de28feb5cd2a3a447a348f940 100644 --- a/lib/awpmd/ivutils/include/vector_3.h +++ b/lib/awpmd/ivutils/include/vector_3.h @@ -374,7 +374,7 @@ struct Vector_Nt { } - T maxcoord(int *ind=NULL) const { + T maxcoord(int *ind=nullptr) const { int im=0; T vv=v[0]; for (int i=1; i -Vector_3 get_extent(vec_inp_it beg,vec_inp_it end, Vector_3* box_min=NULL,Vector_3* box_max=NULL){ +Vector_3 get_extent(vec_inp_it beg,vec_inp_it end, Vector_3* box_min=nullptr,Vector_3* box_max=nullptr){ if(beg==end) return Vector_3(); Vector_3 center(*beg++); diff --git a/lib/awpmd/ivutils/src/logexc.cpp b/lib/awpmd/ivutils/src/logexc.cpp index 7e82af0f659aec5be08f1f68ec61f402796899d6..6e809dd65cb390deb074a6cba309a26fcb594995 100644 --- a/lib/awpmd/ivutils/src/logexc.cpp +++ b/lib/awpmd/ivutils/src/logexc.cpp @@ -13,7 +13,7 @@ message_logger &message_logger::global(){ return *glogp; } -message_logger *message_logger::glogp=NULL; +message_logger *message_logger::glogp=nullptr; stdfile_logger default_log("",0,stdout,stderr,vblALLBAD|vblMESS1,vblFATAL,1); const char *logfmt(const char *format,...){ diff --git a/lib/awpmd/systems/interact/TCP/wpmd.h b/lib/awpmd/systems/interact/TCP/wpmd.h index e118b76f360d92b4d520d4d713c02500321800f0..4c654400145e20d8ca2be270050e3629d2d315f5 100644 --- a/lib/awpmd/systems/interact/TCP/wpmd.h +++ b/lib/awpmd/systems/interact/TCP/wpmd.h @@ -255,7 +255,7 @@ public: } //e Create NormDeriv object and calculate the derivatived for the given WP - void set2(const WavePacket& w2_, const cdouble *I0_=NULL){ + void set2(const WavePacket& w2_, const cdouble *I0_=nullptr){ w2=w2_; d2.set(w2); w12=conj(w1)*w2; @@ -558,13 +558,13 @@ public: //e if PBCs are used, the corresponding coordinates of electrons and ions //e in periodic directions must be within the range [0, cell[per_dir]) //e @returns 1 if OK - int set_pbc(const Vector_3P pcell=NULL, int pbc_=0x7); + int set_pbc(const Vector_3P pcell=nullptr, int pbc_=0x7); ///\en Setup electrons: forms internal wave packet representations. /// If PBCs are used the coords must be within a range [0, cell). /// Default electron mass is AWPMD::me. - /// Default (q=NULL )electron charges are -1. - int set_electrons(int spin, int n, Vector_3P x, Vector_3P v, double* w, double* pw, double mass=-1, double *q=NULL); + /// Default (q=nullptr )electron charges are -1. + int set_electrons(int spin, int n, Vector_3P x, Vector_3P v, double* w, double* pw, double mass=-1, double *q=nullptr); //e setup ion charges and coordinates //e if PBCs are used the coords must be within a range [0, cell) @@ -593,16 +593,16 @@ public: // 0x2 -- add ion forces to the existing set // 0x4 -- calculate derivatives for electronic time step (NOT IMPLEMENTED) //e if PBCs are used the coords must be within a range [0, cell) - virtual int interaction(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, - Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); + virtual int interaction(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, + Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); //e same as interaction, but using Hartee factorization (no antisymmetrization) - virtual int interaction_hartree(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, - Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); + virtual int interaction_hartree(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, + Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); ///\en Calculates ion-ion interactions and updates Eii and ion forces if requested. This function /// is called form intaraction() and interaction_hartree if calc_ii is set. - virtual int interaction_ii(int flag,Vector_3P fi=NULL); + virtual int interaction_ii(int flag,Vector_3P fi=nullptr); //e Calculates Norm matrix //e The result is saved in AWPMD::Norm[s] @@ -643,7 +643,7 @@ public: ///\en Prepares force arrays according to \a flag setting for interaction() virtual void clear_forces(int flagi,Vector_3P fi, Vector_3P fe_x, - Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c=NULL); + Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c=nullptr); ///\en Creates wave packet according to the given physical parameters. diff --git a/lib/awpmd/systems/interact/TCP/wpmd_split.cpp b/lib/awpmd/systems/interact/TCP/wpmd_split.cpp index 2c58bdaf28555710a8e0ad1e43d56251d4df65d8..f85b1ebf59a4d4e56cec1bd8d6e6467a53fdd546 100644 --- a/lib/awpmd/systems/interact/TCP/wpmd_split.cpp +++ b/lib/awpmd/systems/interact/TCP/wpmd_split.cpp @@ -312,7 +312,7 @@ void AWPMD_split::clear_forces(int flag,Vector_3P fi, Vector_3P fe_x, void AWPMD_split::get_el_forces(int flag, Vector_3P fe_x, Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c){ if(flag&0x4) //need to replace the forces - clear_forces(0x4,NULL,fe_x,fe_p,fe_w,fe_pw,fe_c); + clear_forces(0x4,nullptr,fe_x,fe_p,fe_w,fe_pw,fe_c); // recalculating derivatives if(flag&(0x8|0x4)){ //electron forces needed @@ -622,7 +622,7 @@ void AWPMD_split::y_deriv(cdouble v,int s,int c2, int c1){ /// 0x4 -- calculate electronic forces \n /// 0x8 -- add electronic forces to the existing arrays \n /// 0x10 -- calculate internal electronic derivatives only: \n -/// will not update electronic force arrays, which may be NULL, \n +/// will not update electronic force arrays, which may be null pointers, \n /// the forces may be obtained then using \ref get_el_forces() for all WPs \n /// or separately for each WP using \ref get_wp_force() /// if PBCs are used the coords must be within a range [0, cell) diff --git a/lib/awpmd/systems/interact/TCP/wpmd_split.h b/lib/awpmd/systems/interact/TCP/wpmd_split.h index 44fb757576e2424d2ce5c8d603067456b9837ed4..10a8bda558f2751f824fef5e97939c109d63779a 100644 --- a/lib/awpmd/systems/interact/TCP/wpmd_split.h +++ b/lib/awpmd/systems/interact/TCP/wpmd_split.h @@ -116,8 +116,8 @@ public: /// \a n is the number of electrons of a given spin component /// Electron velocity v is multiplied by mass to obtain momentum. /// Default mass (-1) means me. - /// Electronic charges q are -1 by default (when q=NULL), otherwise the charges are assigned for each split - int set_electrons(int s, int nel, Vector_3P x, Vector_3P v, double* w, double* pw, Vector_2 *c, int *splits, double mass=-1, double *q=NULL); + /// Electronic charges q are -1 by default (when q=nullptr), otherwise the charges are assigned for each split + int set_electrons(int s, int nel, Vector_3P x, Vector_3P v, double* w, double* pw, Vector_2 *c, int *splits, double mass=-1, double *q=nullptr); ///\en Starts adding new electron: continue with \ref add_split functions. @@ -141,7 +141,7 @@ public: ///\en gets current electronic coordinates, and (optionally) number of wave packets for each electron - int get_electrons(int spin, Vector_3P x, Vector_3P v, double* w, double* pw, cdouble *c, int *splits=NULL, double mass=-1); + int get_electrons(int spin, Vector_3P x, Vector_3P v, double* w, double* pw, cdouble *c, int *splits=nullptr, double mass=-1); void eterm_deriv(int ic1,int s1, int c1,int k1,int ic2,int s2, int c2,int j2,cdouble pref, @@ -164,8 +164,8 @@ public: cdouble overlap(int ic1, int s1, int c1,int ic2, int s2, int c2); //e same as interaction, but using Hartee factorization (no antisymmetrization) - int interaction_hartree(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, - Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); + int interaction_hartree(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, + Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); ///\en Calculates interaction in the system of ni ions + electrons /// the electonic subsystem must be previously setup by set_electrons, ionic by set_ions @@ -174,12 +174,12 @@ public: /// 0x4 -- calculate electronic forces \n /// 0x8 -- add electronic forces to the existing arrays \n /// 0x10 -- calculate internal electronic derivatives only: \n - /// will not update electronic force arrays, which may be NULL, \n + /// will not update electronic force arrays, which may be null pointers, \n /// the forces may be obtained then using \ref get_el_forces() for all WPs \n /// or separately for each WP using \ref get_wp_force() /// if PBCs are used the coords must be within a range [0, cell) - int interaction(int flag=0, Vector_3P fi=NULL, Vector_3P fe_x=NULL, - Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); + int interaction(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr, + Vector_3P fe_p=nullptr, double *fe_w=nullptr, double *fe_pw=nullptr, Vector_2P fe_c=nullptr); ///\en Get electronic forcess in the arrays provided, using calculated internal representation /// Valid flag settings are:\n diff --git a/lib/gpu/cudpp_mini/cudpp.cpp b/lib/gpu/cudpp_mini/cudpp.cpp index e2cd4621a4b23800d98e58aaf25114267ef026a8..950632074860c358dfd1921547d625a542059244 100644 --- a/lib/gpu/cudpp_mini/cudpp.cpp +++ b/lib/gpu/cudpp_mini/cudpp.cpp @@ -95,7 +95,7 @@ CUDPPResult cudppScan(CUDPPHandle planHandle, size_t numElements) { CUDPPScanPlan *plan = (CUDPPScanPlan*)CUDPPPlanManager::GetPlan(planHandle); - if (plan != NULL) + if (plan != nullptr) { cudppScanDispatch(d_out, d_in, numElements, 1, plan); return CUDPP_SUCCESS; @@ -159,7 +159,7 @@ CUDPPResult cudppSegmentedScan(CUDPPHandle planHandle, { CUDPPSegmentedScanPlan *plan = (CUDPPSegmentedScanPlan*)CUDPPPlanManager::GetPlan(planHandle); - if (plan != NULL) + if (plan != nullptr) { cudppSegmentedScanDispatch(d_out, d_idata, d_iflags, numElements, plan); return CUDPP_SUCCESS; @@ -200,7 +200,7 @@ CUDPPResult cudppMultiScan(CUDPPHandle planHandle, size_t numRows) { CUDPPScanPlan *plan = (CUDPPScanPlan*)CUDPPPlanManager::GetPlan(planHandle); - if (plan != NULL) + if (plan != nullptr) { cudppScanDispatch(d_out, d_in, numElements, numRows, plan); return CUDPP_SUCCESS; @@ -255,7 +255,7 @@ CUDPPResult cudppCompact(CUDPPHandle planHandle, size_t numElements) { CUDPPCompactPlan *plan = (CUDPPCompactPlan*)CUDPPPlanManager::GetPlan(planHandle); - if (plan != NULL) + if (plan != nullptr) { cudppCompactDispatch(d_out, d_numValidElements, d_in, d_isValid, numElements, plan); @@ -300,7 +300,7 @@ CUDPPResult cudppSort(CUDPPHandle planHandle, size_t numElements) { CUDPPRadixSortPlan *plan = (CUDPPRadixSortPlan*)CUDPPPlanManager::GetPlan(planHandle); - if (plan != NULL) + if (plan != nullptr) { cudppRadixSortDispatch(d_keys, d_values, numElements, keyBits, plan); return CUDPP_SUCCESS; @@ -331,7 +331,7 @@ CUDPPResult cudppSparseMatrixVectorMultiply(CUDPPHandle sparseMatrixHandl CUDPPSparseMatrixVectorMultiplyPlan *plan = (CUDPPSparseMatrixVectorMultiplyPlan*)CUDPPPlanManager::GetPlan(sparseMatrixHandle); - if (plan != NULL) + if (plan != nullptr) { cudppSparseMatrixVectorMultiplyDispatch(d_y, d_x, plan); return CUDPP_SUCCESS; @@ -366,7 +366,7 @@ CUDPP_DLL CUDPPResult cudppRand(CUDPPHandle planHandle,void * d_out, size_t numElements) { CUDPPRandPlan * plan = (CUDPPRandPlan *) CUDPPPlanManager::GetPlan(planHandle); - if(plan != NULL) + if(plan != nullptr) { //dispatch the rand algorithm here cudppRandDispatch(d_out, numElements, plan); diff --git a/lib/gpu/cudpp_mini/cudpp_plan.cpp b/lib/gpu/cudpp_mini/cudpp_plan.cpp index e92a857dd1e195c4c656975a17dcef97e10405c6..8ea99a23feb18eeb6394c08c897cdce7056d9545 100644 --- a/lib/gpu/cudpp_mini/cudpp_plan.cpp +++ b/lib/gpu/cudpp_mini/cudpp_plan.cpp @@ -18,7 +18,7 @@ #include -CUDPPPlanManager* CUDPPPlanManager::m_instance = NULL; +CUDPPPlanManager* CUDPPPlanManager::m_instance = nullptr; CUDPPResult validateOptions(CUDPPConfiguration config, size_t /*numElements*/, size_t numRows, size_t /*rowPitch*/) { diff --git a/lib/gpu/cudpp_mini/cudpp_plan_manager.cpp b/lib/gpu/cudpp_mini/cudpp_plan_manager.cpp index dd9d6eb9db4e01c3e6aaea75740803b1e6402745..33c8621d29e92c77b40f392aba7e3f4c1579fc9f 100644 --- a/lib/gpu/cudpp_mini/cudpp_plan_manager.cpp +++ b/lib/gpu/cudpp_mini/cudpp_plan_manager.cpp @@ -26,17 +26,17 @@ extern "C" void compNumCTAs(KernelPointer kernel, size_t bytesDynamicSharedMem, //! @internal Instantiate the plan manager singleton object void CUDPPPlanManager::Instantiate() { - if (NULL == m_instance) + if (nullptr == m_instance) m_instance = new CUDPPPlanManager; } //! @internal Destroy the plan manager singleton object void CUDPPPlanManager::Destroy() { - if (NULL != m_instance) + if (nullptr != m_instance) { delete m_instance; - m_instance = NULL; + m_instance = nullptr; } } @@ -51,7 +51,7 @@ CUDPPPlanManager::~CUDPPPlanManager() { CUDPPPlan* plan = it->second; delete plan; - plan = NULL; + plan = nullptr; } m_instance->plans.clear(); @@ -85,7 +85,7 @@ CUDPPHandle CUDPPPlanManager::AddPlan(CUDPPPlan* plan) */ bool CUDPPPlanManager::RemovePlan(CUDPPHandle handle) { - if (m_instance == NULL) + if (m_instance == nullptr) { return false; } @@ -97,7 +97,7 @@ bool CUDPPPlanManager::RemovePlan(CUDPPHandle handle) { CUDPPPlan* plan = it->second; delete plan; - plan = NULL; + plan = nullptr; m_instance->plans.erase(it); if (0 == m_instance->plans.size()) @@ -115,14 +115,14 @@ bool CUDPPPlanManager::RemovePlan(CUDPPHandle handle) /** @brief Get a plan from the plan manager by handle * -* @returns A pointer to the plan if found, or NULL otherwise +* @returns A pointer to the plan if found, or nullptr otherwise * @param handle The handle to the requested plan */ CUDPPPlan* CUDPPPlanManager::GetPlan(CUDPPHandle handle) { - if (m_instance == NULL) + if (m_instance == nullptr) { - return NULL; + return nullptr; } std::map::iterator it; @@ -133,13 +133,13 @@ CUDPPPlan* CUDPPPlanManager::GetPlan(CUDPPHandle handle) } else { - return NULL; + return nullptr; } } size_t CUDPPPlanManager::numCTAs(KernelPointer kernel) { - if (m_instance == NULL) + if (m_instance == nullptr) { return 0; } diff --git a/lib/gpu/cudpp_mini/cutil.h b/lib/gpu/cudpp_mini/cutil.h index 7d1fcc17eef9934567f2d41b88d64b8b0da5701f..54f29f498e572656eda0032995a704f03b4726dd 100644 --- a/lib/gpu/cudpp_mini/cutil.h +++ b/lib/gpu/cudpp_mini/cutil.h @@ -136,7 +136,7 @@ extern "C" { //! @param data uninitialized pointer, returned initialized and pointing to //! the data read //! @param len number of data elements in data, -1 on error - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -152,7 +152,7 @@ extern "C" { //! @param data uninitialized pointer, returned initialized and pointing to //! the data read //! @param len number of data elements in data, -1 on error - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -168,7 +168,7 @@ extern "C" { //! @param data uninitialized pointer, returned initialized and pointing to //! the data read //! @param len number of data elements in data, -1 on error - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -183,7 +183,7 @@ extern "C" { //! @param data uninitialized pointer, returned initialized and pointing to //! the data read //! @param len number of data elements in data, -1 on error - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -199,7 +199,7 @@ extern "C" { //! @param data uninitialized pointer, returned initialized and pointing to //! the data read //! @param len number of data elements in data, -1 on error - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -215,7 +215,7 @@ extern "C" { //! @param data uninitialized pointer, returned initialized and pointing to //! the data read //! @param len number of data elements in data, -1 on error - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -307,7 +307,7 @@ extern "C" { //! @param data handle to the data read //! @param w width of the image //! @param h height of the image - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -350,7 +350,7 @@ extern "C" { //! @param data handle to the data read //! @param w width of the image //! @param h height of the image - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -366,7 +366,7 @@ extern "C" { //! @param data handle to the data read //! @param w width of the image //! @param h height of the image - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// @@ -381,7 +381,7 @@ extern "C" { //! @param data handle to the data read //! @param w width of the image //! @param h height of the image - //! @note If a NULL pointer is passed to this function and it is + //! @note If a nullptr pointer is passed to this function and it is //! initialized within Cutil then cutFree() has to be used to //! deallocate the memory //////////////////////////////////////////////////////////////////////////// diff --git a/lib/gpu/geryon/hip_device.h b/lib/gpu/geryon/hip_device.h index 93f38d28bbf773ace806e7746bc598a715859ce5..d2fb1919b7e849e0f7233315897c51960fcda02d 100644 --- a/lib/gpu/geryon/hip_device.h +++ b/lib/gpu/geryon/hip_device.h @@ -261,7 +261,7 @@ class UCL_Device { /// Select the platform that has accelerators (for compatibility with OpenCL) inline int set_platform_accelerator(int pid=-1) { return UCL_SUCCESS; } - inline int load_module(const void* program, hipModule_t& module, std::string *log=NULL){ + inline int load_module(const void* program, hipModule_t& module, std::string *log=nullptr){ auto it = _loaded_modules.emplace(program, hipModule_t()); if(!it.second){ module = it.first->second; @@ -281,7 +281,7 @@ class UCL_Device { hipError_t err=hipModuleLoadDataEx(&module,program,num_opts, options,(void **)values); - if (log!=NULL) + if (log!=nullptr) *log=std::string(clog); if (err != hipSuccess) { diff --git a/lib/gpu/geryon/hip_kernel.h b/lib/gpu/geryon/hip_kernel.h index 654eb44772371461d32078057f91be6289870c1b..c5014b52e77aadc194a11a665071e8d9a66a622b 100644 --- a/lib/gpu/geryon/hip_kernel.h +++ b/lib/gpu/geryon/hip_kernel.h @@ -30,7 +30,7 @@ class UCL_Program { public: inline UCL_Program(UCL_Device &device) { _device_ptr = &device; _cq=device.cq(); } inline UCL_Program(UCL_Device &device, const void *program, - const char *flags="", std::string *log=NULL) { + const char *flags="", std::string *log=nullptr) { _device_ptr = &device; _cq=device.cq(); init(device); load_string(program,flags,log); @@ -46,7 +46,7 @@ class UCL_Program { inline void clear() { } /// Load a program from a file and compile with flags - inline int load(const char *filename, const char *flags="", std::string *log=NULL) { + inline int load(const char *filename, const char *flags="", std::string *log=nullptr) { std::ifstream in(filename); if (!in || in.is_open()==false) { #ifndef UCL_NO_EXIT @@ -64,7 +64,7 @@ class UCL_Program { } /// Load a program from a string and compile with flags - inline int load_string(const void *program, const char *flags="", std::string *log=NULL) { + inline int load_string(const void *program, const char *flags="", std::string *log=nullptr) { return _device_ptr->load_module(program, _module, log); } @@ -263,7 +263,7 @@ class UCL_Kernel { }; const auto res = hipModuleLaunchKernel(_kernel,_num_blocks[0],_num_blocks[1], _num_blocks[2],_block_size[0],_block_size[1], - _block_size[2],0,_cq, NULL, config); + _block_size[2],0,_cq, nullptr, config); CU_SAFE_CALL(res); //#endif } diff --git a/lib/gpu/geryon/hip_memory.h b/lib/gpu/geryon/hip_memory.h index 13f60ad93963ecbfcbdc5ab6e44dcd39161bfffb..a983ba3227c1d84584562e4c3973d88e44f8f908 100644 --- a/lib/gpu/geryon/hip_memory.h +++ b/lib/gpu/geryon/hip_memory.h @@ -55,7 +55,7 @@ inline int _host_alloc(mat_type &mat, copy_type &cm, const size_t n, err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocWriteCombined); else err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocDefault); - if (err!=hipSuccess || *(mat.host_ptr())==NULL) + if (err!=hipSuccess || *(mat.host_ptr())==nullptr) return UCL_MEMORY_ERROR; mat.cq()=cm.cq(); return UCL_SUCCESS; @@ -71,7 +71,7 @@ inline int _host_alloc(mat_type &mat, UCL_Device &dev, const size_t n, err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocWriteCombined); else err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocDefault); - if (err!=hipSuccess || *(mat.host_ptr())==NULL) + if (err!=hipSuccess || *(mat.host_ptr())==nullptr) return UCL_MEMORY_ERROR; mat.cq()=dev.cq(); return UCL_SUCCESS; @@ -97,7 +97,7 @@ inline int _host_resize(mat_type &mat, const size_t n) { err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocWriteCombined); else err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocDefault); - if (err!=hipSuccess || *(mat.host_ptr())==NULL) + if (err!=hipSuccess || *(mat.host_ptr())==nullptr) return UCL_MEMORY_ERROR; return UCL_SUCCESS; } diff --git a/lib/gpu/geryon/hip_texture.h b/lib/gpu/geryon/hip_texture.h index e7aa4e1461e25c2c0cdcbee35761d64832bc6b8c..ae16bee90089fa7858de1e4f317c5627f0a14d9e 100644 --- a/lib/gpu/geryon/hip_texture.h +++ b/lib/gpu/geryon/hip_texture.h @@ -99,7 +99,7 @@ class UCL_Texture { else CU_SAFE_CALL(hipTexRefSetFormat(_tex,HIP_AD_FORMAT_SIGNED_INT32,numel*2)); } - CU_SAFE_CALL(hipTexRefSetAddress(NULL, _tex, vec.cbegin(), vec.numel()*vec.element_size())); + CU_SAFE_CALL(hipTexRefSetAddress(nullptr, _tex, vec.cbegin(), vec.numel()*vec.element_size())); #else void* data_ptr = (void*)vec.cbegin(); CU_SAFE_CALL(hipMemcpyHtoD(hipDeviceptr_t(_device_ptr_to_global_var), &data_ptr, sizeof(void*))); diff --git a/lib/gpu/geryon/nvd_kernel.h b/lib/gpu/geryon/nvd_kernel.h index 9293db2fe49f4125959034e76117b4658bc0adae..d74b0e2dc16e4bfb9d8374ba0750d40d497c5d21 100644 --- a/lib/gpu/geryon/nvd_kernel.h +++ b/lib/gpu/geryon/nvd_kernel.h @@ -41,7 +41,7 @@ class UCL_Program { public: inline UCL_Program(UCL_Device &device) { _cq=device.cq(); } inline UCL_Program(UCL_Device &device, const void *program, - const char *flags="", std::string *log=NULL) { + const char *flags="", std::string *log=nullptr) { _cq=device.cq(); init(device); load_string(program,flags,log); @@ -58,7 +58,7 @@ class UCL_Program { /// Load a program from a file and compile with flags inline int load(const char *filename, const char *flags="", - std::string *log=NULL) { + std::string *log=nullptr) { std::ifstream in(filename); if (!in || in.is_open()==false) { #ifndef UCL_NO_EXIT @@ -77,7 +77,7 @@ class UCL_Program { /// Load a program from a string and compile with flags inline int load_string(const void *program, const char *flags="", - std::string *log=NULL) { + std::string *log=nullptr) { if (std::string(flags)=="BINARY") return load_binary((const char *)program); const unsigned int num_opts=2; @@ -95,7 +95,7 @@ class UCL_Program { CUresult err=cuModuleLoadDataEx(&_module,program,num_opts, options,(void **)values); - if (log!=NULL) + if (log!=nullptr) *log=std::string(clog); if (err != CUDA_SUCCESS) { @@ -361,7 +361,7 @@ class UCL_Kernel { #if CUDA_VERSION >= 4000 CU_SAFE_CALL(cuLaunchKernel(_kernel,_num_blocks[0],_num_blocks[1], _num_blocks[2],_block_size[0],_block_size[1], - _block_size[2],0,_cq,_kernel_args,NULL)); + _block_size[2],0,_cq,_kernel_args,nullptr)); #else CU_SAFE_CALL(cuParamSetSize(_kernel,_param_size)); CU_SAFE_CALL(cuLaunchGridAsync(_kernel,_num_blocks[0],_num_blocks[1],_cq)); diff --git a/lib/gpu/geryon/nvd_memory.h b/lib/gpu/geryon/nvd_memory.h index 0484e33de61fade58d60be41c3ef99a7c4b42575..bcfc055ac27ad6ad97809cfe34a9d3a6094b43ee 100644 --- a/lib/gpu/geryon/nvd_memory.h +++ b/lib/gpu/geryon/nvd_memory.h @@ -55,7 +55,7 @@ inline int _host_alloc(mat_type &mat, copy_type &cm, const size_t n, err=cuMemHostAlloc((void **)mat.host_ptr(),n,CU_MEMHOSTALLOC_WRITECOMBINED); else err=cuMemAllocHost((void **)mat.host_ptr(),n); - if (err!=CUDA_SUCCESS || *(mat.host_ptr())==NULL) + if (err!=CUDA_SUCCESS || *(mat.host_ptr())==nullptr) return UCL_MEMORY_ERROR; mat.cq()=cm.cq(); return UCL_SUCCESS; @@ -71,7 +71,7 @@ inline int _host_alloc(mat_type &mat, UCL_Device &dev, const size_t n, err=cuMemHostAlloc((void **)mat.host_ptr(),n,CU_MEMHOSTALLOC_WRITECOMBINED); else err=cuMemAllocHost((void **)mat.host_ptr(),n); - if (err!=CUDA_SUCCESS || *(mat.host_ptr())==NULL) + if (err!=CUDA_SUCCESS || *(mat.host_ptr())==nullptr) return UCL_MEMORY_ERROR; mat.cq()=dev.cq(); return UCL_SUCCESS; @@ -97,7 +97,7 @@ inline int _host_resize(mat_type &mat, const size_t n) { err=cuMemHostAlloc((void **)mat.host_ptr(),n,CU_MEMHOSTALLOC_WRITECOMBINED); else err=cuMemAllocHost((void **)mat.host_ptr(),n); - if (err!=CUDA_SUCCESS || *(mat.host_ptr())==NULL) + if (err!=CUDA_SUCCESS || *(mat.host_ptr())==nullptr) return UCL_MEMORY_ERROR; return UCL_SUCCESS; } diff --git a/lib/gpu/geryon/nvd_texture.h b/lib/gpu/geryon/nvd_texture.h index 965595a448fa460e7fe2fab2ef1841b09535a31a..c766af826c0e9f843d57bf19cb83d23b23614994 100644 --- a/lib/gpu/geryon/nvd_texture.h +++ b/lib/gpu/geryon/nvd_texture.h @@ -80,7 +80,7 @@ class UCL_Texture { #ifdef UCL_DEBUG assert(numel!=0 && numel<5); #endif - CU_SAFE_CALL(cuTexRefSetAddress(NULL, _tex, vec.cbegin(), + CU_SAFE_CALL(cuTexRefSetAddress(nullptr, _tex, vec.cbegin(), vec.numel()*vec.element_size())); if (vec.element_size()==sizeof(float)) CU_SAFE_CALL(cuTexRefSetFormat(_tex, CU_AD_FORMAT_FLOAT, numel)); diff --git a/lib/gpu/geryon/ocl_device.h b/lib/gpu/geryon/ocl_device.h index 10e84a436a4c54634c5047c395efbf38e60ff7dc..de4def0bc182ed801113d5d4462a9b6eba1f9f94 100644 --- a/lib/gpu/geryon/ocl_device.h +++ b/lib/gpu/geryon/ocl_device.h @@ -360,7 +360,7 @@ int UCL_Device::set_platform(int pid) { // --- Get Number of Devices cl_uint n; - errorv=clGetDeviceIDs(_cl_platform,CL_DEVICE_TYPE_ALL,0,NULL,&n); + errorv=clGetDeviceIDs(_cl_platform,CL_DEVICE_TYPE_ALL,0,nullptr,&n); _num_devices=n; if (errorv!=CL_SUCCESS || _num_devices==0) { _num_devices=0; @@ -385,7 +385,7 @@ int UCL_Device::create_context() { props[0]=CL_CONTEXT_PLATFORM; props[1]=_platform; props[2]=0; - _context=clCreateContext(0,1,&_cl_device,NULL,NULL,&errorv); + _context=clCreateContext(0,1,&_cl_device,nullptr,nullptr,&errorv); if (errorv!=CL_SUCCESS) { #ifndef UCL_NO_EXIT std::cerr << "UCL Error: Could not access accelerator number " << _device @@ -404,36 +404,36 @@ void UCL_Device::add_properties(cl_device_id device_list) { char buffer[1024]; cl_bool ans_bool; - CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_NAME,1024,buffer,NULL)); + CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_NAME,1024,buffer,nullptr)); op.name=buffer; CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_GLOBAL_MEM_SIZE, - sizeof(op.global_mem),&op.global_mem,NULL)); + sizeof(op.global_mem),&op.global_mem,nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_LOCAL_MEM_SIZE, - sizeof(op.shared_mem),&op.shared_mem,NULL)); + sizeof(op.shared_mem),&op.shared_mem,nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, - sizeof(op.const_mem),&op.const_mem,NULL)); + sizeof(op.const_mem),&op.const_mem,nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_TYPE, - sizeof(op.device_type),&op.device_type,NULL)); + sizeof(op.device_type),&op.device_type,nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_COMPUTE_UNITS, sizeof(op.compute_units),&op.compute_units, - NULL)); + nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_CLOCK_FREQUENCY, - sizeof(op.clock),&op.clock,NULL)); + sizeof(op.clock),&op.clock,nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(op.work_group_size),&op.work_group_size, - NULL)); + nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_WORK_ITEM_SIZES, 3*sizeof(op.work_item_size[0]),op.work_item_size, - NULL)); + nullptr)); CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MEM_BASE_ADDR_ALIGN, - sizeof(cl_uint),&op.alignment,NULL)); + sizeof(cl_uint),&op.alignment,nullptr)); op.alignment/=8; // Determine if double precision is supported cl_uint double_width; CL_SAFE_CALL(clGetDeviceInfo(device_list, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE, - sizeof(double_width),&double_width,NULL)); + sizeof(double_width),&double_width,nullptr)); if (double_width==0) op.double_precision=false; else @@ -441,13 +441,13 @@ void UCL_Device::add_properties(cl_device_id device_list) { CL_SAFE_CALL(clGetDeviceInfo(device_list, CL_DEVICE_PROFILING_TIMER_RESOLUTION, - sizeof(size_t),&op.timer_resolution,NULL)); + sizeof(size_t),&op.timer_resolution,nullptr)); op.ecc_support=false; CL_SAFE_CALL(clGetDeviceInfo(device_list, CL_DEVICE_ERROR_CORRECTION_SUPPORT, - sizeof(ans_bool),&ans_bool,NULL)); + sizeof(ans_bool),&ans_bool,nullptr)); if (ans_bool==CL_TRUE) op.ecc_support=true; @@ -459,7 +459,7 @@ void UCL_Device::add_properties(cl_device_id device_list) { #ifdef CL_VERSION_1_2 size_t return_bytes; CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_OPENCL_C_VERSION,1024, - buffer,NULL)); + buffer,nullptr)); op.c_version=buffer; cl_device_partition_property pinfo[4]; @@ -479,7 +479,7 @@ void UCL_Device::add_properties(cl_device_id device_list) { CL_SAFE_CALL(clGetDeviceInfo(device_list, CL_DEVICE_PARTITION_MAX_SUB_DEVICES, - sizeof(cl_uint),&op.max_sub_devices,NULL)); + sizeof(cl_uint),&op.max_sub_devices,nullptr)); #endif _properties.push_back(op); @@ -489,15 +489,15 @@ std::string UCL_Device::platform_name() { char info[1024]; CL_SAFE_CALL(clGetPlatformInfo(_cl_platform,CL_PLATFORM_VENDOR,1024,info, - NULL)); + nullptr)); std::string ans=std::string(info)+' '; CL_SAFE_CALL(clGetPlatformInfo(_cl_platform,CL_PLATFORM_NAME,1024,info, - NULL)); + nullptr)); ans+=std::string(info)+' '; CL_SAFE_CALL(clGetPlatformInfo(_cl_platform,CL_PLATFORM_VERSION,1024,info, - NULL)); + nullptr)); ans+=std::string(info); return ans; diff --git a/lib/gpu/geryon/ocl_kernel.h b/lib/gpu/geryon/ocl_kernel.h index b65049b9e698eaeab5a72eda799da39b1b820502..77593f4515ccd66e10ac4360f870502d54340368 100644 --- a/lib/gpu/geryon/ocl_kernel.h +++ b/lib/gpu/geryon/ocl_kernel.h @@ -42,7 +42,7 @@ class UCL_Program { inline UCL_Program() : _init_done(false) {} inline UCL_Program(UCL_Device &device) : _init_done(false) { init(device); } inline UCL_Program(UCL_Device &device, const void *program, - const char *flags="", std::string *log=NULL) : + const char *flags="", std::string *log=nullptr) : _init_done(false) { init(device); load_string(program,flags,log); @@ -74,7 +74,7 @@ class UCL_Program { /// Load a program from a file and compile with flags inline int load(const char *filename, const char *flags="", - std::string *log=NULL) { + std::string *log=nullptr) { std::ifstream in(filename); if (!in || in.is_open()==false) { #ifndef UCL_NO_EXIT @@ -93,29 +93,29 @@ class UCL_Program { /// Load a program from a string and compile with flags inline int load_string(const void *program, const char *flags="", - std::string *log=NULL) { + std::string *log=nullptr) { cl_int error_flag; const char *prog=(const char *)program; - _program=clCreateProgramWithSource(_context,1,&prog,NULL,&error_flag); + _program=clCreateProgramWithSource(_context,1,&prog,nullptr,&error_flag); CL_CHECK_ERR(error_flag); - error_flag = clBuildProgram(_program,1,&_device,flags,NULL,NULL); + error_flag = clBuildProgram(_program,1,&_device,flags,nullptr,nullptr); if (error_flag!=-11) CL_CHECK_ERR(error_flag); cl_build_status build_status; CL_SAFE_CALL(clGetProgramBuildInfo(_program,_device, CL_PROGRAM_BUILD_STATUS, sizeof(cl_build_status),&build_status, - NULL)); + nullptr)); - if (build_status != CL_SUCCESS || log!=NULL) { + if (build_status != CL_SUCCESS || log!=nullptr) { size_t ms; CL_SAFE_CALL(clGetProgramBuildInfo(_program,_device,CL_PROGRAM_BUILD_LOG,0, - NULL, &ms)); + nullptr, &ms)); char *build_log = new char[ms]; CL_SAFE_CALL(clGetProgramBuildInfo(_program,_device,CL_PROGRAM_BUILD_LOG,ms, - build_log, NULL)); + build_log, nullptr)); - if (log!=NULL) + if (log!=nullptr) *log=std::string(build_log); if (build_status != CL_SUCCESS) { @@ -363,7 +363,7 @@ inline int UCL_Kernel::set_function(UCL_Program &program, const char *function) _kernel_info_name=function; cl_uint nargs; CL_SAFE_CALL(clGetKernelInfo(_kernel,CL_KERNEL_NUM_ARGS,sizeof(cl_uint), - &nargs,NULL)); + &nargs,nullptr)); _kernel_info_nargs=nargs; #ifdef NOT_TEST_CL_VERSION_1_2 char tname[256]; @@ -380,8 +380,8 @@ inline int UCL_Kernel::set_function(UCL_Program &program, const char *function) } void UCL_Kernel::run() { - CL_SAFE_CALL(clEnqueueNDRangeKernel(_cq,_kernel,_dimensions,NULL, - _num_blocks,_block_size,0,NULL,NULL)); + CL_SAFE_CALL(clEnqueueNDRangeKernel(_cq,_kernel,_dimensions,nullptr, + _num_blocks,_block_size,0,nullptr,nullptr)); } } // namespace diff --git a/lib/gpu/geryon/ocl_memory.h b/lib/gpu/geryon/ocl_memory.h index 9692f4dd7bd5b619565ba03d625ad5b6edb807d4..740020ab18411a662999980eeded5110087a1698 100644 --- a/lib/gpu/geryon/ocl_memory.h +++ b/lib/gpu/geryon/ocl_memory.h @@ -58,7 +58,7 @@ inline int _host_alloc(mat_type &mat, copy_type &cm, const size_t n, cl_int error_flag; cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(cm.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); cl_mem_flags buffer_perm; cl_map_flags map_perm; @@ -103,12 +103,12 @@ inline int _host_alloc(mat_type &mat, copy_type &cm, const size_t n, map_perm=CL_MAP_READ | CL_MAP_WRITE; } - mat.cbegin()=clCreateBuffer(context,buffer_perm,n,NULL,&error_flag); + mat.cbegin()=clCreateBuffer(context,buffer_perm,n,nullptr,&error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; *mat.host_ptr() = (typename mat_type::data_type*) clEnqueueMapBuffer(cm.cq(),mat.cbegin(),CL_TRUE, - map_perm,0,n,0,NULL,NULL,NULL); + map_perm,0,n,0,nullptr,nullptr,nullptr); mat.cq()=cm.cq(); CL_SAFE_CALL(clRetainCommandQueue(mat.cq())); @@ -120,10 +120,10 @@ inline int _host_view(mat_type &mat, copy_type &cm, const size_t n) { cl_int error_flag; cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(cm.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); cl_mem_flags orig_flags; CL_SAFE_CALL(clGetMemObjectInfo(cm.cbegin(),CL_MEM_FLAGS,sizeof(orig_flags), - &orig_flags,NULL)); + &orig_flags,nullptr)); orig_flags=orig_flags & ~CL_MEM_ALLOC_HOST_PTR; mat.cbegin()=clCreateBuffer(context, CL_MEM_USE_HOST_PTR | orig_flags, n, @@ -159,13 +159,13 @@ inline int _host_alloc(mat_type &mat, UCL_Device &dev, const size_t n, } cl_int error_flag; - mat.cbegin()=clCreateBuffer(dev.context(),buffer_perm,n,NULL,&error_flag); + mat.cbegin()=clCreateBuffer(dev.context(),buffer_perm,n,nullptr,&error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; *mat.host_ptr() = (typename mat_type::data_type*) clEnqueueMapBuffer(dev.cq(),mat.cbegin(),CL_TRUE, - map_perm,0,n,0,NULL,NULL,NULL); + map_perm,0,n,0,nullptr,nullptr,nullptr); mat.cq()=dev.cq(); CL_SAFE_CALL(clRetainCommandQueue(mat.cq())); return UCL_SUCCESS; @@ -194,10 +194,10 @@ inline int _host_resize(mat_type &mat, const size_t n) { cl_int error_flag; cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); cl_mem_flags buffer_perm; CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_FLAGS,sizeof(buffer_perm), - &buffer_perm,NULL)); + &buffer_perm,nullptr)); CL_DESTRUCT_CALL(clReleaseMemObject(mat.cbegin())); @@ -209,12 +209,12 @@ inline int _host_resize(mat_type &mat, const size_t n) { else map_perm=CL_MAP_READ | CL_MAP_WRITE; - mat.cbegin()=clCreateBuffer(context,buffer_perm,n,NULL,&error_flag); + mat.cbegin()=clCreateBuffer(context,buffer_perm,n,nullptr,&error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; *mat.host_ptr() = (typename mat_type::data_type*) clEnqueueMapBuffer(mat.cq(),mat.cbegin(),CL_TRUE, - map_perm,0,n,0,NULL,NULL,NULL); + map_perm,0,n,0,nullptr,nullptr,nullptr); return UCL_SUCCESS; } @@ -229,7 +229,7 @@ inline int _device_alloc(mat_type &mat, copy_type &cm, const size_t n, cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(cm.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); cl_mem_flags flag; if (kind==UCL_READ_WRITE) flag=CL_MEM_READ_WRITE; @@ -247,7 +247,7 @@ inline int _device_alloc(mat_type &mat, copy_type &cm, const size_t n, #endif else assert(0==1); - mat.cbegin()=clCreateBuffer(context,flag,n,NULL,&error_flag); + mat.cbegin()=clCreateBuffer(context,flag,n,nullptr,&error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; mat.cq()=cm.cq(); @@ -276,7 +276,7 @@ inline int _device_alloc(mat_type &mat, UCL_Device &dev, const size_t n, #endif else assert(0==1); - mat.cbegin()=clCreateBuffer(dev.context(),flag,n,NULL, + mat.cbegin()=clCreateBuffer(dev.context(),flag,n,nullptr, &error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; @@ -321,7 +321,7 @@ inline int _device_resize(mat_type &mat, const size_t n) { cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); CL_DESTRUCT_CALL(clReleaseMemObject(mat.cbegin())); cl_mem_flags flag; @@ -341,7 +341,7 @@ inline int _device_resize(mat_type &mat, const size_t n) { #endif else assert(0==1); - mat.cbegin()=clCreateBuffer(context,flag,n,NULL,&error_flag); + mat.cbegin()=clCreateBuffer(context,flag,n,nullptr,&error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; return UCL_SUCCESS; @@ -359,7 +359,7 @@ inline int _device_resize(mat_type &mat, const size_t rows, cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); CL_DESTRUCT_CALL(clReleaseMemObject(mat.cbegin())); cl_mem_flags flag; @@ -379,7 +379,7 @@ inline int _device_resize(mat_type &mat, const size_t rows, #endif else assert(0==1); - mat.cbegin()=clCreateBuffer(context,flag,pitch*rows,NULL,&error_flag); + mat.cbegin()=clCreateBuffer(context,flag,pitch*rows,nullptr,&error_flag); if (error_flag != CL_SUCCESS) return UCL_MEMORY_ERROR; return UCL_SUCCESS; @@ -395,21 +395,21 @@ inline void _host_zero(void *ptr, const size_t n) { inline void _ocl_build(cl_program &program, cl_device_id &device, const char* options = "") { - clBuildProgram(program,1,&device,options,NULL,NULL); + clBuildProgram(program,1,&device,options,nullptr,nullptr); cl_build_status build_status; CL_SAFE_CALL(clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_STATUS, sizeof(cl_build_status),&build_status, - NULL)); + nullptr)); if (build_status == CL_SUCCESS) return; size_t ms; CL_SAFE_CALL(clGetProgramBuildInfo(program, device,CL_PROGRAM_BUILD_LOG, 0, - NULL, &ms)); + nullptr, &ms)); char *build_log = new char[ms]; CL_SAFE_CALL(clGetProgramBuildInfo(program,device,CL_PROGRAM_BUILD_LOG,ms, - build_log, NULL)); + build_log, nullptr)); std::cerr << std::endl << "----------------------------------------------------------\n" @@ -426,7 +426,7 @@ inline void _ocl_kernel_from_source(cl_context &context, cl_device_id &device, cl_int error_flag; cl_program program=clCreateProgramWithSource(context,lines,source, - NULL,&error_flag); + nullptr,&error_flag); CL_CHECK_ERR(error_flag); _ocl_build(program,device,options); kernel=clCreateKernel(program,function,&error_flag); @@ -444,15 +444,15 @@ inline void _device_zero(mat_type &mat, const size_t n, command_queue &cq) { #ifdef UCL_CL_ZERO cl_int zeroint=0; CL_SAFE_CALL(clEnqueueFillBuffer(cq,mat.begin(),&zeroint,sizeof(cl_int), - mat.byteoff(),n,0,NULL,NULL)); + mat.byteoff(),n,0,nullptr,nullptr)); #else cl_context context; CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_CONTEXT,sizeof(context), - &context,NULL)); + &context,nullptr)); cl_device_id device; CL_SAFE_CALL(clGetContextInfo(context,CL_CONTEXT_DEVICES, - sizeof(cl_device_id),&device,NULL)); + sizeof(cl_device_id),&device,nullptr)); const char * szero[3]={ "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n", @@ -585,7 +585,7 @@ template <> struct _ucl_memcpy<1,0> { std::cerr << "UCL_COPY 1NS\n"; #endif CL_SAFE_CALL(clEnqueueReadBuffer(cq,src.cbegin(),block,src_offset,n, - dst.begin(),0,NULL,NULL)); + dst.begin(),0,nullptr,nullptr)); } template static inline void mc(p1 &dst, const size_t dpitch, const p2 &src, @@ -607,13 +607,13 @@ template <> struct _ucl_memcpy<1,0> { src.cols()==cols/src.element_size()) CL_SAFE_CALL(clEnqueueReadBuffer(cq,src.cbegin(),block,src_offset, spitch*rows, - (char *)dst.begin()+dst_offset,0,NULL, - NULL)); + (char *)dst.begin()+dst_offset,0,nullptr, + nullptr)); else for (size_t i=0; i struct _ucl_memcpy<0,1> { std::cerr << "UCL_COPY 3NS\n"; #endif CL_SAFE_CALL(clEnqueueWriteBuffer(cq,dst.cbegin(),block,dst_offset,n, - src.begin(),0,NULL,NULL)); + src.begin(),0,nullptr,nullptr)); } template static inline void mc(p1 &dst, const size_t dpitch, const p2 &src, @@ -659,13 +659,13 @@ template <> struct _ucl_memcpy<0,1> { src.cols()==cols/src.element_size()) CL_SAFE_CALL(clEnqueueWriteBuffer(cq,dst.cbegin(),block,dst_offset, spitch*rows, - (char *)src.begin()+src_offset,0,NULL, - NULL)); + (char *)src.begin()+src_offset,0,nullptr, + nullptr)); else for (size_t i=0; i struct _ucl_memcpy { const size_t dst_offset, const size_t src_offset) { if (src.cbegin()!=dst.cbegin() || src_offset!=dst_offset) { CL_SAFE_CALL(clEnqueueCopyBuffer(cq,src.cbegin(),dst.cbegin(),src_offset, - dst_offset,n,0,NULL,NULL)); + dst_offset,n,0,nullptr,nullptr)); #ifdef UCL_DBG_MEM_TRACE std::cerr << "UCL_COPY 6NS\n"; #endif @@ -704,13 +704,13 @@ template struct _ucl_memcpy { if (spitch==dpitch && dst.cols()==src.cols() && src.cols()==cols/src.element_size()) CL_SAFE_CALL(clEnqueueCopyBuffer(cq,src.cbegin(),dst.cbegin(),src_offset, - dst_offset,spitch*rows,0,NULL,NULL)); + dst_offset,spitch*rows,0,nullptr,nullptr)); else for (size_t i=0; i AnswerT::Answer() : _allocated(false),_eflag(false),_vflag(false), - _inum(0),_ilist(NULL),_newton(false) { + _inum(0),_ilist(nullptr),_newton(false) { } template @@ -119,7 +119,7 @@ void AnswerT::clear() { engv.clear(); time_answer.clear(); _inum=0; - _ilist=NULL; + _ilist=nullptr; _eflag=false; _vflag=false; } @@ -180,7 +180,7 @@ double AnswerT::energy_virial(double *eatom, double **vatom, for (int i=0; i<_inum; i++) evdwl+=engv[i]; if (_ef_atom) { - if (_ilist==NULL) { + if (_ilist==nullptr) { for (int i=0; i<_inum; i++) eatom[i]+=engv[i]; } else { @@ -196,7 +196,7 @@ double AnswerT::energy_virial(double *eatom, double **vatom, for (int i=vstart; i void AnswerT::get_answers(double **f, double **tor) { int fl=0; - if (_ilist==NULL) { + if (_ilist==nullptr) { for (int i=0; i<_inum; i++) { f[i][0]+=force[fl]; f[i][1]+=force[fl+1]; diff --git a/lib/gpu/lal_base_atomic.cpp b/lib/gpu/lal_base_atomic.cpp index eb0eab87b6a3fec6d1bd1574235eb607e36f5b7c..42925aaeecde23f887cb65626f65365fbac68830 100644 --- a/lib/gpu/lal_base_atomic.cpp +++ b/lib/gpu/lal_base_atomic.cpp @@ -25,8 +25,8 @@ BaseAtomicT::BaseAtomic() : _compiled(false), _max_bytes(0) { device=&global_device; ans=new Answer(); nbor=new Neighbor(); - pair_program=NULL; - ucl_device=NULL; + pair_program=nullptr; + ucl_device=nullptr; } template @@ -135,7 +135,7 @@ int * BaseAtomicT::reset_nbors(const int nall, const int inum, int *ilist, resize_atom(inum,nall,success); resize_local(inum,mn,success); if (!success) - return NULL; + return nullptr; nbor->get_host(inum,ilist,numj,firstneigh,block_size()); @@ -231,7 +231,7 @@ int ** BaseAtomicT::compute(const int ago, const int inum_full, // Make sure textures are correct if realloc by a different hybrid style resize_atom(0,nall,success); zero_timers(); - return NULL; + return nullptr; } hd_balancer.balance(cpu_time); @@ -244,7 +244,7 @@ int ** BaseAtomicT::compute(const int ago, const int inum_full, build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; hd_balancer.start_timer(); } else { atom->cast_x_data(host_x,host_type); diff --git a/lib/gpu/lal_base_charge.cpp b/lib/gpu/lal_base_charge.cpp index 52e8ae2d898c19b8ca2900ad83e222b95de89f9f..d5a6e0622234b689b3902cf21f44db8e03028bdc 100644 --- a/lib/gpu/lal_base_charge.cpp +++ b/lib/gpu/lal_base_charge.cpp @@ -25,8 +25,8 @@ BaseChargeT::BaseCharge() : _compiled(false), _max_bytes(0) { device=&global_device; ans=new Answer(); nbor=new Neighbor(); - pair_program=NULL; - ucl_device=NULL; + pair_program=nullptr; + ucl_device=nullptr; } template @@ -137,7 +137,7 @@ int * BaseChargeT::reset_nbors(const int nall, const int inum, int *ilist, resize_atom(inum,nall,success); resize_local(inum,mn,success); if (!success) - return NULL; + return nullptr; nbor->get_host(inum,ilist,numj,firstneigh,block_size()); @@ -240,7 +240,7 @@ int** BaseChargeT::compute(const int ago, const int inum_full, // Make sure textures are correct if realloc by a different hybrid style resize_atom(0,nall,success); zero_timers(); - return NULL; + return nullptr; } hd_balancer.balance(cpu_time); @@ -253,7 +253,7 @@ int** BaseChargeT::compute(const int ago, const int inum_full, build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; atom->cast_q_data(host_q); hd_balancer.start_timer(); } else { diff --git a/lib/gpu/lal_base_dipole.cpp b/lib/gpu/lal_base_dipole.cpp index ed71029e6831f2d4d7f0a80add55ab69b7fa74c5..57773a3b80379757fc4775c7beb9634aec0a011e 100644 --- a/lib/gpu/lal_base_dipole.cpp +++ b/lib/gpu/lal_base_dipole.cpp @@ -25,8 +25,8 @@ BaseDipoleT::BaseDipole() : _compiled(false), _max_bytes(0) { device=&global_device; ans=new Answer(); nbor=new Neighbor(); - pair_program=NULL; - ucl_device=NULL; + pair_program=nullptr; + ucl_device=nullptr; } template @@ -139,7 +139,7 @@ int * BaseDipoleT::reset_nbors(const int nall, const int inum, int *ilist, resize_atom(inum,nall,success); resize_local(inum,mn,success); if (!success) - return NULL; + return nullptr; nbor->get_host(inum,ilist,numj,firstneigh,block_size()); @@ -245,7 +245,7 @@ int** BaseDipoleT::compute(const int ago, const int inum_full, // Make sure textures are correct if realloc by a different hybrid style resize_atom(0,nall,success); zero_timers(); - return NULL; + return nullptr; } hd_balancer.balance(cpu_time); @@ -258,7 +258,7 @@ int** BaseDipoleT::compute(const int ago, const int inum_full, build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; atom->cast_q_data(host_q); atom->cast_quat_data(host_mu[0]); hd_balancer.start_timer(); diff --git a/lib/gpu/lal_base_dpd.cpp b/lib/gpu/lal_base_dpd.cpp index c0d7ad47bc37de4f597f6a5aa5c07b80a84f232e..e4fd80fcc3f79e21206f50de35a6e15d805e1681 100644 --- a/lib/gpu/lal_base_dpd.cpp +++ b/lib/gpu/lal_base_dpd.cpp @@ -25,8 +25,8 @@ BaseDPDT::BaseDPD() : _compiled(false), _max_bytes(0) { device=&global_device; ans=new Answer(); nbor=new Neighbor(); - pair_program=NULL; - ucl_device=NULL; + pair_program=nullptr; + ucl_device=nullptr; } template @@ -138,7 +138,7 @@ int * BaseDPDT::reset_nbors(const int nall, const int inum, int *ilist, resize_atom(inum,nall,success); resize_local(inum,mn,success); if (!success) - return NULL; + return nullptr; nbor->get_host(inum,ilist,numj,firstneigh,block_size()); @@ -245,7 +245,7 @@ int** BaseDPDT::compute(const int ago, const int inum_full, // Make sure textures are correct if realloc by a different hybrid style resize_atom(0,nall,success); zero_timers(); - return NULL; + return nullptr; } hd_balancer.balance(cpu_time); @@ -258,7 +258,7 @@ int** BaseDPDT::compute(const int ago, const int inum_full, build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; atom->cast_v_data(host_v,tag); hd_balancer.start_timer(); } else { diff --git a/lib/gpu/lal_base_ellipsoid.cpp b/lib/gpu/lal_base_ellipsoid.cpp index abc8807a8bc4d334d44906e6d63ae2ee3ee28864..524705ed4163255c75780f1329f8bc252a7c4ee4 100644 --- a/lib/gpu/lal_base_ellipsoid.cpp +++ b/lib/gpu/lal_base_ellipsoid.cpp @@ -33,10 +33,10 @@ BaseEllipsoidT::BaseEllipsoid() : _compiled(false), _max_bytes(0) { device=&global_device; ans=new Answer(); nbor=new Neighbor(); - nbor_program=NULL; - ellipsoid_program=NULL; - lj_program=NULL; - ucl_device=NULL; + nbor_program=nullptr; + ellipsoid_program=nullptr; + lj_program=nullptr; + ucl_device=nullptr; } template @@ -356,7 +356,7 @@ int* BaseEllipsoidT::compute(const int f_ago, const int inum_full, if (inum_full==0) { host_start=0; zero_timers(); - return NULL; + return nullptr; } int ago=hd_balancer.ago_first(f_ago); @@ -369,7 +369,7 @@ int* BaseEllipsoidT::compute(const int f_ago, const int inum_full, reset_nbors(nall, inum, inum_full, ilist, numj, host_type, firstneigh, success); if (!success) - return NULL; + return nullptr; } int *list; if (_multiple_forms) @@ -406,7 +406,7 @@ int** BaseEllipsoidT::compute(const int ago, const int inum_full, const int nall if (inum_full==0) { host_start=0; zero_timers(); - return NULL; + return nullptr; } hd_balancer.balance(cpu_time); @@ -420,7 +420,7 @@ int** BaseEllipsoidT::compute(const int ago, const int inum_full, const int nall build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; atom->cast_quat_data(host_quat[0]); hd_balancer.start_timer(); } else { diff --git a/lib/gpu/lal_base_three.cpp b/lib/gpu/lal_base_three.cpp index 0b4dbdc89a23bd64d6ea15224cd83e5ff71c9633..cfc138aea276d2add1741f5a301b07dbec2358a2 100644 --- a/lib/gpu/lal_base_three.cpp +++ b/lib/gpu/lal_base_three.cpp @@ -27,8 +27,8 @@ BaseThreeT::BaseThree() : _compiled(false), _max_bytes(0) { #ifdef THREE_CONCURRENT ans2=new Answer(); #endif - pair_program=NULL; - ucl_device=NULL; + pair_program=nullptr; + ucl_device=nullptr; } template @@ -176,7 +176,7 @@ int * BaseThreeT::reset_nbors(const int nall, const int inum, const int nlist, resize_atom(inum,nall,success); resize_local(nall,mn,success); if (!success) - return NULL; + return nullptr; _nall = nall; @@ -310,7 +310,7 @@ int ** BaseThreeT::compute(const int ago, const int inum_full, // Make sure textures are correct if realloc by a different hybrid style resize_atom(0,nall,success); zero_timers(); - return NULL; + return nullptr; } hd_balancer.balance(cpu_time); @@ -326,7 +326,7 @@ int ** BaseThreeT::compute(const int ago, const int inum_full, _max_nbors = build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; hd_balancer.start_timer(); } else { atom->cast_x_data(host_x,host_type); diff --git a/lib/gpu/lal_base_three.h b/lib/gpu/lal_base_three.h index 38af78b78ece17e14b4ef7b2cd38f83b3c3ecd37..36129e6168067dae3707f1edc16fc4b8ac42af1a 100644 --- a/lib/gpu/lal_base_three.h +++ b/lib/gpu/lal_base_three.h @@ -59,7 +59,7 @@ class BaseThree { const double gpu_split, FILE *screen, const void *pair_program, const char *k_two, const char *k_three_center, const char *k_three_end, - const char *k_short_nbor=NULL); + const char *k_short_nbor=nullptr); /// Estimate the overhead for GPU context changes and CPU driver void estimate_gpu_overhead(); diff --git a/lib/gpu/lal_device.cpp b/lib/gpu/lal_device.cpp index aaf74ed28c314bed0152667b43294ffe0055cae2..6c6a206307e1d3f55681274d317caf3b7ed32c30 100644 --- a/lib/gpu/lal_device.cpp +++ b/lib/gpu/lal_device.cpp @@ -72,7 +72,7 @@ int DeviceT::init_device(MPI_Comm world, MPI_Comm replica, const int first_gpu, // "0:generic" will select platform 0 and tune for generic device // "1:fermi" will select platform 1 and tune for Nvidia Fermi gpu if (ocl_vendor) { - char *sep = NULL; + char *sep = nullptr; if ((sep = strstr(ocl_vendor,":"))) { *sep = '\0'; _platform_id = atoi(ocl_vendor); @@ -182,7 +182,7 @@ template int DeviceT::set_ocl_params(char *ocl_vendor) { #ifdef USE_OPENCL std::string s_vendor=OCL_DEFAULT_VENDOR; - if (ocl_vendor!=NULL) + if (ocl_vendor!=nullptr) s_vendor=ocl_vendor; if (s_vendor=="none") s_vendor="generic"; @@ -215,14 +215,14 @@ int DeviceT::set_ocl_params(char *ocl_vendor) { int token_count=0; std::string params[13]; char *pch = strtok(ocl_vendor,","); - pch = strtok(NULL,","); - if (pch == NULL) return -11; - while (pch != NULL) { + pch = strtok(nullptr,","); + if (pch == nullptr) return -11; + while (pch != nullptr) { if (token_count==13) return -11; params[token_count]=pch; token_count++; - pch = strtok(NULL,","); + pch = strtok(nullptr,","); } _ocl_vendor_string+=" -DMEM_THREADS="+params[0]+ " -DTHREADS_PER_ATOM="+params[1]+ @@ -430,9 +430,9 @@ template void DeviceT::estimate_gpu_overhead(const int kernel_calls, double &gpu_overhead, double &gpu_driver_overhead) { - UCL_H_Vec *host_data_in=NULL, *host_data_out=NULL; - UCL_D_Vec *dev_data_in=NULL, *dev_data_out=NULL, *kernel_data=NULL; - UCL_Timer *timers_in=NULL, *timers_out=NULL, *timers_kernel=NULL; + UCL_H_Vec *host_data_in=nullptr, *host_data_out=nullptr; + UCL_D_Vec *dev_data_in=nullptr, *dev_data_out=nullptr, *kernel_data=nullptr; + UCL_Timer *timers_in=nullptr, *timers_out=nullptr, *timers_kernel=nullptr; UCL_Timer over_timer(*gpu); if (_data_in_estimate>0) { diff --git a/lib/gpu/lal_eam.cpp b/lib/gpu/lal_eam.cpp index 8c81353f364f8f9965114036c46f039b27404021..03479cd16a5f10cbb3be929cafac320725537165 100644 --- a/lib/gpu/lal_eam.cpp +++ b/lib/gpu/lal_eam.cpp @@ -380,7 +380,7 @@ int** EAMT::compute(const int ago, const int inum_full, const int nall, // Make sure textures are correct if realloc by a different hybrid style this->resize_atom(0,nall,success); this->zero_timers(); - return NULL; + return nullptr; } // load balance, returning the atom count on the device (inum) @@ -394,7 +394,7 @@ int** EAMT::compute(const int ago, const int inum_full, const int nall, this->build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; } else { this->atom->cast_x_data(host_x,host_type); this->atom->add_x_data(host_x,host_type); @@ -429,7 +429,7 @@ void EAMT::compute2(int *ilist, const bool eflag, const bool vflag, time_fp2.stop(); loop2(eflag,vflag); - if (ilist == NULL) + if (ilist == nullptr) this->ans->copy_answers(eflag,vflag,eatom,vatom); else this->ans->copy_answers(eflag,vflag,eatom,vatom, ilist); diff --git a/lib/gpu/lal_lj_tip4p_long.cpp b/lib/gpu/lal_lj_tip4p_long.cpp index bb848ad5c3aca1c6089f61be9cf6a9b0b5f7da18..1f3b32248c5ea0a34f8017c7422a7fb531871bb2 100644 --- a/lib/gpu/lal_lj_tip4p_long.cpp +++ b/lib/gpu/lal_lj_tip4p_long.cpp @@ -340,7 +340,7 @@ int** LJTIP4PLongT::compute(const int ago, const int inum_full, // Make sure textures are correct if realloc by a different hybrid style this->resize_atom(0,nall,success); this->zero_timers(); - return NULL; + return nullptr; } this->hd_balancer.balance(cpu_time); @@ -353,7 +353,7 @@ int** LJTIP4PLongT::compute(const int ago, const int inum_full, this->build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; this->atom->cast_q_data(host_q); this->hd_balancer.start_timer(); } else { diff --git a/lib/gpu/lal_neighbor.cpp b/lib/gpu/lal_neighbor.cpp index 3e128bcf57349d39399f5cf625e5f863186a3630..6c4890ef47f0a80069c481e9f780bd20fbb3edc5 100644 --- a/lib/gpu/lal_neighbor.cpp +++ b/lib/gpu/lal_neighbor.cpp @@ -158,7 +158,7 @@ void Neighbor::alloc(bool &success) { } _c_bytes+=nbor_host.device.row_bytes()+dev_numj_host.row_bytes(); } else { - // Some OpenCL implementations return errors for NULL pointers as args + // Some OpenCL implementations return errors for nullptr pointers as args nbor_host.device.view(dev_nbor); dev_numj_host.view(dev_nbor); } diff --git a/lib/gpu/lal_pppm.cpp b/lib/gpu/lal_pppm.cpp index 84d6c16e1430ae8919d2bad52b90464bd3eae5bf..6b5bf88ea53798c86d82ef7ee2590522ddf8b843 100644 --- a/lib/gpu/lal_pppm.cpp +++ b/lib/gpu/lal_pppm.cpp @@ -35,7 +35,7 @@ PPPMT::PPPM() : _allocated(false), _compiled(false), _max_bytes(0) { device=&global_device; ans=new Answer(); - pppm_program=NULL; + pppm_program=nullptr; } template diff --git a/lib/gpu/lal_pppm_ext.cpp b/lib/gpu/lal_pppm_ext.cpp index a75536eb19aa805a32c0fd307bc055896f7a80df..b826881392f8fef43b8166d9bf52b58dcfa23403 100644 --- a/lib/gpu/lal_pppm_ext.cpp +++ b/lib/gpu/lal_pppm_ext.cpp @@ -56,7 +56,7 @@ grdtyp * pppm_gpu_init(memtyp &pppm, const int nlocal, const int nall, } success=0; - grdtyp * host_brick=NULL; + grdtyp * host_brick=nullptr; if (world_me==0) host_brick=pppm.init(nlocal,nall,screen,order,nxlo_out,nylo_out,nzlo_out, nxhi_out,nyhi_out,nzhi_out,rho_coeff,vd_brick, @@ -129,7 +129,7 @@ double pppm_gpu_bytes_f() { void pppm_gpu_forces_f(double **f) { double etmp; PPPMF.atom->data_unavail(); - PPPMF.ans->get_answers(f,NULL,NULL,NULL,NULL,etmp); + PPPMF.ans->get_answers(f,nullptr,nullptr,nullptr,nullptr,etmp); } double * pppm_gpu_init_d(const int nlocal, const int nall, FILE *screen, @@ -173,6 +173,6 @@ double pppm_gpu_bytes_d() { void pppm_gpu_forces_d(double **f) { double etmp; PPPMD.atom->data_unavail(); - PPPMD.ans->get_answers(f,NULL,NULL,NULL,NULL,etmp); + PPPMD.ans->get_answers(f,nullptr,nullptr,nullptr,nullptr,etmp); } diff --git a/lib/gpu/lal_yukawa_colloid.cpp b/lib/gpu/lal_yukawa_colloid.cpp index e71e962ffdf558fb0b0fb8ed0050820d86bbd05a..46d4d6432847b1415018c0b533d770a2d454d968 100644 --- a/lib/gpu/lal_yukawa_colloid.cpp +++ b/lib/gpu/lal_yukawa_colloid.cpp @@ -213,7 +213,7 @@ int** YukawaColloidT::compute(const int ago, const int inum_full, const int nall // Make sure textures are correct if realloc by a different hybrid style this->resize_atom(0,nall,success); this->zero_timers(); - return NULL; + return nullptr; } // load balance, returning the atom count on the device (inum) @@ -227,7 +227,7 @@ int** YukawaColloidT::compute(const int ago, const int inum_full, const int nall this->build_nbor_list(inum, inum_full-inum, nall, host_x, host_type, sublo, subhi, tag, nspecial, special, success); if (!success) - return NULL; + return nullptr; this->cast_rad_data(rad); this->hd_balancer.start_timer(); } else { diff --git a/lib/message/cslib/src/STUBS_ZMQ/zmq.h b/lib/message/cslib/src/STUBS_ZMQ/zmq.h index a335ee5e01f43e0725a15bc03c90d977e0b02666..98cb937ed1d79c783ddca51db9cde3b828d069a2 100644 --- a/lib/message/cslib/src/STUBS_ZMQ/zmq.h +++ b/lib/message/cslib/src/STUBS_ZMQ/zmq.h @@ -24,10 +24,10 @@ namespace CSLIB_NS { #define ZMQ_REQ 0 #define ZMQ_REP 0 -static void *zmq_ctx_new() {return NULL;} -static void *zmq_connect(void *, char *) {return NULL;} +static void *zmq_ctx_new() {return nullptr;} +static void *zmq_connect(void *, char *) {return nullptr;} static int zmq_bind(void *, char *) {return 0;} -static void *zmq_socket(void *,int) {return NULL;} +static void *zmq_socket(void *,int) {return nullptr;} static void zmq_close(void *) {} static void zmq_ctx_destroy(void *) {} static void zmq_send(void *, void *, int, int) {} diff --git a/lib/message/cslib/src/cslib.cpp b/lib/message/cslib/src/cslib.cpp index 7c75a399290e1727c562f3bdc18cfbe1d6e80a4c..20292329ac9250ff9ba110886ea3165869979217 100644 --- a/lib/message/cslib/src/cslib.cpp +++ b/lib/message/cslib/src/cslib.cpp @@ -57,7 +57,7 @@ CSlib::CSlib(int csflag, const char *mode, const void *ptr, const void *pcomm) else if (csflag == 1) server = 1; else error_all("constructor(): Invalid client/server arg"); - if (pcomm == NULL) { + if (pcomm == nullptr) { me = 0; nprocs = 1; @@ -82,19 +82,19 @@ CSlib::CSlib(int csflag, const char *mode, const void *ptr, const void *pcomm) } maxfield = 0; - fieldID = fieldtype = fieldlen = fieldoffset = NULL; + fieldID = fieldtype = fieldlen = fieldoffset = nullptr; maxheader = 0; - header = NULL; + header = nullptr; maxbuf = 0; - buf = NULL; + buf = nullptr; - recvcounts = displs = NULL; + recvcounts = displs = nullptr; maxglobal = 0; - allids = NULL; + allids = nullptr; maxfieldbytes = 0; - fielddata = NULL; + fielddata = nullptr; - pad = "\0\0\0\0\0\0\0"; // just length 7 since will have trailing NULL + pad = "\0\0\0\0\0\0\0"; // just length 7 since will have trailing nullptr nsend = nrecv = 0; } @@ -218,7 +218,7 @@ void CSlib::pack_parallel(int id, int ftype, // nlocal datums, each of nper length, from all procs // final data in buf = datums for all natoms, ordered by ids - if (recvcounts == NULL) { + if (recvcounts == nullptr) { recvcounts = (int *) smalloc(nprocs*sizeof(int)); displs = (int *) smalloc(nprocs*sizeof(int)); } @@ -706,9 +706,9 @@ void CSlib::deallocate_fields() void *CSlib::smalloc(int nbytes) { - if (nbytes == 0) return NULL; + if (nbytes == 0) return nullptr; void *ptr = malloc(nbytes); - if (ptr == NULL) { + if (ptr == nullptr) { char str[128]; sprintf(str,"malloc(): Failed to allocate %d bytes",nbytes); error_one(str); @@ -722,11 +722,11 @@ void *CSlib::srealloc(void *ptr, int nbytes) { if (nbytes == 0) { sfree(ptr); - return NULL; + return nullptr; } ptr = realloc(ptr,nbytes); - if (ptr == NULL) { + if (ptr == nullptr) { char str[128]; sprintf(str,"realloc(): Failed to reallocate %d bytes",nbytes); error_one(str); @@ -738,7 +738,7 @@ void *CSlib::srealloc(void *ptr, int nbytes) void CSlib::sfree(void *ptr) { - if (ptr == NULL) return; + if (ptr == nullptr) return; free(ptr); } diff --git a/lib/message/cslib/src/cslib_wrap.cpp b/lib/message/cslib/src/cslib_wrap.cpp index 64b4d53b25fbb297c9cc85cc8860086f4ff6d6dc..cb132c2382a208575f03dfd73d015a6b65216327 100644 --- a/lib/message/cslib/src/cslib_wrap.cpp +++ b/lib/message/cslib/src/cslib_wrap.cpp @@ -44,7 +44,7 @@ void cslib_open_fortran(int csflag, const char *mode, const char *str, const void *pcomm, void **csptr) { MPI_Comm ccomm; - void *pccomm = NULL; + void *pccomm = nullptr; if (pcomm) { MPI_Fint *fcomm = (MPI_Fint *) pcomm; diff --git a/lib/message/cslib/src/msg.cpp b/lib/message/cslib/src/msg.cpp index ff654ecbcf17d740e78dd7f74b4cfedd5bcab649..dcd78fb7399abe06e49e53ef7e428e71a3c84741 100644 --- a/lib/message/cslib/src/msg.cpp +++ b/lib/message/cslib/src/msg.cpp @@ -80,9 +80,9 @@ void Msg::allocate(int nheader, int &maxheader, int *&header, void *Msg::smalloc(int nbytes) { - if (nbytes == 0) return NULL; + if (nbytes == 0) return nullptr; void *ptr = (void *) malloc(nbytes); - if (ptr == NULL) { + if (ptr == nullptr) { char str[128]; sprintf(str,"Failed to allocate %d bytes",nbytes); } @@ -93,7 +93,7 @@ void *Msg::smalloc(int nbytes) void Msg::sfree(void *ptr) { - if (ptr == NULL) return; + if (ptr == nullptr) return; free(ptr); } diff --git a/lib/message/cslib/src/msg_mpi_two.cpp b/lib/message/cslib/src/msg_mpi_two.cpp index 2a4fa65ff75d1ce8e1991fb8c16db932d462590e..d365e20849aab51866e2b1fa069bf52fc02058b9 100644 --- a/lib/message/cslib/src/msg_mpi_two.cpp +++ b/lib/message/cslib/src/msg_mpi_two.cpp @@ -52,7 +52,7 @@ void MsgMPITwo::init(char *filename) { if (client) { if (me == 0) { - FILE *fp = NULL; + FILE *fp = nullptr; while (!fp) { fp = fopen(filename,"r"); if (!fp) sleep(1); diff --git a/lib/message/cslib/src/msg_zmq.cpp b/lib/message/cslib/src/msg_zmq.cpp index 8bee3aebde6e1f710787c2722c7336446896e0f4..07920c6b5c3f5d68bbe7db4ae35eaa934790fbe6 100644 --- a/lib/message/cslib/src/msg_zmq.cpp +++ b/lib/message/cslib/src/msg_zmq.cpp @@ -99,12 +99,12 @@ void MsgZMQ::send(int nheader, int *header, int nbuf, char *buf) if (me == 0) { zmq_send(socket,lengths,2*sizeof(int),0); - zmq_recv(socket,NULL,0,0); + zmq_recv(socket,nullptr,0,0); } if (me == 0) { zmq_send(socket,header,nheader*sizeof(int),0); - zmq_recv(socket,NULL,0,0); + zmq_recv(socket,nullptr,0,0); } if (me == 0) zmq_send(socket,buf,nbuf,0); @@ -125,7 +125,7 @@ void MsgZMQ::recv(int &maxheader, int *&header, int &maxbuf, char *&buf) { if (me == 0) { zmq_recv(socket,lengths,2*sizeof(int),0); - zmq_send(socket,NULL,0,0); + zmq_send(socket,nullptr,0,0); } if (nprocs > 1) MPI_Bcast(lengths,2,MPI_INT,0,world); @@ -135,7 +135,7 @@ void MsgZMQ::recv(int &maxheader, int *&header, int &maxbuf, char *&buf) if (me == 0) { zmq_recv(socket,header,nheader*sizeof(int),0); - zmq_send(socket,NULL,0,0); + zmq_send(socket,nullptr,0,0); } if (nprocs > 1) MPI_Bcast(header,nheader,MPI_INT,0,world); diff --git a/lib/molfile/molfile_plugin.h b/lib/molfile/molfile_plugin.h index 057c403369507b243c07348f87bba8f84091734a..491cd375bb4ef2916825b2bec03fc85ca4153c2f 100644 --- a/lib/molfile/molfile_plugin.h +++ b/lib/molfile/molfile_plugin.h @@ -11,7 +11,7 @@ * * $RCSfile: molfile_plugin.h,v $ * $Author: johns $ $Locker: $ $State: Exp $ - * $Revision: 1.108 $ $Date: 2016/02/26 03:17:01 $ + * $Revision: 1.112 $ $Date: 2019/10/17 06:12:24 $ * ***************************************************************************/ @@ -111,7 +111,7 @@ typedef struct { char resname[8]; /**< required residue name string */ int resid; /**< required integer residue ID */ char segid[8]; /**< required segment name string, or "" */ -#if 0 && vmdplugin_ABIVERSION > 17 +#if 0 && vmdplugin_ABIVERSION > 10000 /* The new PDB file formats allows for much larger structures, */ /* which can therefore require longer chain ID strings. The */ /* new PDBx/mmCIF file formats do not have length limits on */ @@ -187,8 +187,53 @@ typedef struct molfile_timestep_metadata { int has_velocities; /**< if timesteps have velocities */ } molfile_timestep_metadata_t; + /* - * Per-timestep atom coordinates and periodic cell information + * + * Per-timestep atom coordinates, velocities, forces, energies, + * and periodic cell information + * + */ + +#if 0 +/** + * Periodically stored energies of various kinds + */ +typedef struct { + int energyflags; // XXX indicate use and semantics of data fields + + double total_energy; // XXX these copied from DESRES_READ_TIMESTEP2 case + double potential_energy; + double kinetic_energy; + double extended_energy; + double force_energy; + double total_pressure; + + // Alchemical free energy methods need to store individual energy samples. + // We don't really want pre-averaged quantities, they lead to problems later. + double lambda; // data gen sim parm: + aux scheduling + soft core parm + double temperature; // temp set by thermostat + // either we use deltaU, or we store U and Uprime... + double deltaU; // Ulambda - Ulambdaprime + double Ulambda; // U for lambda + double Ulambdaprime; // U for lambdaprime + + // IDWS methods + // XXX both values of lambdaprime and required de-interleaving information + + // Replica exchange methods + // XXX rectangle sample params? + + // REST2 method + // XXX + +} molfile_energies_t; +#endif + + +/** + * Per-timestep atom coordinates, velocities, time, energies + * and periodic cell info */ typedef struct { float *coords; /**< coordinates of all atoms, arranged xyzxyzxyz */ @@ -662,7 +707,7 @@ typedef struct { int **bondtype, int *nbondtypes, char ***bondtypename); /** - * XXX this function will be augmented and possibly superseded by a + * XXX this function will be augmented and possibly superceded by a * new QM-capable version named read_timestep(), when finished. * * Read the next timestep from the file. Return MOLFILE_SUCCESS, or @@ -839,6 +884,29 @@ typedef struct { int (* read_qm_rundata)(void *, molfile_qm_t *qmdata); + /** + * Query the molfile plugin to determine whether or not memory + * allocations used for atomic coordinates and PBC unit cell information + * need to be aligned to a particular virtual memory or filesystem + * page size boundary to facilitate kernel-bypass unbuffered I/O, + * e.g., as used by jsplugin. This API should be called prior to the + * first call to read a timestep. The required page alignment size + * (in bytes) is returned to the caller. If this API has not been + * called, then the molfile plugin should revert to standard + * kernel-buffered I/O and suffer the associated performance loss. + * The caller can be assured that the plugin will not request any + * page alignment size that is greater than the value of + * MOLFILE_DIRECTIO_MAX_BLOCK_SIZE, both as a runtime sanity check, + * and to ensure that a caller that is unable to perform the max + * aligned allocation doesn't call the API in the first place. + * If a page-aligned allocation is not required for the file being read, + * the plugin will return an alignment size of 1. + */ +#if vmdplugin_ABIVERSION > 17 + int (* read_timestep_pagealign_size)(void *, int *pagealignsize); +#endif + + /** * Read the next timestep from the file. Return MOLFILE_SUCCESS, or * MOLFILE_EOF on EOF. If the molfile_timestep_t or molfile_qm_metadata_t @@ -862,6 +930,25 @@ typedef struct { int (* read_timestep_metadata)(void *, molfile_timestep_metadata_t *); int (* read_qm_timestep_metadata)(void *, molfile_qm_timestep_metadata_t *); + +#if defined(EXPERIMENTAL_DIRECTIO_APIS) + /** + * Calculate file offsets and I/O lengths for performing + * kernel-bypass direct I/O or using GPU-Direct Storage APIs, + * thereby enabling peak I/O rates to be achieved for analysis + * worksloads like clustering of trajectories. + */ + int (* calc_fileoffsets_timestep)(void *, + molfile_ssize_t frameindex, + int firstatom, + int lastatom, + int *firstatom, + int *pageoffset, + molfile_ssize_t *startoffset, + molfile_ssize_t *readlen); +#endif + + #if defined(DESRES_READ_TIMESTEP2) /** * Read a specified timestep! diff --git a/lib/molfile/vmdplugin.h b/lib/molfile/vmdplugin.h index 842d1e431c67238c5849ff5026a2f3c28ec5dd97..7afc358e97c8bf2d7586412f752ea4175a1f5e1f 100644 --- a/lib/molfile/vmdplugin.h +++ b/lib/molfile/vmdplugin.h @@ -11,7 +11,7 @@ * * $RCSfile: vmdplugin.h,v $ * $Author: johns $ $Locker: $ $State: Exp $ - * $Revision: 1.33 $ $Date: 2015/10/29 05:10:54 $ + * $Revision: 1.34 $ $Date: 2018/05/02 03:12:56 $ * ***************************************************************************/ @@ -144,7 +144,7 @@ typedef struct { /** * Use this macro to initialize the abiversion member of each plugin */ -#define vmdplugin_ABIVERSION 17 +#define vmdplugin_ABIVERSION 18 /*@{*/ /** Use this macro to indicate a plugin's thread-safety at registration time */ diff --git a/lib/poems/SystemProcessor.h b/lib/poems/SystemProcessor.h index 4fc8785dd7b78beab49010e9adab671ced362009..f009794f6666292a08aa8de2f5e0cfc96ddae2bf 100644 --- a/lib/poems/SystemProcessor.h +++ b/lib/poems/SystemProcessor.h @@ -110,21 +110,21 @@ void SystemProcessor::processArray(int** links, int numLinks) do { currentNode = findSingleLink(temp); //find the start of the next available chain - if(currentNode != NULL) + if(currentNode != nullptr) { headsOfSystems.Append(AddNewChain(currentNode)); //and add it to the headsOfSystems list of chains } } - while(currentNode != NULL); //repeat this until all chains have been added + while(currentNode != nullptr); //repeat this until all chains have been added } POEMSChain * SystemProcessor::AddNewChain(POEMSNode * currentNode){ - if(currentNode == NULL) //Termination condition; if the currentNode is null, then return null + if(currentNode == nullptr) //Termination condition; if the currentNode is null, then return null { - return NULL; + return nullptr; } int * tmp; - POEMSNode * nextNode = NULL; //nextNode stores the proposed next node to add to the chain. this will be checked to make sure no backtracking is occurring before being assigned as the current node. + POEMSNode * nextNode = nullptr; //nextNode stores the proposed next node to add to the chain. this will be checked to make sure no backtracking is occurring before being assigned as the current node. POEMSChain * newChain = new POEMSChain; //make a new POEMSChain object. This will be the object returned if(currentNode->links.GetNumElements() == 0) //if we have no links from this node, then the whole chain is only one node. Add this node to the chain and return it; mark node as visited for future reference @@ -168,8 +168,8 @@ POEMSChain * SystemProcessor::AddNewChain(POEMSNode * currentNode){ newChain->listOfNodes.Append(tmp); //append the last node before branch (node shared jointly with branch chains) //re-mark as visited, just to make sure ListElement * tempNode = currentNode->links.GetHeadElement(); //go through all of the links, one at a time that branch - POEMSChain * tempChain = NULL; //temporary variable to hold data - while(tempNode != NULL) //when we have followed all links, stop + POEMSChain * tempChain = nullptr; //temporary variable to hold data + while(tempNode != nullptr) //when we have followed all links, stop { if(setLinkVisited(tempNode->value, currentNode)) //dont backtrack, or create closed loops { @@ -187,12 +187,12 @@ POEMSNode * SystemProcessor::findSingleLink(TreeNode * aNode) //This function takes the root of a search tree containing POEMSNodes and returns a POEMSNode corresponding to the start of a chain in the //system. It finds a node that has not been visited before, and only has one link; this node will be used as the head of the chain. { - if(aNode == NULL) + if(aNode == nullptr) { - return NULL; + return nullptr; } POEMSNode * returnVal = (POEMSNode *)aNode->GetAuxData(); //get the poemsnode data out of the treenode - POEMSNode * detectLoneLoops = NULL; //is used to handle a loop that has no protruding chains + POEMSNode * detectLoneLoops = nullptr; //is used to handle a loop that has no protruding chains if(returnVal->visited == false) { detectLoneLoops = returnVal; //if we find any node that has not been visited yet, save it @@ -202,15 +202,15 @@ POEMSNode * SystemProcessor::findSingleLink(TreeNode * aNode) return returnVal; //return the node is it meets this criteria } returnVal = findSingleLink(aNode->Left()); //otherwise, check the left subtree - if(returnVal == NULL) //and if we find nothing... + if(returnVal == nullptr) //and if we find nothing... { returnVal = findSingleLink(aNode->Right()); //check the right subtree } - if(returnVal == NULL) //if we could not find any chains + if(returnVal == nullptr) //if we could not find any chains { returnVal = detectLoneLoops; //see if we found any nodes at all that havent been processed } - return returnVal; //return what we find (will be NULL if no new chains are + return returnVal; //return what we find (will be a null pointer if no new chains are //found) } @@ -226,7 +226,7 @@ bool SystemProcessor::setLinkVisited(POEMSNode * firstNode, POEMSNode * secondNo //cout << "Checking link between nodes " << firstNode->idNumber << " and " << secondNode->idNumber << "... "; ListElement * tmp = firstNode->links.GetHeadElement(); //get the head element of the list of pointers for node 1 ListElement * tmp2 = firstNode->taken.GetHeadElement(); //get the head element of the list of bool isVisited flags for node 1 - while(tmp->value != NULL || tmp2->value != NULL) //go through until we reach the end of the lists + while(tmp->value != nullptr || tmp2->value != nullptr) //go through until we reach the end of the lists { if(tmp->value == secondNode) //if we find the link to the other node { @@ -248,7 +248,7 @@ bool SystemProcessor::setLinkVisited(POEMSNode * firstNode, POEMSNode * secondNo tmp = secondNode->links.GetHeadElement(); //now, if the link was unvisited, we need to go set the other node's list such that //it also knows this link is being visited tmp2 = secondNode->taken.GetHeadElement(); - while(tmp->value != NULL || tmp2->value != NULL) //go through the list + while(tmp->value != nullptr || tmp2->value != nullptr) //go through the list { if(tmp->value == firstNode) //if we find the link { diff --git a/lib/poems/poemsnodelib.h b/lib/poems/poemsnodelib.h index 446fa2013f85bface2d6b88c9df37ccf70841f73..04f0f4b79b96752a3ad885014fa2858ebffeb1dc 100644 --- a/lib/poems/poemsnodelib.h +++ b/lib/poems/poemsnodelib.h @@ -23,7 +23,7 @@ using namespace std; -TreeNode *GetTreeNode(int item,TreeNode *lptr = NULL,TreeNode *rptr =NULL); +TreeNode *GetTreeNode(int item,TreeNode *lptr = nullptr,TreeNode *rptr =nullptr); void FreeTreeNode(TreeNode *p); @@ -46,7 +46,7 @@ void PrintTree (TreeNode *t, int level); void Postorder (TreeNode *t, void visit(TreeNode* &t)) { // the recursive scan terminates on a empty subtree - if (t != NULL) + if (t != nullptr) { Postorder(t->Left(), visit); // descend left Postorder(t->Right(), visit); // descend right @@ -59,7 +59,7 @@ void Postorder (TreeNode *t, void visit(TreeNode* &t)) void Preorder (TreeNode *t, void visit(TreeNode* &t)) { // the recursive scan terminates on a empty subtree - if (t != NULL) + if (t != nullptr) { visit(t); // visit the node Preorder(t->Left(), visit); // descend left @@ -69,7 +69,7 @@ void Preorder (TreeNode *t, void visit(TreeNode* &t)) //create TreeNode object with pointer fields lptr and rptr -// The pointers have default value NULL +// The pointers have default value nullptr TreeNode *GetTreeNode(int item,TreeNode *lptr,TreeNode *rptr) { TreeNode *p; @@ -79,7 +79,7 @@ TreeNode *GetTreeNode(int item,TreeNode *lptr,TreeNode *rptr) p = new TreeNode(item, lptr, rptr); // if insufficient memory, terminatewith an error message - if (p == NULL) + if (p == nullptr) { cerr << "Memory allocation failure!\n"; exit(1); @@ -103,14 +103,14 @@ void FreeTreeNode(TreeNode *p) void CountLeaf (TreeNode *t, int& count) { //use postorder descent - if(t !=NULL) + if(t !=nullptr) { CountLeaf(t->Left(), count); // descend left CountLeaf(t->Right(), count); // descend right // check if node t is a leaf node (no descendants) // if so, increment the variable count - if (t->Left() == NULL && t->Right() == NULL) + if (t->Left() == nullptr && t->Right() == nullptr) count++; } } @@ -124,7 +124,7 @@ int Depth (TreeNode *t) { int depthLeft, depthRight, depthval; - if (t == NULL) + if (t == nullptr) depthval = -1; else { @@ -145,8 +145,8 @@ void IndentBlanks(int num) void PrintTree (TreeNode *t, int level) { - //print tree with root t, as long as t!=NULL - if (t != NULL) + //print tree with root t, as long as t!=nullptr + if (t != nullptr) { int indentUnit = 5; // print right branch of tree t diff --git a/lib/poems/poemstree.h b/lib/poems/poemstree.h index ee07a33255e69c5603cd527f47110415ed70b4f3..cb9499cfd48c959e1fb7ac8886ec4c075eb85938 100644 --- a/lib/poems/poemstree.h +++ b/lib/poems/poemstree.h @@ -82,7 +82,7 @@ public: DeleteAuxData = callback; } - void Insert(const int& item, const int& data, void * AuxData = NULL); + void Insert(const int& item, const int& data, void * AuxData = nullptr); void Delete(const int& item); void AVLInsert(TreeNode* &tree, TreeNode* newNode, int &reviseBalanceFactor); void ClearList(void); @@ -99,7 +99,7 @@ Tree::Tree(void) root = 0; current = 0; size = 0; - DeleteAuxData = NULL; + DeleteAuxData = nullptr; } @@ -131,18 +131,18 @@ Tree& Tree::operator = (const Tree& rhs) } // search for data item in the tree. if found, return its node -// address and a pointer to its parent; otherwise, return NULL +// address and a pointer to its parent; otherwise, return a null pointer TreeNode *Tree::FindNode(const int& item, TreeNode* & parent) const { // cycle t through the tree starting with root TreeNode *t = root; - // the parent of the root is NULL - parent = NULL; + // the parent of the root is a null pointer + parent = nullptr; // terminate on empty subtree - while(t != NULL) + while(t != nullptr) { // stop on a match if (item == t->data) @@ -158,7 +158,7 @@ TreeNode *Tree::FindNode(const int& item, } } - // return pointer to node; NULL if not found + // return pointer to node; a null pointer if not found return t; } @@ -172,14 +172,14 @@ void * Tree::Find(int& item) current = FindNode (item, parent); // if item found, assign data to item and return True - if (current != NULL) + if (current != nullptr) { item = current->data; return current->GetAuxData(); } else - // item not found in the tree. return False - return NULL; + // item not found in the tree. return a null pointer + return nullptr; } @@ -194,7 +194,7 @@ void Tree::Insert(const int& item, const int& data, void * AuxData) int reviseBalanceFactor = 0; // get a new AVL tree node with empty pointer fields - newNode = GetTreeNode(item,NULL,NULL); + newNode = GetTreeNode(item,nullptr,nullptr); newNode->data = data; newNode->SetAuxData(AuxData); // call recursive routine to actually insert the element @@ -213,7 +213,7 @@ void Tree::AVLInsert(TreeNode *&tree, TreeNode *newNode, int &reviseBalanceFacto int rebalanceCurrNode; // scan reaches an empty tree; time to insert the new node - if (tree == NULL) + if (tree == nullptr) { // update the parent to point at newNode tree = newNode; @@ -456,16 +456,16 @@ void Tree::Delete(const int& item) // search for a node containing data value item. obtain its // node address and that of its parent - if ((DNodePtr = FindNode (item, PNodePtr)) == NULL) + if ((DNodePtr = FindNode (item, PNodePtr)) == nullptr) return; - // If D has NULL pointer, the + // If D has null pointer, the // replacement node is the one on the other branch - if (DNodePtr->right == NULL) + if (DNodePtr->right == nullptr) RNodePtr = DNodePtr->left; - else if (DNodePtr->left == NULL) + else if (DNodePtr->left == nullptr) RNodePtr = DNodePtr->right; - // Both pointers of DNodePtr are non-NULL + // Both pointers of DNodePtr are non-null pointers else { // Find and unlink replacement node for D @@ -483,7 +483,7 @@ void Tree::Delete(const int& item) // descend down right subtree of the left child of D // keeping a record of current node and its parent. // when we stop, we have found the replacement - while (RNodePtr->right != NULL) + while (RNodePtr->right != nullptr) { PofRNodePtr = RNodePtr; RNodePtr = RNodePtr; @@ -508,7 +508,7 @@ void Tree::Delete(const int& item) // complete the link to the parent node // deleting the root node. assign new root - if (PNodePtr == NULL) + if (PNodePtr == nullptr) root = RNodePtr; // attach R to the correct branch of P else if (DNodePtr->data < PNodePtr->data) @@ -529,7 +529,7 @@ void Tree::Delete(const int& item) // assign node value to item; otherwise, insert item in tree void Tree::Update(const int& item) { - if (current !=NULL && current->data == item) + if (current !=nullptr && current->data == item) current->data = item; else Insert(item, item); @@ -545,25 +545,25 @@ TreeNode *Tree::CopyTree(TreeNode *t) TreeNode *newlptr, *newrptr, *newnode; // stop the recursive scan when we arrive at an empty tree - if (t == NULL) - return NULL; + if (t == nullptr) + return nullptr; // CopyTree builds a new tree by scanning the nodes of t. // At each node in t, CopyTree checks for a left child. if - // present it makes a copy of left child or returns NULL. + // present it makes a copy of left child or returns a null pointer. // the algorithm similarly checks for a right child. // CopyTree builds a copy of node using GetTreeNode and // appends copy of left and right children to node. - if (t->Left() !=NULL) + if (t->Left() !=nullptr) newlptr = CopyTree(t->Left()); else - newlptr = NULL; + newlptr = nullptr; - if (t->Right() !=NULL) + if (t->Right() !=nullptr) newrptr = CopyTree(t->Right()); else - newrptr = NULL; + newrptr = nullptr; // Build new tree from the bottom up by building the two @@ -579,12 +579,12 @@ TreeNode *Tree::CopyTree(TreeNode *t) // the tree and delete each node at the visit operation void Tree::DeleteTree(TreeNode *t) { - if (t != NULL) { + if (t != nullptr) { DeleteTree(t->Left()); DeleteTree(t->Right()); void *aux = t->GetAuxData(); - if (aux != NULL) { - if (DeleteAuxData != NULL) { + if (aux != nullptr) { + if (DeleteAuxData != nullptr) { (*DeleteAuxData)(aux); } else { delete (TreeNode *) aux; @@ -595,11 +595,11 @@ void Tree::DeleteTree(TreeNode *t) } // call the function DeleteTree to deallocate the nodes. then -// set the root pointer back to NULL +// set the root pointer back to a null pointer void Tree::ClearTree(TreeNode * &t) { DeleteTree(t); - t = NULL; // root now NULL + t = nullptr; // root now a null pointer } // delete all nodes in list diff --git a/lib/poems/poemstreenode.cpp b/lib/poems/poemstreenode.cpp index 051e13d6e0a4c7e1a25bbd22d9143e3cae3a3d8e..0b475c0a85da29665bf92552f9b87c44f21fc9ed 100644 --- a/lib/poems/poemstreenode.cpp +++ b/lib/poems/poemstreenode.cpp @@ -18,7 +18,7 @@ #include "poemstreenode.h" // constructor; initialize the data and pointer fields -// The pointer value NULL assigns a empty subtree +// A null pointer value assigns a empty subtree TreeNode::TreeNode (const int & item, TreeNode *lptr,TreeNode *rptr, int balfac):data(item), left(lptr), right(rptr), balanceFactor(balfac) { diff --git a/lib/poems/solver.cpp b/lib/poems/solver.cpp index 67f5b607e3e06b419a3342ff63e6ea800275e29d..7b1e718b93aab4a958ba8bbe1dc827692e5435b1 100644 --- a/lib/poems/solver.cpp +++ b/lib/poems/solver.cpp @@ -45,7 +45,7 @@ Solver * Solver::GetSolver(SolverType solverToMake) //returning a pointer to a n switch((int)solverToMake) { case ONSOLVER: return new OnSolver(); - default: return NULL; + default: return nullptr; } } diff --git a/lib/poems/system.cpp b/lib/poems/system.cpp index 369213f7d0abdd59bf082eea910f293f19ad8121..23554f4117d03d69200efc02c3d03e3dc6359562 100644 --- a/lib/poems/system.cpp +++ b/lib/poems/system.cpp @@ -23,7 +23,7 @@ System::System(){ - mappings = NULL; + mappings = nullptr; } System::~System(){ @@ -238,7 +238,7 @@ void System::Create_DegenerateSystem(int& nfree, int*freelist, double *&masstota //-------------------------------------------------------------------------// // Declaring Temporary Entities //-------------------------------------------------------------------------// - Body* body = NULL; + Body* body = nullptr; Body* prev; Body* Inertial; Point* origin; @@ -246,7 +246,7 @@ void System::Create_DegenerateSystem(int& nfree, int*freelist, double *&masstota Point* point_CM; Point* point_p; Point* point_k; - Point* point_ch = NULL; + Point* point_ch = nullptr; Vect3 r1,r2,r3,v1,v2,v3; Mat3x3 IM, N, PKCK,PKCN ; ColMatrix qo, uo, q, qdot,w; @@ -391,7 +391,7 @@ void System::Create_System_LAMMPS(int numbodies, double *mass,double **inertia, // Declaring Temporary Entities //-------------------------------------------------------------------------// - Body* body = NULL; + Body* body = nullptr; Body* prev; Body* Inertial; Point* origin; @@ -399,7 +399,7 @@ void System::Create_System_LAMMPS(int numbodies, double *mass,double **inertia, Point* point_CM; Point* point_p; Point* point_k; - Point* point_ch = NULL; + Point* point_ch = nullptr; Vect3 r1,r2,r3,v1,v2,v3; Mat3x3 IM, N, PKCK,PKCN ; ColMatrix qo, uo, q, qdot,w; diff --git a/lib/poems/workspace.cpp b/lib/poems/workspace.cpp index 2b3257b0dd39fa051209ba16a2508fae987835fb..21819d4c02ede532b1f3726babf81ce06713fa4e 100644 --- a/lib/poems/workspace.cpp +++ b/lib/poems/workspace.cpp @@ -52,7 +52,7 @@ void Workspace::allocateNewSystem() { Workspace::Workspace(){ currentIndex = -1; maxAlloc = 0; - system = NULL; + system = nullptr; } Workspace::~Workspace(){ @@ -133,7 +133,7 @@ if(njoint){ int ttk = 0; - while(NodeValue != NULL) { + while(NodeValue != nullptr) { array = new int[NodeValue->value->listOfNodes.GetNumElements()]; arrayFromChain = NodeValue->value->listOfNodes.CreateArray(); numElementsInSystem = NodeValue->value->listOfNodes.GetNumElements(); @@ -200,7 +200,7 @@ System* Workspace::GetSystem(int index){ } } else{ - return NULL; + return nullptr; } } diff --git a/src/ASPHERE/compute_temp_asphere.cpp b/src/ASPHERE/compute_temp_asphere.cpp index 889563f617205bd5f80f916c947486f2c4a85430..2242fba026c9b8c45f565b8f150dbb35366535cb 100644 --- a/src/ASPHERE/compute_temp_asphere.cpp +++ b/src/ASPHERE/compute_temp_asphere.cpp @@ -38,7 +38,7 @@ enum{ROTATE,ALL}; ComputeTempAsphere::ComputeTempAsphere(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_bias(NULL), tbias(NULL), avec(NULL) + id_bias(nullptr), tbias(nullptr), avec(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute temp/asphere command"); @@ -49,7 +49,7 @@ ComputeTempAsphere::ComputeTempAsphere(LAMMPS *lmp, int narg, char **arg) : tempflag = 1; tempbias = 0; - id_bias = NULL; + id_bias = nullptr; mode = ALL; int iarg = 3; diff --git a/src/ASPHERE/pair_gayberne.cpp b/src/ASPHERE/pair_gayberne.cpp index 89350dd00f3858df6ff4fb28cefc8a614bd15829..3878f7e4de99508e042812df70ef88fc31bef256 100644 --- a/src/ASPHERE/pair_gayberne.cpp +++ b/src/ASPHERE/pair_gayberne.cpp @@ -461,20 +461,20 @@ void PairGayBerne::read_restart(FILE *fp) int i,j; int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { - if (me == 0) utils::sfread(FLERR,&setwell[i],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setwell[i],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setwell[i],1,MPI_INT,0,world); if (setwell[i]) { - if (me == 0) utils::sfread(FLERR,&well[i][0],sizeof(double),3,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&well[i][0],sizeof(double),3,fp,nullptr,error); MPI_Bcast(&well[i][0],3,MPI_DOUBLE,0,world); } for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -506,12 +506,12 @@ void PairGayBerne::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&gamma,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&upsilon,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mu,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&gamma,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&upsilon,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mu,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&gamma,1,MPI_DOUBLE,0,world); MPI_Bcast(&upsilon,1,MPI_DOUBLE,0,world); diff --git a/src/ASPHERE/pair_line_lj.cpp b/src/ASPHERE/pair_line_lj.cpp index 6397e77f5bf4c564015baedb2e424e0e0cd22782..ba565c592240ed49995f36c8ab7eb28059d2c45b 100644 --- a/src/ASPHERE/pair_line_lj.cpp +++ b/src/ASPHERE/pair_line_lj.cpp @@ -31,8 +31,8 @@ using namespace LAMMPS_NS; PairLineLJ::PairLineLJ(LAMMPS *lmp) : Pair(lmp) { dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; single_enable = 0; restartinfo = 0; diff --git a/src/ASPHERE/pair_resquared.cpp b/src/ASPHERE/pair_resquared.cpp index 81fb4d4b6ca1324556f89bcf767ff6c0b8910844..c234ce27bf7bb36644df47677af48d5b0a3c69d9 100644 --- a/src/ASPHERE/pair_resquared.cpp +++ b/src/ASPHERE/pair_resquared.cpp @@ -439,20 +439,20 @@ void PairRESquared::read_restart(FILE *fp) int i,j; int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { - if (me == 0) utils::sfread(FLERR,&setwell[i],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setwell[i],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setwell[i],1,MPI_INT,0,world); if (setwell[i]) { - if (me == 0) utils::sfread(FLERR,&well[i][0],sizeof(double),3,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&well[i][0],sizeof(double),3,fp,nullptr,error); MPI_Bcast(&well[i][0],3,MPI_DOUBLE,0,world); } for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -480,8 +480,8 @@ void PairRESquared::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); diff --git a/src/ASPHERE/pair_tri_lj.cpp b/src/ASPHERE/pair_tri_lj.cpp index cf89cf9d33ed57a0648e00c490fbe7e961792fd0..79253140c0553f197bbf70542b14cb4160b66b7d 100644 --- a/src/ASPHERE/pair_tri_lj.cpp +++ b/src/ASPHERE/pair_tri_lj.cpp @@ -32,8 +32,8 @@ using namespace LAMMPS_NS; PairTriLJ::PairTriLJ(LAMMPS *lmp) : Pair(lmp) { dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; single_enable = 0; restartinfo = 0; diff --git a/src/BODY/body_nparticle.cpp b/src/BODY/body_nparticle.cpp index e63d50f81473339aa6728c46fae0677693d24184..2619f0cf1b79fad9ce8b664a196c2d52b5769819 100644 --- a/src/BODY/body_nparticle.cpp +++ b/src/BODY/body_nparticle.cpp @@ -30,7 +30,7 @@ enum{SPHERE,LINE,TRI}; // also in DumpImage /* ---------------------------------------------------------------------- */ BodyNparticle::BodyNparticle(LAMMPS *lmp, int narg, char **arg) : - Body(lmp, narg, arg), imflag(NULL), imdata(NULL) + Body(lmp, narg, arg), imflag(nullptr), imdata(nullptr) { if (narg != 3) error->all(FLERR,"Invalid body nparticle command"); @@ -194,7 +194,7 @@ void BodyNparticle::data_body(int ibonus, int ninteger, int ndouble, /* ---------------------------------------------------------------------- pack data struct for one body into buf for writing to data file - if buf is NULL, just return buffer size + if buf is nullptr, just return buffer size ------------------------------------------------------------------------- */ int BodyNparticle::pack_data_body(tagint atomID, int ibonus, double *buf) diff --git a/src/BODY/body_rounded_polygon.cpp b/src/BODY/body_rounded_polygon.cpp index c43484dca227d84904426c994ba855943938d94e..c7d006c67f770fc40471115e09f1adccce6261f6 100644 --- a/src/BODY/body_rounded_polygon.cpp +++ b/src/BODY/body_rounded_polygon.cpp @@ -321,7 +321,7 @@ void BodyRoundedPolygon::data_body(int ibonus, int ninteger, int ndouble, /* ---------------------------------------------------------------------- pack data struct for one body into buf for writing to data file - if buf is NULL, just return buffer size + if buf is a null pointer, just return buffer size ------------------------------------------------------------------------- */ int BodyRoundedPolygon::pack_data_body(tagint atomID, int ibonus, double *buf) diff --git a/src/BODY/body_rounded_polyhedron.cpp b/src/BODY/body_rounded_polyhedron.cpp index 18fd65c1dd281f9fb32ae495d3a59560069f0712..423a3b344369b5da4d8b56f27acb58a9bf5aad22 100644 --- a/src/BODY/body_rounded_polyhedron.cpp +++ b/src/BODY/body_rounded_polyhedron.cpp @@ -122,7 +122,7 @@ int BodyRoundedPolyhedron::nfaces(AtomVecBody::Bonus *bonus) double *BodyRoundedPolyhedron::faces(AtomVecBody::Bonus *bonus) { int nvertices = bonus->ivalue[0]; - if (nvertices == 1 || nvertices == 2) return NULL; + if (nvertices == 1 || nvertices == 2) return nullptr; return bonus->dvalue+3*nsub(bonus)+2*nedges(bonus); } @@ -373,7 +373,7 @@ void BodyRoundedPolyhedron::data_body(int ibonus, int ninteger, int ndouble, /* ---------------------------------------------------------------------- pack data struct for one body into buf for writing to data file - if buf is NULL, just return buffer size + if buf is a null pointer, just return buffer size ------------------------------------------------------------------------- */ int BodyRoundedPolyhedron::pack_data_body(tagint atomID, int ibonus, double *buf) diff --git a/src/BODY/compute_body_local.cpp b/src/BODY/compute_body_local.cpp index cf570d71a3d686ada151eef32f69a17c6d9b03e8..940250d160281c6889fcdae3e8c7ac2fa7de8f32 100644 --- a/src/BODY/compute_body_local.cpp +++ b/src/BODY/compute_body_local.cpp @@ -31,7 +31,7 @@ enum{ID,TYPE,INDEX}; /* ---------------------------------------------------------------------- */ ComputeBodyLocal::ComputeBodyLocal(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), which(NULL), index(NULL), avec(NULL), bptr(NULL) + Compute(lmp, narg, arg), which(nullptr), index(nullptr), avec(nullptr), bptr(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute body/local command"); @@ -66,8 +66,8 @@ ComputeBodyLocal::ComputeBodyLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; nmax = 0; - vector = NULL; - array = NULL; + vector = nullptr; + array = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/BODY/compute_temp_body.cpp b/src/BODY/compute_temp_body.cpp index 18c301678a606e0f895672906fa4aea415e3141f..6903f7a25c1ffa2a43d7c00da22b5a0536ed8fa4 100644 --- a/src/BODY/compute_temp_body.cpp +++ b/src/BODY/compute_temp_body.cpp @@ -36,7 +36,7 @@ enum{ROTATE,ALL}; /* ---------------------------------------------------------------------- */ ComputeTempBody::ComputeTempBody(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), id_bias(NULL), tbias(NULL), avec(NULL) + Compute(lmp, narg, arg), id_bias(nullptr), tbias(nullptr), avec(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute temp/body command"); @@ -47,7 +47,7 @@ ComputeTempBody::ComputeTempBody(LAMMPS *lmp, int narg, char **arg) : tempflag = 1; tempbias = 0; - id_bias = NULL; + id_bias = nullptr; mode = ALL; int iarg = 3; diff --git a/src/BODY/fix_wall_body_polygon.cpp b/src/BODY/fix_wall_body_polygon.cpp index ccfd37bbb2041c348e63914ef1ea7eb68b258065..2e69f70af798226707bb12b8f58fafe917832b9c 100644 --- a/src/BODY/fix_wall_body_polygon.cpp +++ b/src/BODY/fix_wall_body_polygon.cpp @@ -133,15 +133,15 @@ FixWallBodyPolygon::FixWallBodyPolygon(LAMMPS *lmp, int narg, char **arg) : time_origin = update->ntimestep; dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; edmax = ednummax = 0; - edge = NULL; - ednum = edfirst = NULL; + edge = nullptr; + ednum = edfirst = nullptr; - enclosing_radius = NULL; - rounded_radius = NULL; + enclosing_radius = nullptr; + rounded_radius = nullptr; } /* ---------------------------------------------------------------------- */ @@ -226,7 +226,7 @@ void FixWallBodyPolygon::post_force(int /*vflag*/) // dx,dy,dz = signed distance from wall // for rotating cylinder, reset vwall based on particle position // skip atom if not close enough to wall - // if wall was set to NULL, it's skipped since lo/hi are infinity + // if wall was set to a null pointer, it's skipped since lo/hi are infinity // compute force and torque on atom if close enough to wall // via wall potential matched to pair potential diff --git a/src/BODY/fix_wall_body_polyhedron.cpp b/src/BODY/fix_wall_body_polyhedron.cpp index 161f8d6d6d88bd3f5847694eff0ce641aeb2b42c..472fe5fb2108a4ab5472135e47f79b912117a4f3 100644 --- a/src/BODY/fix_wall_body_polyhedron.cpp +++ b/src/BODY/fix_wall_body_polyhedron.cpp @@ -132,19 +132,19 @@ FixWallBodyPolyhedron::FixWallBodyPolyhedron(LAMMPS *lmp, int narg, char **arg) time_origin = update->ntimestep; dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; edmax = ednummax = 0; - edge = NULL; - ednum = edfirst = NULL; + edge = nullptr; + ednum = edfirst = nullptr; facmax = facnummax = 0; - face = NULL; - facnum = facfirst = NULL; + face = nullptr; + facnum = facfirst = nullptr; - enclosing_radius = NULL; - rounded_radius = NULL; + enclosing_radius = nullptr; + rounded_radius = nullptr; } /* ---------------------------------------------------------------------- */ @@ -233,7 +233,7 @@ void FixWallBodyPolyhedron::post_force(int /*vflag*/) // dx,dy,dz = signed distance from wall // for rotating cylinder, reset vwall based on particle position // skip atom if not close enough to wall - // if wall was set to NULL, it's skipped since lo/hi are infinity + // if wall was set to a null pointer, it's skipped since lo/hi are infinity // compute force and torque on atom if close enough to wall // via wall potential matched to pair potential diff --git a/src/BODY/pair_body_nparticle.cpp b/src/BODY/pair_body_nparticle.cpp index ece23d9522b17bf4b12dbdcb9123198359525506..92ae392cd75b71406daf9f288aae629d413d08d9 100644 --- a/src/BODY/pair_body_nparticle.cpp +++ b/src/BODY/pair_body_nparticle.cpp @@ -34,8 +34,8 @@ using namespace LAMMPS_NS; PairBodyNparticle::PairBodyNparticle(LAMMPS *lmp) : Pair(lmp) { dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; single_enable = 0; restartinfo = 0; diff --git a/src/BODY/pair_body_rounded_polygon.cpp b/src/BODY/pair_body_rounded_polygon.cpp index fa5a8e57dab4556c91b0fda6f5540a5441a3f518..b7fa88b740aceb43ee133b97812d00fdc7a48ca3 100644 --- a/src/BODY/pair_body_rounded_polygon.cpp +++ b/src/BODY/pair_body_rounded_polygon.cpp @@ -53,16 +53,16 @@ enum {INVALID=0,NONE=1,VERTEXI=2,VERTEXJ=3,EDGE=4}; PairBodyRoundedPolygon::PairBodyRoundedPolygon(LAMMPS *lmp) : Pair(lmp) { dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; edmax = ednummax = 0; - edge = NULL; - ednum = edfirst = NULL; + edge = nullptr; + ednum = edfirst = nullptr; - enclosing_radius = NULL; - rounded_radius = NULL; - maxerad = NULL; + enclosing_radius = nullptr; + rounded_radius = nullptr; + maxerad = nullptr; single_enable = 0; restartinfo = 0; @@ -458,7 +458,7 @@ void PairBodyRoundedPolygon::init_style() for (i = 0; i < nlocal; i++) dnum[i] = ednum[i] = 0; - double *merad = NULL; + double *merad = nullptr; memory->create(merad,ntypes+1,"pair:merad"); for (i = 1; i <= ntypes; i++) maxerad[i] = merad[i] = 0; diff --git a/src/BODY/pair_body_rounded_polyhedron.cpp b/src/BODY/pair_body_rounded_polyhedron.cpp index d376ac759eba9a1c3b680d7e4f40e5266a799247..a3cffef9cc90323c254e6e58819aab7f696c47d5 100644 --- a/src/BODY/pair_body_rounded_polyhedron.cpp +++ b/src/BODY/pair_body_rounded_polyhedron.cpp @@ -58,20 +58,20 @@ enum {EF_INVALID=0,EF_NONE,EF_PARALLEL,EF_SAME_SIDE_OF_FACE, PairBodyRoundedPolyhedron::PairBodyRoundedPolyhedron(LAMMPS *lmp) : Pair(lmp) { dmax = nmax = 0; - discrete = NULL; - dnum = dfirst = NULL; + discrete = nullptr; + dnum = dfirst = nullptr; edmax = ednummax = 0; - edge = NULL; - ednum = edfirst = NULL; + edge = nullptr; + ednum = edfirst = nullptr; facmax = facnummax = 0; - face = NULL; - facnum = facfirst = NULL; + face = nullptr; + facnum = facfirst = nullptr; - enclosing_radius = NULL; - rounded_radius = NULL; - maxerad = NULL; + enclosing_radius = nullptr; + rounded_radius = nullptr; + maxerad = nullptr; single_enable = 0; restartinfo = 0; @@ -81,8 +81,8 @@ PairBodyRoundedPolyhedron::PairBodyRoundedPolyhedron(LAMMPS *lmp) : Pair(lmp) mu = 0.0; A_ua = 1.0; - k_n = NULL; - k_na = NULL; + k_n = nullptr; + k_na = nullptr; } /* ---------------------------------------------------------------------- */ @@ -440,7 +440,7 @@ void PairBodyRoundedPolyhedron::init_style() for (i = 0; i < nlocal; i++) dnum[i] = ednum[i] = facnum[i] = 0; - double *merad = NULL; + double *merad = nullptr; memory->create(merad,ntypes+1,"pair:merad"); for (i = 1; i <= ntypes; i++) maxerad[i] = merad[i] = 0; @@ -884,7 +884,7 @@ void PairBodyRoundedPolyhedron::sphere_against_face(int ibody, int jbody, project_pt_plane(x[jbody], xi1, xi2, xi3, h, d, inside); - inside_polygon(ibody, ni, x[ibody], h, NULL, inside, tmp); + inside_polygon(ibody, ni, x[ibody], h, nullptr, inside, tmp); if (inside == 0) continue; delx = h[0] - x[jbody][0]; @@ -1880,7 +1880,7 @@ void PairBodyRoundedPolyhedron::project_pt_plane(const double* q, face_index = face index of the body xmi = atom i's coordinates q1 = tested point on the face (e.g. the projection of a point) - q2 = another point (can be NULL) for face-edge intersection + q2 = another point (can be a null pointer) for face-edge intersection Output: inside1 = 1 if q1 is inside the polygon, 0 otherwise inside2 = 1 if q2 is inside the polygon, 0 otherwise @@ -1929,7 +1929,7 @@ void PairBodyRoundedPolyhedron::inside_polygon(int ibody, int face_index, anglesum1 += acos(costheta); } - if (q2 != NULL) { + if (q2 != nullptr) { MathExtra::sub3(xi1,q2,u); MathExtra::sub3(xi2,q2,v); magu = MathExtra::len3(u); @@ -1945,7 +1945,7 @@ void PairBodyRoundedPolyhedron::inside_polygon(int ibody, int face_index, if (fabs(anglesum1 - MY_2PI) < EPSILON) inside1 = 1; else inside1 = 0; - if (q2 != NULL) { + if (q2 != nullptr) { if (fabs(anglesum2 - MY_2PI) < EPSILON) inside2 = 1; else inside2 = 0; } diff --git a/src/CLASS2/angle_class2.cpp b/src/CLASS2/angle_class2.cpp index eea43480e194779d08573bc99ae68874a7387601..28d081c5c905d36435e9bb7b6e51527c7a366fbd 100644 --- a/src/CLASS2/angle_class2.cpp +++ b/src/CLASS2/angle_class2.cpp @@ -373,19 +373,19 @@ void AngleClass2::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k3[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k4[1],sizeof(double),atom->nangletypes,fp,NULL,error); - - utils::sfread(FLERR,&bb_k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&bb_r1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&bb_r2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - - utils::sfread(FLERR,&ba_k1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ba_k2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ba_r1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ba_r2[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k3[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k4[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + + utils::sfread(FLERR,&bb_k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&bb_r1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&bb_r2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + + utils::sfread(FLERR,&ba_k1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ba_k2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ba_r1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ba_r2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/CLASS2/bond_class2.cpp b/src/CLASS2/bond_class2.cpp index a97b06a3c770ff71f3e242c3e9e45aff9cc8e4bc..8a84717228d4d41682b6a66981fa27fbad321c28 100644 --- a/src/CLASS2/bond_class2.cpp +++ b/src/CLASS2/bond_class2.cpp @@ -184,10 +184,10 @@ void BondClass2::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&k2[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&k3[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&k4[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&k3[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&k4[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&k2[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -228,5 +228,5 @@ void *BondClass2::extract(const char *str, int &dim) { dim = 1; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/CLASS2/dihedral_class2.cpp b/src/CLASS2/dihedral_class2.cpp index 5be522f2c9936eccfc248000044c546240dde379..5a0300359d447a99d2f1d61ad48409a34725990a 100644 --- a/src/CLASS2/dihedral_class2.cpp +++ b/src/CLASS2/dihedral_class2.cpp @@ -834,45 +834,45 @@ void DihedralClass2::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&k2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&k3[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&phi1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&phi2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&phi3[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&mbt_f1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&mbt_f2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&mbt_f3[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&mbt_r0[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&ebt_f1_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&ebt_f2_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&ebt_f3_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&ebt_r0_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&ebt_f1_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&ebt_f2_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&ebt_f3_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&ebt_r0_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&at_f1_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&at_f2_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&at_f3_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&at_theta0_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&at_f1_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&at_f2_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&at_f3_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&at_theta0_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&aat_k[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&aat_theta0_1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&aat_theta0_2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - - utils::sfread(FLERR,&bb13t_k[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&bb13t_r10[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&bb13t_r30[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&k1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&k3[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&phi1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&phi2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&phi3[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&mbt_f1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&mbt_f2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&mbt_f3[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&mbt_r0[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&ebt_f1_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&ebt_f2_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&ebt_f3_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&ebt_r0_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&ebt_f1_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&ebt_f2_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&ebt_f3_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&ebt_r0_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&at_f1_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&at_f2_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&at_f3_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&at_theta0_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&at_f1_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&at_f2_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&at_f3_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&at_theta0_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&aat_k[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&aat_theta0_1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&aat_theta0_2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + + utils::sfread(FLERR,&bb13t_k[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&bb13t_r10[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&bb13t_r30[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&k1[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); diff --git a/src/CLASS2/improper_class2.cpp b/src/CLASS2/improper_class2.cpp index 0b07a7d60c4ebaec10101f425e0bdc8bdf8bc2b9..801c21c3b48a904a71d26d6058b40f85ba222b72 100644 --- a/src/CLASS2/improper_class2.cpp +++ b/src/CLASS2/improper_class2.cpp @@ -598,15 +598,15 @@ void ImproperClass2::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k0[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi0[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - - utils::sfread(FLERR,&aa_k1[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&aa_k2[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&aa_k3[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&aa_theta0_1[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&aa_theta0_2[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&aa_theta0_3[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k0[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi0[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + + utils::sfread(FLERR,&aa_k1[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&aa_k2[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&aa_k3[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&aa_theta0_1[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&aa_theta0_2[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&aa_theta0_3[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k0[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi0[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/CLASS2/pair_lj_class2.cpp b/src/CLASS2/pair_lj_class2.cpp index bb1dfe0ab30c79ecdb5f0b2f0fe956a056f46ea3..fdfaf158ef7ea4ee2093245a838daa8f5be77905 100644 --- a/src/CLASS2/pair_lj_class2.cpp +++ b/src/CLASS2/pair_lj_class2.cpp @@ -509,7 +509,7 @@ void PairLJClass2::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -612,13 +612,13 @@ void PairLJClass2::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -647,10 +647,10 @@ void PairLJClass2::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -707,5 +707,5 @@ void *PairLJClass2::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/CLASS2/pair_lj_class2_coul_cut.cpp b/src/CLASS2/pair_lj_class2_coul_cut.cpp index 8375043ed8e9dbaa01273b4d1d55d0048d0b7518..df0019c2519e3d4103352e2bd32f03ce2fd57f15 100644 --- a/src/CLASS2/pair_lj_class2_coul_cut.cpp +++ b/src/CLASS2/pair_lj_class2_coul_cut.cpp @@ -364,14 +364,14 @@ void PairLJClass2CoulCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -401,11 +401,11 @@ void PairLJClass2CoulCut::write_restart_settings(FILE *fp) void PairLJClass2CoulCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); @@ -478,6 +478,6 @@ void *PairLJClass2CoulCut::extract(const char *str, int &dim) if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/CLASS2/pair_lj_class2_coul_long.cpp b/src/CLASS2/pair_lj_class2_coul_long.cpp index 3b9ef8deaf092a411e5316984a06e106f35004bc..68a5bd217158156b9870cb7a2dd322aab5a05dab 100644 --- a/src/CLASS2/pair_lj_class2_coul_long.cpp +++ b/src/CLASS2/pair_lj_class2_coul_long.cpp @@ -47,8 +47,8 @@ PairLJClass2CoulLong::PairLJClass2CoulLong(LAMMPS *lmp) : Pair(lmp) ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; - cut_respa = NULL; + ftable = nullptr; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -691,11 +691,11 @@ void PairLJClass2CoulLong::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -807,13 +807,13 @@ void PairLJClass2CoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -844,13 +844,13 @@ void PairLJClass2CoulLong::write_restart_settings(FILE *fp) void PairLJClass2CoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -956,5 +956,5 @@ void *PairLJClass2CoulLong::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/COLLOID/pair_brownian.cpp b/src/COLLOID/pair_brownian.cpp index 786be66c70569ce7d7118e16f21a3feaff540fcf..9ec25eeccda4ff68fd7aaac8a9b0e570d3bb24f6 100644 --- a/src/COLLOID/pair_brownian.cpp +++ b/src/COLLOID/pair_brownian.cpp @@ -51,7 +51,7 @@ enum{EDGE,CONSTANT,VARIABLE}; PairBrownian::PairBrownian(LAMMPS *lmp) : Pair(lmp) { single_enable = 0; - random = NULL; + random = nullptr; } /* ---------------------------------------------------------------------- */ @@ -497,7 +497,7 @@ void PairBrownian::init_style() for (int i = 0; i < modify->nfix; i++){ if (strcmp(modify->fix[i]->style,"deform") == 0) flagdeform = 1; - else if (strstr(modify->fix[i]->style,"wall") != NULL) { + else if (strstr(modify->fix[i]->style,"wall") != nullptr) { if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with pair brownian"); @@ -603,12 +603,12 @@ void PairBrownian::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_inner[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -643,17 +643,17 @@ void PairBrownian::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&mu,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&flaglog,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagfld,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&t_target, sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed, sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagHI,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagVF,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&mu,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&flaglog,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagfld,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&t_target, sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed, sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagHI,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagVF,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&mu,1,MPI_DOUBLE,0,world); MPI_Bcast(&flaglog,1,MPI_INT,0,world); diff --git a/src/COLLOID/pair_brownian_poly.cpp b/src/COLLOID/pair_brownian_poly.cpp index 9c2593ffb1af8a6020805cb6ceb687fcdb602067..c71c0aa3ef22f66f052ad2c95b86791b20cfd5b7 100644 --- a/src/COLLOID/pair_brownian_poly.cpp +++ b/src/COLLOID/pair_brownian_poly.cpp @@ -358,7 +358,7 @@ void PairBrownianPoly::init_style() for (int i = 0; i < modify->nfix; i++){ if (strcmp(modify->fix[i]->style,"deform") == 0) flagdeform = 1; - else if (strstr(modify->fix[i]->style,"wall") != NULL) { + else if (strstr(modify->fix[i]->style,"wall") != nullptr) { if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with pair brownian"); diff --git a/src/COLLOID/pair_colloid.cpp b/src/COLLOID/pair_colloid.cpp index f95645c6131d46076436f141993c035145298916..3ac4d8f2b128f19237b26bda0a25d229f2393e21 100644 --- a/src/COLLOID/pair_colloid.cpp +++ b/src/COLLOID/pair_colloid.cpp @@ -395,15 +395,15 @@ void PairColloid::read_restart(FILE *fp) for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (comm->me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (comm->me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (comm->me == 0) { - utils::sfread(FLERR,&a12[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&d1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&d2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a12[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&d1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&d2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a12[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -433,9 +433,9 @@ void PairColloid::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/COLLOID/pair_lubricate.cpp b/src/COLLOID/pair_lubricate.cpp index 867bb9197979b60557c7a83adc2ba7f23873e1f0..4e0bf33442705accc92d7464a97a67b60635c35d 100644 --- a/src/COLLOID/pair_lubricate.cpp +++ b/src/COLLOID/pair_lubricate.cpp @@ -566,7 +566,7 @@ void PairLubricate::init_style() error->all(FLERR,"Using pair lubricate with inconsistent " "fix deform remap option"); } - if (strstr(modify->fix[i]->style,"wall") != NULL) { + if (strstr(modify->fix[i]->style,"wall") != nullptr) { if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with pair lubricate"); @@ -683,12 +683,12 @@ void PairLubricate::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_inner[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -721,15 +721,15 @@ void PairLubricate::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&mu,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&flaglog,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagfld,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagHI,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagVF,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&mu,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&flaglog,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagfld,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagHI,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagVF,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&mu,1,MPI_DOUBLE,0,world); MPI_Bcast(&flaglog,1,MPI_INT,0,world); diff --git a/src/COLLOID/pair_lubricateU.cpp b/src/COLLOID/pair_lubricateU.cpp index 2df1ecaaa62c7f6c3c818712c7b2f3002c1694ae..b3420154fb0783f762d70822e9912a09ca9fd241 100644 --- a/src/COLLOID/pair_lubricateU.cpp +++ b/src/COLLOID/pair_lubricateU.cpp @@ -58,10 +58,10 @@ PairLubricateU::PairLubricateU(LAMMPS *lmp) : Pair(lmp) no_virial_fdotr_compute = 1; nmax = 0; - fl = Tl = xl = NULL; + fl = Tl = xl = nullptr; cgmax = 0; - bcg = xcg = rcg = rcg1 = pcg = RU = NULL; + bcg = xcg = rcg = rcg1 = pcg = RU = nullptr; // set comm size needed by this Pair @@ -1794,7 +1794,7 @@ void PairLubricateU::init_style() for (int i = 0; i < modify->nfix; i++){ if (strcmp(modify->fix[i]->style,"deform") == 0) flagdeform = 1; - else if (strstr(modify->fix[i]->style,"wall") != NULL) { + else if (strstr(modify->fix[i]->style,"wall") != nullptr) { if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with " @@ -1909,12 +1909,12 @@ void PairLubricateU::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_inner[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -1946,14 +1946,14 @@ void PairLubricateU::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&mu,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&flaglog,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagHI,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&flagVF,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&mu,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&flaglog,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagHI,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&flagVF,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&mu,1,MPI_DOUBLE,0,world); MPI_Bcast(&flaglog,1,MPI_INT,0,world); diff --git a/src/COLLOID/pair_lubricateU_poly.cpp b/src/COLLOID/pair_lubricateU_poly.cpp index 8483bb0f51161c047dd95c75dc5486f6df83a5d1..501977187becfe34b6a0ebff68693641fd510712 100644 --- a/src/COLLOID/pair_lubricateU_poly.cpp +++ b/src/COLLOID/pair_lubricateU_poly.cpp @@ -1158,7 +1158,7 @@ void PairLubricateUPoly::init_style() for (int i = 0; i < modify->nfix; i++){ if (strcmp(modify->fix[i]->style,"deform") == 0) flagdeform = 1; - else if (strstr(modify->fix[i]->style,"wall") != NULL){ + else if (strstr(modify->fix[i]->style,"wall") != nullptr){ if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with " diff --git a/src/COLLOID/pair_lubricate_poly.cpp b/src/COLLOID/pair_lubricate_poly.cpp index 351757e09b82e9f21ecb823c1a54acff12939fbb..244b37457b6bfafb2f62e1bc3ecfe0d5968eda1a 100644 --- a/src/COLLOID/pair_lubricate_poly.cpp +++ b/src/COLLOID/pair_lubricate_poly.cpp @@ -468,7 +468,7 @@ void PairLubricatePoly::init_style() error->all(FLERR,"Using pair lubricate with inconsistent " "fix deform remap option"); } - if (strstr(modify->fix[i]->style,"wall") != NULL) { + if (strstr(modify->fix[i]->style,"wall") != nullptr) { if (flagwall) error->all(FLERR, "Cannot use multiple fix wall commands with " @@ -478,7 +478,7 @@ void PairLubricatePoly::init_style() if (wallfix->xflag) flagwall = 2; // Moving walls exist } - if (strstr(modify->fix[i]->style,"wall") != NULL){ + if (strstr(modify->fix[i]->style,"wall") != nullptr){ flagwall = 1; // Walls exist if (((FixWall *) modify->fix[i])->xflag ) { flagwall = 2; // Moving walls exist diff --git a/src/COMPRESS/dump_atom_gz.cpp b/src/COMPRESS/dump_atom_gz.cpp index 484175762e7d9c0888103a53e797814b0513c314..9cc1439e66432f9f84dfce0f2e757bfb8578ccb6 100644 --- a/src/COMPRESS/dump_atom_gz.cpp +++ b/src/COMPRESS/dump_atom_gz.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; DumpAtomGZ::DumpAtomGZ(LAMMPS *lmp, int narg, char **arg) : DumpAtom(lmp, narg, arg) { - gzFp = NULL; + gzFp = nullptr; compression_level = Z_BEST_COMPRESSION; @@ -38,8 +38,8 @@ DumpAtomGZ::DumpAtomGZ(LAMMPS *lmp, int narg, char **arg) : DumpAtomGZ::~DumpAtomGZ() { if (gzFp) gzclose(gzFp); - gzFp = NULL; - fp = NULL; + gzFp = nullptr; + fp = nullptr; } /* ---------------------------------------------------------------------- @@ -102,8 +102,8 @@ void DumpAtomGZ::openfile() gzFp = gzopen(filecurrent, mode.c_str()); - if (gzFp == NULL) error->one(FLERR,"Cannot open dump file"); - } else gzFp = NULL; + if (gzFp == nullptr) error->one(FLERR,"Cannot open dump file"); + } else gzFp = nullptr; // delete string with timestep replaced @@ -155,7 +155,7 @@ void DumpAtomGZ::write() if (filewriter) { if (multifile) { gzclose(gzFp); - gzFp = NULL; + gzFp = nullptr; } else { if (flush_flag) gzflush(gzFp,Z_SYNC_FLUSH); diff --git a/src/COMPRESS/dump_cfg_gz.cpp b/src/COMPRESS/dump_cfg_gz.cpp index 18f0fa56d7315452bf37ee7c40ed07b72fb0f713..b6a94e587ddceb1b24917711fbdcccdcb2137b68 100644 --- a/src/COMPRESS/dump_cfg_gz.cpp +++ b/src/COMPRESS/dump_cfg_gz.cpp @@ -27,7 +27,7 @@ using namespace LAMMPS_NS; DumpCFGGZ::DumpCFGGZ(LAMMPS *lmp, int narg, char **arg) : DumpCFG(lmp, narg, arg) { - gzFp = NULL; + gzFp = nullptr; compression_level = Z_BEST_COMPRESSION; @@ -41,8 +41,8 @@ DumpCFGGZ::DumpCFGGZ(LAMMPS *lmp, int narg, char **arg) : DumpCFGGZ::~DumpCFGGZ() { if (gzFp) gzclose(gzFp); - gzFp = NULL; - fp = NULL; + gzFp = nullptr; + fp = nullptr; } @@ -106,8 +106,8 @@ void DumpCFGGZ::openfile() gzFp = gzopen(filecurrent, mode.c_str()); - if (gzFp == NULL) error->one(FLERR,"Cannot open dump file"); - } else gzFp = NULL; + if (gzFp == nullptr) error->one(FLERR,"Cannot open dump file"); + } else gzFp = nullptr; // delete string with timestep replaced @@ -163,7 +163,7 @@ void DumpCFGGZ::write() if (filewriter) { if (multifile) { gzclose(gzFp); - gzFp = NULL; + gzFp = nullptr; } else { if (flush_flag) gzflush(gzFp,Z_SYNC_FLUSH); diff --git a/src/COMPRESS/dump_custom_gz.cpp b/src/COMPRESS/dump_custom_gz.cpp index fb2b121f7f873c6b878f5762f4566ef9993d2653..af37ff0a1dea347ce1a90f79833ce5c336444b9f 100644 --- a/src/COMPRESS/dump_custom_gz.cpp +++ b/src/COMPRESS/dump_custom_gz.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; DumpCustomGZ::DumpCustomGZ(LAMMPS *lmp, int narg, char **arg) : DumpCustom(lmp, narg, arg) { - gzFp = NULL; + gzFp = nullptr; compression_level = Z_BEST_COMPRESSION; @@ -39,8 +39,8 @@ DumpCustomGZ::DumpCustomGZ(LAMMPS *lmp, int narg, char **arg) : DumpCustomGZ::~DumpCustomGZ() { if (gzFp) gzclose(gzFp); - gzFp = NULL; - fp = NULL; + gzFp = nullptr; + fp = nullptr; } @@ -104,8 +104,8 @@ void DumpCustomGZ::openfile() gzFp = gzopen(filecurrent, mode.c_str()); - if (gzFp == NULL) error->one(FLERR,"Cannot open dump file"); - } else gzFp = NULL; + if (gzFp == nullptr) error->one(FLERR,"Cannot open dump file"); + } else gzFp = nullptr; // delete string with timestep replaced @@ -155,7 +155,7 @@ void DumpCustomGZ::write() if (filewriter) { if (multifile) { gzclose(gzFp); - gzFp = NULL; + gzFp = nullptr; } else { if (flush_flag) gzflush(gzFp,Z_SYNC_FLUSH); diff --git a/src/COMPRESS/dump_local_gz.cpp b/src/COMPRESS/dump_local_gz.cpp index 49a3c3bef2d727732be5230b9c746854f006bbe0..fc7b534727a99f4804188c9601415e18cff87bc0 100644 --- a/src/COMPRESS/dump_local_gz.cpp +++ b/src/COMPRESS/dump_local_gz.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; DumpLocalGZ::DumpLocalGZ(LAMMPS *lmp, int narg, char **arg) : DumpLocal(lmp, narg, arg) { - gzFp = NULL; + gzFp = nullptr; compression_level = Z_BEST_COMPRESSION; @@ -39,8 +39,8 @@ DumpLocalGZ::DumpLocalGZ(LAMMPS *lmp, int narg, char **arg) : DumpLocalGZ::~DumpLocalGZ() { if (gzFp) gzclose(gzFp); - gzFp = NULL; - fp = NULL; + gzFp = nullptr; + fp = nullptr; } @@ -104,8 +104,8 @@ void DumpLocalGZ::openfile() gzFp = gzopen(filecurrent, mode.c_str()); - if (gzFp == NULL) error->one(FLERR,"Cannot open dump file"); - } else gzFp = NULL; + if (gzFp == nullptr) error->one(FLERR,"Cannot open dump file"); + } else gzFp = nullptr; // delete string with timestep replaced @@ -170,7 +170,7 @@ void DumpLocalGZ::write() if (filewriter) { if (multifile) { gzclose(gzFp); - gzFp = NULL; + gzFp = nullptr; } else { if (flush_flag) gzflush(gzFp,Z_SYNC_FLUSH); diff --git a/src/COMPRESS/dump_xyz_gz.cpp b/src/COMPRESS/dump_xyz_gz.cpp index cc07b1ce61808f1643fd6165eeb60fe648f20402..24b4a7a0707a26a87f9414ef73a1294602d6d986 100644 --- a/src/COMPRESS/dump_xyz_gz.cpp +++ b/src/COMPRESS/dump_xyz_gz.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; DumpXYZGZ::DumpXYZGZ(LAMMPS *lmp, int narg, char **arg) : DumpXYZ(lmp, narg, arg) { - gzFp = NULL; + gzFp = nullptr; compression_level = Z_BEST_COMPRESSION; @@ -38,8 +38,8 @@ DumpXYZGZ::DumpXYZGZ(LAMMPS *lmp, int narg, char **arg) : DumpXYZGZ::~DumpXYZGZ() { if (gzFp) gzclose(gzFp); - gzFp = NULL; - fp = NULL; + gzFp = nullptr; + fp = nullptr; } @@ -103,8 +103,8 @@ void DumpXYZGZ::openfile() gzFp = gzopen(filecurrent, mode.c_str()); - if (gzFp == NULL) error->one(FLERR,"Cannot open dump file"); - } else gzFp = NULL; + if (gzFp == nullptr) error->one(FLERR,"Cannot open dump file"); + } else gzFp = nullptr; // delete string with timestep replaced @@ -134,7 +134,7 @@ void DumpXYZGZ::write() if (filewriter) { if (multifile) { gzclose(gzFp); - gzFp = NULL; + gzFp = nullptr; } else { if (flush_flag) gzflush(gzFp,Z_SYNC_FLUSH); diff --git a/src/CORESHELL/compute_temp_cs.cpp b/src/CORESHELL/compute_temp_cs.cpp index 1b7eb1e43f5fce64afbc942f77490d55540da41f..06754003f63ded171179ecf5447860cc9cb03b0b 100644 --- a/src/CORESHELL/compute_temp_cs.cpp +++ b/src/CORESHELL/compute_temp_cs.cpp @@ -38,7 +38,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeTempCS::ComputeTempCS(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), vint(NULL), id_fix(NULL), fix(NULL) + Compute(lmp, narg, arg), vint(nullptr), id_fix(nullptr), fix(nullptr) { if (narg != 5) error->all(FLERR,"Illegal compute temp/cs command"); @@ -94,7 +94,7 @@ ComputeTempCS::ComputeTempCS(LAMMPS *lmp, int narg, char **arg) : vector = new double[size_vector]; maxatom = 0; - vint = NULL; + vint = nullptr; // set comm size needed by this Compute diff --git a/src/CORESHELL/pair_born_coul_long_cs.cpp b/src/CORESHELL/pair_born_coul_long_cs.cpp index d50138145a48543087f13c91c2c8729a551464dd..58f58db1bf7ac2af96e2a70c88f4ad0d3ca44b47 100644 --- a/src/CORESHELL/pair_born_coul_long_cs.cpp +++ b/src/CORESHELL/pair_born_coul_long_cs.cpp @@ -42,7 +42,7 @@ PairBornCoulLongCS::PairBornCoulLongCS(LAMMPS *lmp) : PairBornCoulLong(lmp) { ewaldflag = pppmflag = 1; single_enable = 0; // TODO: single function does not match compute - ftable = NULL; + ftable = nullptr; writedata = 1; } diff --git a/src/CORESHELL/pair_buck_coul_long_cs.cpp b/src/CORESHELL/pair_buck_coul_long_cs.cpp index dd43f7f4bd2d548798f756b6316d5988049aee15..f8a00a3489b7575d58550ebac31fb09b57ae41c0 100644 --- a/src/CORESHELL/pair_buck_coul_long_cs.cpp +++ b/src/CORESHELL/pair_buck_coul_long_cs.cpp @@ -43,7 +43,7 @@ PairBuckCoulLongCS::PairBuckCoulLongCS(LAMMPS *lmp) : PairBuckCoulLong(lmp) ewaldflag = pppmflag = 1; writedata = 1; single_enable = 0; - ftable = NULL; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/CORESHELL/pair_coul_long_cs.cpp b/src/CORESHELL/pair_coul_long_cs.cpp index ee03780a02c95b12ed5c4b0a5ad43e6063da1b3d..6a2117149f3b56acc8613f95959319fc8956f404 100644 --- a/src/CORESHELL/pair_coul_long_cs.cpp +++ b/src/CORESHELL/pair_coul_long_cs.cpp @@ -42,7 +42,7 @@ PairCoulLongCS::PairCoulLongCS(LAMMPS *lmp) : PairCoulLong(lmp) { ewaldflag = pppmflag = 1; single_enable = 0; // TODO: single function does not match compute - ftable = NULL; + ftable = nullptr; qdist = 0.0; } diff --git a/src/CORESHELL/pair_lj_class2_coul_long_cs.cpp b/src/CORESHELL/pair_lj_class2_coul_long_cs.cpp index 75e3f5ed17539680a43748a981485090f849bbae..81336e6810869c7e68695d434f850e292df4214d 100644 --- a/src/CORESHELL/pair_lj_class2_coul_long_cs.cpp +++ b/src/CORESHELL/pair_lj_class2_coul_long_cs.cpp @@ -40,7 +40,7 @@ PairLJClass2CoulLongCS::PairLJClass2CoulLongCS(LAMMPS *lmp) : PairLJClass2CoulLo respa_enable = 0; // TODO: r-RESPA handling is inconsistent and thus disabled until fixed single_enable = 0; // TODO: single function does not match compute writedata = 1; - ftable = NULL; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp b/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp index 9d60dfdbf6c9fce072ebc2ab1feb3bbaddc6e6aa..89523032a08e44f5dc006f1b3f00484befeaa589 100644 --- a/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp +++ b/src/CORESHELL/pair_lj_cut_coul_long_cs.cpp @@ -44,7 +44,7 @@ PairLJCutCoulLongCS::PairLJCutCoulLongCS(LAMMPS *lmp) : PairLJCutCoulLong(lmp) respa_enable = 0; // TODO: r-RESPA handling is inconsistent and thus disabled until fixed single_enable = 0; // TODO: single function does not match compute writedata = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; } diff --git a/src/DIPOLE/pair_lj_cut_dipole_cut.cpp b/src/DIPOLE/pair_lj_cut_dipole_cut.cpp index 25fed599db048a62bae66ccf117addde3b7b1fcb..d7f320180582ccdd19a82b66f9d16f596b4f255c 100644 --- a/src/DIPOLE/pair_lj_cut_dipole_cut.cpp +++ b/src/DIPOLE/pair_lj_cut_dipole_cut.cpp @@ -438,14 +438,14 @@ void PairLJCutDipoleCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -474,10 +474,10 @@ void PairLJCutDipoleCut::write_restart_settings(FILE *fp) void PairLJCutDipoleCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); diff --git a/src/DIPOLE/pair_lj_cut_dipole_long.cpp b/src/DIPOLE/pair_lj_cut_dipole_long.cpp index 67d2e0aa3ceca1802661904a2f1d692dd487c987..e6fe0e8dca055c8801b3ba7d4f11885b9fbd0d43 100644 --- a/src/DIPOLE/pair_lj_cut_dipole_long.cpp +++ b/src/DIPOLE/pair_lj_cut_dipole_long.cpp @@ -446,7 +446,7 @@ void PairLJCutDipoleLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -490,13 +490,13 @@ void PairLJCutDipoleLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -524,10 +524,10 @@ void PairLJCutDipoleLong::write_restart_settings(FILE *fp) void PairLJCutDipoleLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -552,5 +552,5 @@ void *PairLJCutDipoleLong::extract(const char *str, int &dim) dim = 0; return (void *) &mix_flag; } - return NULL; + return nullptr; } diff --git a/src/DIPOLE/pair_lj_long_dipole_long.cpp b/src/DIPOLE/pair_lj_long_dipole_long.cpp index 86e143626df0db59c62ec708c88716f33af55218..33ee57b83d6123bb173c8e3af6c6b4d853f9a025 100644 --- a/src/DIPOLE/pair_lj_long_dipole_long.cpp +++ b/src/DIPOLE/pair_lj_long_dipole_long.cpp @@ -58,7 +58,7 @@ PairLJLongDipoleLong::PairLJLongDipoleLong(LAMMPS *lmp) : Pair(lmp) void PairLJLongDipoleLong::options(char **arg, int order) { - const char *option[] = {"long", "cut", "off", NULL}; + const char *option[] = {"long", "cut", "off", nullptr}; int i; if (!*arg) error->all(FLERR,"Illegal pair_style lj/long/dipole/long command"); @@ -168,10 +168,10 @@ void *PairLJLongDipoleLong::extract(const char *id, int &dim) { const char *ids[] = { "B", "sigma", "epsilon", "ewald_order", "ewald_cut", "ewald_mix", - "cut_coul", "cut_vdwl", NULL}; + "cut_coul", "cut_vdwl", nullptr}; void *ptrs[] = { lj4, sigma, epsilon, &ewald_order, &cut_coul, &mix_flag, &cut_coul, - &cut_lj_global, NULL}; + &cut_lj_global, nullptr}; int i; for (i=0; ids[i]&&strcmp(ids[i], id); ++i); @@ -220,8 +220,8 @@ void PairLJLongDipoleLong::coeff(int narg, char **arg) void PairLJLongDipoleLong::init_style() { - const char *style3[] = {"ewald/disp", NULL}; - const char *style6[] = {"ewald/disp", NULL}; + const char *style3[] = {"ewald/disp", nullptr}; + const char *style6[] = {"ewald/disp", nullptr}; int i; if (strcmp(update->unit_style,"electron") == 0) @@ -242,14 +242,14 @@ void PairLJLongDipoleLong::init_style() // ensure use of KSpace long-range solver, set g_ewald if (ewald_order&(1<<3)) { // r^-1 kspace - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); for (i=0; style3[i]&&strcmp(force->kspace_style, style3[i]); ++i); if (!style3[i]) error->all(FLERR,"Pair style requires use of kspace_style ewald/disp"); } if (ewald_order&(1<<6)) { // r^-6 kspace - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); for (i=0; style6[i]&&strcmp(force->kspace_style, style6[i]); ++i); if (!style6[i]) @@ -343,13 +343,13 @@ void PairLJLongDipoleLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_read[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_read[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon_read[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma_read[i][j],1,MPI_DOUBLE,0,world); @@ -378,11 +378,11 @@ void PairLJLongDipoleLong::write_restart_settings(FILE *fp) void PairLJLongDipoleLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); diff --git a/src/GPU/fix_gpu.cpp b/src/GPU/fix_gpu.cpp index f12305063375510e9428854bb66d4c537b6d7b94..7928d16e6705469712b894448af216df82ab300b 100644 --- a/src/GPU/fix_gpu.cpp +++ b/src/GPU/fix_gpu.cpp @@ -118,7 +118,7 @@ FixGPU::FixGPU(LAMMPS *lmp, int narg, char **arg) : int newtonflag = 0; int threads_per_atom = -1; double binsize = 0.0; - char *opencl_flags = NULL; + char *opencl_flags = nullptr; int block_pair = -1; int iarg = 4; @@ -232,7 +232,7 @@ void FixGPU::init() // make sure fdotr virial is not accumulated multiple times - if (force->pair_match("^hybrid",0) != NULL) { + if (force->pair_match("^hybrid",0) != nullptr) { PairHybrid *hybrid = (PairHybrid *) force->pair; for (int i = 0; i < hybrid->nstyles; i++) if (!utils::strmatch(hybrid->keywords[i],"/gpu$")) diff --git a/src/GPU/pair_born_coul_long_cs_gpu.cpp b/src/GPU/pair_born_coul_long_cs_gpu.cpp index c27c670f2ac276dd6b4e868d12d2ebc7dec71825..dbcb3bcf3fa2fa61cab860b8e916497a3bbc6a94 100644 --- a/src/GPU/pair_born_coul_long_cs_gpu.cpp +++ b/src/GPU/pair_born_coul_long_cs_gpu.cpp @@ -189,7 +189,7 @@ void PairBornCoulLongCSGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_born_coul_long_gpu.cpp b/src/GPU/pair_born_coul_long_gpu.cpp index a2524909e5dc6350ee188c48fd95625b3d331ede..3a6808d43c1be4730ad6ca3e5b96f0f8453bc34e 100644 --- a/src/GPU/pair_born_coul_long_gpu.cpp +++ b/src/GPU/pair_born_coul_long_gpu.cpp @@ -184,7 +184,7 @@ void PairBornCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_buck_coul_long_gpu.cpp b/src/GPU/pair_buck_coul_long_gpu.cpp index 41823fc27eda3dd7df7118b433f0790e28307080..aa25fb4cbbe73ba99dec7d70bef0350bb9ca80ed 100644 --- a/src/GPU/pair_buck_coul_long_gpu.cpp +++ b/src/GPU/pair_buck_coul_long_gpu.cpp @@ -180,7 +180,7 @@ void PairBuckCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_colloid_gpu.cpp b/src/GPU/pair_colloid_gpu.cpp index 39737ab18311679518db77ed954d38f891f5f2ee..0ced57d2850fa0824d00f451b852bd8a7b5d1e4c 100644 --- a/src/GPU/pair_colloid_gpu.cpp +++ b/src/GPU/pair_colloid_gpu.cpp @@ -158,7 +158,7 @@ void PairColloidGPU::init_style() } double cell_size = sqrt(maxcut) + neighbor->skin; - int **_form = NULL; + int **_form = nullptr; int n=atom->ntypes; memory->create(_form,n+1,n+1,"colloid/gpu:_form"); for (int i = 1; i <= n; i++) { diff --git a/src/GPU/pair_coul_long_cs_gpu.cpp b/src/GPU/pair_coul_long_cs_gpu.cpp index da59873dd20443e141cfa2943769fd8e0def2162..3eb678fc796fbdf3195e09b2bd3d326f6236cf49 100644 --- a/src/GPU/pair_coul_long_cs_gpu.cpp +++ b/src/GPU/pair_coul_long_cs_gpu.cpp @@ -154,7 +154,7 @@ void PairCoulLongCSGPU::compute(int eflag, int vflag) void PairCoulLongCSGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (!atom->q_flag) error->all(FLERR,"Pair style coul/long/cs/gpu requires atom attribute q"); @@ -175,7 +175,7 @@ void PairCoulLongCSGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_coul_long_gpu.cpp b/src/GPU/pair_coul_long_gpu.cpp index 185d3a7f94d96b6747373f92b0cbda9e0ba93294..7eb5029558d93cc38b90f8b5d98d23bd81f43f03 100644 --- a/src/GPU/pair_coul_long_gpu.cpp +++ b/src/GPU/pair_coul_long_gpu.cpp @@ -149,7 +149,7 @@ void PairCoulLongGPU::compute(int eflag, int vflag) void PairCoulLongGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (!atom->q_flag) error->all(FLERR,"Pair style coul/long/gpu requires atom attribute q"); @@ -170,7 +170,7 @@ void PairCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_eam_alloy_gpu.cpp b/src/GPU/pair_eam_alloy_gpu.cpp index 4939537770bee72aafcf0a63b6a5a95c249accc1..998ca929365d3e34c022d064cdc3f30b3ca6a673 100644 --- a/src/GPU/pair_eam_alloy_gpu.cpp +++ b/src/GPU/pair_eam_alloy_gpu.cpp @@ -143,7 +143,7 @@ void PairEAMAlloyGPU::compute(int eflag, int vflag) // compute forces on each atom on GPU if (gpu_mode != GPU_FORCE) - eam_alloy_gpu_compute_force(NULL, eflag, vflag, eflag_atom, vflag_atom); + eam_alloy_gpu_compute_force(nullptr, eflag, vflag, eflag_atom, vflag_atom); else eam_alloy_gpu_compute_force(ilist, eflag, vflag, eflag_atom, vflag_atom); } @@ -324,7 +324,7 @@ void PairEAMAlloyGPU::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/GPU/pair_eam_alloy_gpu.h b/src/GPU/pair_eam_alloy_gpu.h index 14d9a95c30772fc5408e285f4e563f3fa931e36b..3cd78ea511e3bcb8180b3a1b9199c62b2be4b115 100644 --- a/src/GPU/pair_eam_alloy_gpu.h +++ b/src/GPU/pair_eam_alloy_gpu.h @@ -33,7 +33,7 @@ public: void init_style(); double single(int, int, int, int, double, double, double, double &); double memory_usage(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } int pack_forward_comm(int, int *, double *, int, int *); void unpack_forward_comm(int, int, double *); diff --git a/src/GPU/pair_eam_fs_gpu.cpp b/src/GPU/pair_eam_fs_gpu.cpp index eb028bc778b744e989dbf2d49b5495af3717a5bb..5559bb470f87f3e5a93b97a76a2ad3c4966dea72 100644 --- a/src/GPU/pair_eam_fs_gpu.cpp +++ b/src/GPU/pair_eam_fs_gpu.cpp @@ -143,7 +143,7 @@ void PairEAMFSGPU::compute(int eflag, int vflag) // compute forces on each atom on GPU if (gpu_mode != GPU_FORCE) - eam_fs_gpu_compute_force(NULL, eflag, vflag, eflag_atom, vflag_atom); + eam_fs_gpu_compute_force(nullptr, eflag, vflag, eflag_atom, vflag_atom); else eam_fs_gpu_compute_force(ilist, eflag, vflag, eflag_atom, vflag_atom); } @@ -324,7 +324,7 @@ void PairEAMFSGPU::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/GPU/pair_eam_fs_gpu.h b/src/GPU/pair_eam_fs_gpu.h index 70edf2164eb5e09c57ff934aaca9dbbc26a57502..53825f2e8a40a4dcd1fda939ed9bee27cd26789f 100644 --- a/src/GPU/pair_eam_fs_gpu.h +++ b/src/GPU/pair_eam_fs_gpu.h @@ -33,7 +33,7 @@ public: void init_style(); double single(int, int, int, int, double, double, double, double &); double memory_usage(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } int pack_forward_comm(int, int *, double *, int, int *); void unpack_forward_comm(int, int, double *); diff --git a/src/GPU/pair_eam_gpu.cpp b/src/GPU/pair_eam_gpu.cpp index 3965f27c675e70e562c22336d881cdfd23aad21e..d8058f11aec4d5a6daa8946b73a2ec894d377bfd 100644 --- a/src/GPU/pair_eam_gpu.cpp +++ b/src/GPU/pair_eam_gpu.cpp @@ -145,7 +145,7 @@ void PairEAMGPU::compute(int eflag, int vflag) // compute forces on each atom on GPU if (gpu_mode != GPU_FORCE) - eam_gpu_compute_force(NULL, eflag, vflag, eflag_atom, vflag_atom); + eam_gpu_compute_force(nullptr, eflag, vflag, eflag_atom, vflag_atom); else eam_gpu_compute_force(ilist, eflag, vflag, eflag_atom, vflag_atom); } diff --git a/src/GPU/pair_eam_gpu.h b/src/GPU/pair_eam_gpu.h index e4742a3bef578f130fc04fcaaf7dcd487de91c95..09566f7de9dcb041a08d12065eb8c260fbbd4294 100644 --- a/src/GPU/pair_eam_gpu.h +++ b/src/GPU/pair_eam_gpu.h @@ -33,7 +33,7 @@ class PairEAMGPU : public PairEAM { void init_style(); double single(int, int, int, int, double, double, double, double &); double memory_usage(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } int pack_forward_comm(int, int *, double *, int, int *); void unpack_forward_comm(int, int, double *); diff --git a/src/GPU/pair_gayberne_gpu.cpp b/src/GPU/pair_gayberne_gpu.cpp index 451799027baf4ea972d5570213c810c9d04a2272..58414f4e300e1de3ee6fa22eb87c8ff0da74b456 100644 --- a/src/GPU/pair_gayberne_gpu.cpp +++ b/src/GPU/pair_gayberne_gpu.cpp @@ -74,7 +74,7 @@ PairGayBerneGPU::PairGayBerneGPU(LAMMPS *lmp) : PairGayBerne(lmp), { quat_nmax = 0; reinitflag = 0; - quat = NULL; + quat = nullptr; suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } diff --git a/src/GPU/pair_lj96_cut_gpu.cpp b/src/GPU/pair_lj96_cut_gpu.cpp index 215998bc88a3727fd67141da31bfad8c8d206824..e4d20e23add4749475dae3b9e58ad63fea2bd969 100644 --- a/src/GPU/pair_lj96_cut_gpu.cpp +++ b/src/GPU/pair_lj96_cut_gpu.cpp @@ -135,7 +135,7 @@ void PairLJ96CutGPU::compute(int eflag, int vflag) void PairLJ96CutGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with lj96/cut/gpu pair style"); diff --git a/src/GPU/pair_lj_charmm_coul_long_gpu.cpp b/src/GPU/pair_lj_charmm_coul_long_gpu.cpp index 09ed178200bda130aa8989f29ed0ee727a8f65c8..92101885392b30ede308dd150eb306fff9426ed6 100644 --- a/src/GPU/pair_lj_charmm_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_charmm_coul_long_gpu.cpp @@ -154,7 +154,7 @@ void PairLJCharmmCoulLongGPU::compute(int eflag, int vflag) void PairLJCharmmCoulLongGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (!atom->q_flag) error->all(FLERR,"Pair style lj/charmm/coul/long/gpu requires atom attribute q"); @@ -182,7 +182,7 @@ void PairLJCharmmCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_lj_class2_coul_long_gpu.cpp b/src/GPU/pair_lj_class2_coul_long_gpu.cpp index f6d671d95a86461a23c2b7711cf6b7c04ff9e49c..264ada0fd3a0f045db5d6cac5fe9dbc9f0f7825e 100644 --- a/src/GPU/pair_lj_class2_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_class2_coul_long_gpu.cpp @@ -177,7 +177,7 @@ void PairLJClass2CoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_lj_cut_coul_long_gpu.cpp b/src/GPU/pair_lj_cut_coul_long_gpu.cpp index 2a9d431a427ac9ec1a8ab6d6179b5a506089ecfd..135a2a7dd948cd8a3fbadcf131707f9888b91030 100644 --- a/src/GPU/pair_lj_cut_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_long_gpu.cpp @@ -154,7 +154,7 @@ void PairLJCutCoulLongGPU::compute(int eflag, int vflag) void PairLJCutCoulLongGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (!atom->q_flag) error->all(FLERR,"Pair style lj/cut/coul/long/gpu requires atom attribute q"); @@ -182,7 +182,7 @@ void PairLJCutCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_lj_cut_coul_msm_gpu.cpp b/src/GPU/pair_lj_cut_coul_msm_gpu.cpp index f5987c0ddfc94a968965081674714c065fd63f9a..f8f4af5dee55bce207f0e94801fa55bb5972f9a9 100644 --- a/src/GPU/pair_lj_cut_coul_msm_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_msm_gpu.cpp @@ -143,7 +143,7 @@ void PairLJCutCoulMSMGPU::compute(int eflag, int vflag) void PairLJCutCoulMSMGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with lj/cut/coul/msm/gpu pair style"); diff --git a/src/GPU/pair_lj_cut_dipole_long_gpu.cpp b/src/GPU/pair_lj_cut_dipole_long_gpu.cpp index 7de9ae2aa69bce4eff8458709014511db3326a26..896a0b9d4dbf64d90f11189cec8159154633ba61 100644 --- a/src/GPU/pair_lj_cut_dipole_long_gpu.cpp +++ b/src/GPU/pair_lj_cut_dipole_long_gpu.cpp @@ -185,13 +185,13 @@ void PairLJCutDipoleLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; // setup force tables - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); int maxspecial=0; if (atom->molecular) diff --git a/src/GPU/pair_lj_cut_gpu.cpp b/src/GPU/pair_lj_cut_gpu.cpp index 5656c2e18d17c79477a83a1f4b9f5f00b3d454e4..3fc727a4f761c2ade88fae1943ad55204532c346 100644 --- a/src/GPU/pair_lj_cut_gpu.cpp +++ b/src/GPU/pair_lj_cut_gpu.cpp @@ -139,7 +139,7 @@ void PairLJCutGPU::compute(int eflag, int vflag) void PairLJCutGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with lj/cut/gpu pair style"); diff --git a/src/GPU/pair_lj_cut_tip4p_long_gpu.cpp b/src/GPU/pair_lj_cut_tip4p_long_gpu.cpp index 4aca75cd4ddf5bfd13a881def4beb8acf908425d..3876820358862d849a6b0bc920ab9597e6dd029e 100644 --- a/src/GPU/pair_lj_cut_tip4p_long_gpu.cpp +++ b/src/GPU/pair_lj_cut_tip4p_long_gpu.cpp @@ -168,15 +168,15 @@ void PairLJCutTIP4PLongGPU::compute(int eflag, int vflag) void PairLJCutTIP4PLongGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (atom->tag_enable == 0) error->all(FLERR,"Pair style lj/cut/tip4p/long/gpu requires atom IDs"); if (!atom->q_flag) error->all(FLERR, "Pair style lj/cut/tip4p/long/gpu requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); if (atom->map_style == Atom::MAP_HASH) @@ -202,7 +202,7 @@ void PairLJCutTIP4PLongGPU::init_style() double cell_size = sqrt(maxcut) + neighbor->skin; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_lj_expand_coul_long_gpu.cpp b/src/GPU/pair_lj_expand_coul_long_gpu.cpp index f13eea51e75c2ee72a7545ad0d508852ed1d8b09..86ff980c7e72191c57f27a15d8c7e1e931865d59 100644 --- a/src/GPU/pair_lj_expand_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_expand_coul_long_gpu.cpp @@ -154,7 +154,7 @@ void PairLJExpandCoulLongGPU::compute(int eflag, int vflag) void PairLJExpandCoulLongGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (!atom->q_flag) error->all(FLERR,"Pair style lj/cut/coul/long/gpu requires atom attribute q"); @@ -182,7 +182,7 @@ void PairLJExpandCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; diff --git a/src/GPU/pair_lj_sdk_coul_long_gpu.cpp b/src/GPU/pair_lj_sdk_coul_long_gpu.cpp index 4054f08523c7bd85abc9dc2d4794cc6efce7c9ba..d04a490caf2388d23e28ec146c709da6d9329fca 100644 --- a/src/GPU/pair_lj_sdk_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_sdk_coul_long_gpu.cpp @@ -186,13 +186,13 @@ void PairLJSDKCoulLongGPU::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style is incompatible with KSpace style"); g_ewald = force->kspace->g_ewald; // setup force tables - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); int maxspecial=0; if (atom->molecular) diff --git a/src/GPU/pair_mie_cut_gpu.cpp b/src/GPU/pair_mie_cut_gpu.cpp index 60e6e935e85355109f73de8ea6e61655259b4830..70e8752918e7eb80cf076b04618739c0ec3a131e 100644 --- a/src/GPU/pair_mie_cut_gpu.cpp +++ b/src/GPU/pair_mie_cut_gpu.cpp @@ -136,7 +136,7 @@ void PairMIECutGPU::compute(int eflag, int vflag) void PairMIECutGPU::init_style() { - cut_respa = NULL; + cut_respa = nullptr; if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with mie/cut/gpu pair style"); diff --git a/src/GPU/pair_resquared_gpu.cpp b/src/GPU/pair_resquared_gpu.cpp index ca70e3c3377c314c448ef266b74ef18bc945faed..4ce9730e0c3bc7bc10646f10ea90c202cf68b4ee 100644 --- a/src/GPU/pair_resquared_gpu.cpp +++ b/src/GPU/pair_resquared_gpu.cpp @@ -76,7 +76,7 @@ PairRESquaredGPU::PairRESquaredGPU(LAMMPS *lmp) : PairRESquared(lmp), if (!avec) error->all(FLERR,"Pair resquared/gpu requires atom style ellipsoid"); quat_nmax = 0; - quat = NULL; + quat = nullptr; suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); } diff --git a/src/GPU/pair_sw_gpu.cpp b/src/GPU/pair_sw_gpu.cpp index d544534c9d72bc1f02bb7a7dd67b641e09f39c32..54312e41153d309ac4fdecab23c27226bb1e3b23 100644 --- a/src/GPU/pair_sw_gpu.cpp +++ b/src/GPU/pair_sw_gpu.cpp @@ -76,7 +76,7 @@ PairSWGPU::PairSWGPU(LAMMPS *lmp) : PairSW(lmp), gpu_mode(GPU_FORCE) suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); - cutghost = NULL; + cutghost = nullptr; ghostneigh = 1; } @@ -162,9 +162,9 @@ void PairSWGPU::init_style() double *epsilon, *sigma, *lambda, *gamma; double *biga, *bigb, *powerp, *powerq; double *_cut, *_cutsq, *costheta; - epsilon = sigma = lambda = gamma = NULL; - biga = bigb = powerp = powerq = NULL; - _cut = _cutsq = costheta = NULL; + epsilon = sigma = lambda = gamma = nullptr; + biga = bigb = powerp = powerq = nullptr; + _cut = _cutsq = costheta = nullptr; memory->create(epsilon,nparams,"pair:epsilon"); memory->create(sigma,nparams,"pair:sigma"); diff --git a/src/GPU/pair_table_gpu.cpp b/src/GPU/pair_table_gpu.cpp index 4ac674aa94ce5aa2a4ac85af431fb26c25dce964..20d21615a9616c32b6ffb38dec64f86efd28fe2a 100644 --- a/src/GPU/pair_table_gpu.cpp +++ b/src/GPU/pair_table_gpu.cpp @@ -165,8 +165,8 @@ void PairTableGPU::init_style() double cell_size = sqrt(maxcut) + neighbor->skin; // pack tables and send them to device - double ***table_coeffs = NULL; - double **table_data = NULL; + double ***table_coeffs = nullptr; + double **table_data = nullptr; memory->create(table_coeffs, ntypes+1, ntypes+1, 6, "table:coeffs"); Table *tb; diff --git a/src/GPU/pair_tersoff_gpu.cpp b/src/GPU/pair_tersoff_gpu.cpp index 885dd73d9ed67392610f847e7fee2b66d5603765..b76bf99d5d5bb7dbf7455f292bd2a30e3a139118 100644 --- a/src/GPU/pair_tersoff_gpu.cpp +++ b/src/GPU/pair_tersoff_gpu.cpp @@ -80,7 +80,7 @@ PairTersoffGPU::PairTersoffGPU(LAMMPS *lmp) : PairTersoff(lmp), gpu_mode(GPU_FOR suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); - cutghost = NULL; + cutghost = nullptr; ghostneigh = 1; } @@ -168,11 +168,11 @@ void PairTersoffGPU::init_style() double *c1, *c2, *c3, *c4; double *c, *d, *h, *gamma; double *beta, *powern, *_cutsq; - lam1 = lam2 = lam3 = powermint = NULL; - biga = bigb = bigr = bigd = NULL; - c1 = c2 = c3 = c4 = NULL; - c = d = h = gamma = NULL; - beta = powern = _cutsq = NULL; + lam1 = lam2 = lam3 = powermint = nullptr; + biga = bigb = bigr = bigd = nullptr; + c1 = c2 = c3 = c4 = nullptr; + c = d = h = gamma = nullptr; + beta = powern = _cutsq = nullptr; memory->create(lam1,nparams,"pair:lam1"); memory->create(lam2,nparams,"pair:lam2"); diff --git a/src/GPU/pair_tersoff_mod_gpu.cpp b/src/GPU/pair_tersoff_mod_gpu.cpp index 35edd9ea220d064b2debc801a63e116a87fe6329..57e13bb299a47e1fa6add85799b08affc390ae74 100644 --- a/src/GPU/pair_tersoff_mod_gpu.cpp +++ b/src/GPU/pair_tersoff_mod_gpu.cpp @@ -73,7 +73,7 @@ PairTersoffMODGPU::PairTersoffMODGPU(LAMMPS *lmp) : PairTersoffMOD(lmp), suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); - cutghost = NULL; + cutghost = nullptr; ghostneigh = 1; } @@ -160,11 +160,11 @@ void PairTersoffMODGPU::init_style() double *biga, *bigb, *bigr, *bigd; double *c1, *c2, *c3, *c4, *c5, *h; double *beta, *powern, *ca1, *powern_del, *_cutsq; - lam1 = lam2 = lam3 = powermint = NULL; - biga = bigb = bigr = bigd = NULL; - powern_del = ca1 = NULL; - c1 = c2 = c3 = c4 = c5 = h = NULL; - beta = powern = _cutsq = NULL; + lam1 = lam2 = lam3 = powermint = nullptr; + biga = bigb = bigr = bigd = nullptr; + powern_del = ca1 = nullptr; + c1 = c2 = c3 = c4 = c5 = h = nullptr; + beta = powern = _cutsq = nullptr; memory->create(lam1,nparams,"pair:lam1"); memory->create(lam2,nparams,"pair:lam2"); diff --git a/src/GPU/pair_tersoff_zbl_gpu.cpp b/src/GPU/pair_tersoff_zbl_gpu.cpp index 73251ee726f2a9b23a6a573562b69a32f0fb1497..5facd86254cc7100dd71e2761a6b31204c54bffe 100644 --- a/src/GPU/pair_tersoff_zbl_gpu.cpp +++ b/src/GPU/pair_tersoff_zbl_gpu.cpp @@ -81,7 +81,7 @@ PairTersoffZBLGPU::PairTersoffZBLGPU(LAMMPS *lmp) : PairTersoffZBL(lmp), suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); - cutghost = NULL; + cutghost = nullptr; ghostneigh = 1; } @@ -169,11 +169,11 @@ void PairTersoffZBLGPU::init_style() double *c1, *c2, *c3, *c4; double *c, *d, *h, *gamma; double *beta, *powern, *Z_i, *Z_j, *ZBLcut, *ZBLexpscale, *_cutsq; - lam1 = lam2 = lam3 = powermint = NULL; - biga = bigb = bigr = bigd = NULL; - c1 = c2 = c3 = c4 = NULL; - c = d = h = gamma = NULL; - beta = powern = Z_i = Z_j = ZBLcut = ZBLexpscale = _cutsq = NULL; + lam1 = lam2 = lam3 = powermint = nullptr; + biga = bigb = bigr = bigd = nullptr; + c1 = c2 = c3 = c4 = nullptr; + c = d = h = gamma = nullptr; + beta = powern = Z_i = Z_j = ZBLcut = ZBLexpscale = _cutsq = nullptr; memory->create(lam1,nparams,"pair:lam1"); memory->create(lam2,nparams,"pair:lam2"); diff --git a/src/GPU/pair_ufm_gpu.cpp b/src/GPU/pair_ufm_gpu.cpp index fe6adfef12b5618b65dba3442857bb6031281f3f..f462e579c52df1fa07359adf3ac17983122bc008 100644 --- a/src/GPU/pair_ufm_gpu.cpp +++ b/src/GPU/pair_ufm_gpu.cpp @@ -141,7 +141,7 @@ void PairUFMGPU::compute(int eflag, int vflag) void PairUFMGPU::init_style() { -// cut_respa = NULL; +// cut_respa = nullptr; if (force->newton_pair) error->all(FLERR,"Cannot use newton pair with ufm/gpu pair style"); diff --git a/src/GPU/pair_vashishta_gpu.cpp b/src/GPU/pair_vashishta_gpu.cpp index 868b8de0c0e2528d107a63af3a0ffb32ca2e80aa..99a763bfbc8b21ae83ef74e972a0b12500a54904 100644 --- a/src/GPU/pair_vashishta_gpu.cpp +++ b/src/GPU/pair_vashishta_gpu.cpp @@ -77,7 +77,7 @@ PairVashishtaGPU::PairVashishtaGPU(LAMMPS *lmp) : PairVashishta(lmp), gpu_mode(G suffix_flag |= Suffix::GPU; GPU_EXTRA::gpu_ready(lmp->modify, lmp->error); - cutghost = NULL; + cutghost = nullptr; ghostneigh = 1; } @@ -169,11 +169,11 @@ void PairVashishtaGPU::init_style() double *bigw, *c0, *costheta, *bigb; double *big2b, *bigc; - cutsq = r0 = gamma = eta = NULL; - lam1inv = lam4inv = zizj = mbigd = NULL; - dvrc = big6w = heta = bigh = NULL; - bigw = c0 = costheta = bigb = NULL; - big2b = bigc = NULL; + cutsq = r0 = gamma = eta = nullptr; + lam1inv = lam4inv = zizj = mbigd = nullptr; + dvrc = big6w = heta = bigh = nullptr; + bigw = c0 = costheta = bigb = nullptr; + big2b = bigc = nullptr; memory->create(cutsq,nparams,"pair:cutsq"); memory->create(r0,nparams,"pair:r0"); diff --git a/src/GPU/pppm_gpu.cpp b/src/GPU/pppm_gpu.cpp index cb5e08a46dbf282ec400abcc9fe7fe5fb43508be..a2e3e3ab98c2072e90b08693af3b00d519736ecd 100644 --- a/src/GPU/pppm_gpu.cpp +++ b/src/GPU/pppm_gpu.cpp @@ -91,7 +91,7 @@ void PPPM_GPU_API(forces)(double **f); PPPMGPU::PPPMGPU(LAMMPS *lmp) : PPPM(lmp) { - density_brick_gpu = vd_brick = NULL; + density_brick_gpu = vd_brick = nullptr; kspace_split = false; im_real_space = false; @@ -117,11 +117,11 @@ void PPPMGPU::init() // thru its deallocate(), allocate() // NOTE: could free density_brick and vdxyz_brick after PPPM allocates them, // before allocating db_gpu and vd_brick down below, if don't need, - // if do this, make sure to set them to NULL + // if do this, make sure to set them to a null pointer destroy_3d_offset(density_brick_gpu,nzlo_out,nylo_out); destroy_3d_offset(vd_brick,nzlo_out,nylo_out); - density_brick_gpu = vd_brick = NULL; + density_brick_gpu = vd_brick = nullptr; PPPM::init(); @@ -707,7 +707,7 @@ FFT_SCALAR ***PPPMGPU::create_3d_offset(int n1lo, int n1hi, int n2lo, int n2hi, void PPPMGPU::destroy_3d_offset(FFT_SCALAR ***array, int n1_offset, int n2_offset) { - if (array == NULL) return; + if (array == nullptr) return; memory->sfree(&array[n1_offset][n2_offset]); memory->sfree(array + n1_offset); } @@ -797,7 +797,7 @@ void PPPMGPU::compute_group_group(int groupbit_A, int groupbit_B, int AA_flag) // extend size of per-atom arrays if necessary // part2grid needs to be allocated - if (atom->nmax > nmax || part2grid == NULL) { + if (atom->nmax > nmax || part2grid == nullptr) { memory->destroy(part2grid); nmax = atom->nmax; memory->create(part2grid,nmax,3,"pppm:part2grid"); diff --git a/src/GRANULAR/fix_pour.cpp b/src/GRANULAR/fix_pour.cpp index 4a8e0dbb74a90bf62839215823676afe0199b167..d6b6372aaaad18e399f97d7cd2708acdb20eb9e7 100644 --- a/src/GRANULAR/fix_pour.cpp +++ b/src/GRANULAR/fix_pour.cpp @@ -48,10 +48,10 @@ enum{CONSTANT,EQUAL}; // same as FixGravity /* ---------------------------------------------------------------------- */ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), radius_poly(NULL), frac_poly(NULL), - idrigid(NULL), idshake(NULL), onemols(NULL), molfrac(NULL), coords(NULL), - imageflags(NULL), fixrigid(NULL), fixshake(NULL), recvcounts(NULL), - displs(NULL), random(NULL), random2(NULL) + Fix(lmp, narg, arg), radius_poly(nullptr), frac_poly(nullptr), + idrigid(nullptr), idshake(nullptr), onemols(nullptr), molfrac(nullptr), coords(nullptr), + imageflags(nullptr), fixrigid(nullptr), fixshake(nullptr), recvcounts(nullptr), + displs(nullptr), random(nullptr), random2(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix pour command"); @@ -344,7 +344,7 @@ void FixPour::init() // if rigidflag defined, check for rigid/small fix // its molecule template must be same as this one - fixrigid = NULL; + fixrigid = nullptr; if (rigidflag) { int ifix = modify->find_fix(idrigid); if (ifix < 0) error->all(FLERR,"Fix pour rigid fix does not exist"); @@ -359,7 +359,7 @@ void FixPour::init() // if shakeflag defined, check for SHAKE fix // its molecule template must be same as this one - fixshake = NULL; + fixshake = nullptr; if (shakeflag) { int ifix = modify->find_fix(idshake); if (ifix < 0) error->all(FLERR,"Fix pour shake fix does not exist"); @@ -456,7 +456,7 @@ void FixPour::pre_exchange() // perform allgatherv to acquire list of nearby particles on all procs - double *ptr = NULL; + double *ptr = nullptr; if (ncount) ptr = xmine[0]; MPI_Allgatherv(ptr,4*ncount,MPI_DOUBLE, xnear[0],recvcounts,displs,MPI_DOUBLE,world); @@ -889,16 +889,16 @@ void FixPour::options(int narg, char **arg) iregion = -1; mode = ATOM; - molfrac = NULL; + molfrac = nullptr; rigidflag = 0; - idrigid = NULL; + idrigid = nullptr; shakeflag = 0; - idshake = NULL; + idshake = nullptr; idnext = 0; ignoreflag = ignoreline = ignoretri = 0; dstyle = ONE; radius_max = radius_one = 0.5; - radius_poly = frac_poly = NULL; + radius_poly = frac_poly = nullptr; density_lo = density_hi = 1.0; volfrac = 0.25; maxattempt = 50; @@ -1091,5 +1091,5 @@ void *FixPour::extract(const char *str, int &itype) itype = 0; return &oneradius; } - return NULL; + return nullptr; } diff --git a/src/GRANULAR/fix_wall_gran.cpp b/src/GRANULAR/fix_wall_gran.cpp index a30217ddddb692ae428a4ee3b87898bd53a60ec4..cf05db82ce9105badfdce1759eaf2273e07abcdf 100644 --- a/src/GRANULAR/fix_wall_gran.cpp +++ b/src/GRANULAR/fix_wall_gran.cpp @@ -63,8 +63,8 @@ enum {ROLL_NONE, ROLL_SDS}; /* ---------------------------------------------------------------------- */ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), idregion(NULL), history_one(NULL), - fix_rigid(NULL), mass_rigid(NULL) + Fix(lmp, narg, arg), idregion(nullptr), history_one(nullptr), + fix_rigid(nullptr), mass_rigid(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix wall/gran command"); @@ -303,7 +303,7 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : // wallstyle args - idregion = NULL; + idregion = nullptr; if (strcmp(arg[iarg],"xplane") == 0) { if (narg < iarg+3) error->all(FLERR,"Illegal fix wall/gran command"); @@ -407,16 +407,16 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - history_one = NULL; + history_one = nullptr; grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); atom->add_callback(Atom::RESTART); nmax = 0; - mass_rigid = NULL; + mass_rigid = nullptr; // initialize history as if particle is not touching region - // history_one will be NULL for wallstyle = REGION + // history_one will be a null pointer for wallstyle = REGION if (use_history && history_one) { int nlocal = atom->nlocal; @@ -471,7 +471,7 @@ void FixWallGran::init() // check for FixRigid so can extract rigid body masses - fix_rigid = NULL; + fix_rigid = nullptr; for (i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) break; if (i < modify->nfix) fix_rigid = modify->fix[i]; @@ -576,7 +576,7 @@ void FixWallGran::post_force(int /*vflag*/) // dx,dy,dz = signed distance from wall // for rotating cylinder, reset vwall based on particle position // skip atom if not close enough to wall - // if wall was set to NULL, it's skipped since lo/hi are infinity + // if wall was set to a null pointer, it's skipped since lo/hi are infinity // compute force and torque on atom if close enough to wall // via wall potential matched to pair potential // set history if pair potential stores history @@ -681,7 +681,7 @@ void FixWallGran::post_force(int /*vflag*/) if (peratom_flag) contact = array_atom[i]; else - contact = NULL; + contact = nullptr; if (pairstyle == HOOKE) hooke(rsq,dx,dy,dz,vwall,v[i],f[i], diff --git a/src/GRANULAR/fix_wall_gran.h b/src/GRANULAR/fix_wall_gran.h index 3aa518209a3b9aed183eefa0d093a5e05131ddd0..a81a4c787c11a7740fd0a166c8a8ca7cc5a53a3e 100644 --- a/src/GRANULAR/fix_wall_gran.h +++ b/src/GRANULAR/fix_wall_gran.h @@ -103,7 +103,7 @@ class FixWallGran : public Fix { // rigid body masses for use in granular interactions - class Fix *fix_rigid; // ptr to rigid body fix, NULL if none + class Fix *fix_rigid; // ptr to rigid body fix, null pointer if none double *mass_rigid; // rigid mass for owned+ghost atoms int nmax; // allocated size of mass_rigid diff --git a/src/GRANULAR/fix_wall_gran_region.cpp b/src/GRANULAR/fix_wall_gran_region.cpp index 543df02fc2fb51fd445efff85a668cc3433e6f83..f91bac2c9b5b2ac33efe0574c4c714f1bccc6d76 100644 --- a/src/GRANULAR/fix_wall_gran_region.cpp +++ b/src/GRANULAR/fix_wall_gran_region.cpp @@ -39,9 +39,9 @@ enum {NORMAL_HOOKE, NORMAL_HERTZ, HERTZ_MATERIAL, DMT, JKR}; /* ---------------------------------------------------------------------- */ FixWallGranRegion::FixWallGranRegion(LAMMPS *lmp, int narg, char **arg) : - FixWallGran(lmp, narg, arg), region(NULL), region_style(NULL), - ncontact(NULL), - walls(NULL), history_many(NULL), c2r(NULL) + FixWallGran(lmp, narg, arg), region(nullptr), region_style(nullptr), + ncontact(nullptr), + walls(nullptr), history_many(nullptr), c2r(nullptr) { restart_global = 1; motion_resetflag = 0; @@ -61,11 +61,11 @@ FixWallGranRegion::FixWallGranRegion(LAMMPS *lmp, int narg, char **arg) : // do not register with Atom class, since parent class did that memory->destroy(history_one); - history_one = NULL; + history_one = nullptr; - ncontact = NULL; - walls = NULL; - history_many = NULL; + ncontact = nullptr; + walls = nullptr; + history_many = nullptr; grow_arrays(atom->nmax); // initialize shear history as if particle is not touching region @@ -262,7 +262,7 @@ void FixWallGranRegion::post_force(int /*vflag*/) if (peratom_flag) contact = array_atom[i]; else - contact = NULL; + contact = nullptr; if (pairstyle == HOOKE) hooke(rsq,dx,dy,dz,vwall,v[i],f[i], diff --git a/src/GRANULAR/pair_gran_hooke_history.cpp b/src/GRANULAR/pair_gran_hooke_history.cpp index 68a7803f4bf62cb9726b7b9c139e11cb27649156..b296f84657a1146637b3a194cf81d428a0f4b0d0 100644 --- a/src/GRANULAR/pair_gran_hooke_history.cpp +++ b/src/GRANULAR/pair_gran_hooke_history.cpp @@ -52,7 +52,7 @@ PairGranHookeHistory::PairGranHookeHistory(LAMMPS *lmp) : Pair(lmp) neighprev = 0; nmax = 0; - mass_rigid = NULL; + mass_rigid = nullptr; // set comm size needed by this Pair if used with fix rigid @@ -65,7 +65,7 @@ PairGranHookeHistory::PairGranHookeHistory(LAMMPS *lmp) : Pair(lmp) // create dummy fix as placeholder for FixNeighHistory // this is so final order of Modify:fix will conform to input script - fix_history = NULL; + fix_history = nullptr; modify->add_fix("NEIGH_HISTORY_HH_DUMMY all DUMMY"); fix_dummy = (FixDummy *) modify->fix[modify->nfix-1]; } @@ -426,7 +426,7 @@ void PairGranHookeHistory::init_style() // it replaces FixDummy, created in the constructor // this is so its order in the fix list is preserved - if (history && fix_history == NULL) { + if (history && fix_history == nullptr) { char dnumstr[16]; sprintf(dnumstr,"%d",size_history); char **fixarg = new char*[4]; @@ -450,7 +450,7 @@ void PairGranHookeHistory::init_style() // check for FixRigid so can extract rigid body masses - fix_rigid = NULL; + fix_rigid = nullptr; for (i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) break; if (i < modify->nfix) fix_rigid = modify->fix[i]; @@ -554,7 +554,7 @@ void PairGranHookeHistory::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); } } @@ -580,12 +580,12 @@ void PairGranHookeHistory::write_restart_settings(FILE *fp) void PairGranHookeHistory::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&kn,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&kt,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamman,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gammat,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&xmu,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dampflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&kn,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&kt,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamman,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gammat,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&xmu,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dampflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&kn,1,MPI_DOUBLE,0,world); MPI_Bcast(&kt,1,MPI_DOUBLE,0,world); diff --git a/src/GRANULAR/pair_gran_hooke_history.h b/src/GRANULAR/pair_gran_hooke_history.h index 309af54ee6dcd75c65e059907ebbb825b5c1fd40..c27ce8a9af786684935b2a7d29ecf0adb5c38391 100644 --- a/src/GRANULAR/pair_gran_hooke_history.h +++ b/src/GRANULAR/pair_gran_hooke_history.h @@ -61,7 +61,7 @@ class PairGranHookeHistory : public Pair { // storage of rigid body masses for use in granular interactions - class Fix *fix_rigid; // ptr to rigid body fix, NULL if none + class Fix *fix_rigid; // ptr to rigid body fix, null pointer if none double *mass_rigid; // rigid mass for owned+ghost atoms int nmax; // allocated size of mass_rigid diff --git a/src/GRANULAR/pair_granular.cpp b/src/GRANULAR/pair_granular.cpp index ee0eb2ad774fe655f0d1d7556a456a38b5d26ff1..5edc656a67a85fc0dc8e8a6591effc7838f6f1f1 100644 --- a/src/GRANULAR/pair_granular.cpp +++ b/src/GRANULAR/pair_granular.cpp @@ -73,14 +73,14 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) neighprev = 0; nmax = 0; - mass_rigid = NULL; + mass_rigid = nullptr; - onerad_dynamic = NULL; - onerad_frozen = NULL; - maxrad_dynamic = NULL; - maxrad_frozen = NULL; + onerad_dynamic = nullptr; + onerad_frozen = nullptr; + maxrad_dynamic = nullptr; + maxrad_frozen = nullptr; - history_transfer_factors = NULL; + history_transfer_factors = nullptr; dt = update->dt; @@ -97,7 +97,7 @@ PairGranular::PairGranular(LAMMPS *lmp) : Pair(lmp) // create dummy fix as placeholder for FixNeighHistory // this is so final order of Modify:fix will conform to input script - fix_history = NULL; + fix_history = nullptr; modify->add_fix("NEIGH_HISTORY_GRANULAR_DUMMY all DUMMY"); fix_dummy = (FixDummy *) modify->fix[modify->nfix-1]; } @@ -1101,7 +1101,7 @@ void PairGranular::init_style() // it replaces FixDummy, created in the constructor // this is so its order in the fix list is preserved - if (use_history && fix_history == NULL) { + if (use_history && fix_history == nullptr) { char dnumstr[16]; sprintf(dnumstr,"%d",size_history); char **fixarg = new char*[4]; @@ -1125,7 +1125,7 @@ void PairGranular::init_style() // check for FixRigid so can extract rigid body masses - fix_rigid = NULL; + fix_rigid = nullptr; for (i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) break; if (i < modify->nfix) fix_rigid = modify->fix[i]; @@ -1330,20 +1330,20 @@ void PairGranular::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&normal_model[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&damping_model[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tangential_model[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&roll_model[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&twist_model[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,normal_coeffs[i][j],sizeof(double),4,fp,NULL,error); - utils::sfread(FLERR,tangential_coeffs[i][j],sizeof(double),3,fp,NULL,error); - utils::sfread(FLERR,roll_coeffs[i][j],sizeof(double),3,fp,NULL,error); - utils::sfread(FLERR,twist_coeffs[i][j],sizeof(double),3,fp,NULL,error); - utils::sfread(FLERR,&cutoff_type[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&normal_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&damping_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tangential_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&roll_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&twist_model[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,normal_coeffs[i][j],sizeof(double),4,fp,nullptr,error); + utils::sfread(FLERR,tangential_coeffs[i][j],sizeof(double),3,fp,nullptr,error); + utils::sfread(FLERR,roll_coeffs[i][j],sizeof(double),3,fp,nullptr,error); + utils::sfread(FLERR,twist_coeffs[i][j],sizeof(double),3,fp,nullptr,error); + utils::sfread(FLERR,&cutoff_type[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&normal_model[i][j],1,MPI_INT,0,world); MPI_Bcast(&damping_model[i][j],1,MPI_INT,0,world); diff --git a/src/GRANULAR/pair_granular.h b/src/GRANULAR/pair_granular.h index e9ba629b49580f3edfe466cc4d9a19a96ce9a565..7ef4f2af98bdc24f0a1ddb5605068d55559751bb 100644 --- a/src/GRANULAR/pair_granular.h +++ b/src/GRANULAR/pair_granular.h @@ -56,7 +56,7 @@ class PairGranular : public Pair { // storage of rigid body masses for use in granular interactions - class Fix *fix_rigid; // ptr to rigid body fix, NULL if none + class Fix *fix_rigid; // ptr to rigid body fix, null pointer if none double *mass_rigid; // rigid mass for owned+ghost atoms int nmax; // allocated size of mass_rigid diff --git a/src/KIM/fix_store_kim.cpp b/src/KIM/fix_store_kim.cpp index 776d8aab982e355746d2243af296d8feace58806..5428b75093267a10c81099be92978e0a4cfa3786 100644 --- a/src/KIM/fix_store_kim.cpp +++ b/src/KIM/fix_store_kim.cpp @@ -67,8 +67,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixStoreKIM::FixStoreKIM(LAMMPS *lmp, int narg, char **arg) - : Fix(lmp, narg, arg), simulator_model(NULL), model_name(NULL), - model_units(NULL), user_units(NULL) + : Fix(lmp, narg, arg), simulator_model(nullptr), model_name(nullptr), + model_units(nullptr), user_units(nullptr) { if (narg != 3) error->all(FLERR,"Illegal fix STORE/KIM command"); } @@ -82,25 +82,25 @@ FixStoreKIM::~FixStoreKIM() if (simulator_model) { KIM_SimulatorModel *sm = (KIM_SimulatorModel *)simulator_model; KIM_SimulatorModel_Destroy(&sm); - simulator_model = NULL; + simulator_model = nullptr; } if (model_name) { char *mn = (char *)model_name; delete[] mn; - model_name = NULL; + model_name = nullptr; } if (model_units) { char *mu = (char *)model_units; delete[] mu; - model_units = NULL; + model_units = nullptr; } if (user_units) { char *uu = (char *)user_units; delete[] uu; - user_units = NULL; + user_units = nullptr; } } @@ -151,5 +151,5 @@ void *FixStoreKIM::getptr(const char *name) else if (strcmp(name,"model_name") == 0) return model_name; else if (strcmp(name,"model_units") == 0) return model_units; else if (strcmp(name,"user_units") == 0) return user_units; - else return NULL; + else return nullptr; } diff --git a/src/KIM/fix_store_kim.h b/src/KIM/fix_store_kim.h index 6baf480993cabfaba8afa69431a601627a9d523f..5775056876cc508036f43fdfb12af165d005296d 100644 --- a/src/KIM/fix_store_kim.h +++ b/src/KIM/fix_store_kim.h @@ -79,8 +79,8 @@ class FixStoreKIM : public Fix { private: void *simulator_model; // pointer to KIM simulator model class void *model_name; // string of KIM model name - void *model_units; // string of unit conversion origin or NULL - void *user_units; // string of unit conversion target or NULL + void *model_units; // string of unit conversion origin or null pointer + void *user_units; // string of unit conversion target or null pointer }; } diff --git a/src/KIM/kim_init.cpp b/src/KIM/kim_init.cpp index 684108be715363b2dddee3ea37611dc27419ffd4..bbeffe2d82b417de03a55a4e6ec340961a29ad14 100644 --- a/src/KIM/kim_init.cpp +++ b/src/KIM/kim_init.cpp @@ -96,7 +96,7 @@ void KimInit::command(int narg, char **arg) } else unit_conversion_mode = false; char *model_units; - KIM_Model *pkim = NULL; + KIM_Model *pkim = nullptr; if (universe->me == 0) std::remove("kim.log"); @@ -366,8 +366,8 @@ void KimInit::do_init(char *model_name, char *user_units, char *model_units, KIM if (numberOfParameters) { KIM_DataType kim_DataType; int extent; - char const *str_name = NULL; - char const *str_desc = NULL; + char const *str_name = nullptr; + char const *str_desc = nullptr; mesg += std::to_string(numberOfParameters) + " mutable parameters. \n"; @@ -486,7 +486,7 @@ void KimInit::write_log_cite(char *model_name) int availableAsString; char const * fileString; err = KIM_Collections_GetItemMetadataFile( - coll,i,&fileName,NULL,NULL,&availableAsString,&fileString); + coll,i,&fileName,nullptr,nullptr,&availableAsString,&fileString); if (err) continue; if (0 == strncmp("kimcite",fileName,7)) { diff --git a/src/KIM/kim_interactions.cpp b/src/KIM/kim_interactions.cpp index 5f45dd34dc341672437f04039e375ab67e8f59de..c5ae2ec380703fc40dbddcf804537a4a1d57b3b5 100644 --- a/src/KIM/kim_interactions.cpp +++ b/src/KIM/kim_interactions.cpp @@ -103,12 +103,12 @@ void KimInteractions::do_setup(int narg, char **arg) fixed_types = false; } - char *model_name = NULL; - KIM_SimulatorModel *simulatorModel(NULL); + char *model_name = nullptr; + KIM_SimulatorModel *simulatorModel(nullptr); // check if we had a kim_init command by finding fix STORE/KIM // retrieve model name and pointer to simulator model class instance. - // validate model name if not given as NULL. + // validate model name if not given as null pointer. int ifix = modify->find_fix("KIM_MODEL_STORE"); if (ifix >= 0) { @@ -256,7 +256,7 @@ void KimInteractions::KIM_SET_TYPE_PARAMETERS(const std::string &input_line) con FILE *fp; fp = fopen(filename.c_str(),"r"); - if (fp == NULL) { + if (fp == nullptr) { error->one(FLERR,"Parameter file not found"); } @@ -266,7 +266,7 @@ void KimInteractions::KIM_SET_TYPE_PARAMETERS(const std::string &input_line) con while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; diff --git a/src/KIM/kim_param.cpp b/src/KIM/kim_param.cpp index 6f4ac5cc21e1f98554f717017099fe282cb5665e..121f167ab6a10119866d3735ac1dc77e3a5c66c8 100644 --- a/src/KIM/kim_param.cpp +++ b/src/KIM/kim_param.cpp @@ -185,7 +185,7 @@ void KimParam::command(int narg, char **arg) input->write_echo(fmt::format("#=== BEGIN kim-param {} ===================" "==================\n",kim_param_get_set)); - KIM_Model *pkim = NULL; + KIM_Model *pkim = nullptr; std::string atom_type_list; @@ -251,9 +251,9 @@ void KimParam::command(int narg, char **arg) // Get the parameters if (kim_param_get_set == "get") { // Parameter name - char *paramname = NULL; + char *paramname = nullptr; // Variable name - char *varname = NULL; + char *varname = nullptr; // Loop over all the arguments for (int i = 1; i < narg;) { @@ -267,8 +267,8 @@ void KimParam::command(int narg, char **arg) int param_index; KIM_DataType kim_DataType; int extent; - char const *str_name = NULL; - char const *str_desc = NULL; + char const *str_name = nullptr; + char const *str_desc = nullptr; for (param_index = 0; param_index < numberOfParameters; ++param_index) { kim_error = KIM_Model_GetParameterMetadata(pkim, param_index, @@ -344,7 +344,7 @@ void KimParam::command(int narg, char **arg) } int const nvars = nubound - nlbound + 1; - char **varsname = NULL; + char **varsname = nullptr; if (i < narg) { // Get the variable/variable_base name diff --git a/src/KIM/kim_property.cpp b/src/KIM/kim_property.cpp index 95a12748596609d99fc179fe9458919fea1cd11e..4a381fb8dade3226e36d6cad2ea9abcee55f8542 100644 --- a/src/KIM/kim_property.cpp +++ b/src/KIM/kim_property.cpp @@ -112,7 +112,7 @@ void kimProperty::command(int narg, char **arg) PyGILState_STATE gstate = PyGILState_Ensure(); // kim_property module - PyObject *kim_property = NULL; + PyObject *kim_property = nullptr; // import kim_property { @@ -438,7 +438,7 @@ void kimProperty::command(int narg, char **arg) "evaluation failed!"); } } else - pValue = NULL; + pValue = nullptr; // Destroy the variable input->variable->set("kim_property_str delete"); diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index 7ed70972c5060cad0c7f00e08a6594e9d4637634..30b5e6cbb2129dd8304537acdc28ebecd547a16a 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -78,9 +78,9 @@ PairKIM::PairKIM(LAMMPS *lmp) : Pair(lmp), settings_call_count(0), init_style_call_count(0), - kim_modelname(NULL), - lmps_map_species_to_unique(NULL), - lmps_unique_elements(NULL), + kim_modelname(nullptr), + lmps_map_species_to_unique(nullptr), + lmps_unique_elements(nullptr), lmps_num_unique_elements(0), lmps_units(METAL), lengthUnit(KIM_LENGTH_UNIT_unused), @@ -88,8 +88,8 @@ PairKIM::PairKIM(LAMMPS *lmp) : chargeUnit(KIM_CHARGE_UNIT_unused), temperatureUnit(KIM_TEMPERATURE_UNIT_unused), timeUnit(KIM_TIME_UNIT_unused), - pkim(NULL), - pargs(NULL), + pkim(nullptr), + pargs(nullptr), kim_model_support_for_energy(KIM_SUPPORT_STATUS_notSupported), kim_model_support_for_forces(KIM_SUPPORT_STATUS_notSupported), kim_model_support_for_particleEnergy(KIM_SUPPORT_STATUS_notSupported), @@ -97,15 +97,15 @@ PairKIM::PairKIM(LAMMPS *lmp) : lmps_local_tot_num_atoms(0), kim_global_influence_distance(0.0), kim_number_of_neighbor_lists(0), - kim_cutoff_values(NULL), - modelWillNotRequestNeighborsOfNoncontributingParticles(NULL), - neighborLists(NULL), - kim_particle_codes(NULL), + kim_cutoff_values(nullptr), + modelWillNotRequestNeighborsOfNoncontributingParticles(nullptr), + neighborLists(nullptr), + kim_particle_codes(nullptr), lmps_maxalloc(0), - kim_particleSpecies(NULL), - kim_particleContributing(NULL), - lmps_stripped_neigh_list(NULL), - lmps_stripped_neigh_ptr(NULL) + kim_particleSpecies(nullptr), + kim_particleContributing(nullptr), + lmps_stripped_neigh_list(nullptr), + lmps_stripped_neigh_ptr(nullptr) { // Initialize Pair data members to appropriate values single_enable = 0; // We do not provide the Single() function @@ -137,7 +137,7 @@ PairKIM::~PairKIM() if (kim_particle_codes_ok) { delete [] kim_particle_codes; - kim_particle_codes = NULL; + kim_particle_codes = nullptr; kim_particle_codes_ok = false; } @@ -393,7 +393,7 @@ void PairKIM::coeff(int narg, char **arg) // setup mapping between LAMMPS unique elements and KIM species codes if (kim_particle_codes_ok) { delete [] kim_particle_codes; - kim_particle_codes = NULL; + kim_particle_codes = nullptr; kim_particle_codes_ok = false; } kim_particle_codes = new int[lmps_num_unique_elements]; @@ -430,7 +430,7 @@ void PairKIM::coeff(int narg, char **arg) int kimerror; // Parameter name - char *paramname = NULL; + char *paramname = nullptr; for (int i = 2 + atom->ntypes; i < narg;) { // Parameter name @@ -443,8 +443,8 @@ void PairKIM::coeff(int narg, char **arg) int param_index; KIM_DataType kim_DataType; int extent; - char const *str_name = NULL; - char const *str_desc = NULL; + char const *str_name = nullptr; + char const *str_desc = nullptr; for (param_index = 0; param_index < numberOfParameters; ++param_index) { kimerror = KIM_Model_GetParameterMetadata(pkim, param_index, @@ -903,7 +903,7 @@ void PairKIM::set_argument_pointers() kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( pargs,KIM_COMPUTE_ARGUMENT_NAME_partialEnergy, - static_cast(NULL)); + static_cast(nullptr)); } } @@ -924,7 +924,7 @@ void PairKIM::set_argument_pointers() kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( pargs, KIM_COMPUTE_ARGUMENT_NAME_partialParticleEnergy, - static_cast(NULL)); + static_cast(nullptr)); } else if (KIM_SupportStatus_NotEqual(kim_model_support_for_particleEnergy, KIM_SUPPORT_STATUS_notSupported)) { kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( @@ -937,7 +937,7 @@ void PairKIM::set_argument_pointers() kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( pargs, KIM_COMPUTE_ARGUMENT_NAME_partialForces, - static_cast(NULL)); + static_cast(nullptr)); } else { kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( pargs, KIM_COMPUTE_ARGUMENT_NAME_partialForces, &(atom->f[0][0])); @@ -960,7 +960,7 @@ void PairKIM::set_argument_pointers() kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( pargs, KIM_COMPUTE_ARGUMENT_NAME_partialParticleVirial, - static_cast(NULL)); + static_cast(nullptr)); } else if (KIM_SupportStatus_NotEqual(kim_model_support_for_particleVirial, KIM_SUPPORT_STATUS_notSupported)) { kimerror = kimerror || KIM_ComputeArguments_SetArgumentPointerDouble( diff --git a/src/KOKKOS/atom_kokkos.cpp b/src/KOKKOS/atom_kokkos.cpp index c3ded3ec6302fca0828a27500ce2149e2dfb526e..a587494d09b36c16e1bd34c90dea7956abd98a46 100644 --- a/src/KOKKOS/atom_kokkos.cpp +++ b/src/KOKKOS/atom_kokkos.cpp @@ -87,7 +87,7 @@ AtomKokkos::~AtomKokkos() memoryKK->destroy_kokkos(k_duChem,duChem); memoryKK->destroy_kokkos(k_dvector,dvector); - dvector = NULL; + dvector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -282,7 +282,7 @@ int AtomKokkos::add_custom(const char *name, int flag) /* ---------------------------------------------------------------------- remove a custom variable of type flag = 0/1 for int/double at index - free memory for vector and name and set ptrs to NULL + free memory for vector and name and set ptrs to a null pointer ivector/dvector and iname/dname lists never shrink ------------------------------------------------------------------------- */ @@ -290,14 +290,14 @@ void AtomKokkos::remove_custom(int flag, int index) { if (flag == 0) { memory->destroy(ivector[index]); - ivector[index] = NULL; + ivector[index] = nullptr; delete [] iname[index]; - iname[index] = NULL; + iname[index] = nullptr; } else { //memoryKK->destroy_kokkos(dvector); - dvector[index] = NULL; + dvector[index] = nullptr; delete [] dname[index]; - dname[index] = NULL; + dname[index] = nullptr; } } diff --git a/src/KOKKOS/atom_vec_angle_kokkos.cpp b/src/KOKKOS/atom_vec_angle_kokkos.cpp index d7ca73777e7066aec178552cf16b6bfe5449e671..150cd93dea0af5280a64fd6a73dbbe4653dc415f 100644 --- a/src/KOKKOS/atom_vec_angle_kokkos.cpp +++ b/src/KOKKOS/atom_vec_angle_kokkos.cpp @@ -48,7 +48,7 @@ AtomVecAngleKokkos::AtomVecAngleKokkos(LAMMPS *lmp) : AtomVecKokkos(lmp) k_count = DAT::tdual_int_1d("atom::k_count",1); atomKK = (AtomKokkos *) atom; commKK = (CommKokkos *) comm; - buffer = NULL; + buffer = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/atom_vec_kokkos.cpp b/src/KOKKOS/atom_vec_kokkos.cpp index 9e39f537335843430b897063468c5b8a546c5d82..f2dca9bebc4f0f6895ca6e3d90feea0668482cfa 100644 --- a/src/KOKKOS/atom_vec_kokkos.cpp +++ b/src/KOKKOS/atom_vec_kokkos.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; AtomVecKokkos::AtomVecKokkos(LAMMPS *lmp) : AtomVec(lmp) { kokkosable = 1; - buffer = NULL; + buffer = nullptr; buffer_size = 0; no_comm_vel_flag = 0; diff --git a/src/KOKKOS/comm_kokkos.cpp b/src/KOKKOS/comm_kokkos.cpp index c5ff66e99cdf17df36d67ba972ab4d557cda378a..c6ba15febd66d0ea14544ae66aee014cb55c4e32 100644 --- a/src/KOKKOS/comm_kokkos.cpp +++ b/src/KOKKOS/comm_kokkos.cpp @@ -45,7 +45,7 @@ CommKokkos::CommKokkos(LAMMPS *lmp) : CommBrick(lmp) { if (sendlist) for (int i = 0; i < maxswap; i++) memory->destroy(sendlist[i]); memory->sfree(sendlist); - sendlist = NULL; + sendlist = nullptr; k_sendlist = DAT::tdual_int_2d(); k_total_send = DAT::tdual_int_scalar("comm::k_total_send"); @@ -54,9 +54,9 @@ CommKokkos::CommKokkos(LAMMPS *lmp) : CommBrick(lmp) // initialize comm buffers & exchange memory memory->destroy(buf_send); - buf_send = NULL; + buf_send = nullptr; memory->destroy(buf_recv); - buf_recv = NULL; + buf_recv = nullptr; k_exchange_lists = DAT::tdual_int_2d("comm:k_exchange_lists",2,100); k_exchange_sendlist = Kokkos::subview(k_exchange_lists,0,Kokkos::ALL); @@ -65,7 +65,7 @@ CommKokkos::CommKokkos(LAMMPS *lmp) : CommBrick(lmp) k_sendflag = DAT::tdual_int_1d("comm:k_sendflag",100); memory->destroy(maxsendlist); - maxsendlist = NULL; + maxsendlist = nullptr; memory->create(maxsendlist,maxswap,"comm:maxsendlist"); for (int i = 0; i < maxswap; i++) { maxsendlist[i] = BUFMIN; @@ -82,11 +82,11 @@ CommKokkos::CommKokkos(LAMMPS *lmp) : CommBrick(lmp) CommKokkos::~CommKokkos() { memoryKK->destroy_kokkos(k_sendlist,sendlist); - sendlist = NULL; + sendlist = nullptr; memoryKK->destroy_kokkos(k_buf_send,buf_send); - buf_send = NULL; + buf_send = nullptr; memoryKK->destroy_kokkos(k_buf_recv,buf_recv); - buf_recv = NULL; + buf_recv = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/fft3d_kokkos.cpp b/src/KOKKOS/fft3d_kokkos.cpp index ff95998e4ec7a98241e9a19c4c1c11995306ba24..d7f556cf87c7cf5adabe76aed2a1333b4252653e 100644 --- a/src/KOKKOS/fft3d_kokkos.cpp +++ b/src/KOKKOS/fft3d_kokkos.cpp @@ -69,7 +69,7 @@ FFT3dKokkos::FFT3dKokkos(LAMMPS *lmp, MPI_Comm comm, int nfast, int in_ilo,in_ihi,in_jlo,in_jhi,in_klo,in_khi, out_ilo,out_ihi,out_jlo,out_jhi,out_klo,out_khi, scaled,permute,nbuf,usecollective,nthreads,usecuda_aware); - if (plan == NULL) error->one(FLERR,"Could not create 3d FFT plan"); + if (plan == nullptr) error->one(FLERR,"Could not create 3d FFT plan"); } /* ---------------------------------------------------------------------- */ @@ -403,7 +403,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl plan = new struct fft_plan_3d_kokkos; remapKK = new RemapKokkos(lmp); - if (plan == NULL) return NULL; + if (plan == nullptr) return nullptr; // remap from initial distribution to layout needed for 1st set of 1d FFTs // not needed if all procs own entire fast axis initially @@ -422,7 +422,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl first_jhi = in_jhi; first_klo = in_klo; first_khi = in_khi; - plan->pre_plan = NULL; + plan->pre_plan = nullptr; } else { first_ilo = 0; @@ -436,7 +436,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl first_ilo,first_ihi,first_jlo,first_jhi, first_klo,first_khi,2,0,0,FFT_PRECISION, usecollective,usecuda_aware); - if (plan->pre_plan == NULL) return NULL; + if (plan->pre_plan == nullptr) return nullptr; } // 1d FFTs along fast axis @@ -461,7 +461,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl second_ilo,second_ihi,second_jlo,second_jhi, second_klo,second_khi,2,1,0,FFT_PRECISION, usecollective,usecuda_aware); - if (plan->mid1_plan == NULL) return NULL; + if (plan->mid1_plan == nullptr) return nullptr; // 1d FFTs along mid axis @@ -502,7 +502,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl third_jlo,third_jhi,third_klo,third_khi, third_ilo,third_ihi,2,1,0,FFT_PRECISION, usecollective,usecuda_aware); - if (plan->mid2_plan == NULL) return NULL; + if (plan->mid2_plan == nullptr) return nullptr; // 1d FFTs along slow axis @@ -521,7 +521,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl MPI_Allreduce(&flag,&remapflag,1,MPI_INT,MPI_MAX,comm); if (remapflag == 0) - plan->post_plan = NULL; + plan->post_plan = nullptr; else { plan->post_plan = remapKK->remap_3d_create_plan_kokkos(comm, @@ -530,7 +530,7 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl out_klo,out_khi,out_ilo,out_ihi, out_jlo,out_jhi,2,(permute+1)%3,0,FFT_PRECISION, usecollective,usecuda_aware); - if (plan->post_plan == NULL) return NULL; + if (plan->post_plan == nullptr) return nullptr; } // configure plan memory pointers and allocate work space @@ -648,39 +648,39 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl plan->plan_fast_forward = FFTW_API(plan_many_dft)(1, &nfast,plan->total1/plan->length1, - NULL,&nfast,1,plan->length1, - NULL,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, FFTW_FORWARD,FFTW_ESTIMATE); plan->plan_fast_backward = FFTW_API(plan_many_dft)(1, &nfast,plan->total1/plan->length1, - NULL,&nfast,1,plan->length1, - NULL,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, FFTW_BACKWARD,FFTW_ESTIMATE); plan->plan_mid_forward = FFTW_API(plan_many_dft)(1, &nmid,plan->total2/plan->length2, - NULL,&nmid,1,plan->length2, - NULL,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, FFTW_FORWARD,FFTW_ESTIMATE); plan->plan_mid_backward = FFTW_API(plan_many_dft)(1, &nmid,plan->total2/plan->length2, - NULL,&nmid,1,plan->length2, - NULL,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, FFTW_BACKWARD,FFTW_ESTIMATE); plan->plan_slow_forward = FFTW_API(plan_many_dft)(1, &nslow,plan->total3/plan->length3, - NULL,&nslow,1,plan->length3, - NULL,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, FFTW_FORWARD,FFTW_ESTIMATE); plan->plan_slow_backward = FFTW_API(plan_many_dft)(1, &nslow,plan->total3/plan->length3, - NULL,&nslow,1,plan->length3, - NULL,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, FFTW_BACKWARD,FFTW_ESTIMATE); #elif defined(FFT_CUFFT) @@ -704,16 +704,16 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl kissfftKK = new KissFFTKokkos(); - plan->cfg_fast_forward = KissFFTKokkos::kiss_fft_alloc_kokkos(nfast,0,NULL,NULL); - plan->cfg_fast_backward = KissFFTKokkos::kiss_fft_alloc_kokkos(nfast,1,NULL,NULL); + plan->cfg_fast_forward = KissFFTKokkos::kiss_fft_alloc_kokkos(nfast,0,nullptr,nullptr); + plan->cfg_fast_backward = KissFFTKokkos::kiss_fft_alloc_kokkos(nfast,1,nullptr,nullptr); if (nmid == nfast) { plan->cfg_mid_forward = plan->cfg_fast_forward; plan->cfg_mid_backward = plan->cfg_fast_backward; } else { - plan->cfg_mid_forward = KissFFTKokkos::kiss_fft_alloc_kokkos(nmid,0,NULL,NULL); - plan->cfg_mid_backward = KissFFTKokkos::kiss_fft_alloc_kokkos(nmid,1,NULL,NULL); + plan->cfg_mid_forward = KissFFTKokkos::kiss_fft_alloc_kokkos(nmid,0,nullptr,nullptr); + plan->cfg_mid_backward = KissFFTKokkos::kiss_fft_alloc_kokkos(nmid,1,nullptr,nullptr); } if (nslow == nfast) { @@ -725,8 +725,8 @@ struct fft_plan_3d_kokkos* FFT3dKokkos::fft_3d_create_pl plan->cfg_slow_backward = plan->cfg_mid_backward; } else { - plan->cfg_slow_forward = KissFFTKokkos::kiss_fft_alloc_kokkos(nslow,0,NULL,NULL); - plan->cfg_slow_backward = KissFFTKokkos::kiss_fft_alloc_kokkos(nslow,1,NULL,NULL); + plan->cfg_slow_forward = KissFFTKokkos::kiss_fft_alloc_kokkos(nslow,0,nullptr,nullptr); + plan->cfg_slow_backward = KissFFTKokkos::kiss_fft_alloc_kokkos(nslow,1,nullptr,nullptr); } #endif diff --git a/src/KOKKOS/fix_langevin_kokkos.cpp b/src/KOKKOS/fix_langevin_kokkos.cpp index 6f4b21463e840d5804a893039aaf85495672fb7f..0e3d8c360ab9c61249fdacce53726c1ccebbef9e 100644 --- a/src/KOKKOS/fix_langevin_kokkos.cpp +++ b/src/KOKKOS/fix_langevin_kokkos.cpp @@ -735,7 +735,7 @@ void FixLangevinKokkos::reset_dt() template double FixLangevinKokkos::compute_scalar() { - if (!tallyflag || flangevin == NULL) return 0.0; + if (!tallyflag || flangevin == nullptr) return 0.0; v = atomKK->k_v.template view(); mask = atomKK->k_mask.template view(); @@ -893,19 +893,19 @@ void FixLangevinKokkos::copy_arrays(int i, int j, int /*delflag*/) template void FixLangevinKokkos::cleanup_copy() { - random = NULL; - tstr = NULL; - gfactor1 = NULL; - gfactor2 = NULL; - ratio = NULL; - id_temp = NULL; - flangevin = NULL; - tforce = NULL; + random = nullptr; + tstr = nullptr; + gfactor1 = nullptr; + gfactor2 = nullptr; + ratio = nullptr; + id_temp = nullptr; + flangevin = nullptr; + tforce = nullptr; gjfflag = 0; - franprev = NULL; - lv = NULL; - id = style = NULL; - vatom = NULL; + franprev = nullptr; + lv = nullptr; + id = style = nullptr; + vatom = nullptr; } namespace LAMMPS_NS { diff --git a/src/KOKKOS/fix_minimize_kokkos.cpp b/src/KOKKOS/fix_minimize_kokkos.cpp index 13b9cb02a735fdf753b56cb3f3c3b7c95b3d28ef..f123a663d2fe43d9abfb2df1bece0982a9d58581 100644 --- a/src/KOKKOS/fix_minimize_kokkos.cpp +++ b/src/KOKKOS/fix_minimize_kokkos.cpp @@ -34,7 +34,7 @@ FixMinimizeKokkos::FixMinimizeKokkos(LAMMPS *lmp, int narg, char **arg) : FixMinimizeKokkos::~FixMinimizeKokkos() { memoryKK->destroy_kokkos(k_vectors,vectors); - vectors = NULL; + vectors = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/fix_neigh_history_kokkos.cpp b/src/KOKKOS/fix_neigh_history_kokkos.cpp index d1f3f6632766b5f9a31b27cb42edf59f7a1264c5..56a37c8d1b6dd9d6d2a2a2b7ab568ea719a89f1b 100644 --- a/src/KOKKOS/fix_neigh_history_kokkos.cpp +++ b/src/KOKKOS/fix_neigh_history_kokkos.cpp @@ -35,9 +35,9 @@ FixNeighHistoryKokkos::FixNeighHistoryKokkos(LAMMPS *lmp, int narg, memory->destroy(npartner); memory->sfree(partner); memory->sfree(valuepartner); - npartner = NULL; - partner = NULL; - valuepartner = NULL; + npartner = nullptr; + partner = nullptr; + valuepartner = nullptr; maxpartner = 8; grow_arrays(atom->nmax); diff --git a/src/KOKKOS/fix_nve_kokkos.cpp b/src/KOKKOS/fix_nve_kokkos.cpp index beabc5572728bbd78c97728a45548cd3ff571cb0..fe6aeaccfffd6f0f1578c86d3490f1a3fc902d56 100644 --- a/src/KOKKOS/fix_nve_kokkos.cpp +++ b/src/KOKKOS/fix_nve_kokkos.cpp @@ -163,8 +163,8 @@ void FixNVEKokkos::final_integrate_rmass_item(int i) const template void FixNVEKokkos::cleanup_copy() { - id = style = NULL; - vatom = NULL; + id = style = nullptr; + vatom = nullptr; } namespace LAMMPS_NS { diff --git a/src/KOKKOS/fix_nve_sphere_kokkos.cpp b/src/KOKKOS/fix_nve_sphere_kokkos.cpp index 64298748db90b9d3631e4ccee78e0818b8127de8..f292f30d3f7c4693b53fe116d2b9e070f0c654bc 100644 --- a/src/KOKKOS/fix_nve_sphere_kokkos.cpp +++ b/src/KOKKOS/fix_nve_sphere_kokkos.cpp @@ -39,8 +39,8 @@ FixNVESphereKokkos::FixNVESphereKokkos(LAMMPS *lmp, int narg, char * template void FixNVESphereKokkos::cleanup_copy() { - id = style = NULL; - vatom = NULL; + id = style = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/fix_qeq_reax_kokkos.cpp b/src/KOKKOS/fix_qeq_reax_kokkos.cpp index a71b52e0f12334d4ae73538a8c90576e535f746d..0f4ab850aeb8fb594f073d282f901a539e6d3cdf 100644 --- a/src/KOKKOS/fix_qeq_reax_kokkos.cpp +++ b/src/KOKKOS/fix_qeq_reax_kokkos.cpp @@ -1423,7 +1423,7 @@ void FixQEqReaxKokkos::unpack_reverse_comm(int n, int *list, double template void FixQEqReaxKokkos::cleanup_copy() { - id = style = NULL; + id = style = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp b/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp index f98ab0314cf6ba5d679614730dafe71062374842..faa5a983151e834a83574c7dc9141b7defc5452f 100644 --- a/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp +++ b/src/KOKKOS/fix_reaxc_bonds_kokkos.cpp @@ -51,7 +51,7 @@ FixReaxCBondsKokkos::~FixReaxCBondsKokkos() void FixReaxCBondsKokkos::init() { Pair *pair_kk = force->pair_match("reax/c/kk",0); - if (pair_kk == NULL) error->all(FLERR,"Cannot use fix reax/c/bonds without " + if (pair_kk == nullptr) error->all(FLERR,"Cannot use fix reax/c/bonds without " "pair_style reax/c/kk"); FixReaxCBonds::init(); diff --git a/src/KOKKOS/fix_reaxc_species_kokkos.cpp b/src/KOKKOS/fix_reaxc_species_kokkos.cpp index f3bce2f9c0ba723b5f9b1f00cd58037e34e388d7..4674389ed4a4081b872303c3439ae9e8f14b1e33 100644 --- a/src/KOKKOS/fix_reaxc_species_kokkos.cpp +++ b/src/KOKKOS/fix_reaxc_species_kokkos.cpp @@ -58,7 +58,7 @@ FixReaxCSpeciesKokkos::~FixReaxCSpeciesKokkos() void FixReaxCSpeciesKokkos::init() { Pair* pair_kk = force->pair_match("reax/c/kk",0); - if (pair_kk == NULL) error->all(FLERR,"Cannot use fix reax/c/species/kk without " + if (pair_kk == nullptr) error->all(FLERR,"Cannot use fix reax/c/species/kk without " "pair_style reax/c/kk"); FixReaxCSpecies::init(); diff --git a/src/KOKKOS/fix_rx_kokkos.cpp b/src/KOKKOS/fix_rx_kokkos.cpp index 18bc4225a70c640cb70d9b37fbf7b46ea436fba9..1ba227d539799c753d72a7573c85e99f01e12287 100644 --- a/src/KOKKOS/fix_rx_kokkos.cpp +++ b/src/KOKKOS/fix_rx_kokkos.cpp @@ -62,7 +62,7 @@ double getElapsedTime( const TimerType &t0, const TimerType &t1) { return t1-t0; template FixRxKokkos::FixRxKokkos(LAMMPS *lmp, int narg, char **arg) : FixRX(lmp, narg, arg), - pairDPDEKK(NULL), + pairDPDEKK(nullptr), update_kinetics_data(true) { kokkosable = 1; @@ -117,14 +117,14 @@ void FixRxKokkos::init() //FixRX::init(); pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy/kk",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) error->all(FLERR,"Must use pair_style dpd/fdt/energy with fix rx"); pairDPDEKK = dynamic_cast(pairDPDE); - if (pairDPDEKK == NULL) + if (pairDPDEKK == nullptr) error->all(FLERR,"Must use pair_style dpd/fdt/energy/kk with fix rx/kk"); bool eos_flag = false; @@ -964,7 +964,7 @@ int FixRxKokkos::rhs_sparse(double /*t*/, const double *y, double *d //const double VDPD = domain->xprd * domain->yprd * domain->zprd / atom->natoms; #define kFor (userData->kFor) - #define kRev (NULL) + #define kRev (nullptr) #define rxnRateLaw (userData->rxnRateLaw) #define conc (dydt) #define maxReactants (this->sparseKinetics_maxReactants) @@ -1111,7 +1111,7 @@ KOKKOS_INLINE_FUNCTION int FixRxKokkos::k_rhs_sparse(double /*t*/, const VectorType& y, VectorType& dydt, UserDataType& userData) const { #define kFor (userData.kFor) - #define kRev (NULL) + #define kRev (nullptr) #define rxnRateLaw (userData.rxnRateLaw) #define conc (dydt) #define maxReactants (this->sparseKinetics_maxReactants) diff --git a/src/KOKKOS/fix_rx_kokkos.h b/src/KOKKOS/fix_rx_kokkos.h index 26c6ae4ae591ed8d810f813792cf32968e6186fe..0033e696498fb22bb4d79d551fe855e76b999f34 100644 --- a/src/KOKKOS/fix_rx_kokkos.h +++ b/src/KOKKOS/fix_rx_kokkos.h @@ -121,7 +121,7 @@ class FixRxKokkos : public FixRX { value_type *m_data; KOKKOS_INLINE_FUNCTION - StridedArrayType() : m_data(NULL) {} + StridedArrayType() : m_data(nullptr) {} KOKKOS_INLINE_FUNCTION StridedArrayType(value_type *ptr) : m_data(ptr) {} diff --git a/src/KOKKOS/fix_setforce_kokkos.cpp b/src/KOKKOS/fix_setforce_kokkos.cpp index a11e8b4bd4d32d642dd15071b32e1ce643d30d35..00d717c915052059e065e23aa507830506045b27 100644 --- a/src/KOKKOS/fix_setforce_kokkos.cpp +++ b/src/KOKKOS/fix_setforce_kokkos.cpp @@ -57,7 +57,7 @@ FixSetForceKokkos::~FixSetForceKokkos() if (copymode) return; memoryKK->destroy_kokkos(k_sforce,sforce); - sforce = NULL; + sforce = nullptr; } /* ---------------------------------------------------------------------- */ @@ -86,7 +86,7 @@ void FixSetForceKokkos::post_force(int /*vflag*/) // update region if necessary - region = NULL; + region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/KOKKOS/fix_shardlow_kokkos.cpp b/src/KOKKOS/fix_shardlow_kokkos.cpp index 9be4321ff2dc0f8f70f4bf56fed6e666780d71d0..1779ebc85539fc77b07488ffce5e18ff6faf135d 100644 --- a/src/KOKKOS/fix_shardlow_kokkos.cpp +++ b/src/KOKKOS/fix_shardlow_kokkos.cpp @@ -63,7 +63,7 @@ using namespace random_external_state; template FixShardlowKokkos::FixShardlowKokkos(LAMMPS *lmp, int narg, char **arg) : - FixShardlow(lmp, narg, arg), k_pairDPDE(NULL), ghostmax(0), nlocal(0) , nghost(0) + FixShardlow(lmp, narg, arg), k_pairDPDE(nullptr), ghostmax(0), nlocal(0) , nghost(0) { kokkosable = 1; atomKK = (AtomKokkos *) atom; @@ -74,8 +74,8 @@ FixShardlowKokkos::FixShardlowKokkos(LAMMPS *lmp, int narg, char **a if (narg != 3) error->all(FLERR,"Illegal fix shardlow command"); -// k_pairDPD = NULL; - k_pairDPDE = NULL; +// k_pairDPD = nullptr; + k_pairDPDE = nullptr; // k_pairDPD = (PairDPDfdtKokkos *) force->pair_match("dpd/fdt",1); k_pairDPDE = dynamic_cast *>(force->pair_match("dpd/fdt/energy",0)); @@ -88,7 +88,7 @@ FixShardlowKokkos::FixShardlowKokkos(LAMMPS *lmp, int narg, char **a // } - if(/* k_pairDPD == NULL &&*/ k_pairDPDE == NULL) + if(/* k_pairDPD == nullptr &&*/ k_pairDPDE == nullptr) error->all(FLERR,"Must use pair_style "/*"dpd/fdt/kk or "*/"dpd/fdt/energy/kk with fix shardlow/kk"); #ifdef DEBUG_SSA_PAIR_CT diff --git a/src/KOKKOS/gridcomm_kokkos.cpp b/src/KOKKOS/gridcomm_kokkos.cpp index 909e3c8544c7ea1fac299e7e5526c0379e194c62..0a175343c30f003ce7cba53f4cdb733a93952a09 100644 --- a/src/KOKKOS/gridcomm_kokkos.cpp +++ b/src/KOKKOS/gridcomm_kokkos.cpp @@ -91,21 +91,21 @@ GridCommKokkos::~GridCommKokkos() // regular comm data struct for (int i = 0; i < nswap; i++) { - swap[i].packlist = NULL; - swap[i].unpacklist = NULL; + swap[i].packlist = nullptr; + swap[i].unpacklist = nullptr; } // tiled comm data structs for (int i = 0; i < nsend; i++) - send[i].packlist = NULL; + send[i].packlist = nullptr; for (int i = 0; i < nrecv; i++) - recv[i].unpacklist = NULL; + recv[i].unpacklist = nullptr; for (int i = 0; i < ncopy; i++) { - copy[i].packlist = NULL; - copy[i].unpacklist = NULL; + copy[i].packlist = nullptr; + copy[i].unpacklist = nullptr; } } @@ -459,7 +459,7 @@ void GridCommKokkos::setup_tiled(int &nbuf1, int &nbuf2) memory->create(overlap_procs,nprocs,"GridComm:overlap_procs"); noverlap = maxoverlap = 0; - overlap = NULL; + overlap = nullptr; ghost_box_drop(ghostbox,pbc); diff --git a/src/KOKKOS/kokkos.cpp b/src/KOKKOS/kokkos.cpp index 79fd0685b079c5cd901133d90b7bc79dc84f0529..16d906ba3c492e4ae19f76e80722f9cb5ccb0681 100644 --- a/src/KOKKOS/kokkos.cpp +++ b/src/KOKKOS/kokkos.cpp @@ -226,7 +226,7 @@ KokkosLMP::KokkosLMP(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) int len; char mpi_version[MPI_MAX_LIBRARY_VERSION_STRING]; MPI_Get_library_version(mpi_version, &len); - if (strstr(&mpi_version[0], "Spectrum") != NULL) { + if (strstr(&mpi_version[0], "Spectrum") != nullptr) { cuda_aware_flag = 0; char* str; if (str = getenv("OMPI_MCA_pml_pami_enable_cuda")) diff --git a/src/KOKKOS/memory_kokkos.h b/src/KOKKOS/memory_kokkos.h index 83e8b9ec7cd02faff17d9fea767df9eeaf7b79e7..df85f72c65eac9d1167351fab884699f6e7eb75b 100644 --- a/src/KOKKOS/memory_kokkos.h +++ b/src/KOKKOS/memory_kokkos.h @@ -78,7 +78,7 @@ template TYPE grow_kokkos(TYPE &data, typename TYPE::value_type *&array, int n1, const char *name) { - if (array == NULL) return create_kokkos(data,array,n1,name); + if (array == nullptr) return create_kokkos(data,array,n1,name); data.resize(n1); array = data.h_view.data(); @@ -88,9 +88,9 @@ TYPE grow_kokkos(TYPE &data, typename TYPE::value_type *&array, template void destroy_kokkos(TYPE data, typename TYPE::value_type* &array) { - if (array == NULL) return; + if (array == nullptr) return; data = TYPE(); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -100,7 +100,7 @@ void destroy_kokkos(TYPE data, typename TYPE::value_type* &array) template TYPE destroy_kokkos(TYPE &data) { - /*if(data.data()!=NULL) + /*if(data.data()!=nullptr) free(data.data());*/ data = TYPE(); return data; @@ -186,7 +186,7 @@ TYPE create_kokkos(TYPE &data, typename TYPE::value_type **&array, bigint n = 0; for (int i = 0; i < n1; i++) { if(n2==0) - array[i] = NULL; + array[i] = nullptr; else array[i] = &data.h_view(i,0); n += n2; @@ -211,7 +211,7 @@ template bigint n = 0; for (int i = 0; i < n1; i++) { if(n2==0) - array[i] = NULL; + array[i] = nullptr; else array[i] = &h_data(i,0); n += n2; @@ -228,14 +228,14 @@ template TYPE grow_kokkos(TYPE &data, typename TYPE::value_type **&array, int n1, int n2, const char *name) { - if (array == NULL) return create_kokkos(data,array,n1,n2,name); + if (array == nullptr) return create_kokkos(data,array,n1,n2,name); data.resize(n1,n2); bigint nbytes = ((bigint) sizeof(typename TYPE::value_type *)) * n1; array = (typename TYPE::value_type**) srealloc(array,nbytes,name); for (int i = 0; i < n1; i++) if(n2==0) - array[i] = NULL; + array[i] = nullptr; else array[i] = &data.h_view(i,0); @@ -252,7 +252,7 @@ TYPE create_kokkos(TYPE &data, typename TYPE::value_type **&array, for (int i = 0; i < n1; i++) if(data.h_view.extent(1)==0) - array[i] = NULL; + array[i] = nullptr; else array[i] = &data.h_view(i,0); @@ -263,7 +263,7 @@ template TYPE grow_kokkos(TYPE &data, typename TYPE::value_type **&array, int n1, const char *name) { - if (array == NULL) return create_kokkos(data,array,n1,name); + if (array == nullptr) return create_kokkos(data,array,n1,name); data.resize(n1); @@ -272,7 +272,7 @@ TYPE grow_kokkos(TYPE &data, typename TYPE::value_type **&array, for (int i = 0; i < n1; i++) if(data.h_view.extent(1)==0) - array[i] = NULL; + array[i] = nullptr; else array[i] = &data.h_view(i,0); @@ -286,10 +286,10 @@ TYPE grow_kokkos(TYPE &data, typename TYPE::value_type **&array, template void destroy_kokkos(TYPE data, typename TYPE::value_type** &array) { - if (array == NULL) return; + if (array == nullptr) return; data = TYPE(); sfree(array); - array = NULL; + array = nullptr; } }; diff --git a/src/KOKKOS/min_kokkos.cpp b/src/KOKKOS/min_kokkos.cpp index 032538fe601a8f63ce197582af0232b88f5c9a49..759b00976fe29bbc00917cc2506772a7ada5e832 100644 --- a/src/KOKKOS/min_kokkos.cpp +++ b/src/KOKKOS/min_kokkos.cpp @@ -49,7 +49,7 @@ using namespace LAMMPS_NS; MinKokkos::MinKokkos(LAMMPS *lmp) : Min(lmp) { atomKK = (AtomKokkos *) atom; - fix_minimize_kk = NULL; + fix_minimize_kk = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/neighbor_kokkos.cpp b/src/KOKKOS/neighbor_kokkos.cpp index b21a7cb1ee7e87943bce9aa885ab72b9714bfa98..cadfccfa6bb67fc6bf0c5277b868429e0eb1111a 100644 --- a/src/KOKKOS/neighbor_kokkos.cpp +++ b/src/KOKKOS/neighbor_kokkos.cpp @@ -41,10 +41,10 @@ NeighborKokkos::NeighborKokkos(LAMMPS *lmp) : Neighbor(lmp), neighbond_host(lmp),neighbond_device(lmp) { device_flag = 0; - bondlist = NULL; - anglelist = NULL; - dihedrallist = NULL; - improperlist = NULL; + bondlist = nullptr; + anglelist = nullptr; + dihedrallist = nullptr; + improperlist = nullptr; } /* ---------------------------------------------------------------------- */ @@ -53,7 +53,7 @@ NeighborKokkos::~NeighborKokkos() { if (!copymode) { memoryKK->destroy_kokkos(k_cutneighsq,cutneighsq); - cutneighsq = NULL; + cutneighsq = nullptr; memoryKK->destroy_kokkos(k_ex_type,ex_type); memoryKK->destroy_kokkos(k_ex1_type,ex1_type); diff --git a/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp b/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp index afa8bd649aea4cf5cdf961cb287777fd4d3ad144..8f874b9febd89eb28472652f9faccf19d1b2c8b0 100644 --- a/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_buck_coul_cut_kokkos.cpp @@ -48,9 +48,9 @@ PairBuckCoulCutKokkos::PairBuckCoulCutKokkos(LAMMPS *lmp):PairBuckCo execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; } @@ -69,11 +69,11 @@ PairBuckCoulCutKokkos::~PairBuckCoulCutKokkos() memory->sfree(cutsq); memory->sfree(cut_ljsq); memory->sfree(cut_coulsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; } } diff --git a/src/KOKKOS/pair_buck_coul_long_kokkos.cpp b/src/KOKKOS/pair_buck_coul_long_kokkos.cpp index a77ef291fa54bc0a65e7da10717b74faac3af0c1..6a13254e8a53b75ec4ada5abc4e9b8189471c173 100644 --- a/src/KOKKOS/pair_buck_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_buck_coul_long_kokkos.cpp @@ -55,8 +55,8 @@ PairBuckCoulLongKokkos::PairBuckCoulLongKokkos(LAMMPS *lmp):PairBuck execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; cut_coulsq = 0.0; } @@ -75,11 +75,11 @@ PairBuckCoulLongKokkos::~PairBuckCoulLongKokkos() memory->sfree(cutsq); memory->sfree(cut_ljsq); //memory->sfree(cut_coulsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; - cut_ljsq = NULL; - //cut_coulsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; + cut_ljsq = nullptr; + //cut_coulsq = nullptr; } } @@ -88,11 +88,11 @@ PairBuckCoulLongKokkos::~PairBuckCoulLongKokkos() template void PairBuckCoulLongKokkos::cleanup_copy() { allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - eatom = NULL; - vatom = NULL; - ftable = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_buck_kokkos.cpp b/src/KOKKOS/pair_buck_kokkos.cpp index 71f63a9f92d612f429550440a05c9ca4572c19e9..efddb43a99338c7c57fad17a6715caa4ec35433f 100644 --- a/src/KOKKOS/pair_buck_kokkos.cpp +++ b/src/KOKKOS/pair_buck_kokkos.cpp @@ -46,7 +46,7 @@ PairBuckKokkos::PairBuckKokkos(LAMMPS *lmp) : PairBuck(lmp) execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -59,9 +59,9 @@ PairBuckKokkos::~PairBuckKokkos() memoryKK->destroy_kokkos(k_vatom,vatom); k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; } } diff --git a/src/KOKKOS/pair_coul_cut_kokkos.cpp b/src/KOKKOS/pair_coul_cut_kokkos.cpp index 8fae09e1eb38d57c8a8a57572a9b4322ef299a10..a77f738a5f9d010d0c8ad6914ed66a8866bcbd01 100644 --- a/src/KOKKOS/pair_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_coul_cut_kokkos.cpp @@ -37,7 +37,7 @@ PairCoulCutKokkos::PairCoulCutKokkos(LAMMPS *lmp) : PairCoulCut(lmp) execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -55,9 +55,9 @@ template void PairCoulCutKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_coul_debye_kokkos.cpp b/src/KOKKOS/pair_coul_debye_kokkos.cpp index e3326f30560bfb24e70e073afe0a6e1012727a0b..b469a2b8c1037e9a11db642222356f8dbb8e07c1 100644 --- a/src/KOKKOS/pair_coul_debye_kokkos.cpp +++ b/src/KOKKOS/pair_coul_debye_kokkos.cpp @@ -46,7 +46,7 @@ PairCoulDebyeKokkos::PairCoulDebyeKokkos(LAMMPS *lmp):PairCoulDebye( execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } @@ -66,9 +66,9 @@ template void PairCoulDebyeKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_coul_long_kokkos.cpp b/src/KOKKOS/pair_coul_long_kokkos.cpp index 780d57d92128a2a720435c34495647f7cfcda3ad..aeba50c0adc4eb86c283a6131103b28a31a4fd9d 100644 --- a/src/KOKKOS/pair_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_coul_long_kokkos.cpp @@ -55,7 +55,7 @@ PairCoulLongKokkos::PairCoulLongKokkos(LAMMPS *lmp):PairCoulLong(lmp execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; cut_coulsq = 0.0; } @@ -71,9 +71,9 @@ PairCoulLongKokkos::~PairCoulLongKokkos() k_cutsq = DAT::tdual_ffloat_2d(); k_cut_coulsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; } } @@ -82,10 +82,10 @@ PairCoulLongKokkos::~PairCoulLongKokkos() template void PairCoulLongKokkos::cleanup_copy() { allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; - ftable = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.cpp b/src/KOKKOS/pair_eam_alloy_kokkos.cpp index 280e47b77166b9dcdc50b1726a579467c2f3970c..52882c8be8a5df3c4f176712bcc398edec2d69b8 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.cpp +++ b/src/KOKKOS/pair_eam_alloy_kokkos.cpp @@ -938,7 +938,7 @@ void PairEAMAlloyKokkos::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/KOKKOS/pair_eam_alloy_kokkos.h b/src/KOKKOS/pair_eam_alloy_kokkos.h index aee94471cf60fb7eb42535488a83dba0fb67fd48..2c4e4fdf9323411f2d016b92a90c26530c2441f4 100644 --- a/src/KOKKOS/pair_eam_alloy_kokkos.h +++ b/src/KOKKOS/pair_eam_alloy_kokkos.h @@ -61,7 +61,7 @@ class PairEAMAlloyKokkos : public PairEAM, public KokkosBase { virtual ~PairEAMAlloyKokkos(); void compute(int, int); void init_style(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } void coeff(int, char **); KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/pair_eam_fs_kokkos.cpp b/src/KOKKOS/pair_eam_fs_kokkos.cpp index a4828c00aa0f245a95d7c45c5980703a265ab7c3..d697cfbe9aac4cb037e6c444a90bd17ac54157dd 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.cpp +++ b/src/KOKKOS/pair_eam_fs_kokkos.cpp @@ -938,7 +938,7 @@ void PairEAMFSKokkos::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/KOKKOS/pair_eam_fs_kokkos.h b/src/KOKKOS/pair_eam_fs_kokkos.h index 5f1a912f54201618117f90560c57131b37e5d16b..104ecf1a0bad720554b1e3b4f594e226e398b218 100644 --- a/src/KOKKOS/pair_eam_fs_kokkos.h +++ b/src/KOKKOS/pair_eam_fs_kokkos.h @@ -61,7 +61,7 @@ class PairEAMFSKokkos : public PairEAM, public KokkosBase { virtual ~PairEAMFSKokkos(); void compute(int, int); void init_style(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } void coeff(int, char **); KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/pair_eam_kokkos.h b/src/KOKKOS/pair_eam_kokkos.h index 5992b7ed6d7f606d54be2640d4c6692bc87d0ba7..99719bbe5ae4906b09fd6ef879674487d2e87824 100644 --- a/src/KOKKOS/pair_eam_kokkos.h +++ b/src/KOKKOS/pair_eam_kokkos.h @@ -59,7 +59,7 @@ class PairEAMKokkos : public PairEAM, public KokkosBase { virtual ~PairEAMKokkos(); void compute(int, int); void init_style(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } KOKKOS_INLINE_FUNCTION void operator()(TagPairEAMPackForwardComm, const int&) const; diff --git a/src/KOKKOS/pair_exp6_rx_kokkos.cpp b/src/KOKKOS/pair_exp6_rx_kokkos.cpp index 035bf87cecda8a1d1b7c6955d32fb66f41f25a56..811589972fc01abf63203fea3cc5c935caa7fe4b 100644 --- a/src/KOKKOS/pair_exp6_rx_kokkos.cpp +++ b/src/KOKKOS/pair_exp6_rx_kokkos.cpp @@ -1715,16 +1715,16 @@ void PairExp6rxKokkos::read_file(char *file) char **words = new char*[params_per_line+1]; memoryKK->destroy_kokkos(k_params,params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 FILE *fp; - fp = NULL; + fp = nullptr; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open exp6/rx potential file %s",file); error->one(FLERR,str); @@ -1741,7 +1741,7 @@ void PairExp6rxKokkos::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -1763,7 +1763,7 @@ void PairExp6rxKokkos::read_file(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -1783,7 +1783,7 @@ void PairExp6rxKokkos::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; for (ispecies = 0; ispecies < nspecies; ispecies++) if (strcmp(words[0],&atom->dname[ispecies][0]) == 0) break; diff --git a/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp b/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp index a442a987f675f5f9bfa39841b721c7df953b2289..a1c376cdfaa2b5c32f922f47a518df4a825f5d58 100644 --- a/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp +++ b/src/KOKKOS/pair_gran_hooke_history_kokkos.cpp @@ -48,8 +48,8 @@ PairGranHookeHistoryKokkos::~PairGranHookeHistoryKokkos() if (allocated) { memoryKK->destroy_kokkos(k_eatom,eatom); memoryKK->destroy_kokkos(k_vatom,vatom); - eatom = NULL; - vatom = NULL; + eatom = nullptr; + vatom = nullptr; } } @@ -64,7 +64,7 @@ void PairGranHookeHistoryKokkos::init_style() // it replaces FixDummy, created in the constructor // this is so its order in the fix list is preserved - if (history && fix_history == NULL) { + if (history && fix_history == nullptr) { char dnumstr[16]; sprintf(dnumstr,"%d",3); char **fixarg = new char*[4]; diff --git a/src/KOKKOS/pair_hybrid_kokkos.cpp b/src/KOKKOS/pair_hybrid_kokkos.cpp index b5b0a9d02b7cf271e1554ee1647c675e0eac43c6..23b8401fe81598507ce39079f22b7b01210a2c16 100644 --- a/src/KOKKOS/pair_hybrid_kokkos.cpp +++ b/src/KOKKOS/pair_hybrid_kokkos.cpp @@ -87,7 +87,7 @@ void PairHybridKokkos::compute(int eflag, int vflag) // check if we are running with r-RESPA using the hybrid keyword - Respa *respa = NULL; + Respa *respa = nullptr; respaflag = 0; if (strstr(update->integrate_style,"respa")) { respa = (Respa *) update->integrate; diff --git a/src/KOKKOS/pair_kokkos.h b/src/KOKKOS/pair_kokkos.h index 396a5f2d4872341f7084471ea9df39ea11e1f4bb..cb55dd314195c19218e7456e7331276149e0adde 100644 --- a/src/KOKKOS/pair_kokkos.h +++ b/src/KOKKOS/pair_kokkos.h @@ -94,7 +94,7 @@ struct PairComputeFunctor { dup_vatom = Kokkos::Experimental::create_scatter_view::value >(c.d_vatom); }; - // Call cleanup_copy which sets allocations NULL which are destructed by the PairStyle + // Call cleanup_copy which sets allocations to null which are destructed by the PairStyle ~PairComputeFunctor() {c.cleanup_copy();list.copymode = 1;}; KOKKOS_INLINE_FUNCTION int sbmask(const int& j) const { diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp index 2ce056938311d6a522d3624a4f78552c19358839..adfe095dc532ab28914c2bd543f3faefa95547bd 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_implicit_kokkos.cpp @@ -54,7 +54,7 @@ PairLJCharmmCoulCharmmImplicitKokkos::PairLJCharmmCoulCharmmImplicit execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; @@ -74,9 +74,9 @@ PairLJCharmmCoulCharmmImplicitKokkos::~PairLJCharmmCoulCharmmImplici memory->sfree(cutsq); //memory->sfree(cut_ljsq); //memory->sfree(cut_coulsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; } @@ -88,11 +88,11 @@ template void PairLJCharmmCoulCharmmImplicitKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; - eatom = NULL; - vatom = NULL; - ftable = NULL; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp index e59da8d298921aaeb89479e9a962651748c66a9c..a20a6242c394a8a46967cd2ed6109fba22c480f2 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_charmm_kokkos.cpp @@ -55,7 +55,7 @@ PairLJCharmmCoulCharmmKokkos::PairLJCharmmCoulCharmmKokkos(LAMMPS *l execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; @@ -75,9 +75,9 @@ PairLJCharmmCoulCharmmKokkos::~PairLJCharmmCoulCharmmKokkos() memory->sfree(cutsq); //memory->sfree(cut_ljsq); //memory->sfree(cut_coulsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; } @@ -89,11 +89,11 @@ template void PairLJCharmmCoulCharmmKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; - eatom = NULL; - vatom = NULL; - ftable = NULL; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp index a06e569ebe0fbb363431a0c6a4a07397566a6675..2f4a03e9b0a1453fe6a2d49d0fbe0180a35f9a8f 100644 --- a/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_charmm_coul_long_kokkos.cpp @@ -55,7 +55,7 @@ PairLJCharmmCoulLongKokkos::PairLJCharmmCoulLongKokkos(LAMMPS *lmp): execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; @@ -75,9 +75,9 @@ PairLJCharmmCoulLongKokkos::~PairLJCharmmCoulLongKokkos() memory->sfree(cutsq); //memory->sfree(cut_ljsq); //memory->sfree(cut_coulsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; } @@ -89,11 +89,11 @@ template void PairLJCharmmCoulLongKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; - eatom = NULL; - vatom = NULL; - ftable = NULL; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp b/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp index b45ff6d31a0c2aaccd078b7a0adb024f159379f4..799f1a2789d164b70e65f1f8929b28f12f869419 100644 --- a/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_coul_cut_kokkos.cpp @@ -43,9 +43,9 @@ PairLJClass2CoulCutKokkos::PairLJClass2CoulCutKokkos(LAMMPS *lmp):Pa execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; } @@ -67,11 +67,11 @@ template void PairLJClass2CoulCutKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp index fc97c3491f96d1916a85a114e1655766a846c13e..7fafd865c0656717a83c10323825df5c026df101 100644 --- a/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_coul_long_kokkos.cpp @@ -51,8 +51,8 @@ PairLJClass2CoulLongKokkos::PairLJClass2CoulLongKokkos(LAMMPS *lmp): execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; cut_coulsq = 0.0; } @@ -74,11 +74,11 @@ template void PairLJClass2CoulLongKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - eatom = NULL; - vatom = NULL; - ftable = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_class2_kokkos.cpp b/src/KOKKOS/pair_lj_class2_kokkos.cpp index a0d2fba581dd2436de92905d2236c98298e19890..6a66a8861d0e541dd66eecd00c956f81ab0aec2c 100644 --- a/src/KOKKOS/pair_lj_class2_kokkos.cpp +++ b/src/KOKKOS/pair_lj_class2_kokkos.cpp @@ -46,7 +46,7 @@ PairLJClass2Kokkos::PairLJClass2Kokkos(LAMMPS *lmp) : PairLJClass2(l execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -57,7 +57,7 @@ PairLJClass2Kokkos::~PairLJClass2Kokkos() if (allocated) { k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - cutsq = NULL; + cutsq = nullptr; } } @@ -67,9 +67,9 @@ template void PairLJClass2Kokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp index d269de45e41f6e3e7789439eaf2e1a143547537b..3749690b7996d2a37358dcc4d5296daa738f82fe 100644 --- a/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_cut_kokkos.cpp @@ -42,9 +42,9 @@ PairLJCutCoulCutKokkos::PairLJCutCoulCutKokkos(LAMMPS *lmp):PairLJCu execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; } @@ -66,11 +66,11 @@ template void PairLJCutCoulCutKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp index 05e0d15dbfb4f1d532fca395f085f24a79a709ae..bd4530cf32a2a37f49908fc8f93bc6315178679b 100644 --- a/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_debye_kokkos.cpp @@ -46,9 +46,9 @@ PairLJCutCoulDebyeKokkos::PairLJCutCoulDebyeKokkos(LAMMPS *lmp):Pair execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; } @@ -70,11 +70,11 @@ template void PairLJCutCoulDebyeKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - cut_coulsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + cut_coulsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp index bdd167a2992a6f5587fef0653d6c323ad8894f74..47fa5cf114f3fc4dd5bf2650fce106a6f53012e3 100644 --- a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp @@ -56,9 +56,9 @@ PairLJCutCoulDSFKokkos::PairLJCutCoulDSFKokkos(LAMMPS *lmp):PairLJCu execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; - //cut_coulsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + //cut_coulsq = nullptr; } @@ -80,11 +80,11 @@ template void PairLJCutCoulDSFKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - //cut_coulsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + //cut_coulsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp index b6ea969d86aead394ad2eb2efac091bbfb0383f2..6f31a816d2f857d5c165dbe91cf7959ca2574040 100644 --- a/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_long_kokkos.cpp @@ -53,8 +53,8 @@ PairLJCutCoulLongKokkos::PairLJCutCoulLongKokkos(LAMMPS *lmp):PairLJ execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_ljsq = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; cut_coulsq = 0.0; } @@ -66,8 +66,8 @@ PairLJCutCoulLongKokkos::~PairLJCutCoulLongKokkos() { memoryKK->destroy_kokkos(k_eatom,eatom); memoryKK->destroy_kokkos(k_vatom,vatom); - eatom = NULL; - vatom = NULL; + eatom = nullptr; + vatom = nullptr; if (allocated){ memoryKK->destroy_kokkos(k_cutsq, cutsq); memoryKK->destroy_kokkos(k_cut_ljsq, cut_ljsq); @@ -80,11 +80,11 @@ template void PairLJCutCoulLongKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_ljsq = NULL; - eatom = NULL; - vatom = NULL; - ftable = NULL; + cutsq = nullptr; + cut_ljsq = nullptr; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_cut_kokkos.cpp b/src/KOKKOS/pair_lj_cut_kokkos.cpp index 8294d62f68d2029755960988c05e7ef3ead45361..674c54fa4cfb3d12a2d114f8074f6989c22dc37c 100644 --- a/src/KOKKOS/pair_lj_cut_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_kokkos.cpp @@ -41,7 +41,7 @@ PairLJCutKokkos::PairLJCutKokkos(LAMMPS *lmp) : PairLJCut(lmp) execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -54,9 +54,9 @@ PairLJCutKokkos::~PairLJCutKokkos() memoryKK->destroy_kokkos(k_vatom,vatom); k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; } } @@ -66,9 +66,9 @@ template void PairLJCutKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_expand_kokkos.cpp b/src/KOKKOS/pair_lj_expand_kokkos.cpp index f17703e2d1c0a815e4bc1da716573de5d91afeff..5d47e5dabefc0d7532ea5e86082ac627ee8f5467 100644 --- a/src/KOKKOS/pair_lj_expand_kokkos.cpp +++ b/src/KOKKOS/pair_lj_expand_kokkos.cpp @@ -46,7 +46,7 @@ PairLJExpandKokkos::PairLJExpandKokkos(LAMMPS *lmp) : PairLJExpand(l execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -57,7 +57,7 @@ PairLJExpandKokkos::~PairLJExpandKokkos() if (!copymode) { k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - cutsq = NULL; + cutsq = nullptr; } } @@ -67,9 +67,9 @@ template void PairLJExpandKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp index 60d18519b2e2a2315c8cafa53eaa6986b40c1d9b..04d018257ee8c5773201daa533bc59300f36b543 100644 --- a/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp +++ b/src/KOKKOS/pair_lj_gromacs_coul_gromacs_kokkos.cpp @@ -46,7 +46,7 @@ PairLJGromacsCoulGromacsKokkos::PairLJGromacsCoulGromacsKokkos(LAMMP execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; @@ -66,9 +66,9 @@ PairLJGromacsCoulGromacsKokkos::~PairLJGromacsCoulGromacsKokkos() memory->sfree(cutsq); //memory->sfree(cut_ljsq); //memory->sfree(cut_coulsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; cut_ljsq = 0.0; cut_coulsq = 0.0; } @@ -80,11 +80,11 @@ template void PairLJGromacsCoulGromacsKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; + cutsq = nullptr; cut_ljsq = 0.0; - eatom = NULL; - vatom = NULL; - ftable = NULL; + eatom = nullptr; + vatom = nullptr; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_gromacs_kokkos.cpp b/src/KOKKOS/pair_lj_gromacs_kokkos.cpp index d27b9e1ec61538347bd7ecacc9af6ea33bfdf1f2..dacf4d977ed5acc6f0ec2edcac56d6bbba88ea24 100644 --- a/src/KOKKOS/pair_lj_gromacs_kokkos.cpp +++ b/src/KOKKOS/pair_lj_gromacs_kokkos.cpp @@ -46,9 +46,9 @@ PairLJGromacsKokkos::PairLJGromacsKokkos(LAMMPS *lmp):PairLJGromacs( execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | Q_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; - cut_inner = NULL; - cut_inner_sq = NULL; + cutsq = nullptr; + cut_inner = nullptr; + cut_inner_sq = nullptr; } @@ -63,11 +63,11 @@ PairLJGromacsKokkos::~PairLJGromacsKokkos() k_cutsq = DAT::tdual_ffloat_2d(); k_cut_inner_sq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; - cut_inner = NULL; - cut_inner_sq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; + cut_inner = nullptr; + cut_inner_sq = nullptr; } } @@ -77,11 +77,11 @@ template void PairLJGromacsKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - cut_inner = NULL; - cut_inner_sq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + cut_inner = nullptr; + cut_inner_sq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_lj_sdk_kokkos.cpp b/src/KOKKOS/pair_lj_sdk_kokkos.cpp index 8b228f2c011e6d254ba3f757862684723f810424..ddf4b4efd76a504d4191f0ac1432659689728b33 100644 --- a/src/KOKKOS/pair_lj_sdk_kokkos.cpp +++ b/src/KOKKOS/pair_lj_sdk_kokkos.cpp @@ -46,7 +46,7 @@ PairLJSDKKokkos::PairLJSDKKokkos(LAMMPS *lmp) : PairLJSDK(lmp) execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -57,7 +57,7 @@ PairLJSDKKokkos::~PairLJSDKKokkos() if (allocated) { k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - cutsq = NULL; + cutsq = nullptr; } } @@ -67,9 +67,9 @@ template void PairLJSDKKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_morse_kokkos.cpp b/src/KOKKOS/pair_morse_kokkos.cpp index ba6e9ba97d19b39be8251446745f908e95c58889..b6cf4ed8d6896320423f8472933af22fa7010129 100644 --- a/src/KOKKOS/pair_morse_kokkos.cpp +++ b/src/KOKKOS/pair_morse_kokkos.cpp @@ -48,7 +48,7 @@ PairMorseKokkos::PairMorseKokkos(LAMMPS *lmp) : PairMorse(lmp) execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -61,9 +61,9 @@ PairMorseKokkos::~PairMorseKokkos() memoryKK->destroy_kokkos(k_vatom,vatom); k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; } } @@ -73,9 +73,9 @@ template void PairMorseKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp b/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp index c4e1ae38cb26b87aae99835e6cf2f85a8cf5886c..f620d194a015f1fd32d2f45f7b02000105d4d639 100644 --- a/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp +++ b/src/KOKKOS/pair_multi_lucy_rx_kokkos.cpp @@ -83,7 +83,7 @@ PairMultiLucyRXKokkos::~PairMultiLucyRXKokkos() delete h_table; delete d_table; - tabindex = NULL; + tabindex = nullptr; } /* ---------------------------------------------------------------------- */ @@ -980,7 +980,7 @@ void PairMultiLucyRXKokkos::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/KOKKOS/pair_reaxc_kokkos.cpp b/src/KOKKOS/pair_reaxc_kokkos.cpp index 3a7359df93feaa357fcf762de3a9c3bfe6f886db..d76cb98ec3d80de70853ae836e294ace7470add1 100644 --- a/src/KOKKOS/pair_reaxc_kokkos.cpp +++ b/src/KOKKOS/pair_reaxc_kokkos.cpp @@ -79,9 +79,9 @@ PairReaxCKokkos::~PairReaxCKokkos() memoryKK->destroy_kokkos(k_vatom,vatom); memoryKK->destroy_kokkos(k_tmpid,tmpid); - tmpid = NULL; + tmpid = nullptr; memoryKK->destroy_kokkos(k_tmpbo,tmpbo); - tmpbo = NULL; + tmpbo = nullptr; // deallocate views of views in serial to prevent race condition in profiling tools @@ -137,7 +137,7 @@ void PairReaxCKokkos::init_style() { PairReaxC::init_style(); if (fix_reax) modify->delete_fix(fix_id); // not needed in the Kokkos version - fix_reax = NULL; + fix_reax = nullptr; // irequest = neigh request made by parent class diff --git a/src/KOKKOS/pair_sw_kokkos.cpp b/src/KOKKOS/pair_sw_kokkos.cpp index 7a567e846bd35f582753913c7f868b9bcf5161e5..a8a79f968f0dc63347426a51239927df1d136784 100644 --- a/src/KOKKOS/pair_sw_kokkos.cpp +++ b/src/KOKKOS/pair_sw_kokkos.cpp @@ -61,8 +61,8 @@ PairSWKokkos::~PairSWKokkos() if (!copymode) { memoryKK->destroy_kokkos(k_eatom,eatom); memoryKK->destroy_kokkos(k_vatom,vatom); - eatom = NULL; - vatom = NULL; + eatom = nullptr; + vatom = nullptr; } } diff --git a/src/KOKKOS/pair_table_kokkos.cpp b/src/KOKKOS/pair_table_kokkos.cpp index b5b59dc4568cbb55d98cc713d1eda9be9bdc6250..996dae5c1b966ee6da9aebf4f06d46eb3ec96118 100644 --- a/src/KOKKOS/pair_table_kokkos.cpp +++ b/src/KOKKOS/pair_table_kokkos.cpp @@ -462,7 +462,7 @@ void PairTableKokkos::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -522,10 +522,10 @@ template void PairTableKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; - h_table=NULL; d_table=NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; + h_table=nullptr; d_table=nullptr; } namespace LAMMPS_NS { diff --git a/src/KOKKOS/pair_table_rx_kokkos.cpp b/src/KOKKOS/pair_table_rx_kokkos.cpp index 09e38e638707bbe552e54f17c4b8950b6b91db0a..b2b8a7d60e0ac23244e379bb0b78746f77c27633 100644 --- a/src/KOKKOS/pair_table_rx_kokkos.cpp +++ b/src/KOKKOS/pair_table_rx_kokkos.cpp @@ -995,7 +995,7 @@ void PairTableRXKokkos::settings(int narg, char **arg) for (int m = 0; m < ntables; m++) free_table(&tables[m]); memory->sfree(tables); ntables = 0; - tables = NULL; + tables = nullptr; if (allocated) { memory->destroy(setflag); @@ -1289,10 +1289,10 @@ template void PairTableRXKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; - h_table=NULL; d_table=NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; + h_table=nullptr; d_table=nullptr; } namespace LAMMPS_NS { diff --git a/src/KOKKOS/pair_vashishta_kokkos.cpp b/src/KOKKOS/pair_vashishta_kokkos.cpp index b5dd43f12aa3193fd07a1c6c26687d11233d9357..106422a234800e4b347ce8c380112a2f578140f0 100644 --- a/src/KOKKOS/pair_vashishta_kokkos.cpp +++ b/src/KOKKOS/pair_vashishta_kokkos.cpp @@ -61,8 +61,8 @@ PairVashishtaKokkos::~PairVashishtaKokkos() if (!copymode) { memoryKK->destroy_kokkos(k_eatom,eatom); memoryKK->destroy_kokkos(k_vatom,vatom); - eatom = NULL; - vatom = NULL; + eatom = nullptr; + vatom = nullptr; } } diff --git a/src/KOKKOS/pair_yukawa_kokkos.cpp b/src/KOKKOS/pair_yukawa_kokkos.cpp index 71236c807c0117db5d70d92063371c6c3dfab0cf..03deb1ecf8c9fa10d38fa23509041bc4789ce32c 100644 --- a/src/KOKKOS/pair_yukawa_kokkos.cpp +++ b/src/KOKKOS/pair_yukawa_kokkos.cpp @@ -45,7 +45,7 @@ PairYukawaKokkos::PairYukawaKokkos(LAMMPS *lmp) : PairYukawa(lmp) execution_space = ExecutionSpaceFromDevice::space; datamask_read = X_MASK | F_MASK | TYPE_MASK | ENERGY_MASK | VIRIAL_MASK; datamask_modify = F_MASK | ENERGY_MASK | VIRIAL_MASK; - cutsq = NULL; + cutsq = nullptr; } /* ---------------------------------------------------------------------- */ @@ -58,9 +58,9 @@ PairYukawaKokkos::~PairYukawaKokkos() memoryKK->destroy_kokkos(k_vatom,vatom); k_cutsq = DAT::tdual_ffloat_2d(); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; } } @@ -70,9 +70,9 @@ template void PairYukawaKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/pair_zbl_kokkos.cpp b/src/KOKKOS/pair_zbl_kokkos.cpp index 8b583a75f7598fc5c14a28351e045edfb268821d..796dd521160bc7f0f7759a34c0bc227d9897c34f 100644 --- a/src/KOKKOS/pair_zbl_kokkos.cpp +++ b/src/KOKKOS/pair_zbl_kokkos.cpp @@ -60,9 +60,9 @@ PairZBLKokkos::~PairZBLKokkos() memoryKK->destroy_kokkos(k_eatom,eatom); memoryKK->destroy_kokkos(k_vatom,vatom); memory->sfree(cutsq); - eatom = NULL; - vatom = NULL; - cutsq = NULL; + eatom = nullptr; + vatom = nullptr; + cutsq = nullptr; } } @@ -416,9 +416,9 @@ template void PairZBLKokkos::cleanup_copy() { // WHY needed: this prevents parent copy from deallocating any arrays allocated = 0; - cutsq = NULL; - eatom = NULL; - vatom = NULL; + cutsq = nullptr; + eatom = nullptr; + vatom = nullptr; } namespace LAMMPS_NS { diff --git a/src/KOKKOS/pppm_kokkos.cpp b/src/KOKKOS/pppm_kokkos.cpp index 4a795833fbf6ffa436df659a4798560ab1acf448..f4e3955f3c4be548118928a11a0c78f3b8b63570 100644 --- a/src/KOKKOS/pppm_kokkos.cpp +++ b/src/KOKKOS/pppm_kokkos.cpp @@ -77,25 +77,25 @@ PPPMKokkos::PPPMKokkos(LAMMPS *lmp) : PPPM(lmp) MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); - //density_brick = d_vdx_brick = d_vdy_brick = d_vdz_brick = NULL; - //d_density_fft = NULL; - //d_u_brick = NULL; - //d_v0_brick = d_v1_brick = d_v2_brick = d_v3_brick = d_v4_brick = d_v5_brick = NULL; - //greensfn = NULL; - //d_work1 = d_work2 = NULL; - //vg = NULL; - //d_fkx = d_fky = d_fkz = NULL; + //density_brick = d_vdx_brick = d_vdy_brick = d_vdz_brick = nullptr; + //d_density_fft = nullptr; + //d_u_brick = nullptr; + //d_v0_brick = d_v1_brick = d_v2_brick = d_v3_brick = d_v4_brick = d_v5_brick = nullptr; + //greensfn = nullptr; + //d_work1 = d_work2 = nullptr; + //vg = nullptr; + //d_fkx = d_fky = d_fkz = nullptr; - //gf_b = NULL; - //rho1d = rho_coeff = drho1d = drho_coeff = NULL; + //gf_b = nullptr; + //rho1d = rho_coeff = drho1d = drho_coeff = nullptr; - fft1 = fft2 = NULL; - remap = NULL; - gc = NULL; + fft1 = fft2 = nullptr; + remap = nullptr; + gc = nullptr; nmax = 0; - //part2grid = NULL; + //part2grid = nullptr; peratom_allocate_flag = 0; @@ -160,8 +160,8 @@ PPPMKokkos::~PPPMKokkos() memoryKK->destroy_kokkos(k_eatom,eatom); memoryKK->destroy_kokkos(k_vatom,vatom); - eatom = NULL; - vatom = NULL; + eatom = nullptr; + vatom = nullptr; } /* ---------------------------------------------------------------------- @@ -212,7 +212,7 @@ void PPPMKokkos::init() int itmp = 0; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -247,7 +247,7 @@ void PPPMKokkos::init() // or overlap is allowed, then done // else reduce order and try again - GridCommKokkos *gctmp = NULL; + GridCommKokkos *gctmp = nullptr; int iteration = 0; while (order >= minorder) { @@ -851,22 +851,22 @@ template void PPPMKokkos::deallocate() { memoryKK->destroy_kokkos(d_density_fft,density_fft); - density_fft = NULL; + density_fft = nullptr; memoryKK->destroy_kokkos(d_greensfn,greensfn); - greensfn = NULL; + greensfn = nullptr; memoryKK->destroy_kokkos(d_work1,work1); - work1 = NULL; + work1 = nullptr; memoryKK->destroy_kokkos(d_work2,work2); - work2 = NULL; + work2 = nullptr; delete fft1; - fft1 = NULL; + fft1 = nullptr; delete fft2; - fft2 = NULL; + fft2 = nullptr; delete remap; - remap = NULL; + remap = nullptr; delete gc; - gc = NULL; + gc = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KOKKOS/rand_pool_wrap_kokkos.cpp b/src/KOKKOS/rand_pool_wrap_kokkos.cpp index 2d8865feb0fc34e9eec320cd94f312dde062783a..51ea45e83ae494561618270a3be98563dd5193f8 100644 --- a/src/KOKKOS/rand_pool_wrap_kokkos.cpp +++ b/src/KOKKOS/rand_pool_wrap_kokkos.cpp @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; RandPoolWrap::RandPoolWrap(int, LAMMPS *lmp) : Pointers(lmp) { - random_thr = NULL; + random_thr = nullptr; nthreads = lmp->kokkos->nthreads; } @@ -42,7 +42,7 @@ void RandPoolWrap::destroy() delete random_thr[i]; delete[] random_thr; - random_thr = NULL; + random_thr = nullptr; } } diff --git a/src/KOKKOS/rand_pool_wrap_kokkos.h b/src/KOKKOS/rand_pool_wrap_kokkos.h index 9124d8e9e735b46ff64fa495edc30b5f16f297ea..8ae90011abb67eeb4873e77794ca94d13ca04215 100644 --- a/src/KOKKOS/rand_pool_wrap_kokkos.h +++ b/src/KOKKOS/rand_pool_wrap_kokkos.h @@ -26,7 +26,7 @@ struct RandWrap { KOKKOS_INLINE_FUNCTION RandWrap() { - rng = NULL; + rng = nullptr; } KOKKOS_INLINE_FUNCTION diff --git a/src/KOKKOS/remap_kokkos.cpp b/src/KOKKOS/remap_kokkos.cpp index af87ba3644e1f49c73076f50063688dc5d7efc87..1c72c9edc50ad9d6d08d0b243d1d7445afaf4631 100644 --- a/src/KOKKOS/remap_kokkos.cpp +++ b/src/KOKKOS/remap_kokkos.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; template RemapKokkos::RemapKokkos(LAMMPS *lmp) : Pointers(lmp) { - plan = NULL; + plan = nullptr; } template @@ -44,7 +44,7 @@ RemapKokkos::RemapKokkos(LAMMPS *lmp, MPI_Comm comm, out_ilo,out_ihi,out_jlo,out_jhi,out_klo,out_khi, nqty,permute,memory,precision,usecollective, usecuda_aware); - if (plan == NULL) error->one(FLERR,"Could not create 3d remap plan"); + if (plan == nullptr) error->one(FLERR,"Could not create 3d remap plan"); } /* ---------------------------------------------------------------------- */ @@ -235,7 +235,7 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat // allocate memory for plan data struct plan = new struct remap_plan_3d_kokkos; - if (plan == NULL) return NULL; + if (plan == nullptr) return nullptr; plan->usecollective = usecollective; plan->usecuda_aware = usecuda_aware; @@ -268,10 +268,10 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat // combine output extents across all procs inarray = (struct extent_3d *) malloc(nprocs*sizeof(struct extent_3d)); - if (inarray == NULL) return NULL; + if (inarray == nullptr) return nullptr; outarray = (struct extent_3d *) malloc(nprocs*sizeof(struct extent_3d)); - if (outarray == NULL) return NULL; + if (outarray == nullptr) return nullptr; MPI_Allgather(&out,sizeof(struct extent_3d),MPI_BYTE, outarray,sizeof(struct extent_3d),MPI_BYTE,comm); @@ -297,8 +297,8 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat plan->packplan = (struct pack_plan_3d *) malloc(nsend*sizeof(struct pack_plan_3d)); - if (plan->send_offset == NULL || plan->send_size == NULL || - plan->send_proc == NULL || plan->packplan == NULL) return NULL; + if (plan->send_offset == nullptr || plan->send_size == nullptr || + plan->send_proc == nullptr || plan->packplan == nullptr) return nullptr; } // store send info, with self as last entry @@ -379,9 +379,9 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat plan->unpackplan = (struct pack_plan_3d *) malloc(nrecv*sizeof(struct pack_plan_3d)); - if (plan->recv_offset == NULL || plan->recv_size == NULL || - plan->recv_proc == NULL || plan->recv_bufloc == NULL || - plan->request == NULL || plan->unpackplan == NULL) return NULL; + if (plan->recv_offset == nullptr || plan->recv_size == nullptr || + plan->recv_proc == nullptr || plan->recv_bufloc == nullptr || + plan->request == nullptr || plan->unpackplan == nullptr) return nullptr; } // store recv info, with self as last entry @@ -465,7 +465,7 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat if (size) { plan->d_sendbuf = typename FFT_AT::t_FFT_SCALAR_1d("remap3d:sendbuf",size); - if (!plan->d_sendbuf.data()) return NULL; + if (!plan->d_sendbuf.data()) return nullptr; } // if requested, allocate internal scratch space for recvs, @@ -475,7 +475,7 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat if (nrecv > 0) { plan->d_scratch = typename FFT_AT::t_FFT_SCALAR_1d("remap3d:scratch",nqty*out.isize*out.jsize*out.ksize); - if (!plan->d_scratch.data()) return NULL; + if (!plan->d_scratch.data()) return nullptr; } } @@ -495,7 +495,7 @@ struct remap_plan_3d_kokkos* RemapKokkos::remap_3d_creat template void RemapKokkos::remap_3d_destroy_plan_kokkos(struct remap_plan_3d_kokkos *plan) { - if (plan == NULL) return; + if (plan == nullptr) return; // free MPI communicator diff --git a/src/KSPACE/ewald.cpp b/src/KSPACE/ewald.cpp index 6133df398f9abd15b1c94a1453c29a1cdec8defb..51e19f7637bb601f5511999781ada68bd51ae806 100644 --- a/src/KSPACE/ewald.cpp +++ b/src/KSPACE/ewald.cpp @@ -39,11 +39,11 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ Ewald::Ewald(LAMMPS *lmp) : KSpace(lmp), - kxvecs(NULL), kyvecs(NULL), kzvecs(NULL), ug(NULL), eg(NULL), vg(NULL), - ek(NULL), sfacrl(NULL), sfacim(NULL), sfacrl_all(NULL), sfacim_all(NULL), - cs(NULL), sn(NULL), sfacrl_A(NULL), sfacim_A(NULL), sfacrl_A_all(NULL), - sfacim_A_all(NULL), sfacrl_B(NULL), sfacim_B(NULL), sfacrl_B_all(NULL), - sfacim_B_all(NULL) + kxvecs(nullptr), kyvecs(nullptr), kzvecs(nullptr), ug(nullptr), eg(nullptr), vg(nullptr), + ek(nullptr), sfacrl(nullptr), sfacim(nullptr), sfacrl_all(nullptr), sfacim_all(nullptr), + cs(nullptr), sn(nullptr), sfacrl_A(nullptr), sfacim_A(nullptr), sfacrl_A_all(nullptr), + sfacim_A_all(nullptr), sfacrl_B(nullptr), sfacim_B(nullptr), sfacrl_B_all(nullptr), + sfacim_B_all(nullptr) { group_allocate_flag = 0; kmax_created = 0; @@ -53,14 +53,14 @@ Ewald::Ewald(LAMMPS *lmp) : KSpace(lmp), accuracy_relative = 0.0; kmax = 0; - kxvecs = kyvecs = kzvecs = NULL; - ug = NULL; - eg = vg = NULL; - sfacrl = sfacim = sfacrl_all = sfacim_all = NULL; + kxvecs = kyvecs = kzvecs = nullptr; + ug = nullptr; + eg = vg = nullptr; + sfacrl = sfacim = sfacrl_all = sfacim_all = nullptr; nmax = 0; - ek = NULL; - cs = sn = NULL; + ek = nullptr; + cs = sn = nullptr; kcount = 0; } @@ -121,7 +121,7 @@ void Ewald::init() int itmp; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); double cutoff = *p_cutoff; diff --git a/src/KSPACE/ewald_dipole.cpp b/src/KSPACE/ewald_dipole.cpp index 33d21b416e7f571dcc27db03da95ef2c267a846c..ae2596ffee1e37fc0f2312540fcbae40ed637995 100644 --- a/src/KSPACE/ewald_dipole.cpp +++ b/src/KSPACE/ewald_dipole.cpp @@ -40,12 +40,12 @@ using namespace MathSpecial; /* ---------------------------------------------------------------------- */ EwaldDipole::EwaldDipole(LAMMPS *lmp) : Ewald(lmp), - tk(NULL), vc(NULL) + tk(nullptr), vc(nullptr) { ewaldflag = dipoleflag = 1; group_group_enable = 0; - tk = NULL; - vc = NULL; + tk = nullptr; + vc = nullptr; } /* ---------------------------------------------------------------------- @@ -112,7 +112,7 @@ void EwaldDipole::init() int itmp; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); double cutoff = *p_cutoff; diff --git a/src/KSPACE/ewald_dipole_spin.cpp b/src/KSPACE/ewald_dipole_spin.cpp index 94cacd3a753d12431ee1a09a8ef586b51cd11b6a..67f49f87cfaf4df8ebc5f87da18e42b557f3e20d 100644 --- a/src/KSPACE/ewald_dipole_spin.cpp +++ b/src/KSPACE/ewald_dipole_spin.cpp @@ -102,7 +102,7 @@ void EwaldDipoleSpin::init() int itmp; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); double cutoff = *p_cutoff; diff --git a/src/KSPACE/ewald_disp.cpp b/src/KSPACE/ewald_disp.cpp index 546ac472c907b7fd7d8defa17519ab5dba3015a1..4de393c8f672b4e52efc7fb8fd36db6e41bf6613 100644 --- a/src/KSPACE/ewald_disp.cpp +++ b/src/KSPACE/ewald_disp.cpp @@ -43,21 +43,21 @@ using namespace MathSpecial; /* ---------------------------------------------------------------------- */ EwaldDisp::EwaldDisp(LAMMPS *lmp) : KSpace(lmp), - kenergy(NULL), kvirial(NULL), energy_self_peratom(NULL), virial_self_peratom(NULL), - ekr_local(NULL), hvec(NULL), kvec(NULL), B(NULL), cek_local(NULL), cek_global(NULL) + kenergy(nullptr), kvirial(nullptr), energy_self_peratom(nullptr), virial_self_peratom(nullptr), + ekr_local(nullptr), hvec(nullptr), kvec(nullptr), B(nullptr), cek_local(nullptr), cek_global(nullptr) { ewaldflag = dispersionflag = dipoleflag = 1; memset(function, 0, EWALD_NFUNCS*sizeof(int)); - kenergy = kvirial = NULL; - cek_local = cek_global = NULL; - ekr_local = NULL; - hvec = NULL; - kvec = NULL; - B = NULL; + kenergy = kvirial = nullptr; + cek_local = cek_global = nullptr; + ekr_local = nullptr; + hvec = nullptr; + kvec = nullptr; + B = nullptr; first_output = 0; - energy_self_peratom = NULL; - virial_self_peratom = NULL; + energy_self_peratom = nullptr; + virial_self_peratom = nullptr; nmax = 0; q2 = 0; b2 = 0; @@ -109,8 +109,8 @@ void EwaldDisp::init() int tmp; Pair *pair = force->pair; - int *ptr = pair ? (int *) pair->extract("ewald_order",tmp) : NULL; - double *cutoff = pair ? (double *) pair->extract("cut_coul",tmp) : NULL; + int *ptr = pair ? (int *) pair->extract("ewald_order",tmp) : nullptr; + double *cutoff = pair ? (double *) pair->extract("cut_coul",tmp) : nullptr; if (!(ptr||cutoff)) error->all(FLERR,"KSpace style is incompatible with Pair style"); int ewald_order = ptr ? *((int *) ptr) : 1<<1; @@ -423,12 +423,12 @@ void EwaldDisp::deallocate_peratom() // free memory { if (energy_self_peratom) { memory->destroy(energy_self_peratom); - energy_self_peratom = NULL; + energy_self_peratom = nullptr; } if (virial_self_peratom) { memory->destroy(virial_self_peratom); - virial_self_peratom = NULL; + virial_self_peratom = nullptr; } } @@ -436,12 +436,12 @@ void EwaldDisp::deallocate_peratom() // free memory void EwaldDisp::deallocate() // free memory { - delete [] hvec; hvec = NULL; - delete [] kvec; kvec = NULL; - delete [] kenergy; kenergy = NULL; - delete [] kvirial; kvirial = NULL; - delete [] cek_local; cek_local = NULL; - delete [] cek_global; cek_global = NULL; + delete [] hvec; hvec = nullptr; + delete [] kvec; kvec = nullptr; + delete [] kenergy; kenergy = nullptr; + delete [] kvirial; kvirial = nullptr; + delete [] cek_local; cek_local = nullptr; + delete [] cek_global; cek_global = nullptr; } /* ---------------------------------------------------------------------- */ @@ -726,7 +726,7 @@ void EwaldDisp::compute_ek() { cvector *ekr = ekr_local; int lbytes = (2*nbox+1)*sizeof(cvector); - hvector *h = NULL; + hvector *h = nullptr; kvector *k, *nk = kvec+nkvec; cvector *z = new cvector[2*nbox+1]; cvector z1, *zx, *zy, *zz, *zn = z+2*nbox; @@ -734,7 +734,7 @@ void EwaldDisp::compute_ek() vector mui; double *x = atom->x[0], *xn = x+3*atom->nlocal, *q = atom->q, qi = 0.0; double bi = 0.0, ci[7]; - double *mu = atom->mu ? atom->mu[0] : NULL; + double *mu = atom->mu ? atom->mu[0] : nullptr; int i, kx, ky, n = nkvec*nsums, *type = atom->type, tri = domain->triclinic; int func[EWALD_NFUNCS]; @@ -806,8 +806,8 @@ void EwaldDisp::compute_force() vector sum[EWALD_MAX_NSUMS], mui = COMPLEX_NULL; complex *cek, zc, zx = COMPLEX_NULL, zxy = COMPLEX_NULL; complex *cek_coul; - double *f = atom->f[0], *fn = f+3*atom->nlocal, *q = atom->q, *t = NULL; - double *mu = atom->mu ? atom->mu[0] : NULL; + double *f = atom->f[0], *fn = f+3*atom->nlocal, *q = atom->q, *t = nullptr; + double *mu = atom->mu ? atom->mu[0] : nullptr; const double qscale = force->qqrd2e * scale; double *ke, c[EWALD_NFUNCS] = { 8.0*MY_PI*qscale/volume, 2.0*MY_PI*MY_PIS/(12.0*volume), @@ -1002,7 +1002,7 @@ void EwaldDisp::compute_energy_peratom() complex *cek_coul; double *q = atom->q; double *eatomj = eatom; - double *mu = atom->mu ? atom->mu[0] : NULL; + double *mu = atom->mu ? atom->mu[0] : nullptr; const double qscale = force->qqrd2e * scale; double *ke = kenergy; double c[EWALD_NFUNCS] = { @@ -1159,8 +1159,8 @@ void EwaldDisp::compute_virial_dipole() double sum_total[6]; complex *cek, zc, zx = COMPLEX_NULL, zxy = COMPLEX_NULL; complex *cek_coul; - double *mu = atom->mu ? atom->mu[0] : NULL; - double *vatomj = NULL; + double *mu = atom->mu ? atom->mu[0] : nullptr; + double *vatomj = nullptr; if (vflag_atom && vatom) vatomj = vatom[0]; const double qscale = force->qqrd2e * scale; double *ke, c[EWALD_NFUNCS] = { @@ -1255,8 +1255,8 @@ void EwaldDisp::compute_virial_peratom() complex *cek_coul; double *kv; double *q = atom->q; - double *vatomj = vatom ? vatom[0] : NULL; - double *mu = atom->mu ? atom->mu[0] : NULL; + double *vatomj = vatom ? vatom[0] : nullptr; + double *mu = atom->mu ? atom->mu[0] : nullptr; const double qscale = force->qqrd2e * scale; double c[EWALD_NFUNCS] = { 4.0*MY_PI*qscale/volume, 2.0*MY_PI*MY_PIS/(24.0*volume), diff --git a/src/KSPACE/fft3d.cpp b/src/KSPACE/fft3d.cpp index 477f8c759e2308f1fab55acd230eb4ab0861d54e..d5ca88c0df895eaeb447759eb3a5e5f656f3f1fb 100644 --- a/src/KSPACE/fft3d.cpp +++ b/src/KSPACE/fft3d.cpp @@ -279,7 +279,7 @@ struct fft_plan_3d *fft_3d_create_plan( // allocate memory for plan data struct plan = (struct fft_plan_3d *) malloc(sizeof(struct fft_plan_3d)); - if (plan == NULL) return NULL; + if (plan == nullptr) return nullptr; // remap from initial distribution to layout needed for 1st set of 1d FFTs // not needed if all procs own entire fast axis initially @@ -299,7 +299,7 @@ struct fft_plan_3d *fft_3d_create_plan( first_jhi = in_jhi; first_klo = in_klo; first_khi = in_khi; - plan->pre_plan = NULL; + plan->pre_plan = nullptr; } else { first_ilo = 0; first_ihi = nfast - 1; @@ -311,7 +311,7 @@ struct fft_plan_3d *fft_3d_create_plan( remap_3d_create_plan(comm,in_ilo,in_ihi,in_jlo,in_jhi,in_klo,in_khi, first_ilo,first_ihi,first_jlo,first_jhi, first_klo,first_khi,2,0,0,FFT_PRECISION,0); - if (plan->pre_plan == NULL) return NULL; + if (plan->pre_plan == nullptr) return nullptr; } // 1d FFTs along fast axis @@ -336,7 +336,7 @@ struct fft_plan_3d *fft_3d_create_plan( second_ilo,second_ihi,second_jlo,second_jhi, second_klo,second_khi,2,1,0,FFT_PRECISION, usecollective); - if (plan->mid1_plan == NULL) return NULL; + if (plan->mid1_plan == nullptr) return nullptr; // 1d FFTs along mid axis @@ -377,7 +377,7 @@ struct fft_plan_3d *fft_3d_create_plan( second_ilo,second_ihi, third_jlo,third_jhi,third_klo,third_khi, third_ilo,third_ihi,2,1,0,FFT_PRECISION,usecollective); - if (plan->mid2_plan == NULL) return NULL; + if (plan->mid2_plan == nullptr) return nullptr; // 1d FFTs along slow axis @@ -398,7 +398,7 @@ struct fft_plan_3d *fft_3d_create_plan( MPI_Allreduce(&flag,&remapflag,1,MPI_INT,MPI_MAX,comm); if (remapflag == 0) - plan->post_plan = NULL; + plan->post_plan = nullptr; else { plan->post_plan = remap_3d_create_plan(comm, @@ -406,7 +406,7 @@ struct fft_plan_3d *fft_3d_create_plan( third_jlo,third_jhi, out_klo,out_khi,out_ilo,out_ihi, out_jlo,out_jhi,2,(permute+1)%3,0,FFT_PRECISION,0); - if (plan->post_plan == NULL) return NULL; + if (plan->post_plan == nullptr) return nullptr; } // configure plan memory pointers and allocate work space @@ -467,15 +467,15 @@ struct fft_plan_3d *fft_3d_create_plan( if (copy_size) { plan->copy = (FFT_DATA *) malloc(copy_size*sizeof(FFT_DATA)); - if (plan->copy == NULL) return NULL; + if (plan->copy == nullptr) return nullptr; } - else plan->copy = NULL; + else plan->copy = nullptr; if (scratch_size) { plan->scratch = (FFT_DATA *) malloc(scratch_size*sizeof(FFT_DATA)); - if (plan->scratch == NULL) return NULL; + if (plan->scratch == nullptr) return nullptr; } - else plan->scratch = NULL; + else plan->scratch = nullptr; // system specific pre-computation of 1d FFT coeffs // and scaling normalization @@ -527,47 +527,47 @@ struct fft_plan_3d *fft_3d_create_plan( plan->plan_fast_forward = FFTW_API(plan_many_dft)(1, &nfast,plan->total1/plan->length1, - NULL,&nfast,1,plan->length1, - NULL,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, FFTW_FORWARD,FFTW_ESTIMATE); plan->plan_fast_backward = FFTW_API(plan_many_dft)(1, &nfast,plan->total1/plan->length1, - NULL,&nfast,1,plan->length1, - NULL,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, + nullptr,&nfast,1,plan->length1, FFTW_BACKWARD,FFTW_ESTIMATE); plan->plan_mid_forward = FFTW_API(plan_many_dft)(1, &nmid,plan->total2/plan->length2, - NULL,&nmid,1,plan->length2, - NULL,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, FFTW_FORWARD,FFTW_ESTIMATE); plan->plan_mid_backward = FFTW_API(plan_many_dft)(1, &nmid,plan->total2/plan->length2, - NULL,&nmid,1,plan->length2, - NULL,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, + nullptr,&nmid,1,plan->length2, FFTW_BACKWARD,FFTW_ESTIMATE); plan->plan_slow_forward = FFTW_API(plan_many_dft)(1, &nslow,plan->total3/plan->length3, - NULL,&nslow,1,plan->length3, - NULL,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, FFTW_FORWARD,FFTW_ESTIMATE); plan->plan_slow_backward = FFTW_API(plan_many_dft)(1, &nslow,plan->total3/plan->length3, - NULL,&nslow,1,plan->length3, - NULL,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, + nullptr,&nslow,1,plan->length3, FFTW_BACKWARD,FFTW_ESTIMATE); #else /* FFT_KISS */ - plan->cfg_fast_forward = kiss_fft_alloc(nfast,0,NULL,NULL); - plan->cfg_fast_backward = kiss_fft_alloc(nfast,1,NULL,NULL); + plan->cfg_fast_forward = kiss_fft_alloc(nfast,0,nullptr,nullptr); + plan->cfg_fast_backward = kiss_fft_alloc(nfast,1,nullptr,nullptr); if (nmid == nfast) { plan->cfg_mid_forward = plan->cfg_fast_forward; plan->cfg_mid_backward = plan->cfg_fast_backward; } else { - plan->cfg_mid_forward = kiss_fft_alloc(nmid,0,NULL,NULL); - plan->cfg_mid_backward = kiss_fft_alloc(nmid,1,NULL,NULL); + plan->cfg_mid_forward = kiss_fft_alloc(nmid,0,nullptr,nullptr); + plan->cfg_mid_backward = kiss_fft_alloc(nmid,1,nullptr,nullptr); } if (nslow == nfast) { @@ -579,8 +579,8 @@ struct fft_plan_3d *fft_3d_create_plan( plan->cfg_slow_backward = plan->cfg_mid_backward; } else { - plan->cfg_slow_forward = kiss_fft_alloc(nslow,0,NULL,NULL); - plan->cfg_slow_backward = kiss_fft_alloc(nslow,1,NULL,NULL); + plan->cfg_slow_forward = kiss_fft_alloc(nslow,0,nullptr,nullptr); + plan->cfg_slow_backward = kiss_fft_alloc(nslow,1,nullptr,nullptr); } #endif diff --git a/src/KSPACE/fft3d_wrap.cpp b/src/KSPACE/fft3d_wrap.cpp index d0e3a2b50c62c6288255582f29ca2a3cf82c45cf..28af7aabbd4d08fd3b45d9d20eadd73e71bb1267 100644 --- a/src/KSPACE/fft3d_wrap.cpp +++ b/src/KSPACE/fft3d_wrap.cpp @@ -30,7 +30,7 @@ FFT3d::FFT3d(LAMMPS *lmp, MPI_Comm comm, int nfast, int nmid, int nslow, in_ilo,in_ihi,in_jlo,in_jhi,in_klo,in_khi, out_ilo,out_ihi,out_jlo,out_jhi,out_klo,out_khi, scaled,permute,nbuf,usecollective); - if (plan == NULL) error->one(FLERR,"Could not create 3d FFT plan"); + if (plan == nullptr) error->one(FLERR,"Could not create 3d FFT plan"); } /* ---------------------------------------------------------------------- */ diff --git a/src/KSPACE/gridcomm.cpp b/src/KSPACE/gridcomm.cpp index 0f899d31cf693acbf16203b3f4ccc761fb53c969..1c013716cafc5ef7b338411b5a7c5f14a2f6febe 100644 --- a/src/KSPACE/gridcomm.cpp +++ b/src/KSPACE/gridcomm.cpp @@ -211,13 +211,13 @@ void GridComm::initialize(MPI_Comm gcomm, // internal data initializations nswap = maxswap = 0; - swap = NULL; + swap = nullptr; nsend = nrecv = ncopy = 0; - send = NULL; - recv = NULL; - copy = NULL; - requests = NULL; + send = nullptr; + recv = nullptr; + copy = nullptr; + requests = nullptr; } /* ---------------------------------------------------------------------- */ @@ -575,7 +575,7 @@ void GridComm::setup_tiled(int &nbuf1, int &nbuf2) memory->create(overlap_procs,nprocs,"GridComm:overlap_procs"); noverlap = maxoverlap = 0; - overlap = NULL; + overlap = nullptr; ghost_box_drop(ghostbox,pbc); diff --git a/src/KSPACE/kissfft.h b/src/KSPACE/kissfft.h index c95b648dcb2213c100e8f82a06cdbaf676af0f7d..119dc17f669ffe857fb4d16f69c4892aea277a0b 100644 --- a/src/KSPACE/kissfft.h +++ b/src/KSPACE/kissfft.h @@ -420,14 +420,14 @@ static void kf_factor(int n, int *facbuf) */ static kiss_fft_cfg kiss_fft_alloc(int nfft, int inverse_fft, void *mem, size_t *lenmem) { - kiss_fft_cfg st=NULL; + kiss_fft_cfg st=nullptr; size_t memneeded = sizeof(struct kiss_fft_state) + sizeof(FFT_DATA)*(nfft-1); /* twiddle factors */ - if (lenmem==NULL) { + if (lenmem==nullptr) { st=(kiss_fft_cfg)KISS_FFT_MALLOC( memneeded ); } else { - if (mem != NULL && *lenmem >= memneeded) + if (mem != nullptr && *lenmem >= memneeded) st = (kiss_fft_cfg)mem; *lenmem = memneeded; } diff --git a/src/KSPACE/msm.cpp b/src/KSPACE/msm.cpp index 2634b7633cefceeff6d263d362f0dea0d15468b8..8127f89d9c8b2a47d0f1cad4522b17e452826e78 100644 --- a/src/KSPACE/msm.cpp +++ b/src/KSPACE/msm.cpp @@ -45,19 +45,19 @@ enum{FORWARD_RHO,FORWARD_AD,FORWARD_AD_PERATOM}; MSM::MSM(LAMMPS *lmp) : KSpace(lmp), - factors(NULL), delxinv(NULL), delyinv(NULL), delzinv(NULL), nx_msm(NULL), - ny_msm(NULL), nz_msm(NULL), nxlo_in(NULL), nylo_in(NULL), nzlo_in(NULL), - nxhi_in(NULL), nyhi_in(NULL), nzhi_in(NULL), nxlo_out(NULL), nylo_out(NULL), - nzlo_out(NULL), nxhi_out(NULL), nyhi_out(NULL), nzhi_out(NULL), ngrid(NULL), - active_flag(NULL), alpha(NULL), betax(NULL), betay(NULL), betaz(NULL), - peratom_allocate_flag(0),levels(0),world_levels(NULL),qgrid(NULL),egrid(NULL), - v0grid(NULL), v1grid(NULL),v2grid(NULL),v3grid(NULL),v4grid(NULL),v5grid(NULL), - g_direct(NULL),v0_direct(NULL),v1_direct(NULL),v2_direct(NULL),v3_direct(NULL), - v4_direct(NULL),v5_direct(NULL),g_direct_top(NULL),v0_direct_top(NULL), - v1_direct_top(NULL),v2_direct_top(NULL),v3_direct_top(NULL),v4_direct_top(NULL), - v5_direct_top(NULL),phi1d(NULL),dphi1d(NULL),procneigh_levels(NULL),gcall(NULL), - gc(NULL),gcall_buf1(NULL),gcall_buf2(NULL),gc_buf1(NULL),gc_buf2(NULL), - ngc_buf1(NULL),ngc_buf2(NULL),part2grid(NULL),boxlo(NULL) + factors(nullptr), delxinv(nullptr), delyinv(nullptr), delzinv(nullptr), nx_msm(nullptr), + ny_msm(nullptr), nz_msm(nullptr), nxlo_in(nullptr), nylo_in(nullptr), nzlo_in(nullptr), + nxhi_in(nullptr), nyhi_in(nullptr), nzhi_in(nullptr), nxlo_out(nullptr), nylo_out(nullptr), + nzlo_out(nullptr), nxhi_out(nullptr), nyhi_out(nullptr), nzhi_out(nullptr), ngrid(nullptr), + active_flag(nullptr), alpha(nullptr), betax(nullptr), betay(nullptr), betaz(nullptr), + peratom_allocate_flag(0),levels(0),world_levels(nullptr),qgrid(nullptr),egrid(nullptr), + v0grid(nullptr), v1grid(nullptr),v2grid(nullptr),v3grid(nullptr),v4grid(nullptr),v5grid(nullptr), + g_direct(nullptr),v0_direct(nullptr),v1_direct(nullptr),v2_direct(nullptr),v3_direct(nullptr), + v4_direct(nullptr),v5_direct(nullptr),g_direct_top(nullptr),v0_direct_top(nullptr), + v1_direct_top(nullptr),v2_direct_top(nullptr),v3_direct_top(nullptr),v4_direct_top(nullptr), + v5_direct_top(nullptr),phi1d(nullptr),dphi1d(nullptr),procneigh_levels(nullptr),gcall(nullptr), + gc(nullptr),gcall_buf1(nullptr),gcall_buf2(nullptr),gc_buf1(nullptr),gc_buf2(nullptr), + ngc_buf1(nullptr),ngc_buf2(nullptr),part2grid(nullptr),boxlo(nullptr) { msmflag = 1; @@ -67,32 +67,32 @@ MSM::MSM(LAMMPS *lmp) MPI_Comm_rank(world,&me); - phi1d = dphi1d = NULL; + phi1d = dphi1d = nullptr; nmax = 0; - part2grid = NULL; + part2grid = nullptr; - g_direct = NULL; - g_direct_top = NULL; + g_direct = nullptr; + g_direct_top = nullptr; - v0_direct = v1_direct = v2_direct = NULL; - v3_direct = v4_direct = v5_direct = NULL; + v0_direct = v1_direct = v2_direct = nullptr; + v3_direct = v4_direct = v5_direct = nullptr; - v0_direct_top = v1_direct_top = v2_direct_top = NULL; - v3_direct_top = v4_direct_top = v5_direct_top = NULL; + v0_direct_top = v1_direct_top = v2_direct_top = nullptr; + v3_direct_top = v4_direct_top = v5_direct_top = nullptr; - ngrid = NULL; + ngrid = nullptr; - alpha = betax = betay = betaz = NULL; - nx_msm = ny_msm = nz_msm = NULL; - nxlo_in = nylo_in = nzlo_in = NULL; - nxhi_in = nyhi_in = nzhi_in = NULL; - nxlo_out = nylo_out = nzlo_out = NULL; - nxhi_out = nyhi_out = nzhi_out = NULL; - delxinv = delyinv = delzinv = NULL; - qgrid = NULL; - egrid = NULL; - v0grid = v1grid = v2grid = v3grid = v4grid = v5grid = NULL; + alpha = betax = betay = betaz = nullptr; + nx_msm = ny_msm = nz_msm = nullptr; + nxlo_in = nylo_in = nzlo_in = nullptr; + nxhi_in = nyhi_in = nzhi_in = nullptr; + nxlo_out = nylo_out = nzlo_out = nullptr; + nxhi_out = nyhi_out = nzhi_out = nullptr; + delxinv = delyinv = delzinv = nullptr; + qgrid = nullptr; + egrid = nullptr; + v0grid = v1grid = v2grid = v3grid = v4grid = v5grid = nullptr; peratom_allocate_flag = 0; scalar_pressure_flag = 1; @@ -176,7 +176,7 @@ void MSM::init() int itmp; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -825,18 +825,18 @@ void MSM::allocate_levels() v5grid = new double***[levels]; for (int n=0; n 1) { for (i = 0; i < nfactors; i++) { diff --git a/src/KSPACE/msm_cg.cpp b/src/KSPACE/msm_cg.cpp index bbd940f762a34458d5a4ff4f096037d77f8ffac7..383bb58dd5cf10a0ee654dc59945d842d064ceb4 100644 --- a/src/KSPACE/msm_cg.cpp +++ b/src/KSPACE/msm_cg.cpp @@ -40,7 +40,7 @@ enum{FORWARD_RHO,FORWARD_AD,FORWARD_AD_PERATOM}; /* ---------------------------------------------------------------------- */ MSMCG::MSMCG(LAMMPS *lmp) : MSM(lmp), - is_charged(NULL) + is_charged(nullptr) { triclinic_support = 0; diff --git a/src/KSPACE/pair_born_coul_long.cpp b/src/KSPACE/pair_born_coul_long.cpp index a05a6a282b97cbfd9e06899918312b051da888d0..060c19dc19bd20e189673f27096cd4c1c9c53fa0 100644 --- a/src/KSPACE/pair_born_coul_long.cpp +++ b/src/KSPACE/pair_born_coul_long.cpp @@ -45,9 +45,9 @@ using namespace MathConst; PairBornCoulLong::PairBornCoulLong(LAMMPS *lmp) : Pair(lmp) { ewaldflag = pppmflag = 1; - ftable = NULL; + ftable = nullptr; writedata = 1; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -375,7 +375,7 @@ void PairBornCoulLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -383,7 +383,7 @@ void PairBornCoulLong::init_style() // setup force tables - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); } /* ---------------------------------------------------------------------- @@ -423,16 +423,16 @@ void PairBornCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -466,13 +466,13 @@ void PairBornCoulLong::write_restart_settings(FILE *fp) void PairBornCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -577,5 +577,5 @@ void *PairBornCoulLong::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_born_coul_msm.cpp b/src/KSPACE/pair_born_coul_msm.cpp index 7300cd92e067258d028b242f37e152984472626b..707f7f79593f5a12fbcaaaace695588ea0113d12 100644 --- a/src/KSPACE/pair_born_coul_msm.cpp +++ b/src/KSPACE/pair_born_coul_msm.cpp @@ -34,7 +34,7 @@ PairBornCoulMSM::PairBornCoulMSM(LAMMPS *lmp) : PairBornCoulLong(lmp) ewaldflag = pppmflag = 0; msmflag = 1; nmax = 0; - ftmp = NULL; + ftmp = nullptr; } /* ---------------------------------------------------------------------- */ @@ -251,5 +251,5 @@ void *PairBornCoulMSM::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_buck_coul_long.cpp b/src/KSPACE/pair_buck_coul_long.cpp index 8d15a6480aac75e820594203db74c5f8e5bf68c5..2733bc31cdd53271f6cb2b70aff61c0985c3efac 100644 --- a/src/KSPACE/pair_buck_coul_long.cpp +++ b/src/KSPACE/pair_buck_coul_long.cpp @@ -364,7 +364,7 @@ void PairBuckCoulLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -372,7 +372,7 @@ void PairBuckCoulLong::init_style() // setup force tables - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); } /* ---------------------------------------------------------------------- @@ -410,14 +410,14 @@ void PairBuckCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -449,13 +449,13 @@ void PairBuckCoulLong::write_restart_settings(FILE *fp) void PairBuckCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -558,5 +558,5 @@ void *PairBuckCoulLong::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_buck_coul_msm.cpp b/src/KSPACE/pair_buck_coul_msm.cpp index 1355a2f13a2c24a9cd1f22ea82df8af008a24580..87c852b5aaf4fbd36ce7e58a213172b6af66a225 100644 --- a/src/KSPACE/pair_buck_coul_msm.cpp +++ b/src/KSPACE/pair_buck_coul_msm.cpp @@ -31,7 +31,7 @@ PairBuckCoulMSM::PairBuckCoulMSM(LAMMPS *lmp) : PairBuckCoulLong(lmp) ewaldflag = pppmflag = 0; msmflag = 1; nmax = 0; - ftmp = NULL; + ftmp = nullptr; } /* ---------------------------------------------------------------------- */ @@ -246,5 +246,5 @@ void *PairBuckCoulMSM::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_buck_long_coul_long.cpp b/src/KSPACE/pair_buck_long_coul_long.cpp index a845ddd1d2c75c2cdc3baaacf8d862f31ecafe82..744232dd8e9df823fe6870aa26d29c44dea0064c 100644 --- a/src/KSPACE/pair_buck_long_coul_long.cpp +++ b/src/KSPACE/pair_buck_long_coul_long.cpp @@ -50,9 +50,9 @@ PairBuckLongCoulLong::PairBuckLongCoulLong(LAMMPS *lmp) : Pair(lmp) dispersionflag = ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; - fdisptable = NULL; - cut_respa = NULL; + ftable = nullptr; + fdisptable = nullptr; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -61,7 +61,7 @@ PairBuckLongCoulLong::PairBuckLongCoulLong(LAMMPS *lmp) : Pair(lmp) void PairBuckLongCoulLong::options(char **arg, int order) { - const char *option[] = {"long", "cut", "off", NULL}; + const char *option[] = {"long", "cut", "off", nullptr}; int i; if (!*arg) error->all(FLERR,"Illegal pair_style buck/long/coul/long command"); @@ -177,10 +177,10 @@ void PairBuckLongCoulLong::allocate() void *PairBuckLongCoulLong::extract(const char *id, int &dim) { const char *ids[] = { - "B", "ewald_order", "ewald_cut", "ewald_mix", "cut_coul", "cut_LJ", NULL}; + "B", "ewald_order", "ewald_cut", "ewald_mix", "cut_coul", "cut_LJ", nullptr}; void *ptrs[] = { buck_c, &ewald_order, &cut_coul, &mix_flag, &cut_coul, &cut_buck_global, - NULL}; + nullptr}; int i; for (i=0; ids[i]&&strcmp(ids[i], id); ++i); @@ -240,7 +240,7 @@ void PairBuckLongCoulLong::init_style() // ensure use of KSpace long-range solver, set two g_ewalds - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); if (ewald_order&(1<<1)) g_ewald = force->kspace->g_ewald; if (ewald_order&(1<<6)) g_ewald_6 = force->kspace->g_ewald_6; @@ -250,7 +250,7 @@ void PairBuckLongCoulLong::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // setup force tables @@ -359,14 +359,14 @@ void PairBuckLongCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&buck_a_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck_rho_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck_c_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_buck_read[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&buck_a_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck_rho_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck_c_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_buck_read[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&buck_a_read[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&buck_rho_read[i][j],1,MPI_DOUBLE,0,world); @@ -399,14 +399,14 @@ void PairBuckLongCoulLong::write_restart_settings(FILE *fp) void PairBuckLongCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_buck_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_buck_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_buck_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); diff --git a/src/KSPACE/pair_coul_long.cpp b/src/KSPACE/pair_coul_long.cpp index 2520da2654288a2d98eccb5faaffbf13591b9d72..68b9a8cbe2f4aa05329afa96d5d8f40b9a5132b2 100644 --- a/src/KSPACE/pair_coul_long.cpp +++ b/src/KSPACE/pair_coul_long.cpp @@ -44,9 +44,9 @@ using namespace LAMMPS_NS; PairCoulLong::PairCoulLong(LAMMPS *lmp) : Pair(lmp) { ewaldflag = pppmflag = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -242,13 +242,13 @@ void PairCoulLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; // setup force tables - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); } /* ---------------------------------------------------------------------- @@ -291,10 +291,10 @@ void PairCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { - if (me == 0) utils::sfread(FLERR,&scale[i][j],sizeof(double),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&scale[i][j],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&scale[i][j],1,MPI_DOUBLE,0,world); } } @@ -320,11 +320,11 @@ void PairCoulLong::write_restart_settings(FILE *fp) void PairCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -393,5 +393,5 @@ void *PairCoulLong::extract(const char *str, int &dim) dim = 2; return (void *) scale; } - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_coul_msm.cpp b/src/KSPACE/pair_coul_msm.cpp index 5d42e1f046e70a529282b3c6806327b13d86ec62..bf689d403d7ce9b5310e42b3b9a59f7f964d510d 100644 --- a/src/KSPACE/pair_coul_msm.cpp +++ b/src/KSPACE/pair_coul_msm.cpp @@ -217,5 +217,5 @@ void *PairCoulMSM::extract(const char *str, int &dim) dim = 2; return (void *) scale; } - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_lj_charmm_coul_long.cpp b/src/KSPACE/pair_lj_charmm_coul_long.cpp index 261e93fbc9288ca8063218f0b2b1c170d83cee15..b4455ff9b84d3a20bb50baee6e1451397b12750f 100644 --- a/src/KSPACE/pair_lj_charmm_coul_long.cpp +++ b/src/KSPACE/pair_lj_charmm_coul_long.cpp @@ -47,11 +47,11 @@ PairLJCharmmCoulLong::PairLJCharmmCoulLong(LAMMPS *lmp) : Pair(lmp) { respa_enable = 1; ewaldflag = pppmflag = 1; - ftable = NULL; + ftable = nullptr; implicit = 0; mix_flag = ARITHMETIC; writedata = 1; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -738,11 +738,11 @@ void PairLJCharmmCoulLong::init_style() error->all(FLERR,"Pair cutoff < Respa interior cutoff"); if (cut_lj_inner < cut_respa[1]) error->all(FLERR,"Pair inner cutoff < Respa interior cutoff"); - } else cut_respa = NULL; + } else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -824,14 +824,14 @@ void PairLJCharmmCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -863,13 +863,13 @@ void PairLJCharmmCoulLong::write_restart_settings(FILE *fp) void PairLJCharmmCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_inner,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj,1,MPI_DOUBLE,0,world); @@ -994,5 +994,5 @@ void *PairLJCharmmCoulLong::extract(const char *str, int &dim) if (strcmp(str,"implicit") == 0) return (void *) &implicit; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_lj_charmm_coul_msm.cpp b/src/KSPACE/pair_lj_charmm_coul_msm.cpp index a93a1275f4433e99593fd2bd1c66af7536712591..fe3ce441a1ea1a2f7dde3e13b9aa47b021567012 100644 --- a/src/KSPACE/pair_lj_charmm_coul_msm.cpp +++ b/src/KSPACE/pair_lj_charmm_coul_msm.cpp @@ -35,7 +35,7 @@ PairLJCharmmCoulMSM::PairLJCharmmCoulMSM(LAMMPS *lmp) : ewaldflag = pppmflag = 0; msmflag = 1; nmax = 0; - ftmp = NULL; + ftmp = nullptr; } /* ---------------------------------------------------------------------- */ @@ -537,5 +537,5 @@ void *PairLJCharmmCoulMSM::extract(const char *str, int &dim) if (strcmp(str,"implicit") == 0) return (void *) &implicit; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp b/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp index 9df9862c117a8c20f32399cd98ec98ba9e08369c..abc8888e5946041fd0acd1bedbe6bf2d880ef78a 100644 --- a/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp +++ b/src/KSPACE/pair_lj_charmmfsw_coul_long.cpp @@ -51,11 +51,11 @@ PairLJCharmmfswCoulLong::PairLJCharmmfswCoulLong(LAMMPS *lmp) : Pair(lmp) { respa_enable = 1; ewaldflag = pppmflag = 1; - ftable = NULL; + ftable = nullptr; implicit = 0; mix_flag = ARITHMETIC; writedata = 1; - cut_respa = NULL; + cut_respa = nullptr; // short-range/long-range flag accessed by DihedralCharmmfsw @@ -786,11 +786,11 @@ void PairLJCharmmfswCoulLong::init_style() error->all(FLERR,"Pair cutoff < Respa interior cutoff"); if (cut_lj_inner < cut_respa[1]) error->all(FLERR,"Pair inner cutoff < Respa interior cutoff"); - } else cut_respa = NULL; + } else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -872,14 +872,14 @@ void PairLJCharmmfswCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -911,13 +911,13 @@ void PairLJCharmmfswCoulLong::write_restart_settings(FILE *fp) void PairLJCharmmfswCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_inner,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj,1,MPI_DOUBLE,0,world); @@ -1055,5 +1055,5 @@ void *PairLJCharmmfswCoulLong::extract(const char *str, int &dim) if (strcmp(str,"cut_lj") == 0) return (void *) &cut_lj; if (strcmp(str,"dihedflag") == 0) return (void *) &dihedflag; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_lj_cut_coul_long.cpp b/src/KSPACE/pair_lj_cut_coul_long.cpp index 7fd8a72559ce20bd86f6d7671793c21856696997..7ae60acc869470ecd6b3438ed7a7a826d5bee823 100644 --- a/src/KSPACE/pair_lj_cut_coul_long.cpp +++ b/src/KSPACE/pair_lj_cut_coul_long.cpp @@ -51,9 +51,9 @@ PairLJCutCoulLong::PairLJCutCoulLong(LAMMPS *lmp) : Pair(lmp) ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -676,11 +676,11 @@ void PairLJCutCoulLong::init_style() if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -792,13 +792,13 @@ void PairLJCutCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -829,13 +829,13 @@ void PairLJCutCoulLong::write_restart_settings(FILE *fp) void PairLJCutCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -943,5 +943,5 @@ void *PairLJCutCoulLong::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_lj_cut_coul_msm.cpp b/src/KSPACE/pair_lj_cut_coul_msm.cpp index 4ebbcb9a3fd808c9f745c7fb88ddc073733ef634..00aa88152d0e3babd310e20f29ec67f905b45163 100644 --- a/src/KSPACE/pair_lj_cut_coul_msm.cpp +++ b/src/KSPACE/pair_lj_cut_coul_msm.cpp @@ -34,7 +34,7 @@ PairLJCutCoulMSM::PairLJCutCoulMSM(LAMMPS *lmp) : PairLJCutCoulLong(lmp) ewaldflag = pppmflag = 0; msmflag = 1; nmax = 0; - ftmp = NULL; + ftmp = nullptr; } /* ---------------------------------------------------------------------- */ @@ -478,5 +478,5 @@ void *PairLJCutCoulMSM::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/KSPACE/pair_lj_cut_tip4p_long.cpp b/src/KSPACE/pair_lj_cut_tip4p_long.cpp index a62c1bd55b2f9a95e6a21fe950370dcf7a55a093..0d7778c93a6205c7a438d79027a3a69043aef725 100644 --- a/src/KSPACE/pair_lj_cut_tip4p_long.cpp +++ b/src/KSPACE/pair_lj_cut_tip4p_long.cpp @@ -55,8 +55,8 @@ PairLJCutTIP4PLong::PairLJCutTIP4PLong(LAMMPS *lmp) : writedata = 1; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -464,9 +464,9 @@ void PairLJCutTIP4PLong::init_style() if (!atom->q_flag) error->all(FLERR, "Pair style lj/cut/tip4p/long requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); PairLJCutCoulLong::init_style(); @@ -529,19 +529,19 @@ void PairLJCutTIP4PLong::write_restart_settings(FILE *fp) void PairLJCutTIP4PLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); @@ -594,7 +594,7 @@ void *PairLJCutTIP4PLong::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KSPACE/pair_lj_long_coul_long.cpp b/src/KSPACE/pair_lj_long_coul_long.cpp index b6727c2c992931fb92416aabce23fcf8e31af8dd..960a47e685651e367734ae875254f90e42a8aafa 100644 --- a/src/KSPACE/pair_lj_long_coul_long.cpp +++ b/src/KSPACE/pair_lj_long_coul_long.cpp @@ -53,10 +53,10 @@ PairLJLongCoulLong::PairLJLongCoulLong(LAMMPS *lmp) : Pair(lmp) dispersionflag = ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; - fdisptable = NULL; + ftable = nullptr; + fdisptable = nullptr; qdist = 0.0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -65,7 +65,7 @@ PairLJLongCoulLong::PairLJLongCoulLong(LAMMPS *lmp) : Pair(lmp) void PairLJLongCoulLong::options(char **arg, int order) { - const char *option[] = {"long", "cut", "off", NULL}; + const char *option[] = {"long", "cut", "off", nullptr}; int i; if (!*arg) error->all(FLERR,"Illegal pair_style lj/long/coul/long command"); @@ -176,10 +176,10 @@ void *PairLJLongCoulLong::extract(const char *id, int &dim) { const char *ids[] = { "B", "sigma", "epsilon", "ewald_order", "ewald_cut", "ewald_mix", - "cut_coul", "cut_LJ", NULL}; + "cut_coul", "cut_LJ", nullptr}; void *ptrs[] = { lj4, sigma, epsilon, &ewald_order, &cut_coul, &mix_flag, - &cut_coul, &cut_lj_global, NULL}; + &cut_coul, &cut_lj_global, nullptr}; int i; for (i=0; ids[i]&&strcmp(ids[i], id); ++i); @@ -235,7 +235,7 @@ void PairLJLongCoulLong::init_style() // ensure use of KSpace long-range solver, set two g_ewalds - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); if (ewald_order&(1<<1)) g_ewald = force->kspace->g_ewald; if (ewald_order&(1<<6)) g_ewald_6 = force->kspace->g_ewald_6; @@ -245,7 +245,7 @@ void PairLJLongCoulLong::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // setup force tables @@ -360,13 +360,13 @@ void PairLJLongCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma_read[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_read[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma_read[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_read[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon_read[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma_read[i][j],1,MPI_DOUBLE,0,world); @@ -398,14 +398,14 @@ void PairLJLongCoulLong::write_restart_settings(FILE *fp) void PairLJLongCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); diff --git a/src/KSPACE/pair_lj_long_tip4p_long.cpp b/src/KSPACE/pair_lj_long_tip4p_long.cpp index 8f17bda0086574fda1836b674078a71ba1971149..790e318160d5821ae909c4158bd9421bd7789abe 100644 --- a/src/KSPACE/pair_lj_long_tip4p_long.cpp +++ b/src/KSPACE/pair_lj_long_tip4p_long.cpp @@ -52,8 +52,8 @@ PairLJLongTIP4PLong::PairLJLongTIP4PLong(LAMMPS *lmp) : respa_enable = 1; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to find_M() finding bonded H atoms which are not near O atom @@ -1479,9 +1479,9 @@ void PairLJLongTIP4PLong::init_style() error->all(FLERR,"Pair style lj/long/tip4p/long requires newton pair on"); if (!atom->q_flag) error->all(FLERR,"Pair style lj/long/tip4p/long requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); PairLJLongCoulLong::init_style(); @@ -1544,20 +1544,20 @@ void PairLJLongTIP4PLong::write_restart_settings(FILE *fp) void PairLJLongTIP4PLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&ewald_order,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); @@ -1611,14 +1611,14 @@ void *PairLJLongTIP4PLong::extract(const char *str, int &dim) const char *ids[] = { "B", "sigma", "epsilon", "ewald_order", "ewald_cut", "cut_coul", - "ewald_mix", "cut_LJ", NULL}; + "ewald_mix", "cut_LJ", nullptr}; void *ptrs[] = { lj4, sigma, epsilon, &ewald_order, &cut_coul, &cut_coul, - &mix_flag, &cut_lj_global, NULL}; + &mix_flag, &cut_lj_global, nullptr}; int i; i=0; - while (ids[i] != NULL) { + while (ids[i] != nullptr) { if (i <=2) dim = 2; else dim = 0; @@ -1627,7 +1627,7 @@ void *PairLJLongTIP4PLong::extract(const char *str, int &dim) ++i; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KSPACE/pair_tip4p_long.cpp b/src/KSPACE/pair_tip4p_long.cpp index 54973c69c2b4845efc6a5e174d1aa27f0145f292..80785d35515d11aa55952b82b9a2677e2454dd15 100644 --- a/src/KSPACE/pair_tip4p_long.cpp +++ b/src/KSPACE/pair_tip4p_long.cpp @@ -51,8 +51,8 @@ PairTIP4PLong::PairTIP4PLong(LAMMPS *lmp) : PairCoulLong(lmp) respa_enable = 0; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -421,9 +421,9 @@ void PairTIP4PLong::init_style() if (!atom->q_flag) error->all(FLERR, "Pair style tip4p/long requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); PairCoulLong::init_style(); @@ -468,11 +468,11 @@ void PairTIP4PLong::read_restart_settings(FILE *fp) PairCoulLong::read_restart_settings(fp); if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); @@ -514,7 +514,7 @@ void *PairTIP4PLong::extract(const char *str, int &dim) if (strcmp(str,"typeA") == 0) return (void *) &typeA; if (strcmp(str,"typeB") == 0) return (void *) &typeB; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KSPACE/pppm.cpp b/src/KSPACE/pppm.cpp index 41ffec4f3b0c967381d06f6d494ac090e72dd3cc..89d308eaa37a1ca404e30378f5113fd4889f718e 100644 --- a/src/KSPACE/pppm.cpp +++ b/src/KSPACE/pppm.cpp @@ -63,16 +63,16 @@ enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM}; /* ---------------------------------------------------------------------- */ PPPM::PPPM(LAMMPS *lmp) : KSpace(lmp), - factors(NULL), density_brick(NULL), vdx_brick(NULL), vdy_brick(NULL), vdz_brick(NULL), - u_brick(NULL), v0_brick(NULL), v1_brick(NULL), v2_brick(NULL), v3_brick(NULL), - v4_brick(NULL), v5_brick(NULL), greensfn(NULL), vg(NULL), fkx(NULL), fky(NULL), - fkz(NULL), density_fft(NULL), work1(NULL), work2(NULL), gf_b(NULL), rho1d(NULL), - rho_coeff(NULL), drho1d(NULL), drho_coeff(NULL), - sf_precoeff1(NULL), sf_precoeff2(NULL), sf_precoeff3(NULL), - sf_precoeff4(NULL), sf_precoeff5(NULL), sf_precoeff6(NULL), - acons(NULL), fft1(NULL), fft2(NULL), remap(NULL), gc(NULL), - gc_buf1(NULL), gc_buf2(NULL), density_A_brick(NULL), density_B_brick(NULL), density_A_fft(NULL), - density_B_fft(NULL), part2grid(NULL), boxlo(NULL) + factors(nullptr), density_brick(nullptr), vdx_brick(nullptr), vdy_brick(nullptr), vdz_brick(nullptr), + u_brick(nullptr), v0_brick(nullptr), v1_brick(nullptr), v2_brick(nullptr), v3_brick(nullptr), + v4_brick(nullptr), v5_brick(nullptr), greensfn(nullptr), vg(nullptr), fkx(nullptr), fky(nullptr), + fkz(nullptr), density_fft(nullptr), work1(nullptr), work2(nullptr), gf_b(nullptr), rho1d(nullptr), + rho_coeff(nullptr), drho1d(nullptr), drho_coeff(nullptr), + sf_precoeff1(nullptr), sf_precoeff2(nullptr), sf_precoeff3(nullptr), + sf_precoeff4(nullptr), sf_precoeff5(nullptr), sf_precoeff6(nullptr), + acons(nullptr), fft1(nullptr), fft2(nullptr), remap(nullptr), gc(nullptr), + gc_buf1(nullptr), gc_buf2(nullptr), density_A_brick(nullptr), density_B_brick(nullptr), density_A_fft(nullptr), + density_B_fft(nullptr), part2grid(nullptr), boxlo(nullptr) { peratom_allocate_flag = 0; group_allocate_flag = 0; @@ -95,31 +95,31 @@ PPPM::PPPM(LAMMPS *lmp) : KSpace(lmp), nyhi_in = nylo_in = nyhi_out = nylo_out = 0; nzhi_in = nzlo_in = nzhi_out = nzlo_out = 0; - density_brick = vdx_brick = vdy_brick = vdz_brick = NULL; - density_fft = NULL; - u_brick = NULL; - v0_brick = v1_brick = v2_brick = v3_brick = v4_brick = v5_brick = NULL; - greensfn = NULL; - work1 = work2 = NULL; - vg = NULL; - fkx = fky = fkz = NULL; + density_brick = vdx_brick = vdy_brick = vdz_brick = nullptr; + density_fft = nullptr; + u_brick = nullptr; + v0_brick = v1_brick = v2_brick = v3_brick = v4_brick = v5_brick = nullptr; + greensfn = nullptr; + work1 = work2 = nullptr; + vg = nullptr; + fkx = fky = fkz = nullptr; sf_precoeff1 = sf_precoeff2 = sf_precoeff3 = - sf_precoeff4 = sf_precoeff5 = sf_precoeff6 = NULL; + sf_precoeff4 = sf_precoeff5 = sf_precoeff6 = nullptr; - density_A_brick = density_B_brick = NULL; - density_A_fft = density_B_fft = NULL; + density_A_brick = density_B_brick = nullptr; + density_A_fft = density_B_fft = nullptr; - gf_b = NULL; - rho1d = rho_coeff = drho1d = drho_coeff = NULL; + gf_b = nullptr; + rho1d = rho_coeff = drho1d = drho_coeff = nullptr; - fft1 = fft2 = NULL; - remap = NULL; - gc = NULL; - gc_buf1 = gc_buf2 = NULL; + fft1 = fft2 = nullptr; + remap = nullptr; + gc = nullptr; + gc_buf1 = gc_buf2 = nullptr; nmax = 0; - part2grid = NULL; + part2grid = nullptr; // define acons coefficients for estimation of kspace errors // see JCP 109, pg 7698 for derivation of coefficients @@ -229,7 +229,7 @@ void PPPM::init() int itmp = 0; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -254,8 +254,8 @@ void PPPM::init() int typeA = *p_typeA; int typeB = *p_typeB; - if (force->angle == NULL || force->bond == NULL || - force->angle->setflag == NULL || force->bond->setflag == NULL) + if (force->angle == nullptr || force->bond == nullptr || + force->angle->setflag == nullptr || force->bond->setflag == nullptr) error->all(FLERR,"Bond and angle potentials must be defined for TIP4P"); if (typeA < 1 || typeA > atom->nangletypes || force->angle->setflag[typeA] == 0) @@ -292,7 +292,7 @@ void PPPM::init() // or overlap is allowed, then done // else reduce order and try again - GridComm *gctmp = NULL; + GridComm *gctmp = nullptr; int iteration = 0; while (order >= minorder) { @@ -867,7 +867,7 @@ void PPPM::deallocate() } memory->destroy(gf_b); - if (stagger_flag) gf_b = NULL; + if (stagger_flag) gf_b = nullptr; memory->destroy2d_offset(rho1d,-order_allocated/2); memory->destroy2d_offset(drho1d,-order_allocated/2); memory->destroy2d_offset(rho_coeff,(1-order_allocated)/2); diff --git a/src/KSPACE/pppm_cg.cpp b/src/KSPACE/pppm_cg.cpp index b319014c7814fd35392a177668c38dfa33266680..62f816a94dc9ff659a6d1a105db875096b5fa1c2 100644 --- a/src/KSPACE/pppm_cg.cpp +++ b/src/KSPACE/pppm_cg.cpp @@ -47,7 +47,7 @@ enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM}; /* ---------------------------------------------------------------------- */ PPPMCG::PPPMCG(LAMMPS *lmp) : PPPM(lmp), - is_charged(NULL) + is_charged(nullptr) { num_charged = -1; group_group_enable = 1; diff --git a/src/KSPACE/pppm_dipole.cpp b/src/KSPACE/pppm_dipole.cpp index 1b7d3253268ff2f79a02695c8799c7e718214a08..feb17e522e08017043a7c50324c6962578421c59 100644 --- a/src/KSPACE/pppm_dipole.cpp +++ b/src/KSPACE/pppm_dipole.cpp @@ -58,25 +58,25 @@ enum{FORWARD_MU,FORWARD_MU_PERATOM}; /* ---------------------------------------------------------------------- */ PPPMDipole::PPPMDipole(LAMMPS *lmp) : PPPM(lmp), - densityx_brick_dipole(NULL), densityy_brick_dipole(NULL), - densityz_brick_dipole(NULL), - vdxx_brick_dipole(NULL), vdyy_brick_dipole(NULL), vdzz_brick_dipole(NULL), - vdxy_brick_dipole(NULL), vdxz_brick_dipole(NULL), vdyz_brick_dipole(NULL), - ux_brick_dipole(NULL), uy_brick_dipole(NULL), uz_brick_dipole(NULL), - v0x_brick_dipole(NULL), v1x_brick_dipole(NULL), - v2x_brick_dipole(NULL), v3x_brick_dipole(NULL), v4x_brick_dipole(NULL), - v5x_brick_dipole(NULL), v0y_brick_dipole(NULL), v1y_brick_dipole(NULL), - v2y_brick_dipole(NULL), v3y_brick_dipole(NULL), v4y_brick_dipole(NULL), - v5y_brick_dipole(NULL), v0z_brick_dipole(NULL), v1z_brick_dipole(NULL), - v2z_brick_dipole(NULL), v3z_brick_dipole(NULL), v4z_brick_dipole(NULL), - v5z_brick_dipole(NULL), work3(NULL), work4(NULL), - densityx_fft_dipole(NULL), densityy_fft_dipole(NULL), - densityz_fft_dipole(NULL) + densityx_brick_dipole(nullptr), densityy_brick_dipole(nullptr), + densityz_brick_dipole(nullptr), + vdxx_brick_dipole(nullptr), vdyy_brick_dipole(nullptr), vdzz_brick_dipole(nullptr), + vdxy_brick_dipole(nullptr), vdxz_brick_dipole(nullptr), vdyz_brick_dipole(nullptr), + ux_brick_dipole(nullptr), uy_brick_dipole(nullptr), uz_brick_dipole(nullptr), + v0x_brick_dipole(nullptr), v1x_brick_dipole(nullptr), + v2x_brick_dipole(nullptr), v3x_brick_dipole(nullptr), v4x_brick_dipole(nullptr), + v5x_brick_dipole(nullptr), v0y_brick_dipole(nullptr), v1y_brick_dipole(nullptr), + v2y_brick_dipole(nullptr), v3y_brick_dipole(nullptr), v4y_brick_dipole(nullptr), + v5y_brick_dipole(nullptr), v0z_brick_dipole(nullptr), v1z_brick_dipole(nullptr), + v2z_brick_dipole(nullptr), v3z_brick_dipole(nullptr), v4z_brick_dipole(nullptr), + v5z_brick_dipole(nullptr), work3(nullptr), work4(nullptr), + densityx_fft_dipole(nullptr), densityy_fft_dipole(nullptr), + densityz_fft_dipole(nullptr) { dipoleflag = 1; group_group_enable = 0; - gc_dipole = NULL; + gc_dipole = nullptr; } /* ---------------------------------------------------------------------- @@ -153,7 +153,7 @@ void PPPMDipole::init() int itmp = 0; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -187,7 +187,7 @@ void PPPMDipole::init() // or overlap is allowed, then done // else reduce order and try again - GridComm *gctmp = NULL; + GridComm *gctmp = nullptr; int iteration = 0; while (order >= minorder) { diff --git a/src/KSPACE/pppm_dipole_spin.cpp b/src/KSPACE/pppm_dipole_spin.cpp index 595c257331a4e7b784f6497884efa53874ae880d..a3f7aa29cf92b5062c8c0d047ea7e27ed974d863 100644 --- a/src/KSPACE/pppm_dipole_spin.cpp +++ b/src/KSPACE/pppm_dipole_spin.cpp @@ -75,10 +75,10 @@ PPPMDipoleSpin::~PPPMDipoleSpin() deallocate(); if (peratom_allocate_flag) deallocate_peratom(); - fft1 = NULL; - fft2 = NULL; - remap = NULL; - gc_dipole = NULL; + fft1 = nullptr; + fft2 = nullptr; + remap = nullptr; + gc_dipole = nullptr; } /* ---------------------------------------------------------------------- @@ -139,7 +139,7 @@ void PPPMDipoleSpin::init() int itmp = 0; double *p_cutoff = (double *) force->pair->extract("cut_coul",itmp); // check the correct extract here - if (p_cutoff == NULL) + if (p_cutoff == nullptr) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -172,7 +172,7 @@ void PPPMDipoleSpin::init() // or overlap is allowed, then done // else reduce order and try again - GridComm *gctmp = NULL; + GridComm *gctmp = nullptr; int iteration = 0; while (order >= minorder) { diff --git a/src/KSPACE/pppm_disp.cpp b/src/KSPACE/pppm_disp.cpp index a484751a8164c521bf3e62b8da8cd56b3f448cea..a88a0892bcaa46c8a5353e47902cebffd6dd2a31 100644 --- a/src/KSPACE/pppm_disp.cpp +++ b/src/KSPACE/pppm_disp.cpp @@ -63,47 +63,47 @@ enum{FORWARD_IK, FORWARD_AD, FORWARD_IK_PERATOM, FORWARD_AD_PERATOM, /* ---------------------------------------------------------------------- */ PPPMDisp::PPPMDisp(LAMMPS *lmp) : KSpace(lmp), - factors(NULL), csumi(NULL), cii(NULL), B(NULL), density_brick(NULL), vdx_brick(NULL), - vdy_brick(NULL), vdz_brick(NULL), density_fft(NULL), u_brick(NULL), v0_brick(NULL), - v1_brick(NULL), v2_brick(NULL), v3_brick(NULL), v4_brick(NULL), v5_brick(NULL), - density_brick_g(NULL), vdx_brick_g(NULL), vdy_brick_g(NULL), vdz_brick_g(NULL), - density_fft_g(NULL), u_brick_g(NULL), v0_brick_g(NULL), v1_brick_g(NULL), v2_brick_g(NULL), - v3_brick_g(NULL), v4_brick_g(NULL), v5_brick_g(NULL), density_brick_a0(NULL), - vdx_brick_a0(NULL), vdy_brick_a0(NULL), vdz_brick_a0(NULL), density_fft_a0(NULL), - u_brick_a0(NULL), v0_brick_a0(NULL), v1_brick_a0(NULL), v2_brick_a0(NULL), - v3_brick_a0(NULL), v4_brick_a0(NULL), v5_brick_a0(NULL), density_brick_a1(NULL), - vdx_brick_a1(NULL), vdy_brick_a1(NULL), vdz_brick_a1(NULL), density_fft_a1(NULL), - u_brick_a1(NULL), v0_brick_a1(NULL), v1_brick_a1(NULL), v2_brick_a1(NULL), - v3_brick_a1(NULL), v4_brick_a1(NULL), v5_brick_a1(NULL), density_brick_a2(NULL), - vdx_brick_a2(NULL), vdy_brick_a2(NULL), vdz_brick_a2(NULL), density_fft_a2(NULL), - u_brick_a2(NULL), v0_brick_a2(NULL), v1_brick_a2(NULL), v2_brick_a2(NULL), - v3_brick_a2(NULL), v4_brick_a2(NULL), v5_brick_a2(NULL), density_brick_a3(NULL), - vdx_brick_a3(NULL), vdy_brick_a3(NULL), vdz_brick_a3(NULL), density_fft_a3(NULL), - u_brick_a3(NULL), v0_brick_a3(NULL), v1_brick_a3(NULL), v2_brick_a3(NULL), - v3_brick_a3(NULL), v4_brick_a3(NULL), v5_brick_a3(NULL), density_brick_a4(NULL), - vdx_brick_a4(NULL), vdy_brick_a4(NULL), vdz_brick_a4(NULL), density_fft_a4(NULL), - u_brick_a4(NULL), v0_brick_a4(NULL), v1_brick_a4(NULL), v2_brick_a4(NULL), - v3_brick_a4(NULL), v4_brick_a4(NULL), v5_brick_a4(NULL), density_brick_a5(NULL), - vdx_brick_a5(NULL), vdy_brick_a5(NULL), vdz_brick_a5(NULL), density_fft_a5(NULL), - u_brick_a5(NULL), v0_brick_a5(NULL), v1_brick_a5(NULL), v2_brick_a5(NULL), - v3_brick_a5(NULL), v4_brick_a5(NULL), v5_brick_a5(NULL), density_brick_a6(NULL), - vdx_brick_a6(NULL), vdy_brick_a6(NULL), vdz_brick_a6(NULL), density_fft_a6(NULL), - u_brick_a6(NULL), v0_brick_a6(NULL), v1_brick_a6(NULL), v2_brick_a6(NULL), - v3_brick_a6(NULL), v4_brick_a6(NULL), v5_brick_a6(NULL), density_brick_none(NULL), - vdx_brick_none(NULL), vdy_brick_none(NULL), vdz_brick_none(NULL), - density_fft_none(NULL), u_brick_none(NULL), v0_brick_none(NULL), v1_brick_none(NULL), - v2_brick_none(NULL), v3_brick_none(NULL), v4_brick_none(NULL), v5_brick_none(NULL), - greensfn(NULL), vg(NULL), vg2(NULL), greensfn_6(NULL), vg_6(NULL), vg2_6(NULL), - fkx(NULL), fky(NULL), fkz(NULL), fkx2(NULL), fky2(NULL), fkz2(NULL), fkx_6(NULL), - fky_6(NULL), fkz_6(NULL), fkx2_6(NULL), fky2_6(NULL), fkz2_6(NULL), gf_b(NULL), - gf_b_6(NULL), sf_precoeff1(NULL), sf_precoeff2(NULL), sf_precoeff3(NULL), - sf_precoeff4(NULL), sf_precoeff5(NULL), sf_precoeff6(NULL), sf_precoeff1_6(NULL), - sf_precoeff2_6(NULL), sf_precoeff3_6(NULL), sf_precoeff4_6(NULL), sf_precoeff5_6(NULL), - sf_precoeff6_6(NULL), rho1d(NULL), rho_coeff(NULL), drho1d(NULL), drho_coeff(NULL), - rho1d_6(NULL), rho_coeff_6(NULL), drho1d_6(NULL), drho_coeff_6(NULL), work1(NULL), - work2(NULL), work1_6(NULL), work2_6(NULL), fft1(NULL), fft2(NULL), fft1_6(NULL), - fft2_6(NULL), remap(NULL), remap_6(NULL), gc(NULL), gc6(NULL), - part2grid(NULL), part2grid_6(NULL), boxlo(NULL) + factors(nullptr), csumi(nullptr), cii(nullptr), B(nullptr), density_brick(nullptr), vdx_brick(nullptr), + vdy_brick(nullptr), vdz_brick(nullptr), density_fft(nullptr), u_brick(nullptr), v0_brick(nullptr), + v1_brick(nullptr), v2_brick(nullptr), v3_brick(nullptr), v4_brick(nullptr), v5_brick(nullptr), + density_brick_g(nullptr), vdx_brick_g(nullptr), vdy_brick_g(nullptr), vdz_brick_g(nullptr), + density_fft_g(nullptr), u_brick_g(nullptr), v0_brick_g(nullptr), v1_brick_g(nullptr), v2_brick_g(nullptr), + v3_brick_g(nullptr), v4_brick_g(nullptr), v5_brick_g(nullptr), density_brick_a0(nullptr), + vdx_brick_a0(nullptr), vdy_brick_a0(nullptr), vdz_brick_a0(nullptr), density_fft_a0(nullptr), + u_brick_a0(nullptr), v0_brick_a0(nullptr), v1_brick_a0(nullptr), v2_brick_a0(nullptr), + v3_brick_a0(nullptr), v4_brick_a0(nullptr), v5_brick_a0(nullptr), density_brick_a1(nullptr), + vdx_brick_a1(nullptr), vdy_brick_a1(nullptr), vdz_brick_a1(nullptr), density_fft_a1(nullptr), + u_brick_a1(nullptr), v0_brick_a1(nullptr), v1_brick_a1(nullptr), v2_brick_a1(nullptr), + v3_brick_a1(nullptr), v4_brick_a1(nullptr), v5_brick_a1(nullptr), density_brick_a2(nullptr), + vdx_brick_a2(nullptr), vdy_brick_a2(nullptr), vdz_brick_a2(nullptr), density_fft_a2(nullptr), + u_brick_a2(nullptr), v0_brick_a2(nullptr), v1_brick_a2(nullptr), v2_brick_a2(nullptr), + v3_brick_a2(nullptr), v4_brick_a2(nullptr), v5_brick_a2(nullptr), density_brick_a3(nullptr), + vdx_brick_a3(nullptr), vdy_brick_a3(nullptr), vdz_brick_a3(nullptr), density_fft_a3(nullptr), + u_brick_a3(nullptr), v0_brick_a3(nullptr), v1_brick_a3(nullptr), v2_brick_a3(nullptr), + v3_brick_a3(nullptr), v4_brick_a3(nullptr), v5_brick_a3(nullptr), density_brick_a4(nullptr), + vdx_brick_a4(nullptr), vdy_brick_a4(nullptr), vdz_brick_a4(nullptr), density_fft_a4(nullptr), + u_brick_a4(nullptr), v0_brick_a4(nullptr), v1_brick_a4(nullptr), v2_brick_a4(nullptr), + v3_brick_a4(nullptr), v4_brick_a4(nullptr), v5_brick_a4(nullptr), density_brick_a5(nullptr), + vdx_brick_a5(nullptr), vdy_brick_a5(nullptr), vdz_brick_a5(nullptr), density_fft_a5(nullptr), + u_brick_a5(nullptr), v0_brick_a5(nullptr), v1_brick_a5(nullptr), v2_brick_a5(nullptr), + v3_brick_a5(nullptr), v4_brick_a5(nullptr), v5_brick_a5(nullptr), density_brick_a6(nullptr), + vdx_brick_a6(nullptr), vdy_brick_a6(nullptr), vdz_brick_a6(nullptr), density_fft_a6(nullptr), + u_brick_a6(nullptr), v0_brick_a6(nullptr), v1_brick_a6(nullptr), v2_brick_a6(nullptr), + v3_brick_a6(nullptr), v4_brick_a6(nullptr), v5_brick_a6(nullptr), density_brick_none(nullptr), + vdx_brick_none(nullptr), vdy_brick_none(nullptr), vdz_brick_none(nullptr), + density_fft_none(nullptr), u_brick_none(nullptr), v0_brick_none(nullptr), v1_brick_none(nullptr), + v2_brick_none(nullptr), v3_brick_none(nullptr), v4_brick_none(nullptr), v5_brick_none(nullptr), + greensfn(nullptr), vg(nullptr), vg2(nullptr), greensfn_6(nullptr), vg_6(nullptr), vg2_6(nullptr), + fkx(nullptr), fky(nullptr), fkz(nullptr), fkx2(nullptr), fky2(nullptr), fkz2(nullptr), fkx_6(nullptr), + fky_6(nullptr), fkz_6(nullptr), fkx2_6(nullptr), fky2_6(nullptr), fkz2_6(nullptr), gf_b(nullptr), + gf_b_6(nullptr), sf_precoeff1(nullptr), sf_precoeff2(nullptr), sf_precoeff3(nullptr), + sf_precoeff4(nullptr), sf_precoeff5(nullptr), sf_precoeff6(nullptr), sf_precoeff1_6(nullptr), + sf_precoeff2_6(nullptr), sf_precoeff3_6(nullptr), sf_precoeff4_6(nullptr), sf_precoeff5_6(nullptr), + sf_precoeff6_6(nullptr), rho1d(nullptr), rho_coeff(nullptr), drho1d(nullptr), drho_coeff(nullptr), + rho1d_6(nullptr), rho_coeff_6(nullptr), drho1d_6(nullptr), drho_coeff_6(nullptr), work1(nullptr), + work2(nullptr), work1_6(nullptr), work2_6(nullptr), fft1(nullptr), fft2(nullptr), fft1_6(nullptr), + fft2_6(nullptr), remap(nullptr), remap_6(nullptr), gc(nullptr), gc6(nullptr), + part2grid(nullptr), part2grid_6(nullptr), boxlo(nullptr) { triclinic_support = 0; pppmflag = dispersionflag = 1; @@ -125,98 +125,98 @@ PPPMDisp::PPPMDisp(LAMMPS *lmp) : KSpace(lmp), nzhi_in_6 = nzlo_in_6 = nzhi_out_6 = nzlo_out_6 = 0; csumflag = 0; - B = NULL; - cii = NULL; - csumi = NULL; + B = nullptr; + cii = nullptr; + csumi = nullptr; peratom_allocate_flag = 0; - density_brick = vdx_brick = vdy_brick = vdz_brick = NULL; - density_fft = NULL; + density_brick = vdx_brick = vdy_brick = vdz_brick = nullptr; + density_fft = nullptr; u_brick = v0_brick = v1_brick = v2_brick = v3_brick = - v4_brick = v5_brick = NULL; + v4_brick = v5_brick = nullptr; - density_brick_g = vdx_brick_g = vdy_brick_g = vdz_brick_g = NULL; - density_fft_g = NULL; + density_brick_g = vdx_brick_g = vdy_brick_g = vdz_brick_g = nullptr; + density_fft_g = nullptr; u_brick_g = v0_brick_g = v1_brick_g = v2_brick_g = v3_brick_g = - v4_brick_g = v5_brick_g = NULL; + v4_brick_g = v5_brick_g = nullptr; - density_brick_a0 = vdx_brick_a0 = vdy_brick_a0 = vdz_brick_a0 = NULL; - density_fft_a0 = NULL; + density_brick_a0 = vdx_brick_a0 = vdy_brick_a0 = vdz_brick_a0 = nullptr; + density_fft_a0 = nullptr; u_brick_a0 = v0_brick_a0 = v1_brick_a0 = v2_brick_a0 = v3_brick_a0 = - v4_brick_a0 = v5_brick_a0 = NULL; + v4_brick_a0 = v5_brick_a0 = nullptr; - density_brick_a1 = vdx_brick_a1 = vdy_brick_a1 = vdz_brick_a1 = NULL; - density_fft_a1 = NULL; + density_brick_a1 = vdx_brick_a1 = vdy_brick_a1 = vdz_brick_a1 = nullptr; + density_fft_a1 = nullptr; u_brick_a1 = v0_brick_a1 = v1_brick_a1 = v2_brick_a1 = v3_brick_a1 = - v4_brick_a1 = v5_brick_a1 = NULL; + v4_brick_a1 = v5_brick_a1 = nullptr; - density_brick_a2 = vdx_brick_a2 = vdy_brick_a2 = vdz_brick_a2 = NULL; - density_fft_a2 = NULL; + density_brick_a2 = vdx_brick_a2 = vdy_brick_a2 = vdz_brick_a2 = nullptr; + density_fft_a2 = nullptr; u_brick_a2 = v0_brick_a2 = v1_brick_a2 = v2_brick_a2 = v3_brick_a2 = - v4_brick_a2 = v5_brick_a2 = NULL; + v4_brick_a2 = v5_brick_a2 = nullptr; - density_brick_a3 = vdx_brick_a3 = vdy_brick_a3 = vdz_brick_a3 = NULL; - density_fft_a3 = NULL; + density_brick_a3 = vdx_brick_a3 = vdy_brick_a3 = vdz_brick_a3 = nullptr; + density_fft_a3 = nullptr; u_brick_a3 = v0_brick_a3 = v1_brick_a3 = v2_brick_a3 = v3_brick_a3 = - v4_brick_a3 = v5_brick_a3 = NULL; + v4_brick_a3 = v5_brick_a3 = nullptr; - density_brick_a4 = vdx_brick_a4 = vdy_brick_a4 = vdz_brick_a4 = NULL; - density_fft_a4 = NULL; + density_brick_a4 = vdx_brick_a4 = vdy_brick_a4 = vdz_brick_a4 = nullptr; + density_fft_a4 = nullptr; u_brick_a4 = v0_brick_a4 = v1_brick_a4 = v2_brick_a4 = v3_brick_a4 = - v4_brick_a4 = v5_brick_a4 = NULL; + v4_brick_a4 = v5_brick_a4 = nullptr; - density_brick_a5 = vdx_brick_a5 = vdy_brick_a5 = vdz_brick_a5 = NULL; - density_fft_a5 = NULL; + density_brick_a5 = vdx_brick_a5 = vdy_brick_a5 = vdz_brick_a5 = nullptr; + density_fft_a5 = nullptr; u_brick_a5 = v0_brick_a5 = v1_brick_a5 = v2_brick_a5 = v3_brick_a5 = - v4_brick_a5 = v5_brick_a5 = NULL; + v4_brick_a5 = v5_brick_a5 = nullptr; - density_brick_a6 = vdx_brick_a6 = vdy_brick_a6 = vdz_brick_a6 = NULL; - density_fft_a6 = NULL; + density_brick_a6 = vdx_brick_a6 = vdy_brick_a6 = vdz_brick_a6 = nullptr; + density_fft_a6 = nullptr; u_brick_a6 = v0_brick_a6 = v1_brick_a6 = v2_brick_a6 = v3_brick_a6 = - v4_brick_a6 = v5_brick_a6 = NULL; + v4_brick_a6 = v5_brick_a6 = nullptr; - density_brick_none = vdx_brick_none = vdy_brick_none = vdz_brick_none = NULL; - density_fft_none = NULL; + density_brick_none = vdx_brick_none = vdy_brick_none = vdz_brick_none = nullptr; + density_fft_none = nullptr; u_brick_none = v0_brick_none = v1_brick_none = v2_brick_none = v3_brick_none = - v4_brick_none = v5_brick_none = NULL; - - greensfn = NULL; - greensfn_6 = NULL; - work1 = work2 = NULL; - work1_6 = work2_6 = NULL; - vg = NULL; - vg2 = NULL; - vg_6 = NULL; - vg2_6 = NULL; - fkx = fky = fkz = NULL; - fkx2 = fky2 = fkz2 = NULL; - fkx_6 = fky_6 = fkz_6 = NULL; - fkx2_6 = fky2_6 = fkz2_6 = NULL; + v4_brick_none = v5_brick_none = nullptr; + + greensfn = nullptr; + greensfn_6 = nullptr; + work1 = work2 = nullptr; + work1_6 = work2_6 = nullptr; + vg = nullptr; + vg2 = nullptr; + vg_6 = nullptr; + vg2_6 = nullptr; + fkx = fky = fkz = nullptr; + fkx2 = fky2 = fkz2 = nullptr; + fkx_6 = fky_6 = fkz_6 = nullptr; + fkx2_6 = fky2_6 = fkz2_6 = nullptr; sf_precoeff1 = sf_precoeff2 = sf_precoeff3 = sf_precoeff4 = - sf_precoeff5 = sf_precoeff6 = NULL; + sf_precoeff5 = sf_precoeff6 = nullptr; sf_precoeff1_6 = sf_precoeff2_6 = sf_precoeff3_6 = sf_precoeff4_6 = - sf_precoeff5_6 = sf_precoeff6_6 = NULL; - - gf_b = NULL; - gf_b_6 = NULL; - rho1d = rho_coeff = NULL; - drho1d = drho_coeff = NULL; - rho1d_6 = rho_coeff_6 = NULL; - drho1d_6 = drho_coeff_6 = NULL; - fft1 = fft2 = NULL; - fft1_6 = fft2_6 = NULL; - remap = NULL; - remap_6 = NULL; - gc = gc6 = NULL; - gc_buf1 = gc_buf2 = NULL; - gc6_buf1 = gc6_buf2 = NULL; + sf_precoeff5_6 = sf_precoeff6_6 = nullptr; + + gf_b = nullptr; + gf_b_6 = nullptr; + rho1d = rho_coeff = nullptr; + drho1d = drho_coeff = nullptr; + rho1d_6 = rho_coeff_6 = nullptr; + drho1d_6 = drho_coeff_6 = nullptr; + fft1 = fft2 = nullptr; + fft1_6 = fft2_6 = nullptr; + remap = nullptr; + remap_6 = nullptr; + gc = gc6 = nullptr; + gc_buf1 = gc_buf2 = nullptr; + gc6_buf1 = gc6_buf2 = nullptr; ngc_buf1 = ngc_buf2 = ngc6_buf1 = ngc6_buf2 = 0; ngrid = ngrid_6 = npergrid = npergrid6 = 0; nmax = 0; - part2grid = NULL; - part2grid_6 = NULL; + part2grid = nullptr; + part2grid_6 = nullptr; memset(function,0,EWALD_FUNCS*sizeof(int)); } @@ -237,16 +237,16 @@ PPPMDisp::~PPPMDisp() { delete [] factors; delete [] B; - B = NULL; + B = nullptr; delete [] cii; - cii = NULL; + cii = nullptr; delete [] csumi; - csumi = NULL; + csumi = nullptr; deallocate(); deallocate_peratom(); memory->destroy(part2grid); memory->destroy(part2grid_6); - part2grid = part2grid_6 = NULL; + part2grid = part2grid_6 = nullptr; } /* ---------------------------------------------------------------------- @@ -295,9 +295,9 @@ void PPPMDisp::init() int tmp; Pair *pair = force->pair; - int *ptr = pair ? (int *) pair->extract("ewald_order",tmp) : NULL; - double *p_cutoff = pair ? (double *) pair->extract("cut_coul",tmp) : NULL; - double *p_cutoff_lj = pair ? (double *) pair->extract("cut_LJ",tmp) : NULL; + int *ptr = pair ? (int *) pair->extract("ewald_order",tmp) : nullptr; + double *p_cutoff = pair ? (double *) pair->extract("cut_coul",tmp) : nullptr; + double *p_cutoff_lj = pair ? (double *) pair->extract("cut_LJ",tmp) : nullptr; if (!(ptr||p_cutoff||p_cutoff_lj)) error->all(FLERR,"KSpace style is incompatible with Pair style"); cutoff = *p_cutoff; @@ -377,7 +377,7 @@ void PPPMDisp::init() int typeA = *p_typeA; int typeB = *p_typeB; - if (force->angle == NULL || force->bond == NULL) + if (force->angle == nullptr || force->bond == nullptr) error->all(FLERR,"Bond and angle potentials must be defined for TIP4P"); if (typeA < 1 || typeA > atom->nangletypes || force->angle->setflag[typeA] == 0) @@ -411,7 +411,7 @@ void PPPMDisp::init() int iteration = 0; if (function[0]) { - GridComm *gctmp = NULL; + GridComm *gctmp = nullptr; while (order >= minorder) { if (iteration && me == 0) @@ -492,7 +492,7 @@ void PPPMDisp::init() iteration = 0; if (function[1] + function[2] + function[3]) { - GridComm *gctmp = NULL; + GridComm *gctmp = nullptr; while (order_6 >= minorder) { if (iteration && me == 0) @@ -1281,14 +1281,14 @@ void PPPMDisp::init_coeffs() // local pair coeffs int n = atom->ntypes; int converged; delete [] B; - B = NULL; + B = nullptr; if (function[3] + function[2]) { // no mixing rule or arithmetic if (function[2] && me == 0) utils::logmesg(lmp," Optimizing splitting of Dispersion coefficients\n"); // allocate data for eigenvalue decomposition - double **A=NULL; - double **Q=NULL; + double **A=nullptr; + double **Q=nullptr; if ( n > 1 ) { // get dispersion coefficients double **b = (double **) force->pair->extract("B",tmp); @@ -2299,80 +2299,80 @@ void PPPMDisp::deallocate() memory->destroy3d_offset(vdy_brick,nzlo_out,nylo_out,nxlo_out); memory->destroy3d_offset(vdz_brick,nzlo_out,nylo_out,nxlo_out); memory->destroy(density_fft); - density_brick = vdx_brick = vdy_brick = vdz_brick = NULL; - density_fft = NULL; + density_brick = vdx_brick = vdy_brick = vdz_brick = nullptr; + density_fft = nullptr; memory->destroy3d_offset(density_brick_g,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_g,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_g,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_g,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_g); - density_brick_g = vdx_brick_g = vdy_brick_g = vdz_brick_g = NULL; - density_fft_g = NULL; + density_brick_g = vdx_brick_g = vdy_brick_g = vdz_brick_g = nullptr; + density_fft_g = nullptr; memory->destroy3d_offset(density_brick_a0,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a0,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a0,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a0,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a0); - density_brick_a0 = vdx_brick_a0 = vdy_brick_a0 = vdz_brick_a0 = NULL; - density_fft_a0 = NULL; + density_brick_a0 = vdx_brick_a0 = vdy_brick_a0 = vdz_brick_a0 = nullptr; + density_fft_a0 = nullptr; memory->destroy3d_offset(density_brick_a1,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a1,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a1,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a1,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a1); - density_brick_a1 = vdx_brick_a1 = vdy_brick_a1 = vdz_brick_a1 = NULL; - density_fft_a1 = NULL; + density_brick_a1 = vdx_brick_a1 = vdy_brick_a1 = vdz_brick_a1 = nullptr; + density_fft_a1 = nullptr; memory->destroy3d_offset(density_brick_a2,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a2,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a2,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a2,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a2); - density_brick_a2 = vdx_brick_a2 = vdy_brick_a2 = vdz_brick_a2 = NULL; - density_fft_a2 = NULL; + density_brick_a2 = vdx_brick_a2 = vdy_brick_a2 = vdz_brick_a2 = nullptr; + density_fft_a2 = nullptr; memory->destroy3d_offset(density_brick_a3,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a3,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a3,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a3,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a3); - density_brick_a3 = vdx_brick_a3 = vdy_brick_a3 = vdz_brick_a3 = NULL; - density_fft_a3 = NULL; + density_brick_a3 = vdx_brick_a3 = vdy_brick_a3 = vdz_brick_a3 = nullptr; + density_fft_a3 = nullptr; memory->destroy3d_offset(density_brick_a4,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a4,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a4,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a4,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a4); - density_brick_a4 = vdx_brick_a4 = vdy_brick_a4 = vdz_brick_a4 = NULL; - density_fft_a4 = NULL; + density_brick_a4 = vdx_brick_a4 = vdy_brick_a4 = vdz_brick_a4 = nullptr; + density_fft_a4 = nullptr; memory->destroy3d_offset(density_brick_a5,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a5,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a5,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a5,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a5); - density_brick_a5 = vdx_brick_a5 = vdy_brick_a5 = vdz_brick_a5 = NULL; - density_fft_a5 = NULL; + density_brick_a5 = vdx_brick_a5 = vdy_brick_a5 = vdz_brick_a5 = nullptr; + density_fft_a5 = nullptr; memory->destroy3d_offset(density_brick_a6,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdx_brick_a6,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdy_brick_a6,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy3d_offset(vdz_brick_a6,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_a6); - density_brick_a6 = vdx_brick_a6 = vdy_brick_a6 = vdz_brick_a6 = NULL; - density_fft_a6 = NULL; + density_brick_a6 = vdx_brick_a6 = vdy_brick_a6 = vdz_brick_a6 = nullptr; + density_fft_a6 = nullptr; memory->destroy4d_offset(density_brick_none,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy4d_offset(vdx_brick_none,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy4d_offset(vdy_brick_none,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy4d_offset(vdz_brick_none,nzlo_out_6,nylo_out_6,nxlo_out_6); memory->destroy(density_fft_none); - density_brick_none = vdx_brick_none = vdy_brick_none = vdz_brick_none = NULL; - density_fft_none = NULL; + density_brick_none = vdx_brick_none = vdy_brick_none = vdz_brick_none = nullptr; + density_fft_none = nullptr; memory->destroy(sf_precoeff1); memory->destroy(sf_precoeff2); @@ -2381,7 +2381,7 @@ void PPPMDisp::deallocate() memory->destroy(sf_precoeff5); memory->destroy(sf_precoeff6); sf_precoeff1 = sf_precoeff2 = sf_precoeff3 = - sf_precoeff4 = sf_precoeff5 = sf_precoeff6 = NULL; + sf_precoeff4 = sf_precoeff5 = sf_precoeff6 = nullptr; memory->destroy(sf_precoeff1_6); memory->destroy(sf_precoeff2_6); @@ -2390,7 +2390,7 @@ void PPPMDisp::deallocate() memory->destroy(sf_precoeff5_6); memory->destroy(sf_precoeff6_6); sf_precoeff1_6 = sf_precoeff2_6 = sf_precoeff3_6 = - sf_precoeff4_6 = sf_precoeff5_6 = sf_precoeff6_6 = NULL; + sf_precoeff4_6 = sf_precoeff5_6 = sf_precoeff6_6 = nullptr; memory->destroy(greensfn); memory->destroy(greensfn_6); @@ -2402,45 +2402,45 @@ void PPPMDisp::deallocate() memory->destroy(vg2); memory->destroy(vg_6); memory->destroy(vg2_6); - greensfn = greensfn_6 = NULL; - work1 = work2 = work1_6 = work2_6 = NULL; - vg = vg2 = vg_6 = vg2_6 = NULL; + greensfn = greensfn_6 = nullptr; + work1 = work2 = work1_6 = work2_6 = nullptr; + vg = vg2 = vg_6 = vg2_6 = nullptr; memory->destroy1d_offset(fkx,nxlo_fft); memory->destroy1d_offset(fky,nylo_fft); memory->destroy1d_offset(fkz,nzlo_fft); - fkx = fky = fkz = NULL; + fkx = fky = fkz = nullptr; memory->destroy1d_offset(fkx2,nxlo_fft); memory->destroy1d_offset(fky2,nylo_fft); memory->destroy1d_offset(fkz2,nzlo_fft); - fkx2 = fky2 = fkz2 = NULL; + fkx2 = fky2 = fkz2 = nullptr; memory->destroy1d_offset(fkx_6,nxlo_fft_6); memory->destroy1d_offset(fky_6,nylo_fft_6); memory->destroy1d_offset(fkz_6,nzlo_fft_6); - fkx_6 = fky_6 = fkz_6 = NULL; + fkx_6 = fky_6 = fkz_6 = nullptr; memory->destroy1d_offset(fkx2_6,nxlo_fft_6); memory->destroy1d_offset(fky2_6,nylo_fft_6); memory->destroy1d_offset(fkz2_6,nzlo_fft_6); - fkx2_6 = fky2_6 = fkz2_6 = NULL; + fkx2_6 = fky2_6 = fkz2_6 = nullptr; memory->destroy(gf_b); memory->destroy2d_offset(rho1d,-order/2); memory->destroy2d_offset(rho_coeff,(1-order)/2); memory->destroy2d_offset(drho1d,-order/2); memory->destroy2d_offset(drho_coeff, (1-order)/2); - gf_b = NULL; - rho1d = rho_coeff = drho1d = drho_coeff = NULL; + gf_b = nullptr; + rho1d = rho_coeff = drho1d = drho_coeff = nullptr; memory->destroy(gf_b_6); memory->destroy2d_offset(rho1d_6,-order_6/2); memory->destroy2d_offset(rho_coeff_6,(1-order_6)/2); memory->destroy2d_offset(drho1d_6,-order_6/2); memory->destroy2d_offset(drho_coeff_6,(1-order_6)/2); - gf_b_6 = NULL; - rho1d_6 = rho_coeff_6 = drho1d_6 = drho_coeff_6 = NULL; + gf_b_6 = nullptr; + rho1d_6 = rho_coeff_6 = drho1d_6 = drho_coeff_6 = nullptr; memory->destroy(gc_buf1); memory->destroy(gc_buf2); @@ -2474,7 +2474,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick, nzlo_out, nylo_out, nxlo_out); memory->destroy3d_offset(v5_brick, nzlo_out, nylo_out, nxlo_out); u_brick = v0_brick = v1_brick = v2_brick = - v3_brick = v4_brick = v5_brick = NULL; + v3_brick = v4_brick = v5_brick = nullptr; memory->destroy3d_offset(u_brick_g, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_g, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2484,7 +2484,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick_g, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_g, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_g = v0_brick_g = v1_brick_g = v2_brick_g = - v3_brick_g = v4_brick_g = v5_brick_g = NULL; + v3_brick_g = v4_brick_g = v5_brick_g = nullptr; memory->destroy3d_offset(u_brick_a0, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a0, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2494,7 +2494,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick_a0, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a0, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_a0 = v0_brick_a0 = v1_brick_a0 = v2_brick_a0 = - v3_brick_a0 = v4_brick_a0 = v5_brick_a0 = NULL; + v3_brick_a0 = v4_brick_a0 = v5_brick_a0 = nullptr; memory->destroy3d_offset(u_brick_a1, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a1, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2504,7 +2504,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick_a1, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a1, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_a1 = v0_brick_a1 = v1_brick_a1 = v2_brick_a1 = - v3_brick_a1 = v4_brick_a1 = v5_brick_a1 = NULL; + v3_brick_a1 = v4_brick_a1 = v5_brick_a1 = nullptr; memory->destroy3d_offset(u_brick_a2, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a2, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2513,7 +2513,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v3_brick_a2, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v4_brick_a2, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a2, nzlo_out_6, nylo_out_6, nxlo_out_6); - u_brick_a2 = v0_brick_a2 = v1_brick_a2 = v2_brick_a2 = v3_brick_a2 = v4_brick_a2 = v5_brick_a2 = NULL; + u_brick_a2 = v0_brick_a2 = v1_brick_a2 = v2_brick_a2 = v3_brick_a2 = v4_brick_a2 = v5_brick_a2 = nullptr; memory->destroy3d_offset(u_brick_a3, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a3, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2522,7 +2522,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v3_brick_a3, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v4_brick_a3, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a3, nzlo_out_6, nylo_out_6, nxlo_out_6); - u_brick_a3 = v0_brick_a3 = v1_brick_a3 = v2_brick_a3 = v3_brick_a3 = v4_brick_a3 = v5_brick_a3 = NULL; + u_brick_a3 = v0_brick_a3 = v1_brick_a3 = v2_brick_a3 = v3_brick_a3 = v4_brick_a3 = v5_brick_a3 = nullptr; memory->destroy3d_offset(u_brick_a4, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a4, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2532,7 +2532,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick_a4, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a4, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_a4 = v0_brick_a4 = v1_brick_a4 = v2_brick_a4 = - v3_brick_a4 = v4_brick_a4 = v5_brick_a4 = NULL; + v3_brick_a4 = v4_brick_a4 = v5_brick_a4 = nullptr; memory->destroy3d_offset(u_brick_a5, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a5, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2542,7 +2542,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick_a5, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a5, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_a5 = v0_brick_a5 = v1_brick_a5 = v2_brick_a5 = - v3_brick_a5 = v4_brick_a5 = v5_brick_a5 = NULL; + v3_brick_a5 = v4_brick_a5 = v5_brick_a5 = nullptr; memory->destroy3d_offset(u_brick_a6, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v0_brick_a6, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2552,7 +2552,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy3d_offset(v4_brick_a6, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy3d_offset(v5_brick_a6, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_a6 = v0_brick_a6 = v1_brick_a6 = v2_brick_a6 = - v3_brick_a6 = v4_brick_a6 = v5_brick_a6 = NULL; + v3_brick_a6 = v4_brick_a6 = v5_brick_a6 = nullptr; memory->destroy4d_offset(u_brick_none, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy4d_offset(v0_brick_none, nzlo_out_6, nylo_out_6, nxlo_out_6); @@ -2562,7 +2562,7 @@ void PPPMDisp::deallocate_peratom() memory->destroy4d_offset(v4_brick_none, nzlo_out_6, nylo_out_6, nxlo_out_6); memory->destroy4d_offset(v5_brick_none, nzlo_out_6, nylo_out_6, nxlo_out_6); u_brick_none = v0_brick_none = v1_brick_none = v2_brick_none = - v3_brick_none = v4_brick_none = v5_brick_none = NULL; + v3_brick_none = v4_brick_none = v5_brick_none = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/KSPACE/pppm_stagger.cpp b/src/KSPACE/pppm_stagger.cpp index f71529ae839006e270f5b0ed4a45a160308953b4..afdc97e3748d71b6e7347bcf2153e5297dc8750b 100644 --- a/src/KSPACE/pppm_stagger.cpp +++ b/src/KSPACE/pppm_stagger.cpp @@ -50,7 +50,7 @@ enum{FORWARD_IK,FORWARD_AD,FORWARD_IK_PERATOM,FORWARD_AD_PERATOM}; PPPMStagger::PPPMStagger(LAMMPS *lmp) : PPPM(lmp), - gf_b2(NULL) + gf_b2(nullptr) { stagger_flag = 1; group_group_enable = 0; diff --git a/src/KSPACE/remap.cpp b/src/KSPACE/remap.cpp index d4cfdea2b0a21330f67eaee9f6bf77059286cb20..41ba1a67825713029229ce223399d5248cc2a5ea 100644 --- a/src/KSPACE/remap.cpp +++ b/src/KSPACE/remap.cpp @@ -252,7 +252,7 @@ struct remap_plan_3d *remap_3d_create_plan( // allocate memory for plan data struct plan = (struct remap_plan_3d *) malloc(sizeof(struct remap_plan_3d)); - if (plan == NULL) return NULL; + if (plan == nullptr) return nullptr; plan->usecollective = usecollective; // store parameters in local data structs @@ -284,10 +284,10 @@ struct remap_plan_3d *remap_3d_create_plan( // combine output extents across all procs inarray = (struct extent_3d *) malloc(nprocs*sizeof(struct extent_3d)); - if (inarray == NULL) return NULL; + if (inarray == nullptr) return nullptr; outarray = (struct extent_3d *) malloc(nprocs*sizeof(struct extent_3d)); - if (outarray == NULL) return NULL; + if (outarray == nullptr) return nullptr; MPI_Allgather(&out,sizeof(struct extent_3d),MPI_BYTE, outarray,sizeof(struct extent_3d),MPI_BYTE,comm); @@ -313,8 +313,8 @@ struct remap_plan_3d *remap_3d_create_plan( plan->packplan = (struct pack_plan_3d *) malloc(nsend*sizeof(struct pack_plan_3d)); - if (plan->send_offset == NULL || plan->send_size == NULL || - plan->send_proc == NULL || plan->packplan == NULL) return NULL; + if (plan->send_offset == nullptr || plan->send_size == nullptr || + plan->send_proc == nullptr || plan->packplan == nullptr) return nullptr; } // store send info, with self as last entry @@ -395,9 +395,9 @@ struct remap_plan_3d *remap_3d_create_plan( plan->unpackplan = (struct pack_plan_3d *) malloc(nrecv*sizeof(struct pack_plan_3d)); - if (plan->recv_offset == NULL || plan->recv_size == NULL || - plan->recv_proc == NULL || plan->recv_bufloc == NULL || - plan->request == NULL || plan->unpackplan == NULL) return NULL; + if (plan->recv_offset == nullptr || plan->recv_size == nullptr || + plan->recv_proc == nullptr || plan->recv_bufloc == nullptr || + plan->request == nullptr || plan->unpackplan == nullptr) return nullptr; } // store recv info, with self as last entry @@ -456,7 +456,7 @@ struct remap_plan_3d *remap_3d_create_plan( // create sub-comm rank list if (plan->usecollective) { - plan->commringlist = NULL; + plan->commringlist = nullptr; // merge recv and send rank lists // ask Steve Plimpton about method to more accurately determine @@ -578,7 +578,7 @@ struct remap_plan_3d *remap_3d_create_plan( // find biggest send message (not including self) and malloc space for it - plan->sendbuf = NULL; + plan->sendbuf = nullptr; size = 0; for (nsend = 0; nsend < plan->nsend; nsend++) @@ -586,20 +586,20 @@ struct remap_plan_3d *remap_3d_create_plan( if (size) { plan->sendbuf = (FFT_SCALAR *) malloc(size*sizeof(FFT_SCALAR)); - if (plan->sendbuf == NULL) return NULL; + if (plan->sendbuf == nullptr) return nullptr; } // if requested, allocate internal scratch space for recvs, // only need it if I will receive any data (including self) - plan->scratch = NULL; + plan->scratch = nullptr; if (memory == 1) { if (nrecv > 0) { plan->scratch = (FFT_SCALAR *) malloc(nqty*out.isize*out.jsize*out.ksize * sizeof(FFT_SCALAR)); - if (plan->scratch == NULL) return NULL; + if (plan->scratch == nullptr) return nullptr; } } @@ -643,7 +643,7 @@ void remap_3d_destroy_plan(struct remap_plan_3d *plan) MPI_Comm_free(&plan->comm); if (plan->usecollective) { - if (plan->commringlist != NULL) + if (plan->commringlist != nullptr) free(plan->commringlist); } diff --git a/src/KSPACE/remap_wrap.cpp b/src/KSPACE/remap_wrap.cpp index 4aaaa1329ed8396c55fbce4ccbf2b0b8c60368ee..de85339474532ae9086ec365a46c09d553a52199 100644 --- a/src/KSPACE/remap_wrap.cpp +++ b/src/KSPACE/remap_wrap.cpp @@ -31,7 +31,7 @@ Remap::Remap(LAMMPS *lmp, MPI_Comm comm, in_ilo,in_ihi,in_jlo,in_jhi,in_klo,in_khi, out_ilo,out_ihi,out_jlo,out_jhi,out_klo,out_khi, nqty,permute,memory,precision,usecollective); - if (plan == NULL) error->one(FLERR,"Could not create 3d remap plan"); + if (plan == nullptr) error->one(FLERR,"Could not create 3d remap plan"); } /* ---------------------------------------------------------------------- */ diff --git a/src/LATTE/fix_latte.cpp b/src/LATTE/fix_latte.cpp index 7d4e89272d22eeb87afb856352f2470477d2d2c1..055e62c418ea6257e2b2709ab9811220819331f4 100644 --- a/src/LATTE/fix_latte.cpp +++ b/src/LATTE/fix_latte.cpp @@ -74,10 +74,10 @@ FixLatte::FixLatte(LAMMPS *lmp, int narg, char **arg) : thermo_virial = 1; // store ID of compute pe/atom used to generate Coulomb potential for LATTE - // NULL means LATTE will compute Coulombic potential + // null pointer means LATTE will compute Coulombic potential coulomb = 0; - id_pe = NULL; + id_pe = nullptr; if (strcmp(arg[3],"NULL") != 0) { coulomb = 1; @@ -97,8 +97,8 @@ FixLatte::FixLatte(LAMMPS *lmp, int narg, char **arg) : // initializations nmax = 0; - qpotential = NULL; - flatte = NULL; + qpotential = nullptr; + flatte = nullptr; latte_energy = 0.0; } @@ -136,7 +136,7 @@ void FixLatte::init() error->all(FLERR,"Fix latte requires 3d problem"); if (coulomb) { - if (atom->q_flag == 0 || force->pair == NULL || force->kspace == NULL) + if (atom->q_flag == 0 || force->pair == nullptr || force->kspace == nullptr) error->all(FLERR,"Fix latte cannot compute Coulomb potential"); int ipe = modify->find_compute(id_pe); @@ -154,7 +154,7 @@ void FixLatte::init() // create qpotential & flatte if needed // for now, assume nlocal will never change - if (coulomb && qpotential == NULL) { + if (coulomb && qpotential == nullptr) { memory->create(qpotential,atom->nlocal,"latte:qpotential"); memory->create(flatte,atom->nlocal,3,"latte:flatte"); } diff --git a/src/MANYBODY/fix_qeq_comb.cpp b/src/MANYBODY/fix_qeq_comb.cpp index 54169d08d71c92677429e07a9848d3bdf15693c4..bddec9e2ecb78fa274fba7a5ac4fd85ec2d4526a 100644 --- a/src/MANYBODY/fix_qeq_comb.cpp +++ b/src/MANYBODY/fix_qeq_comb.cpp @@ -39,7 +39,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixQEQComb::FixQEQComb(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - fp(NULL), comb(NULL), comb3(NULL), qf(NULL), q1(NULL), q2(NULL) + fp(nullptr), comb(nullptr), comb3(nullptr), qf(nullptr), q1(nullptr), q2(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix qeq/comb command"); @@ -65,7 +65,7 @@ FixQEQComb::FixQEQComb(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), if (iarg+2 > narg) error->all(FLERR,"Illegal fix qeq/comb command"); if (me == 0) { fp = fopen(arg[iarg+1],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,std::string("Cannot open fix qeq/comb file ") + arg[iarg+1]); } @@ -85,8 +85,8 @@ FixQEQComb::FixQEQComb(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) qf[i] = 0.0; - comb = NULL; - comb3 = NULL; + comb = nullptr; + comb3 = nullptr; comm_forward = 1; } @@ -121,7 +121,7 @@ void FixQEQComb::init() comb = (PairComb *) force->pair_match("^comb",0); comb3 = (PairComb3 *) force->pair_match("^comb3",0); - if (comb == NULL && comb3 == NULL) + if (comb == nullptr && comb3 == nullptr) error->all(FLERR,"Must use pair_style comb or comb3 with fix qeq/comb"); if (utils::strmatch(update->integrate_style,"^respa")) { diff --git a/src/MANYBODY/pair_adp.cpp b/src/MANYBODY/pair_adp.cpp index ff30ac7b1e9822f664ed104a6894979304af847a..3b98c91cb89a843a9cfc6cdc3c87eb98617df8e1 100644 --- a/src/MANYBODY/pair_adp.cpp +++ b/src/MANYBODY/pair_adp.cpp @@ -41,25 +41,25 @@ PairADP::PairADP(LAMMPS *lmp) : Pair(lmp) restartinfo = 0; nmax = 0; - rho = NULL; - fp = NULL; - mu = NULL; - lambda = NULL; - map = NULL; - - setfl = NULL; - - frho = NULL; - rhor = NULL; - z2r = NULL; - u2r = NULL; - w2r = NULL; - - frho_spline = NULL; - rhor_spline = NULL; - z2r_spline = NULL; - u2r_spline = NULL; - w2r_spline = NULL; + rho = nullptr; + fp = nullptr; + mu = nullptr; + lambda = nullptr; + map = nullptr; + + setfl = nullptr; + + frho = nullptr; + rhor = nullptr; + z2r = nullptr; + u2r = nullptr; + w2r = nullptr; + + frho_spline = nullptr; + rhor_spline = nullptr; + z2r_spline = nullptr; + u2r_spline = nullptr; + w2r_spline = nullptr; // set comm size needed by this Pair @@ -465,7 +465,7 @@ void PairADP::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_airebo.cpp b/src/MANYBODY/pair_airebo.cpp index 7ab2eaa27b1ef5d948f953e41cdca068fcdf4054..eb92e0c58a497f9574d21b847b1bdd5dc5191f7f 100644 --- a/src/MANYBODY/pair_airebo.cpp +++ b/src/MANYBODY/pair_airebo.cpp @@ -61,13 +61,13 @@ PairAIREBO::PairAIREBO(LAMMPS *lmp) pvector = new double[nextra]; maxlocal = 0; - REBO_numneigh = NULL; - REBO_firstneigh = NULL; - ipage = NULL; + REBO_numneigh = nullptr; + REBO_firstneigh = nullptr; + ipage = nullptr; pgsize = oneatom = 0; - nC = nH = NULL; - map = NULL; + nC = nH = nullptr; + map = nullptr; manybody_flag = 1; sigwid = 0.84; @@ -185,7 +185,7 @@ void PairAIREBO::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to C and H - // map[i] = which element (0,1) the Ith atom type is, -1 if NULL + // map[i] = which element (0,1) the Ith atom type is, -1 if "NULL" for (int i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { @@ -245,7 +245,7 @@ void PairAIREBO::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; diff --git a/src/MANYBODY/pair_airebo.h b/src/MANYBODY/pair_airebo.h index ab02533ceca0875c84933f81aace2bca0f1c978f..7539cc5e7fc833e862336cb47a8736b4476beed8 100644 --- a/src/MANYBODY/pair_airebo.h +++ b/src/MANYBODY/pair_airebo.h @@ -40,7 +40,7 @@ class PairAIREBO : public Pair { enum { AIREBO, REBO_2, AIREBO_M }; // for telling class variants apart in shared code protected: - int *map; // 0 (C), 1 (H), or -1 (NULL) for each type + int *map; // 0 (C), 1 (H), or -1 ("NULL") for each type int variant; int ljflag,torflag; // 0/1 if LJ/Morse,torsion terms included diff --git a/src/MANYBODY/pair_atm.cpp b/src/MANYBODY/pair_atm.cpp index 2a69e70b811f9a4870d0bf1e715c7db4308bf585..a6bf0ac400442dde7ed1249688117e81fb985e5a 100644 --- a/src/MANYBODY/pair_atm.cpp +++ b/src/MANYBODY/pair_atm.cpp @@ -311,10 +311,10 @@ void PairATM::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) for (k = j; k <= atom->ntypes; k++) { - if (me == 0) utils::sfread(FLERR,&nu[i][j][k],sizeof(double),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nu[i][j][k],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&nu[i][j][k],1,MPI_DOUBLE,0,world); } } @@ -339,8 +339,8 @@ void PairATM::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_triple,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_triple,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_triple,1,MPI_DOUBLE,0,world); diff --git a/src/MANYBODY/pair_bop.cpp b/src/MANYBODY/pair_bop.cpp index e7c2f64672b11174c0e63a44c9235352ce7b3a25..4c7d30e457c9fd447e006c7c5046e60bee7b77ed 100644 --- a/src/MANYBODY/pair_bop.cpp +++ b/src/MANYBODY/pair_bop.cpp @@ -64,114 +64,114 @@ PairBOP::PairBOP(LAMMPS *lmp) : Pair(lmp) ghostneigh = 1; allocated = 0; - BOP_index = NULL; - BOP_index3 = NULL; - BOP_total = NULL; - BOP_total3 = NULL; - map = NULL; - pi_a = NULL; - pro_delta = NULL; - pi_delta = NULL; - pi_p = NULL; - pi_c = NULL; - r1 = NULL; - sigma_r0 = NULL; - pi_r0 = NULL; - phi_r0 = NULL; - sigma_rc = NULL; - pi_rc = NULL; - phi_rc = NULL; - sigma_beta0 = NULL; - pi_beta0 = NULL; - phi0 = NULL; - sigma_n = NULL; - pi_n = NULL; - phi_m = NULL; - sigma_nc = NULL; - pi_nc = NULL; - phi_nc = NULL; - pro = NULL; - sigma_delta = NULL; - sigma_c = NULL; - sigma_a = NULL; - sigma_f = NULL; - sigma_k = NULL; - small3 = NULL; - rcut = NULL; - rcut3 = NULL; - rcutsq = NULL; - rcutsq3 = NULL; - dr = NULL; - rdr = NULL; - dr3 = NULL; - rdr3 = NULL; - disij = NULL; - rij = NULL; - neigh_index = NULL; - neigh_index3 = NULL; - neigh_flag = NULL; - neigh_flag3 = NULL; - cosAng = NULL; - betaS = NULL; - dBetaS = NULL; - betaP = NULL; - dBetaP = NULL; - repul = NULL; - dRepul = NULL; - itypeSigBk = NULL; - itypePiBk = NULL; - pBetaS = NULL; - pBetaS1 = NULL; - pBetaS2 = NULL; - pBetaS3 = NULL; - pBetaS4 = NULL; - pBetaS5 = NULL; - pBetaS6 = NULL; - pLong = NULL; - pLong1 = NULL; - pLong2 = NULL; - pLong3 = NULL; - pLong4 = NULL; - pLong5 = NULL; - pLong6 = NULL; - pBetaP = NULL; - pBetaP1 = NULL; - pBetaP2 = NULL; - pBetaP3 = NULL; - pBetaP4 = NULL; - pBetaP5 = NULL; - pBetaP6 = NULL; - pRepul = NULL; - pRepul1 = NULL; - pRepul2 = NULL; - pRepul3 = NULL; - pRepul4 = NULL; - pRepul5 = NULL; - pRepul6 = NULL; - FsigBO = NULL; - FsigBO1 = NULL; - FsigBO2 = NULL; - FsigBO3 = NULL; - FsigBO4 = NULL; - FsigBO5 = NULL; - FsigBO6 = NULL; - rcmin = NULL; - rcmax = NULL; - rcmaxp = NULL; - setflag = NULL; - cutsq = NULL; - cutghost = NULL; - - gfunc = NULL; - gfunc1 = NULL; - gfunc2 = NULL; - gfunc3 = NULL; - gfunc4 = NULL; - gfunc5 = NULL; - gfunc6 = NULL; - gpara = NULL; - bt_sg=NULL; - bt_pi=NULL; + BOP_index = nullptr; + BOP_index3 = nullptr; + BOP_total = nullptr; + BOP_total3 = nullptr; + map = nullptr; + pi_a = nullptr; + pro_delta = nullptr; + pi_delta = nullptr; + pi_p = nullptr; + pi_c = nullptr; + r1 = nullptr; + sigma_r0 = nullptr; + pi_r0 = nullptr; + phi_r0 = nullptr; + sigma_rc = nullptr; + pi_rc = nullptr; + phi_rc = nullptr; + sigma_beta0 = nullptr; + pi_beta0 = nullptr; + phi0 = nullptr; + sigma_n = nullptr; + pi_n = nullptr; + phi_m = nullptr; + sigma_nc = nullptr; + pi_nc = nullptr; + phi_nc = nullptr; + pro = nullptr; + sigma_delta = nullptr; + sigma_c = nullptr; + sigma_a = nullptr; + sigma_f = nullptr; + sigma_k = nullptr; + small3 = nullptr; + rcut = nullptr; + rcut3 = nullptr; + rcutsq = nullptr; + rcutsq3 = nullptr; + dr = nullptr; + rdr = nullptr; + dr3 = nullptr; + rdr3 = nullptr; + disij = nullptr; + rij = nullptr; + neigh_index = nullptr; + neigh_index3 = nullptr; + neigh_flag = nullptr; + neigh_flag3 = nullptr; + cosAng = nullptr; + betaS = nullptr; + dBetaS = nullptr; + betaP = nullptr; + dBetaP = nullptr; + repul = nullptr; + dRepul = nullptr; + itypeSigBk = nullptr; + itypePiBk = nullptr; + pBetaS = nullptr; + pBetaS1 = nullptr; + pBetaS2 = nullptr; + pBetaS3 = nullptr; + pBetaS4 = nullptr; + pBetaS5 = nullptr; + pBetaS6 = nullptr; + pLong = nullptr; + pLong1 = nullptr; + pLong2 = nullptr; + pLong3 = nullptr; + pLong4 = nullptr; + pLong5 = nullptr; + pLong6 = nullptr; + pBetaP = nullptr; + pBetaP1 = nullptr; + pBetaP2 = nullptr; + pBetaP3 = nullptr; + pBetaP4 = nullptr; + pBetaP5 = nullptr; + pBetaP6 = nullptr; + pRepul = nullptr; + pRepul1 = nullptr; + pRepul2 = nullptr; + pRepul3 = nullptr; + pRepul4 = nullptr; + pRepul5 = nullptr; + pRepul6 = nullptr; + FsigBO = nullptr; + FsigBO1 = nullptr; + FsigBO2 = nullptr; + FsigBO3 = nullptr; + FsigBO4 = nullptr; + FsigBO5 = nullptr; + FsigBO6 = nullptr; + rcmin = nullptr; + rcmax = nullptr; + rcmaxp = nullptr; + setflag = nullptr; + cutsq = nullptr; + cutghost = nullptr; + + gfunc = nullptr; + gfunc1 = nullptr; + gfunc2 = nullptr; + gfunc3 = nullptr; + gfunc4 = nullptr; + gfunc5 = nullptr; + gfunc6 = nullptr; + gpara = nullptr; + bt_sg=nullptr; + bt_pi=nullptr; } /* ---------------------------------------------------------------------- @@ -5627,12 +5627,12 @@ void PairBOP::memory_theta_destroy() memory->destroy(neigh_flag3); memory->destroy(neigh_index); memory->destroy(neigh_index3); - itypeSigBk = NULL; - itypePiBk = NULL; - neigh_flag = NULL; - neigh_flag3 = NULL; - neigh_index = NULL; - neigh_index3 = NULL; + itypeSigBk = nullptr; + itypePiBk = nullptr; + neigh_flag = nullptr; + neigh_flag3 = nullptr; + neigh_index = nullptr; + neigh_index3 = nullptr; if(otfly==0) { memory->destroy(cosAng); memory->destroy(dcAng); @@ -5680,7 +5680,7 @@ void PairBOP::grow_pi(int n1, int n2) } } memory->destroy(bt_pi); - bt_pi=NULL; + bt_pi=nullptr; bt_pi = (B_PI *) memory->smalloc(n2*sizeof(B_PI),"BOP:bt_pi"); for(i=0;idestroy(bt_sg); - bt_sg=NULL; + bt_sg=nullptr; bt_sg = (B_SG *) memory->smalloc(n2*sizeof(B_SG),"BOP:bt_sg"); for(i=0;iall(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -465,7 +465,7 @@ void PairComb::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -542,7 +542,7 @@ void PairComb::init_style() //for (i = 0; i < modify->nfix; i++) // if (strcmp(modify->fix[i]->style,"qeq") == 0) break; //if (i < modify->nfix) fixqeq = (FixQEQ *) modify->fix[i]; - //else fixqeq = NULL; + //else fixqeq = nullptr; // need a full neighbor list @@ -554,7 +554,7 @@ void PairComb::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; diff --git a/src/MANYBODY/pair_comb3.cpp b/src/MANYBODY/pair_comb3.cpp index 265d30c6f71df82389a57f01e03ca45df5eb0154..01a1538f7b69642773088318c7fad9958c8f0e00 100644 --- a/src/MANYBODY/pair_comb3.cpp +++ b/src/MANYBODY/pair_comb3.cpp @@ -54,38 +54,38 @@ PairComb3::PairComb3(LAMMPS *lmp) : Pair(lmp) ghostneigh = 1; nmax = 0; - NCo = NULL; - bbij = NULL; - map = NULL; - esm = NULL; + NCo = nullptr; + bbij = nullptr; + map = nullptr; + esm = nullptr; nelements = 0; - elements = NULL; + elements = nullptr; nparams = 0; maxparam = 0; - params = NULL; - elem2param = NULL; - - intype = NULL; - afb = NULL; - dafb = NULL; - fafb = NULL; - dfafb = NULL; - ddfafb = NULL; - phin = NULL; - dphin = NULL; - erpaw = NULL; - vvdw = NULL; - vdvdw = NULL; - dpl = NULL; - xcctmp = NULL; - xchtmp = NULL; - xcotmp = NULL; - - sht_num = NULL; - sht_first = NULL; - - ipage = NULL; + params = nullptr; + elem2param = nullptr; + + intype = nullptr; + afb = nullptr; + dafb = nullptr; + fafb = nullptr; + dfafb = nullptr; + ddfafb = nullptr; + phin = nullptr; + dphin = nullptr; + erpaw = nullptr; + vvdw = nullptr; + vdvdw = nullptr; + dpl = nullptr; + xcctmp = nullptr; + xchtmp = nullptr; + xcotmp = nullptr; + + sht_num = nullptr; + sht_first = nullptr; + + ipage = nullptr; pgsize = oneatom = 0; cflag = 0; @@ -192,7 +192,7 @@ void PairComb3::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -201,7 +201,7 @@ void PairComb3::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -277,7 +277,7 @@ void PairComb3::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; diff --git a/src/MANYBODY/pair_eam.cpp b/src/MANYBODY/pair_eam.cpp index 999384ea2f5d6d4c7391164f742b474f04ec63aa..ac96c040bb2392300785af7c54cf9720ac71d4b2 100644 --- a/src/MANYBODY/pair_eam.cpp +++ b/src/MANYBODY/pair_eam.cpp @@ -46,26 +46,26 @@ PairEAM::PairEAM(LAMMPS *lmp) : Pair(lmp) unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); nmax = 0; - rho = NULL; - fp = NULL; - numforce = NULL; - map = NULL; - type2frho = NULL; + rho = nullptr; + fp = nullptr; + numforce = nullptr; + map = nullptr; + type2frho = nullptr; nfuncfl = 0; - funcfl = NULL; + funcfl = nullptr; - setfl = NULL; - fs = NULL; + setfl = nullptr; + fs = nullptr; - frho = NULL; - rhor = NULL; - z2r = NULL; - scale = NULL; + frho = nullptr; + rhor = nullptr; + z2r = nullptr; + scale = nullptr; - frho_spline = NULL; - rhor_spline = NULL; - z2r_spline = NULL; + frho_spline = nullptr; + rhor_spline = nullptr; + z2r_spline = nullptr; // set comm size needed by this Pair @@ -90,8 +90,8 @@ PairEAM::~PairEAM() memory->destroy(cutsq); delete [] map; delete [] type2frho; - map = NULL; - type2frho = NULL; + map = nullptr; + type2frho = nullptr; memory->destroy(type2rhor); memory->destroy(type2z2r); memory->destroy(scale); @@ -105,7 +105,7 @@ PairEAM::~PairEAM() memory->destroy(funcfl[i].zr); } memory->sfree(funcfl); - funcfl = NULL; + funcfl = nullptr; } if (setfl) { @@ -116,7 +116,7 @@ PairEAM::~PairEAM() memory->destroy(setfl->rhor); memory->destroy(setfl->z2r); delete setfl; - setfl = NULL; + setfl = nullptr; } if (fs) { @@ -127,7 +127,7 @@ PairEAM::~PairEAM() memory->destroy(fs->rhor); memory->destroy(fs->z2r); delete fs; - fs = NULL; + fs = nullptr; } memory->destroy(frho); @@ -937,5 +937,5 @@ void *PairEAM::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"scale") == 0) return (void *) scale; - return NULL; + return nullptr; } diff --git a/src/MANYBODY/pair_eam_alloy.cpp b/src/MANYBODY/pair_eam_alloy.cpp index d30f46aa3620bf3227aa61608469cabe984253aa..f17d500a40484b77097016da4d3d9095dc66ea97 100644 --- a/src/MANYBODY/pair_eam_alloy.cpp +++ b/src/MANYBODY/pair_eam_alloy.cpp @@ -70,7 +70,7 @@ void PairEAMAlloy::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_eam_cd.cpp b/src/MANYBODY/pair_eam_cd.cpp index dc36c73272e8144bc6eac5036e71820adc056666..01ec02dd2e6cac597a86bd5381aaa71da6d46603 100644 --- a/src/MANYBODY/pair_eam_cd.cpp +++ b/src/MANYBODY/pair_eam_cd.cpp @@ -44,9 +44,9 @@ PairEAMCD::PairEAMCD(LAMMPS *lmp, int _cdeamVersion) restartinfo = 0; unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); - rhoB = NULL; - D_values = NULL; - hcoeff = NULL; + rhoB = nullptr; + D_values = nullptr; + hcoeff = nullptr; // Set communication buffer sizes needed by this pair style. @@ -505,14 +505,14 @@ void PairEAMCD::read_h_coeff(char *filename) char nextline[MAXLINE]; int convert_flag = unit_convert_flag; fptr = utils::open_potential(filename, lmp, &convert_flag); - if (fptr == NULL) + if (fptr == nullptr) error->one(FLERR,fmt::format("Cannot open EAMCD potential file {}", filename)); // h coefficients are stored at the end of the file. // Skip to last line of file. - while(fgets(nextline, MAXLINE, fptr) != NULL) { + while(fgets(nextline, MAXLINE, fptr) != nullptr) { strcpy(line, nextline); } diff --git a/src/MANYBODY/pair_eam_cd.h b/src/MANYBODY/pair_eam_cd.h index ee84fb09c53f9fed5c2808f8e784340b705b7679..8f306d101900cc084b00293dd2ab3bc288faf384 100644 --- a/src/MANYBODY/pair_eam_cd.h +++ b/src/MANYBODY/pair_eam_cd.h @@ -49,7 +49,7 @@ public: /// Reports the memory usage of this pair style to LAMMPS. double memory_usage(); - void *extract(const char *, int &) { return NULL; } + void *extract(const char *, int &) { return nullptr; } /// Parses the coefficients of the h polynomial from the end of the EAM file. void read_h_coeff(char* filename); diff --git a/src/MANYBODY/pair_eam_fs.cpp b/src/MANYBODY/pair_eam_fs.cpp index dd45d12da336924286f1a873b3f886cf56343c8f..1c055e1bcf807f96fcd97e3230b3f18744ad9c4e 100644 --- a/src/MANYBODY/pair_eam_fs.cpp +++ b/src/MANYBODY/pair_eam_fs.cpp @@ -70,7 +70,7 @@ void PairEAMFS::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/MANYBODY/pair_eim.cpp b/src/MANYBODY/pair_eim.cpp index cb5a95faa2731c8b64e9e787c2e666c8e41e30db..8f229060cf0978aea2bb047b48f5998c84cd4b0f 100644 --- a/src/MANYBODY/pair_eim.cpp +++ b/src/MANYBODY/pair_eim.cpp @@ -41,25 +41,25 @@ PairEIM::PairEIM(LAMMPS *lmp) : Pair(lmp) manybody_flag = 1; unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); - setfl = NULL; + setfl = nullptr; nmax = 0; - rho = NULL; - fp = NULL; - map = NULL; + rho = nullptr; + fp = nullptr; + map = nullptr; nelements = 0; - elements = NULL; + elements = nullptr; - negativity = NULL; - q0 = NULL; - cutforcesq = NULL; - Fij = NULL; - Gij = NULL; - phiij = NULL; + negativity = nullptr; + q0 = nullptr; + cutforcesq = nullptr; + Fij = nullptr; + Gij = nullptr; + phiij = nullptr; - Fij_spline = NULL; - Gij_spline = NULL; - phiij_spline = NULL; + Fij_spline = nullptr; + Gij_spline = nullptr; + phiij_spline = nullptr; // set comm size needed by this Pair @@ -388,7 +388,7 @@ void PairEIM::coeff(int narg, char **arg) read_file(arg[2+nelements]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3 + nelements; i < narg; i++) { m = i - (3+nelements) + 1; @@ -1062,7 +1062,7 @@ EIMPotentialFileReader::EIMPotentialFileReader(LAMMPS *lmp, FILE *fp = utils::open_potential(filename, lmp, &unit_convert); conversion_factor = utils::get_conversion_factor(utils::ENERGY,unit_convert); - if (fp == NULL) { + if (fp == nullptr) { error->one(FLERR, fmt::format("cannot open eim potential file {}", filename)); } diff --git a/src/MANYBODY/pair_gw.cpp b/src/MANYBODY/pair_gw.cpp index 051c30f8733868da3fb434f9f9f06982d32c5445..6a97975d457b9bcbf7341935a3e1664db90cce08 100644 --- a/src/MANYBODY/pair_gw.cpp +++ b/src/MANYBODY/pair_gw.cpp @@ -51,11 +51,11 @@ PairGW::PairGW(LAMMPS *lmp) : Pair(lmp) unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; } /* ---------------------------------------------------------------------- @@ -283,7 +283,7 @@ void PairGW::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -292,7 +292,7 @@ void PairGW::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -370,7 +370,7 @@ double PairGW::init_one(int i, int j) void PairGW::read_file(char *file) { memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 diff --git a/src/MANYBODY/pair_gw_zbl.cpp b/src/MANYBODY/pair_gw_zbl.cpp index ee3bebda133169cea8fd4520e5360aa9888e27e2..69c677d0cf087c1c7ab4c7cd059c4d30e351bf3f 100644 --- a/src/MANYBODY/pair_gw_zbl.cpp +++ b/src/MANYBODY/pair_gw_zbl.cpp @@ -61,7 +61,7 @@ PairGWZBL::PairGWZBL(LAMMPS *lmp) : PairGW(lmp) void PairGWZBL::read_file(char *file) { memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 diff --git a/src/MANYBODY/pair_lcbop.cpp b/src/MANYBODY/pair_lcbop.cpp index d2e478b37dd52ea4ee71659ceb12ee2b5d9015dd..760ffc8cd852334b1c3aab3ae6d798ddafff75a5 100644 --- a/src/MANYBODY/pair_lcbop.cpp +++ b/src/MANYBODY/pair_lcbop.cpp @@ -48,13 +48,13 @@ PairLCBOP::PairLCBOP(LAMMPS *lmp) : Pair(lmp) ghostneigh = 1; maxlocal = 0; - SR_numneigh = NULL; - SR_firstneigh = NULL; - ipage = NULL; + SR_numneigh = nullptr; + SR_firstneigh = nullptr; + ipage = nullptr; pgsize = oneatom = 0; - N = NULL; - M = NULL; + N = nullptr; + M = nullptr; } /* ---------------------------------------------------------------------- @@ -135,8 +135,8 @@ void PairLCBOP::coeff(int narg, char **arg) if (strcmp(arg[0],"*") != 0 || strcmp(arg[1],"*") != 0) error->all(FLERR,"Incorrect args for pair coefficients"); - // read args that map atom types to C and NULL - // map[i] = which element (0 for C) the Ith atom type is, -1 if NULL + // read args that map atom types to C and "NULL" + // map[i] = which element (0 for C) the Ith atom type is, -1 if "NULL" for (int i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { @@ -193,7 +193,7 @@ void PairLCBOP::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; @@ -970,7 +970,7 @@ void PairLCBOP::read_file(char *filename) if (me == 0) { FILE *fp = utils::open_potential(filename,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open LCBOP potential file %s",filename); error->one(FLERR,str); diff --git a/src/MANYBODY/pair_lcbop.h b/src/MANYBODY/pair_lcbop.h index c7a7fab46d849fce6270db3205712495706149f3..dacbe7415813386d5f00c3dfc81d4f63e501c56e 100644 --- a/src/MANYBODY/pair_lcbop.h +++ b/src/MANYBODY/pair_lcbop.h @@ -39,7 +39,7 @@ class PairLCBOP : public Pair { protected: int **pages; // neighbor list pages - int *map; // 0 (C) or -1 (NULL) for each type + int *map; // 0 (C) or -1 ("NULL") for each type int me; diff --git a/src/MANYBODY/pair_nb3b_harmonic.cpp b/src/MANYBODY/pair_nb3b_harmonic.cpp index 0a197a157603825faf2a3314d3dc2cac631568d1..859652dd1041f2d594c416cc43519bb81fa0a642 100644 --- a/src/MANYBODY/pair_nb3b_harmonic.cpp +++ b/src/MANYBODY/pair_nb3b_harmonic.cpp @@ -50,11 +50,11 @@ PairNb3bHarmonic::PairNb3bHarmonic(LAMMPS *lmp) : Pair(lmp) unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; } /* ---------------------------------------------------------------------- @@ -198,7 +198,7 @@ void PairNb3bHarmonic::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -207,7 +207,7 @@ void PairNb3bHarmonic::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { diff --git a/src/MANYBODY/pair_polymorphic.cpp b/src/MANYBODY/pair_polymorphic.cpp index 0f7fd7a1c7bc4dee87e98590995f71537e8f5c1d..99eb2fec551c931042102ddcd79bb484ee47e1ff 100644 --- a/src/MANYBODY/pair_polymorphic.cpp +++ b/src/MANYBODY/pair_polymorphic.cpp @@ -479,7 +479,7 @@ void PairPolymorphic::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -909,7 +909,7 @@ void PairPolymorphic::write_tables(int npts) { char tag[6] = ""; if (comm->me != 0) sprintf(tag,"%d",comm->me); - FILE* fp = NULL; + FILE* fp = nullptr; double xmin,xmax,x,uf,vf,wf,pf,gf,ff,ufp,vfp,wfp,pfp,gfp,ffp; char line[MAXLINE]; for (int i = 0; i < nelements; i++) { diff --git a/src/MANYBODY/pair_sw.cpp b/src/MANYBODY/pair_sw.cpp index 2deb45ac75a5da5ef3fca043a8c7f9250c10dc0e..b74eda0f85df1ec6a73dbedc721686e78cb53242 100644 --- a/src/MANYBODY/pair_sw.cpp +++ b/src/MANYBODY/pair_sw.cpp @@ -46,14 +46,14 @@ PairSW::PairSW(LAMMPS *lmp) : Pair(lmp) unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; maxshort = 10; - neighshort = NULL; + neighshort = nullptr; } /* ---------------------------------------------------------------------- @@ -262,7 +262,7 @@ void PairSW::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -271,7 +271,7 @@ void PairSW::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { diff --git a/src/MANYBODY/pair_tersoff.cpp b/src/MANYBODY/pair_tersoff.cpp index c08c722e5f9e80b59ba0475db5db62b845f31f3e..b8379d15cc87b7261c0e3290c63b63b65e0b52c0 100644 --- a/src/MANYBODY/pair_tersoff.cpp +++ b/src/MANYBODY/pair_tersoff.cpp @@ -50,14 +50,14 @@ PairTersoff::PairTersoff(LAMMPS *lmp) : Pair(lmp) unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; maxshort = 10; - neighshort = NULL; + neighshort = nullptr; } /* ---------------------------------------------------------------------- @@ -306,7 +306,7 @@ void PairTersoff::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -315,7 +315,7 @@ void PairTersoff::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { diff --git a/src/MANYBODY/pair_vashishta.cpp b/src/MANYBODY/pair_vashishta.cpp index 63765234b3948f86c506f0ffeec1fa0007ff1dff..10ac2c418fbfcece2ab6802d431a8a8f2ab0f1af 100644 --- a/src/MANYBODY/pair_vashishta.cpp +++ b/src/MANYBODY/pair_vashishta.cpp @@ -48,15 +48,15 @@ PairVashishta::PairVashishta(LAMMPS *lmp) : Pair(lmp) unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; r0max = 0.0; maxshort = 10; - neighshort = NULL; + neighshort = nullptr; } /* ---------------------------------------------------------------------- @@ -269,7 +269,7 @@ void PairVashishta::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -278,7 +278,7 @@ void PairVashishta::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { diff --git a/src/MANYBODY/pair_vashishta_table.cpp b/src/MANYBODY/pair_vashishta_table.cpp index 5e0c2c16f767d972d36f484bcc2ab02a7127a38a..8939efc78fc6429f41536315fc95d0814e607693 100644 --- a/src/MANYBODY/pair_vashishta_table.cpp +++ b/src/MANYBODY/pair_vashishta_table.cpp @@ -30,8 +30,8 @@ using namespace LAMMPS_NS; PairVashishtaTable::PairVashishtaTable(LAMMPS *lmp) : PairVashishta(lmp) { - forceTable = NULL; - potentialTable = NULL; + forceTable = nullptr; + potentialTable = nullptr; } /* ---------------------------------------------------------------------- @@ -252,8 +252,8 @@ void PairVashishtaTable::create_tables() { memory->destroy(forceTable); memory->destroy(potentialTable); - forceTable = NULL; - potentialTable = NULL; + forceTable = nullptr; + potentialTable = nullptr; tabinnersq = tabinner*tabinner; diff --git a/src/MC/fix_atom_swap.cpp b/src/MC/fix_atom_swap.cpp index f786179aa4ceaaab0ed95ec2e654ae3b4a87aeb7..217646b92d96f57f65f75dd1fe9a157f22b3ee44 100644 --- a/src/MC/fix_atom_swap.cpp +++ b/src/MC/fix_atom_swap.cpp @@ -50,10 +50,10 @@ using namespace FixConst; FixAtomSwap::FixAtomSwap(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idregion(NULL), type_list(NULL), mu(NULL), qtype(NULL), - sqrt_mass_ratio(NULL), local_swap_iatom_list(NULL), - local_swap_jatom_list(NULL), local_swap_atom_list(NULL), - random_equal(NULL), random_unequal(NULL), c_pe(NULL) + idregion(nullptr), type_list(nullptr), mu(nullptr), qtype(nullptr), + sqrt_mass_ratio(nullptr), local_swap_iatom_list(nullptr), + local_swap_jatom_list(nullptr), local_swap_atom_list(nullptr), + random_equal(nullptr), random_unequal(nullptr), c_pe(nullptr) { if (narg < 10) error->all(FLERR,"Illegal fix atom/swap command"); @@ -105,9 +105,9 @@ FixAtomSwap::FixAtomSwap(LAMMPS *lmp, int narg, char **arg) : nswap_successes = 0.0; atom_swap_nmax = 0; - local_swap_atom_list = NULL; - local_swap_iatom_list = NULL; - local_swap_jatom_list = NULL; + local_swap_atom_list = nullptr; + local_swap_iatom_list = nullptr; + local_swap_jatom_list = nullptr; // set comm size needed by this Fix diff --git a/src/MC/fix_bond_break.cpp b/src/MC/fix_bond_break.cpp index 8a7cd20b0f9c0fa26c73027d73ea06b26de919a4..a024bc20dec5789a01c07d8f9499ac6109008c5f 100644 --- a/src/MC/fix_bond_break.cpp +++ b/src/MC/fix_bond_break.cpp @@ -33,8 +33,8 @@ using namespace FixConst; FixBondBreak::FixBondBreak(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - partner(NULL), finalpartner(NULL), distsq(NULL), probability(NULL), - broken(NULL), copy(NULL), random(NULL) + partner(nullptr), finalpartner(nullptr), distsq(nullptr), probability(nullptr), + broken(nullptr), copy(nullptr), random(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix bond/break command"); diff --git a/src/MC/fix_bond_create.cpp b/src/MC/fix_bond_create.cpp index 002ba4502699d7a757630d78055b2ca54b1e7101..ca34c8bfeab5de65ec0a5e6bc0172c62c21941c3 100644 --- a/src/MC/fix_bond_create.cpp +++ b/src/MC/fix_bond_create.cpp @@ -40,8 +40,8 @@ using namespace MathConst; FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - bondcount(NULL), partner(NULL), finalpartner(NULL), distsq(NULL), - probability(NULL), created(NULL), copy(NULL), random(NULL), list(NULL) + bondcount(nullptr), partner(nullptr), finalpartner(nullptr), distsq(nullptr), + probability(nullptr), created(nullptr), copy(nullptr), random(nullptr), list(nullptr) { if (narg < 8) error->all(FLERR,"Illegal fix bond/create command"); @@ -163,7 +163,7 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) : // register with Atom class // bondcount values will be initialized in setup() - bondcount = NULL; + bondcount = nullptr; grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); countflag = 0; @@ -177,11 +177,11 @@ FixBondCreate::FixBondCreate(LAMMPS *lmp, int narg, char **arg) : // allocate arrays local to this fix nmax = 0; - partner = finalpartner = NULL; - distsq = NULL; + partner = finalpartner = nullptr; + distsq = nullptr; maxcreate = 0; - created = NULL; + created = nullptr; // copy = special list for one atom // size = ms^2 + ms is sufficient @@ -237,7 +237,7 @@ void FixBondCreate::init() // check cutoff for iatomtype,jatomtype - if (force->pair == NULL || cutsq > force->pair->cutsq[iatomtype][jatomtype]) + if (force->pair == nullptr || cutsq > force->pair->cutsq[iatomtype][jatomtype]) error->all(FLERR,"Fix bond/create cutoff is longer than pairwise cutoff"); // warn if more than one fix bond/create or also a fix bond/break diff --git a/src/MC/fix_bond_swap.cpp b/src/MC/fix_bond_swap.cpp index 270a497772c1a3ae03101361cba441d477b931f8..9b1f14516ae3f98e6691ef59bb68b4565ca70257 100644 --- a/src/MC/fix_bond_swap.cpp +++ b/src/MC/fix_bond_swap.cpp @@ -52,8 +52,8 @@ static const char cite_fix_bond_swap[] = FixBondSwap::FixBondSwap(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - tflag(0), alist(NULL), id_temp(NULL), type(NULL), x(NULL), list(NULL), - temperature(NULL), random(NULL) + tflag(0), alist(nullptr), id_temp(nullptr), type(nullptr), x(nullptr), list(nullptr), + temperature(nullptr), random(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_bond_swap); @@ -96,7 +96,7 @@ FixBondSwap::FixBondSwap(LAMMPS *lmp, int narg, char **arg) : // initialize atom list nmax = 0; - alist = NULL; + alist = nullptr; naccept = foursome = 0; } @@ -130,7 +130,7 @@ void FixBondSwap::init() { // require an atom style with molecule IDs - if (atom->molecule == NULL) + if (atom->molecule == nullptr) error->all(FLERR, "Must use atom style with molecule IDs with fix bond/swap"); @@ -143,13 +143,13 @@ void FixBondSwap::init() // no dihedral or improper potentials allowed // special bonds must be 0 1 1 - if (force->pair == NULL || force->bond == NULL) + if (force->pair == nullptr || force->bond == nullptr) error->all(FLERR,"Fix bond/swap requires pair and bond styles"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support fix bond/swap"); - if (force->angle == NULL && atom->nangles > 0 && comm->me == 0) + if (force->angle == nullptr && atom->nangles > 0 && comm->me == 0) error->warning(FLERR,"Fix bond/swap will ignore defined angles"); if (force->dihedral || force->improper) diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index bae9b148b373d184c404e9d9cf76036e9a9cdb90..4aa3821e65ea3a1ccbbb4a3f8706b24f0a8fd547 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -66,10 +66,10 @@ enum{MOVEATOM,MOVEMOL}; // movemode FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idregion(NULL), full_flag(0), ngroups(0), groupstrings(NULL), ngrouptypes(0), grouptypestrings(NULL), - grouptypebits(NULL), grouptypes(NULL), local_gas_list(NULL), molcoords(NULL), molq(NULL), molimage(NULL), - random_equal(NULL), random_unequal(NULL), - fixrigid(NULL), fixshake(NULL), idrigid(NULL), idshake(NULL) + idregion(nullptr), full_flag(0), ngroups(0), groupstrings(nullptr), ngrouptypes(0), grouptypestrings(nullptr), + grouptypebits(nullptr), grouptypes(nullptr), local_gas_list(nullptr), molcoords(nullptr), molq(nullptr), molimage(nullptr), + random_equal(nullptr), random_unequal(nullptr), + fixrigid(nullptr), fixshake(nullptr), idrigid(nullptr), idshake(nullptr) { if (narg < 11) error->all(FLERR,"Illegal fix gcmc command"); @@ -167,7 +167,7 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix gcmc molecule must have atom types"); if (ngcmc_type != 0) error->all(FLERR,"Atom type must be zero in fix gcmc mol command"); - if (onemols[imol]->qflag == 1 && atom->q == NULL) + if (onemols[imol]->qflag == 1 && atom->q == nullptr) error->all(FLERR,"Fix gcmc molecule has charges, but atom style does not"); if (atom->molecular == Atom::TEMPLATE && onemols != atom->avec->onemols) @@ -176,7 +176,7 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : onemols[imol]->check_attributes(0); } - if (charge_flag && atom->q == NULL) + if (charge_flag && atom->q == nullptr) error->all(FLERR,"Fix gcmc atom has charge, but atom style does not"); if (rigidflag && exchmode == EXCHATOM) @@ -219,7 +219,7 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : ninsertion_successes = 0.0; gcmc_nmax = 0; - local_gas_list = NULL; + local_gas_list = nullptr; } /* ---------------------------------------------------------------------- @@ -258,12 +258,12 @@ void FixGCMC::options(int narg, char **arg) full_flag = false; ngroups = 0; int ngroupsmax = 0; - groupstrings = NULL; + groupstrings = nullptr; ngrouptypes = 0; int ngrouptypesmax = 0; - grouptypestrings = NULL; - grouptypes = NULL; - grouptypebits = NULL; + grouptypestrings = nullptr; + grouptypes = nullptr; + grouptypebits = nullptr; energy_intra = 0.0; tfac_insert = 1.0; overlap_cutoffsq = 0.0; @@ -481,7 +481,7 @@ void FixGCMC::init() if (!full_flag) { if ((force->kspace) || - (force->pair == NULL) || + (force->pair == nullptr) || (force->pair->single_enable == 0) || (force->pair_match("^hybrid",0)) || (force->pair_match("^eam",0)) || @@ -543,7 +543,7 @@ void FixGCMC::init() // if rigidflag defined, check for rigid/small fix // its molecule template must be same as this one - fixrigid = NULL; + fixrigid = nullptr; if (rigidflag) { int ifix = modify->find_fix(idrigid); if (ifix < 0) error->all(FLERR,"Fix gcmc rigid fix does not exist"); @@ -558,7 +558,7 @@ void FixGCMC::init() // if shakeflag defined, check for SHAKE fix // its molecule template must be same as this one - fixshake = NULL; + fixshake = nullptr; if (shakeflag) { int ifix = modify->find_fix(idshake); if (ifix < 0) error->all(FLERR,"Fix gcmc shake fix does not exist"); diff --git a/src/MC/fix_tfmc.cpp b/src/MC/fix_tfmc.cpp index b855c0b79e35e9da035ec7266d5d6d081f3c1164..20b72dc2697e440996e2ac6a1637b4e0ed314dd6 100644 --- a/src/MC/fix_tfmc.cpp +++ b/src/MC/fix_tfmc.cpp @@ -37,7 +37,7 @@ using namespace FixConst; FixTFMC::FixTFMC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xd(NULL), rotflag(0), random_num(NULL) + xd(nullptr), rotflag(0), random_num(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix tfmc command"); @@ -83,7 +83,7 @@ FixTFMC::FixTFMC(LAMMPS *lmp, int narg, char **arg) : comflag = 0; if (rotflag) { - xd = NULL; + xd = nullptr; nmax = -1; } @@ -97,7 +97,7 @@ FixTFMC::~FixTFMC() delete random_num; if (rotflag) { memory->destroy(xd); - xd = NULL; + xd = nullptr; nmax = -1; } } diff --git a/src/MC/fix_widom.cpp b/src/MC/fix_widom.cpp index 22af9881a4cd14c4118297853d5ff16539dfd8fb..e45b4b76b60170fdc7749d4a213c7a51ec0fff42 100644 --- a/src/MC/fix_widom.cpp +++ b/src/MC/fix_widom.cpp @@ -58,9 +58,9 @@ enum{EXCHATOM,EXCHMOL}; // exchmode FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idregion(NULL), full_flag(0), - local_gas_list(NULL), molcoords(NULL), molq(NULL), molimage(NULL), - random_equal(NULL) + idregion(nullptr), full_flag(0), + local_gas_list(nullptr), molcoords(nullptr), molq(nullptr), molimage(nullptr), + random_equal(nullptr) { if (narg < 8) error->all(FLERR,"Illegal fix widom command"); @@ -151,7 +151,7 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Fix widom molecule must have atom types"); if (nwidom_type != 0) error->all(FLERR,"Atom type must be zero in fix widom mol command"); - if (onemols[imol]->qflag == 1 && atom->q == NULL) + if (onemols[imol]->qflag == 1 && atom->q == nullptr) error->all(FLERR,"Fix widom molecule has charges, but atom style does not"); if (atom->molecular == Atom::TEMPLATE && onemols != atom->avec->onemols) @@ -160,8 +160,8 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : onemols[imol]->check_attributes(0); } - if (charge_flag && atom->q == NULL) - error->all(FLERR,"Fix widom atom has charge, but atom style does not"); + if (charge_flag && atom->q == nullptr) + error->all(FLERR,"Fix Widom atom has charge, but atom style does not"); // setup of array of coordinates for molecule insertion @@ -177,7 +177,7 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : // zero out counters widom_nmax = 0; - local_gas_list = NULL; + local_gas_list = nullptr; } /* ---------------------------------------------------------------------- @@ -283,7 +283,7 @@ void FixWidom::init() // decide whether to switch to the full_energy option if (!full_flag) { if ((force->kspace) || - (force->pair == NULL) || + (force->pair == nullptr) || (force->pair->single_enable == 0) || (force->pair_match("hybrid",0)) || (force->pair_match("eam",0)) || diff --git a/src/MC/pair_dsmc.cpp b/src/MC/pair_dsmc.cpp index 588d57f324ad01fa1dbf4de088488f6e779b8091..f4bac9b8cb6b1e36308c600028f71b99dd794ba3 100644 --- a/src/MC/pair_dsmc.cpp +++ b/src/MC/pair_dsmc.cpp @@ -38,8 +38,8 @@ PairDSMC::PairDSMC(LAMMPS *lmp) : Pair(lmp) total_number_of_collisions = 0; max_particles = max_particle_list = 0; - next_particle = NULL; - random = NULL; + next_particle = nullptr; + random = nullptr; } /* ---------------------------------------------------------------------- */ @@ -342,12 +342,12 @@ void PairDSMC::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -375,11 +375,11 @@ void PairDSMC::write_restart_settings(FILE *fp) void PairDSMC::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&max_cell_size,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&max_cell_size,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/MESSAGE/fix_client_md.cpp b/src/MESSAGE/fix_client_md.cpp index 5a795c99fcc958c4b8ca692876e1b710626de915..ab9bbfa14c41e73dfca9790a9e9b0176da35770c 100644 --- a/src/MESSAGE/fix_client_md.cpp +++ b/src/MESSAGE/fix_client_md.cpp @@ -62,7 +62,7 @@ FixClientMD::FixClientMD(LAMMPS *lmp, int narg, char **arg) : box[0][2] = box[1][2] = box[2][0] = box[2][1] = box[2][2] = 0.0; maxatom = 0; - xpbc = NULL; + xpbc = nullptr; // unit conversion factors for REAL // otherwise not needed diff --git a/src/MESSAGE/message.cpp b/src/MESSAGE/message.cpp index b83be0339ccc26ef2cb781150295018aed0754a1..b43a2686a28a8af01a8b8e3ce0172435e5317ed9 100644 --- a/src/MESSAGE/message.cpp +++ b/src/MESSAGE/message.cpp @@ -116,6 +116,6 @@ void Message::quit() // clean-up delete cs; - lmp->cslib = NULL; + lmp->cslib = nullptr; lmp->clientserver = 0; } diff --git a/src/MESSAGE/server_mc.cpp b/src/MESSAGE/server_mc.cpp index d74594be3ec5c643fa44ba92abe1252a6502c8af..d42dfa7512c8e174a337390dd48e319895b37681 100644 --- a/src/MESSAGE/server_mc.cpp +++ b/src/MESSAGE/server_mc.cpp @@ -77,7 +77,7 @@ void ServerMC::loop() cs->send(msgID,2); cs->pack_double(1,dval); - double *coords = NULL; + double *coords = nullptr; if (atom->nlocal) coords = &atom->x[0][0]; cs->pack_parallel(2,4,atom->nlocal,atom->tag,3,coords); @@ -143,5 +143,5 @@ void ServerMC::loop() // clean up delete cs; - lmp->cslib = NULL; + lmp->cslib = nullptr; } diff --git a/src/MESSAGE/server_md.cpp b/src/MESSAGE/server_md.cpp index ef00e9556387275bd2619229d986efd8f2925c9e..2d6b07490f74be491a201e0a5a0207ced2e894d3 100644 --- a/src/MESSAGE/server_md.cpp +++ b/src/MESSAGE/server_md.cpp @@ -64,7 +64,7 @@ ServerMD::ServerMD(LAMMPS *lmp) : Pointers(lmp) pconvert = 1.0 / 0.986923; // atmospheres -> bars } - fcopy = NULL; + fcopy = nullptr; } /* ---------------------------------------------------------------------- */ @@ -107,15 +107,15 @@ void ServerMD::loop() if (msgID == SETUP) { int dim = 0; - int *periodicity = NULL; + int *periodicity = nullptr; int natoms = -1; int ntypes = -1; - double *origin = NULL; - double *box = NULL; - int *types = NULL; - double *coords = NULL; - char *unit_style = NULL; - double *charge = NULL; + double *origin = nullptr; + double *box = nullptr; + int *types = nullptr; + double *coords = nullptr; + char *unit_style = nullptr; + double *charge = nullptr; for (int ifield = 0; ifield < nfield; ifield++) { if (fieldID[ifield] == DIM) { @@ -185,7 +185,7 @@ void ServerMD::loop() int nlocal = 0; for (int i = 0; i < natoms; i++) { - if (!domain->ownatom(i+1,&coords[3*i],NULL,0)) continue; + if (!domain->ownatom(i+1,&coords[3*i],nullptr,0)) continue; atom->avec->create_atom(types[i],&coords[3*i]); atom->tag[nlocal] = i+1; if (charge) atom->q[nlocal] = charge[i]; @@ -226,9 +226,9 @@ void ServerMD::loop() } else if (msgID == STEP) { - double *coords = NULL; - double *origin = NULL; - double *box = NULL; + double *coords = nullptr; + double *origin = nullptr; + double *box = nullptr; for (int ifield = 0; ifield < nfield; ifield++) { if (fieldID[ifield] == COORDS) { @@ -314,7 +314,7 @@ void ServerMD::loop() // clean up delete cs; - lmp->cslib = NULL; + lmp->cslib = nullptr; } /* ---------------------------------------------------------------------- @@ -349,7 +349,7 @@ void ServerMD::send_fev(int msgID) cs->send(msgID,3); - double *forces = NULL; + double *forces = nullptr; if (atom->nlocal) { if (units != REAL) forces = &atom->f[0][0]; else { diff --git a/src/MISC/compute_ti.cpp b/src/MISC/compute_ti.cpp index d8be8679c6956fd2c6e3f8575bddd82b6f1dfad2..f984aeac2e2bee9317c27e2f1c4bcde22721d755 100644 --- a/src/MISC/compute_ti.cpp +++ b/src/MISC/compute_ti.cpp @@ -36,8 +36,8 @@ enum{PAIR,TAIL,KSPACE}; /* ---------------------------------------------------------------------- */ ComputeTI::ComputeTI(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), nterms(0), which(NULL), ivar1(NULL), ivar2(NULL), - ilo(NULL), ihi(NULL), var1(NULL), var2(NULL), pptr(NULL), pstyle(NULL) + Compute(lmp, narg, arg), nterms(0), which(nullptr), ivar1(nullptr), ivar2(nullptr), + ilo(nullptr), ihi(nullptr), var1(nullptr), var2(nullptr), pptr(nullptr), pstyle(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute ti command"); @@ -64,7 +64,7 @@ ComputeTI::ComputeTI(LAMMPS *lmp, int narg, char **arg) : pptr = new Pair*[nterms]; pstyle = new char*[nterms]; - for (int m = 0; m < nterms; m++) pstyle[m] = NULL; + for (int m = 0; m < nterms; m++) pstyle[m] = nullptr; // parse keywords @@ -136,16 +136,16 @@ void ComputeTI::init() if (which[m] == PAIR) { pptr[m] = force->pair_match(pstyle[m],1); - if (pptr[m] == NULL) + if (pptr[m] == nullptr) error->all(FLERR,"Compute ti pair style does not exist"); } else if (which[m] == TAIL) { - if (force->pair == NULL || force->pair->tail_flag == 0) + if (force->pair == nullptr || force->pair->tail_flag == 0) error->all(FLERR,"Compute ti tail when pair style does not " "compute tail corrections"); } else if (which[m] == KSPACE) { - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Compute ti kspace style does not exist"); } } diff --git a/src/MISC/dump_xtc.cpp b/src/MISC/dump_xtc.cpp index ba90f833104c0a80411a3a6a6b9e33ef70189f7d..1a1e01b16c781e184ee125480a39964f2876a10a 100644 --- a/src/MISC/dump_xtc.cpp +++ b/src/MISC/dump_xtc.cpp @@ -53,7 +53,7 @@ int xdr3dfcoord(XDR *, float *, int *, float *); /* ---------------------------------------------------------------------- */ DumpXTC::DumpXTC(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), - coords(NULL) + coords(nullptr) { if (narg != 5) error->all(FLERR,"Illegal dump xtc command"); if (binary || compressed || multifile || multiproc) @@ -62,7 +62,7 @@ DumpXTC::DumpXTC(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), size_one = 3; sort_flag = 1; sortcol = 0; - format_default = NULL; + format_default = nullptr; flush_flag = 0; unwrap_flag = 0; precision = 1000.0; @@ -137,9 +137,9 @@ void DumpXTC::init_style() void DumpXTC::openfile() { // XTC maintains it's own XDR file ptr - // set fp to NULL so parent dump class will not use it + // set fp to a null pointer so parent dump class will not use it - fp = NULL; + fp = nullptr; if (me == 0) if (xdropen(&xd,filename,"w") == 0) error->one(FLERR,"Cannot open dump file"); } @@ -364,8 +364,8 @@ void DumpXTC::write_frame() static FILE *xdrfiles[MAXID]; static XDR *xdridptr[MAXID]; static char xdrmodes[MAXID]; -static int *ip = NULL; -static int *buf = NULL; +static int *ip = nullptr; +static int *buf = nullptr; /*___________________________________________________________________________ | @@ -414,12 +414,12 @@ int xdropen(XDR *xdrs, const char *filename, const char *type) if (init_done == 0) { for (xdrid = 1; xdrid < MAXID; xdrid++) { - xdridptr[xdrid] = NULL; + xdridptr[xdrid] = nullptr; } init_done = 1; } xdrid = 1; - while (xdrid < MAXID && xdridptr[xdrid] != NULL) { + while (xdrid < MAXID && xdridptr[xdrid] != nullptr) { xdrid++; } if (xdrid == MAXID) { @@ -433,8 +433,8 @@ int xdropen(XDR *xdrs, const char *filename, const char *type) lmode = XDR_DECODE; } xdrfiles[xdrid] = fopen(filename, type); - if (xdrfiles[xdrid] == NULL) { - xdrs = NULL; + if (xdrfiles[xdrid] == nullptr) { + xdrs = nullptr; return 0; } xdrmodes[xdrid] = *type; @@ -444,7 +444,7 @@ int xdropen(XDR *xdrs, const char *filename, const char *type) * (C users are expected to pass the address of an already allocated * XDR staructure) */ - if (xdrs == NULL) { + if (xdrs == nullptr) { xdridptr[xdrid] = (XDR *) malloc(sizeof(XDR)); xdrstdio_create(xdridptr[xdrid], xdrfiles[xdrid], lmode); } else { @@ -468,7 +468,7 @@ int xdrclose(XDR *xdrs) { int xdrid; - if (xdrs == NULL) { + if (xdrs == nullptr) { fprintf(stderr, "xdrclose: passed a NULL pointer\n"); exit(1); } @@ -477,7 +477,7 @@ int xdrclose(XDR *xdrs) xdr_destroy(xdrs); fclose(xdrfiles[xdrid]); - xdridptr[xdrid] = NULL; + xdridptr[xdrid] = nullptr; return 1; } } @@ -495,8 +495,8 @@ void xdrfreebuf() { if (ip) free(ip); if (buf) free(buf); - ip = NULL; - buf = NULL; + ip = nullptr; + buf = nullptr; } @@ -815,28 +815,28 @@ int xdr3dfcoord(XDR *xdrs, float *fp, int *size, float *precision) } xdr_float(xdrs, precision); - if (ip == NULL) { + if (ip == nullptr) { ip = (int *) malloc(size3 * sizeof(*ip)); - if (ip == NULL) { + if (ip == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } bufsize = (int) (size3 * 1.2); buf = (int *) malloc(bufsize * sizeof(*buf)); - if (buf == NULL) { + if (buf == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } oldsize = *size; } else if (*size > oldsize) { ip = (int *) realloc(ip, size3 * sizeof(*ip)); - if (ip == NULL) { + if (ip == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } bufsize = (int) (size3 * 1.2); buf = (int *) realloc(buf, bufsize * sizeof(*buf)); - if (buf == NULL) { + if (buf == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } @@ -1059,28 +1059,28 @@ int xdr3dfcoord(XDR *xdrs, float *fp, int *size, float *precision) (xdrproc_t)xdr_float)); } xdr_float(xdrs, precision); - if (ip == NULL) { + if (ip == nullptr) { ip = (int *) malloc(size3 * sizeof(*ip)); - if (ip == NULL) { + if (ip == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } bufsize = (int) (size3 * 1.2); buf = (int *) malloc(bufsize * sizeof(*buf)); - if (buf == NULL) { + if (buf == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } oldsize = *size; } else if (*size > oldsize) { ip = (int *)realloc(ip, size3 * sizeof(*ip)); - if (ip == NULL) { + if (ip == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } bufsize = (int) (size3 * 1.2); buf = (int *)realloc(buf, bufsize * sizeof(*buf)); - if (buf == NULL) { + if (buf == nullptr) { fprintf(stderr,"malloc failed\n"); exit(1); } diff --git a/src/MISC/fix_deposit.cpp b/src/MISC/fix_deposit.cpp index 4e2ef6b035c9fb18b97fbbec9f7e03c535741507..a4cc2baa6b741fe1ed255d6344c776265f031525 100644 --- a/src/MISC/fix_deposit.cpp +++ b/src/MISC/fix_deposit.cpp @@ -44,9 +44,9 @@ enum{DIST_UNIFORM,DIST_GAUSSIAN}; /* ---------------------------------------------------------------------- */ FixDeposit::FixDeposit(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), idregion(NULL), idrigid(NULL), - idshake(NULL), onemols(NULL), molfrac(NULL), coords(NULL), imageflags(NULL), - fixrigid(NULL), fixshake(NULL), random(NULL) + Fix(lmp, narg, arg), idregion(nullptr), idrigid(nullptr), + idshake(nullptr), onemols(nullptr), molfrac(nullptr), coords(nullptr), imageflags(nullptr), + fixrigid(nullptr), fixshake(nullptr), random(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix deposit command"); @@ -233,7 +233,7 @@ void FixDeposit::init() // if rigidflag defined, check for rigid/small fix // its molecule template must be same as this one - fixrigid = NULL; + fixrigid = nullptr; if (rigidflag) { int ifix = modify->find_fix(idrigid); if (ifix < 0) error->all(FLERR,"Fix deposit rigid fix does not exist"); @@ -248,7 +248,7 @@ void FixDeposit::init() // if shakeflag defined, check for SHAKE fix // its molecule template must be same as this one - fixshake = NULL; + fixshake = nullptr; if (shakeflag) { int ifix = modify->find_fix(idshake); if (ifix < 0) error->all(FLERR,"Fix deposit shake fix does not exist"); @@ -658,13 +658,13 @@ void FixDeposit::options(int narg, char **arg) // defaults iregion = -1; - idregion = NULL; + idregion = nullptr; mode = ATOM; - molfrac = NULL; + molfrac = nullptr; rigidflag = 0; - idrigid = NULL; + idrigid = nullptr; shakeflag = 0; - idshake = NULL; + idshake = nullptr; idnext = 0; globalflag = localflag = 0; lo = hi = deltasq = 0.0; @@ -904,5 +904,5 @@ void *FixDeposit::extract(const char *str, int &itype) return &oneradius; } - return NULL; + return nullptr; } diff --git a/src/MISC/fix_efield.cpp b/src/MISC/fix_efield.cpp index bd2f9acfb91879076c46c80766593dc419056914..d3836f52a54295cae97651ba940d0755e9a38c7b 100644 --- a/src/MISC/fix_efield.cpp +++ b/src/MISC/fix_efield.cpp @@ -40,8 +40,8 @@ enum{NONE,CONSTANT,EQUAL,ATOM}; /* ---------------------------------------------------------------------- */ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), xstr(NULL), ystr(NULL), zstr(NULL), - estr(NULL), idregion(NULL), efield(NULL) + Fix(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr), + estr(nullptr), idregion(nullptr), efield(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix efield command"); @@ -57,7 +57,7 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : virial_flag = 1; qe2f = force->qe2f; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; @@ -89,8 +89,8 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) : // optional args iregion = -1; - idregion = NULL; - estr = NULL; + idregion = nullptr; + estr = nullptr; int iarg = 6; while (iarg < narg) { @@ -272,7 +272,7 @@ void FixEfield::post_force(int vflag) // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/MISC/fix_evaporate.cpp b/src/MISC/fix_evaporate.cpp index 37d7ebde21b7d3da389a107dcc1ea71a5d967714..ae2d51448b9d61cb1f0efe1792250d8dfb0f0f0c 100644 --- a/src/MISC/fix_evaporate.cpp +++ b/src/MISC/fix_evaporate.cpp @@ -33,7 +33,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixEvaporate::FixEvaporate(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), idregion(NULL), list(NULL), mark(NULL), random(NULL) + Fix(lmp, narg, arg), idregion(nullptr), list(nullptr), mark(nullptr), random(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix evaporate command"); @@ -84,8 +84,8 @@ FixEvaporate::FixEvaporate(LAMMPS *lmp, int narg, char **arg) : ndeleted = 0; nmax = 0; - list = NULL; - mark = NULL; + list = nullptr; + mark = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MISC/fix_gld.cpp b/src/MISC/fix_gld.cpp index 2eee815f4da74673f12a28cae3f6069dc23c8ee1..7ef5b019ba2406d9a49a1e78a663dad658378668 100644 --- a/src/MISC/fix_gld.cpp +++ b/src/MISC/fix_gld.cpp @@ -41,7 +41,7 @@ using namespace FixConst; FixGLD::FixGLD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - step_respa(NULL), prony_c(NULL), prony_tau(NULL), s_gld(NULL), random(NULL) + step_respa(nullptr), prony_c(nullptr), prony_tau(nullptr), s_gld(nullptr), random(nullptr) { int narg_min = 8; // Check to make sure we have the minimal number of inputs @@ -89,7 +89,7 @@ FixGLD::FixGLD(LAMMPS *lmp, int narg, char **arg) : // allocate memory for Prony series timescale coefficients memory->create(prony_tau, prony_terms, "gld:prony_tau"); // allocate memory for Prony series extended variables - s_gld = NULL; + s_gld = nullptr; grow_arrays(atom->nmax); // add callbacks to enable restarts atom->add_callback(Atom::GROW); diff --git a/src/MISC/fix_oneway.cpp b/src/MISC/fix_oneway.cpp index 1ca24a5906bbc15da52d356f43f158887ef7309c..3508c2fd7ec25f630e8a3c170cbe80297c64e7cd 100644 --- a/src/MISC/fix_oneway.cpp +++ b/src/MISC/fix_oneway.cpp @@ -35,7 +35,7 @@ FixOneWay::FixOneWay(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { direction = NONE; regionidx = 0; - regionstr = NULL; + regionstr = nullptr; if (narg < 6) error->all(FLERR,"Illegal fix oneway command"); diff --git a/src/MISC/fix_orient_bcc.cpp b/src/MISC/fix_orient_bcc.cpp index cc22a509ba9aebd82bf1a06857ec2fcc98fc0cfb..7d9463f77c99ab2c4e2291a0d95af3be27e45edd 100644 --- a/src/MISC/fix_orient_bcc.cpp +++ b/src/MISC/fix_orient_bcc.cpp @@ -56,7 +56,7 @@ static const char cite_fix_orient_bcc[] = FixOrientBCC::FixOrientBCC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xifilename(NULL), chifilename(NULL), order(NULL), nbr(NULL), sort(NULL), list(NULL) + xifilename(nullptr), chifilename(nullptr), order(nullptr), nbr(nullptr), sort(nullptr), list(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_orient_bcc); @@ -114,7 +114,7 @@ FixOrientBCC::FixOrientBCC(LAMMPS *lmp, int narg, char **arg) : int count; FILE *inpfile = fopen(xifilename,"r"); - if (inpfile == NULL) error->one(FLERR,"Fix orient/bcc file open failed"); + if (inpfile == nullptr) error->one(FLERR,"Fix orient/bcc file open failed"); for (int i = 0; i < 4; i++) { result = fgets(line,IMGMAX,inpfile); if (!result) error->one(FLERR,"Fix orient/bcc file read failed"); @@ -124,7 +124,7 @@ FixOrientBCC::FixOrientBCC(LAMMPS *lmp, int narg, char **arg) : fclose(inpfile); inpfile = fopen(chifilename,"r"); - if (inpfile == NULL) error->one(FLERR,"Fix orient/bcc file open failed"); + if (inpfile == nullptr) error->one(FLERR,"Fix orient/bcc file open failed"); for (int i = 0; i < 4; i++) { result = fgets(line,IMGMAX,inpfile); if (!result) error->one(FLERR,"Fix orient/bcc file read failed"); diff --git a/src/MISC/fix_orient_fcc.cpp b/src/MISC/fix_orient_fcc.cpp index f391eab91e3280291da9c602a414c89ff098947f..0677b8d57ca2cc71d9a4b8e881eee96249559f93 100644 --- a/src/MISC/fix_orient_fcc.cpp +++ b/src/MISC/fix_orient_fcc.cpp @@ -53,8 +53,8 @@ static const char cite_fix_orient_fcc[] = FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xifilename(NULL), chifilename(NULL), order(NULL), nbr(NULL), - sort(NULL), list(NULL) + xifilename(nullptr), chifilename(nullptr), order(nullptr), nbr(nullptr), + sort(nullptr), list(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_orient_fcc); @@ -112,7 +112,7 @@ FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) : int count; FILE *inpfile = fopen(xifilename,"r"); - if (inpfile == NULL) error->one(FLERR,"Fix orient/fcc file open failed"); + if (inpfile == nullptr) error->one(FLERR,"Fix orient/fcc file open failed"); for (int i = 0; i < 6; i++) { result = fgets(line,IMGMAX,inpfile); if (!result) error->one(FLERR,"Fix orient/fcc file read failed"); @@ -122,7 +122,7 @@ FixOrientFCC::FixOrientFCC(LAMMPS *lmp, int narg, char **arg) : fclose(inpfile); inpfile = fopen(chifilename,"r"); - if (inpfile == NULL) error->one(FLERR,"Fix orient/fcc file open failed"); + if (inpfile == nullptr) error->one(FLERR,"Fix orient/fcc file open failed"); for (int i = 0; i < 6; i++) { result = fgets(line,IMGMAX,inpfile); if (!result) error->one(FLERR,"Fix orient/fcc file read failed"); diff --git a/src/MISC/fix_thermal_conductivity.cpp b/src/MISC/fix_thermal_conductivity.cpp index 115045db81d4d36ceee158657666a69a8f0979a0..ac86162e31e03b632114204c48a720a902815622 100644 --- a/src/MISC/fix_thermal_conductivity.cpp +++ b/src/MISC/fix_thermal_conductivity.cpp @@ -35,7 +35,7 @@ using namespace FixConst; FixThermalConductivity::FixThermalConductivity(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - index_lo(NULL), index_hi(NULL), ke_lo(NULL), ke_hi(NULL) + index_lo(nullptr), index_hi(nullptr), ke_lo(nullptr), ke_hi(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix thermal/conductivity command"); diff --git a/src/MISC/fix_ttm.cpp b/src/MISC/fix_ttm.cpp index 954234240f41af74186181617615639ad8e2c9de..a1f5425038dcad8a387b2b23bbb091467f4c2de2 100644 --- a/src/MISC/fix_ttm.cpp +++ b/src/MISC/fix_ttm.cpp @@ -42,11 +42,11 @@ using namespace FixConst; FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - random(NULL), fp(NULL), nsum(NULL), nsum_all(NULL), - gfactor1(NULL), gfactor2(NULL), ratio(NULL), flangevin(NULL), - T_electron(NULL), T_electron_old(NULL), sum_vsq(NULL), sum_mass_vsq(NULL), - sum_vsq_all(NULL), sum_mass_vsq_all(NULL), net_energy_transfer(NULL), - net_energy_transfer_all(NULL) + random(nullptr), fp(nullptr), nsum(nullptr), nsum_all(nullptr), + gfactor1(nullptr), gfactor2(nullptr), ratio(nullptr), flangevin(nullptr), + T_electron(nullptr), T_electron_old(nullptr), sum_vsq(nullptr), sum_mass_vsq(nullptr), + sum_vsq_all(nullptr), sum_mass_vsq_all(nullptr), net_energy_transfer(nullptr), + net_energy_transfer_all(nullptr) { if (narg < 15) error->all(FLERR,"Illegal fix ttm command"); @@ -74,7 +74,7 @@ FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) : if (narg != 16) error->all(FLERR,"Illegal fix ttm command"); if (comm->me == 0) { fp = fopen(arg[15],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open output file {}: {}", arg[15], utils::getsyserror())); } @@ -128,7 +128,7 @@ FixTTM::FixTTM(LAMMPS *lmp, int narg, char **arg) : memory->create(net_energy_transfer_all,nxnodes,nynodes,nznodes, "TTM:net_energy_transfer_all"); - flangevin = NULL; + flangevin = nullptr; grow_arrays(atom->nmax); // zero out the flangevin array @@ -341,7 +341,7 @@ void FixTTM::read_initial_electron_temperatures(const char *filename) int ixnode,iynode,iznode; double T_tmp; while (1) { - if (fgets(line,MAXLINE,fpr) == NULL) break; + if (fgets(line,MAXLINE,fpr) == nullptr) break; ValueTokenizer values(line); if (values.has_next()) ixnode = values.next_int(); if (values.has_next()) iynode = values.next_int(); diff --git a/src/MISC/fix_viscosity.cpp b/src/MISC/fix_viscosity.cpp index 5dcd2d291d7a5813f15233c7d11995a177cff8bc..90e6fcda6375f66a9c4c76ff6a1ef43b1fdc852d 100644 --- a/src/MISC/fix_viscosity.cpp +++ b/src/MISC/fix_viscosity.cpp @@ -37,7 +37,7 @@ using namespace FixConst; FixViscosity::FixViscosity(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - pos_index(NULL), neg_index(NULL), pos_delta(NULL), neg_delta(NULL) + pos_index(nullptr), neg_index(nullptr), pos_delta(nullptr), neg_delta(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix viscosity command"); diff --git a/src/MISC/pair_nm_cut.cpp b/src/MISC/pair_nm_cut.cpp index 4fc1fb0628bb3faff8a2118d27c0dbcbb007dcc5..4090677a03e0b482b8a65f6bb078462c37fd8131 100644 --- a/src/MISC/pair_nm_cut.cpp +++ b/src/MISC/pair_nm_cut.cpp @@ -319,15 +319,15 @@ void PairNMCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&e0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&r0[i][j],1,MPI_DOUBLE,0,world); @@ -357,10 +357,10 @@ void PairNMCut::write_restart_settings(FILE *fp) void PairNMCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -422,5 +422,5 @@ void *PairNMCut::extract(const char *str, int &dim) if (strcmp(str,"r0") == 0) return (void *) r0; if (strcmp(str,"nn") == 0) return (void *) nn; if (strcmp(str,"mm") == 0) return (void *) mm; - return NULL; + return nullptr; } diff --git a/src/MISC/pair_nm_cut_coul_cut.cpp b/src/MISC/pair_nm_cut_coul_cut.cpp index 4a18680415295c8c07ad00663b0e6cbf2c890e6f..1f0ae96324cbdbdd7927819121ad5b9b90bd2ccc 100644 --- a/src/MISC/pair_nm_cut_coul_cut.cpp +++ b/src/MISC/pair_nm_cut_coul_cut.cpp @@ -370,16 +370,16 @@ void PairNMCutCoulCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&e0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&r0[i][j],1,MPI_DOUBLE,0,world); @@ -411,11 +411,11 @@ void PairNMCutCoulCut::write_restart_settings(FILE *fp) void PairNMCutCoulCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); @@ -493,5 +493,5 @@ void *PairNMCutCoulCut::extract(const char *str, int &dim) if (strcmp(str,"r0") == 0) return (void *) r0; if (strcmp(str,"nn") == 0) return (void *) nn; if (strcmp(str,"mm") == 0) return (void *) mm; - return NULL; + return nullptr; } diff --git a/src/MISC/pair_nm_cut_coul_long.cpp b/src/MISC/pair_nm_cut_coul_long.cpp index 576637c593ad22786b960194cdfe727eb0c82e5c..a981204af6fa3fae1e615dc31775ff9c93e66125 100644 --- a/src/MISC/pair_nm_cut_coul_long.cpp +++ b/src/MISC/pair_nm_cut_coul_long.cpp @@ -46,7 +46,7 @@ using namespace MathConst; PairNMCutCoulLong::PairNMCutCoulLong(LAMMPS *lmp) : Pair(lmp) { ewaldflag = pppmflag = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; } @@ -308,13 +308,13 @@ void PairNMCutCoulLong::init_style() cut_coulsq = cut_coul * cut_coul; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; // setup force tables - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); } /* ---------------------------------------------------------------------- @@ -414,15 +414,15 @@ void PairNMCutCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&e0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&nn[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mm[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&e0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&r0[i][j],1,MPI_DOUBLE,0,world); @@ -455,13 +455,13 @@ void PairNMCutCoulLong::write_restart_settings(FILE *fp) void PairNMCutCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -576,5 +576,5 @@ void *PairNMCutCoulLong::extract(const char *str, int &dim) if (strcmp(str,"r0") == 0) return (void *) r0; if (strcmp(str,"nn") == 0) return (void *) nn; if (strcmp(str,"mm") == 0) return (void *) mm; - return NULL; + return nullptr; } diff --git a/src/MISC/xdr_compat.cpp b/src/MISC/xdr_compat.cpp index 9806b0bbd2ef71f35143f0b9f5a99000b56eb875..7483b4aa18a17b9df28f34ad9b591b5e2817cb3d 100644 --- a/src/MISC/xdr_compat.cpp +++ b/src/MISC/xdr_compat.cpp @@ -352,7 +352,7 @@ xdr_opaque (XDR *xdrs, char *cp, unsigned int cnt) /* * XDR null terminated ASCII strings * xdr_string deals with "C strings" - arrays of bytes that are - * terminated by a NULL character. The parameter cpp references a + * terminated by a nullptr character. The parameter cpp references a * pointer to storage; If the pointer is null, then the necessary * storage is allocated. The last parameter is the max allowed length * of the string as specified by a protocol. @@ -370,13 +370,13 @@ xdr_string (XDR *xdrs, char **cpp, unsigned int maxsize) switch (xdrs->x_op) { case XDR_FREE: - if (sp == NULL) + if (sp == nullptr) { return TRUE; /* already free */ } /* fall through... */ case XDR_ENCODE: - if (sp == NULL) + if (sp == nullptr) return FALSE; size = strlen (sp); break; @@ -404,9 +404,9 @@ xdr_string (XDR *xdrs, char **cpp, unsigned int maxsize) { return TRUE; } - if (sp == NULL) + if (sp == nullptr) *cpp = sp = (char *) malloc (nodesize); - if (sp == NULL) + if (sp == nullptr) { (void) fputs ("xdr_string: out of memory\n", stderr); return FALSE; @@ -419,7 +419,7 @@ xdr_string (XDR *xdrs, char **cpp, unsigned int maxsize) case XDR_FREE: free (sp); - *cpp = NULL; + *cpp = nullptr; return TRUE; } return FALSE; @@ -660,7 +660,7 @@ xdrstdio_inline (XDR * /*xdrs*/, int /*len*/) * most of the gains to be had here and require storage * management on this buffer, so we don't do this. */ - return NULL; + return nullptr; } static bool_t diff --git a/src/MLIAP/compute_mliap.cpp b/src/MLIAP/compute_mliap.cpp index 956cb0196f1f0758a8495ee487d8f3e700cbf353..fe406772cab42cac0201c25f60c22a2b9b43bb7b 100644 --- a/src/MLIAP/compute_mliap.cpp +++ b/src/MLIAP/compute_mliap.cpp @@ -34,8 +34,8 @@ using namespace LAMMPS_NS; enum{SCALAR,VECTOR,ARRAY}; ComputeMLIAP::ComputeMLIAP(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), mliaparray(NULL), - mliaparrayall(NULL), map(NULL) + Compute(lmp, narg, arg), mliaparray(nullptr), + mliaparrayall(nullptr), map(nullptr) { array_flag = 1; extarray = 0; @@ -127,7 +127,7 @@ ComputeMLIAP::~ComputeMLIAP() void ComputeMLIAP::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute mliap requires a pair style be defined"); if (descriptor->cutmax > force->pair->cutforce) diff --git a/src/MLIAP/mliap_data.cpp b/src/MLIAP/mliap_data.cpp index a7e50012cb484e8529fe2e1c16a04d68e46355cf..cb29dffd469cb45a1d45d77166ab0d216c4c7cb0 100644 --- a/src/MLIAP/mliap_data.cpp +++ b/src/MLIAP/mliap_data.cpp @@ -25,10 +25,10 @@ MLIAPData::MLIAPData(LAMMPS *lmp, int gradgradflag_in, int *map_in, class MLIAPModel* model_in, class MLIAPDescriptor* descriptor_in, class PairMLIAP* pairmliap_in) : - Pointers(lmp), gradforce(NULL), betas(NULL), descriptors(NULL), gamma(NULL), - gamma_row_index(NULL), gamma_col_index(NULL), egradient(NULL), - numneighs(NULL), iatoms(NULL), ielems(NULL), jatoms(NULL), jelems(NULL), - rij(NULL), graddesc(NULL), model(NULL), descriptor(NULL), list(NULL) + Pointers(lmp), gradforce(nullptr), betas(nullptr), descriptors(nullptr), gamma(nullptr), + gamma_row_index(nullptr), gamma_col_index(nullptr), egradient(nullptr), + numneighs(nullptr), iatoms(nullptr), ielems(nullptr), jatoms(nullptr), jelems(nullptr), + rij(nullptr), graddesc(nullptr), model(nullptr), descriptor(nullptr), list(nullptr) { gradgradflag = gradgradflag_in; map = map_in; diff --git a/src/MLIAP/mliap_data.h b/src/MLIAP/mliap_data.h index 0307d93aee9dce5f96390a2beaf69daa463428fc..ffac9ccd4ca13337489ae64ba970f06c40f6ca9d 100644 --- a/src/MLIAP/mliap_data.h +++ b/src/MLIAP/mliap_data.h @@ -21,7 +21,7 @@ namespace LAMMPS_NS { class MLIAPData : protected Pointers { public: - MLIAPData(class LAMMPS*, int, int*, class MLIAPModel*, class MLIAPDescriptor*, class PairMLIAP* = NULL); + MLIAPData(class LAMMPS*, int, int*, class MLIAPModel*, class MLIAPDescriptor*, class PairMLIAP* = nullptr); ~MLIAPData(); void init(); diff --git a/src/MLIAP/mliap_descriptor_snap.cpp b/src/MLIAP/mliap_descriptor_snap.cpp index 5f0ee33c8c4e23d48d035fcfc0b1a61e7100c0e2..21ba68e9a80410429069f1c3e88f8d93987a1ae1 100644 --- a/src/MLIAP/mliap_descriptor_snap.cpp +++ b/src/MLIAP/mliap_descriptor_snap.cpp @@ -35,10 +35,10 @@ MLIAPDescriptorSNAP::MLIAPDescriptorSNAP(LAMMPS *lmp, char *paramfilename): MLIAPDescriptor(lmp) { nelements = 0; - elements = NULL; - radelem = NULL; - wjelem = NULL; - snaptr = NULL; + elements = nullptr; + radelem = nullptr; + wjelem = nullptr; + snaptr = nullptr; read_paramfile(paramfilename); snaptr = new SNA(lmp, rfac0, twojmax, @@ -374,7 +374,7 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) FILE *fpparam; if (comm->me == 0) { fpparam = utils::open_potential(paramfilename,lmp,nullptr); - if (fpparam == NULL) + if (fpparam == nullptr) error->one(FLERR,fmt::format("Cannot open SNAP parameter file {}: {}", paramfilename, utils::getsyserror())); } @@ -386,7 +386,7 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpparam); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpparam); } else n = strlen(line) + 1; @@ -406,7 +406,7 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) // strip single and double quotes from words char* keywd = strtok(line,"' \t\n\r\f"); - char* keyval = strtok(NULL,"' \t\n\r\f"); + char* keyval = strtok(nullptr,"' \t\n\r\f"); if (comm->me == 0) { utils::logmesg(lmp, fmt::format("SNAP keyword {} {} \n", keywd, keyval)); @@ -427,19 +427,19 @@ void MLIAPDescriptorSNAP::read_paramfile(char *paramfilename) int n = strlen(elemtmp) + 1; elements[ielem] = new char[n]; strcpy(elements[ielem],elemtmp); - keyval = strtok(NULL,"' \t\n\r\f"); + keyval = strtok(nullptr,"' \t\n\r\f"); } elementsflag = 1; } else if (strcmp(keywd,"radelems") == 0) { for (int ielem = 0; ielem < nelements; ielem++) { radelem[ielem] = atof(keyval); - keyval = strtok(NULL,"' \t\n\r\f"); + keyval = strtok(nullptr,"' \t\n\r\f"); } radelemflag = 1; } else if (strcmp(keywd,"welems") == 0) { for (int ielem = 0; ielem < nelements; ielem++) { wjelem[ielem] = atof(keyval); - keyval = strtok(NULL,"' \t\n\r\f"); + keyval = strtok(nullptr,"' \t\n\r\f"); } wjelemflag = 1; } diff --git a/src/MLIAP/mliap_model.cpp b/src/MLIAP/mliap_model.cpp index b731e1c9f809e27c8644484d817582c6681898a7..7ac1013c4feddade46b5f4b1d607ef8eabb8d91b 100644 --- a/src/MLIAP/mliap_model.cpp +++ b/src/MLIAP/mliap_model.cpp @@ -28,7 +28,7 @@ using namespace LAMMPS_NS; MLIAPModel::MLIAPModel(LAMMPS* lmp, char* coefffilename) : Pointers(lmp) { - coeffelem = NULL; + coeffelem = nullptr; if (coefffilename) read_coeffs(coefffilename); else { nparams = 0; @@ -81,7 +81,7 @@ void MLIAPModel::read_coeffs(char *coefffilename) FILE *fpcoeff; if (comm->me == 0) { fpcoeff = utils::open_potential(coefffilename,lmp,nullptr); - if (fpcoeff == NULL) + if (fpcoeff == nullptr) error->one(FLERR,fmt::format("Cannot open MLIAPModel coeff file {}: {}", coefffilename,utils::getsyserror())); } @@ -94,7 +94,7 @@ void MLIAPModel::read_coeffs(char *coefffilename) while (nwords == 0) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpcoeff); } else n = strlen(line) + 1; @@ -119,7 +119,7 @@ void MLIAPModel::read_coeffs(char *coefffilename) int iword = 0; words[iword] = strtok(line,"' \t\n\r\f"); iword = 1; - words[iword] = strtok(NULL,"' \t\n\r\f"); + words[iword] = strtok(nullptr,"' \t\n\r\f"); nelements = atoi(words[0]); nparams = atoi(words[1]); @@ -134,7 +134,7 @@ void MLIAPModel::read_coeffs(char *coefffilename) for (int icoeff = 0; icoeff < nparams; icoeff++) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpcoeff); } else n = strlen(line) + 1; diff --git a/src/MLIAP/mliap_model_quadratic.h b/src/MLIAP/mliap_model_quadratic.h index 188d78661fcbec7803abfa7993c81b324de85dfd..b41df18a078283517409157273f02626bf1c78d9 100644 --- a/src/MLIAP/mliap_model_quadratic.h +++ b/src/MLIAP/mliap_model_quadratic.h @@ -20,7 +20,7 @@ namespace LAMMPS_NS { class MLIAPModelQuadratic : public MLIAPModel { public: - MLIAPModelQuadratic(LAMMPS*, char* = NULL); + MLIAPModelQuadratic(LAMMPS*, char* = nullptr); ~MLIAPModelQuadratic(); virtual int get_nparams(); virtual int get_gamma_nnz(class MLIAPData*); diff --git a/src/MOLECULE/angle_charmm.cpp b/src/MOLECULE/angle_charmm.cpp index 6cd550384d61c6e2a64d7310afdc1146dfcd53da..61051084bb34ed46b2ed10730c06ae33c5cf046a 100644 --- a/src/MOLECULE/angle_charmm.cpp +++ b/src/MOLECULE/angle_charmm.cpp @@ -246,10 +246,10 @@ void AngleCharmm::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k_ub[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&r_ub[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k_ub[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&r_ub[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/angle_cosine.cpp b/src/MOLECULE/angle_cosine.cpp index 0288a61d8330c3332d708267d2fc9d3165034b93..b4190d902de4b85faf67743f640d5dc7344ec9c7 100644 --- a/src/MOLECULE/angle_cosine.cpp +++ b/src/MOLECULE/angle_cosine.cpp @@ -194,7 +194,7 @@ void AngleCosine::read_restart(FILE *fp) { allocate(); - if (comm->me == 0) utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); + if (comm->me == 0) utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); for (int i = 1; i <= atom->nangletypes; i++) setflag[i] = 1; diff --git a/src/MOLECULE/angle_cosine_periodic.cpp b/src/MOLECULE/angle_cosine_periodic.cpp index 1a05edc20bf7a6992db08b23b30238dcc7f919ac..1cf0cb887327e2caa5b5c3902b7c8c68d882a643 100644 --- a/src/MOLECULE/angle_cosine_periodic.cpp +++ b/src/MOLECULE/angle_cosine_periodic.cpp @@ -247,9 +247,9 @@ void AngleCosinePeriodic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&b[1],sizeof(int),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&b[1],sizeof(int),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/angle_cosine_squared.cpp b/src/MOLECULE/angle_cosine_squared.cpp index 5fb40b54c9dff1890e5e8d5c7967bd870e5e8365..dc1a20fd8b0adf0b2867c86c4411aab88107df44 100644 --- a/src/MOLECULE/angle_cosine_squared.cpp +++ b/src/MOLECULE/angle_cosine_squared.cpp @@ -37,8 +37,8 @@ using namespace MathConst; AngleCosineSquared::AngleCosineSquared(LAMMPS *lmp) : Angle(lmp) { - k = NULL; - theta0 = NULL; + k = nullptr; + theta0 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -216,8 +216,8 @@ void AngleCosineSquared::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/angle_harmonic.cpp b/src/MOLECULE/angle_harmonic.cpp index eb5e48ec9b87c7b9d617596833d0b6cc861724ed..19142f94c87843148957766f931e45f57b2ddc25 100644 --- a/src/MOLECULE/angle_harmonic.cpp +++ b/src/MOLECULE/angle_harmonic.cpp @@ -33,8 +33,8 @@ using namespace MathConst; AngleHarmonic::AngleHarmonic(LAMMPS *lmp) : Angle(lmp) { - k = NULL; - theta0 = NULL; + k = nullptr; + theta0 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -216,8 +216,8 @@ void AngleHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/angle_table.cpp b/src/MOLECULE/angle_table.cpp index 100b75cb0a1d7399fa99929cb959c717e7f1b9c3..6e47bf787721737c9b2321276ca93d221fd894f7 100644 --- a/src/MOLECULE/angle_table.cpp +++ b/src/MOLECULE/angle_table.cpp @@ -47,7 +47,7 @@ AngleTable::AngleTable(LAMMPS *lmp) : Angle(lmp) { writedata = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- */ @@ -205,7 +205,7 @@ void AngleTable::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -311,8 +311,8 @@ void AngleTable::write_restart_settings(FILE *fp) void AngleTable::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); MPI_Bcast(&tablength,1,MPI_INT,0,world); @@ -351,10 +351,10 @@ double AngleTable::single(int type, int i1, int i2, int i3) void AngleTable::null_table(Table *tb) { - tb->afile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->ang = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->afile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->ang = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/atom_vec_angle.cpp b/src/MOLECULE/atom_vec_angle.cpp index 3f7e31dcb297703f8fc41197222b895d7a745dc7..3c69f30addaafa622638332e0eb1a781dde24d67 100644 --- a/src/MOLECULE/atom_vec_angle.cpp +++ b/src/MOLECULE/atom_vec_angle.cpp @@ -55,7 +55,7 @@ AtomVecAngle::AtomVecAngle(LAMMPS *lmp) : AtomVec(lmp) setup_fields(); bond_per_atom = angle_per_atom = 0; - bond_negative = angle_negative = NULL; + bond_negative = angle_negative = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/atom_vec_bond.cpp b/src/MOLECULE/atom_vec_bond.cpp index 7801b4e4e1ce096700aa2f4d928a2e27deb61799..a61a7f9f0573beb38a26d4fab75c60d28ac8865a 100644 --- a/src/MOLECULE/atom_vec_bond.cpp +++ b/src/MOLECULE/atom_vec_bond.cpp @@ -50,7 +50,7 @@ AtomVecBond::AtomVecBond(LAMMPS *lmp) : AtomVec(lmp) setup_fields(); bond_per_atom = 0; - bond_negative = NULL; + bond_negative = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/atom_vec_full.cpp b/src/MOLECULE/atom_vec_full.cpp index 8f3f06a01407841767758ce1771609bdded94898..5ec0df9af8115971bd77c7447d0f57c8adea5b75 100644 --- a/src/MOLECULE/atom_vec_full.cpp +++ b/src/MOLECULE/atom_vec_full.cpp @@ -75,7 +75,7 @@ AtomVecFull::AtomVecFull(LAMMPS *lmp) : AtomVec(lmp) setup_fields(); bond_per_atom = angle_per_atom = dihedral_per_atom = improper_per_atom = 0; - bond_negative = angle_negative = dihedral_negative = improper_negative = NULL; + bond_negative = angle_negative = dihedral_negative = improper_negative = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/atom_vec_molecular.cpp b/src/MOLECULE/atom_vec_molecular.cpp index 426e4e20dd7154e6a9edba17311c8857faa5352b..26bb7b3e5aa44fe2367e9b5e046ad491478ddb0c 100644 --- a/src/MOLECULE/atom_vec_molecular.cpp +++ b/src/MOLECULE/atom_vec_molecular.cpp @@ -75,7 +75,7 @@ AtomVecMolecular::AtomVecMolecular(LAMMPS *lmp) : AtomVec(lmp) setup_fields(); bond_per_atom = angle_per_atom = dihedral_per_atom = improper_per_atom = 0; - bond_negative = angle_negative = dihedral_negative = improper_negative = NULL; + bond_negative = angle_negative = dihedral_negative = improper_negative = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/bond_fene.cpp b/src/MOLECULE/bond_fene.cpp index b2271d45fcf0fd78df8580288358473cc8653f11..f79c56b636e9de573071a5329ab407b1e253b325 100644 --- a/src/MOLECULE/bond_fene.cpp +++ b/src/MOLECULE/bond_fene.cpp @@ -215,10 +215,10 @@ void BondFENE::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&epsilon[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&sigma[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&epsilon[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&sigma[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -279,5 +279,5 @@ void *BondFENE::extract(const char *str, int &dim) dim = 1; if (strcmp(str,"kappa")==0) return (void*) k; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/bond_fene_expand.cpp b/src/MOLECULE/bond_fene_expand.cpp index 676d5f6871eeb31a144892156aff6a396ad6ac5a..8166e63e246845b07550fb90cf80735911aaf688 100644 --- a/src/MOLECULE/bond_fene_expand.cpp +++ b/src/MOLECULE/bond_fene_expand.cpp @@ -225,11 +225,11 @@ void BondFENEExpand::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&epsilon[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&sigma[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&shift[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&epsilon[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&sigma[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&shift[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/bond_gromos.cpp b/src/MOLECULE/bond_gromos.cpp index 89b3830cb53adc2678e876347827354ad5534687..85653a60f3723af70dab2b5d5603d51192624193 100644 --- a/src/MOLECULE/bond_gromos.cpp +++ b/src/MOLECULE/bond_gromos.cpp @@ -167,8 +167,8 @@ void BondGromos::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -204,5 +204,5 @@ void *BondGromos::extract(const char *str, int &dim) dim = 1; if (strcmp(str,"kappa")==0) return (void*) k; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/bond_harmonic.cpp b/src/MOLECULE/bond_harmonic.cpp index 28100512a8c398c6cfea283c480f96df0fc9652a..6e523b492386e23eb53a044720a1556ad3b185fb 100644 --- a/src/MOLECULE/bond_harmonic.cpp +++ b/src/MOLECULE/bond_harmonic.cpp @@ -168,8 +168,8 @@ void BondHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -208,7 +208,7 @@ void *BondHarmonic::extract(const char *str, int &dim) dim = 1; if (strcmp(str,"kappa")==0) return (void*) k; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/bond_morse.cpp b/src/MOLECULE/bond_morse.cpp index 49074e1cdc393430f16f3da262c0cba29aa68c1a..f7e4e6c9194094f89421d5756d910652147a439c 100644 --- a/src/MOLECULE/bond_morse.cpp +++ b/src/MOLECULE/bond_morse.cpp @@ -173,9 +173,9 @@ void BondMorse::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&d0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&alpha[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&d0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&alpha[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&d0[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&alpha[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -213,5 +213,5 @@ void *BondMorse::extract(const char *str, int &dim) { dim = 1; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/bond_nonlinear.cpp b/src/MOLECULE/bond_nonlinear.cpp index 63b640730af0651775c862af628ff5ee6044b8cd..7c74d8f418db747da1e607fa5f92f6f6fd27d725 100644 --- a/src/MOLECULE/bond_nonlinear.cpp +++ b/src/MOLECULE/bond_nonlinear.cpp @@ -168,9 +168,9 @@ void BondNonlinear::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&epsilon[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&lamda[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&epsilon[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&lamda[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&epsilon[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -211,5 +211,5 @@ void *BondNonlinear::extract(const char *str, int &dim) dim = 1; if (strcmp(str,"epsilon")==0) return (void*) epsilon; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/bond_quartic.cpp b/src/MOLECULE/bond_quartic.cpp index dc75df74ab5efa71c2ab662626762161259142f9..e2c2e8f74212250393a6892a2a201d7157f9803a 100644 --- a/src/MOLECULE/bond_quartic.cpp +++ b/src/MOLECULE/bond_quartic.cpp @@ -229,7 +229,7 @@ void BondQuartic::coeff(int narg, char **arg) void BondQuartic::init_style() { - if (force->pair == NULL || force->pair->single_enable == 0) + if (force->pair == nullptr || force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support bond_style quartic"); if (force->angle || force->dihedral || force->improper) error->all(FLERR, @@ -276,11 +276,11 @@ void BondQuartic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&b1[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&b2[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&rc[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&u0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&b1[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&b2[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&rc[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&u0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&b1[1],atom->nbondtypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/bond_table.cpp b/src/MOLECULE/bond_table.cpp index 5cc91ceae09c2a88f8ced4a97648ed66d0f176e0..a7fbbb84d7919cf3cfa47714a0294bf48ca89792 100644 --- a/src/MOLECULE/bond_table.cpp +++ b/src/MOLECULE/bond_table.cpp @@ -43,7 +43,7 @@ BondTable::BondTable(LAMMPS *lmp) : Bond(lmp) { writedata = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- */ @@ -157,7 +157,7 @@ void BondTable::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -254,8 +254,8 @@ void BondTable::write_restart_settings(FILE *fp) void BondTable::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); MPI_Bcast(&tablength,1,MPI_INT,0,world); @@ -278,10 +278,10 @@ double BondTable::single(int type, double rsq, int /*i*/, int /*j*/, void BondTable::null_table(Table *tb) { - tb->rfile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->r = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->rfile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->r = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/MOLECULE/dihedral_charmm.cpp b/src/MOLECULE/dihedral_charmm.cpp index 11422e0820df1101d0af4bf09629c971f40aae8f..cc615213a0727d809e2fd29580f83b6eac63c8da 100644 --- a/src/MOLECULE/dihedral_charmm.cpp +++ b/src/MOLECULE/dihedral_charmm.cpp @@ -389,7 +389,7 @@ void DihedralCharmm::init_style() " dihedral style charmm for use with CHARMM pair styles"); int itmp; - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Dihedral charmm is incompatible with Pair style"); lj14_1 = (double **) force->pair->extract("lj14_1",itmp); lj14_2 = (double **) force->pair->extract("lj14_2",itmp); @@ -424,11 +424,11 @@ void DihedralCharmm::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&shift[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&weight[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&weightflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&shift[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&weight[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&weightflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&k[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&multiplicity[1],atom->ndihedraltypes,MPI_INT,0,world); diff --git a/src/MOLECULE/dihedral_charmmfsw.cpp b/src/MOLECULE/dihedral_charmmfsw.cpp index 408be8ef9986cc633234dffd8610480e02308248..a124212117c704b34754663c1e807aee1e048cc1 100644 --- a/src/MOLECULE/dihedral_charmmfsw.cpp +++ b/src/MOLECULE/dihedral_charmmfsw.cpp @@ -407,7 +407,7 @@ void DihedralCharmmfsw::init_style() " dihedral style charmm for use with CHARMM pair styles"); int itmp; - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Dihedral charmmfsw is incompatible with Pair style"); lj14_1 = (double **) force->pair->extract("lj14_1",itmp); lj14_2 = (double **) force->pair->extract("lj14_2",itmp); @@ -428,8 +428,8 @@ void DihedralCharmmfsw::init_style() double *p_cutlj = (double *) force->pair->extract("cut_lj",itmp); double *p_cutcoul = (double *) force->pair->extract("cut_coul",itmp); - if (p_cutcoul == NULL || p_cutljinner == NULL || - p_cutlj == NULL || p_dihedflag == NULL) + if (p_cutcoul == nullptr || p_cutljinner == nullptr || + p_cutlj == nullptr || p_dihedflag == nullptr) error->all(FLERR,"Dihedral charmmfsw is incompatible with Pair style"); dihedflag = *p_dihedflag; @@ -467,11 +467,11 @@ void DihedralCharmmfsw::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&shift[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&weight[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&weightflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&shift[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&weight[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&weightflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&k[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&multiplicity[1],atom->ndihedraltypes,MPI_INT,0,world); diff --git a/src/MOLECULE/dihedral_harmonic.cpp b/src/MOLECULE/dihedral_harmonic.cpp index 55e2f250061dcf680e82d4f322dbdfb39b5dd220..87ade01be31279a2a3f975ffaffd401721c3e9db 100644 --- a/src/MOLECULE/dihedral_harmonic.cpp +++ b/src/MOLECULE/dihedral_harmonic.cpp @@ -328,9 +328,9 @@ void DihedralHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&sign[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&sign[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&sign[1],atom->ndihedraltypes,MPI_INT,0,world); diff --git a/src/MOLECULE/dihedral_helix.cpp b/src/MOLECULE/dihedral_helix.cpp index 40e026c2f1f45059ecc310d1b2c6708e89335897..8c4ba07fb635eb8a15d9bd7d0784fb0cf1eb0940 100644 --- a/src/MOLECULE/dihedral_helix.cpp +++ b/src/MOLECULE/dihedral_helix.cpp @@ -323,9 +323,9 @@ void DihedralHelix::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&aphi[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&bphi[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&cphi[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&aphi[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&bphi[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&cphi[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&aphi[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&bphi[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/dihedral_multi_harmonic.cpp b/src/MOLECULE/dihedral_multi_harmonic.cpp index 963304da80ad884054929f00c252f2f4f16a60c4..57c017bd95e70a57877ecd2c0484e5655028d94c 100644 --- a/src/MOLECULE/dihedral_multi_harmonic.cpp +++ b/src/MOLECULE/dihedral_multi_harmonic.cpp @@ -319,11 +319,11 @@ void DihedralMultiHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&a1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&a2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&a3[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&a4[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&a5[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&a1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&a2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&a3[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&a4[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&a5[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&a1[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&a2[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/dihedral_opls.cpp b/src/MOLECULE/dihedral_opls.cpp index fe05dc7c3d0a1cf3fb9df28eda21b1679f85a5f4..39b979ff238e00e50f90ab40b8a261a976fd4ca4 100644 --- a/src/MOLECULE/dihedral_opls.cpp +++ b/src/MOLECULE/dihedral_opls.cpp @@ -331,10 +331,10 @@ void DihedralOPLS::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k1[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&k2[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&k3[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&k4[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&k1[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&k3[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&k4[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&k1[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&k2[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/fix_cmap.cpp b/src/MOLECULE/fix_cmap.cpp index 85146b69e1ed97ce41d6edafa45e50e42d0918a6..a37f74f5c2b330c80c9f14e4d38aa78daf998574 100644 --- a/src/MOLECULE/fix_cmap.cpp +++ b/src/MOLECULE/fix_cmap.cpp @@ -62,11 +62,11 @@ using namespace MathConst; FixCMAP::FixCMAP(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - crosstermlist(NULL), num_crossterm(NULL), crossterm_type(NULL), - crossterm_atom1(NULL), crossterm_atom2(NULL), crossterm_atom3(NULL), - crossterm_atom4(NULL), crossterm_atom5(NULL), - g_axis(NULL), cmapgrid(NULL), d1cmapgrid(NULL), d2cmapgrid(NULL), - d12cmapgrid(NULL) + crosstermlist(nullptr), num_crossterm(nullptr), crossterm_type(nullptr), + crossterm_atom1(nullptr), crossterm_atom2(nullptr), crossterm_atom3(nullptr), + crossterm_atom4(nullptr), crossterm_atom5(nullptr), + g_axis(nullptr), cmapgrid(nullptr), d1cmapgrid(nullptr), d2cmapgrid(nullptr), + d12cmapgrid(nullptr) { if (narg != 4) error->all(FLERR,"Illegal fix cmap command"); @@ -101,13 +101,13 @@ FixCMAP::FixCMAP(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - num_crossterm = NULL; - crossterm_type = NULL; - crossterm_atom1 = NULL; - crossterm_atom2 = NULL; - crossterm_atom3 = NULL; - crossterm_atom4 = NULL; - crossterm_atom5 = NULL; + num_crossterm = nullptr; + crossterm_type = nullptr; + crossterm_atom1 = nullptr; + crossterm_atom2 = nullptr; + crossterm_atom3 = nullptr; + crossterm_atom4 = nullptr; + crossterm_atom5 = nullptr; nmax_previous = 0; grow_arrays(atom->nmax); @@ -118,7 +118,7 @@ FixCMAP::FixCMAP(LAMMPS *lmp, int narg, char **arg) : ncmap = 0; maxcrossterm = 0; - crosstermlist = NULL; + crosstermlist = nullptr; } /* --------------------------------------------------------------------- */ @@ -631,10 +631,10 @@ void FixCMAP::read_grid_map(char *cmapfile) char *chunk,*line; int i1, i2, i3, i4, i5, i6, j1, j2, j3, j4, j5, j6, counter; - FILE *fp = NULL; + FILE *fp = nullptr; if (comm->me == 0) { fp = utils::open_potential(cmapfile,lmp,nullptr); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix cmap file {}: {}", cmapfile, utils::getsyserror())); @@ -654,7 +654,7 @@ void FixCMAP::read_grid_map(char *cmapfile) while (!done) { // only read on rank 0 and broadcast to all other ranks if (comm->me == 0) - done = (fgets(linebuf,MAXLINE,fp) == NULL); + done = (fgets(linebuf,MAXLINE,fp) == nullptr); MPI_Bcast(&done,1,MPI_INT,0,world); if (done) continue; @@ -681,13 +681,13 @@ void FixCMAP::read_grid_map(char *cmapfile) // 6. Glycine before proline map chunk = strtok(line, " \r\n"); - while (chunk != NULL) { + while (chunk != nullptr) { // alanine map if (counter < CMAPDIM*CMAPDIM) { cmapgrid[0][i1][j1] = atof(chunk); - chunk = strtok(NULL, " \r\n"); + chunk = strtok(nullptr, " \r\n"); j1++; if (j1 == CMAPDIM) { j1 = 0; @@ -701,7 +701,7 @@ void FixCMAP::read_grid_map(char *cmapfile) else if (counter >= CMAPDIM*CMAPDIM && counter < 2*CMAPDIM*CMAPDIM) { cmapgrid[1][i2][j2]= atof(chunk); - chunk = strtok(NULL, " \r\n"); + chunk = strtok(nullptr, " \r\n"); j2++; if (j2 == CMAPDIM) { j2 = 0; @@ -715,7 +715,7 @@ void FixCMAP::read_grid_map(char *cmapfile) else if (counter >= 2*CMAPDIM*CMAPDIM && counter < 3*CMAPDIM*CMAPDIM) { cmapgrid[2][i3][j3] = atof(chunk); - chunk = strtok(NULL, " \r\n"); + chunk = strtok(nullptr, " \r\n"); j3++; if (j3 == CMAPDIM) { j3 = 0; @@ -729,7 +729,7 @@ void FixCMAP::read_grid_map(char *cmapfile) else if (counter >= 3*CMAPDIM*CMAPDIM && counter < 4*CMAPDIM*CMAPDIM) { cmapgrid[3][i4][j4] = atof(chunk); - chunk = strtok(NULL, " \r\n"); + chunk = strtok(nullptr, " \r\n"); j4++; if (j4 == CMAPDIM) { j4 = 0; @@ -743,7 +743,7 @@ void FixCMAP::read_grid_map(char *cmapfile) else if (counter >= 4*CMAPDIM*CMAPDIM && counter < 5*CMAPDIM*CMAPDIM) { cmapgrid[4][i5][j5] = atof(chunk); - chunk = strtok(NULL, " \r\n"); + chunk = strtok(nullptr, " \r\n"); j5++; if (j5 == CMAPDIM) { j5 = 0; @@ -757,7 +757,7 @@ void FixCMAP::read_grid_map(char *cmapfile) else if (counter >= 5*CMAPDIM*CMAPDIM && counter < 6*CMAPDIM*CMAPDIM) { cmapgrid[5][i6][j6] = atof(chunk); - chunk = strtok(NULL, " \r\n"); + chunk = strtok(nullptr, " \r\n"); j6++; if (j6 == CMAPDIM) { j6 = 0; diff --git a/src/MOLECULE/improper_cvff.cpp b/src/MOLECULE/improper_cvff.cpp index 90cf3eee3915584392491d4b569504971ca5355d..75eeb4a45af0e17697f0ef19983ff17c21fedac9 100644 --- a/src/MOLECULE/improper_cvff.cpp +++ b/src/MOLECULE/improper_cvff.cpp @@ -334,9 +334,9 @@ void ImproperCvff::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&sign[1],sizeof(int),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&sign[1],sizeof(int),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&sign[1],atom->nimpropertypes,MPI_INT,0,world); diff --git a/src/MOLECULE/improper_harmonic.cpp b/src/MOLECULE/improper_harmonic.cpp index 6327ea8b06476ff2c81d692fdf4eac0a58f51a7a..159574a12d8eee9415dfff0ed5ba3e6b14322e81 100644 --- a/src/MOLECULE/improper_harmonic.cpp +++ b/src/MOLECULE/improper_harmonic.cpp @@ -275,8 +275,8 @@ void ImproperHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/improper_umbrella.cpp b/src/MOLECULE/improper_umbrella.cpp index 7b2c4e0b09520238542d7bbf429f0a905565e2c3..7a7c07ab02f50de3f792e2657abf19ec10054622 100644 --- a/src/MOLECULE/improper_umbrella.cpp +++ b/src/MOLECULE/improper_umbrella.cpp @@ -316,9 +316,9 @@ void ImproperUmbrella::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&kw[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&w0[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&C[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&kw[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&w0[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&C[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&kw[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&w0[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/MOLECULE/pair_hbond_dreiding_lj.cpp b/src/MOLECULE/pair_hbond_dreiding_lj.cpp index a7be928819caba1bb0f0c21632ce5a920dbe6659..831e8edc1bfe7e26e2bf9fad84cde7712e0cd6ad 100644 --- a/src/MOLECULE/pair_hbond_dreiding_lj.cpp +++ b/src/MOLECULE/pair_hbond_dreiding_lj.cpp @@ -50,7 +50,7 @@ PairHbondDreidingLJ::PairHbondDreidingLJ(LAMMPS *lmp) : Pair(lmp) restartinfo = 0; nparams = maxparam = 0; - params = NULL; + params = nullptr; nextra = 2; pvector = new double[2]; diff --git a/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp b/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp index dea6bd62514e014aa211f85cf25b817831b9f702..9b3805a8b600163779490d1c110a7fd04f52389b 100644 --- a/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp +++ b/src/MOLECULE/pair_lj_charmm_coul_charmm.cpp @@ -375,14 +375,14 @@ void PairLJCharmmCoulCharmm::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -436,12 +436,12 @@ void PairLJCharmmCoulCharmm::write_restart_settings(FILE *fp) void PairLJCharmmCoulCharmm::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_inner,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj,1,MPI_DOUBLE,0,world); @@ -523,5 +523,5 @@ void *PairLJCharmmCoulCharmm::extract(const char *str, int &dim) dim = 0; if (strcmp(str,"implicit") == 0) return (void *) &implicit; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp b/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp index 31083312a9c2f72f3f59dd2008bf3a232d7e8665..c311c76f5578cd844bcf59763be9e0a0373e15a7 100644 --- a/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp +++ b/src/MOLECULE/pair_lj_charmmfsw_coul_charmmfsh.cpp @@ -433,14 +433,14 @@ void PairLJCharmmfswCoulCharmmfsh::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -470,11 +470,11 @@ void PairLJCharmmfswCoulCharmmfsh::write_restart_settings(FILE *fp) void PairLJCharmmfswCoulCharmmfsh::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_inner,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj,1,MPI_DOUBLE,0,world); @@ -560,5 +560,5 @@ void *PairLJCharmmfswCoulCharmmfsh::extract(const char *str, int &dim) if (strcmp(str,"cut_lj") == 0) return (void *) &cut_lj; if (strcmp(str,"dihedflag") == 0) return (void *) &dihedflag; - return NULL; + return nullptr; } diff --git a/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp b/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp index b5ed2557890980b38de4ded4378af87822cea327..d8ab817e7d426461b9165a1bc2ede50d05a1adc0 100644 --- a/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp +++ b/src/MOLECULE/pair_lj_cut_tip4p_cut.cpp @@ -43,8 +43,8 @@ PairLJCutTIP4PCut::PairLJCutTIP4PCut(LAMMPS *lmp) : Pair(lmp) writedata = 1; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -494,9 +494,9 @@ void PairLJCutTIP4PCut::init_style() if (!atom->q_flag) error->all(FLERR, "Pair style lj/cut/tip4p/cut requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); neighbor->request(this,instance_me); @@ -618,13 +618,13 @@ void PairLJCutTIP4PCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -660,17 +660,17 @@ void PairLJCutTIP4PCut::write_restart_settings(FILE *fp) void PairLJCutTIP4PCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); @@ -740,7 +740,7 @@ void *PairLJCutTIP4PCut::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- memory usage of hneigh diff --git a/src/MOLECULE/pair_tip4p_cut.cpp b/src/MOLECULE/pair_tip4p_cut.cpp index 8d8f5ec78ec5810ce7607aee5ac843bd321fa149..7757e96496f4432c01319c4b27663d4b0c9bd495 100644 --- a/src/MOLECULE/pair_tip4p_cut.cpp +++ b/src/MOLECULE/pair_tip4p_cut.cpp @@ -39,8 +39,8 @@ PairTIP4PCut::PairTIP4PCut(LAMMPS *lmp) : Pair(lmp) single_enable = 0; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -423,9 +423,9 @@ void PairTIP4PCut::init_style() if (!atom->q_flag) error->all(FLERR, "Pair style tip4p/cut requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); neighbor->request(this,instance_me); @@ -475,7 +475,7 @@ void PairTIP4PCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); } } @@ -502,13 +502,13 @@ void PairTIP4PCut::write_restart_settings(FILE *fp) void PairTIP4PCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); diff --git a/src/MPIIO/dump_atom_mpiio.cpp b/src/MPIIO/dump_atom_mpiio.cpp index 62d940af3717dc6e91aed907d346e61dce7145bf..812cec21a3cf15414ed106b4ecccded5a6c9da59 100644 --- a/src/MPIIO/dump_atom_mpiio.cpp +++ b/src/MPIIO/dump_atom_mpiio.cpp @@ -186,7 +186,7 @@ void DumpAtomMPIIO::write() } if (sort_flag && sortcol == 0) pack(ids); - else pack(NULL); + else pack(nullptr); if (sort_flag) sort(); // determine how much data needs to be written for setting the file size and prepocess it prior to writing diff --git a/src/MPIIO/dump_cfg_mpiio.cpp b/src/MPIIO/dump_cfg_mpiio.cpp index 6d5fc3da8e6f756a5446c2bcd2d713840c65e035..f598f2599845292c2b7340b168aeb1d70f78cd44 100644 --- a/src/MPIIO/dump_cfg_mpiio.cpp +++ b/src/MPIIO/dump_cfg_mpiio.cpp @@ -207,7 +207,7 @@ void DumpCFGMPIIO::write() } if (sort_flag && sortcol == 0) pack(ids); - else pack(NULL); + else pack(nullptr); if (sort_flag) sort(); // determine how much data needs to be written for setting the file size and prepocess it prior to writing diff --git a/src/MPIIO/dump_custom_mpiio.cpp b/src/MPIIO/dump_custom_mpiio.cpp index b623df82d086598f35ae2e18a298fce730f6ffdd..065b04801e49cad75ebe3cb1285b3ed1de3247de 100644 --- a/src/MPIIO/dump_custom_mpiio.cpp +++ b/src/MPIIO/dump_custom_mpiio.cpp @@ -202,7 +202,7 @@ void DumpCustomMPIIO::write() } if (sort_flag && sortcol == 0) pack(ids); - else pack(NULL); + else pack(nullptr); if (sort_flag) sort(); // determine how much data needs to be written for setting the file size and prepocess it prior to writing @@ -247,8 +247,8 @@ void DumpCustomMPIIO::init_style() char *ptr; for (int i = 0; i < size_one; i++) { if (i == 0) ptr = strtok(format," \0"); - else ptr = strtok(NULL," \0"); - if (ptr == NULL) error->all(FLERR,"Dump_modify format line is too short"); + else ptr = strtok(nullptr," \0"); + if (ptr == nullptr) error->all(FLERR,"Dump_modify format line is too short"); delete [] vformat[i]; if (format_column_user[i]) { diff --git a/src/MPIIO/dump_xyz_mpiio.cpp b/src/MPIIO/dump_xyz_mpiio.cpp index 139245e4b0ad8da087d88ed29523b3f1445710e6..959a454103153ea1bf0ad04996dbd35aa5383266 100644 --- a/src/MPIIO/dump_xyz_mpiio.cpp +++ b/src/MPIIO/dump_xyz_mpiio.cpp @@ -198,7 +198,7 @@ void DumpXYZMPIIO::write() } if (sort_flag && sortcol == 0) pack(ids); - else pack(NULL); + else pack(nullptr); if (sort_flag) sort(); // determine how much data needs to be written for setting the file size and prepocess it prior to writing @@ -239,7 +239,7 @@ void DumpXYZMPIIO::init_style() // initialize typenames array to be backward compatible by default // a 32-bit int can be maximally 10 digits plus sign - if (typenames == NULL) { + if (typenames == nullptr) { typenames = new char*[ntypes+1]; for (int itype = 1; itype <= ntypes; itype++) { typenames[itype] = new char[12]; diff --git a/src/MSCG/fix_mscg.cpp b/src/MSCG/fix_mscg.cpp index 29d6d550e415788e17a0cca646f72165517ba4d7..650c25cd4d0032568f0cf8d7f4a1860115704fbd 100644 --- a/src/MSCG/fix_mscg.cpp +++ b/src/MSCG/fix_mscg.cpp @@ -65,7 +65,7 @@ FixMSCG::FixMSCG(LAMMPS *lmp, int narg, char **arg) : nframes = n_frames = block_size = 0; range_flag = 0; name_flag = 0; - f = NULL; + f = nullptr; type_names = new char*[natoms]; for (int i = 0; i < natoms; i++) type_names[i] = new char[24]; diff --git a/src/PERI/compute_damage_atom.cpp b/src/PERI/compute_damage_atom.cpp index 8bea52f1cff68ad696df267c36781b7da985042f..9e4c886900448d0c9d8a683db124d965336cb6bb 100644 --- a/src/PERI/compute_damage_atom.cpp +++ b/src/PERI/compute_damage_atom.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeDamageAtom::ComputeDamageAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), damage(NULL) + Compute(lmp, narg, arg), damage(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute damage/atom command"); diff --git a/src/PERI/compute_dilatation_atom.cpp b/src/PERI/compute_dilatation_atom.cpp index 65a25cda03174fd2a0d20fbdc39e96ed42efc181..bf8d345f29bcb27d593bdeba6dd5730682838580 100644 --- a/src/PERI/compute_dilatation_atom.cpp +++ b/src/PERI/compute_dilatation_atom.cpp @@ -43,7 +43,7 @@ ComputeDilatationAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - dilatation = NULL; + dilatation = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/PERI/compute_plasticity_atom.cpp b/src/PERI/compute_plasticity_atom.cpp index d90e2115069ee4fd0ba07025fe4fd6807e7086e6..5d0d554986b13a5eb021a5b679f3e707e932dd74 100644 --- a/src/PERI/compute_plasticity_atom.cpp +++ b/src/PERI/compute_plasticity_atom.cpp @@ -44,7 +44,7 @@ ComputePlasticityAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - plasticity = NULL; + plasticity = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/PERI/fix_peri_neigh.cpp b/src/PERI/fix_peri_neigh.cpp index 784947a0b33be849251fccda4a6e0da447744002..f799221d1e1b7358e6f4f33f5699ee13aebd855f 100644 --- a/src/PERI/fix_peri_neigh.cpp +++ b/src/PERI/fix_peri_neigh.cpp @@ -56,15 +56,15 @@ FixPeriNeigh::FixPeriNeigh(LAMMPS *lmp,int narg, char **arg) : // set maxpartner = 1 as placeholder maxpartner = 1; - npartner = NULL; - partner = NULL; - deviatorextention = NULL; - deviatorBackextention = NULL; - deviatorPlasticextension = NULL; - lambdaValue = NULL; - r0 = NULL; - vinter = NULL; - wvolume = NULL; + npartner = nullptr; + partner = nullptr; + deviatorextention = nullptr; + deviatorBackextention = nullptr; + deviatorPlasticextension = nullptr; + lambdaValue = nullptr; + r0 = nullptr; + vinter = nullptr; + wvolume = nullptr; grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); @@ -228,13 +228,13 @@ void FixPeriNeigh::setup(int /*vflag*/) memory->destroy(r0); memory->destroy(npartner); - npartner = NULL; - partner = NULL; - deviatorextention = NULL; - deviatorBackextention = NULL; - deviatorPlasticextension = NULL; - lambdaValue = NULL; - r0 = NULL; + npartner = nullptr; + partner = nullptr; + deviatorextention = nullptr; + deviatorBackextention = nullptr; + deviatorPlasticextension = nullptr; + lambdaValue = nullptr; + r0 = nullptr; grow_arrays(atom->nmax); // create partner list and r0 values from neighbor list @@ -301,9 +301,9 @@ void FixPeriNeigh::setup(int /*vflag*/) double **x0 = atom->x0; double half_lc = 0.5*(domain->lattice->xlattice); double vfrac_scale; - PairPeriLPS *pairlps = NULL; - PairPeriVES *pairves = NULL; - PairPeriEPS *paireps = NULL; + PairPeriLPS *pairlps = nullptr; + PairPeriVES *pairves = nullptr; + PairPeriEPS *paireps = nullptr; if (isLPS) pairlps = static_cast(anypair); else if (isVES) diff --git a/src/PERI/pair_peri_eps.cpp b/src/PERI/pair_peri_eps.cpp index 93d8eea92adad990d5ba7f3c6fcbd1b8a72d1792..33a75f506f12d82ffb189839ef5e9576bf6d9e0c 100644 --- a/src/PERI/pair_peri_eps.cpp +++ b/src/PERI/pair_peri_eps.cpp @@ -47,14 +47,14 @@ PairPeriEPS::PairPeriEPS(LAMMPS *lmp) : Pair(lmp) ifix_peri = -1; nmax = -1; - s0_new = NULL; - theta = NULL; + s0_new = nullptr; + theta = nullptr; - bulkmodulus = NULL; - shearmodulus = NULL; - s00 = alpha = NULL; - cut = NULL; - m_yieldstress = NULL; + bulkmodulus = nullptr; + shearmodulus = nullptr; + s00 = alpha = nullptr; + cut = nullptr; + m_yieldstress = nullptr; // set comm size needed by this Pair // comm_reverse not needed @@ -219,7 +219,7 @@ void PairPeriEPS::compute(int eflag, int vflag) // ******** temp array to store Plastic extension *********** /// // create on heap to reduce stack use and to allow for faster zeroing - double **deviatorPlasticExtTemp = NULL; + double **deviatorPlasticExtTemp = nullptr; if (nlocal*maxpartner > 0) { memory->create(deviatorPlasticExtTemp,nlocal,maxpartner,"pair:plastext"); memset(&(deviatorPlasticExtTemp[0][0]),0,sizeof(double)*nlocal*maxpartner); @@ -505,7 +505,7 @@ void PairPeriEPS::init_style() if (atom->map_style == Atom::MAP_NONE) error->all(FLERR,"Pair peri requires an atom map, see atom_modify"); - if (domain->lattice == NULL) + if (domain->lattice == nullptr) error->all(FLERR,"Pair peri requires a lattice be defined"); if (domain->lattice->xlattice != domain->lattice->ylattice || domain->lattice->xlattice != domain->lattice->zlattice || @@ -559,16 +559,16 @@ void PairPeriEPS::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&bulkmodulus[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shearmodulus[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&m_yieldstress[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&bulkmodulus[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shearmodulus[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&m_yieldstress[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&bulkmodulus[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&shearmodulus[i][j],1,MPI_DOUBLE,0,world); diff --git a/src/PERI/pair_peri_lps.cpp b/src/PERI/pair_peri_lps.cpp index 41d140a216e848d18bb753232186750c125e605b..be16dfe925fe6e725995da3da9b29249e4c789fc 100644 --- a/src/PERI/pair_peri_lps.cpp +++ b/src/PERI/pair_peri_lps.cpp @@ -45,13 +45,13 @@ PairPeriLPS::PairPeriLPS(LAMMPS *lmp) : Pair(lmp) ifix_peri = -1; nmax = 0; - s0_new = NULL; - theta = NULL; + s0_new = nullptr; + theta = nullptr; - bulkmodulus = NULL; - shearmodulus = NULL; - s00 = alpha = NULL; - cut = NULL; + bulkmodulus = nullptr; + shearmodulus = nullptr; + s00 = alpha = nullptr; + cut = nullptr; // set comm size needed by this Pair // comm_reverse not needed @@ -481,15 +481,15 @@ void PairPeriLPS::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&bulkmodulus[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shearmodulus[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&bulkmodulus[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shearmodulus[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&bulkmodulus[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&shearmodulus[i][j],1,MPI_DOUBLE,0,world); diff --git a/src/PERI/pair_peri_pmb.cpp b/src/PERI/pair_peri_pmb.cpp index 14e9c8bc2831046ddaaa7eb4ace1f63c2c6fa824..38fe7f16703fef2764a1760cb1b6a2d8a3a4713b 100644 --- a/src/PERI/pair_peri_pmb.cpp +++ b/src/PERI/pair_peri_pmb.cpp @@ -44,12 +44,12 @@ PairPeriPMB::PairPeriPMB(LAMMPS *lmp) : Pair(lmp) ifix_peri = -1; nmax = 0; - s0_new = NULL; + s0_new = nullptr; - kspring = NULL; - s00 = NULL; - alpha = NULL; - cut = NULL; + kspring = nullptr; + s00 = nullptr; + alpha = nullptr; + cut = nullptr; } /* ---------------------------------------------------------------------- */ @@ -410,14 +410,14 @@ void PairPeriPMB::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&kspring[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&kspring[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&kspring[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&s00[i][j],1,MPI_DOUBLE,0,world); diff --git a/src/PERI/pair_peri_ves.cpp b/src/PERI/pair_peri_ves.cpp index e50b6b4168944e091f63bece400e400df8ab2cfe..ae18a3e41909d2e3394ba1e4701909e6966111cc 100644 --- a/src/PERI/pair_peri_ves.cpp +++ b/src/PERI/pair_peri_ves.cpp @@ -45,15 +45,15 @@ PairPeriVES::PairPeriVES(LAMMPS *lmp) : Pair(lmp) ifix_peri = -1; nmax = 0; - s0_new = NULL; - theta = NULL; + s0_new = nullptr; + theta = nullptr; - bulkmodulus = NULL; - shearmodulus = NULL; - s00 = alpha = NULL; - cut = NULL; - m_lambdai = NULL; - m_taubi = NULL; + bulkmodulus = nullptr; + shearmodulus = nullptr; + s00 = alpha = nullptr; + cut = nullptr; + m_lambdai = nullptr; + m_taubi = nullptr; // set comm size needed by this Pair // comm_reverse not needed @@ -484,7 +484,7 @@ void PairPeriVES::init_style() if (atom->map_style == Atom::MAP_NONE) error->all(FLERR,"Pair peri requires an atom map, see atom_modify"); - if (domain->lattice == NULL) + if (domain->lattice == nullptr) error->all(FLERR,"Pair peri requires a lattice be defined"); if (domain->lattice->xlattice != domain->lattice->ylattice || domain->lattice->xlattice != domain->lattice->zlattice || @@ -539,17 +539,17 @@ void PairPeriVES::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&bulkmodulus[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shearmodulus[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&m_lambdai[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&m_taubi[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&bulkmodulus[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shearmodulus[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&s00[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&m_lambdai[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&m_taubi[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&bulkmodulus[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&shearmodulus[i][j],1,MPI_DOUBLE,0,world); diff --git a/src/POEMS/fix_poems.cpp b/src/POEMS/fix_poems.cpp index 3bf305e9cb512aa0796cd88a84276097cb851aff..3b53c1abc478121cab717f892117c787b8d64d54 100644 --- a/src/POEMS/fix_poems.cpp +++ b/src/POEMS/fix_poems.cpp @@ -62,12 +62,12 @@ static const char cite_fix_poems[] = ------------------------------------------------------------------------- */ FixPOEMS::FixPOEMS(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), step_respa(NULL), natom2body(NULL), - atom2body(NULL), displace(NULL), nrigid(NULL), masstotal(NULL), - xcm(NULL), vcm(NULL), fcm(NULL), inertia(NULL), ex_space(NULL), - ey_space(NULL), ez_space(NULL), angmom(NULL), omega(NULL), - torque(NULL), sum(NULL), all(NULL), jointbody(NULL), - xjoint(NULL), freelist(NULL), poems(NULL) + Fix(lmp, narg, arg), step_respa(nullptr), natom2body(nullptr), + atom2body(nullptr), displace(nullptr), nrigid(nullptr), masstotal(nullptr), + xcm(nullptr), vcm(nullptr), fcm(nullptr), inertia(nullptr), ex_space(nullptr), + ey_space(nullptr), ez_space(nullptr), angmom(nullptr), omega(nullptr), + torque(nullptr), sum(nullptr), all(nullptr), jointbody(nullptr), + xjoint(nullptr), freelist(nullptr), poems(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_poems); @@ -84,9 +84,9 @@ FixPOEMS::FixPOEMS(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with atom class - natom2body = NULL; - atom2body = NULL; - displace = NULL; + natom2body = nullptr; + atom2body = nullptr; + displace = nullptr; grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); @@ -944,7 +944,7 @@ void FixPOEMS::readfile(char *file) if (me == 0) { fp = fopen(file,"r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix poems file %s",file); error->one(FLERR,str); @@ -952,7 +952,7 @@ void FixPOEMS::readfile(char *file) } nbody = 0; - char *line = NULL; + char *line = nullptr; int maxline = 0; char *ptr; int nlocal = atom->nlocal; @@ -965,10 +965,10 @@ void FixPOEMS::readfile(char *file) MPI_Bcast(line,nlen,MPI_CHAR,0,world); ptr = strtok(line," ,\t\n\0"); - if (ptr == NULL || ptr[0] == '#') continue; - ptr = strtok(NULL," ,\t\n\0"); + if (ptr == nullptr || ptr[0] == '#') continue; + ptr = strtok(nullptr," ,\t\n\0"); - while ((ptr = strtok(NULL," ,\t\n\0"))) { + while ((ptr = strtok(nullptr," ,\t\n\0"))) { id = atoi(ptr); i = atom->map(id); if (i < 0 || i >= nlocal) continue; @@ -995,7 +995,7 @@ int FixPOEMS::readline(FILE *fp, char **pline, int *pmaxline) maxline += DELTA; memory->grow(line,maxline,"fix_poems:line"); } - if (fgets(&line[n],maxline-n,fp) == NULL) { + if (fgets(&line[n],maxline-n,fp) == nullptr) { n = 0; break; } @@ -1030,7 +1030,7 @@ void FixPOEMS::jointbuild() mjoint += natom2body[i]-1; } - tagint **mylist = NULL; + tagint **mylist = nullptr; if (mjoint) memory->create(mylist,mjoint,3,"poems:mylist"); mjoint = 0; @@ -1047,7 +1047,7 @@ void FixPOEMS::jointbuild() // jlist = mylist concatenated across all procs via MPI_Allgatherv MPI_Allreduce(&mjoint,&njoint,1,MPI_INT,MPI_SUM,world); - tagint **jlist = NULL; + tagint **jlist = nullptr; if (njoint) memory->create(jlist,njoint,3,"poems:jlist"); int nprocs; @@ -1069,7 +1069,7 @@ void FixPOEMS::jointbuild() MPI_Allgatherv(mylist[0],3*mjoint,MPI_LMP_TAGINT,jlist[0], recvcounts,displs,MPI_LMP_TAGINT,world); else - MPI_Allgatherv(NULL,3*mjoint,MPI_LMP_TAGINT,jlist[0], + MPI_Allgatherv(nullptr,3*mjoint,MPI_LMP_TAGINT,jlist[0], recvcounts,displs,MPI_LMP_TAGINT,world); } @@ -1107,9 +1107,9 @@ void FixPOEMS::jointbuild() // each proc sets myjoint if it owns joint atom // MPI_Allreduce gives all procs the xjoint coords - jointbody = NULL; - xjoint = NULL; - double **myjoint = NULL; + jointbody = nullptr; + xjoint = nullptr; + double **myjoint = nullptr; if (njoint) { memory->create(jointbody,njoint,2,"poems:jointbody"); memory->create(xjoint,njoint,3,"poems:xjoint"); @@ -1146,7 +1146,7 @@ void FixPOEMS::jointbuild() for (i = 0; i < nbody; i++) if (mark[i]) nfree++; if (nfree) freelist = new int[nfree]; - else freelist = NULL; + else freelist = nullptr; nfree = 0; for (i = 0; i < nbody; i++) if (mark[i]) freelist[nfree++] = i + 1; diff --git a/src/PYTHON/fix_python_move.cpp b/src/PYTHON/fix_python_move.cpp index 53bde5e8045a1e0957c0a264b18b80782fbd0410..6aec1d785a4bb78ffe334eb411b4b9da52714839 100644 --- a/src/PYTHON/fix_python_move.cpp +++ b/src/PYTHON/fix_python_move.cpp @@ -37,7 +37,7 @@ FixPythonMove::FixPythonMove(LAMMPS *lmp, int narg, char **arg) : python->init(); - py_move = NULL; + py_move = nullptr; PyGILState_STATE gstate = PyGILState_Ensure(); @@ -50,7 +50,7 @@ FixPythonMove::FixPythonMove(LAMMPS *lmp, int narg, char **arg) : char * full_cls_name = arg[3]; char * lastpos = strrchr(full_cls_name, '.'); - if (lastpos == NULL) { + if (lastpos == nullptr) { error->all(FLERR,"Fix python/integrate requires fully qualified class name"); } @@ -138,7 +138,7 @@ void FixPythonMove::init() PyGILState_Release(gstate); error->all(FLERR,"Could not find 'init' method'"); } - PyObject * result = PyEval_CallObject(py_init, NULL); + PyObject * result = PyEval_CallObject(py_init, nullptr); PyGILState_Release(gstate); } @@ -174,7 +174,7 @@ void FixPythonMove::final_integrate() PyGILState_Release(gstate); error->all(FLERR,"Could not find 'final_integrate' method'"); } - PyObject * result = PyEval_CallObject(py_final_integrate, NULL); + PyObject * result = PyEval_CallObject(py_final_integrate, nullptr); PyGILState_Release(gstate); } @@ -229,6 +229,6 @@ void FixPythonMove::reset_dt() PyGILState_Release(gstate); error->all(FLERR,"Could not find 'reset_dt' method'"); } - PyObject * result = PyEval_CallObject(py_reset_dt, NULL); + PyObject * result = PyEval_CallObject(py_reset_dt, nullptr); PyGILState_Release(gstate); } diff --git a/src/PYTHON/pair_python.cpp b/src/PYTHON/pair_python.cpp index 074de2f39a64c3eadfdabe811851392581658dad..e24daf311643a23a0debebd578b7ae05c0654de2 100644 --- a/src/PYTHON/pair_python.cpp +++ b/src/PYTHON/pair_python.cpp @@ -43,8 +43,8 @@ PairPython::PairPython(LAMMPS *lmp) : Pair(lmp) { cut_global = 0.0; centroidstressflag = 1; - py_potential = NULL; - skip_types = NULL; + py_potential = nullptr; + skip_types = nullptr; python->init(); @@ -54,7 +54,7 @@ PairPython::PairPython(LAMMPS *lmp) : Pair(lmp) { // if LAMMPS_POTENTIALS environment variable is set, add it to PYTHONPATH as well const char * potentials_path = getenv("LAMMPS_POTENTIALS"); - if (potentials_path != NULL) { + if (potentials_path != nullptr) { PyList_Append(py_path, PY_STRING_FROM_STRING(potentials_path)); } } @@ -259,7 +259,7 @@ void PairPython::coeff(int narg, char **arg) char * full_cls_name = arg[2]; char * lastpos = strrchr(full_cls_name, '.'); - if (lastpos == NULL) { + if (lastpos == nullptr) { error->all(FLERR,"Python pair style requires fully qualified class name"); } @@ -297,7 +297,7 @@ void PairPython::coeff(int narg, char **arg) delete [] module_name; delete [] cls_name; - PyObject * py_pair_instance = PyObject_CallObject(py_pair_type, NULL); + PyObject * py_pair_instance = PyObject_CallObject(py_pair_type, nullptr); if (!py_pair_instance) { PyErr_Print(); PyErr_Clear(); diff --git a/src/PYTHON/python_compat.h b/src/PYTHON/python_compat.h index effac81cef8304c13f6e3dc63c10685933e1e4f6..97946349b2a08db5748464a39923ff1ed9d6b87b 100644 --- a/src/PYTHON/python_compat.h +++ b/src/PYTHON/python_compat.h @@ -21,14 +21,14 @@ #define PY_INT_FROM_LONG(X) PyInt_FromLong(X) #define PY_INT_AS_LONG(X) PyInt_AsLong(X) #define PY_STRING_FROM_STRING(X) PyString_FromString(X) -#define PY_VOID_POINTER(X) PyCObject_FromVoidPtr((void *) X, NULL) +#define PY_VOID_POINTER(X) PyCObject_FromVoidPtr((void *) X, nullptr) #define PY_STRING_AS_STRING(X) PyString_AsString(X) #elif PY_MAJOR_VERSION == 3 #define PY_INT_FROM_LONG(X) PyLong_FromLong(X) #define PY_INT_AS_LONG(X) PyLong_AsLong(X) #define PY_STRING_FROM_STRING(X) PyUnicode_FromString(X) -#define PY_VOID_POINTER(X) PyCapsule_New((void *) X, NULL, NULL) +#define PY_VOID_POINTER(X) PyCapsule_New((void *) X, nullptr, nullptr) #define PY_STRING_AS_STRING(X) PyUnicode_AsUTF8(X) #endif diff --git a/src/PYTHON/python_impl.cpp b/src/PYTHON/python_impl.cpp index cb35cba85ae6800495162244782394af8e4b4f82..5a94d33e983df61b01ff17f8418dd54ed282981e 100644 --- a/src/PYTHON/python_impl.cpp +++ b/src/PYTHON/python_impl.cpp @@ -38,15 +38,15 @@ enum{NONE,INT,DOUBLE,STRING,PTR}; PythonImpl::PythonImpl(LAMMPS *lmp) : Pointers(lmp) { ninput = noutput = 0; - istr = NULL; - ostr = NULL; - format = NULL; + istr = nullptr; + ostr = nullptr; + format = nullptr; length_longstr = 0; // pfuncs stores interface info for each Python function nfunc = 0; - pfuncs = NULL; + pfuncs = nullptr; // one-time initialization of Python interpreter // pyMain stores pointer to main module @@ -104,7 +104,7 @@ void PythonImpl::command(int narg, char **arg) int ifunc = find(arg[0]); if (ifunc < 0) error->all(FLERR,"Python invoke of undefined function"); - char *str = NULL; + char *str = nullptr; if (noutput) { str = input->variable->pythonstyle(pfuncs[ifunc].ovarname, pfuncs[ifunc].name); @@ -122,7 +122,7 @@ void PythonImpl::command(int narg, char **arg) int err; FILE *fp = fopen(arg[2],"r"); - if (fp == NULL) + if (fp == nullptr) err = execute_string(arg[2]); else err = execute_file(arg[2]); @@ -136,12 +136,12 @@ void PythonImpl::command(int narg, char **arg) // parse optional args, invoke is not allowed in this mode ninput = noutput = 0; - istr = NULL; - ostr = NULL; - format = NULL; + istr = nullptr; + ostr = nullptr; + format = nullptr; length_longstr = 0; - char *pyfile = NULL; - char *herestr = NULL; + char *pyfile = nullptr; + char *herestr = nullptr; int existflag = 0; int iarg = 1; @@ -206,7 +206,7 @@ void PythonImpl::command(int narg, char **arg) if (pyfile) { FILE *fp = fopen(pyfile,"r"); - if (fp == NULL) { + if (fp == nullptr) { PyGILState_Release(gstate); error->all(FLERR,"Could not open Python file"); } @@ -422,7 +422,7 @@ int PythonImpl::create_entry(char *name) pfuncs[ifunc].svalue = new char*[ninput]; for (int i = 0; i < ninput; i++) { - pfuncs[ifunc].svalue[i] = NULL; + pfuncs[ifunc].svalue[i] = nullptr; char type = format[i]; if (type == 'i') { pfuncs[ifunc].itype[i] = INT; @@ -470,8 +470,8 @@ int PythonImpl::create_entry(char *name) // process output as value or variable - pfuncs[ifunc].ovarname = NULL; - pfuncs[ifunc].longstr = NULL; + pfuncs[ifunc].ovarname = nullptr; + pfuncs[ifunc].longstr = nullptr; if (!noutput) return ifunc; char type = format[ninput]; @@ -512,7 +512,7 @@ int PythonImpl::execute_string(char *cmd) int PythonImpl::execute_file(char *fname) { FILE *fp = fopen(fname,"r"); - if (fp == NULL) return -1; + if (fp == nullptr) return -1; PyGILState_STATE gstate = PyGILState_Ensure(); int err = PyRun_SimpleFile(fp,fname); diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 172dedf5f0da8e44aee76dbcfa4890b9a9847b39..29930f67908c573d87457cf341d83f07251d94af 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -37,11 +37,11 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), list(NULL), chi(NULL), eta(NULL), - gamma(NULL), zeta(NULL), zcore(NULL), chizj(NULL), shld(NULL), - s(NULL), t(NULL), s_hist(NULL), t_hist(NULL), Hdia_inv(NULL), b_s(NULL), - b_t(NULL), p(NULL), q(NULL), r(NULL), d(NULL), - qf(NULL), q1(NULL), q2(NULL), qv(NULL) + Fix(lmp, narg, arg), list(nullptr), chi(nullptr), eta(nullptr), + gamma(nullptr), zeta(nullptr), zcore(nullptr), chizj(nullptr), shld(nullptr), + s(nullptr), t(nullptr), s_hist(nullptr), t_hist(nullptr), Hdia_inv(nullptr), b_s(nullptr), + b_t(nullptr), p(nullptr), q(nullptr), r(nullptr), d(nullptr), + qf(nullptr), q1(nullptr), q2(nullptr), qv(nullptr) { if (narg < 8) error->all(FLERR,"Illegal fix qeq command"); @@ -58,48 +58,48 @@ FixQEq::FixQEq(LAMMPS *lmp, int narg, char **arg) : swa = 0.0; swb = cutoff; - shld = NULL; + shld = nullptr; nlocal = n_cap = 0; nall = nmax = 0; m_fill = m_cap = 0; pack_flag = 0; - s = NULL; - t = NULL; + s = nullptr; + t = nullptr; nprev = 5; - Hdia_inv = NULL; - b_s = NULL; - b_t = NULL; + Hdia_inv = nullptr; + b_s = nullptr; + b_t = nullptr; // CG - p = NULL; - q = NULL; - r = NULL; - d = NULL; + p = nullptr; + q = nullptr; + r = nullptr; + d = nullptr; // H matrix - H.firstnbr = NULL; - H.numnbrs = NULL; - H.jlist = NULL; - H.val = NULL; + H.firstnbr = nullptr; + H.numnbrs = nullptr; + H.jlist = nullptr; + H.val = nullptr; // others cutoff_sq = cutoff*cutoff; - chizj = NULL; - qf = NULL; - q1 = NULL; - q2 = NULL; + chizj = nullptr; + qf = nullptr; + q1 = nullptr; + q2 = nullptr; streitz_flag = 0; reax_flag = 0; - qv = NULL; + qv = nullptr; comm_forward = comm_reverse = 1; // perform initial allocation of atom-based arrays // register with Atom class - s_hist = t_hist = NULL; + s_hist = t_hist = nullptr; grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); @@ -708,7 +708,7 @@ void FixQEq::read_file(char *file) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix qeq parameter file %s",file); error->one(FLERR,str); @@ -726,7 +726,7 @@ void FixQEq::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -751,7 +751,7 @@ void FixQEq::read_file(char *file) for (n=0, words[n] = strtok(line," \t\n\r\f"); n < 6; - words[++n] = strtok(NULL," \t\n\r\f")); + words[++n] = strtok(nullptr," \t\n\r\f")); utils::bounds(FLERR,words[0],1,ntypes,nlo,nhi,error); for (n=nlo; n <=nhi; ++n) { diff --git a/src/QEQ/fix_qeq_fire.cpp b/src/QEQ/fix_qeq_fire.cpp index 6dcc5e9cdca813e35bf82c8a3e521ad7028841e5..10cdc5d3ca938de3589eeaad0054aa7154f080c0 100644 --- a/src/QEQ/fix_qeq_fire.cpp +++ b/src/QEQ/fix_qeq_fire.cpp @@ -66,8 +66,8 @@ FixQEqFire::FixQEqFire(LAMMPS *lmp, int narg, char **arg) : } else error->all(FLERR,"Illegal fix qeq/fire command"); } - comb = NULL; - comb3 = NULL; + comb = nullptr; + comb3 = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/QEQ/fix_qeq_shielded.cpp b/src/QEQ/fix_qeq_shielded.cpp index 37951adb1ad177f3aee2d1286a6ce3147878370f..306f3f61e37fa9f32a48c69b880ad17ca7a1f281 100644 --- a/src/QEQ/fix_qeq_shielded.cpp +++ b/src/QEQ/fix_qeq_shielded.cpp @@ -78,12 +78,12 @@ void FixQEqShielded::init() void FixQEqShielded::extract_reax() { Pair *pair = force->pair_match("^reax/c",0); - if (pair == NULL) error->all(FLERR,"No pair reax/c for fix qeq/shielded"); + if (pair == nullptr) error->all(FLERR,"No pair reax/c for fix qeq/shielded"); int tmp; chi = (double *) pair->extract("chi",tmp); eta = (double *) pair->extract("eta",tmp); gamma = (double *) pair->extract("gamma",tmp); - if (chi == NULL || eta == NULL || gamma == NULL) + if (chi == nullptr || eta == nullptr || gamma == nullptr) error->all(FLERR, "Fix qeq/slater could not extract params from pair reax/c"); } diff --git a/src/QEQ/fix_qeq_slater.cpp b/src/QEQ/fix_qeq_slater.cpp index 327a9c5b3ae7f89739763c26158c83524f001d83..7c7dc159b112342a6da6b66eb13ca49738d5f39b 100644 --- a/src/QEQ/fix_qeq_slater.cpp +++ b/src/QEQ/fix_qeq_slater.cpp @@ -88,15 +88,15 @@ void FixQEqSlater::init() void FixQEqSlater::extract_streitz() { Pair *pair = force->pair_match("coul/streitz",1); - if (pair == NULL) error->all(FLERR,"No pair coul/streitz for fix qeq/slater"); + if (pair == nullptr) error->all(FLERR,"No pair coul/streitz for fix qeq/slater"); int tmp; chi = (double *) pair->extract("chi",tmp); eta = (double *) pair->extract("eta",tmp); gamma = (double *) pair->extract("gamma",tmp); zeta = (double *) pair->extract("zeta",tmp); zcore = (double *) pair->extract("zcore",tmp); - if (chi == NULL || eta == NULL || gamma == NULL - || zeta == NULL || zcore == NULL) + if (chi == nullptr || eta == nullptr || gamma == nullptr + || zeta == nullptr || zcore == nullptr) error->all(FLERR, "Fix qeq/slater could not extract params from pair coul/streitz"); diff --git a/src/REPLICA/compute_event_displace.cpp b/src/REPLICA/compute_event_displace.cpp index 531f488e60426debfefc964d8cea917291175ca2..8efaab7c7a7dec64e99c2d72481a08ade523a557 100644 --- a/src/REPLICA/compute_event_displace.cpp +++ b/src/REPLICA/compute_event_displace.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeEventDisplace::ComputeEventDisplace(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), id_event(NULL), fix_event(NULL) + Compute(lmp, narg, arg), id_event(nullptr), fix_event(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute event/displace command"); @@ -47,7 +47,7 @@ ComputeEventDisplace::ComputeEventDisplace(LAMMPS *lmp, int narg, char **arg) : // fix event ID will be set later by accelerated dynamics method - id_event = NULL; + id_event = nullptr; } /* ---------------------------------------------------------------------- */ @@ -65,7 +65,7 @@ void ComputeEventDisplace::init() // if set by PRD, then find fix which stores original atom coords // check if it is correct style - if (id_event != NULL) { + if (id_event != nullptr) { int ifix = modify->find_fix(id_event); if (ifix < 0) error->all(FLERR, "Could not find compute event/displace fix ID"); @@ -88,7 +88,7 @@ double ComputeEventDisplace::compute_scalar() { invoked_scalar = update->ntimestep; - if (id_event == NULL) return 0.0; + if (id_event == nullptr) return 0.0; double event = 0.0; double **xevent = fix_event->array_atom; @@ -150,7 +150,7 @@ int ComputeEventDisplace::all_events() { invoked_scalar = update->ntimestep; - if (id_event == NULL) return 0.0; + if (id_event == nullptr) return 0.0; int event = 0; double **xevent = fix_event->array_atom; @@ -204,8 +204,8 @@ int ComputeEventDisplace::all_events() void ComputeEventDisplace::reset_extra_compute_fix(const char *id_new) { delete [] id_event; - id_event = NULL; - if (id_new == NULL) return; + id_event = nullptr; + if (id_new == nullptr) return; int n = strlen(id_new) + 1; id_event = new char[n]; diff --git a/src/REPLICA/fix_event.cpp b/src/REPLICA/fix_event.cpp index a67bdbc51f552d42ccefded08bcdb91c9c08dfe7..92efcef7bac747156963b5dc32b08c3ea521e912 100644 --- a/src/REPLICA/fix_event.cpp +++ b/src/REPLICA/fix_event.cpp @@ -27,8 +27,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixEvent::FixEvent(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), xevent(NULL), xold(NULL), vold(NULL), - imageold(NULL), xorig(NULL), vorig(NULL), imageorig(NULL) + Fix(lmp, narg, arg), xevent(nullptr), xold(nullptr), vold(nullptr), + imageold(nullptr), xorig(nullptr), vorig(nullptr), imageorig(nullptr) { if (narg != 3) error->all(FLERR,"Illegal fix event command"); diff --git a/src/REPLICA/fix_hyper.cpp b/src/REPLICA/fix_hyper.cpp index 472d0bbb442d371d3a04750e8644b71ec81c5820..733578caa13dbfa4e5c0f2f1f89f4d6ff6e25137 100644 --- a/src/REPLICA/fix_hyper.cpp +++ b/src/REPLICA/fix_hyper.cpp @@ -35,6 +35,6 @@ void *FixHyper::extract(const char *str, int &dim) if (strcmp(str,"hyperflag") == 0) { return &hyperflag; } - return NULL; + return nullptr; } diff --git a/src/REPLICA/fix_hyper_global.cpp b/src/REPLICA/fix_hyper_global.cpp index e562b152ab4e729f0058a47e8f33d09b36126d1c..9a396d2987ffba61c2148356e64e357616e307de 100644 --- a/src/REPLICA/fix_hyper_global.cpp +++ b/src/REPLICA/fix_hyper_global.cpp @@ -41,7 +41,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixHyperGlobal::FixHyperGlobal(LAMMPS *lmp, int narg, char **arg) : - FixHyper(lmp, narg, arg), blist(NULL), xold(NULL), tagold(NULL) + FixHyper(lmp, narg, arg), blist(nullptr), xold(nullptr), tagold(nullptr) { if (atom->map_style == Atom::MAP_NONE) error->all(FLERR,"Fix hyper/global command requires atom map"); @@ -70,12 +70,12 @@ FixHyperGlobal::FixHyperGlobal(LAMMPS *lmp, int narg, char **arg) : maxbond = 0; nblocal = 0; - blist = NULL; + blist = nullptr; maxold = 0; - xold = NULL; - tagold = NULL; - old2now = NULL; + xold = nullptr; + tagold = nullptr; + old2now = nullptr; me = comm->me; firstflag = 1; diff --git a/src/REPLICA/fix_hyper_local.cpp b/src/REPLICA/fix_hyper_local.cpp index 5d42e25eda17984bf4dd81bc03c2678b308f80aa..c26a9a67356e63547e1683901c483e5344a99dba 100644 --- a/src/REPLICA/fix_hyper_local.cpp +++ b/src/REPLICA/fix_hyper_local.cpp @@ -47,10 +47,10 @@ enum{IGNORE,WARN,ERROR}; /* ---------------------------------------------------------------------- */ FixHyperLocal::FixHyperLocal(LAMMPS *lmp, int narg, char **arg) : - FixHyper(lmp, narg, arg), blist(NULL), biascoeff(NULL), numbond(NULL), - maxhalf(NULL), eligible(NULL), maxhalfstrain(NULL), old2now(NULL), - tagold(NULL), xold(NULL), maxstrain(NULL), maxstrain_domain(NULL), - biasflag(NULL), bias(NULL), cpage(NULL), clist(NULL), numcoeff(NULL) + FixHyper(lmp, narg, arg), blist(nullptr), biascoeff(nullptr), numbond(nullptr), + maxhalf(nullptr), eligible(nullptr), maxhalfstrain(nullptr), old2now(nullptr), + tagold(nullptr), xold(nullptr), maxstrain(nullptr), maxstrain_domain(nullptr), + biasflag(nullptr), bias(nullptr), cpage(nullptr), clist(nullptr), numcoeff(nullptr) { // error checks @@ -132,28 +132,28 @@ FixHyperLocal::FixHyperLocal(LAMMPS *lmp, int narg, char **arg) : // per-atom data structs maxbond = nblocal = 0; - blist = NULL; - biascoeff = NULL; + blist = nullptr; + biascoeff = nullptr; allbonds = 0; maxatom = 0; - maxstrain = NULL; - maxstrain_domain = NULL; - biasflag = NULL; + maxstrain = nullptr; + maxstrain_domain = nullptr; + biasflag = nullptr; maxlocal = nlocal_old = 0; - numbond = NULL; - maxhalf = NULL; - eligible = NULL; - maxhalfstrain = NULL; + numbond = nullptr; + maxhalf = nullptr; + eligible = nullptr; + maxhalfstrain = nullptr; maxall = nall_old = 0; - xold = NULL; - tagold = NULL; - old2now = NULL; + xold = nullptr; + tagold = nullptr; + old2now = nullptr; nbias = maxbias = 0; - bias = NULL; + bias = nullptr; // data structs for persisting bias coeffs when bond list is reformed // maxbondperatom = max # of bonds any atom is part of @@ -162,8 +162,8 @@ FixHyperLocal::FixHyperLocal(LAMMPS *lmp, int narg, char **arg) : maxcoeff = 0; maxbondperatom = FCCBONDS; - numcoeff = NULL; - clist = NULL; + numcoeff = nullptr; + clist = nullptr; cpage = new MyPage; cpage->init(maxbondperatom,1024*maxbondperatom,1); @@ -983,7 +983,7 @@ void FixHyperLocal::build_bond_list(int natom) while (1) { if (firstflag) break; for (i = 0; i < nall; i++) numcoeff[i] = 0; - for (i = 0; i < nall; i++) clist[i] = NULL; + for (i = 0; i < nall; i++) clist[i] = nullptr; cpage->reset(); for (m = 0; m < nblocal; m++) { diff --git a/src/REPLICA/fix_neb.cpp b/src/REPLICA/fix_neb.cpp index b8fd0f64428771463f39a43ce7c9ef130dcc3c74..a739ec754c1419f7aefd2ca3d4179c1ddde2bd73 100644 --- a/src/REPLICA/fix_neb.cpp +++ b/src/REPLICA/fix_neb.cpp @@ -45,12 +45,12 @@ enum{SINGLE_PROC_DIRECT,SINGLE_PROC_MAP,MULTI_PROC}; FixNEB::FixNEB(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - id_pe(NULL), pe(NULL), nlenall(NULL), xprev(NULL), xnext(NULL), - fnext(NULL), springF(NULL), tangent(NULL), xsend(NULL), xrecv(NULL), - fsend(NULL), frecv(NULL), tagsend(NULL), tagrecv(NULL), - xsendall(NULL), xrecvall(NULL), fsendall(NULL), frecvall(NULL), - tagsendall(NULL), tagrecvall(NULL), counts(NULL), - displacements(NULL) + id_pe(nullptr), pe(nullptr), nlenall(nullptr), xprev(nullptr), xnext(nullptr), + fnext(nullptr), springF(nullptr), tangent(nullptr), xsend(nullptr), xrecv(nullptr), + fsend(nullptr), frecv(nullptr), tagsend(nullptr), tagrecv(nullptr), + xsendall(nullptr), xrecvall(nullptr), fsendall(nullptr), frecvall(nullptr), + tagsendall(nullptr), tagrecvall(nullptr), counts(nullptr), + displacements(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix neb command"); @@ -237,7 +237,7 @@ void FixNEB::init() if (atom->nmax > maxlocal) reallocate(); - if ((cmode == MULTI_PROC) && (counts == NULL)) { + if ((cmode == MULTI_PROC) && (counts == nullptr)) { memory->create(xsendall,ntotal,3,"neb:xsendall"); memory->create(xrecvall,ntotal,3,"neb:xrecvall"); memory->create(fsendall,ntotal,3,"neb:fsendall"); @@ -785,9 +785,9 @@ void FixNEB::inter_replica_comm() MPI_Gatherv(fsend[0],3*m,MPI_DOUBLE, fsendall[0],counts,displacements,MPI_DOUBLE,0,world); } else { - MPI_Gatherv(NULL,3*m,MPI_DOUBLE, + MPI_Gatherv(nullptr,3*m,MPI_DOUBLE, xsendall[0],counts,displacements,MPI_DOUBLE,0,world); - MPI_Gatherv(NULL,3*m,MPI_DOUBLE, + MPI_Gatherv(nullptr,3*m,MPI_DOUBLE, fsendall[0],counts,displacements,MPI_DOUBLE,0,world); } diff --git a/src/REPLICA/hyper.cpp b/src/REPLICA/hyper.cpp index 6c4cba4ab8a1f535926c8c5cb2a42f135c191bce..b015839f642ebca77fbd97d4e4ca34396df642b0 100644 --- a/src/REPLICA/hyper.cpp +++ b/src/REPLICA/hyper.cpp @@ -38,7 +38,7 @@ enum{NOHYPER,GLOBAL,LOCAL}; /* ---------------------------------------------------------------------- */ -Hyper::Hyper(LAMMPS *lmp) : Pointers(lmp), dumplist(NULL) {} +Hyper::Hyper(LAMMPS *lmp) : Pointers(lmp), dumplist(nullptr) {} /* ---------------------------------------------------------------------- perform hyperdynamics simulation @@ -91,7 +91,7 @@ void Hyper::command(int narg, char **arg) fix_hyper = (FixHyper *) modify->fix[ifix]; int dim; int *hyperflag = (int *) fix_hyper->extract("hyperflag",dim); - if (hyperflag == NULL || *hyperflag == 0) + if (hyperflag == nullptr || *hyperflag == 0) error->all(FLERR,"Hyper fix is not a valid hyperdynamics fix"); if (*hyperflag == 1) hyperstyle = GLOBAL; if (*hyperflag == 2) hyperstyle = LOCAL; @@ -353,7 +353,7 @@ void Hyper::command(int narg, char **arg) delete finish; modify->delete_fix("hyper_event"); - compute_event->reset_extra_compute_fix(NULL); + compute_event->reset_extra_compute_fix(nullptr); } /* ---------------------------------------------------------------------- @@ -449,7 +449,7 @@ void Hyper::options(int narg, char **arg) maxeval = 50; dumpflag = 0; ndump = 0; - dumplist = NULL; + dumplist = nullptr; rebond = 0; int iarg = 0; diff --git a/src/REPLICA/neb.cpp b/src/REPLICA/neb.cpp index 9992e8d93437a13e3b656790e2087839a74d8bc8..37d69e674fe3a6377642de1ad5bfc94892a067b9 100644 --- a/src/REPLICA/neb.cpp +++ b/src/REPLICA/neb.cpp @@ -391,7 +391,7 @@ void NEB::readfile(char *file, int flag) open(file); while (1) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of NEB file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of NEB file"); start = &line[strspn(line," \t\n\v\f\r")]; if (*start != '\0' && *start != '#') break; } @@ -407,7 +407,7 @@ void NEB::readfile(char *file, int flag) open(file); while (1) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of NEB file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of NEB file"); start = &line[strspn(line," \t\n\v\f\r")]; if (*start != '\0' && *start != '#') break; } @@ -460,7 +460,7 @@ void NEB::readfile(char *file, int flag) values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) - values[j] = strtok(NULL," \t\n\r\f"); + values[j] = strtok(nullptr," \t\n\r\f"); // adjust atom coord based on replica fraction // for flag = 0, interpolate for intermediate and final replicas @@ -561,7 +561,7 @@ void NEB::open(char *file) #endif } - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); diff --git a/src/REPLICA/prd.cpp b/src/REPLICA/prd.cpp index 998fc69f9d5110af78cf8f27d3692d6a3cb3929f..67bf3202ac226089b76cc73980310c7a54baec8c 100644 --- a/src/REPLICA/prd.cpp +++ b/src/REPLICA/prd.cpp @@ -117,9 +117,9 @@ void PRD::command(int narg, char **arg) natoms = atom->natoms; - tagall = NULL; - xall = NULL; - imageall = NULL; + tagall = nullptr; + xall = nullptr; + imageall = nullptr; if (cmode != SINGLE_PROC_DIRECT) { memory->create(tagall,natoms,"prd:tagall"); @@ -127,8 +127,8 @@ void PRD::command(int narg, char **arg) memory->create(imageall,natoms,"prd:imageall"); } - counts = NULL; - displacements = NULL; + counts = nullptr; + displacements = nullptr; if (cmode == MULTI_PROC) { memory->create(counts,nprocs,"prd:counts"); @@ -465,7 +465,7 @@ void PRD::command(int narg, char **arg) modify->delete_compute("prd_temp"); modify->delete_fix("prd_event"); - compute_event->reset_extra_compute_fix(NULL); + compute_event->reset_extra_compute_fix(nullptr); } /* ---------------------------------------------------------------------- @@ -908,16 +908,16 @@ void PRD::options(int narg, char **arg) delete [] loop_setting; delete [] dist_setting; - if (strcmp(arg[iarg+1],"all") == 0) loop_setting = NULL; - else if (strcmp(arg[iarg+1],"local") == 0) loop_setting = NULL; - else if (strcmp(arg[iarg+1],"geom") == 0) loop_setting = NULL; + if (strcmp(arg[iarg+1],"all") == 0) loop_setting = nullptr; + else if (strcmp(arg[iarg+1],"local") == 0) loop_setting = nullptr; + else if (strcmp(arg[iarg+1],"geom") == 0) loop_setting = nullptr; else error->all(FLERR,"Illegal prd command"); int n = strlen(arg[iarg+1]) + 1; loop_setting = new char[n]; strcpy(loop_setting,arg[iarg+1]); - if (strcmp(arg[iarg+2],"uniform") == 0) dist_setting = NULL; - else if (strcmp(arg[iarg+2],"gaussian") == 0) dist_setting = NULL; + if (strcmp(arg[iarg+2],"uniform") == 0) dist_setting = nullptr; + else if (strcmp(arg[iarg+2],"gaussian") == 0) dist_setting = nullptr; else error->all(FLERR,"Illegal prd command"); n = strlen(arg[iarg+2]) + 1; dist_setting = new char[n]; diff --git a/src/REPLICA/tad.cpp b/src/REPLICA/tad.cpp index fbb555097b04aab7d97f55e57e885c83d4a5691e..d0046b527cbb6e58b7fb26cddfa47aa2aa6807b0 100644 --- a/src/REPLICA/tad.cpp +++ b/src/REPLICA/tad.cpp @@ -50,7 +50,7 @@ TAD::TAD(LAMMPS *lmp) : Pointers(lmp) {} TAD::~TAD() { memory->sfree(fix_event_list); - if (neb_logfilename != NULL) delete [] neb_logfilename; + if (neb_logfilename != nullptr) delete [] neb_logfilename; delete [] min_style; delete [] min_style_neb; } @@ -62,7 +62,7 @@ TAD::~TAD() void TAD::command(int narg, char **arg) { - fix_event_list = NULL; + fix_event_list = nullptr; n_event_list = 0; nmax_event_list = 0; nmin_event_list = 10; @@ -226,8 +226,8 @@ void TAD::command(int narg, char **arg) ulogfile_lammps = universe->ulogfile; uscreen_lammps = universe->uscreen; - ulogfile_neb = NULL; - uscreen_neb = NULL; + ulogfile_neb = nullptr; + uscreen_neb = nullptr; if (me_universe == 0 && neb_logfilename) ulogfile_neb = fopen(neb_logfilename,"w"); @@ -421,7 +421,7 @@ void TAD::command(int narg, char **arg) modify->delete_fix("tad_revert"); delete_event_list(); - compute_event->reset_extra_compute_fix(NULL); + compute_event->reset_extra_compute_fix(nullptr); } /* ---------------------------------------------------------------------- @@ -586,7 +586,7 @@ void TAD::options(int narg, char **arg) min_style_neb = new char[n]; strcpy(min_style_neb,"quickmin"); dt_neb = update->dt; - neb_logfilename = NULL; + neb_logfilename = nullptr; int iarg = 0; while (iarg < narg) { @@ -630,7 +630,7 @@ void TAD::options(int narg, char **arg) } else if (strcmp(arg[iarg],"neb_log") == 0) { delete [] neb_logfilename; if (iarg+2 > narg) error->all(FLERR,"Illegal tad command"); - if (strcmp(arg[iarg+1],"none") == 0) neb_logfilename = NULL; + if (strcmp(arg[iarg+1],"none") == 0) neb_logfilename = nullptr; else { int n = strlen(arg[iarg+1]) + 1; neb_logfilename = new char[n]; @@ -885,7 +885,7 @@ void TAD::delete_event_list() { modify->delete_fix(str); } memory->sfree(fix_event_list); - fix_event_list = NULL; + fix_event_list = nullptr; n_event_list = 0; nmax_event_list = 0; diff --git a/src/REPLICA/temper.cpp b/src/REPLICA/temper.cpp index 0cce389bf0a0069770a73f09ec988439c4f23ea8..0d15be2aa63967e0d13416b04e2f42b19627e144 100644 --- a/src/REPLICA/temper.cpp +++ b/src/REPLICA/temper.cpp @@ -147,7 +147,7 @@ void Temper::command(int narg, char **arg) // warm up Boltzmann RNG if (seed_swap) ranswap = new RanPark(lmp,seed_swap); - else ranswap = NULL; + else ranswap = nullptr; ranboltz = new RanPark(lmp,seed_boltz + me_universe); for (int i = 0; i < 100; i++) ranboltz->uniform(); diff --git a/src/REPLICA/verlet_split.cpp b/src/REPLICA/verlet_split.cpp index 389bd109e5f0266dbb49233f610dbfc242fbd819..41ee3b1911ff4dbcd4ebfebfde4cddb470420f83 100644 --- a/src/REPLICA/verlet_split.cpp +++ b/src/REPLICA/verlet_split.cpp @@ -42,7 +42,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ VerletSplit::VerletSplit(LAMMPS *lmp, int narg, char **arg) : - Verlet(lmp, narg, arg), qsize(NULL), qdisp(NULL), xsize(NULL), xdisp(NULL), f_kspace(NULL) + Verlet(lmp, narg, arg), qsize(nullptr), qdisp(nullptr), xsize(nullptr), xdisp(nullptr), f_kspace(nullptr) { // error checks on partitions @@ -194,7 +194,7 @@ VerletSplit::VerletSplit(LAMMPS *lmp, int narg, char **arg) : // allocate dummy version for Kspace partition maxatom = 0; - f_kspace = NULL; + f_kspace = nullptr; if (!master) memory->create(f_kspace,1,1,"verlet/split:f_kspace"); } @@ -289,7 +289,7 @@ void VerletSplit::run(int n) Fix *fix_omp; int ifix = modify->find_fix("package_omp"); - if (ifix < 0) fix_omp = NULL; + if (ifix < 0) fix_omp = nullptr; else fix_omp = modify->fix[ifix]; // flags for timestepping iterations diff --git a/src/RIGID/compute_erotate_rigid.cpp b/src/RIGID/compute_erotate_rigid.cpp index e15c0deb82cb714cf81736d2c7d0311a44e6944f..43e636963fc1ffccf612d196ba408a431c2acade 100644 --- a/src/RIGID/compute_erotate_rigid.cpp +++ b/src/RIGID/compute_erotate_rigid.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeERotateRigid::ComputeERotateRigid(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), rfix(NULL) + Compute(lmp, narg, arg), rfix(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute erotate/rigid command"); diff --git a/src/RIGID/compute_ke_rigid.cpp b/src/RIGID/compute_ke_rigid.cpp index 031919b7a971350c675b3f6364f4c913f5af7362..6ce4440d05b21a17c7062f2855b8959e3ce9be66 100644 --- a/src/RIGID/compute_ke_rigid.cpp +++ b/src/RIGID/compute_ke_rigid.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeKERigid::ComputeKERigid(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), rfix(NULL) + Compute(lmp, narg, arg), rfix(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute ke/rigid command"); diff --git a/src/RIGID/compute_rigid_local.cpp b/src/RIGID/compute_rigid_local.cpp index 57f69a64e2f42e96e0afd0707a0bb8adf54a802c..c100db82e89995443bcd2bda56cb989e6064908c 100644 --- a/src/RIGID/compute_rigid_local.cpp +++ b/src/RIGID/compute_rigid_local.cpp @@ -33,7 +33,7 @@ enum{ID,MOL,MASS,X,Y,Z,XU,YU,ZU,VX,VY,VZ,FX,FY,FZ,IX,IY,IZ, ComputeRigidLocal::ComputeRigidLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - rstyle(NULL), idrigid(NULL), fixrigid(NULL), vlocal(NULL), alocal(NULL) + rstyle(nullptr), idrigid(nullptr), fixrigid(nullptr), vlocal(nullptr), alocal(nullptr) { if (narg < 5) error->all(FLERR,"Illegal compute rigid/local command"); @@ -89,8 +89,8 @@ ComputeRigidLocal::ComputeRigidLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; ncount = nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -115,8 +115,8 @@ void ComputeRigidLocal::init() fixrigid = (FixRigidSmall *) modify->fix[ifix]; int flag = 0; - if (strstr(fixrigid->style,"rigid/") == NULL) flag = 1; - if (strstr(fixrigid->style,"/small") == NULL) flag = 1; + if (strstr(fixrigid->style,"rigid/") == nullptr) flag = 1; + if (strstr(fixrigid->style,"/small") == nullptr) flag = 1; if (flag) error->all(FLERR,"Compute rigid/local does not use fix rigid/small fix"); diff --git a/src/RIGID/fix_ehex.cpp b/src/RIGID/fix_ehex.cpp index eab17df47f0134cca7e1e23f8e43194b84003d05..c325707ddacbbddc1cbd659ffb8971ca6e51fc29 100644 --- a/src/RIGID/fix_ehex.cpp +++ b/src/RIGID/fix_ehex.cpp @@ -45,8 +45,8 @@ enum{CONSTANT,EQUAL,ATOM}; /* ---------------------------------------------------------------------- */ FixEHEX::FixEHEX(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idregion(NULL), x(NULL), f(NULL), v(NULL), - mass(NULL), rmass(NULL), type(NULL), scalingmask(NULL) + idregion(nullptr), x(nullptr), f(nullptr), v(nullptr), + mass(nullptr), rmass(nullptr), type(nullptr), scalingmask(nullptr) { MPI_Comm_rank(world, &me); @@ -127,7 +127,7 @@ FixEHEX::FixEHEX(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), error->all(FLERR, "You can only use the keyword 'com' together with the keyword 'constrain' "); scale = 1.0; - scalingmask = NULL; + scalingmask = nullptr; grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); @@ -177,7 +177,7 @@ void FixEHEX::init() if (group->count(igroup) == 0) error->all(FLERR,"Fix ehex group has no atoms"); - fshake = NULL; + fshake = nullptr; if (constraints) { // check if constraining algorithm is used (FixRattle inherits from FixShake) @@ -335,7 +335,7 @@ void FixEHEX::update_scalingmask() { // prematch region - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); @@ -354,7 +354,7 @@ void FixEHEX::update_scalingmask() { m = fshake->list[i]; // check if the centre of mass of the cluster is inside the region - // if region == NULL, just check the group information of all sites + // if region == nullptr, just check the group information of all sites if (fshake->shake_flag[m] == 1) nsites = 3; else if (fshake->shake_flag[m] == 2) nsites = 2; diff --git a/src/RIGID/fix_rattle.cpp b/src/RIGID/fix_rattle.cpp index 436b2191ff8fac1bcbfe314c056422252e5a0fd0..07787bcbfe312355c2d57cf8dd0ea31e3d71e912 100644 --- a/src/RIGID/fix_rattle.cpp +++ b/src/RIGID/fix_rattle.cpp @@ -59,7 +59,7 @@ FixRattle::FixRattle(LAMMPS *lmp, int narg, char **arg) : // allocate memory for unconstrained velocity update - vp = NULL; + vp = nullptr; grow_arrays(atom->nmax); // default communication mode diff --git a/src/RIGID/fix_rigid.cpp b/src/RIGID/fix_rigid.cpp index 8c9f30c57fc6904a64a1afd17080a58e4daf7007..dd40b0fe4539434d31f345f0d6a5ed6ae3643be9 100644 --- a/src/RIGID/fix_rigid.cpp +++ b/src/RIGID/fix_rigid.cpp @@ -46,16 +46,16 @@ using namespace RigidConst; /* ---------------------------------------------------------------------- */ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), step_respa(NULL), - inpfile(NULL), nrigid(NULL), mol2body(NULL), body2mol(NULL), - body(NULL), displace(NULL), masstotal(NULL), xcm(NULL), - vcm(NULL), fcm(NULL), inertia(NULL), ex_space(NULL), - ey_space(NULL), ez_space(NULL), angmom(NULL), omega(NULL), - torque(NULL), quat(NULL), imagebody(NULL), fflag(NULL), - tflag(NULL), langextra(NULL), sum(NULL), all(NULL), - remapflag(NULL), xcmimage(NULL), eflags(NULL), orient(NULL), - dorient(NULL), id_dilate(NULL), id_gravity(NULL), random(NULL), - avec_ellipsoid(NULL), avec_line(NULL), avec_tri(NULL) + Fix(lmp, narg, arg), step_respa(nullptr), + inpfile(nullptr), nrigid(nullptr), mol2body(nullptr), body2mol(nullptr), + body(nullptr), displace(nullptr), masstotal(nullptr), xcm(nullptr), + vcm(nullptr), fcm(nullptr), inertia(nullptr), ex_space(nullptr), + ey_space(nullptr), ez_space(nullptr), angmom(nullptr), omega(nullptr), + torque(nullptr), quat(nullptr), imagebody(nullptr), fflag(nullptr), + tflag(nullptr), langextra(nullptr), sum(nullptr), all(nullptr), + remapflag(nullptr), xcmimage(nullptr), eflags(nullptr), orient(nullptr), + dorient(nullptr), id_dilate(nullptr), id_gravity(nullptr), random(nullptr), + avec_ellipsoid(nullptr), avec_line(nullptr), avec_tri(nullptr) { int i,ibody; @@ -76,12 +76,12 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : // register with Atom class extended = orientflag = dorientflag = 0; - body = NULL; - xcmimage = NULL; - displace = NULL; - eflags = NULL; - orient = NULL; - dorient = NULL; + body = nullptr; + xcmimage = nullptr; + displace = nullptr; + eflags = nullptr; + orient = nullptr; + dorient = nullptr; grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); @@ -91,8 +91,8 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : if (narg < 4) error->all(FLERR,"Illegal fix rigid command"); int iarg; - mol2body = NULL; - body2mol = NULL; + mol2body = nullptr; + body2mol = nullptr; // single rigid body // nbody = 1 @@ -322,9 +322,9 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : t_order = 3; p_chain = 10; - inpfile = NULL; - id_gravity = NULL; - id_dilate = NULL; + inpfile = nullptr; + id_gravity = nullptr; + id_dilate = nullptr; pcouple = NONE; pstyle = ANISO; @@ -567,7 +567,7 @@ FixRigid::FixRigid(LAMMPS *lmp, int narg, char **arg) : // initialize Marsaglia RNG with processor-unique seed if (langflag) random = new RanMars(lmp,seed + me); - else random = NULL; + else random = nullptr; // initialize vector output quantities in case accessed before run @@ -1930,7 +1930,7 @@ void FixRigid::setup_bodies_static() // overwrite Cartesian inertia tensor with file values - if (inpfile) readfile(1,NULL,all,NULL,NULL,NULL,inbody); + if (inpfile) readfile(1,nullptr,all,nullptr,nullptr,nullptr,inbody); // diagonalize inertia tensor for each body via Jacobi rotations // inertia = 3 eigenvalues = principal moments of inertia @@ -2281,12 +2281,12 @@ void FixRigid::readfile(int which, double *vec, if (me == 0) { fp = fopen(inpfile,"r"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix rigid file {}: {}", inpfile,utils::getsyserror())); while (1) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of fix rigid file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of fix rigid file"); start = &line[strspn(line," \t\n\v\f\r")]; if (*start != '\0' && *start != '#') break; } @@ -2327,7 +2327,7 @@ void FixRigid::readfile(int which, double *vec, values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) - values[j] = strtok(NULL," \t\n\r\f"); + values[j] = strtok(nullptr," \t\n\r\f"); id = atoi(values[0]); if (rstyle == MOLECULE) { @@ -2390,7 +2390,7 @@ void FixRigid::write_restart_file(const char *file) auto outfile = std::string(file) + ".rigid"; FILE *fp = fopen(outfile.c_str(),"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix rigid restart file {}: {}", outfile,utils::getsyserror())); @@ -2711,7 +2711,7 @@ void *FixRigid::extract(const char *str, int &dim) return &t_target; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/RIGID/fix_rigid_nh.cpp b/src/RIGID/fix_rigid_nh.cpp index 1df7f345327cb2be2c974e8a21c3b36c37134f84..0aa5f9976570d2a6841e80b29de1b8f94b4d43c0 100644 --- a/src/RIGID/fix_rigid_nh.cpp +++ b/src/RIGID/fix_rigid_nh.cpp @@ -42,12 +42,12 @@ using namespace RigidConst; /* ---------------------------------------------------------------------- */ FixRigidNH::FixRigidNH(LAMMPS *lmp, int narg, char **arg) : - FixRigid(lmp, narg, arg), conjqm(NULL), w(NULL), - wdti1(NULL), wdti2(NULL), wdti4(NULL), q_t(NULL), q_r(NULL), - eta_t(NULL), eta_r(NULL), eta_dot_t(NULL), eta_dot_r(NULL), - f_eta_t(NULL), f_eta_r(NULL), q_b(NULL), eta_b(NULL), - eta_dot_b(NULL), f_eta_b(NULL), rfix(NULL), id_temp(NULL), - id_press(NULL), temperature(NULL), pressure(NULL) + FixRigid(lmp, narg, arg), conjqm(nullptr), w(nullptr), + wdti1(nullptr), wdti2(nullptr), wdti4(nullptr), q_t(nullptr), q_r(nullptr), + eta_t(nullptr), eta_r(nullptr), eta_dot_t(nullptr), eta_dot_r(nullptr), + f_eta_t(nullptr), f_eta_r(nullptr), q_b(nullptr), eta_b(nullptr), + eta_dot_b(nullptr), f_eta_b(nullptr), rfix(nullptr), id_temp(nullptr), + id_press(nullptr), temperature(nullptr), pressure(nullptr) { // error checks: could be moved up to FixRigid @@ -145,7 +145,7 @@ FixRigidNH::FixRigidNH(LAMMPS *lmp, int narg, char **arg) : // rigid body pointers nrigidfix = 0; - rfix = NULL; + rfix = nullptr; vol0 = 0.0; t0 = 1.0; @@ -153,8 +153,8 @@ FixRigidNH::FixRigidNH(LAMMPS *lmp, int narg, char **arg) : tcomputeflag = 0; pcomputeflag = 0; - id_temp = NULL; - id_press = NULL; + id_temp = nullptr; + id_press = nullptr; } /* ---------------------------------------------------------------------- */ @@ -304,7 +304,7 @@ void FixRigidNH::init() if (rfix) delete [] rfix; nrigidfix = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigidfix++; diff --git a/src/RIGID/fix_rigid_nh_small.cpp b/src/RIGID/fix_rigid_nh_small.cpp index d1204e2bbc4e4d051f972d6b9dc37c1c79ad7149..b599868ecdb7c6a438be187145443e6e0234b57e 100644 --- a/src/RIGID/fix_rigid_nh_small.cpp +++ b/src/RIGID/fix_rigid_nh_small.cpp @@ -44,12 +44,12 @@ using namespace RigidConst; /* ---------------------------------------------------------------------- */ FixRigidNHSmall::FixRigidNHSmall(LAMMPS *lmp, int narg, char **arg) : - FixRigidSmall(lmp, narg, arg), w(NULL), wdti1(NULL), - wdti2(NULL), wdti4(NULL), q_t(NULL), q_r(NULL), eta_t(NULL), - eta_r(NULL), eta_dot_t(NULL), eta_dot_r(NULL), f_eta_t(NULL), - f_eta_r(NULL), q_b(NULL), eta_b(NULL), eta_dot_b(NULL), - f_eta_b(NULL), rfix(NULL), id_temp(NULL), id_press(NULL), - temperature(NULL), pressure(NULL) + FixRigidSmall(lmp, narg, arg), w(nullptr), wdti1(nullptr), + wdti2(nullptr), wdti4(nullptr), q_t(nullptr), q_r(nullptr), eta_t(nullptr), + eta_r(nullptr), eta_dot_t(nullptr), eta_dot_r(nullptr), f_eta_t(nullptr), + f_eta_r(nullptr), q_b(nullptr), eta_b(nullptr), eta_dot_b(nullptr), + f_eta_b(nullptr), rfix(nullptr), id_temp(nullptr), id_press(nullptr), + temperature(nullptr), pressure(nullptr) { // error checks @@ -159,7 +159,7 @@ FixRigidNHSmall::FixRigidNHSmall(LAMMPS *lmp, int narg, char **arg) : // rigid body pointers nrigidfix = 0; - rfix = NULL; + rfix = nullptr; vol0 = 0.0; t0 = 1.0; @@ -167,8 +167,8 @@ FixRigidNHSmall::FixRigidNHSmall(LAMMPS *lmp, int narg, char **arg) : tcomputeflag = 0; pcomputeflag = 0; - id_temp = NULL; - id_press = NULL; + id_temp = nullptr; + id_press = nullptr; } /* ---------------------------------------------------------------------- */ @@ -301,7 +301,7 @@ void FixRigidNHSmall::init() if (rfix) delete [] rfix; nrigidfix = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigidfix++; diff --git a/src/RIGID/fix_rigid_small.cpp b/src/RIGID/fix_rigid_small.cpp index 2a662ec4c989773fc343738272ca5617b77ea8c4..69f5b2b004dd003acede841b2bf1cb9efe4726b1 100644 --- a/src/RIGID/fix_rigid_small.cpp +++ b/src/RIGID/fix_rigid_small.cpp @@ -54,12 +54,12 @@ using namespace RigidConst; /* ---------------------------------------------------------------------- */ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), step_respa(NULL), - inpfile(NULL), body(NULL), bodyown(NULL), bodytag(NULL), atom2body(NULL), - xcmimage(NULL), displace(NULL), eflags(NULL), orient(NULL), dorient(NULL), - avec_ellipsoid(NULL), avec_line(NULL), avec_tri(NULL), counts(NULL), - itensor(NULL), mass_body(NULL), langextra(NULL), random(NULL), - id_dilate(NULL), id_gravity(NULL), onemols(NULL) + Fix(lmp, narg, arg), step_respa(nullptr), + inpfile(nullptr), body(nullptr), bodyown(nullptr), bodytag(nullptr), atom2body(nullptr), + xcmimage(nullptr), displace(nullptr), eflags(nullptr), orient(nullptr), dorient(nullptr), + avec_ellipsoid(nullptr), avec_line(nullptr), avec_tri(nullptr), counts(nullptr), + itensor(nullptr), mass_body(nullptr), langextra(nullptr), random(nullptr), + id_dilate(nullptr), id_gravity(nullptr), onemols(nullptr) { int i; @@ -82,21 +82,21 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : // register with Atom class extended = orientflag = dorientflag = customflag = 0; - bodyown = NULL; - bodytag = NULL; - atom2body = NULL; - xcmimage = NULL; - displace = NULL; - eflags = NULL; - orient = NULL; - dorient = NULL; + bodyown = nullptr; + bodytag = nullptr; + atom2body = nullptr; + xcmimage = nullptr; + displace = nullptr; + eflags = nullptr; + orient = nullptr; + dorient = nullptr; grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); // parse args for rigid body specification int *mask = atom->mask; - tagint *bodyID = NULL; + tagint *bodyID = nullptr; int nlocal = atom->nlocal; if (narg < 4) error->all(FLERR,"Illegal fix rigid/small command"); @@ -178,14 +178,14 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : int seed; langflag = 0; - inpfile = NULL; - onemols = NULL; + inpfile = nullptr; + onemols = nullptr; reinitflag = 1; tstat_flag = 0; pstat_flag = 0; allremap = 1; - id_dilate = NULL; + id_dilate = nullptr; t_chain = 10; t_iter = 1; t_order = 3; @@ -477,13 +477,13 @@ FixRigidSmall::FixRigidSmall(LAMMPS *lmp, int narg, char **arg) : // initialize Marsaglia RNG with processor-unique seed maxlang = 0; - langextra = NULL; - random = NULL; + langextra = nullptr; + random = nullptr; if (langflag) random = new RanMars(lmp,seed + comm->me); // mass vector for granular pair styles - mass_body = NULL; + mass_body = nullptr; nmax_mass = 0; // wait to setup bodies until comm stencils are defined @@ -1965,7 +1965,7 @@ void FixRigidSmall::setup_bodies_static() if (inpfile) { memory->create(inbody,nlocal_body,"rigid/small:inbody"); for (ibody = 0; ibody < nlocal_body; ibody++) inbody[ibody] = 0; - readfile(0,NULL,inbody); + readfile(0,nullptr,inbody); } // remap the xcm of each body back into simulation box @@ -2445,12 +2445,12 @@ void FixRigidSmall::readfile(int which, double **array, int *inbody) if (me == 0) { fp = fopen(inpfile,"r"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix rigid/small file {}: {}", inpfile,utils::getsyserror())); while (1) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) + if (eof == nullptr) error->one(FLERR,"Unexpected end of fix rigid/small file"); start = &line[strspn(line," \t\n\v\f\r")]; if (*start != '\0' && *start != '#') break; @@ -2490,7 +2490,7 @@ void FixRigidSmall::readfile(int which, double **array, int *inbody) values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) - values[j] = strtok(NULL," \t\n\r\f"); + values[j] = strtok(nullptr," \t\n\r\f"); id = ATOTAGINT(values[0]); if (id <= 0 || id > maxmol) @@ -2559,7 +2559,7 @@ void FixRigidSmall::write_restart_file(const char *file) if (me == 0) { auto outfile = std::string(file) + ".rigid"; fp = fopen(outfile.c_str(),"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix rigid restart file {}: {}", outfile,utils::getsyserror())); @@ -3432,7 +3432,7 @@ void *FixRigidSmall::extract(const char *str, int &dim) return mass_body; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp index 2756ccbe910cba07816229dde96671a0247ecde7..564a66273e71cdd684433a113f19cb1c955d23b2 100644 --- a/src/RIGID/fix_shake.cpp +++ b/src/RIGID/fix_shake.cpp @@ -47,16 +47,16 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), bond_flag(NULL), angle_flag(NULL), - type_flag(NULL), mass_list(NULL), bond_distance(NULL), angle_distance(NULL), - loop_respa(NULL), step_respa(NULL), x(NULL), v(NULL), f(NULL), ftmp(NULL), - vtmp(NULL), mass(NULL), rmass(NULL), type(NULL), shake_flag(NULL), - shake_atom(NULL), shake_type(NULL), xshake(NULL), nshake(NULL), - list(NULL), b_count(NULL), b_count_all(NULL), b_ave(NULL), b_max(NULL), - b_min(NULL), b_ave_all(NULL), b_max_all(NULL), b_min_all(NULL), - a_count(NULL), a_count_all(NULL), a_ave(NULL), a_max(NULL), a_min(NULL), - a_ave_all(NULL), a_max_all(NULL), a_min_all(NULL), atommols(NULL), - onemols(NULL) + Fix(lmp, narg, arg), bond_flag(nullptr), angle_flag(nullptr), + type_flag(nullptr), mass_list(nullptr), bond_distance(nullptr), angle_distance(nullptr), + loop_respa(nullptr), step_respa(nullptr), x(nullptr), v(nullptr), f(nullptr), ftmp(nullptr), + vtmp(nullptr), mass(nullptr), rmass(nullptr), type(nullptr), shake_flag(nullptr), + shake_atom(nullptr), shake_type(nullptr), xshake(nullptr), nshake(nullptr), + list(nullptr), b_count(nullptr), b_count_all(nullptr), b_ave(nullptr), b_max(nullptr), + b_min(nullptr), b_ave_all(nullptr), b_max_all(nullptr), b_min_all(nullptr), + a_count(nullptr), a_count_all(nullptr), a_ave(nullptr), a_max(nullptr), a_min(nullptr), + a_ave_all(nullptr), a_max_all(nullptr), a_min_all(nullptr), atommols(nullptr), + onemols(nullptr) { MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); @@ -76,13 +76,13 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - shake_flag = NULL; - shake_atom = NULL; - shake_type = NULL; - xshake = NULL; + shake_flag = nullptr; + shake_atom = nullptr; + shake_type = nullptr; + xshake = nullptr; - ftmp = NULL; - vtmp = NULL; + ftmp = nullptr; + vtmp = nullptr; grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); @@ -161,7 +161,7 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : // parse optional args - onemols = NULL; + onemols = nullptr; int iarg = next; while (iarg < narg) { @@ -233,7 +233,7 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : // initialize list of SHAKE clusters to constrain maxlist = 0; - list = NULL; + list = nullptr; } /* ---------------------------------------------------------------------- */ @@ -367,7 +367,7 @@ void FixShake::init() // set equilibrium bond distances - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Bond potential must be defined for SHAKE"); for (i = 1; i <= atom->nbondtypes; i++) bond_distance[i] = force->bond->equilibrium_distance(i); @@ -378,7 +378,7 @@ void FixShake::init() for (i = 1; i <= atom->nangletypes; i++) { if (angle_flag[i] == 0) continue; - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Angle potential must be defined for SHAKE"); // scan all atoms for a SHAKE angle cluster @@ -2976,7 +2976,7 @@ void *FixShake::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"onemol") == 0) return onemols; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/SHOCK/fix_append_atoms.cpp b/src/SHOCK/fix_append_atoms.cpp index 601030fa2339eb05347ee3b1c8b96df370d23f96..428dfc67e404e46bcd19afc0a01d30b03b29645f 100644 --- a/src/SHOCK/fix_append_atoms.cpp +++ b/src/SHOCK/fix_append_atoms.cpp @@ -35,8 +35,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), randomx(NULL), randomt(NULL), basistype(NULL), - spatialid(NULL), gfactor1(NULL), gfactor2(NULL) + Fix(lmp, narg, arg), randomx(nullptr), randomt(nullptr), basistype(nullptr), + spatialid(nullptr), gfactor1(nullptr), gfactor2(nullptr) { force_reneighbor = 1; next_reneighbor = -1; @@ -48,7 +48,7 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : scaleflag = 1; spatflag=0; - spatialid = NULL; + spatialid = nullptr; xloflag = xhiflag = yloflag = yhiflag = zloflag = zhiflag = 0; tempflag = 0; @@ -58,8 +58,8 @@ FixAppendAtoms::FixAppendAtoms(LAMMPS *lmp, int narg, char **arg) : rany = 0.0; ranz = 0.0; - randomx = NULL; - randomt = NULL; + randomx = nullptr; + randomt = nullptr; if (domain->lattice->nbasis == 0) error->all(FLERR,"Fix append/atoms requires a lattice be defined"); diff --git a/src/SHOCK/fix_msst.cpp b/src/SHOCK/fix_msst.cpp index 3930133221d91b5a25caa1229921753b05ae9d28..1b2e73726b33b50d8465a1c74c652ca732d952bb 100644 --- a/src/SHOCK/fix_msst.cpp +++ b/src/SHOCK/fix_msst.cpp @@ -41,9 +41,9 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixMSST::FixMSST(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), old_velocity(NULL), rfix(NULL), - id_temp(NULL), id_press(NULL), id_pe(NULL), temperature(NULL), - pressure(NULL), pe(NULL) + Fix(lmp, narg, arg), old_velocity(nullptr), rfix(nullptr), + id_temp(nullptr), id_press(nullptr), id_pe(nullptr), temperature(nullptr), + pressure(nullptr), pe(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix msst command"); @@ -206,10 +206,10 @@ FixMSST::FixMSST(LAMMPS *lmp, int narg, char **arg) : omega[0] = omega[1] = omega[2] = 0.0; nrigid = 0; - rfix = NULL; + rfix = nullptr; maxold = -1; - old_velocity = NULL; + old_velocity = nullptr; } /* ---------------------------------------------------------------------- */ @@ -246,7 +246,7 @@ int FixMSST::setmask() void FixMSST::init() { - if (atom->mass == NULL) + if (atom->mass == nullptr) error->all(FLERR,"Cannot use fix msst without per-type mass defined"); // set compute ptrs @@ -287,7 +287,7 @@ void FixMSST::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (utils::strmatch(modify->fix[i]->style,"^rigid") || @@ -306,7 +306,7 @@ void FixMSST::init() for (int i = 0; i < modify->nfix; i++) if (utils::strmatch(modify->fix[i]->style,"^external$")) fix_external = (FixExternal *) modify->fix[i]; - if (fix_external == NULL) + if (fix_external == nullptr) error->all(FLERR,"Fix msst dftb cannot be used w/out fix external"); } } diff --git a/src/SHOCK/fix_nphug.cpp b/src/SHOCK/fix_nphug.cpp index 1179bb6b35253577920af964d533cf0b28c8c551..20fa909af2e309ea63a3f73357ea42baa3965795 100644 --- a/src/SHOCK/fix_nphug.cpp +++ b/src/SHOCK/fix_nphug.cpp @@ -30,7 +30,7 @@ enum{ISO,ANISO,TRICLINIC}; // same as fix_nh.cpp /* ---------------------------------------------------------------------- */ FixNPHug::FixNPHug(LAMMPS *lmp, int narg, char **arg) : - FixNH(lmp, narg, arg), pe(NULL), id_pe(NULL) + FixNH(lmp, narg, arg), pe(nullptr), id_pe(nullptr) { // Prevent masses from being updated every timestep diff --git a/src/SHOCK/fix_wall_piston.cpp b/src/SHOCK/fix_wall_piston.cpp index a796c1a4b4a4437568c0ab12485f0f6e804fcfdb..b375370226baa179105285b1b06626c247720620 100644 --- a/src/SHOCK/fix_wall_piston.cpp +++ b/src/SHOCK/fix_wall_piston.cpp @@ -31,15 +31,15 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ FixWallPiston::FixWallPiston(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), randomt(NULL), gfactor1(NULL), gfactor2(NULL) + Fix(lmp, narg, arg), randomt(nullptr), gfactor1(nullptr), gfactor2(nullptr) { force_reneighbor = 1; next_reneighbor = -1; if (narg < 4) error->all(FLERR,"Illegal fix wall/piston command"); - randomt = NULL; - gfactor1 = gfactor2 = NULL; + randomt = nullptr; + gfactor1 = gfactor2 = nullptr; tempflag = 0; scaleflag = 1; roughflag = 0; diff --git a/src/SNAP/compute_sna_atom.cpp b/src/SNAP/compute_sna_atom.cpp index 37b82b86f0fea468428ae303051e1bff4e41f01f..66d6abfb789fd235efc86112ff448da42c61b9ca 100644 --- a/src/SNAP/compute_sna_atom.cpp +++ b/src/SNAP/compute_sna_atom.cpp @@ -30,13 +30,13 @@ using namespace LAMMPS_NS; ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), cutsq(NULL), list(NULL), sna(NULL), - radelem(NULL), wjelem(NULL) + Compute(lmp, narg, arg), cutsq(nullptr), list(nullptr), sna(nullptr), + radelem(nullptr), wjelem(nullptr) { double rmin0, rfac0; int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag; - radelem = NULL; - wjelem = NULL; + radelem = nullptr; + wjelem = nullptr; int ntypes = atom->ntypes; int nargmin = 6+2*ntypes; @@ -145,7 +145,7 @@ ComputeSNAAtom::ComputeSNAAtom(LAMMPS *lmp, int narg, char **arg) : peratom_flag = 1; nmax = 0; - sna = NULL; + sna = nullptr; } /* ---------------------------------------------------------------------- */ @@ -163,7 +163,7 @@ ComputeSNAAtom::~ComputeSNAAtom() void ComputeSNAAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute sna/atom requires a pair style be defined"); if (cutmax > force->pair->cutforce) diff --git a/src/SNAP/compute_snad_atom.cpp b/src/SNAP/compute_snad_atom.cpp index bb546708b84a0c1010ca7bdb12e1775e53fc0438..e08679a374533a4cb25b58c86193c03d284b0b37 100644 --- a/src/SNAP/compute_snad_atom.cpp +++ b/src/SNAP/compute_snad_atom.cpp @@ -30,13 +30,13 @@ using namespace LAMMPS_NS; ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), cutsq(NULL), list(NULL), snad(NULL), - radelem(NULL), wjelem(NULL) + Compute(lmp, narg, arg), cutsq(nullptr), list(nullptr), snad(nullptr), + radelem(nullptr), wjelem(nullptr) { double rfac0, rmin0; int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag; - radelem = NULL; - wjelem = NULL; + radelem = nullptr; + wjelem = nullptr; int ntypes = atom->ntypes; int nargmin = 6+2*ntypes; @@ -147,7 +147,7 @@ ComputeSNADAtom::ComputeSNADAtom(LAMMPS *lmp, int narg, char **arg) : peratom_flag = 1; nmax = 0; - snad = NULL; + snad = nullptr; } /* ---------------------------------------------------------------------- */ @@ -165,7 +165,7 @@ ComputeSNADAtom::~ComputeSNADAtom() void ComputeSNADAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute snad/atom requires a pair style be defined"); if (cutmax > force->pair->cutforce) diff --git a/src/SNAP/compute_snap.cpp b/src/SNAP/compute_snap.cpp index ca989a75b41cfd13529d6cfe229d862f5a94612b..5537d2c933edd89cf14c31c356399f7fdbccd2e6 100644 --- a/src/SNAP/compute_snap.cpp +++ b/src/SNAP/compute_snap.cpp @@ -32,9 +32,9 @@ using namespace LAMMPS_NS; enum{SCALAR,VECTOR,ARRAY}; ComputeSnap::ComputeSnap(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), cutsq(NULL), list(NULL), snap(NULL), - snapall(NULL), snap_peratom(NULL), radelem(NULL), wjelem(NULL), - snaptr(NULL) + Compute(lmp, narg, arg), cutsq(nullptr), list(nullptr), snap(nullptr), + snapall(nullptr), snap_peratom(nullptr), radelem(nullptr), wjelem(nullptr), + snaptr(nullptr) { array_flag = 1; @@ -42,8 +42,8 @@ ComputeSnap::ComputeSnap(LAMMPS *lmp, int narg, char **arg) : double rfac0, rmin0; int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag; - radelem = NULL; - wjelem = NULL; + radelem = nullptr; + wjelem = nullptr; int ntypes = atom->ntypes; int nargmin = 6+2*ntypes; @@ -180,7 +180,7 @@ ComputeSnap::~ComputeSnap() void ComputeSnap::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute snap requires a pair style be defined"); if (cutmax > force->pair->cutforce) diff --git a/src/SNAP/compute_snav_atom.cpp b/src/SNAP/compute_snav_atom.cpp index dd562cac5c84285730bb7318cf9413ec6999dbff..cace5e532fd8daac597dbe6342c14ba29df3d6ef 100644 --- a/src/SNAP/compute_snav_atom.cpp +++ b/src/SNAP/compute_snav_atom.cpp @@ -29,13 +29,13 @@ using namespace LAMMPS_NS; ComputeSNAVAtom::ComputeSNAVAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), cutsq(NULL), list(NULL), snav(NULL), - radelem(NULL), wjelem(NULL) + Compute(lmp, narg, arg), cutsq(nullptr), list(nullptr), snav(nullptr), + radelem(nullptr), wjelem(nullptr) { double rfac0, rmin0; int twojmax, switchflag, bzeroflag, bnormflag, wselfallflag; - radelem = NULL; - wjelem = NULL; + radelem = nullptr; + wjelem = nullptr; int ntypes = atom->ntypes; int nargmin = 6+2*ntypes; @@ -140,7 +140,7 @@ ComputeSNAVAtom::ComputeSNAVAtom(LAMMPS *lmp, int narg, char **arg) : peratom_flag = 1; nmax = 0; - snav = NULL; + snav = nullptr; } @@ -160,7 +160,7 @@ ComputeSNAVAtom::~ComputeSNAVAtom() void ComputeSNAVAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute snav/atom requires a pair style be defined"); // TODO: Not sure what to do with this error check since cutoff radius is not // a single number diff --git a/src/SNAP/pair_snap.cpp b/src/SNAP/pair_snap.cpp index cb1a71aa453849b119412fe5f850cd5546461ecd..e3b8fdfa98c9952b738b77878f0b267afc6c18e9 100644 --- a/src/SNAP/pair_snap.cpp +++ b/src/SNAP/pair_snap.cpp @@ -42,15 +42,15 @@ PairSNAP::PairSNAP(LAMMPS *lmp) : Pair(lmp) manybody_flag = 1; nelements = 0; - elements = NULL; - radelem = NULL; - wjelem = NULL; - coeffelem = NULL; + elements = nullptr; + radelem = nullptr; + wjelem = nullptr; + coeffelem = nullptr; beta_max = 0; - beta = NULL; - bispectrum = NULL; - snaptr = NULL; + beta = nullptr; + bispectrum = nullptr; + snaptr = nullptr; } /* ---------------------------------------------------------------------- */ @@ -516,7 +516,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) FILE *fpcoeff; if (comm->me == 0) { fpcoeff = utils::open_potential(coefffilename,lmp,nullptr); - if (fpcoeff == NULL) { + if (fpcoeff == nullptr) { char str[128]; snprintf(str,128,"Cannot open SNAP coefficient file %s",coefffilename); error->one(FLERR,str); @@ -531,7 +531,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) while (nwords == 0) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpcoeff); } else n = strlen(line) + 1; @@ -556,7 +556,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) int iword = 0; words[iword] = strtok(line,"' \t\n\r\f"); iword = 1; - words[iword] = strtok(NULL,"' \t\n\r\f"); + words[iword] = strtok(nullptr,"' \t\n\r\f"); nelements = atoi(words[0]); ncoeffall = atoi(words[1]); @@ -574,7 +574,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpcoeff); } else n = strlen(line) + 1; @@ -592,9 +592,9 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) iword = 0; words[iword] = strtok(line,"' \t\n\r\f"); iword = 1; - words[iword] = strtok(NULL,"' \t\n\r\f"); + words[iword] = strtok(nullptr,"' \t\n\r\f"); iword = 2; - words[iword] = strtok(NULL,"' \t\n\r\f"); + words[iword] = strtok(nullptr,"' \t\n\r\f"); char* elemtmp = words[0]; int n = strlen(elemtmp) + 1; @@ -615,7 +615,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) for (int icoeff = 0; icoeff < ncoeffall; icoeff++) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpcoeff); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpcoeff); } else n = strlen(line) + 1; @@ -663,7 +663,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) FILE *fpparam; if (comm->me == 0) { fpparam = utils::open_potential(paramfilename,lmp,nullptr); - if (fpparam == NULL) { + if (fpparam == nullptr) { char str[128]; snprintf(str,128,"Cannot open SNAP parameter file %s",paramfilename); error->one(FLERR,str); @@ -674,7 +674,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fpparam); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fpparam); } else n = strlen(line) + 1; @@ -697,7 +697,7 @@ void PairSNAP::read_files(char *coefffilename, char *paramfilename) // strip single and double quotes from words char* keywd = strtok(line,"' \t\n\r\f"); - char* keyval = strtok(NULL,"' \t\n\r\f"); + char* keyval = strtok(nullptr,"' \t\n\r\f"); if (comm->me == 0) { if (screen) fprintf(screen,"SNAP keyword %s %s \n",keywd,keyval); diff --git a/src/SNAP/sna.cpp b/src/SNAP/sna.cpp index e003ec7ca8e32a4bcb5a215c4c5fb977872ad158..ae250c6f76e3e1ef26ba42baa4715e5e949ad45e 100644 --- a/src/SNAP/sna.cpp +++ b/src/SNAP/sna.cpp @@ -134,16 +134,16 @@ SNA::SNA(LAMMPS* lmp, double rfac0_in, int twojmax_in, compute_ncoeff(); - rij = NULL; - inside = NULL; - wj = NULL; - rcutij = NULL; - element = NULL; + rij = nullptr; + inside = nullptr; + wj = nullptr; + rcutij = nullptr; + element = nullptr; nmax = 0; - idxz = NULL; - idxb = NULL; - ulist_r_ij = NULL; - ulist_i_ij = NULL; + idxz = nullptr; + idxb = nullptr; + ulist_r_ij = nullptr; + ulist_i_ij = nullptr; build_indexlist(); create_twojmax_arrays(); @@ -1332,7 +1332,7 @@ void SNA::create_twojmax_arrays() if (bzero_flag) memory->create(bzero, twojmax+1,"sna:bzero"); else - bzero = NULL; + bzero = nullptr; } diff --git a/src/SPIN/compute_spin.cpp b/src/SPIN/compute_spin.cpp index 281100740aadd5f2c6d4f9a0ddc9609f2cc0d341..32f9e735182fdc329a3df423b6f48cc79eac810a 100644 --- a/src/SPIN/compute_spin.cpp +++ b/src/SPIN/compute_spin.cpp @@ -41,7 +41,7 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ ComputeSpin::ComputeSpin(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), pair(NULL), spin_pairs(NULL) + Compute(lmp, narg, arg), pair(nullptr), spin_pairs(nullptr) { if ((narg != 3) && (narg != 4)) error->all(FLERR,"Illegal compute compute/spin command"); diff --git a/src/SPIN/fix_langevin_spin.cpp b/src/SPIN/fix_langevin_spin.cpp index 82bf83ac10342b9a222d0ffe1b352226ac2b4030..2b3aa363f635afe1c92a690e99df5264ef9c8403 100644 --- a/src/SPIN/fix_langevin_spin.cpp +++ b/src/SPIN/fix_langevin_spin.cpp @@ -43,7 +43,7 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ FixLangevinSpin::FixLangevinSpin(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), id_temp(NULL), random(NULL) + Fix(lmp, narg, arg), id_temp(nullptr), random(nullptr) { if (narg != 6) error->all(FLERR,"Illegal langevin/spin command"); diff --git a/src/SPIN/fix_neb_spin.cpp b/src/SPIN/fix_neb_spin.cpp index 0b2e86e4656c1858bd4489fc129911a00f91af91..b2982e7bc0848f30b9ef49488c5a2e51d644e25d 100644 --- a/src/SPIN/fix_neb_spin.cpp +++ b/src/SPIN/fix_neb_spin.cpp @@ -46,13 +46,13 @@ enum{SINGLE_PROC_DIRECT,SINGLE_PROC_MAP,MULTI_PROC}; /* ---------------------------------------------------------------------- */ FixNEBSpin::FixNEBSpin(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), id_pe(NULL), pe(NULL), nlenall(NULL), xprev(NULL), - xnext(NULL), fnext(NULL), spprev(NULL), spnext(NULL), fmnext(NULL), springF(NULL), - tangent(NULL), xsend(NULL), xrecv(NULL), fsend(NULL), frecv(NULL), spsend(NULL), - sprecv(NULL), fmsend(NULL), fmrecv(NULL), tagsend(NULL), tagrecv(NULL), - xsendall(NULL), xrecvall(NULL), fsendall(NULL), frecvall(NULL), spsendall(NULL), - sprecvall(NULL), fmsendall(NULL), fmrecvall(NULL), tagsendall(NULL), tagrecvall(NULL), - counts(NULL), displacements(NULL) + Fix(lmp, narg, arg), id_pe(nullptr), pe(nullptr), nlenall(nullptr), xprev(nullptr), + xnext(nullptr), fnext(nullptr), spprev(nullptr), spnext(nullptr), fmnext(nullptr), springF(nullptr), + tangent(nullptr), xsend(nullptr), xrecv(nullptr), fsend(nullptr), frecv(nullptr), spsend(nullptr), + sprecv(nullptr), fmsend(nullptr), fmrecv(nullptr), tagsend(nullptr), tagrecv(nullptr), + xsendall(nullptr), xrecvall(nullptr), fsendall(nullptr), frecvall(nullptr), spsendall(nullptr), + sprecvall(nullptr), fmsendall(nullptr), fmrecvall(nullptr), tagsendall(nullptr), tagrecvall(nullptr), + counts(nullptr), displacements(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix neb_spin command"); @@ -229,7 +229,7 @@ void FixNEBSpin::init() if (atom->nmax > maxlocal) reallocate(); - if (MULTI_PROC && counts == NULL) { + if (MULTI_PROC && counts == nullptr) { memory->create(xsendall,ntotal,3,"neb:xsendall"); memory->create(xrecvall,ntotal,3,"neb:xrecvall"); memory->create(fsendall,ntotal,3,"neb:fsendall"); @@ -861,9 +861,9 @@ void FixNEBSpin::inter_replica_comm() MPI_Gatherv(fsend[0],3*m,MPI_DOUBLE, fsendall[0],counts,displacements,MPI_DOUBLE,0,world); } else { - MPI_Gatherv(NULL,3*m,MPI_DOUBLE, + MPI_Gatherv(nullptr,3*m,MPI_DOUBLE, xsendall[0],counts,displacements,MPI_DOUBLE,0,world); - MPI_Gatherv(NULL,3*m,MPI_DOUBLE, + MPI_Gatherv(nullptr,3*m,MPI_DOUBLE, fsendall[0],counts,displacements,MPI_DOUBLE,0,world); } if (spsend) { @@ -872,9 +872,9 @@ void FixNEBSpin::inter_replica_comm() MPI_Gatherv(fmsend[0],3*m,MPI_DOUBLE, fmsendall[0],counts,displacements,MPI_DOUBLE,0,world); } else { - MPI_Gatherv(NULL,3*m,MPI_DOUBLE, + MPI_Gatherv(nullptr,3*m,MPI_DOUBLE, spsendall[0],counts,displacements,MPI_DOUBLE,0,world); - MPI_Gatherv(NULL,3*m,MPI_DOUBLE, + MPI_Gatherv(nullptr,3*m,MPI_DOUBLE, fmsendall[0],counts,displacements,MPI_DOUBLE,0,world); } diff --git a/src/SPIN/fix_nve_spin.cpp b/src/SPIN/fix_nve_spin.cpp index c72faddd301669423fe8c3bde348deba4c99a84c..364994741e45d1397dae2a3f11c6b7b1e6c40d05 100644 --- a/src/SPIN/fix_nve_spin.cpp +++ b/src/SPIN/fix_nve_spin.cpp @@ -60,9 +60,9 @@ enum{NONE}; FixNVESpin::FixNVESpin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - pair(NULL), spin_pairs(NULL), - rsec(NULL), stack_head(NULL), stack_foot(NULL), - backward_stacks(NULL), forward_stacks(NULL) + pair(nullptr), spin_pairs(nullptr), + rsec(nullptr), stack_head(nullptr), stack_foot(nullptr), + backward_stacks(nullptr), forward_stacks(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_nve_spin); diff --git a/src/SPIN/fix_precession_spin.cpp b/src/SPIN/fix_precession_spin.cpp index cbb367e43866814b1ad7d58015d2b800ce182efb..f4dfddd3caa00910dc1bab84330786bcb890d7eb 100644 --- a/src/SPIN/fix_precession_spin.cpp +++ b/src/SPIN/fix_precession_spin.cpp @@ -44,7 +44,7 @@ enum{CONSTANT,EQUAL}; /* ---------------------------------------------------------------------- */ -FixPrecessionSpin::FixPrecessionSpin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), emag(NULL) +FixPrecessionSpin::FixPrecessionSpin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), emag(nullptr) { if (narg < 7) error->all(FLERR,"Illegal precession/spin command"); @@ -59,7 +59,7 @@ FixPrecessionSpin::FixPrecessionSpin(LAMMPS *lmp, int narg, char **arg) : Fix(lm respa_level_support = 1; ilevel_respa = 0; - magstr = NULL; + magstr = nullptr; magfieldstyle = CONSTANT; H_field = 0.0; diff --git a/src/SPIN/fix_setforce_spin.cpp b/src/SPIN/fix_setforce_spin.cpp index ec738b7522ce447c7df93fc11b4e93e76a7c358d..1f38ee43ec81f980c2f4aea4a92fb0d5f22b7c9b 100644 --- a/src/SPIN/fix_setforce_spin.cpp +++ b/src/SPIN/fix_setforce_spin.cpp @@ -52,7 +52,7 @@ void FixSetForceSpin::post_force(int /*vflag*/) // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); @@ -124,7 +124,7 @@ void FixSetForceSpin::single_setforce_spin(int i, double fmi[3]) // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); @@ -195,7 +195,7 @@ void FixSetForceSpin::post_force_respa(int vflag, int ilevel, int /*iloop*/) if (ilevel == ilevel_respa) post_force(vflag); else { - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/SPIN/min_spin_cg.cpp b/src/SPIN/min_spin_cg.cpp index 4b8b74541940c270212b19232a88c3ba47c25cdf..817c149390396bf0d21e03622b0ef44e5c760b2f 100644 --- a/src/SPIN/min_spin_cg.cpp +++ b/src/SPIN/min_spin_cg.cpp @@ -60,7 +60,7 @@ static const char cite_minstyle_spin_cg[] = /* ---------------------------------------------------------------------- */ MinSpinCG::MinSpinCG(LAMMPS *lmp) : - Min(lmp), g_old(NULL), g_cur(NULL), p_s(NULL), sp_copy(NULL) + Min(lmp), g_old(nullptr), g_cur(nullptr), p_s(nullptr), sp_copy(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_minstyle_spin_cg); nlocal_max = 0; diff --git a/src/SPIN/min_spin_lbfgs.cpp b/src/SPIN/min_spin_lbfgs.cpp index 40029b7e7179ded12b62457950344d53d68eeb56..edabcf6bbf148c7bff628e4a9661692cde60b039 100644 --- a/src/SPIN/min_spin_lbfgs.cpp +++ b/src/SPIN/min_spin_lbfgs.cpp @@ -60,7 +60,7 @@ static const char cite_minstyle_spin_lbfgs[] = /* ---------------------------------------------------------------------- */ MinSpinLBFGS::MinSpinLBFGS(LAMMPS *lmp) : - Min(lmp), g_old(NULL), g_cur(NULL), p_s(NULL), rho(NULL), ds(NULL), dy(NULL), sp_copy(NULL) + Min(lmp), g_old(nullptr), g_cur(nullptr), p_s(nullptr), rho(nullptr), ds(nullptr), dy(nullptr), sp_copy(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_minstyle_spin_lbfgs); nlocal_max = 0; diff --git a/src/SPIN/neb_spin.cpp b/src/SPIN/neb_spin.cpp index 498d0bc923338572e5594b595ff9feedaeea682c..8abf7b8e7ce98cd5037aab52a318ffce881ef3e2 100644 --- a/src/SPIN/neb_spin.cpp +++ b/src/SPIN/neb_spin.cpp @@ -384,7 +384,7 @@ void NEBSpin::readfile(char *file, int flag) open(file); while (1) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of neb/spin file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of neb/spin file"); start = &line[strspn(line," \t\n\v\f\r")]; if (*start != '\0' && *start != '#') break; } @@ -398,7 +398,7 @@ void NEBSpin::readfile(char *file, int flag) open(file); while (1) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of neb/spin file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of neb/spin file"); start = &line[strspn(line," \t\n\v\f\r")]; if (*start != '\0' && *start != '#') break; } @@ -452,7 +452,7 @@ void NEBSpin::readfile(char *file, int flag) values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) - values[j] = strtok(NULL," \t\n\r\f"); + values[j] = strtok(nullptr," \t\n\r\f"); // adjust spin coord based on replica fraction // for flag = 0, interpolate for intermediate and final replicas @@ -705,7 +705,7 @@ void NEBSpin::open(char *file) #endif } - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); diff --git a/src/SPIN/pair_spin.cpp b/src/SPIN/pair_spin.cpp index b0965d12711ae1e1b8c5feee845fce8e957005a8..53dd6530bf301d16993c84a75b40c132b436b605 100644 --- a/src/SPIN/pair_spin.cpp +++ b/src/SPIN/pair_spin.cpp @@ -42,7 +42,7 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ -PairSpin::PairSpin(LAMMPS *lmp) : Pair(lmp), emag(NULL) +PairSpin::PairSpin(LAMMPS *lmp) : Pair(lmp), emag(nullptr) { hbar = force->hplanck/MY_2PI; single_enable = 0; diff --git a/src/SPIN/pair_spin.h b/src/SPIN/pair_spin.h index 8bbb27ed0639f0f563ec56ad1f17526c057fa3dc..9db2bd4177b8991cac898d17c5ba1d5d4d718096 100644 --- a/src/SPIN/pair_spin.h +++ b/src/SPIN/pair_spin.h @@ -27,7 +27,7 @@ friend class FixNVESpin; virtual void coeff(int, char **) {} virtual void init_style(); virtual double init_one(int, int) {return 0.0;} - virtual void *extract(const char *, int &) {return NULL;} + virtual void *extract(const char *, int &) {return nullptr;} virtual void compute(int, int) {} virtual void compute_single_pair(int, double *) {} diff --git a/src/SPIN/pair_spin_dipole_cut.cpp b/src/SPIN/pair_spin_dipole_cut.cpp index b27c9736b2ab4a8adba741182ae32e7cc1deeb29..7444be347a2b291e42c772d1222a6f8b6b62d777 100644 --- a/src/SPIN/pair_spin_dipole_cut.cpp +++ b/src/SPIN/pair_spin_dipole_cut.cpp @@ -154,7 +154,7 @@ void *PairSpinDipoleCut::extract(const char *str, int &dim) dim = 0; return (void *) &mix_flag; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -448,11 +448,11 @@ void PairSpinDipoleCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut_spin_long[i][j],sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_long[i][j],sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_long[i][j],1,MPI_INT,0,world); } @@ -477,8 +477,8 @@ void PairSpinDipoleCut::write_restart_settings(FILE *fp) void PairSpinDipoleCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_spin_long_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_long_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_long_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); diff --git a/src/SPIN/pair_spin_dipole_long.cpp b/src/SPIN/pair_spin_dipole_long.cpp index d4b1b8e43ea75791565402b7e14c63828298f058..28a70a047de694889918ac22d32891c4148aed9d 100644 --- a/src/SPIN/pair_spin_dipole_long.cpp +++ b/src/SPIN/pair_spin_dipole_long.cpp @@ -133,7 +133,7 @@ void PairSpinDipoleLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -174,7 +174,7 @@ void *PairSpinDipoleLong::extract(const char *str, int &dim) dim = 0; return (void *) &mix_flag; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -527,11 +527,11 @@ void PairSpinDipoleLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut_spin_long[i][j],sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_long[i][j],sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_long[i][j],1,MPI_INT,0,world); } @@ -556,8 +556,8 @@ void PairSpinDipoleLong::write_restart_settings(FILE *fp) void PairSpinDipoleLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_spin_long_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_long_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_long_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); diff --git a/src/SPIN/pair_spin_dmi.cpp b/src/SPIN/pair_spin_dmi.cpp index e27f9fad7dd57b19d4533a69084a28d816a4efae..e2ddd708df0c6b47c705ae89f89adc2510b2a5fd 100644 --- a/src/SPIN/pair_spin_dmi.cpp +++ b/src/SPIN/pair_spin_dmi.cpp @@ -156,7 +156,7 @@ void *PairSpinDmi::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut") == 0) return (void *) &cut_spin_dmi_global; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -477,18 +477,18 @@ void PairSpinDmi::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&DM[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&v_dmx[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&v_dmy[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&v_dmz[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&vmech_dmx[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&vmech_dmy[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&vmech_dmz[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_spin_dmi[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&DM[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&v_dmx[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&v_dmy[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&v_dmz[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&vmech_dmx[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&vmech_dmy[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&vmech_dmz[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_spin_dmi[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&DM[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&v_dmx[i][j],1,MPI_DOUBLE,0,world); @@ -522,9 +522,9 @@ void PairSpinDmi::write_restart_settings(FILE *fp) void PairSpinDmi::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_spin_dmi_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_dmi_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_dmi_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/SPIN/pair_spin_exchange.cpp b/src/SPIN/pair_spin_exchange.cpp index 27da47dd0f782e8262a87ad884da6a434fde6e14..ba9bddb7c8c51b48dcf373705d508eacd13397ab 100644 --- a/src/SPIN/pair_spin_exchange.cpp +++ b/src/SPIN/pair_spin_exchange.cpp @@ -141,7 +141,7 @@ void *PairSpinExchange::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut") == 0) return (void *) &cut_spin_exchange_global; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -467,15 +467,15 @@ void PairSpinExchange::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&J1_mag[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&J1_mech[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&J2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&J3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_spin_exchange[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&J1_mag[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&J1_mech[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&J2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&J3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_spin_exchange[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&J1_mag[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&J1_mech[i][j],1,MPI_DOUBLE,0,world); @@ -506,9 +506,9 @@ void PairSpinExchange::write_restart_settings(FILE *fp) void PairSpinExchange::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_spin_exchange_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_exchange_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_exchange_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/SPIN/pair_spin_magelec.cpp b/src/SPIN/pair_spin_magelec.cpp index 2242cf985d5bbfdc008ca8b81b3226f1e5cfe103..849590bad215405b21db6cbc221be9ff40535b46 100644 --- a/src/SPIN/pair_spin_magelec.cpp +++ b/src/SPIN/pair_spin_magelec.cpp @@ -149,7 +149,7 @@ void *PairSpinMagelec::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut") == 0) return (void *) &cut_spin_magelec_global; - return NULL; + return nullptr; } @@ -465,15 +465,15 @@ void PairSpinMagelec::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&ME[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&v_mex[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&v_mey[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&v_mez[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_spin_magelec[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&ME[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&v_mex[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&v_mey[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&v_mez[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_spin_magelec[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&ME[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&v_mex[i][j],1,MPI_DOUBLE,0,world); @@ -503,9 +503,9 @@ void PairSpinMagelec::write_restart_settings(FILE *fp) void PairSpinMagelec::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_spin_magelec_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_magelec_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_magelec_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/SPIN/pair_spin_neel.cpp b/src/SPIN/pair_spin_neel.cpp index 33ea904c0c5eef43d94fe373c826877aa72b1659..1e50ee48a602b84b0fe90144f6d85f922d2c3b13 100644 --- a/src/SPIN/pair_spin_neel.cpp +++ b/src/SPIN/pair_spin_neel.cpp @@ -156,7 +156,7 @@ void *PairSpinNeel::extract(const char *str, int &dim) { dim = 0; if (strcmp(str,"cut") == 0) return (void *) &cut_spin_neel_global; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -681,19 +681,19 @@ void PairSpinNeel::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&g1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&g1_mech[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&g2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&g3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&q1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&q1_mech[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&q2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&q3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_spin_neel[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&g1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&g1_mech[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&g2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&g3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&q1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&q1_mech[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&q2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&q3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_spin_neel[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&g1[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&g1_mech[i][j],1,MPI_DOUBLE,0,world); @@ -727,9 +727,9 @@ void PairSpinNeel::write_restart_settings(FILE *fp) void PairSpinNeel::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_spin_neel_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_spin_neel_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_spin_neel_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/SRD/fix_srd.cpp b/src/SRD/fix_srd.cpp index 688522c1bdb68ce2ff8e9382399e4b1c4a38d9a9..50a27b5faecad55cdffdb02865e9f42b94e5ee73 100644 --- a/src/SRD/fix_srd.cpp +++ b/src/SRD/fix_srd.cpp @@ -77,12 +77,12 @@ static const char cite_fix_srd[] = /* ---------------------------------------------------------------------- */ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - wallfix(NULL), wallwhich(NULL), xwall(NULL), xwallhold(NULL), - vwall(NULL), fwall(NULL), avec_ellipsoid(NULL), avec_line(NULL), - avec_tri(NULL), random(NULL), randomshift(NULL), flocal(NULL), - tlocal(NULL), biglist(NULL), binhead(NULL), binnext(NULL), sbuf1(NULL), - sbuf2(NULL), rbuf1(NULL), rbuf2(NULL), nbinbig(NULL), binbig(NULL), - binsrd(NULL), stencil(NULL) + wallfix(nullptr), wallwhich(nullptr), xwall(nullptr), xwallhold(nullptr), + vwall(nullptr), fwall(nullptr), avec_ellipsoid(nullptr), avec_line(nullptr), + avec_tri(nullptr), random(nullptr), randomshift(nullptr), flocal(nullptr), + tlocal(nullptr), biglist(nullptr), binhead(nullptr), binnext(nullptr), sbuf1(nullptr), + sbuf2(nullptr), rbuf1(nullptr), rbuf2(nullptr), nbinbig(nullptr), binbig(nullptr), + binsrd(nullptr), stencil(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_srd); @@ -232,7 +232,7 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), if (shiftuser == SHIFT_YES || shiftuser == SHIFT_POSSIBLE) randomshift = new RanPark(lmp,shiftseed); - else randomshift = NULL; + else randomshift = nullptr; // initialize data structs and flags @@ -240,31 +240,31 @@ FixSRD::FixSRD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), else biggroupbit = 0; nmax = 0; - binhead = NULL; + binhead = nullptr; maxbin1 = 0; - binnext = NULL; + binnext = nullptr; maxbuf = 0; - sbuf1 = sbuf2 = rbuf1 = rbuf2 = NULL; + sbuf1 = sbuf2 = rbuf1 = rbuf2 = nullptr; shifts[0].maxvbin = shifts[1].maxvbin = 0; - shifts[0].vbin = shifts[1].vbin = NULL; + shifts[0].vbin = shifts[1].vbin = nullptr; shifts[0].maxbinsq = shifts[1].maxbinsq = 0; for (int ishift = 0; ishift < 2; ishift++) for (int iswap = 0; iswap < 6; iswap++) shifts[ishift].bcomm[iswap].sendlist = - shifts[ishift].bcomm[iswap].recvlist = NULL; + shifts[ishift].bcomm[iswap].recvlist = nullptr; maxbin2 = 0; - nbinbig = NULL; - binbig = NULL; - binsrd = NULL; + nbinbig = nullptr; + binbig = nullptr; + binsrd = nullptr; nstencil = maxstencil = 0; - stencil = NULL; + stencil = nullptr; maxbig = 0; - biglist = NULL; + biglist = nullptr; stats_flag = 1; for (int i = 0; i < size_vector; i++) stats_all[i] = 0.0; @@ -1367,7 +1367,7 @@ void FixSRD::collisions_single() else slip_wall(v[i],j,norm,vsnew); } else { if (type != WALL) noslip(v[i],v[j],x[j],big,-1, xscoll,norm,vsnew); - else noslip(v[i],NULL,x[j],big,j,xscoll,norm,vsnew); + else noslip(v[i],nullptr,x[j],big,j,xscoll,norm,vsnew); } if (dimension == 2) vsnew[2] = 0.0; @@ -1387,7 +1387,7 @@ void FixSRD::collisions_single() // BIG particle is not torqued if sphere and SLIP collision if (collidestyle == SLIP && type == SPHERE) - force_torque(v[i],vsnew,xscoll,xbcoll,f[j],NULL); + force_torque(v[i],vsnew,xscoll,xbcoll,f[j],nullptr); else if (type != WALL) force_torque(v[i],vsnew,xscoll,xbcoll,f[j],torque[j]); else if (type == WALL) @@ -1557,7 +1557,7 @@ void FixSRD::collisions_multi() else slip_wall(v[i],j,norm,vsnew); } else { if (type != WALL) noslip(v[i],v[j],x[j],big,-1,xscoll,norm,vsnew); - else noslip(v[i],NULL,x[j],big,j,xscoll,norm,vsnew); + else noslip(v[i],nullptr,x[j],big,j,xscoll,norm,vsnew); } if (dimension == 2) vsnew[2] = 0.0; @@ -1576,7 +1576,7 @@ void FixSRD::collisions_multi() // BIG particle is not torqued if sphere and SLIP collision if (collidestyle == SLIP && type == SPHERE) - force_torque(v[i],vsnew,xscoll,xbcoll,f[j],NULL); + force_torque(v[i],vsnew,xscoll,xbcoll,f[j],nullptr); else if (type != WALL) force_torque(v[i],vsnew,xscoll,xbcoll,f[j],torque[j]); else if (type == WALL) diff --git a/src/SRD/fix_wall_srd.cpp b/src/SRD/fix_wall_srd.cpp index 8ffd764447b400efdc70466c3487304999815843..aa8a4140abf49b768afc926bfb93d2b877769516 100644 --- a/src/SRD/fix_wall_srd.cpp +++ b/src/SRD/fix_wall_srd.cpp @@ -34,7 +34,7 @@ enum{NONE,EDGE,CONSTANT,VARIABLE}; /* ---------------------------------------------------------------------- */ FixWallSRD::FixWallSRD(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), nwall(0), fwall(NULL), fwall_all(NULL) + Fix(lmp, narg, arg), nwall(0), fwall(nullptr), fwall_all(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix wall/srd command"); diff --git a/src/USER-ADIOS/dump_atom_adios.cpp b/src/USER-ADIOS/dump_atom_adios.cpp index 3012223ac71691559f355743dbd23c6feafebc34..121bb193e1caa8613f532cbb4d71057dfe664e8b 100644 --- a/src/USER-ADIOS/dump_atom_adios.cpp +++ b/src/USER-ADIOS/dump_atom_adios.cpp @@ -190,7 +190,7 @@ void DumpAtomADIOS::write() if (sort_flag && sortcol == 0) pack(ids); else - pack(NULL); + pack(nullptr); if (sort_flag) sort(); diff --git a/src/USER-ADIOS/dump_custom_adios.cpp b/src/USER-ADIOS/dump_custom_adios.cpp index f7015ef6960c6ab6d51687b89a4abe9cbc68edbd..921c725bc2db868a4ae505027cbc93c9e7617fe7 100644 --- a/src/USER-ADIOS/dump_custom_adios.cpp +++ b/src/USER-ADIOS/dump_custom_adios.cpp @@ -274,7 +274,7 @@ void DumpCustomADIOS::write() if (sort_flag && sortcol == 0) pack(ids); else - pack(NULL); + pack(nullptr); if (sort_flag) sort(); diff --git a/src/USER-ADIOS/reader_adios.cpp b/src/USER-ADIOS/reader_adios.cpp index d1e731343996c21974b5e2789a9995564368dce9..89a9ae698acc7bb7ce2bda074691ecc440f05c74 100644 --- a/src/USER-ADIOS/reader_adios.cpp +++ b/src/USER-ADIOS/reader_adios.cpp @@ -73,7 +73,7 @@ public: ReaderADIOS::ReaderADIOS(LAMMPS *lmp) : Reader(lmp) { - fieldindex = NULL; + fieldindex = nullptr; nAtoms = 0; nAtomsTotal = 0; atomOffset = 0; @@ -230,7 +230,7 @@ void ReaderADIOS::skip() { internal->fh.EndStep(); } match Nfield fields to per-atom column labels allocate and set fieldindex = which column each field maps to fieldtype = X,VX,IZ etc - fieldlabel = user-specified label or NULL if use fieldtype default + fieldlabel = user-specified label or nullptr if use fieldtype default xyz flag = scaledflag if has fieldlabel name, else set by x,xs,xu,xsu only called by proc 0 ------------------------------------------------------------------------- */ diff --git a/src/USER-ATC/fix_atc.cpp b/src/USER-ATC/fix_atc.cpp index e60e0bcb6fcadfd8f32e5aada3765c603f2bf27e..1e1f11b5a797593645c35178b8f387dafab73f8f 100644 --- a/src/USER-ATC/fix_atc.cpp +++ b/src/USER-ATC/fix_atc.cpp @@ -48,7 +48,7 @@ using std::string; /* ------------------------------------------------------------------------- */ FixATC::FixATC(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - lammps_(lmp), atc_(NULL) + lammps_(lmp), atc_(nullptr) { // ID GROUP atc PHYSICSTYPE [PARAMETERFILE] if (narg < 4 || narg > 5) lmp->error->all(FLERR,"Illegal fix atc command"); diff --git a/src/USER-AWPMD/pair_awpmd_cut.cpp b/src/USER-AWPMD/pair_awpmd_cut.cpp index 5e23b7fc69df54eeb5e6d0ead09dfa289b0c4a04..870a154073afa1f6cc3cdb27b3f5757936040dac 100644 --- a/src/USER-AWPMD/pair_awpmd_cut.cpp +++ b/src/USER-AWPMD/pair_awpmd_cut.cpp @@ -49,8 +49,8 @@ PairAWPMDCut::PairAWPMDCut(LAMMPS *lmp) : Pair(lmp) single_enable = 0; nmax = 0; - min_var = NULL; - min_varforce = NULL; + min_var = nullptr; + min_varforce = nullptr; nextra = 4; pvector = new double[nextra]; @@ -82,7 +82,7 @@ PairAWPMDCut::~PairAWPMDCut() struct cmp_x{ double **xx; double tol; - cmp_x(double **xx_=NULL, double tol_=1e-12):xx(xx_),tol(tol_){} + cmp_x(double **xx_=nullptr, double tol_=1e-12):xx(xx_),tol(tol_){} bool operator()(const pair &left, const pair &right) const { if(left.first==right.first){ double d=xx[left.second][0]-xx[right.second][0]; @@ -241,7 +241,7 @@ void PairAWPMDCut::compute(int eflag, int vflag) error->all(FLERR,logfmt("Invalid spin value (%d) for particle %d !",spin[i],i)); } // ion force vector - Vector_3 *fi=NULL; + Vector_3 *fi=nullptr; if(wpmd->ni) fi= new Vector_3[wpmd->ni]; @@ -269,7 +269,7 @@ void PairAWPMDCut::compute(int eflag, int vflag) atom->ervel[i]=pv/(m*ermscale); } } - wpmd->set_pbc(NULL); // not required for LAMMPS + wpmd->set_pbc(nullptr); // not required for LAMMPS wpmd->interaction(0x1|0x4|0x10,fi); // get forces from the AWPMD solver object @@ -602,10 +602,10 @@ void PairAWPMDCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { - if (me == 0) utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); } } @@ -629,9 +629,9 @@ void PairAWPMDCut::write_restart_settings(FILE *fp) void PairAWPMDCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/USER-BOCS/compute_pressure_bocs.cpp b/src/USER-BOCS/compute_pressure_bocs.cpp index a4b8de84bd518bc055839864bdf8f546bf4a3b9d..46aabf790312e749eef1016bd62ed444abc537c6 100644 --- a/src/USER-BOCS/compute_pressure_bocs.cpp +++ b/src/USER-BOCS/compute_pressure_bocs.cpp @@ -39,7 +39,7 @@ using namespace LAMMPS_NS; ComputePressureBocs::ComputePressureBocs(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - vptr(NULL), id_temp(NULL) + vptr(nullptr), id_temp(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute pressure/bocs command"); if (igroup) error->all(FLERR,"Compute pressure/bocs must use group all"); @@ -52,12 +52,12 @@ ComputePressureBocs::ComputePressureBocs(LAMMPS *lmp, int narg, char **arg) : timeflag = 1; p_match_flag = 0; - phi_coeff = NULL; + phi_coeff = nullptr; // store temperature ID used by pressure computation // insure it is valid for temperature computation - if (strcmp(arg[3],"NULL") == 0) id_temp = NULL; + if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr; else { int n = strlen(arg[3]) + 1; id_temp = new char[n]; @@ -104,15 +104,15 @@ ComputePressureBocs::ComputePressureBocs(LAMMPS *lmp, int narg, char **arg) : // error check - if (keflag && id_temp == NULL) + if (keflag && id_temp == nullptr) error->all(FLERR,"Compute pressure/bocs requires temperature ID " "to include kinetic energy"); vector = new double[size_vector]; nvirial = 0; - vptr = NULL; + vptr = nullptr; - splines = NULL; + splines = nullptr; spline_length = 0; } @@ -149,7 +149,7 @@ void ComputePressureBocs::init() delete [] vptr; nvirial = 0; - vptr = NULL; + vptr = nullptr; if (pairflag && force->pair) nvirial++; if (bondflag && atom->molecular && force->bond) nvirial++; @@ -179,7 +179,7 @@ void ComputePressureBocs::init() // flag Kspace contribution separately, since not summed across procs if (kspaceflag && force->kspace) kspace_virial = force->kspace->virial; - else kspace_virial = NULL; + else kspace_virial = nullptr; } /* Extra functions added for BOCS */ diff --git a/src/USER-BOCS/fix_bocs.cpp b/src/USER-BOCS/fix_bocs.cpp index 6f7962c83f6a0fad379c78de50c2e55d7d63e054..0dad793fd2c7dc9a1251b7a395b196a65b5c5508 100644 --- a/src/USER-BOCS/fix_bocs.cpp +++ b/src/USER-BOCS/fix_bocs.cpp @@ -75,10 +75,10 @@ const int MAX_MESSAGE_LENGTH = 255; FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - rfix(NULL), id_dilate(NULL), irregular(NULL), id_temp(NULL), id_press(NULL), - eta(NULL), eta_dot(NULL), eta_dotdot(NULL), - eta_mass(NULL), etap(NULL), etap_dot(NULL), etap_dotdot(NULL), - etap_mass(NULL) + rfix(nullptr), id_dilate(nullptr), irregular(nullptr), id_temp(nullptr), id_press(nullptr), + eta(nullptr), eta_dot(nullptr), eta_dotdot(nullptr), + eta_mass(nullptr), etap(nullptr), etap_dot(nullptr), etap_dotdot(nullptr), + etap_mass(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_user_bocs_package); @@ -98,7 +98,7 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : pcouple = NONE; drag = 0.0; allremap = 1; - id_dilate = NULL; + id_dilate = nullptr; mtchain = mpchain = 3; nc_tchain = nc_pchain = 1; mtk_flag = 1; @@ -113,12 +113,12 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : tcomputeflag = 0; pcomputeflag = 0; - id_temp = NULL; - id_press = NULL; + id_temp = nullptr; + id_press = nullptr; - p_match_coeffs = NULL; + p_match_coeffs = nullptr; - splines = NULL; + splines = nullptr; spline_length = 0; // turn on tilt factor scaling, whenever applicable @@ -385,10 +385,10 @@ FixBocs::FixBocs(LAMMPS *lmp, int narg, char **arg) : } nrigid = 0; - rfix = NULL; + rfix = nullptr; if (pre_exchange_flag) irregular = new Irregular(lmp); - else irregular = NULL; + else irregular = nullptr; // initialize vol0,t0 to zero to signal uninitialized // values then assigned in init(), if necessary @@ -481,7 +481,7 @@ FixBocs::~FixBocs() if (p_match_coeffs) free(p_match_coeffs); // Free splines memory structure - if (splines != NULL) { + if (splines != nullptr) { memory->destroy(splines); spline_length = 0; } @@ -629,7 +629,7 @@ void FixBocs::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigid++; @@ -918,7 +918,7 @@ void FixBocs::setup(int /*vflag*/) // If no thermostat or using fix nphug, // t_target must be defined by other means. - if (tstat_flag && strstr(style,"nphug") == NULL) { + if (tstat_flag && strstr(style,"nphug") == nullptr) { compute_temp_target(); } else if (pstat_flag) { @@ -1924,7 +1924,7 @@ void *FixBocs::extract(const char *str, int &dim) } else if (pstat_flag && strcmp(str,"p_target") == 0) { return &p_target; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-CGDNA/bond_oxdna_fene.cpp b/src/USER-CGDNA/bond_oxdna_fene.cpp index c9540bf0c070152b7a35b3201c2eb1f45cda31aa..f135c6b7efe5125a459c87a6cf7bbbb4d38b37e9 100644 --- a/src/USER-CGDNA/bond_oxdna_fene.cpp +++ b/src/USER-CGDNA/bond_oxdna_fene.cpp @@ -359,9 +359,9 @@ void BondOxdnaFene::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&Delta[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&Delta[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&Delta[1],atom->nbondtypes,MPI_DOUBLE,0,world); diff --git a/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp b/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp index 662d55c5900cbe93e68da92d668ed6cc98af6c2f..6ddf03518c500082ea14768bd29ff0d9356f64cc 100644 --- a/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp +++ b/src/USER-CGDNA/pair_oxdna2_coaxstk.cpp @@ -815,47 +815,47 @@ void PairOxdna2Coaxstk::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&k_cxst[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst_hi[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst1_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst1_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst4_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst4_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst4_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst5_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst5_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst5_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst6_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst6_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst6_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&AA_cxst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&BB_cxst1[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&k_cxst[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst_hi[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst1_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst1_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst4_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst4_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst4_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst5_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst5_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst5_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst6_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst6_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst6_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&AA_cxst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&BB_cxst1[i][j],sizeof(double),1,fp,nullptr,error); } @@ -919,9 +919,9 @@ void PairOxdna2Coaxstk::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1023,5 +1023,5 @@ void *PairOxdna2Coaxstk::extract(const char *str, int &dim) if (strcmp(str,"AA_cxst1") == 0) return (void *) AA_cxst1; if (strcmp(str,"BB_cxst1") == 0) return (void *) BB_cxst1; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxdna2_dh.cpp b/src/USER-CGDNA/pair_oxdna2_dh.cpp index f23ca4fbf71417fe5df67a4d186c9c4f156b48de..1c4bd3bf09f9fcf31963c206e08d5ce40b826c8d 100644 --- a/src/USER-CGDNA/pair_oxdna2_dh.cpp +++ b/src/USER-CGDNA/pair_oxdna2_dh.cpp @@ -437,16 +437,16 @@ void PairOxdna2Dh::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&kappa_dh[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&qeff_dh_pf[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_dh[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_dh_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_dh_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&kappa_dh[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&qeff_dh_pf[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_dh[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_dh_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_dh_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -479,9 +479,9 @@ void PairOxdna2Dh::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -531,5 +531,5 @@ void *PairOxdna2Dh::extract(const char *str, int &dim) if (strcmp(str,"cut_dh_ast") == 0) return (void *) cut_dh_ast; if (strcmp(str,"cut_dh_c") == 0) return (void *) cut_dh_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxdna_coaxstk.cpp b/src/USER-CGDNA/pair_oxdna_coaxstk.cpp index f1d425a0b3bd7f7654e57be60cbb4c06c43e1bad..3a1ee3d127fdd54667d674a999d756562f4dff16 100644 --- a/src/USER-CGDNA/pair_oxdna_coaxstk.cpp +++ b/src/USER-CGDNA/pair_oxdna_coaxstk.cpp @@ -974,53 +974,53 @@ void PairOxdnaCoaxstk::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&k_cxst[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_cxst_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst_hi[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst1_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst1_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst4_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst4_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst4_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst5_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst5_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst5_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_cxst6_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst6_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_cxst6_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_cxst3p[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_cxst3p_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst3p[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_cxst3p_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&a_cxst4p[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_cxst4p_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_cxst4p[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_cxst4p_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&k_cxst[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_cxst_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst_hi[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst1_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst1_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst4_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst4_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst4_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst5_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst5_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst5_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_cxst6_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst6_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_cxst6_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_cxst3p[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_cxst3p_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst3p[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_cxst3p_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&a_cxst4p[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_cxst4p_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_cxst4p[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_cxst4p_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -1090,9 +1090,9 @@ void PairOxdnaCoaxstk::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1205,5 +1205,5 @@ void *PairOxdnaCoaxstk::extract(const char *str, int &dim) if (strcmp(str,"b_cxst4p") == 0) return (void *) b_cxst4p; if (strcmp(str,"cosphi_cxst4p_c") == 0) return (void *) cosphi_cxst4p_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxdna_excv.cpp b/src/USER-CGDNA/pair_oxdna_excv.cpp index ad96186b6bb247dff90d79d57482319403c88c02..64881cae22be8fd4ba6c7fad122ee16c17916248 100644 --- a/src/USER-CGDNA/pair_oxdna_excv.cpp +++ b/src/USER-CGDNA/pair_oxdna_excv.cpp @@ -696,26 +696,26 @@ void PairOxdnaExcv::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon_ss[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma_ss[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_ss_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_ss[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_ss_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&epsilon_sb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma_sb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_sb_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_sb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_sb_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&epsilon_bb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma_bb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_bb_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_bb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_bb_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon_ss[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma_ss[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_ss_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_ss[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_ss_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&epsilon_sb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma_sb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_sb_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_sb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_sb_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&epsilon_bb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma_bb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_bb_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_bb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_bb_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -758,9 +758,9 @@ void PairOxdnaExcv::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -824,5 +824,5 @@ void *PairOxdnaExcv::extract(const char *str, int &dim) if (strcmp(str,"b_bb") == 0) return (void *) b_bb; if (strcmp(str,"cut_bb_c") == 0) return (void *) cut_bb_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxdna_hbond.cpp b/src/USER-CGDNA/pair_oxdna_hbond.cpp index 7987210d7acc74c8e0bdd0a3f88fead487269f91..009b96717394f168e3cba53cf5e673cb1cc03b55 100644 --- a/src/USER-CGDNA/pair_oxdna_hbond.cpp +++ b/src/USER-CGDNA/pair_oxdna_hbond.cpp @@ -986,58 +986,58 @@ void PairOxdnaHbond::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon_hb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&a_hb[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_hb_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_hb_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_hb_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_hb_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_hb_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_hb_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shift_hb[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_hb1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_hb1_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb1_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_hb2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_hb2_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb2_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb2_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_hb3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_hb3_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb3_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb3_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_hb4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_hb4_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb4_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb4_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_hb7[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_hb7_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb7_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb7[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb7_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_hb8[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_hb8_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb8_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_hb8[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_hb8_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon_hb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&a_hb[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_hb_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_hb_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_hb_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_hb_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_hb_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_hb_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shift_hb[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_hb1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_hb1_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb1_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_hb2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_hb2_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb2_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb2_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_hb3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_hb3_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb3_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb3_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_hb4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_hb4_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb4_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb4_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_hb7[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_hb7_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb7_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb7[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb7_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_hb8[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_hb8_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb8_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_hb8[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_hb8_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -1112,9 +1112,9 @@ void PairOxdnaHbond::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1232,5 +1232,5 @@ void *PairOxdnaHbond::extract(const char *str, int &dim) if (strcmp(str,"b_hb8") == 0) return (void *) b_hb8; if (strcmp(str,"dtheta_hb8_c") == 0) return (void *) dtheta_hb8_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxdna_stk.cpp b/src/USER-CGDNA/pair_oxdna_stk.cpp index bf52d61182b1f6441e870975aa694a0bfc378c21..87b22f44684d268b05441a6227461e59d607e59f 100644 --- a/src/USER-CGDNA/pair_oxdna_stk.cpp +++ b/src/USER-CGDNA/pair_oxdna_stk.cpp @@ -1094,49 +1094,49 @@ void PairOxdnaStk::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon_st[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&a_st[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shift_st[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st4_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st4_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st4_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st5_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st5_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st5_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st6_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st6_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st6_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st1_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&a_st2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st2_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st2_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon_st[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&a_st[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shift_st[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st4_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st4_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st4_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st5_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st5_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st5_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st6_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st6_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st6_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st1_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&a_st2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st2_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st2_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -1202,9 +1202,9 @@ void PairOxdnaStk::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1308,5 +1308,5 @@ void *PairOxdnaStk::extract(const char *str, int &dim) if (strcmp(str,"b_st2") == 0) return (void *) b_st2; if (strcmp(str,"cosphi_st2_c") == 0) return (void *) cosphi_st2_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxdna_xstk.cpp b/src/USER-CGDNA/pair_oxdna_xstk.cpp index 17514996832283a637c8dbf26fd22e0568407321..29c78c103ad83a15f73e4cd6ae1ae9a7a08ccc02 100644 --- a/src/USER-CGDNA/pair_oxdna_xstk.cpp +++ b/src/USER-CGDNA/pair_oxdna_xstk.cpp @@ -933,56 +933,56 @@ void PairOxdnaXstk::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&k_xst[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst_hi[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst1_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst1_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst2_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst2_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst2_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst3_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst3_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst3_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst4_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst4_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst4_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst7[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst7_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst7_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst7[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst7_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst8[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst8_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst8_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst8[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst8_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&k_xst[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst_hi[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst1_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst1_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst2_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst2_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst2_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst3_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst3_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst3_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst4_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst4_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst4_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst7[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst7_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst7_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst7[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst7_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst8[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst8_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst8_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst8[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst8_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -1055,9 +1055,9 @@ void PairOxdnaXstk::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1173,5 +1173,5 @@ void *PairOxdnaXstk::extract(const char *str, int &dim) if (strcmp(str,"b_xst8") == 0) return (void *) b_xst8; if (strcmp(str,"dtheta_xst8_c") == 0) return (void *) dtheta_xst8_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxrna2_stk.cpp b/src/USER-CGDNA/pair_oxrna2_stk.cpp index fd02946134ec6e59200365602583eac1ad4544bd..fff552908e504671311c31a29e74385536e92781 100644 --- a/src/USER-CGDNA/pair_oxrna2_stk.cpp +++ b/src/USER-CGDNA/pair_oxrna2_stk.cpp @@ -1191,55 +1191,55 @@ void PairOxrna2Stk::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon_st[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&a_st[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_st_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shift_st[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st5_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st5_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st5[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st5_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st6_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st6_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st6[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st6_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st9[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st9_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st9_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st9[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st9_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st10[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_st10_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st10_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st10[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_st10_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_st1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st1_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&a_st2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st2_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_st2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cosphi_st2_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon_st[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&a_st[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_st_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shift_st[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st5_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st5_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st5[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st5_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st6_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st6_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st6[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st6_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st9[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st9_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st9_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st9[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st9_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st10[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_st10_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st10_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st10[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_st10_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_st1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st1_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&a_st2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st2_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_st2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cosphi_st2_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -1311,9 +1311,9 @@ void PairOxrna2Stk::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1427,5 +1427,5 @@ void *PairOxrna2Stk::extract(const char *str, int &dim) if (strcmp(str,"b_st2") == 0) return (void *) b_st2; if (strcmp(str,"cosphi_st2_c") == 0) return (void *) cosphi_st2_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGDNA/pair_oxrna2_xstk.cpp b/src/USER-CGDNA/pair_oxrna2_xstk.cpp index 673ef1c9a38c0e927340c4a93a69f75234561203..9fe4bebab84bef7f1dfa2ad35b5e1f9208d82c4d 100644 --- a/src/USER-CGDNA/pair_oxrna2_xstk.cpp +++ b/src/USER-CGDNA/pair_oxrna2_xstk.cpp @@ -855,50 +855,50 @@ void PairOxrna2Xstk::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&k_xst[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_hi[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_lc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_xst_hc[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst_lo[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst_hi[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst1_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst1_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst1_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst2_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst2_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst2_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst3_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst3_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst3_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst7[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst7_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst7_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst7[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst7_c[i][j],sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&a_xst8[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&theta_xst8_0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst8_ast[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b_xst8[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dtheta_xst8_c[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&k_xst[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_hi[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_lc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_xst_hc[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst_lo[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst_hi[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst1_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst1_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst1_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst2_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst2_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst2_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst3_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst3_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst3_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst7[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst7_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst7_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst7[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst7_c[i][j],sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&a_xst8[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&theta_xst8_0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst8_ast[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b_xst8[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dtheta_xst8_c[i][j],sizeof(double),1,fp,nullptr,error); } @@ -965,9 +965,9 @@ void PairOxrna2Xstk::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -1073,5 +1073,5 @@ void *PairOxrna2Xstk::extract(const char *str, int &dim) if (strcmp(str,"b_xst8") == 0) return (void *) b_xst8; if (strcmp(str,"dtheta_xst8_c") == 0) return (void *) dtheta_xst8_c; - return NULL; + return nullptr; } diff --git a/src/USER-CGSDK/angle_sdk.cpp b/src/USER-CGSDK/angle_sdk.cpp index 6f97d2104ff1c8301c23fb946280c2c3bd77112c..bdcb03c3c3b4141e99a629d711fa8690d3fb1128 100644 --- a/src/USER-CGSDK/angle_sdk.cpp +++ b/src/USER-CGSDK/angle_sdk.cpp @@ -290,7 +290,7 @@ void AngleSDK::init_style() if (repflag) { int itmp; - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Angle style SDK requires use of a compatible with Pair style"); lj1 = (double **) force->pair->extract("lj1",itmp); @@ -333,9 +333,9 @@ void AngleSDK::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&repscale[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&repscale[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-CGSDK/pair_lj_sdk.cpp b/src/USER-CGSDK/pair_lj_sdk.cpp index 8185e2487665f27b29530d054298f0291b2e24bd..6c3e15089fdc87ca024240000978503c174ae809 100644 --- a/src/USER-CGSDK/pair_lj_sdk.cpp +++ b/src/USER-CGSDK/pair_lj_sdk.cpp @@ -374,14 +374,14 @@ void PairLJSDK::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&lj_type[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&lj_type[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&lj_type[i][j],1,MPI_INT,0,world); MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); @@ -411,10 +411,10 @@ void PairLJSDK::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -484,7 +484,7 @@ void *PairLJSDK::extract(const char *str, int &dim) if (strcmp(str,"lj4") == 0) return (void *) lj4; if (strcmp(str,"rminsq") == 0) return (void *) rminsq; if (strcmp(str,"emin") == 0) return (void *) emin; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp b/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp index 42f1ff3ce7f4329a779db41f7994297a1e6521e4..2e21bdd10214be934b5ed56fffd9cee7ac15a49b 100644 --- a/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp +++ b/src/USER-CGSDK/pair_lj_sdk_coul_long.cpp @@ -51,7 +51,7 @@ PairLJSDKCoulLong::PairLJSDKCoulLong(LAMMPS *lmp) : Pair(lmp) ewaldflag = pppmflag = 1; respa_enable = 0; writedata = 1; - ftable = NULL; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ @@ -361,13 +361,13 @@ void PairLJSDKCoulLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; // setup force tables (no rRESPA support yet) - if (ncoultablebits) init_tables(cut_coul,NULL); + if (ncoultablebits) init_tables(cut_coul,nullptr); } /* ---------------------------------------------------------------------- @@ -466,14 +466,14 @@ void PairLJSDKCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&lj_type[i][j],sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&lj_type[i][j],sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&lj_type[i][j],1,MPI_INT,0,world); MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); @@ -505,13 +505,13 @@ void PairLJSDKCoulLong::write_restart_settings(FILE *fp) void PairLJSDKCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -643,7 +643,7 @@ void *PairLJSDKCoulLong::extract(const char *str, int &dim) dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-CGSDK/pair_lj_sdk_coul_msm.cpp b/src/USER-CGSDK/pair_lj_sdk_coul_msm.cpp index 8aa16b4adbe5b8d7ef9f02bbcded00b311c539eb..9818b7c51c2e9de8ba21e9d38488bcaede8246f8 100644 --- a/src/USER-CGSDK/pair_lj_sdk_coul_msm.cpp +++ b/src/USER-CGSDK/pair_lj_sdk_coul_msm.cpp @@ -37,7 +37,7 @@ PairLJSDKCoulMSM::PairLJSDKCoulMSM(LAMMPS *lmp) : PairLJSDKCoulLong(lmp) ewaldflag = pppmflag = 0; msmflag = 1; respa_enable = 0; - ftable = NULL; + ftable = nullptr; } /* ---------------------------------------------------------------------- */ @@ -308,6 +308,6 @@ void *PairLJSDKCoulMSM::extract(const char *str, int &dim) dim = 0; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; if (strcmp(str,"cut_msm") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/USER-COLVARS/colvarproxy_lammps.cpp b/src/USER-COLVARS/colvarproxy_lammps.cpp index dabb0bf92331ad02845c28a3e3c4be72fed0f394..f265271bb20048f6cabb036f7fba1e410b3ed784 100644 --- a/src/USER-COLVARS/colvarproxy_lammps.cpp +++ b/src/USER-COLVARS/colvarproxy_lammps.cpp @@ -179,9 +179,9 @@ int colvarproxy_lammps::read_state_file(char const *state_filename) colvarproxy_lammps::~colvarproxy_lammps() { delete _random; - if (colvars != NULL) { + if (colvars != nullptr) { delete colvars; - colvars = NULL; + colvars = nullptr; } } diff --git a/src/USER-COLVARS/fix_colvars.cpp b/src/USER-COLVARS/fix_colvars.cpp index e8ce877ea97ec12e649f36854861cd106dc45c52..afa7f533534758177911543f0a61815bd2f1302c 100644 --- a/src/USER-COLVARS/fix_colvars.cpp +++ b/src/USER-COLVARS/fix_colvars.cpp @@ -194,7 +194,7 @@ int inthash_lookup(void *ptr, int key) { /* find the entry in the hash table */ h=inthash(tptr, key); - for (node=tptr->bucket[h]; node!=NULL; node=node->next) { + for (node=tptr->bucket[h]; node!=nullptr; node=node->next) { if (node->key == key) break; } @@ -246,7 +246,7 @@ void inthash_destroy(inthash_t *tptr) { for (i=0; isize; i++) { node = tptr->bucket[i]; - while (node != NULL) { + while (node != nullptr) { last = node; node = node->next; free(last); @@ -254,7 +254,7 @@ void inthash_destroy(inthash_t *tptr) { } /* free the entire array of buckets */ - if (tptr->bucket != NULL) { + if (tptr->bucket != nullptr) { free(tptr->bucket); memset(tptr, 0, sizeof(inthash_t)); } @@ -276,7 +276,7 @@ int FixColvars::instances=0; optional keyword value pairs: input (for restarting/continuing, defaults to - NULL, but set to at end) + nullptr, but set to at end) output (defaults to 'out') seed (seed for RNG, defaults to '1966') tstat (label of thermostatting fix) @@ -305,9 +305,9 @@ FixColvars::FixColvars(LAMMPS *lmp, int narg, char **arg) : rng_seed = 1966; unwrap_flag = 1; - inp_name = NULL; - out_name = NULL; - tmp_name = NULL; + inp_name = nullptr; + out_name = nullptr; + tmp_name = nullptr; /* parse optional arguments */ int argsdone = 4; @@ -346,10 +346,10 @@ FixColvars::FixColvars(LAMMPS *lmp, int narg, char **arg) : nlevels_respa = 0; init_flag = 0; num_coords = 0; - comm_buf = NULL; - force_buf = NULL; - proxy = NULL; - idmap = NULL; + comm_buf = nullptr; + force_buf = nullptr; + proxy = nullptr; + idmap = nullptr; /* storage required to communicate a single coordinate or force. */ size_one = sizeof(struct commdata); @@ -445,7 +445,7 @@ void FixColvars::one_time_init() if (inp_name) { if (strcmp(inp_name,"NULL") == 0) { memory->sfree(inp_name); - inp_name = NULL; + inp_name = nullptr; } } @@ -961,7 +961,7 @@ void FixColvars::write_restart(FILE *fp) proxy->serialize_status(rest_text); // TODO call write_output_files() const char *cvm_state = rest_text.c_str(); - int len = strlen(cvm_state) + 1; // need to include terminating NULL byte. + int len = strlen(cvm_state) + 1; // need to include terminating null byte. fwrite(&len,sizeof(int),1,fp); fwrite(cvm_state,1,len,fp); } diff --git a/src/USER-COLVARS/group_ndx.cpp b/src/USER-COLVARS/group_ndx.cpp index 07a8ac2d5c332f3b10c15e759f4790113a71aae9..37b853ba96cff240058d931381f502707eec893b 100644 --- a/src/USER-COLVARS/group_ndx.cpp +++ b/src/USER-COLVARS/group_ndx.cpp @@ -143,7 +143,7 @@ void Group2Ndx::command(int narg, char **arg) if (comm->me == 0) { fp = fopen(arg[0], "w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,"Cannot open index file for writing"); if (screen) diff --git a/src/USER-COLVARS/ndx_group.cpp b/src/USER-COLVARS/ndx_group.cpp index bab1592b1ecd728825625774c5cffd713ae5eb76..e09084ebfd3a13ff34984ebdef8572936644803b 100644 --- a/src/USER-COLVARS/ndx_group.cpp +++ b/src/USER-COLVARS/ndx_group.cpp @@ -36,13 +36,13 @@ static char *find_section(FILE *fp, const char *name) while ((p = fgets(linebuf,BUFLEN,fp))) { t = strtok(p," \t\n\r\f"); - if ((t != NULL) && *t == '[') { - t = strtok(NULL," \t\n\r\f"); - if (t != NULL) { + if ((t != nullptr) && *t == '[') { + t = strtok(nullptr," \t\n\r\f"); + if (t != nullptr) { n = t; - t = strtok(NULL," \t\n\r\f"); - if ((t != NULL) && *t == ']') { - if ((name == NULL) || strcmp(name,n) == 0) { + t = strtok(nullptr," \t\n\r\f"); + if ((t != nullptr) && *t == ']') { + if ((name == nullptr) || strcmp(name,n) == 0) { int l = strlen(n); r = new char[l+1]; strncpy(r,n,l+1); @@ -52,7 +52,7 @@ static char *find_section(FILE *fp, const char *name) } } } - return NULL; + return nullptr; } static tagint *read_section(FILE *fp, bigint &num) @@ -68,7 +68,7 @@ static tagint *read_section(FILE *fp, bigint &num) while ((p = fgets(linebuf,BUFLEN,fp))) { t = strtok(p," \t\n\r\f"); - while (t != NULL) { + while (t != nullptr) { // start of a new section. we are done here. if (*t == '[') return tagbuf; @@ -77,7 +77,7 @@ static tagint *read_section(FILE *fp, bigint &num) nmax += DELTA; tagbuf = (tagint *)realloc(tagbuf,sizeof(tagint)*nmax); } - t = strtok(NULL," \t\n\r\f"); + t = strtok(nullptr," \t\n\r\f"); } } return tagbuf; @@ -90,7 +90,7 @@ void Ndx2Group::command(int narg, char **arg) int len; bigint num; FILE *fp; - char *name = NULL; + char *name = nullptr; tagint *tags; if (narg < 1) error->all(FLERR,"Illegal ndx2group command"); @@ -100,7 +100,7 @@ void Ndx2Group::command(int narg, char **arg) if (comm->me == 0) { fp = fopen(arg[0], "r"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,"Cannot open index file for reading"); if (screen) @@ -117,15 +117,15 @@ void Ndx2Group::command(int narg, char **arg) // find the next section. // if we had processed a section, before we need to step back - if (name != NULL) { + if (name != nullptr) { rewind(fp); char *tmp = find_section(fp,name); delete[] tmp; delete[] name; - name = NULL; + name = nullptr; } - name = find_section(fp,NULL); - if (name != NULL) { + name = find_section(fp,nullptr); + if (name != nullptr) { len=strlen(name)+1; // skip over group "all", which is called "System" in gromacs @@ -171,10 +171,10 @@ void Ndx2Group::command(int narg, char **arg) len = 0; // find named section, search from beginning of file - if (name != NULL) delete[] name; + if (name != nullptr) delete[] name; rewind(fp); name = find_section(fp,arg[idx]); - if (name != NULL) len=strlen(name)+1; + if (name != nullptr) len=strlen(name)+1; if (screen) fprintf(screen," %s group '%s'\n", diff --git a/src/USER-DIFFRACTION/compute_saed.cpp b/src/USER-DIFFRACTION/compute_saed.cpp index d16fbf2876335c730b1949a1f3fc310b02324bf7..f35ea66796eafb1f39b7d1c500ae9048f703e07f 100644 --- a/src/USER-DIFFRACTION/compute_saed.cpp +++ b/src/USER-DIFFRACTION/compute_saed.cpp @@ -49,7 +49,7 @@ static const char cite_compute_saed_c[] = /* ---------------------------------------------------------------------- */ ComputeSAED::ComputeSAED(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), ztype(NULL), store_tmp(NULL) + Compute(lmp, narg, arg), ztype(nullptr), store_tmp(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_compute_saed_c); diff --git a/src/USER-DIFFRACTION/compute_xrd.cpp b/src/USER-DIFFRACTION/compute_xrd.cpp index b48de49c81731d0b78c61c1c6ea3eb10b560b218..633467fe36c086467addb59df0934d5b7a4826f4 100644 --- a/src/USER-DIFFRACTION/compute_xrd.cpp +++ b/src/USER-DIFFRACTION/compute_xrd.cpp @@ -50,7 +50,7 @@ static const char cite_compute_xrd_c[] = /* ---------------------------------------------------------------------- */ ComputeXRD::ComputeXRD(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), ztype(NULL), store_tmp(NULL) + Compute(lmp, narg, arg), ztype(nullptr), store_tmp(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_compute_xrd_c); diff --git a/src/USER-DIFFRACTION/fix_saed_vtk.cpp b/src/USER-DIFFRACTION/fix_saed_vtk.cpp index 39382264c46af74d97516ce15650b235a7f8dc85..00cfcbf91a2457291edad13a0ff63496d5ebb69b 100644 --- a/src/USER-DIFFRACTION/fix_saed_vtk.cpp +++ b/src/USER-DIFFRACTION/fix_saed_vtk.cpp @@ -40,8 +40,8 @@ enum{FIRST,MULTI}; /* ---------------------------------------------------------------------- */ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), ids(NULL), fp(NULL), vector(NULL), - vector_total(NULL), vector_list(NULL), compute_saed(NULL), filename(NULL) + Fix(lmp, narg, arg), ids(nullptr), fp(nullptr), vector(nullptr), + vector_total(nullptr), vector_list(nullptr), compute_saed(nullptr), filename(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix saed/vtk command"); @@ -66,7 +66,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : options(narg,arg); which = 0; - ids = NULL; + ids = nullptr; nvalues = 0; @@ -136,8 +136,8 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : // allocate memory for averaging - vector = vector_total = NULL; - vector_list = NULL; + vector = vector_total = nullptr; + vector_list = nullptr; if (ave == WINDOW) memory->create(vector_list,nwindow,nvalues,"saed/vtk:vector_list"); @@ -145,7 +145,7 @@ FixSAEDVTK::FixSAEDVTK(LAMMPS *lmp, int narg, char **arg) : memory->create(vector,nrows,"saed/vtk:vector"); memory->create(vector_total,nrows,"saed/vtk:vector_total"); - extlist = NULL; + extlist = nullptr; vector_flag = 1; size_vector = nrows; @@ -425,7 +425,7 @@ void FixSAEDVTK::invoke_vector(bigint ntimestep) snprintf(nName,128,"%s.%d.vtk",filename,nOutput); fp = fopen(nName,"w"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix saed/vtk file %s",nName); error->one(FLERR,str); @@ -531,7 +531,7 @@ void FixSAEDVTK::options(int narg, char **arg) { // option defaults - fp = NULL; + fp = nullptr; ave = ONE; startstep = 0; overwrite = 0; @@ -552,7 +552,7 @@ void FixSAEDVTK::options(int narg, char **arg) snprintf(nName,128,"%s.%d.vtk",filename,nOutput); fp = fopen(nName,"w"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix saed/vtk file %s",nName); error->one(FLERR,str); diff --git a/src/USER-DPD/compute_dpd_atom.cpp b/src/USER-DPD/compute_dpd_atom.cpp index 0fd732f669d30e7b482b9402b9cf1ca2f4520ccf..95141e2de29de5eeae2c815a9fed2f5c0153e433 100644 --- a/src/USER-DPD/compute_dpd_atom.cpp +++ b/src/USER-DPD/compute_dpd_atom.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeDpdAtom::ComputeDpdAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), dpdAtom(NULL) + Compute(lmp, narg, arg), dpdAtom(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute dpd/atom command"); diff --git a/src/USER-DPD/fix_dpd_energy.cpp b/src/USER-DPD/fix_dpd_energy.cpp index 6ee88ea88a2c130abc08f6d052fc12d4ad35b9f9..674bf0e13db43f0005a7a07c634fc2988a8cfb7e 100644 --- a/src/USER-DPD/fix_dpd_energy.cpp +++ b/src/USER-DPD/fix_dpd_energy.cpp @@ -28,12 +28,12 @@ FixDPDenergy::FixDPDenergy(LAMMPS *lmp, int narg, char **arg) : { if (narg != 3 ) error->all(FLERR,"Illegal fix dpd/energy command"); - pairDPDE = NULL; + pairDPDE = nullptr; pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy/kk",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) error->all(FLERR,"Must use pair_style dpd/fdt/energy with fix dpd/energy"); if (!(atom->dpd_flag)) error->all(FLERR,"Must use atom_style dpd/fdt/energy with fix dpd/energy"); diff --git a/src/USER-DPD/fix_eos_table.cpp b/src/USER-DPD/fix_eos_table.cpp index 57cfe03dc8dd1eac7bbdd2ae321efcaf2b1edeb1..00cbda16717edf8c1eab7481fb6e81ccbfa17286 100644 --- a/src/USER-DPD/fix_eos_table.cpp +++ b/src/USER-DPD/fix_eos_table.cpp @@ -31,7 +31,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixEOStable::FixEOStable(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), ntables(0), tables(NULL) + Fix(lmp, narg, arg), ntables(0), tables(nullptr) { if (narg != 7) error->all(FLERR,"Illegal fix eos/table command"); nevery = 1; @@ -43,7 +43,7 @@ FixEOStable::FixEOStable(LAMMPS *lmp, int narg, char **arg) : if (tablength < 2) error->all(FLERR,"Illegal number of eos/table entries"); ntables = 0; - tables = NULL; + tables = nullptr; int me; MPI_Comm_rank(world,&me); tables = (Table *) @@ -167,10 +167,10 @@ void FixEOStable::end_of_step() void FixEOStable::null_table(Table *tb) { - tb->rfile = tb->efile = NULL; - tb->e2file = NULL; - tb->r = tb->e = tb->de = NULL; - tb->e2 = NULL; + tb->rfile = tb->efile = nullptr; + tb->e2file = nullptr; + tb->r = tb->e = tb->de = nullptr; + tb->e2 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -198,7 +198,7 @@ void FixEOStable::read_table(Table *tb, Table *tb2, char *file, char *keyword) // open file FILE *fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); @@ -207,7 +207,7 @@ void FixEOStable::read_table(Table *tb, Table *tb2, char *file, char *keyword) // loop until section found with matching keyword while (1) { - if (fgets(line,MAXLINE,fp) == NULL) + if (fgets(line,MAXLINE,fp) == nullptr) error->one(FLERR,"Did not find keyword in table file"); if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line if (line[0] == '#') continue; // comment @@ -305,13 +305,13 @@ void FixEOStable::param_extract(Table *tb, Table *tb2, char *line) char *word = strtok(line," \t\n\r\f"); while (word) { if (strcmp(word,"N") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->ninput = atoi(word); tb2->ninput = atoi(word); } else { error->one(FLERR,"Invalid keyword in fix eos/table parameters"); } - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); } if (tb->ninput == 0) error->one(FLERR,"fix eos/table parameters did not set N"); diff --git a/src/USER-DPD/fix_eos_table_rx.cpp b/src/USER-DPD/fix_eos_table_rx.cpp index c220d84a576954a9337af36797ceac0a6e2e2e9b..d01b2015d21a6ad7843e6dccf373cb013b0dbfdb 100644 --- a/src/USER-DPD/fix_eos_table_rx.cpp +++ b/src/USER-DPD/fix_eos_table_rx.cpp @@ -42,8 +42,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixEOStableRX::FixEOStableRX(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), ntables(0), tables(NULL), - tables2(NULL), dHf(NULL), eosSpecies(NULL) + Fix(lmp, narg, arg), ntables(0), tables(nullptr), + tables2(nullptr), dHf(nullptr), eosSpecies(nullptr) { if (narg != 8 && narg != 10) error->all(FLERR,"Illegal fix eos/table/rx command"); nevery = 1; @@ -64,9 +64,9 @@ FixEOStableRX::FixEOStableRX(LAMMPS *lmp, int narg, char **arg) : if (tablength < 2) error->all(FLERR,"Illegal number of eos/table/rx entries"); ntables = 0; - tables = NULL; - tables2 = NULL; - eosSpecies = NULL; + tables = nullptr; + tables2 = nullptr; + eosSpecies = nullptr; int me; MPI_Comm_rank(world,&me); @@ -306,10 +306,10 @@ void FixEOStableRX::read_file(char *file) // open file on proc 0 FILE *fp; - fp = NULL; + fp = nullptr; if (comm->me == 0) { fp = fopen(file,"r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open eos table/rx potential file %s",file); error->one(FLERR,str); @@ -324,7 +324,7 @@ void FixEOStableRX::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -346,7 +346,7 @@ void FixEOStableRX::read_file(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -366,7 +366,7 @@ void FixEOStableRX::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; for (ispecies = 0; ispecies < nspecies; ispecies++) if (strcmp(words[0],&atom->dname[ispecies][0]) == 0) break; @@ -388,10 +388,10 @@ void FixEOStableRX::read_file(char *file) void FixEOStableRX::null_table(Table *tb) { - tb->rfile = tb->efile = NULL; - tb->e2file = NULL; - tb->r = tb->e = tb->de = NULL; - tb->e2 = NULL; + tb->rfile = tb->efile = nullptr; + tb->e2file = nullptr; + tb->r = tb->e = tb->de = nullptr; + tb->e2 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -419,7 +419,7 @@ void FixEOStableRX::read_table(Table *tb, Table *tb2, char *file, char *keyword) // open file FILE *fp = fopen(file,"r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); @@ -428,7 +428,7 @@ void FixEOStableRX::read_table(Table *tb, Table *tb2, char *file, char *keyword) // loop until section found with matching keyword while (1) { - if (fgets(line,MAXLINE,fp) == NULL) + if (fgets(line,MAXLINE,fp) == nullptr) error->one(FLERR,"Did not find keyword in table file"); if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line if (line[0] == '#') continue; // comment @@ -482,7 +482,7 @@ void FixEOStableRX::read_table(Table *tb, Table *tb2, char *file, char *keyword) } nwords = 0; word = strtok(line," \t\n\r\f"); - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); rtmp = atof(word); for (int icolumn=0;icolumnrfile[i] = rtmp; @@ -574,11 +574,11 @@ void FixEOStableRX::param_extract(Table *tb, char *line) char *word = strtok(line," \t\n\r\f"); if (strcmp(word,"N") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->ninput = atoi(word); } else error->one(FLERR,"Invalid keyword in fix eos/table/rx parameters"); - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); if(rx_flag){ while (word) { @@ -592,7 +592,7 @@ void FixEOStableRX::param_extract(Table *tb, char *line) printf("name=%s not found in species list\n",word); error->one(FLERR,"Invalid keyword in fix eos/table/rx parameters"); } - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); } for (int icolumn = 0; icolumn < ncolumn; icolumn++) diff --git a/src/USER-DPD/fix_rx.cpp b/src/USER-DPD/fix_rx.cpp index d974d12473d471ee0a3b023dae4ff835f6d61da0..07d39d0de7ba0d3c47119039185108dda5a76fdb 100644 --- a/src/USER-DPD/fix_rx.cpp +++ b/src/USER-DPD/fix_rx.cpp @@ -67,23 +67,23 @@ double getElapsedTime( const TimerType &t0, const TimerType &t1) { return t1-t0; /* ---------------------------------------------------------------------- */ FixRX::FixRX(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), mol2param(NULL), nreactions(0), - params(NULL), Arr(NULL), nArr(NULL), Ea(NULL), tempExp(NULL), - stoich(NULL), stoichReactants(NULL), stoichProducts(NULL), kR(NULL), - pairDPDE(NULL), dpdThetaLocal(NULL), sumWeights(NULL), sparseKinetics_nu(NULL), - sparseKinetics_nuk(NULL), sparseKinetics_inu(NULL), sparseKinetics_isIntegralReaction(NULL), - kineticsFile(NULL), id_fix_species(NULL), - id_fix_species_old(NULL), fix_species(NULL), fix_species_old(NULL) + Fix(lmp, narg, arg), mol2param(nullptr), nreactions(0), + params(nullptr), Arr(nullptr), nArr(nullptr), Ea(nullptr), tempExp(nullptr), + stoich(nullptr), stoichReactants(nullptr), stoichProducts(nullptr), kR(nullptr), + pairDPDE(nullptr), dpdThetaLocal(nullptr), sumWeights(nullptr), sparseKinetics_nu(nullptr), + sparseKinetics_nuk(nullptr), sparseKinetics_inu(nullptr), sparseKinetics_isIntegralReaction(nullptr), + kineticsFile(nullptr), id_fix_species(nullptr), + id_fix_species_old(nullptr), fix_species(nullptr), fix_species_old(nullptr) { if (narg < 7 || narg > 12) error->all(FLERR,"Illegal fix rx command"); nevery = 1; nreactions = maxparam = 0; - params = NULL; - mol2param = NULL; - pairDPDE = NULL; - id_fix_species = NULL; - id_fix_species_old = NULL; + params = nullptr; + mol2param = nullptr; + pairDPDE = nullptr; + id_fix_species = nullptr; + id_fix_species_old = nullptr; const int Verbosity = 1; @@ -166,7 +166,7 @@ FixRX::FixRX(LAMMPS *lmp, int narg, char **arg) : diagnosticFrequency = 0; for (int i = 0; i < numDiagnosticCounters; ++i){ diagnosticCounter[i] = 0; - diagnosticCounterPerODE[i] = NULL; + diagnosticCounterPerODE[i] = nullptr; } if (odeIntegrationFlag == ODE_LAMMPS_RK4 && narg==8){ @@ -189,8 +189,8 @@ FixRX::FixRX(LAMMPS *lmp, int narg, char **arg) : minSteps = atoi( arg[iarg++] ); maxIters = atoi( arg[iarg++] ); - relTol = strtod( arg[iarg++], NULL); - absTol = strtod( arg[iarg++], NULL); + relTol = strtod( arg[iarg++], nullptr); + absTol = strtod( arg[iarg++], nullptr); if (iarg < narg) diagnosticFrequency = atoi( arg[iarg++] ); @@ -207,10 +207,10 @@ FixRX::FixRX(LAMMPS *lmp, int narg, char **arg) : } // Initialize/Create the sparse matrix database. - sparseKinetics_nu = NULL; - sparseKinetics_nuk = NULL; - sparseKinetics_inu = NULL; - sparseKinetics_isIntegralReaction = NULL; + sparseKinetics_nu = nullptr; + sparseKinetics_nuk = nullptr; + sparseKinetics_inu = nullptr; + sparseKinetics_isIntegralReaction = nullptr; sparseKinetics_maxReactants = 0; sparseKinetics_maxProducts = 0; sparseKinetics_maxSpecies = 0; @@ -259,15 +259,15 @@ void FixRX::post_constructor() char **tmpspecies = new char*[maxspecies]; int tmpmaxstrlen = 0; for(int jj=0; jj < maxspecies; jj++) - tmpspecies[jj] = NULL; + tmpspecies[jj] = nullptr; // open file on proc 0 FILE *fp; - fp = NULL; + fp = nullptr; if (comm->me == 0) { fp = utils::open_potential(kineticsFile,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open rx file %s",kineticsFile); error->one(FLERR,str); @@ -284,7 +284,7 @@ void FixRX::post_constructor() while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -304,8 +304,8 @@ void FixRX::post_constructor() nwords = 0; word = strtok(line," \t\n\r\f"); - while (word != NULL){ - word = strtok(NULL, " \t\n\r\f"); + while (word != nullptr){ + word = strtok(nullptr, " \t\n\r\f"); match=false; for(int jj=0;jjnspecies_dpd = nUniqueSpecies; @@ -332,8 +332,8 @@ void FixRX::post_constructor() // new id = fix-ID + FIX_STORE_ATTRIBUTE // new fix group = group for this fix - id_fix_species = NULL; - id_fix_species_old = NULL; + id_fix_species = nullptr; + id_fix_species_old = nullptr; n = strlen(id) + strlen("_SPECIES") + 1; id_fix_species = new char[n]; @@ -637,10 +637,10 @@ int FixRX::setmask() void FixRX::init() { pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy/kk",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) error->all(FLERR,"Must use pair_style dpd/fdt/energy with fix rx"); bool eos_flag = false; @@ -853,10 +853,10 @@ void FixRX::read_file(char *file) // open file on proc 0 FILE *fp; - fp = NULL; + fp = nullptr; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open rx file %s",file); error->one(FLERR,str); @@ -872,7 +872,7 @@ void FixRX::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -926,7 +926,7 @@ void FixRX::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -946,9 +946,9 @@ void FixRX::read_file(char *file) nwords = 0; word = strtok(line," \t\n\r\f"); - while (word != NULL){ + while (word != nullptr){ tmpStoich = atof(word); - word = strtok(NULL, " \t\n\r\f"); + word = strtok(nullptr, " \t\n\r\f"); for (ispecies = 0; ispecies < nspecies; ispecies++){ if (strcmp(word,&atom->dname[ispecies][0]) == 0){ stoich[nreactions][ispecies] += sign*tmpStoich; @@ -965,22 +965,22 @@ void FixRX::read_file(char *file) } error->all(FLERR,"Illegal fix rx command"); } - word = strtok(NULL, " \t\n\r\f"); - if(word==NULL) error->all(FLERR,"Missing parameters in reaction kinetic equation"); + word = strtok(nullptr, " \t\n\r\f"); + if(word==nullptr) error->all(FLERR,"Missing parameters in reaction kinetic equation"); if(strcmp(word,"=") == 0) sign = 1.0; if(strcmp(word,"+") != 0 && strcmp(word,"=") != 0){ - if(word==NULL) error->all(FLERR,"Missing parameters in reaction kinetic equation"); + if(word==nullptr) error->all(FLERR,"Missing parameters in reaction kinetic equation"); Arr[nreactions] = atof(word); - word = strtok(NULL, " \t\n\r\f"); - if(word==NULL) error->all(FLERR,"Missing parameters in reaction kinetic equation"); + word = strtok(nullptr, " \t\n\r\f"); + if(word==nullptr) error->all(FLERR,"Missing parameters in reaction kinetic equation"); nArr[nreactions] = atof(word); - word = strtok(NULL, " \t\n\r\f"); - if(word==NULL) error->all(FLERR,"Missing parameters in reaction kinetic equation"); + word = strtok(nullptr, " \t\n\r\f"); + if(word==nullptr) error->all(FLERR,"Missing parameters in reaction kinetic equation"); Ea[nreactions] = atof(word); sign = -1.0; break; } - word = strtok(NULL, " \t\n\r\f"); + word = strtok(nullptr, " \t\n\r\f"); } nreactions++; } @@ -1434,7 +1434,7 @@ void FixRX::odeDiagnostics(void) my_max[i] = 0; my_min[i] = DBL_MAX; - if (diagnosticCounterPerODE[i] != NULL){ + if (diagnosticCounterPerODE[i] != nullptr){ for (int j = 0; j < nlocal; ++j) if (mask[j] & groupbit){ double diff = double(diagnosticCounterPerODE[i][j]) - avg_per_atom[i]; @@ -1637,8 +1637,8 @@ void FixRX::rkf45(int id, double *rwork, void *v_param, int ode_counter[]) ode_counter[1] += nit; ode_counter[2] += nfe; - //if (diagnosticFrequency == 1 && diagnosticCounterPerODE[StepSum] != NULL) - if (diagnosticCounterPerODE[StepSum] != NULL){ + //if (diagnosticFrequency == 1 && diagnosticCounterPerODE[StepSum] != nullptr) + if (diagnosticCounterPerODE[StepSum] != nullptr){ diagnosticCounterPerODE[StepSum][id] = nst; diagnosticCounterPerODE[FuncSum][id] = nfe; } @@ -1708,7 +1708,7 @@ int FixRX::rhs_sparse(double /*t*/, const double *y, double *dydt, void *v_param const double VDPD = domain->xprd * domain->yprd * domain->zprd / atom->natoms; #define kFor (userData->kFor) - #define kRev (NULL) + #define kRev (nullptr) #define rxnRateLaw (userData->rxnRateLaw) #define conc (dydt) #define maxReactants (this->sparseKinetics_maxReactants) diff --git a/src/USER-DPD/fix_shardlow.cpp b/src/USER-DPD/fix_shardlow.cpp index c4480a037334c1ba3bffb47bbe457fdb0df01df5..6db13d3943f2a0a8ad5cc2cf27f3965fd8a2cd42 100644 --- a/src/USER-DPD/fix_shardlow.cpp +++ b/src/USER-DPD/fix_shardlow.cpp @@ -84,18 +84,18 @@ static const char cite_fix_shardlow[] = /* ---------------------------------------------------------------------- */ FixShardlow::FixShardlow(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), pairDPD(NULL), pairDPDE(NULL), v_t0(NULL) - ,rand_state(NULL) + Fix(lmp, narg, arg), pairDPD(nullptr), pairDPDE(nullptr), v_t0(nullptr) + ,rand_state(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_shardlow); if (narg != 3) error->all(FLERR,"Illegal fix shardlow command"); - pairDPD = NULL; - pairDPDE = NULL; + pairDPD = nullptr; + pairDPDE = nullptr; pairDPD = (PairDPDfdt *) force->pair_match("dpd/fdt",1); pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy",1); - if (pairDPDE == NULL) + if (pairDPDE == nullptr) pairDPDE = (PairDPDfdtEnergy *) force->pair_match("dpd/fdt/energy/kk",1); maxRNG = 0; @@ -107,7 +107,7 @@ FixShardlow::FixShardlow(LAMMPS *lmp, int narg, char **arg) : comm_reverse = 3; } - if(pairDPD == NULL && pairDPDE == NULL) + if(pairDPD == nullptr && pairDPDE == nullptr) error->all(FLERR,"Must use pair_style dpd/fdt or dpd/fdt/energy with fix shardlow"); } @@ -533,7 +533,7 @@ void FixShardlow::initial_integrate(int /*vflag*/) const int nlocal = atom->nlocal; const int nghost = atom->nghost; - const bool useDPDE = (pairDPDE != NULL); + const bool useDPDE = (pairDPDE != nullptr); // NOTE: this logic is specific to orthogonal boxes, not triclinic @@ -640,7 +640,7 @@ fprintf(stdout, "\n%6d %6d,%6d %6d: " #endif memory->sfree(v_t0); - v_t0 = NULL; + v_t0 = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-DPD/npair_half_bin_newton_ssa.cpp b/src/USER-DPD/npair_half_bin_newton_ssa.cpp index 0fd39e1801998d61206cbb511dae579488468f83..e7adb891fd26654106fd051638cd2da505d66d5b 100644 --- a/src/USER-DPD/npair_half_bin_newton_ssa.cpp +++ b/src/USER-DPD/npair_half_bin_newton_ssa.cpp @@ -37,9 +37,9 @@ NPairHalfBinNewtonSSA::NPairHalfBinNewtonSSA(LAMMPS *lmp) : NPair(lmp) ssa_maxPhaseCt = 0; ssa_maxPhaseLen = 0; ssa_phaseCt = 0; - ssa_phaseLen = NULL; - ssa_itemLoc = NULL; - ssa_itemLen = NULL; + ssa_phaseLen = nullptr; + ssa_itemLoc = nullptr; + ssa_itemLen = nullptr; ssa_gphaseCt = 7; memory->create(ssa_gphaseLen,ssa_gphaseCt,"NPairHalfBinNewtonSSA:ssa_gphaseLen"); memory->create(ssa_gitemLoc,ssa_gphaseCt,1,"NPairHalfBinNewtonSSA:ssa_gitemLoc"); diff --git a/src/USER-DPD/pair_dpd_fdt.cpp b/src/USER-DPD/pair_dpd_fdt.cpp index 1d3d952e9f2040a36f2a6ec983400c3f01fee786..822444f8c5b91ec4e7be4d1584000b82c383186b 100644 --- a/src/USER-DPD/pair_dpd_fdt.cpp +++ b/src/USER-DPD/pair_dpd_fdt.cpp @@ -39,7 +39,7 @@ using namespace LAMMPS_NS; PairDPDfdt::PairDPDfdt(LAMMPS *lmp) : Pair(lmp) { - random = NULL; + random = nullptr; splitFDT_flag = false; a0_is_zero = false; } @@ -375,13 +375,13 @@ void PairDPDfdt::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -410,10 +410,10 @@ void PairDPDfdt::write_restart_settings(FILE *fp) void PairDPDfdt::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&temperature,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&temperature,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&temperature,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/USER-DPD/pair_dpd_fdt_energy.cpp b/src/USER-DPD/pair_dpd_fdt_energy.cpp index b843e4601af48c5227ef6bcb2933da61cf42587b..094e5732c7d2c50df7487319605ac09481a2fe4e 100644 --- a/src/USER-DPD/pair_dpd_fdt_energy.cpp +++ b/src/USER-DPD/pair_dpd_fdt_energy.cpp @@ -39,9 +39,9 @@ using namespace LAMMPS_NS; PairDPDfdtEnergy::PairDPDfdtEnergy(LAMMPS *lmp) : Pair(lmp) { - random = NULL; - duCond = NULL; - duMech = NULL; + random = nullptr; + duCond = nullptr; + duMech = nullptr; splitFDT_flag = false; a0_is_zero = false; @@ -476,14 +476,14 @@ void PairDPDfdtEnergy::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&kappa[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&kappa[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -513,9 +513,9 @@ void PairDPDfdtEnergy::write_restart_settings(FILE *fp) void PairDPDfdtEnergy::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&seed,1,MPI_INT,0,world); diff --git a/src/USER-DPD/pair_exp6_rx.cpp b/src/USER-DPD/pair_exp6_rx.cpp index 666a1b0ea95d58d4bb0afedf68f76174317cac85..9d7fcc1ab2b5f699e74b857dc24d9fab32c88091 100644 --- a/src/USER-DPD/pair_exp6_rx.cpp +++ b/src/USER-DPD/pair_exp6_rx.cpp @@ -59,10 +59,10 @@ struct PairExp6ParamDataType // Default constructor -- nullify everything. PairExp6ParamDataType(void) - : n(0), epsilon1(NULL), alpha1(NULL), rm1(NULL), mixWtSite1(NULL), - epsilon2(NULL), alpha2(NULL), rm2(NULL), mixWtSite2(NULL), - epsilonOld1(NULL), alphaOld1(NULL), rmOld1(NULL), mixWtSite1old(NULL), - epsilonOld2(NULL), alphaOld2(NULL), rmOld2(NULL), mixWtSite2old(NULL) + : n(0), epsilon1(nullptr), alpha1(nullptr), rm1(nullptr), mixWtSite1(nullptr), + epsilon2(nullptr), alpha2(nullptr), rm2(nullptr), mixWtSite2(nullptr), + epsilonOld1(nullptr), alphaOld1(nullptr), rmOld1(nullptr), mixWtSite1old(nullptr), + epsilonOld2(nullptr), alphaOld2(nullptr), rmOld2(nullptr), mixWtSite2old(nullptr) {} }; @@ -74,8 +74,8 @@ PairExp6rx::PairExp6rx(LAMMPS *lmp) : Pair(lmp) nspecies = 0; nparams = maxparam = 0; - params = NULL; - mol2param = NULL; + params = nullptr; + mol2param = nullptr; fractionalWeighting = true; } @@ -85,7 +85,7 @@ PairExp6rx::~PairExp6rx() { if (copymode) return; - if (params != NULL) { + if (params != nullptr) { for (int i=0; i < nparams; ++i) { delete[] params[i].name; delete[] params[i].potential; @@ -659,7 +659,7 @@ void PairExp6rx::coeff(int narg, char **arg) } delete[] site1; delete[] site2; - site1 = site2 = NULL; + site1 = site2 = nullptr; setup(); @@ -717,16 +717,16 @@ void PairExp6rx::read_file(char *file) char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 FILE *fp; - fp = NULL; + fp = nullptr; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open exp6/rx potential file %s",file); error->one(FLERR,str); @@ -743,7 +743,7 @@ void PairExp6rx::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -765,7 +765,7 @@ void PairExp6rx::read_file(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -785,7 +785,7 @@ void PairExp6rx::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; for (ispecies = 0; ispecies < nspecies; ispecies++) if (strcmp(words[0],&atom->dname[ispecies][0]) == 0) break; @@ -839,10 +839,10 @@ void PairExp6rx::read_file2(char *file) // open file on proc 0 FILE *fp; - fp = NULL; + fp = nullptr; if (comm->me == 0) { fp = fopen(file,"r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open polynomial file %s",file); error->one(FLERR,str); @@ -857,7 +857,7 @@ void PairExp6rx::read_file2(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -879,7 +879,7 @@ void PairExp6rx::read_file2(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -899,7 +899,7 @@ void PairExp6rx::read_file2(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; if (strcmp(words[0],"alpha") == 0){ for (int ii=1; iime; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); } @@ -1004,10 +1004,10 @@ void PairExp6rx::write_restart_settings(FILE *fp) void PairExp6rx::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/USER-DPD/pair_multi_lucy.cpp b/src/USER-DPD/pair_multi_lucy.cpp index ceb5c78eaf88853e22c3c7f8425b59b982618997..a266e94ccb32dca70e56b5fa2168fe36aa62af7c 100644 --- a/src/USER-DPD/pair_multi_lucy.cpp +++ b/src/USER-DPD/pair_multi_lucy.cpp @@ -57,14 +57,14 @@ static const char cite_pair_multi_lucy[] = /* ---------------------------------------------------------------------- */ PairMultiLucy::PairMultiLucy(LAMMPS *lmp) : Pair(lmp), - ntables(0), tables(NULL), tabindex(NULL) + ntables(0), tables(nullptr), tabindex(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_pair_multi_lucy); if (atom->rho_flag != 1) error->all(FLERR,"Pair multi/lucy command requires atom_style with density (e.g. dpd, meso)"); ntables = 0; - tables = NULL; + tables = nullptr; comm_forward = 1; comm_reverse = 1; @@ -256,7 +256,7 @@ void PairMultiLucy::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -349,7 +349,7 @@ void PairMultiLucy::read_table(Table *tb, char *file, char *keyword) // open file FILE *fp = fopen(file,"r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); @@ -358,7 +358,7 @@ void PairMultiLucy::read_table(Table *tb, char *file, char *keyword) // loop until section found with matching keyword while (1) { - if (fgets(line,MAXLINE,fp) == NULL) + if (fgets(line,MAXLINE,fp) == nullptr) error->one(FLERR,"Did not find keyword in table file"); if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line if (line[0] == '#') continue; // comment @@ -481,26 +481,26 @@ void PairMultiLucy::param_extract(Table *tb, char *line) char *word = strtok(line," \t\n\r\f"); while (word) { if (strcmp(word,"N") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->ninput = atoi(word); } else if (strcmp(word,"R") == 0 || strcmp(word,"RSQ") == 0) { if (strcmp(word,"R") == 0) tb->rflag = RLINEAR; else if (strcmp(word,"RSQ") == 0) tb->rflag = RSQ; - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->rlo = atof(word); - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->rhi = atof(word); } else if (strcmp(word,"FP") == 0) { tb->fpflag = 1; - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->fplo = atof(word); - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->fphi = atof(word); } else { printf("WORD: %s\n",word); error->one(FLERR,"Invalid keyword in pair table parameters"); } - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); } if (tb->ninput == 0) error->one(FLERR,"Pair table parameters did not set N"); @@ -582,15 +582,15 @@ void PairMultiLucy::compute_table(Table *tb) } /* ---------------------------------------------------------------------- - set all ptrs in a table to NULL, so can be freed safely + set all ptrs in a table to a null pointer, so can be freed safely ------------------------------------------------------------------------- */ void PairMultiLucy::null_table(Table *tb) { - tb->rfile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->rsq = tb->drsq = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->rfile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->rsq = tb->drsq = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- @@ -707,8 +707,8 @@ void PairMultiLucy::write_restart_settings(FILE *fp) void PairMultiLucy::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); MPI_Bcast(&tablength,1,MPI_INT,0,world); diff --git a/src/USER-DPD/pair_multi_lucy_rx.cpp b/src/USER-DPD/pair_multi_lucy_rx.cpp index d769d94783b1fcaa6ced3f9872f08d1a838caa28..d8356d20c484c1744a807eedfba867d5ccbab176 100644 --- a/src/USER-DPD/pair_multi_lucy_rx.cpp +++ b/src/USER-DPD/pair_multi_lucy_rx.cpp @@ -68,14 +68,14 @@ static const char cite_pair_multi_lucy_rx[] = /* ---------------------------------------------------------------------- */ PairMultiLucyRX::PairMultiLucyRX(LAMMPS *lmp) : Pair(lmp), - ntables(0), tables(NULL), tabindex(NULL), site1(NULL), site2(NULL) + ntables(0), tables(nullptr), tabindex(nullptr), site1(nullptr), site2(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_pair_multi_lucy_rx); if (atom->rho_flag != 1) error->all(FLERR,"Pair multi/lucy/rx command requires atom_style with density (e.g. dpd, meso)"); ntables = 0; - tables = NULL; + tables = nullptr; comm_forward = 1; comm_reverse = 1; @@ -134,10 +134,10 @@ void PairMultiLucyRX::compute(int eflag, int vflag) int jtable; double *rho = atom->rho; - double *mixWtSite1old = NULL; - double *mixWtSite2old = NULL; - double *mixWtSite1 = NULL; - double *mixWtSite2 = NULL; + double *mixWtSite1old = nullptr; + double *mixWtSite2old = nullptr; + double *mixWtSite1 = nullptr; + double *mixWtSite2 = nullptr; { const int ntotal = nlocal + nghost; @@ -355,7 +355,7 @@ void PairMultiLucyRX::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -494,7 +494,7 @@ void PairMultiLucyRX::read_table(Table *tb, char *file, char *keyword) // open file FILE *fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); @@ -503,7 +503,7 @@ void PairMultiLucyRX::read_table(Table *tb, char *file, char *keyword) // loop until section found with matching keyword while (1) { - if (fgets(line,MAXLINE,fp) == NULL) + if (fgets(line,MAXLINE,fp) == nullptr) error->one(FLERR,"Did not find keyword in table file"); if (strspn(line," \t\n\r") == strlen(line)) continue; // blank line if (line[0] == '#') continue; // comment @@ -626,26 +626,26 @@ void PairMultiLucyRX::param_extract(Table *tb, char *line) char *word = strtok(line," \t\n\r\f"); while (word) { if (strcmp(word,"N") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->ninput = atoi(word); } else if (strcmp(word,"R") == 0 || strcmp(word,"RSQ") == 0) { if (strcmp(word,"R") == 0) tb->rflag = RLINEAR; else if (strcmp(word,"RSQ") == 0) tb->rflag = RSQ; - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->rlo = atof(word); - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->rhi = atof(word); } else if (strcmp(word,"FP") == 0) { tb->fpflag = 1; - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->fplo = atof(word); - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->fphi = atof(word); } else { printf("WORD: %s\n",word); error->one(FLERR,"Invalid keyword in pair table parameters"); } - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); } if (tb->ninput == 0) error->one(FLERR,"Pair table parameters did not set N"); @@ -727,15 +727,15 @@ void PairMultiLucyRX::compute_table(Table *tb) } /* ---------------------------------------------------------------------- - set all ptrs in a table to NULL, so can be freed safely + set all ptrs in a table to a null pointer, so can be freed safely ------------------------------------------------------------------------- */ void PairMultiLucyRX::null_table(Table *tb) { - tb->rfile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->rsq = tb->drsq = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->rfile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->rsq = tb->drsq = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- @@ -852,8 +852,8 @@ void PairMultiLucyRX::write_restart_settings(FILE *fp) void PairMultiLucyRX::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); MPI_Bcast(&tablength,1,MPI_INT,0,world); diff --git a/src/USER-DPD/pair_table_rx.cpp b/src/USER-DPD/pair_table_rx.cpp index f791107f1d84909778d1ca8d23720fbf0a9d51a2..05467346c850560b657f75944b883167e27139c7 100644 --- a/src/USER-DPD/pair_table_rx.cpp +++ b/src/USER-DPD/pair_table_rx.cpp @@ -46,8 +46,8 @@ enum{NONE,RLINEAR,RSQ,BMP}; PairTableRX::PairTableRX(LAMMPS *lmp) : PairTable(lmp) { fractionalWeighting = true; - site1 = NULL; - site2 = NULL; + site1 = nullptr; + site2 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -93,10 +93,10 @@ void PairTableRX::compute(int eflag, int vflag) double *uCG = atom->uCG; double *uCGnew = atom->uCGnew; - double *mixWtSite1old = NULL; - double *mixWtSite2old = NULL; - double *mixWtSite1 = NULL; - double *mixWtSite2 = NULL; + double *mixWtSite1old = nullptr; + double *mixWtSite2old = nullptr; + double *mixWtSite1 = nullptr; + double *mixWtSite2 = nullptr; { const int ntotal = atom->nlocal + atom->nghost; @@ -290,7 +290,7 @@ void PairTableRX::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-DRUDE/compute_temp_drude.cpp b/src/USER-DRUDE/compute_temp_drude.cpp index b806b4434bf896b810b83a100e7987d60b861524..1c60805db26131576a65dad159749ae8dada7664 100644 --- a/src/USER-DRUDE/compute_temp_drude.cpp +++ b/src/USER-DRUDE/compute_temp_drude.cpp @@ -43,9 +43,9 @@ ComputeTempDrude::ComputeTempDrude(LAMMPS *lmp, int narg, char **arg) : tempflag = 0; // because does not compute a single temperature (scalar and vector) vector = new double[size_vector]; - fix_drude = NULL; - id_temp = NULL; - temperature = NULL; + fix_drude = nullptr; + id_temp = nullptr; + temperature = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-DRUDE/fix_drude.cpp b/src/USER-DRUDE/fix_drude.cpp index 7b53cbd8a32679bed73d292729f8e505426cc8e4..509281700f644d753fe3f92ae460e262c947b1ae 100644 --- a/src/USER-DRUDE/fix_drude.cpp +++ b/src/USER-DRUDE/fix_drude.cpp @@ -53,7 +53,7 @@ FixDrude::FixDrude(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Illegal fix drude command"); } - drudeid = NULL; + drudeid = nullptr; grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); atom->add_callback(Atom::RESTART); @@ -147,7 +147,7 @@ void FixDrude::build_drudeid(){ // Loop on procs to fill my atoms' sets of bond partners comm->ring(core_drude_vec.size(), sizeof(tagint), (char *) core_drude_vec.data(), - 4, ring_build_partner, NULL, (void *)this, 1); + 4, ring_build_partner, nullptr, (void *)this, 1); // Build the list of my Drudes' tags // The only bond partners of a Drude particle is its core, @@ -163,7 +163,7 @@ void FixDrude::build_drudeid(){ // so that each core finds its Drude. comm->ring(drude_vec.size(), sizeof(tagint), (char *) drude_vec.data(), - 3, ring_search_drudeid, NULL, (void *)this, 1); + 3, ring_search_drudeid, nullptr, (void *)this, 1); delete [] partner_set; } @@ -338,11 +338,11 @@ void FixDrude::rebuild_special(){ // Remove Drude particles from the special lists of each proc comm->ring(drude_vec.size(), sizeof(tagint), (char *) drude_vec.data(), - 9, ring_remove_drude, NULL, (void *)this, 1); + 9, ring_remove_drude, nullptr, (void *)this, 1); // Add back Drude particles in the lists just after their core comm->ring(core_drude_vec.size(), sizeof(tagint), (char *) core_drude_vec.data(), - 10, ring_add_drude, NULL, (void *)this, 1); + 10, ring_add_drude, nullptr, (void *)this, 1); // Check size of special list nspecmax_loc = 0; @@ -373,7 +373,7 @@ void FixDrude::rebuild_special(){ // Copy core's list into their drude list comm->ring(core_special_vec.size(), sizeof(tagint), (char *) core_special_vec.data(), - 11, ring_copy_drude, NULL, (void *)this, 1); + 11, ring_copy_drude, nullptr, (void *)this, 1); } /* ---------------------------------------------------------------------- diff --git a/src/USER-DRUDE/fix_drude_transform.cpp b/src/USER-DRUDE/fix_drude_transform.cpp index bdccaaebc845c201703c9acd062a868775483f91..fc89367323c68936fb68cb678abfa1821306165e 100644 --- a/src/USER-DRUDE/fix_drude_transform.cpp +++ b/src/USER-DRUDE/fix_drude_transform.cpp @@ -29,11 +29,11 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ template FixDrudeTransform::FixDrudeTransform(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), mcoeff(NULL) + Fix(lmp, narg, arg), mcoeff(nullptr) { if (narg != 3) error->all(FLERR,"Illegal fix drude/transform command"); comm_forward = 9; - fix_drude = NULL; + fix_drude = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-DRUDE/fix_langevin_drude.cpp b/src/USER-DRUDE/fix_langevin_drude.cpp index da745108217ccfac16bbf72671270a8b28e370fd..3fd017444eb71704d11f1cf10823ab3898f83d3d 100644 --- a/src/USER-DRUDE/fix_langevin_drude.cpp +++ b/src/USER-DRUDE/fix_langevin_drude.cpp @@ -48,7 +48,7 @@ FixLangevinDrude::FixLangevinDrude(LAMMPS *lmp, int narg, char **arg) : comm_reverse = 3; // core temperature - tstr_core = NULL; + tstr_core = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; tstr_core = new char[n]; @@ -63,7 +63,7 @@ FixLangevinDrude::FixLangevinDrude(LAMMPS *lmp, int narg, char **arg) : int seed_core = utils::inumeric(FLERR,arg[5],false,lmp); // drude temperature - tstr_drude = NULL; + tstr_drude = nullptr; if (strstr(arg[7],"v_") == arg[6]) { int n = strlen(&arg[6][2]) + 1; tstr_drude = new char[n]; @@ -102,9 +102,9 @@ FixLangevinDrude::FixLangevinDrude(LAMMPS *lmp, int narg, char **arg) : tflag = 0; // no external compute/temp is specified yet (for bias) energy = 0.; - fix_drude = NULL; - temperature = NULL; - id_temp = NULL; + fix_drude = nullptr; + temperature = nullptr; + id_temp = nullptr; } /* ---------------------------------------------------------------------- */ @@ -379,7 +379,7 @@ void *FixLangevinDrude::extract(const char *str, int &dim) } else if (strcmp(str,"t_target_drude") == 0) { return &t_target_drude; } else error->all(FLERR, "Illegal extract string in fix langevin/drude"); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-DRUDE/pair_lj_cut_thole_long.cpp b/src/USER-DRUDE/pair_lj_cut_thole_long.cpp index 461f972885a1bb01ca029d933ea5c5d1d9811238..c6662c423d25cfb50d2e16b0b09caba4dffa58ea 100644 --- a/src/USER-DRUDE/pair_lj_cut_thole_long.cpp +++ b/src/USER-DRUDE/pair_lj_cut_thole_long.cpp @@ -56,9 +56,9 @@ PairLJCutTholeLong::PairLJCutTholeLong(LAMMPS *lmp) : Pair(lmp) ewaldflag = pppmflag = 1; single_enable = 0; writedata = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; - fix_drude = NULL; + fix_drude = nullptr; } /* ---------------------------------------------------------------------- */ @@ -371,11 +371,11 @@ void PairLJCutTholeLong::init_style() // set rRESPA cutoffs - cut_respa = NULL; + cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -496,16 +496,16 @@ void PairLJCutTholeLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&polar[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&thole[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&polar[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&thole[i][j],sizeof(double),1,fp,nullptr,error); ascreen[i][j] = thole[i][j] / pow(polar[i][j], 1./3.); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -541,15 +541,15 @@ void PairLJCutTholeLong::write_restart_settings(FILE *fp) void PairLJCutTholeLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&thole_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&thole_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -602,5 +602,5 @@ void *PairLJCutTholeLong::extract(const char *str, int &dim) if (strcmp(str,"polar") == 0) return (void *) polar; if (strcmp(str,"thole") == 0) return (void *) thole; if (strcmp(str,"ascreen") == 0) return (void *) ascreen; - return NULL; + return nullptr; } diff --git a/src/USER-DRUDE/pair_thole.cpp b/src/USER-DRUDE/pair_thole.cpp index 281317c0764e69bd445c40405861aaee4c8c3528..e9c4f396d07fb89b2c2706b01a7ccce5e48a5cb1 100644 --- a/src/USER-DRUDE/pair_thole.cpp +++ b/src/USER-DRUDE/pair_thole.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ PairThole::PairThole(LAMMPS *lmp) : Pair(lmp) { - fix_drude = NULL; + fix_drude = nullptr; } /* ---------------------------------------------------------------------- */ @@ -312,13 +312,13 @@ void PairThole::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&polar[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&thole[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&polar[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&thole[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); ascreen[i][j] = thole[i][j] / pow(polar[i][j], 1./3.); } MPI_Bcast(&polar[i][j],1,MPI_DOUBLE,0,world); @@ -348,10 +348,10 @@ void PairThole::write_restart_settings(FILE *fp) void PairThole::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&thole_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&thole_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&thole_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); @@ -400,5 +400,5 @@ void *PairThole::extract(const char *str, int &dim) if (strcmp(str,"polar") == 0) return (void *) polar; if (strcmp(str,"thole") == 0) return (void *) thole; if (strcmp(str,"ascreen") == 0) return (void *) ascreen; - return NULL; + return nullptr; } diff --git a/src/USER-EFF/compute_ke_atom_eff.cpp b/src/USER-EFF/compute_ke_atom_eff.cpp index 001e1d4c4309af9c869feb4aa3ffb414645f824d..e25f239adc6e2bf3d75599571c3fdb06fa04fe58 100644 --- a/src/USER-EFF/compute_ke_atom_eff.cpp +++ b/src/USER-EFF/compute_ke_atom_eff.cpp @@ -40,7 +40,7 @@ ComputeKEAtomEff::ComputeKEAtomEff(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - ke = NULL; + ke = nullptr; // error check diff --git a/src/USER-EFF/compute_temp_deform_eff.cpp b/src/USER-EFF/compute_temp_deform_eff.cpp index 90e25ca3c813ed08061599161a3378051f12c195..979b47f50c2f17909f77b428a771d68a675024e8 100644 --- a/src/USER-EFF/compute_temp_deform_eff.cpp +++ b/src/USER-EFF/compute_temp_deform_eff.cpp @@ -52,7 +52,7 @@ ComputeTempDeformEff::ComputeTempDeformEff(LAMMPS *lmp, int narg, char **arg) : tempbias = 1; maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/USER-EFF/compute_temp_region_eff.cpp b/src/USER-EFF/compute_temp_region_eff.cpp index c95cf0de2df4f34f79439bfe5708fada47e7e3f0..f7c1bd5b68584c378f2cc3e50de119454687deb6 100644 --- a/src/USER-EFF/compute_temp_region_eff.cpp +++ b/src/USER-EFF/compute_temp_region_eff.cpp @@ -55,7 +55,7 @@ ComputeTempRegionEff::ComputeTempRegionEff(LAMMPS *lmp, int narg, char **arg) : tempbias = 1; maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/USER-EFF/fix_langevin_eff.cpp b/src/USER-EFF/fix_langevin_eff.cpp index 3966bc7b9847315263d15b9cc597809bad4263a7..a0aabb68a0e25553f9dbdc8a7fc0f42a159da6ab 100644 --- a/src/USER-EFF/fix_langevin_eff.cpp +++ b/src/USER-EFF/fix_langevin_eff.cpp @@ -45,7 +45,7 @@ enum{CONSTANT,EQUAL,ATOM}; FixLangevinEff::FixLangevinEff(LAMMPS *lmp, int narg, char **arg) : FixLangevin(lmp, narg, arg) { - erforcelangevin = NULL; + erforcelangevin = nullptr; } /* ---------------------------------------------------------------------- */ @@ -399,7 +399,7 @@ void FixLangevinEff::end_of_step() double FixLangevinEff::compute_scalar() { - if (!tallyflag || flangevin == NULL || erforcelangevin == NULL) return 0.0; + if (!tallyflag || flangevin == nullptr || erforcelangevin == nullptr) return 0.0; // capture the very first energy transfer to thermal reservoir diff --git a/src/USER-EFF/pair_eff_cut.cpp b/src/USER-EFF/pair_eff_cut.cpp index 72281c4a508195363fbc848c78949f26974cd65c..57435b68de9ae05e21feb3871b339c75fa546080 100644 --- a/src/USER-EFF/pair_eff_cut.cpp +++ b/src/USER-EFF/pair_eff_cut.cpp @@ -42,8 +42,8 @@ PairEffCut::PairEffCut(LAMMPS *lmp) : Pair(lmp) single_enable = 0; nmax = 0; - min_eradius = NULL; - min_erforce = NULL; + min_eradius = nullptr; + min_erforce = nullptr; nextra = 4; pvector = new double[nextra]; } @@ -979,10 +979,10 @@ void PairEffCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { - if (me == 0) utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); } } @@ -1006,9 +1006,9 @@ void PairEffCut::write_restart_settings(FILE *fp) void PairEffCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/USER-FEP/compute_fep.cpp b/src/USER-FEP/compute_fep.cpp index ff1e303a305290f10aea1cc51c1c3c028aa6cfc9..6ecf0795d7d95daa26f5bbbf7e97e327fc988df9 100644 --- a/src/USER-FEP/compute_fep.cpp +++ b/src/USER-FEP/compute_fep.cpp @@ -158,14 +158,14 @@ ComputeFEP::ComputeFEP(LAMMPS *lmp, int narg, char **arg) : // allocate space for charge, force, energy, virial arrays - f_orig = NULL; - q_orig = NULL; - peatom_orig = keatom_orig = NULL; - pvatom_orig = kvatom_orig = NULL; + f_orig = nullptr; + q_orig = nullptr; + peatom_orig = keatom_orig = nullptr; + pvatom_orig = kvatom_orig = nullptr; allocate_storage(); - fixgpu = NULL; + fixgpu = nullptr; } /* ---------------------------------------------------------------------- */ @@ -210,17 +210,17 @@ void ComputeFEP::init() if (!input->variable->equalstyle(pert->ivar)) error->all(FLERR,"Variable for compute fep is of invalid style"); - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"compute fep pair requires pair interactions"); if (pert->which == PAIR) { pairflag = 1; Pair *pair = force->pair_match(pert->pstyle,1); - if (pair == NULL) error->all(FLERR,"compute fep pair style " + if (pair == nullptr) error->all(FLERR,"compute fep pair style " "does not exist"); void *ptr = pair->extract(pert->pparam,pert->pdim); - if (ptr == NULL) + if (ptr == nullptr) error->all(FLERR,"compute fep pair style param not supported"); pert->array = (double **) ptr; @@ -497,10 +497,10 @@ void ComputeFEP::deallocate_storage() memory->destroy(keatom_orig); memory->destroy(kvatom_orig); - f_orig = NULL; - q_orig = NULL; - peatom_orig = keatom_orig = NULL; - pvatom_orig = kvatom_orig = NULL; + f_orig = nullptr; + q_orig = nullptr; + peatom_orig = keatom_orig = nullptr; + pvatom_orig = kvatom_orig = nullptr; } diff --git a/src/USER-FEP/fix_adapt_fep.cpp b/src/USER-FEP/fix_adapt_fep.cpp index 2f97b5a0e381c415eee6177435610bc6f70ba4cb..ca9088836dc53a22199450f3caf57f9f26bbe1ad 100644 --- a/src/USER-FEP/fix_adapt_fep.cpp +++ b/src/USER-FEP/fix_adapt_fep.cpp @@ -172,7 +172,7 @@ FixAdaptFEP::FixAdaptFEP(LAMMPS *lmp, int narg, char **arg) : if (adapt[m].which == PAIR) memory->create(adapt[m].array_orig,n+1,n+1,"adapt:array_orig"); - id_fix_diam = id_fix_chg = NULL; + id_fix_diam = id_fix_chg = nullptr; } /* ---------------------------------------------------------------------- */ @@ -220,8 +220,8 @@ void FixAdaptFEP::post_constructor() // new id = fix-ID + FIX_STORE_ATTRIBUTE // new fix group = group for this fix - id_fix_diam = NULL; - id_fix_chg = NULL; + id_fix_diam = nullptr; + id_fix_chg = nullptr; char **newarg = new char*[6]; newarg[1] = group->names[igroup]; @@ -307,7 +307,7 @@ void FixAdaptFEP::init() if (ad->which == PAIR) { anypair = 1; - Pair *pair = NULL; + Pair *pair = nullptr; if (lmp->suffix_enable) { char psuffix[128]; @@ -316,11 +316,11 @@ void FixAdaptFEP::init() strcat(psuffix,lmp->suffix); pair = force->pair_match(psuffix,1); } - if (pair == NULL) pair = force->pair_match(ad->pstyle,1); - if (pair == NULL) + if (pair == nullptr) pair = force->pair_match(ad->pstyle,1); + if (pair == nullptr) error->all(FLERR, "Fix adapt/fep pair style does not exist"); void *ptr = pair->extract(ad->pparam,ad->pdim); - if (ptr == NULL) + if (ptr == nullptr) error->all(FLERR,"Fix adapt/fep pair style param not supported"); ad->pdim = 2; @@ -340,7 +340,7 @@ void FixAdaptFEP::init() } } else if (ad->which == KSPACE) { - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Fix adapt/fep kspace style does not exist"); kspace_scale = (double *) force->kspace->extract("scale"); diff --git a/src/USER-FEP/pair_coul_cut_soft.cpp b/src/USER-FEP/pair_coul_cut_soft.cpp index b0a099a56f0b8c1cbb5314d29b3a5e9dd5257ac8..a68c136993167655160d22e12c30269c7583c5c0 100644 --- a/src/USER-FEP/pair_coul_cut_soft.cpp +++ b/src/USER-FEP/pair_coul_cut_soft.cpp @@ -275,12 +275,12 @@ void PairCoulCutSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&lambda[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -309,12 +309,12 @@ void PairCoulCutSoft::write_restart_settings(FILE *fp) void PairCoulCutSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&alphac,1,MPI_DOUBLE,0,world); @@ -373,5 +373,5 @@ void *PairCoulCutSoft::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_coul_long_soft.cpp b/src/USER-FEP/pair_coul_long_soft.cpp index 80173f3f0f9fafe51897646ef17b9a3b74858ca6..2749fe8c71dbd4e9b90e0848879f510e38d05450 100644 --- a/src/USER-FEP/pair_coul_long_soft.cpp +++ b/src/USER-FEP/pair_coul_long_soft.cpp @@ -236,7 +236,7 @@ void PairCoulLongSoft::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; } @@ -295,11 +295,11 @@ void PairCoulLongSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&lambda[i][j],1,MPI_DOUBLE,0,world); } } @@ -326,12 +326,12 @@ void PairCoulLongSoft::write_restart_settings(FILE *fp) void PairCoulLongSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&alphac,1,MPI_DOUBLE,0,world); @@ -388,5 +388,5 @@ void *PairCoulLongSoft::extract(const char *str, int &dim) if (strcmp(str,"scale") == 0) return (void *) scale; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp b/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp index e13b98329f971e1ad28de2c3f44874490a1a885a..e6783b0228c288ba753df0a416e7ba6244c39af3 100644 --- a/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_charmm_coul_long_soft.cpp @@ -728,11 +728,11 @@ void PairLJCharmmCoulLongSoft::init_style() error->all(FLERR,"Pair cutoff < Respa interior cutoff"); if (cut_lj_inner < cut_respa[1]) error->all(FLERR,"Pair inner cutoff < Respa interior cutoff"); - } else cut_respa = NULL; + } else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; } @@ -819,15 +819,15 @@ void PairLJCharmmCoulLongSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&eps14[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma14[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -862,15 +862,15 @@ void PairLJCharmmCoulLongSoft::write_restart_settings(FILE *fp) void PairLJCharmmCoulLongSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); @@ -990,5 +990,5 @@ void *PairLJCharmmCoulLongSoft::extract(const char *str, int &dim) if (strcmp(str,"implicit") == 0) return (void *) &implicit; if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp b/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp index bfd5a630f67657cfe36048cd788ca41cdcad6ed2..f8719b89005ee6dc46e0305ce7fb4d25d7973569 100644 --- a/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp +++ b/src/USER-FEP/pair_lj_class2_coul_cut_soft.cpp @@ -382,15 +382,15 @@ void PairLJClass2CoulCutSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -425,15 +425,15 @@ void PairLJClass2CoulCutSoft::write_restart_settings(FILE *fp) void PairLJClass2CoulCutSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&alphalj,1,MPI_DOUBLE,0,world); @@ -515,5 +515,5 @@ void *PairLJClass2CoulCutSoft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp b/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp index e027a3018548f4bfb58d070a1b1f0d46af4a697a..9741dd24caf1c114cbaf7c304142070732e8479b 100644 --- a/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp @@ -285,7 +285,7 @@ void PairLJClass2CoulLongSoft::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -397,14 +397,14 @@ void PairLJClass2CoulLongSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -438,15 +438,15 @@ void PairLJClass2CoulLongSoft::write_restart_settings(FILE *fp) void PairLJClass2CoulLongSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&alphalj,1,MPI_DOUBLE,0,world); @@ -537,5 +537,5 @@ void *PairLJClass2CoulLongSoft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_class2_soft.cpp b/src/USER-FEP/pair_lj_class2_soft.cpp index 0cd1fc9e87f97b751c728ce3e4dc216a7c692801..81319d715c7fa1e29e6fba07041065a1abbdf06a 100644 --- a/src/USER-FEP/pair_lj_class2_soft.cpp +++ b/src/USER-FEP/pair_lj_class2_soft.cpp @@ -321,14 +321,14 @@ void PairLJClass2Soft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -360,12 +360,12 @@ void PairLJClass2Soft::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&alphalj,1,MPI_DOUBLE,0,world); @@ -432,5 +432,5 @@ void *PairLJClass2Soft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp b/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp index a18256f98a79becd1ff8bc4bef4e6b4e250756eb..53f39523e17ed01fd7a1af98301150be625ba577 100644 --- a/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_coul_cut_soft.cpp @@ -378,15 +378,15 @@ void PairLJCutCoulCutSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -421,15 +421,15 @@ void PairLJCutCoulCutSoft::write_restart_settings(FILE *fp) void PairLJCutCoulCutSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); @@ -512,5 +512,5 @@ void *PairLJCutCoulCutSoft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp b/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp index 4b3fae77b37aa9167780bef606f615f49db3ba69..61db28fe1616fcb736957552ec793106402c39c2 100644 --- a/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_coul_long_soft.cpp @@ -656,11 +656,11 @@ void PairLJCutCoulLongSoft::init_style() if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; } @@ -775,14 +775,14 @@ void PairLJCutCoulLongSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -816,15 +816,15 @@ void PairLJCutCoulLongSoft::write_restart_settings(FILE *fp) void PairLJCutCoulLongSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphac,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphac,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); @@ -923,5 +923,5 @@ void *PairLJCutCoulLongSoft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_cut_soft.cpp b/src/USER-FEP/pair_lj_cut_soft.cpp index 786715d6c992f87582642feb77fc8d353e5c4d13..589e036420f4ce4642b38c1121c2b2d729c32e2d 100644 --- a/src/USER-FEP/pair_lj_cut_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_soft.cpp @@ -532,7 +532,7 @@ void PairLJCutSoft::init_style() if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -636,14 +636,14 @@ void PairLJCutSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -676,13 +676,13 @@ void PairLJCutSoft::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alphalj,sizeof(double),1,fp,nullptr,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&alphalj,1,MPI_DOUBLE,0,world); @@ -748,5 +748,5 @@ void *PairLJCutSoft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp b/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp index 18f8db5021580f451192588491133eebda55d1b2..748c616d64390b6f08b7e739d782fd973370190f 100644 --- a/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp +++ b/src/USER-FEP/pair_lj_cut_tip4p_long_soft.cpp @@ -53,8 +53,8 @@ PairLJCutTIP4PLongSoft::PairLJCutTIP4PLongSoft(LAMMPS *lmp) : respa_enable = 0; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -450,9 +450,9 @@ void PairLJCutTIP4PLongSoft::init_style() if (!atom->q_flag) error->all(FLERR, "Pair style lj/cut/tip4p/long/soft requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); PairLJCutCoulLongSoft::init_style(); @@ -517,17 +517,17 @@ void PairLJCutTIP4PLongSoft::read_restart_settings(FILE *fp) PairLJCutCoulLongSoft::read_restart_settings(fp); if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); - - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); + + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); @@ -579,7 +579,7 @@ void *PairLJCutTIP4PLongSoft::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-FEP/pair_morse_soft.cpp b/src/USER-FEP/pair_morse_soft.cpp index 85a30a5414fb2fe1c7d14acfa2565b8501f782a6..5154907ec3955e147550023feb7b99fb49786712 100644 --- a/src/USER-FEP/pair_morse_soft.cpp +++ b/src/USER-FEP/pair_morse_soft.cpp @@ -313,15 +313,15 @@ void PairMorseSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&lambda[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&d0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&alpha[i][j],1,MPI_DOUBLE,0,world); @@ -353,10 +353,10 @@ void PairMorseSoft::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shift_range,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&nlambda,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shift_range,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&nlambda,1,MPI_DOUBLE,0,world); MPI_Bcast(&shift_range,1,MPI_DOUBLE,0,world); @@ -450,5 +450,5 @@ void *PairMorseSoft::extract(const char *str, int &dim) if (strcmp(str,"r0") == 0) return (void *) r0; if (strcmp(str,"alpha") == 0) return (void *) alpha; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } diff --git a/src/USER-FEP/pair_tip4p_long_soft.cpp b/src/USER-FEP/pair_tip4p_long_soft.cpp index 9578befd3785146577286b1fd29cd25659ab5ca1..18e26671500cfbaa332fb82da9ee4edd19da3839 100644 --- a/src/USER-FEP/pair_tip4p_long_soft.cpp +++ b/src/USER-FEP/pair_tip4p_long_soft.cpp @@ -52,8 +52,8 @@ PairTIP4PLongSoft::PairTIP4PLongSoft(LAMMPS *lmp) : PairCoulLongSoft(lmp) respa_enable = 0; nmax = 0; - hneigh = NULL; - newsite = NULL; + hneigh = nullptr; + newsite = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -407,9 +407,9 @@ void PairTIP4PLongSoft::init_style() if (!atom->q_flag) error->all(FLERR, "Pair style tip4p/long requires atom attribute q"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must use a bond style with TIP4P potential"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must use an angle style with TIP4P potential"); PairCoulLongSoft::init_style(); @@ -454,11 +454,11 @@ void PairTIP4PLongSoft::read_restart_settings(FILE *fp) PairCoulLongSoft::read_restart_settings(fp); if (comm->me == 0) { - utils::sfread(FLERR,&typeO,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeH,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeB,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&typeA,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&qdist,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&typeO,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeH,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeB,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&typeA,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&qdist,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&typeO,1,MPI_INT,0,world); MPI_Bcast(&typeH,1,MPI_INT,0,world); @@ -501,7 +501,7 @@ void *PairTIP4PLongSoft::extract(const char *str, int &dim) if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; dim = 2; if (strcmp(str,"lambda") == 0) return (void *) lambda; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-H5MD/dump_h5md.cpp b/src/USER-H5MD/dump_h5md.cpp index e9daf71867dc811722464750d25820ca4cc8923f..11a490626343a38950cc82eb67a0a684a68398a9 100644 --- a/src/USER-H5MD/dump_h5md.cpp +++ b/src/USER-H5MD/dump_h5md.cpp @@ -68,11 +68,11 @@ DumpH5MD::DumpH5MD(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg) size_one = 6; sort_flag = 1; sortcol = 0; - format_default = NULL; + format_default = nullptr; flush_flag = 0; unwrap_flag = 0; datafile_from_dump = -1; - author_name=NULL; + author_name=nullptr; every_dump = utils::inumeric(FLERR,arg[3],false,lmp); every_position = every_image = -1; @@ -175,7 +175,7 @@ DumpH5MD::DumpH5MD(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg) if (iarg+1>=narg) { error->all(FLERR, "Invalid number of arguments in dump h5md"); } - if (author_name==NULL) { + if (author_name==nullptr) { author_name = new char[strlen(arg[iarg])+1]; strcpy(author_name, arg[iarg+1]); } else { @@ -271,10 +271,10 @@ void DumpH5MD::openfile() if (me == 0) { if (datafile_from_dump<0) { - if (author_name==NULL) { - datafile = h5md_create_file(filename, "N/A", NULL, "lammps", LAMMPS_VERSION); + if (author_name==nullptr) { + datafile = h5md_create_file(filename, "N/A", nullptr, "lammps", LAMMPS_VERSION); } else { - datafile = h5md_create_file(filename, author_name, NULL, "lammps", LAMMPS_VERSION); + datafile = h5md_create_file(filename, author_name, nullptr, "lammps", LAMMPS_VERSION); } group_name_length = strlen(group->names[igroup])+1; group_name = new char[group_name_length]; @@ -288,19 +288,19 @@ void DumpH5MD::openfile() dims[0] = natoms; dims[1] = domain->dimension; if (every_position>0) { - particles_data.position = h5md_create_time_data(particles_data.group, "position", 2, dims, H5T_NATIVE_DOUBLE, NULL); - h5md_create_box(&particles_data, dims[1], boundary, true, NULL, &particles_data.position); + particles_data.position = h5md_create_time_data(particles_data.group, "position", 2, dims, H5T_NATIVE_DOUBLE, nullptr); + h5md_create_box(&particles_data, dims[1], boundary, true, nullptr, &particles_data.position); } if (every_image>0) particles_data.image = h5md_create_time_data(particles_data.group, "image", 2, dims, H5T_NATIVE_INT, &particles_data.position); if (every_velocity>0) - particles_data.velocity = h5md_create_time_data(particles_data.group, "velocity", 2, dims, H5T_NATIVE_DOUBLE, NULL); + particles_data.velocity = h5md_create_time_data(particles_data.group, "velocity", 2, dims, H5T_NATIVE_DOUBLE, nullptr); if (every_force>0) - particles_data.force = h5md_create_time_data(particles_data.group, "force", 2, dims, H5T_NATIVE_DOUBLE, NULL); + particles_data.force = h5md_create_time_data(particles_data.group, "force", 2, dims, H5T_NATIVE_DOUBLE, nullptr); if (every_species>0) - particles_data.species = h5md_create_time_data(particles_data.group, "species", 1, dims, H5T_NATIVE_INT, NULL); + particles_data.species = h5md_create_time_data(particles_data.group, "species", 1, dims, H5T_NATIVE_INT, nullptr); if (every_charge>0) { - particles_data.charge = h5md_create_time_data(particles_data.group, "charge", 1, dims, H5T_NATIVE_DOUBLE, NULL); + particles_data.charge = h5md_create_time_data(particles_data.group, "charge", 1, dims, H5T_NATIVE_DOUBLE, nullptr); h5md_write_string_attribute(particles_data.group, "charge", "type", "effective"); } } else { @@ -318,26 +318,26 @@ void DumpH5MD::openfile() dims[0] = natoms; dims[1] = domain->dimension; if (every_position>0) { - particles_data.position = h5md_create_time_data(particles_data.group, "position", 2, dims, H5T_NATIVE_DOUBLE, NULL); - h5md_create_box(&particles_data, dims[1], boundary, true, NULL, &particles_data.position); + particles_data.position = h5md_create_time_data(particles_data.group, "position", 2, dims, H5T_NATIVE_DOUBLE, nullptr); + h5md_create_box(&particles_data, dims[1], boundary, true, nullptr, &particles_data.position); } if (every_image>0) particles_data.image = h5md_create_time_data(particles_data.group, "image", 2, dims, H5T_NATIVE_INT, &particles_data.position); if (every_velocity>0) - particles_data.velocity = h5md_create_time_data(particles_data.group, "velocity", 2, dims, H5T_NATIVE_DOUBLE, NULL); + particles_data.velocity = h5md_create_time_data(particles_data.group, "velocity", 2, dims, H5T_NATIVE_DOUBLE, nullptr); if (every_force>0) - particles_data.force = h5md_create_time_data(particles_data.group, "force", 2, dims, H5T_NATIVE_DOUBLE, NULL); + particles_data.force = h5md_create_time_data(particles_data.group, "force", 2, dims, H5T_NATIVE_DOUBLE, nullptr); if (every_species>0) - particles_data.species = h5md_create_time_data(particles_data.group, "species", 1, dims, H5T_NATIVE_INT, NULL); + particles_data.species = h5md_create_time_data(particles_data.group, "species", 1, dims, H5T_NATIVE_INT, nullptr); if (every_charge>0) { - particles_data.charge = h5md_create_time_data(particles_data.group, "charge", 1, dims, H5T_NATIVE_DOUBLE, NULL); + particles_data.charge = h5md_create_time_data(particles_data.group, "charge", 1, dims, H5T_NATIVE_DOUBLE, nullptr); h5md_write_string_attribute(particles_data.group, "charge", "type", "effective"); } } } - if (author_name!=NULL) delete [] author_name; + if (author_name!=nullptr) delete [] author_name; for (int i=0; i<3; i++) { delete [] boundary[i]; } @@ -536,7 +536,7 @@ void DumpH5MD::write_fixed_frame() edges[2] = boxzhi - boxzlo; if (every_position==0) { particles_data.position = h5md_create_fixed_data_simple(particles_data.group, "position", 2, dims, H5T_NATIVE_DOUBLE, dump_position); - h5md_create_box(&particles_data, dims[1], boundary, false, edges, NULL); + h5md_create_box(&particles_data, dims[1], boundary, false, edges, nullptr); if (every_image==0) particles_data.image = h5md_create_fixed_data_simple(particles_data.group, "image", 2, dims, H5T_NATIVE_INT, dump_image); } diff --git a/src/USER-INTEL/angle_charmm_intel.h b/src/USER-INTEL/angle_charmm_intel.h index 155ecfaff9855f979b043616641a6632f75a90e8..798e3d15231356cafe601e4d98c336f4176a01b5 100644 --- a/src/USER-INTEL/angle_charmm_intel.h +++ b/src/USER-INTEL/angle_charmm_intel.h @@ -61,7 +61,7 @@ class AngleCharmmIntel : public AngleCharmm { fc_packed1 *fc; ForceConst() : _nangletypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nangletypes, Memory *memory); diff --git a/src/USER-INTEL/angle_harmonic_intel.h b/src/USER-INTEL/angle_harmonic_intel.h index c00292f7ce5d78ad51eaac80b2669254429dd830..7df4a98877a15bef8a81a2be856964db6395f5f1 100644 --- a/src/USER-INTEL/angle_harmonic_intel.h +++ b/src/USER-INTEL/angle_harmonic_intel.h @@ -61,7 +61,7 @@ class AngleHarmonicIntel : public AngleHarmonic { fc_packed1 *fc; ForceConst() : _nangletypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nangletypes, Memory *memory); diff --git a/src/USER-INTEL/bond_fene_intel.h b/src/USER-INTEL/bond_fene_intel.h index 58fcdb866928db932e1924b0d8e51ad0872efaac..92ec4097c007e612522c3b0d489c059a0074736c 100644 --- a/src/USER-INTEL/bond_fene_intel.h +++ b/src/USER-INTEL/bond_fene_intel.h @@ -61,7 +61,7 @@ class BondFENEIntel : public BondFENE { fc_packed1 *fc; ForceConst() : _nbondtypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nbondtypes, Memory *memory); diff --git a/src/USER-INTEL/bond_harmonic_intel.h b/src/USER-INTEL/bond_harmonic_intel.h index 3c1d050a3bb159f04eb4fbaae60885152b09bf47..449df3b7a83c741857d92885a82fe8cdfb94fddc 100644 --- a/src/USER-INTEL/bond_harmonic_intel.h +++ b/src/USER-INTEL/bond_harmonic_intel.h @@ -61,7 +61,7 @@ class BondHarmonicIntel : public BondHarmonic { fc_packed1 *fc; ForceConst() : _nbondtypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nbondtypes, Memory *memory); diff --git a/src/USER-INTEL/dihedral_charmm_intel.h b/src/USER-INTEL/dihedral_charmm_intel.h index d80b32c8ac3a731e9b4df20b012315d89b950e88..bb830b7292c6134c38b60d48912b5b2108d2936e 100644 --- a/src/USER-INTEL/dihedral_charmm_intel.h +++ b/src/USER-INTEL/dihedral_charmm_intel.h @@ -66,7 +66,7 @@ class DihedralCharmmIntel : public DihedralCharmm { flt_t *weight; ForceConst() : _npairtypes(0), _nbondtypes(0) {} - ~ForceConst() { set_ntypes(0, 0, NULL); } + ~ForceConst() { set_ntypes(0, 0, nullptr); } void set_ntypes(const int npairtypes, const int nbondtypes, Memory *memory); diff --git a/src/USER-INTEL/dihedral_fourier_intel.h b/src/USER-INTEL/dihedral_fourier_intel.h index 26007f41188acd14ea9b00db659cf964bde28cb4..f91d89f6bcc4b4e2e8acd2c7f541e8a4ec912ba0 100644 --- a/src/USER-INTEL/dihedral_fourier_intel.h +++ b/src/USER-INTEL/dihedral_fourier_intel.h @@ -63,7 +63,7 @@ class DihedralFourierIntel : public DihedralFourier { fc_packed1 **bp; ForceConst() : _nbondtypes(0) {} - ~ForceConst() { set_ntypes(0, NULL, NULL, NULL); } + ~ForceConst() { set_ntypes(0, nullptr, nullptr, nullptr); } void set_ntypes(const int nbondtypes, int *setflag, int *nterms, Memory *memory); diff --git a/src/USER-INTEL/dihedral_harmonic_intel.h b/src/USER-INTEL/dihedral_harmonic_intel.h index 0a9cfaa042df4cfb33359bc5a8a99c58d8e6e9a9..cdbae365fdc16d450521bd0114086b3bf4ac1f2b 100644 --- a/src/USER-INTEL/dihedral_harmonic_intel.h +++ b/src/USER-INTEL/dihedral_harmonic_intel.h @@ -63,7 +63,7 @@ class DihedralHarmonicIntel : public DihedralHarmonic { fc_packed1 *bp; ForceConst() : _nbondtypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nbondtypes, Memory *memory); diff --git a/src/USER-INTEL/dihedral_opls_intel.h b/src/USER-INTEL/dihedral_opls_intel.h index 1080bfa6c3045d62b6ee2dda7b8390fd4c948d28..77fd8c4b95bb07a9853ced688710bbe6955df962 100644 --- a/src/USER-INTEL/dihedral_opls_intel.h +++ b/src/USER-INTEL/dihedral_opls_intel.h @@ -62,7 +62,7 @@ class DihedralOPLSIntel : public DihedralOPLS { fc_packed1 *bp; ForceConst() : _nbondtypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nbondtypes, Memory *memory); diff --git a/src/USER-INTEL/fix_intel.cpp b/src/USER-INTEL/fix_intel.cpp index eacbc7ddcc2b2531845cb4db9977d46ae4c36b9f..21cc106e316511d3b4bfac0897e3d308958525bb 100644 --- a/src/USER-INTEL/fix_intel.cpp +++ b/src/USER-INTEL/fix_intel.cpp @@ -303,7 +303,7 @@ void FixIntel::init() #endif const int nstyles = _pair_intel_count; - if (force->pair_match("^hybrid", 0) != NULL) { + if (force->pair_match("^hybrid", 0) != nullptr) { _pair_hybrid_flag = 1; if (force->newton_pair != 0 && force->pair->no_virial_fdotr_compute) error->all(FLERR, @@ -513,9 +513,9 @@ void FixIntel::bond_init_check() "USER-INTEL package requires same setting for newton bond and non-bond."); int intel_pair = 0; - if (force->pair_match("/intel$", 0) != NULL) + if (force->pair_match("/intel$", 0) != nullptr) intel_pair = 1; - else if (force->pair_match("^hybrid", 0) != NULL) { + else if (force->pair_match("^hybrid", 0) != nullptr) { _hybrid_nonpair = 1; if (pair_hybrid_check()) intel_pair = 1; } @@ -530,9 +530,9 @@ void FixIntel::bond_init_check() void FixIntel::kspace_init_check() { int intel_pair = 0; - if (force->pair_match("/intel$", 0) != NULL) + if (force->pair_match("/intel$", 0) != nullptr) intel_pair = 1; - else if (force->pair_match("^hybrid", 0) != NULL) { + else if (force->pair_match("^hybrid", 0) != nullptr) { _hybrid_nonpair = 1; if (pair_hybrid_check()) intel_pair = 1; } @@ -855,7 +855,7 @@ void FixIntel::add_oresults(const ft * _noalias const f_in, } } - if (ev_global != NULL) { + if (ev_global != nullptr) { force->pair->eng_vdwl += ev_global[0]; force->pair->eng_coul += ev_global[1]; force->pair->virial[0] += ev_global[2]; @@ -1168,7 +1168,7 @@ int FixIntel::set_host_affinity(const int nomp) sprintf(cmd, "lscpu -p | grep -v '#' |" "sort -t, -k 3,3n -k 2,2n | awk -F, '{print $1}'"); p = popen(cmd, "r"); - if (p == NULL) return -1; + if (p == nullptr) return -1; ncores = 0; while(fgets(readbuf, 512, p)) { proc_list[ncores] = atoi(readbuf); @@ -1190,7 +1190,7 @@ int FixIntel::set_host_affinity(const int nomp) int nthreads = nomp; if (nthreads == 0) { estring = getenv("OMP_NUM_THREADS"); - if (estring != NULL) { + if (estring != nullptr) { nthreads = atoi(estring); if (nthreads < 2) nthreads = 1; } else @@ -1222,7 +1222,7 @@ int FixIntel::set_host_affinity(const int nomp) if (coi_cores) { sprintf(cmd, "ps -Lp %d -o lwp | awk ' (NR > 2) {print}'", pid); p = popen(cmd, "r"); - if (p == NULL) return -1; + if (p == nullptr) return -1; while(fgets(readbuf, 512, p)) { lwp = atoi(readbuf); @@ -1258,7 +1258,7 @@ int FixIntel::set_host_affinity(const int nomp) free(buf1); p = popen(cmd, "r"); - if (p == NULL) return -1; + if (p == nullptr) return -1; while(fgets(readbuf, 512, p)) { lwp = atoi(readbuf); diff --git a/src/USER-INTEL/fix_intel.h b/src/USER-INTEL/fix_intel.h index 4c50164d31df8576f6c59d09b118c165a43a9d5d..df3aecbc81251ffcd5b16b9638a55127b7302e93 100644 --- a/src/USER-INTEL/fix_intel.h +++ b/src/USER-INTEL/fix_intel.h @@ -167,8 +167,8 @@ class FixIntel : public Fix { inline void zero_timers() {} inline void start_watch(const int /*which*/) {} inline double stop_watch(const int /*which*/) { return 0.0; } - double * off_watch_pair() { return NULL; } - double * off_watch_neighbor() { return NULL; } + double * off_watch_pair() { return nullptr; } + double * off_watch_neighbor() { return nullptr; } inline void balance_stamp() {} inline void acc_timers() {} inline int separate_buffers() { return 0; } diff --git a/src/USER-INTEL/improper_cvff_intel.h b/src/USER-INTEL/improper_cvff_intel.h index 812b49d50c3006914f4c88afc084e8dbd9a57422..94aa29c55f3546e3c2456544f9a3b8e4ce71db9a 100644 --- a/src/USER-INTEL/improper_cvff_intel.h +++ b/src/USER-INTEL/improper_cvff_intel.h @@ -62,7 +62,7 @@ class ImproperCvffIntel : public ImproperCvff { fc_packed1 *fc; ForceConst() : _nimpropertypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nimpropertypes, Memory *memory); diff --git a/src/USER-INTEL/improper_harmonic_intel.h b/src/USER-INTEL/improper_harmonic_intel.h index 6d7c829961fe4ccf20961cf87aa946300d49838d..ce1da11a3316632acb61599465c460747e816385 100644 --- a/src/USER-INTEL/improper_harmonic_intel.h +++ b/src/USER-INTEL/improper_harmonic_intel.h @@ -62,7 +62,7 @@ class ImproperHarmonicIntel : public ImproperHarmonic { fc_packed1 *fc; ForceConst() : _nimpropertypes(0) {} - ~ForceConst() { set_ntypes(0, NULL); } + ~ForceConst() { set_ntypes(0, nullptr); } void set_ntypes(const int nimpropertypes, Memory *memory); diff --git a/src/USER-INTEL/intel_buffers.cpp b/src/USER-INTEL/intel_buffers.cpp index dc5b0fad5a633d0f9f026e3282500a7499f07fd8..168074eb3e676976d3e3a53711cac341710f9f86 100644 --- a/src/USER-INTEL/intel_buffers.cpp +++ b/src/USER-INTEL/intel_buffers.cpp @@ -123,9 +123,9 @@ void IntelBuffers::_grow(const int nall, const int nlocal, _buf_local_size = static_cast(nlocal) * 1.1 + 1; const int f_stride = get_stride(_buf_local_size); lmp->memory->create(_x, _buf_size,"intel_x"); - if (lmp->atom->q != NULL) + if (lmp->atom->q != nullptr) lmp->memory->create(_q, _buf_size, "intel_q"); - if (lmp->atom->ellipsoid != NULL) + if (lmp->atom->ellipsoid != nullptr) lmp->memory->create(_quat, _buf_size, "intel_quat"); #ifdef _LMP_INTEL_OFFLOAD if (lmp->force->newton_pair) @@ -139,9 +139,9 @@ void IntelBuffers::_grow(const int nall, const int nlocal, #ifdef _LMP_INTEL_OFFLOAD if (_separate_buffers) { lmp->memory->create(_host_x, _buf_size,"intel_host_x"); - if (lmp->atom->q != NULL) + if (lmp->atom->q != nullptr) lmp->memory->create(_host_q, _buf_size, "intel_host_q"); - if (lmp->atom->ellipsoid != NULL) + if (lmp->atom->ellipsoid != nullptr) lmp->memory->create(_host_quat, _buf_size, "intel_host_quat"); } @@ -154,24 +154,24 @@ void IntelBuffers::_grow(const int nall, const int nlocal, const flt_t * const q = get_q(); const vec3_acc_t * f_start = get_off_f(); acc_t * ev_global = get_ev_global(); - if (lmp->atom->q != NULL) { - if (x != NULL && q != NULL && f_start != NULL && ev_global != NULL) { + if (lmp->atom->q != nullptr) { + if (x != nullptr && q != nullptr && f_start != nullptr && ev_global != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(x,q:length(_buf_size) alloc_if(1) free_if(0)) \ nocopy(f_start:length(f_stride*fm) alloc_if(1) free_if(0))\ nocopy(ev_global:length(8) alloc_if(1) free_if(0)) } } else { - if (x != NULL && f_start != NULL && ev_global != NULL) { + if (x != nullptr && f_start != nullptr && ev_global != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(x:length(_buf_size) alloc_if(1) free_if(0)) \ nocopy(f_start:length(f_stride*fm) alloc_if(1) free_if(0))\ nocopy(ev_global:length(8) alloc_if(1) free_if(0)) } } - if (lmp->atom->ellipsoid != NULL) { + if (lmp->atom->ellipsoid != nullptr) { const quat_t * const quat = get_quat(); - if (quat != NULL) { + if (quat != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(quat:length(_buf_size) alloc_if(1) free_if(0)) } @@ -252,7 +252,7 @@ void IntelBuffers::free_list_local() int * cnumneigh = _neigh_list_ptrs[0].cnumneigh; _neigh_list_ptrs[0].cnumneigh = 0; #ifdef _LMP_INTEL_OFFLOAD - if (_off_map_ilist != NULL) { + if (_off_map_ilist != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(cnumneigh:alloc_if(0) free_if(1)) } @@ -261,11 +261,11 @@ void IntelBuffers::free_list_local() } #ifdef _LMP_INTEL_OFFLOAD - if (_off_map_ilist != NULL) { + if (_off_map_ilist != nullptr) { const int * ilist = _off_map_ilist; const int * numneigh = _off_map_numneigh; const int ** firstneigh = (const int **)_off_map_firstneigh; - _off_map_ilist = NULL; + _off_map_ilist = nullptr; #pragma offload_transfer target(mic:_cop) \ nocopy(ilist,firstneigh,numneigh:alloc_if(0) free_if(1)) } @@ -402,7 +402,7 @@ void IntelBuffers::_grow_nbor_list(NeighList * /*list*/, if (offload_end > 0) { int * list_alloc =_list_alloc; - if (list_alloc != NULL) { + if (list_alloc != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(list_alloc:length(list_alloc_size) alloc_if(1) free_if(0)) _off_list_alloc = true; @@ -497,8 +497,8 @@ void IntelBuffers::grow_ccache(const int off_flag, int *ccachei = _ccachei; int *ccachej = _ccachej; - if (ccachex != NULL && ccachey !=NULL && ccachez != NULL && - ccachew != NULL && ccachei != NULL && ccachej !=NULL) { + if (ccachex != nullptr && ccachey !=nullptr && ccachez != nullptr && + ccachew != nullptr && ccachei != nullptr && ccachej !=nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(ccachex,ccachey:length(vsize) alloc_if(1) free_if(0)) \ nocopy(ccachez,ccachew:length(vsize) alloc_if(1) free_if(0)) \ @@ -506,7 +506,7 @@ void IntelBuffers::grow_ccache(const int off_flag, in(ccachej:length(vsize) alloc_if(1) free_if(0)) } #ifdef LMP_USE_AVXCD - if (ccachef != NULL) { + if (ccachef != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(ccachef:length(_ccache_stride3 * nt) alloc_if(1) free_if(0)) } @@ -595,8 +595,8 @@ void IntelBuffers::grow_ncache(const int off_flag, int *ncachej = _ncachej; int *ncachejtype = _ncachejtype; - if (ncachex != NULL && ncachey !=NULL && ncachez != NULL && - ncachej != NULL && ncachejtype != NULL) { + if (ncachex != nullptr && ncachey !=nullptr && ncachez != nullptr && + ncachej != nullptr && ncachejtype != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(ncachex,ncachey:length(vsize) alloc_if(1) free_if(0)) \ nocopy(ncachez,ncachej:length(vsize) alloc_if(1) free_if(0)) \ @@ -674,13 +674,13 @@ void IntelBuffers::set_ntypes(const int ntypes, #ifdef _LMP_INTEL_OFFLOAD flt_t * cutneighsqo = _cutneighsq[0]; const int ntypes2 = ntypes * ntypes; - if (_off_threads > 0 && cutneighsqo != NULL) { + if (_off_threads > 0 && cutneighsqo != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(cutneighsqo:length(ntypes2) alloc_if(1) free_if(0)) } if (use_ghost_cut) { flt_t * cutneighghostsqo = _cutneighghostsq[0]; - if (_off_threads > 0 && cutneighghostsqo != NULL) { + if (_off_threads > 0 && cutneighghostsqo != nullptr) { #pragma offload_transfer target(mic:_cop) \ nocopy(cutneighghostsqo:length(ntypes2) alloc_if(1) free_if(0)) } diff --git a/src/USER-INTEL/intel_buffers.h b/src/USER-INTEL/intel_buffers.h index f3c07da7c2bc750e739af9d9ab158f196a097361..86fc921c9e7a6b878c4f1a99096ac288d3ddf1d8 100644 --- a/src/USER-INTEL/intel_buffers.h +++ b/src/USER-INTEL/intel_buffers.h @@ -211,7 +211,7 @@ class IntelBuffers { _x[i].z = lmp->atom->x[i][2]; _x[i].w = lmp->atom->type[i]; } - if (lmp->atom->q != NULL) + if (lmp->atom->q != nullptr) #if defined(LMP_SIMD_COMPILER) #pragma vector aligned #pragma ivdep @@ -296,7 +296,7 @@ class IntelBuffers { _host_x[nall].y = INTEL_BIGP; _host_x[nall].z = INTEL_BIGP; _host_x[nall].w = 1; - if (lmp->atom->q != NULL) { + if (lmp->atom->q != nullptr) { memcpy(_host_q + host_min_local, _q + host_min_local, used_local * sizeof(flt_t)); memcpy(_host_q + host_min_local + used_local, _q + host_min_ghost, diff --git a/src/USER-INTEL/intel_preprocess.h b/src/USER-INTEL/intel_preprocess.h index 2515e47c52499e3f0db259b8c2e9c5905551c187..3e547b58a0e1747c0fe4ebd4594061c7b6f389e8 100644 --- a/src/USER-INTEL/intel_preprocess.h +++ b/src/USER-INTEL/intel_preprocess.h @@ -528,7 +528,7 @@ inline double MIC_Wtime() { double time; struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); time = 1.0 * tv.tv_sec + 1.0e-6 * tv.tv_usec; return time; } diff --git a/src/USER-INTEL/nbin_intel.cpp b/src/USER-INTEL/nbin_intel.cpp index 3a2af740d8ea27cb2b2aee57c14e9994cfae9c8c..bf5377b9463cb9926eb2dbd221540cabc8d236c4 100644 --- a/src/USER-INTEL/nbin_intel.cpp +++ b/src/USER-INTEL/nbin_intel.cpp @@ -35,8 +35,8 @@ NBinIntel::NBinIntel(LAMMPS *lmp) : NBinStandard(lmp) { "The 'package intel' command is required for /intel styles"); _fix = static_cast(modify->fix[ifix]); _precision_mode = _fix->precision(); - _atombin = NULL; - _binpacked = NULL; + _atombin = nullptr; + _binpacked = nullptr; #ifdef _LMP_INTEL_OFFLOAD _cop = _fix->coprocessor_number(); _offload_alloc = 0; diff --git a/src/USER-INTEL/npair_full_bin_ghost_intel.cpp b/src/USER-INTEL/npair_full_bin_ghost_intel.cpp index 89e80b021a8a6fe3d76523adee645e93be640b9c..ae7ac78bc8bed919e91849b97a804f4f1909dde0 100644 --- a/src/USER-INTEL/npair_full_bin_ghost_intel.cpp +++ b/src/USER-INTEL/npair_full_bin_ghost_intel.cpp @@ -119,8 +119,8 @@ void NPairFullBinGhostIntel::fbi(const int offload, NeighList * list, const int e_nall = nall_t; const int molecular = atom->molecular; - int *ns = NULL; - tagint *s = NULL; + int *ns = nullptr; + tagint *s = nullptr; int tag_size = 0, special_size; if (buffers->need_tag()) tag_size = e_nall; if (molecular != Atom::ATOMIC) { diff --git a/src/USER-INTEL/npair_intel.cpp b/src/USER-INTEL/npair_intel.cpp index 9b8f3481ee5482cdf0bbde955b1022f1100c2cf0..29c4f3bd6701047f110638cfafc9e67a933fdb74 100644 --- a/src/USER-INTEL/npair_intel.cpp +++ b/src/USER-INTEL/npair_intel.cpp @@ -125,8 +125,8 @@ void NPairIntel::bin_newton(const int offload, NeighList *list, const int e_nall = nall_t; const int molecular = atom->molecular; - int *ns = NULL; - tagint *s = NULL; + int *ns = nullptr; + tagint *s = nullptr; int tag_size = 0, special_size; if (buffers->need_tag()) tag_size = e_nall; if (molecular != Atom::ATOMIC) { diff --git a/src/USER-INTEL/pair_airebo_intel.cpp b/src/USER-INTEL/pair_airebo_intel.cpp index 6b576220fe074d5498c153e6bb67a420fc9448e1..d5192f200840f37c5d5a8a57043e022d551d133f 100644 --- a/src/USER-INTEL/pair_airebo_intel.cpp +++ b/src/USER-INTEL/pair_airebo_intel.cpp @@ -159,10 +159,10 @@ void aut_frebo(KernelArgsAIREBOT * ka, int torsion_flag); PairAIREBOIntel::PairAIREBOIntel(LAMMPS *lmp) : PairAIREBO(lmp) { suffix_flag |= Suffix::INTEL; - REBO_cnumneigh = NULL; - REBO_num_skin = NULL; - REBO_list_data = NULL; - fix = NULL; + REBO_cnumneigh = nullptr; + REBO_num_skin = nullptr; + REBO_list_data = nullptr; + fix = nullptr; } /* ---------------------------------------------------------------------- */ @@ -697,7 +697,7 @@ inline flt_t gSpline(KernelArgsAIREBOT * ka, int itype, flt_t cos, flt_t NCmin = ka->params.NCmin; flt_t NCmax = ka->params.NCmax; int index = 0; - flt_t * gDom = NULL; + flt_t * gDom = nullptr; int nDom = 0; int offs = 0; if (itype == 0) { @@ -921,7 +921,7 @@ inline flt_t frebo_pij(KernelArgsAIREBOT * ka, int i, int j, if (pass == 0) { sum_pij += wik * g * ex_lam; sum_dpij_dN += wik * dgdN * ex_lam; - flt_t cutN = Sp(Nki, Nmin, Nmax, NULL); + flt_t cutN = Sp(Nki, Nmin, Nmax, nullptr); *sum_N += (1 - ktype) * wik * cutN; } else { flt_t tmp = -0.5 * pij * pij * pij; @@ -1583,9 +1583,9 @@ void ref_rebo_neigh(KernelArgsAIREBOT * ka) { flt_t rcmin = ka->params.rcmin[itype][jtype]; flt_t rcmax = ka->params.rcmax[itype][jtype]; if (jtype == CARBON) - ka->nC[i] += Sp(overloaded::sqrt(rsq), rcmin, rcmax, NULL); + ka->nC[i] += Sp(overloaded::sqrt(rsq), rcmin, rcmax, nullptr); else - ka->nH[i] += Sp(overloaded::sqrt(rsq), rcmin, rcmax, NULL); + ka->nH[i] += Sp(overloaded::sqrt(rsq), rcmin, rcmax, nullptr); } } ka->neigh_rebo.num[i] = n; @@ -2408,7 +2408,7 @@ static fvec aut_mask_gSpline_pd_2(KernelArgsAIREBOT * ka, bvec /*active_mask*/, int itype, fvec cosjik, fvec Nij, fvec *dgdc, fvec *dgdN) { int i; - flt_t * gDom = NULL; + flt_t * gDom = nullptr; int nDom = 0; ivec offs = ivec::setzero(); fvec NCmin = fvec::set1(ka->params.NCmin); diff --git a/src/USER-INTEL/pair_buck_coul_cut_intel.cpp b/src/USER-INTEL/pair_buck_coul_cut_intel.cpp index a67db0ad327a8c4b35f962f7a63e66fd50552cb2..41af529cabc30895886ac84c817446676922b83a 100644 --- a/src/USER-INTEL/pair_buck_coul_cut_intel.cpp +++ b/src/USER-INTEL/pair_buck_coul_cut_intel.cpp @@ -502,8 +502,8 @@ void PairBuckCoulCutIntel::ForceConst::set_ntypes(const int ntypes, c_energy_t * oc_energy = c_energy[0]; c_cut_t * oc_cut = c_cut[0]; - if (ospecial_lj != NULL && oc_force != NULL && oc_cut != NULL && - oc_energy != NULL && ospecial_coul != NULL && + if (ospecial_lj != nullptr && oc_force != nullptr && oc_cut != nullptr && + oc_energy != nullptr && ospecial_coul != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj, ospecial_coul: alloc_if(0) free_if(1)) \ @@ -531,8 +531,8 @@ void PairBuckCoulCutIntel::ForceConst::set_ntypes(const int ntypes, c_energy_t * oc_energy = c_energy[0]; c_cut_t * oc_cut = c_cut[0]; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && oc_force != NULL && oc_cut != NULL && - oc_energy != NULL && ospecial_coul != NULL && + if (ospecial_lj != nullptr && oc_force != nullptr && oc_cut != nullptr && + oc_energy != nullptr && ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_buck_coul_cut_intel.h b/src/USER-INTEL/pair_buck_coul_cut_intel.h index 72043239035fdaec85d0f29c853470fed8be6782..4bc19ac157401cc314c85dc93dace9c278788983 100644 --- a/src/USER-INTEL/pair_buck_coul_cut_intel.h +++ b/src/USER-INTEL/pair_buck_coul_cut_intel.h @@ -72,7 +72,7 @@ class PairBuckCoulCutIntel : public PairBuckCoulCut { c_cut_t **c_cut; ForceConst() : _ntypes(0), _ntable(0) {} - ~ForceConst() { set_ntypes(0,0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,0,nullptr,_cop); } void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_buck_coul_long_intel.cpp b/src/USER-INTEL/pair_buck_coul_long_intel.cpp index d0cb1837c90ba28adf99bbe3ba6660d9e4207a2e..11ee79e5f2056c8fe896d7b156b02ccdaf9e2050 100644 --- a/src/USER-INTEL/pair_buck_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_buck_coul_long_intel.cpp @@ -617,10 +617,10 @@ void PairBuckCoulLongIntel::ForceConst::set_ntypes(const int ntypes, flt_t * odetable = detable; flt_t * octable = ctable; flt_t * odctable = dctable; - if (ospecial_lj != NULL && oc_force != NULL && orho_inv != NULL && - oc_energy != NULL && otable != NULL && oetable != NULL && - odetable != NULL && octable != NULL && odctable != NULL && - ospecial_coul != NULL && _cop >= 0) { + if (ospecial_lj != nullptr && oc_force != nullptr && orho_inv != nullptr && + oc_energy != nullptr && otable != nullptr && oetable != nullptr && + odetable != nullptr && octable != nullptr && odctable != nullptr && + ospecial_coul != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj, ospecial_coul: alloc_if(0) free_if(1)) \ nocopy(oc_force, oc_energy: alloc_if(0) free_if(1)) \ @@ -662,10 +662,10 @@ void PairBuckCoulLongIntel::ForceConst::set_ntypes(const int ntypes, flt_t * octable = ctable; flt_t * odctable = dctable; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && oc_force != NULL && orho_inv != NULL && - oc_energy != NULL && otable !=NULL && oetable != NULL && - odetable != NULL && octable != NULL && odctable != NULL && - ospecial_coul != NULL && cop >= 0) { + if (ospecial_lj != nullptr && oc_force != nullptr && orho_inv != nullptr && + oc_energy != nullptr && otable !=nullptr && oetable != nullptr && + odetable != nullptr && octable != nullptr && odctable != nullptr && + ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ nocopy(ospecial_coul: length(4) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_buck_coul_long_intel.h b/src/USER-INTEL/pair_buck_coul_long_intel.h index ec37c699c8aceee88a29cf1e3d590b127301b879..95492cd4e63e7a3d3d1792a356bbd2b56272458e 100644 --- a/src/USER-INTEL/pair_buck_coul_long_intel.h +++ b/src/USER-INTEL/pair_buck_coul_long_intel.h @@ -73,7 +73,7 @@ class PairBuckCoulLongIntel : public PairBuckCoulLong { flt_t *etable, *detable, *ctable, *dctable; ForceConst() : _ntypes(0), _ntable(0) {} - ~ForceConst() { set_ntypes(0,0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,0,nullptr,_cop); } void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_buck_intel.cpp b/src/USER-INTEL/pair_buck_intel.cpp index bb5b44d2609ad20f17b75c73dcd3d3d358175c12..b4f57d2fae14ca7b00d2b41a0f55c2989da3e62a 100644 --- a/src/USER-INTEL/pair_buck_intel.cpp +++ b/src/USER-INTEL/pair_buck_intel.cpp @@ -449,8 +449,8 @@ void PairBuckIntel::ForceConst::set_ntypes(const int ntypes, c_force_t * oc_force = c_force[0]; c_energy_t * oc_energy = c_energy[0]; - if (ospecial_lj != NULL && oc_force != NULL && - oc_energy != NULL && + if (ospecial_lj != nullptr && oc_force != nullptr && + oc_energy != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: alloc_if(0) free_if(1)) \ @@ -473,8 +473,8 @@ void PairBuckIntel::ForceConst::set_ntypes(const int ntypes, c_force_t * oc_force = c_force[0]; c_energy_t * oc_energy = c_energy[0]; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && oc_force != NULL && - oc_energy != NULL && + if (ospecial_lj != nullptr && oc_force != nullptr && + oc_energy != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_buck_intel.h b/src/USER-INTEL/pair_buck_intel.h index ab5e135262a378d89b0975376ffca91afe4ad9fc..0e473c7c3f2b979bcf2c045c4c09dde77525ace4 100644 --- a/src/USER-INTEL/pair_buck_intel.h +++ b/src/USER-INTEL/pair_buck_intel.h @@ -69,7 +69,7 @@ private: c_energy_t **c_energy; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,nullptr,_cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_dpd_intel.cpp b/src/USER-INTEL/pair_dpd_intel.cpp index 690496d5469b5919021edb340ea27597dbd6936e..40b6c891d04f7109ba60d734b217bf5c35fc2aa1 100644 --- a/src/USER-INTEL/pair_dpd_intel.cpp +++ b/src/USER-INTEL/pair_dpd_intel.cpp @@ -37,7 +37,7 @@ PairDPDIntel::PairDPDIntel(LAMMPS *lmp) : { suffix_flag |= Suffix::INTEL; respa_enable = 0; - random_thread = NULL; + random_thread = nullptr; _nrandom_thread = 0; } diff --git a/src/USER-INTEL/pair_dpd_intel.h b/src/USER-INTEL/pair_dpd_intel.h index bce90a36b69dd6f1fcd3b3d6513208c5e4d12010..409e123f291e231838ea4a94991b38ddc9503504 100644 --- a/src/USER-INTEL/pair_dpd_intel.h +++ b/src/USER-INTEL/pair_dpd_intel.h @@ -83,7 +83,7 @@ class PairDPDIntel : public PairDPD { int *rngi; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0, 0, 0, NULL, _cop); } + ~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); } void set_ntypes(const int ntypes, const int nthreads, const int max_nbors, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_eam_alloy_intel.cpp b/src/USER-INTEL/pair_eam_alloy_intel.cpp index 084714daf4bad388f364e20cb0e8b6f4d9789b6d..b78baf896f323a53fd9de17ca294e721217128d4 100644 --- a/src/USER-INTEL/pair_eam_alloy_intel.cpp +++ b/src/USER-INTEL/pair_eam_alloy_intel.cpp @@ -69,7 +69,7 @@ void PairEAMAlloyIntel::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/USER-INTEL/pair_eam_fs_intel.cpp b/src/USER-INTEL/pair_eam_fs_intel.cpp index 8786c0d782289e9000afab8fa0bb2be5d919f7b4..84cfcb8a114ee9068b2e51195d0b59fbd479a5b6 100644 --- a/src/USER-INTEL/pair_eam_fs_intel.cpp +++ b/src/USER-INTEL/pair_eam_fs_intel.cpp @@ -69,7 +69,7 @@ void PairEAMFSIntel::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/USER-INTEL/pair_eam_intel.h b/src/USER-INTEL/pair_eam_intel.h index a9590f6b3db09f1fde150a814beb7a26e987a6ce..b9ad11597a1ee0bb62274d9833c1a8f6564622b6 100644 --- a/src/USER-INTEL/pair_eam_intel.h +++ b/src/USER-INTEL/pair_eam_intel.h @@ -76,7 +76,7 @@ class PairEAMIntel : public PairEAM { fc_packed2 *z2r_spline_t; ForceConst() : _ntypes(0), _nr(0) {} - ~ForceConst() { set_ntypes(0, 0, 0, NULL, _cop); } + ~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); } void set_ntypes(const int ntypes, const int nr, const int nrho, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_gayberne_intel.cpp b/src/USER-INTEL/pair_gayberne_intel.cpp index 30e61f67b9596bc27021f2d0a875675ce9646b45..423631ae87a5ae22f75e66edb930d480093c1316 100644 --- a/src/USER-INTEL/pair_gayberne_intel.cpp +++ b/src/USER-INTEL/pair_gayberne_intel.cpp @@ -958,7 +958,7 @@ void PairGayBerneIntel::pack_force_const(ForceConst &fc, FC_PACKED2_T *olj34 = fc.lj34[0]; FC_PACKED3_T *oic = fc.ic; int tp1sq = tp1 * tp1; - if (oijc != NULL && oic != NULL) { + if (oijc != nullptr && oic != nullptr) { #pragma offload_transfer target(mic:_cop) \ in(special_lj: length(4) alloc_if(0) free_if(0)) \ in(oijc,olj34: length(tp1sq) alloc_if(0) free_if(0)) \ @@ -990,9 +990,9 @@ void PairGayBerneIntel::ForceConst::set_ntypes(const int ntypes, int * ojtype_form = jtype_form[0]; int * ojlist_form = jlist_form[0]; - if (ospecial_lj != NULL && oijc != NULL && olj34 != NULL && - orsq_form != NULL && odelx_form != NULL && odely_form != NULL && - odelz_form != NULL && ojtype_form != NULL && ojlist_form != NULL && + if (ospecial_lj != nullptr && oijc != nullptr && olj34 != nullptr && + orsq_form != nullptr && odelx_form != nullptr && odely_form != nullptr && + odelz_form != nullptr && ojtype_form != nullptr && ojlist_form != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:_cop) \ nocopy(ospecial_lj, oijc, olj34, oic: alloc_if(0) free_if(1)) \ @@ -1048,10 +1048,10 @@ void PairGayBerneIntel::ForceConst::set_ntypes(const int ntypes, int off_onel = one_length * nthreads; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && oijc != NULL && olj34 != NULL && - oic != NULL && orsq_form != NULL && odelx_form != NULL && - odely_form != NULL && odelz_form != NULL && ojtype_form !=NULL && - ojlist_form !=NULL && cop >= 0) { + if (ospecial_lj != nullptr && oijc != nullptr && olj34 != nullptr && + oic != nullptr && orsq_form != nullptr && odelx_form != nullptr && + odely_form != nullptr && odelz_form != nullptr && ojtype_form !=nullptr && + ojlist_form !=nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ nocopy(oijc,olj34: length(tp1sq) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_gayberne_intel.h b/src/USER-INTEL/pair_gayberne_intel.h index 07dfba14d113e279bebe240058908b71db39139d..ecdd93d353d62bb2063dfc0c028e136a78892b2d 100644 --- a/src/USER-INTEL/pair_gayberne_intel.h +++ b/src/USER-INTEL/pair_gayberne_intel.h @@ -74,7 +74,7 @@ class PairGayBerneIntel : public PairGayBerne { int **jtype_form, **jlist_form; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0, 0, 0, NULL, _cop); } + ~ForceConst() { set_ntypes(0, 0, 0, nullptr, _cop); } void set_ntypes(const int ntypes, const int one_length, const int nthreads, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp b/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp index c8e4a3d0efaedbce0b77e76af36d0745d83ebf2c..71f2e2455725a6c27ce4965cc66437a3fa318dc3 100644 --- a/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp +++ b/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.cpp @@ -555,8 +555,8 @@ void PairLJCharmmCoulCharmmIntel::ForceConst::set_ntypes( flt_t * ospecial_coul = special_coul; flt_t * ocutsq = cutsq[0]; typename IntelBuffers::vec4_t * olj = lj[0]; - if (ospecial_lj != NULL && ocutsq != NULL && olj != NULL && - ospecial_coul != NULL && cop >= 0) { + if (ospecial_lj != nullptr && ocutsq != nullptr && olj != nullptr && + ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj, ospecial_coul: alloc_if(0) free_if(1)) \ nocopy(ocutsq, olj: alloc_if(0) free_if(1)) @@ -577,8 +577,8 @@ void PairLJCharmmCoulCharmmIntel::ForceConst::set_ntypes( flt_t * ocutsq = cutsq[0]; typename IntelBuffers::vec4_t * olj = lj[0]; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && ocutsq != NULL && olj != NULL && - ospecial_coul != NULL && cop >= 0) { + if (ospecial_lj != nullptr && ocutsq != nullptr && olj != nullptr && + ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ nocopy(ospecial_coul: length(4) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.h b/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.h index a48a84b5ceaa8eae15979376157c35e5083867e2..006dbaade2a6f4c426612b530581d6f9baf67211 100644 --- a/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.h +++ b/src/USER-INTEL/pair_lj_charmm_coul_charmm_intel.h @@ -69,7 +69,7 @@ class PairLJCharmmCoulCharmmIntel : public PairLJCharmmCoulCharmm { typename IntelBuffers::vec4_t **lj; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,nullptr,_cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp b/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp index 5a4069e1991847bdf8eaaf954818d31bcce448b8..8f106d8607de07d2fc991b42b15dbaa522437ee8 100644 --- a/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_lj_charmm_coul_long_intel.cpp @@ -38,7 +38,7 @@ PairLJCharmmCoulLongIntel::PairLJCharmmCoulLongIntel(LAMMPS *lmp) : { suffix_flag |= Suffix::INTEL; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -652,9 +652,9 @@ void PairLJCharmmCoulLongIntel::ForceConst::set_ntypes(const int ntypes, flt_t * odetable = detable; flt_t * octable = ctable; flt_t * odctable = dctable; - if (ospecial_lj != NULL && ocutsq != NULL && olj != NULL && - otable != NULL && oetable != NULL && odetable != NULL && - octable != NULL && odctable != NULL && ospecial_coul != NULL && + if (ospecial_lj != nullptr && ocutsq != nullptr && olj != nullptr && + otable != nullptr && oetable != nullptr && odetable != nullptr && + octable != nullptr && odctable != nullptr && ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj, ospecial_coul: alloc_if(0) free_if(1)) \ @@ -693,9 +693,9 @@ void PairLJCharmmCoulLongIntel::ForceConst::set_ntypes(const int ntypes, flt_t * octable = ctable; flt_t * odctable = dctable; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && ocutsq != NULL && olj != NULL && - otable !=NULL && oetable != NULL && odetable != NULL && - octable != NULL && odctable != NULL && ospecial_coul != NULL && + if (ospecial_lj != nullptr && ocutsq != nullptr && olj != nullptr && + otable !=nullptr && oetable != nullptr && odetable != nullptr && + octable != nullptr && odctable != nullptr && ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_lj_charmm_coul_long_intel.h b/src/USER-INTEL/pair_lj_charmm_coul_long_intel.h index 31b2182cb5deeb5557a62a22324c3f9f0f9609e5..f5b46eaf76203eb25bf8db5a425dda37d4a734c6 100644 --- a/src/USER-INTEL/pair_lj_charmm_coul_long_intel.h +++ b/src/USER-INTEL/pair_lj_charmm_coul_long_intel.h @@ -72,7 +72,7 @@ class PairLJCharmmCoulLongIntel : public PairLJCharmmCoulLong { typename IntelBuffers::vec2_t **lj; ForceConst() : _ntypes(0), _ntable(0) {} - ~ForceConst() { set_ntypes(0,0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,0,nullptr,_cop); } void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp b/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp index 34ab97fd35747863368988fb58d90748714353d4..ead3d5b5b43edcd570a0e50585118f3de6c26522 100644 --- a/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_lj_cut_coul_long_intel.cpp @@ -40,7 +40,7 @@ PairLJCutCoulLongIntel::PairLJCutCoulLongIntel(LAMMPS *lmp) : { suffix_flag |= Suffix::INTEL; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -611,10 +611,10 @@ void PairLJCutCoulLongIntel::ForceConst::set_ntypes(const int ntypes, flt_t * odetable = detable; flt_t * octable = ctable; flt_t * odctable = dctable; - if (ospecial_lj != NULL && oc_force != NULL && - oc_energy != NULL && otable != NULL && oetable != NULL && - odetable != NULL && octable != NULL && odctable != NULL && - ospecial_coul != NULL && _cop >= 0) { + if (ospecial_lj != nullptr && oc_force != nullptr && + oc_energy != nullptr && otable != nullptr && oetable != nullptr && + odetable != nullptr && octable != nullptr && odctable != nullptr && + ospecial_coul != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj, ospecial_coul: alloc_if(0) free_if(1)) \ nocopy(oc_force, oc_energy: alloc_if(0) free_if(1)) \ @@ -652,10 +652,10 @@ void PairLJCutCoulLongIntel::ForceConst::set_ntypes(const int ntypes, flt_t * octable = ctable; flt_t * odctable = dctable; int tp1sq = ntypes*ntypes; - if (ospecial_lj != NULL && oc_force != NULL && - oc_energy != NULL && otable !=NULL && oetable != NULL && - odetable != NULL && octable != NULL && odctable != NULL && - ospecial_coul != NULL && cop >= 0) { + if (ospecial_lj != nullptr && oc_force != nullptr && + oc_energy != nullptr && otable !=nullptr && oetable != nullptr && + odetable != nullptr && octable != nullptr && odctable != nullptr && + ospecial_coul != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(ospecial_lj: length(4) alloc_if(1) free_if(0)) \ nocopy(ospecial_coul: length(4) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_lj_cut_coul_long_intel.h b/src/USER-INTEL/pair_lj_cut_coul_long_intel.h index 288a6a7bc4938aa710c3a036f5568e94964bccab..6172313639cf715b68fce0fc9661fb06cb0e10d5 100644 --- a/src/USER-INTEL/pair_lj_cut_coul_long_intel.h +++ b/src/USER-INTEL/pair_lj_cut_coul_long_intel.h @@ -73,7 +73,7 @@ class PairLJCutCoulLongIntel : public PairLJCutCoulLong { flt_t *etable, *detable, *ctable, *dctable; ForceConst() : _ntypes(0), _ntable(0) {} - ~ForceConst() { set_ntypes(0,0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,0,nullptr,_cop); } void set_ntypes(const int ntypes, const int ntable, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_lj_cut_intel.cpp b/src/USER-INTEL/pair_lj_cut_intel.cpp index b484cb68d910b8a1573a2c598f58ecb2afbe4967..281eef52dbc379107c0844e263193c889df2fff1 100644 --- a/src/USER-INTEL/pair_lj_cut_intel.cpp +++ b/src/USER-INTEL/pair_lj_cut_intel.cpp @@ -36,7 +36,7 @@ PairLJCutIntel::PairLJCutIntel(LAMMPS *lmp) : { suffix_flag |= Suffix::INTEL; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-INTEL/pair_lj_cut_intel.h b/src/USER-INTEL/pair_lj_cut_intel.h index b577a046580dc0351e2071c4adb16a15739be493..b88d2132110037dfe865f41c8c78fee5f74af704 100644 --- a/src/USER-INTEL/pair_lj_cut_intel.h +++ b/src/USER-INTEL/pair_lj_cut_intel.h @@ -67,7 +67,7 @@ class PairLJCutIntel : public PairLJCut { fc_packed2 **lj34; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0, NULL, _cop); } + ~ForceConst() { set_ntypes(0, nullptr, _cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_lj_long_coul_long_intel.cpp b/src/USER-INTEL/pair_lj_long_coul_long_intel.cpp index 533252d018d674f7b7136a78bf2c125d1e699be8..ccde2d3a57ddabd574abf465f2c06909d2826651 100644 --- a/src/USER-INTEL/pair_lj_long_coul_long_intel.cpp +++ b/src/USER-INTEL/pair_lj_long_coul_long_intel.cpp @@ -36,7 +36,7 @@ PairLJLongCoulLongIntel::PairLJLongCoulLongIntel(LAMMPS *lmp) : { suffix_flag |= Suffix::INTEL; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } diff --git a/src/USER-INTEL/pair_sw_intel.cpp b/src/USER-INTEL/pair_sw_intel.cpp index 4ec2af40b00b21ac2a714b9e46c508e52f8fd568..d2a481a76ed31d357fa6ef2041a17d209351ea78 100644 --- a/src/USER-INTEL/pair_sw_intel.cpp +++ b/src/USER-INTEL/pair_sw_intel.cpp @@ -1277,8 +1277,8 @@ void PairSWIntel::ForceConst::set_ntypes(const int ntypes, fc_packed3 *op3 = p3[0][0]; #ifdef _LMP_INTEL_OFFLOAD - if (op2 != NULL && op2f != NULL && op2f2 != NULL && op2e != NULL && - op3 != NULL && _cop >= 0) { + if (op2 != nullptr && op2f != nullptr && op2f2 != nullptr && op2e != nullptr && + op3 != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:_cop) \ nocopy(op2, op2f, op2f2, op2e, op3: alloc_if(0) free_if(1)) } @@ -1306,8 +1306,8 @@ void PairSWIntel::ForceConst::set_ntypes(const int ntypes, fc_packed3 *op3 = p3[0][0]; int tp1sq = ntypes * ntypes; int tp1cu = tp1sq * ntypes; - if (op2 != NULL && op2f != NULL && op2f2 != NULL && op2e != NULL && - op3 != NULL && cop >= 0) { + if (op2 != nullptr && op2f != nullptr && op2f2 != nullptr && op2e != nullptr && + op3 != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(op2,op2f,op2f2,op2e: length(tp1sq) alloc_if(1) free_if(0)) \ nocopy(op3: length(tp1cu) alloc_if(1) free_if(0)) diff --git a/src/USER-INTEL/pair_sw_intel.h b/src/USER-INTEL/pair_sw_intel.h index 5f7a511c9fadd3862339ba3c058de3868a479251..f345b3d4ff43a6d591e97b4db07e242c64149749 100644 --- a/src/USER-INTEL/pair_sw_intel.h +++ b/src/USER-INTEL/pair_sw_intel.h @@ -88,7 +88,7 @@ class PairSWIntel : public PairSW { fc_packed3 ***p3; ForceConst() : p2(0), p2f(0), p2f2(0), p2e(0), p3(0), _ntypes(0) {} - ~ForceConst() { set_ntypes(0, NULL, _cop); } + ~ForceConst() { set_ntypes(0, nullptr, _cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pair_tersoff_intel.cpp b/src/USER-INTEL/pair_tersoff_intel.cpp index 75f5f85f2dcbff87f873f7e38eddb4d40857ead1..db24692b6df3998d4b9d037fdf3718db178d101b 100644 --- a/src/USER-INTEL/pair_tersoff_intel.cpp +++ b/src/USER-INTEL/pair_tersoff_intel.cpp @@ -576,8 +576,8 @@ void PairTersoffIntel::ForceConst::set_ntypes(const int ntypes, c_cutoff_t * oc_cutoff_outer = c_cutoff_outer[0]; c_inner_t * oc_inner = c_inner[0][0]; c_outer_t * oc_outer = c_outer[0]; - if (c_first_loop != NULL && c_second_loop != NULL && - c_inner_loop != NULL && _cop >= 0) { + if (c_first_loop != nullptr && c_second_loop != nullptr && + c_inner_loop != nullptr && _cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(oc_first_loop, oc_second_loop, oc_inner_loop: alloc_if(0) free_if(1)) \ @@ -615,8 +615,8 @@ void PairTersoffIntel::ForceConst::set_ntypes(const int ntypes, int tp1sq = ntypes * ntypes; int tp1cb = ntypes * ntypes * ntypes; int tp1cb_pad = ntypes * ntypes * ntypes_pad; - if (oc_first_loop != NULL && oc_second_loop != NULL && - oc_inner_loop != NULL && cop >= 0) { + if (oc_first_loop != nullptr && oc_second_loop != nullptr && + oc_inner_loop != nullptr && cop >= 0) { #pragma offload_transfer target(mic:cop) \ nocopy(oc_first_loop: length(tp1sq) alloc_if(1) free_if(0)) \ nocopy(oc_second_loop: length(tp1sq) alloc_if(1) free_if(0)) \ diff --git a/src/USER-INTEL/pair_tersoff_intel.h b/src/USER-INTEL/pair_tersoff_intel.h index 6da478c10faa59786daeba33b4261d2cb2dc8591..195efa74de6b6151c4fbfaff428cda98fe6fe4a7 100644 --- a/src/USER-INTEL/pair_tersoff_intel.h +++ b/src/USER-INTEL/pair_tersoff_intel.h @@ -65,7 +65,7 @@ class PairTersoffIntel : public PairTersoff { c_outer_t * * c_outer; c_inner_t * * * c_inner; ForceConst() : _ntypes(0) {} - ~ForceConst() { set_ntypes(0,NULL,_cop); } + ~ForceConst() { set_ntypes(0,nullptr,_cop); } void set_ntypes(const int ntypes, Memory *memory, const int cop); diff --git a/src/USER-INTEL/pppm_disp_intel.cpp b/src/USER-INTEL/pppm_disp_intel.cpp index 1149c9b2c35753d536b756f8e275175f75076a43..8e958bf23b6c322b8e3f6c0050755fdd8c14c9b6 100644 --- a/src/USER-INTEL/pppm_disp_intel.cpp +++ b/src/USER-INTEL/pppm_disp_intel.cpp @@ -68,18 +68,18 @@ PPPMDispIntel::PPPMDispIntel(LAMMPS *lmp) : PPPMDisp(lmp) order = 7; order_6 = 7; //sets default stencil sizes to 7 - perthread_density = NULL; - particle_ekx = particle_eky = particle_ekz = NULL; - particle_ekx0 = particle_eky0 = particle_ekz0 = NULL; - particle_ekx1 = particle_eky1 = particle_ekz1 = NULL; - particle_ekx2 = particle_eky2 = particle_ekz2 = NULL; - particle_ekx3 = particle_eky3 = particle_ekz3 = NULL; - particle_ekx4 = particle_eky4 = particle_ekz4 = NULL; - particle_ekx5 = particle_eky5 = particle_ekz5 = NULL; - particle_ekx6 = particle_eky6 = particle_ekz6 = NULL; - - rho_lookup = drho_lookup = NULL; - rho6_lookup = drho6_lookup = NULL; + perthread_density = nullptr; + particle_ekx = particle_eky = particle_ekz = nullptr; + particle_ekx0 = particle_eky0 = particle_ekz0 = nullptr; + particle_ekx1 = particle_eky1 = particle_ekz1 = nullptr; + particle_ekx2 = particle_eky2 = particle_ekz2 = nullptr; + particle_ekx3 = particle_eky3 = particle_ekz3 = nullptr; + particle_ekx4 = particle_eky4 = particle_ekz4 = nullptr; + particle_ekx5 = particle_eky5 = particle_ekz5 = nullptr; + particle_ekx6 = particle_eky6 = particle_ekz6 = nullptr; + + rho_lookup = drho_lookup = nullptr; + rho6_lookup = drho6_lookup = nullptr; rho_points = 0; _use_table = _use_packing = _use_lrt = 0; diff --git a/src/USER-INTEL/pppm_intel.cpp b/src/USER-INTEL/pppm_intel.cpp index d596df44900541f20b26ebc87d2ed6001cfec960..1a09522a2a26b51edd8111e0580dd0628719ca1d 100644 --- a/src/USER-INTEL/pppm_intel.cpp +++ b/src/USER-INTEL/pppm_intel.cpp @@ -65,10 +65,10 @@ PPPMIntel::PPPMIntel(LAMMPS *lmp) : PPPM(lmp) order = 7; //sets default stencil size to 7 - perthread_density = NULL; - particle_ekx = particle_eky = particle_ekz = NULL; + perthread_density = nullptr; + particle_ekx = particle_eky = particle_ekz = nullptr; - rho_lookup = drho_lookup = NULL; + rho_lookup = drho_lookup = nullptr; rho_points = 0; _use_table = _use_lrt = 0; diff --git a/src/USER-INTEL/verlet_lrt_intel.cpp b/src/USER-INTEL/verlet_lrt_intel.cpp index cad9a09ddaccd4a9e7405445cf32d10fcd6442bb..6b55b92fefb9fb24b6f1f65e7685094bf36a2f20 100644 --- a/src/USER-INTEL/verlet_lrt_intel.cpp +++ b/src/USER-INTEL/verlet_lrt_intel.cpp @@ -45,7 +45,7 @@ using namespace LAMMPS_NS; VerletLRTIntel::VerletLRTIntel(LAMMPS *lmp, int narg, char **arg) : Verlet(lmp, narg, arg) { #if defined(_LMP_INTEL_LRT_PTHREAD) - pthread_mutex_init(&_kmutex,NULL); + pthread_mutex_init(&_kmutex,nullptr); #endif } @@ -119,7 +119,7 @@ void VerletLRTIntel::setup(int flag) _kspace_ready = 0; _kspace_done = 0; - pthread_cond_init(&_kcond, NULL); + pthread_cond_init(&_kcond, nullptr); pthread_attr_init(&_kspace_attr); pthread_attr_setdetachstate(&_kspace_attr, PTHREAD_CREATE_JOINABLE); #endif @@ -377,7 +377,7 @@ void VerletLRTIntel::run(int n) _kspace_done = 0; pthread_cond_signal(&_kcond); pthread_mutex_unlock(&_kmutex); - pthread_join(_kspace_thread, NULL); + pthread_join(_kspace_thread, nullptr); pthread_attr_destroy(&_kspace_attr); } #endif @@ -428,8 +428,8 @@ void * VerletLRTIntel::k_launch_loop(void *context) pthread_mutex_unlock(&(c->_kmutex)); } - pthread_exit(NULL); - return NULL; + pthread_exit(nullptr); + return nullptr; } #endif diff --git a/src/USER-LB/fix_lb_fluid.cpp b/src/USER-LB/fix_lb_fluid.cpp index 22188bb938cba96c6b526ea3412a9ab3a565ee31..ce51757c68ad0635e8bc97b5a81ceec5956b7861 100644 --- a/src/USER-LB/fix_lb_fluid.cpp +++ b/src/USER-LB/fix_lb_fluid.cpp @@ -116,8 +116,8 @@ FixLbFluid::FixLbFluid(LAMMPS *lmp, int narg, char **arg) : setArea = 0; numvel = 15; - Gamma = NULL; - NodeArea = NULL; + Gamma = nullptr; + NodeArea = nullptr; int iarg = 7; while (iarg < narg){ @@ -129,7 +129,7 @@ FixLbFluid::FixLbFluid(LAMMPS *lmp, int narg, char **arg) : double areafactor = atof(arg[iarg+2]); if(itype <= 0 || itype > atom->ntypes || areafactor < 0.0) error->all(FLERR,"Illegal fix lb/fluid command: setArea"); - if(NodeArea == NULL){ + if(NodeArea == nullptr){ NodeArea = new double[atom->ntypes+1]; for(int i=0; i<=atom->ntypes; i++) NodeArea[i] = -1.0; } @@ -142,7 +142,7 @@ FixLbFluid::FixLbFluid(LAMMPS *lmp, int narg, char **arg) : setGamma = 1; double Gammaone; Gammaone = atof(arg[iarg+1]); - if(Gamma == NULL) + if(Gamma == nullptr) Gamma = new double[atom->ntypes+1]; for(int i=0; i<=atom->ntypes; i++) Gamma[i] = Gammaone; iarg += 2; @@ -240,7 +240,7 @@ a z wall velocity without implementing fixed BCs in z"); // perform initial allocation of atom-based array register // with Atom class //-------------------------------------------------------------------------- - hydroF = NULL; + hydroF = nullptr; grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); @@ -248,24 +248,24 @@ a z wall velocity without implementing fixed BCs in z"); for(int j=0; j<3; j++) hydroF[i][j] = 0.0; - Ng_lb = NULL; - w_lb = NULL; - mg_lb = NULL; - e = NULL; - feq = NULL; - feqold = NULL; - feqn = NULL; - feqoldn = NULL; - f_lb = NULL; - fnew = NULL; - density_lb = NULL; - u_lb = NULL; - altogether = NULL; - buf = NULL; - Ff = NULL; - Fftempx = NULL; - Fftempy = NULL; - Fftempz = NULL; + Ng_lb = nullptr; + w_lb = nullptr; + mg_lb = nullptr; + e = nullptr; + feq = nullptr; + feqold = nullptr; + feqn = nullptr; + feqoldn = nullptr; + f_lb = nullptr; + fnew = nullptr; + density_lb = nullptr; + u_lb = nullptr; + altogether = nullptr; + buf = nullptr; + Ff = nullptr; + Fftempx = nullptr; + Fftempy = nullptr; + Fftempz = nullptr; //-------------------------------------------------------------------------- // Set the lattice Boltzmann dt. diff --git a/src/USER-LB/fix_lb_pc.cpp b/src/USER-LB/fix_lb_pc.cpp index 4a4fd34400c88e7fd0463ea9fe7baafd9aa71ed9..0b45770cebd9dfd36ddd76afa4bb5942bd617295 100644 --- a/src/USER-LB/fix_lb_pc.cpp +++ b/src/USER-LB/fix_lb_pc.cpp @@ -45,9 +45,9 @@ FixLbPC::FixLbPC(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based array // register with Atom class - force_old = NULL; - up = NULL; - up_old = NULL; + force_old = nullptr; + up = nullptr; + up_old = nullptr; grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); diff --git a/src/USER-LB/fix_lb_rigid_pc_sphere.cpp b/src/USER-LB/fix_lb_rigid_pc_sphere.cpp index 09eac47865be0ca21891ea81ad4b3aa9ad0ca322..b0edbc63f37e97566f900480e4cd4f9968e59c5c 100644 --- a/src/USER-LB/fix_lb_rigid_pc_sphere.cpp +++ b/src/USER-LB/fix_lb_rigid_pc_sphere.cpp @@ -54,8 +54,8 @@ FixLbRigidPCSphere::FixLbRigidPCSphere(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - body = NULL; - up = NULL; + body = nullptr; + up = nullptr; grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); diff --git a/src/USER-LB/fix_lb_viscous.cpp b/src/USER-LB/fix_lb_viscous.cpp index 59fddebd6751093034ccb91bdda992526556322c..602ec29f00c75cb453ae64dc0a8d80efa1aaa94f 100644 --- a/src/USER-LB/fix_lb_viscous.cpp +++ b/src/USER-LB/fix_lb_viscous.cpp @@ -88,7 +88,7 @@ void FixLbViscous::init() void FixLbViscous::setup(int vflag) { - if (strstr(update->integrate_style,"verlet") != NULL) + if (strstr(update->integrate_style,"verlet") != nullptr) post_force(vflag); else { ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); diff --git a/src/USER-MANIFOLD/fix_manifoldforce.cpp b/src/USER-MANIFOLD/fix_manifoldforce.cpp index 732ba0909e3d58fc024831c26e2569e9b12d5184..3193b23d6e2a2a51a45acb92173d0075c36e4019 100644 --- a/src/USER-MANIFOLD/fix_manifoldforce.cpp +++ b/src/USER-MANIFOLD/fix_manifoldforce.cpp @@ -76,7 +76,7 @@ FixManifoldForce::FixManifoldForce(LAMMPS *lmp, int narg, char **arg) : } ptr_m->params = new double[nvars]; - if (ptr_m->params == NULL) { + if (ptr_m->params == nullptr) { error->all(FLERR,"Parameter pointer was NULL!"); } diff --git a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp index b3122a68d4036d380b1833ee0ba11cc5d8a03dd1..abe903125b596b0a953c62f5925297fbb9e31a8d 100644 --- a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp +++ b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp @@ -129,7 +129,7 @@ FixNVEManifoldRattle::FixNVEManifoldRattle( LAMMPS *lmp, int &narg, char **arg, is_var[i] = 0; } tstrs[i] = new char[len]; - if (tstrs[i] == NULL ) error->all(FLERR,"Error allocating space for args."); + if (tstrs[i] == nullptr ) error->all(FLERR,"Error allocating space for args."); strcpy( tstrs[i], arg[i+6] + offset ); } diff --git a/src/USER-MANIFOLD/fix_nve_manifold_rattle.h b/src/USER-MANIFOLD/fix_nve_manifold_rattle.h index 42da240abcebd23da9a06622ef87e7ad62cadb53..7ed1f75fa8307c00a6d0c150ac4c0c2a8718757f 100644 --- a/src/USER-MANIFOLD/fix_nve_manifold_rattle.h +++ b/src/USER-MANIFOLD/fix_nve_manifold_rattle.h @@ -125,7 +125,7 @@ E: There is no manifold named ... Self-explanatory. You requested a manifold whose name was not registered at the factory. -E: Manifold pointer was NULL for some reason! +E: Manifold pointer was nullptr for some reason! This indicates a bug. The factory was unable to properly create the requested manifold even though it was registered. Send the @@ -136,7 +136,7 @@ E: Manifold ... needs at least ... argument(s)! Self-explanatory. Provide enough arguments for the proper creating of the requested manifold. -E: Parameter pointer was NULL! +E: Parameter pointer was nullptr! This indicates a bug. The array that contains the parameters could not be allocated. Send the maintainer an e-mail. diff --git a/src/USER-MANIFOLD/fix_nvt_manifold_rattle.h b/src/USER-MANIFOLD/fix_nvt_manifold_rattle.h index f42902f7210cc3782cb46732be72543fb0d9c587..69e4eb13e186548da6490cc9f2c22116332fa205 100644 --- a/src/USER-MANIFOLD/fix_nvt_manifold_rattle.h +++ b/src/USER-MANIFOLD/fix_nvt_manifold_rattle.h @@ -112,7 +112,7 @@ E: There is no manifold named ... Self-explanatory. You requested a manifold whose name was not registered at the factory. -E: Manifold pointer was NULL for some reason! +E: Manifold pointer was nullptr for some reason! This indicates a bug. The factory was unable to properly create the requested manifold even though it was registered. Send the @@ -123,7 +123,7 @@ E: Manifold ... needs at least ... argument(s)! Self-explanatory. Provide enough arguments for the proper creating of the requested manifold. -E: Parameter pointer was NULL! +E: Parameter pointer was nullptr! This indicates a bug. The array that contains the parameters could not be allocated. Send the maintainer an e-mail. diff --git a/src/USER-MANIFOLD/manifold.h b/src/USER-MANIFOLD/manifold.h index b0727c346d5efb70272b3493d8ef5ea746108aa3..9adf7055c76def5d49ddcdb8a448d26b8ffbce37 100644 --- a/src/USER-MANIFOLD/manifold.h +++ b/src/USER-MANIFOLD/manifold.h @@ -46,7 +46,7 @@ namespace user_manifold { // Abstract base class. class manifold : protected Pointers { public: - manifold(class LAMMPS* lmp) : Pointers(lmp), params(NULL){ } + manifold(class LAMMPS* lmp) : Pointers(lmp), params(nullptr){ } virtual ~manifold(){ delete[] params; } virtual double g( const double * ) = 0; virtual void n( const double *, double * ) = 0; diff --git a/src/USER-MANIFOLD/manifold_factory.cpp b/src/USER-MANIFOLD/manifold_factory.cpp index 7df3e52ed7dec618063bfabec7c57460b72379ba..fe9b7615b3746014781e9236cf211b9c0e552c7a 100644 --- a/src/USER-MANIFOLD/manifold_factory.cpp +++ b/src/USER-MANIFOLD/manifold_factory.cpp @@ -54,7 +54,7 @@ manifold* LAMMPS_NS::user_manifold::create_manifold(const char *mname, LAMMPS *lmp, int narg, char **arg ) { - manifold *man = NULL; + manifold *man = nullptr; make_manifold_if ( &man, mname, lmp, narg, arg ); make_manifold_if ( &man, mname, lmp, narg, arg ); make_manifold_if ( &man, mname, lmp, narg, arg ); diff --git a/src/USER-MANIFOLD/manifold_factory.h b/src/USER-MANIFOLD/manifold_factory.h index 85ee4011be20d971250faad0bff7c8dcd192ab0b..1eac8bf6441d6493e67799b9ec5adfb7e1271194 100644 --- a/src/USER-MANIFOLD/manifold_factory.h +++ b/src/USER-MANIFOLD/manifold_factory.h @@ -94,7 +94,7 @@ class manifold; LAMMPS *lmp, int narg, char **arg ) { if( strcmp( m_type::type(), name ) == 0 ){ - if( *man_ptr == NULL ){ + if( *man_ptr == nullptr ){ *man_ptr = new m_type(lmp, narg, arg); } } diff --git a/src/USER-MANIFOLD/manifold_gaussian_bump.cpp b/src/USER-MANIFOLD/manifold_gaussian_bump.cpp index ef269992950e8ea49fbc34a66b05621c4eb8f0da..7b0d7d4d3a8900d03ea8571b9e3ed53c5213246e 100644 --- a/src/USER-MANIFOLD/manifold_gaussian_bump.cpp +++ b/src/USER-MANIFOLD/manifold_gaussian_bump.cpp @@ -136,7 +136,7 @@ public: // Manifold itself: manifold_gaussian_bump::manifold_gaussian_bump(class LAMMPS* lmp, int /*narg*/, char **/*arg*/) - : manifold(lmp), lut_z(NULL), lut_zp(NULL) {} + : manifold(lmp), lut_z(nullptr), lut_zp(nullptr) {} manifold_gaussian_bump::~manifold_gaussian_bump() diff --git a/src/USER-MANIFOLD/manifold_thylakoid.cpp b/src/USER-MANIFOLD/manifold_thylakoid.cpp index ee86a50bf2f30e5bdcafea76a78dbdb2506ae001..a1d2c7a62f6b34a756fb33b0287dd4907b377ac5 100644 --- a/src/USER-MANIFOLD/manifold_thylakoid.cpp +++ b/src/USER-MANIFOLD/manifold_thylakoid.cpp @@ -123,14 +123,14 @@ thyla_part *manifold_thylakoid::get_thyla_part( const double *x, int * /*err_fla for( std::size_t i = 0; i < parts.size(); ++i ){ thyla_part *p = parts[i]; if (is_in_domain(p,x)) { - if (idx != NULL) *idx = i; + if (idx != nullptr) *idx = i; return p; } } char msg[2048]; sprintf(msg,"Could not find thyla_part for x = (%f,%f,%f)", x[0],x[1],x[2]); error->one(FLERR,msg); - return NULL; + return nullptr; } diff --git a/src/USER-MANIFOLD/manifold_thylakoid.h b/src/USER-MANIFOLD/manifold_thylakoid.h index 35ad4dfd9c9881b76adcebcf7e6c44472c0e4aeb..d3ffa6776568b08ec7059a9d02d401e61d2916c2 100644 --- a/src/USER-MANIFOLD/manifold_thylakoid.h +++ b/src/USER-MANIFOLD/manifold_thylakoid.h @@ -29,7 +29,7 @@ namespace user_manifold { private: void init_domains(); - thyla_part *get_thyla_part( const double *x, int *err_flag, std::size_t *idx = NULL ); + thyla_part *get_thyla_part( const double *x, int *err_flag, std::size_t *idx = nullptr ); int is_in_domain( thyla_part *p, const double *x ); void check_overlap(); std::vector parts; diff --git a/src/USER-MEAMC/meam_impl.cpp b/src/USER-MEAMC/meam_impl.cpp index a546aa0c7f1498c5cae0379cf0c667342939b544..147be9246364eb6c873d5571bfa662a0301d258a 100644 --- a/src/USER-MEAMC/meam_impl.cpp +++ b/src/USER-MEAMC/meam_impl.cpp @@ -28,15 +28,15 @@ using namespace LAMMPS_NS; MEAM::MEAM(Memory* mem) : memory(mem) { - phir = phirar = phirar1 = phirar2 = phirar3 = phirar4 = phirar5 = phirar6 = NULL; + phir = phirar = phirar1 = phirar2 = phirar3 = phirar4 = phirar5 = phirar6 = nullptr; nmax = 0; - rho = rho0 = rho1 = rho2 = rho3 = frhop = NULL; - gamma = dgamma1 = dgamma2 = dgamma3 = arho2b = NULL; - arho1 = arho2 = arho3 = arho3b = t_ave = tsq_ave = NULL; + rho = rho0 = rho1 = rho2 = rho3 = frhop = nullptr; + gamma = dgamma1 = dgamma2 = dgamma3 = arho2b = nullptr; + arho1 = arho2 = arho3 = arho3b = t_ave = tsq_ave = nullptr; maxneigh = 0; - scrfcn = dscrfcn = fcpair = NULL; + scrfcn = dscrfcn = fcpair = nullptr; neltypes = 0; for (int i = 0; i < maxelt; i++) { diff --git a/src/USER-MEAMC/meam_setup_done.cpp b/src/USER-MEAMC/meam_setup_done.cpp index ddbb40310c7af08bb39c12e61f647f23f8184e4e..f8703f10e582369c92a860f71d1c6ae73d231f2f 100644 --- a/src/USER-MEAMC/meam_setup_done.cpp +++ b/src/USER-MEAMC/meam_setup_done.cpp @@ -186,21 +186,21 @@ MEAM::compute_pair_meam(void) double C, s111, s112, s221, S11, S22; // check for previously allocated arrays and free them - if (this->phir != NULL) + if (this->phir != nullptr) memory->destroy(this->phir); - if (this->phirar != NULL) + if (this->phirar != nullptr) memory->destroy(this->phirar); - if (this->phirar1 != NULL) + if (this->phirar1 != nullptr) memory->destroy(this->phirar1); - if (this->phirar2 != NULL) + if (this->phirar2 != nullptr) memory->destroy(this->phirar2); - if (this->phirar3 != NULL) + if (this->phirar3 != nullptr) memory->destroy(this->phirar3); - if (this->phirar4 != NULL) + if (this->phirar4 != nullptr) memory->destroy(this->phirar4); - if (this->phirar5 != NULL) + if (this->phirar5 != nullptr) memory->destroy(this->phirar5); - if (this->phirar6 != NULL) + if (this->phirar6 != nullptr) memory->destroy(this->phirar6); // allocate memory for array that defines the potential diff --git a/src/USER-MEAMC/pair_meamc.cpp b/src/USER-MEAMC/pair_meamc.cpp index 6f674c9f4526c458a80b76bcbec6b94fae41a26d..4c4a3dcf6242054c24022c1a01fb9e9bee704eb0 100644 --- a/src/USER-MEAMC/pair_meamc.cpp +++ b/src/USER-MEAMC/pair_meamc.cpp @@ -56,10 +56,10 @@ PairMEAMC::PairMEAMC(LAMMPS *lmp) : Pair(lmp) allocated = 0; nelements = 0; - elements = NULL; - mass = NULL; + elements = nullptr; + mass = nullptr; meam_inst = new MEAM(memory); - scale = NULL; + scale = nullptr; // set comm size needed by this Pair @@ -161,7 +161,7 @@ void PairMEAMC::compute(int eflag, int vflag) double **vptr; if (vflag_atom) vptr = vatom; - else vptr = NULL; + else vptr = nullptr; for (ii = 0; ii < inum_half; ii++) { i = ilist_half[ii]; @@ -365,7 +365,7 @@ void PairMEAMC::read_files(const std::string &globalfile, FILE *fp; if (comm->me == 0) { fp = utils::open_potential(globalfile,lmp,nullptr); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open MEAM potential file {}", globalfile)); } @@ -408,7 +408,7 @@ void PairMEAMC::read_files(const std::string &globalfile, while (1) { char *ptr; ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { fclose(fp); break; } @@ -424,7 +424,7 @@ void PairMEAMC::read_files(const std::string &globalfile, while (nwords < params_per_line) { int n = strlen(line); ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { fclose(fp); break; } @@ -440,7 +440,7 @@ void PairMEAMC::read_files(const std::string &globalfile, nwords = 0; words[nwords++] = strtok(line,"' \t\n\r\f"); - while ((words[nwords++] = strtok(NULL,"' \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr,"' \t\n\r\f"))) continue; // skip if element name isn't in element list @@ -556,7 +556,7 @@ void PairMEAMC::read_files(const std::string &globalfile, delete [] rozero; delete [] found; - // done if user param file is NULL + // done if user param file is "NULL" if (userfile == "NULL") return; @@ -564,7 +564,7 @@ void PairMEAMC::read_files(const std::string &globalfile, if (comm->me == 0) { fp = utils::open_potential(userfile,lmp,nullptr); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open MEAM potential file {}", userfile)); } @@ -584,7 +584,7 @@ void PairMEAMC::read_files(const std::string &globalfile, char *ptr; if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { fclose(fp); nline = -1; } else nline = strlen(line) + 1; @@ -603,7 +603,7 @@ void PairMEAMC::read_files(const std::string &globalfile, int nparams = 0; params[nparams++] = strtok(line,"=(), '\t\n\r\f"); while (nparams < maxparams && - (params[nparams++] = strtok(NULL,"=(), '\t\n\r\f"))) + (params[nparams++] = strtok(nullptr,"=(), '\t\n\r\f"))) continue; nparams--; @@ -837,5 +837,5 @@ void *PairMEAMC::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"scale") == 0) return (void *) scale; - return NULL; + return nullptr; } diff --git a/src/USER-MESODPD/compute_edpd_temp_atom.cpp b/src/USER-MESODPD/compute_edpd_temp_atom.cpp index 9eb6e9752b09743be825c682e74f040c369aee39..02aa3e7311ad5a901dcf86bdd33426a3f7c8170f 100644 --- a/src/USER-MESODPD/compute_edpd_temp_atom.cpp +++ b/src/USER-MESODPD/compute_edpd_temp_atom.cpp @@ -34,7 +34,7 @@ ComputeEDPDTempAtom::ComputeEDPDTempAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - temp_vector = NULL; + temp_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-MESODPD/compute_tdpd_cc_atom.cpp b/src/USER-MESODPD/compute_tdpd_cc_atom.cpp index 7e9d5eb29e6cdf0a1625b6b5a40cd969705f1fc5..d87d645b6e15e3be86ab3d6fe8b0a8a1d683a38f 100644 --- a/src/USER-MESODPD/compute_tdpd_cc_atom.cpp +++ b/src/USER-MESODPD/compute_tdpd_cc_atom.cpp @@ -38,7 +38,7 @@ ComputeTDPDCCAtom::ComputeTDPDCCAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - cc_vector = NULL; + cc_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-MESODPD/pair_edpd.cpp b/src/USER-MESODPD/pair_edpd.cpp index 9c2e74b8823cdd555f84e441f17e4e0e538e1442..36ad434f421c7cb16c09dfca407e5991283a57b0 100644 --- a/src/USER-MESODPD/pair_edpd.cpp +++ b/src/USER-MESODPD/pair_edpd.cpp @@ -65,8 +65,8 @@ PairEDPD::PairEDPD(LAMMPS *lmp) : Pair(lmp) { if (lmp->citeme) lmp->citeme->add(cite_pair_edpd); writedata = 1; - random = NULL; - randomT = NULL; + random = nullptr; + randomT = nullptr; } /* ---------------------------------------------------------------------- */ @@ -453,24 +453,24 @@ void PairEDPD::read_restart(FILE *fp) int me = comm->me; for (int i = 1; i <= atom->ntypes; i++) for (int j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&power[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&kappa[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&powerT[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cutT[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&power[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&kappa[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&powerT[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cutT[i][j],sizeof(double),1,fp,nullptr,error); if(power_flag) for (int k = 0; k < 4; k++) - utils::sfread(FLERR,&sc[i][j][k],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&sc[i][j][k],sizeof(double),1,fp,nullptr,error); if(kappa_flag) for (int k = 0; k < 4; k++) - utils::sfread(FLERR,&kc[i][j][k],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&kc[i][j][k],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&gamma[i][j],1,MPI_DOUBLE,0,world); @@ -508,9 +508,9 @@ void PairEDPD::write_restart_settings(FILE *fp) void PairEDPD::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&seed,1,MPI_INT,0,world); diff --git a/src/USER-MESODPD/pair_mdpd.cpp b/src/USER-MESODPD/pair_mdpd.cpp index 88b6724a03a2c60adae5284f9b56f3bd5bf42032..62a2ca8d1c259db9ef2894d2a692e4ceb1740a3a 100644 --- a/src/USER-MESODPD/pair_mdpd.cpp +++ b/src/USER-MESODPD/pair_mdpd.cpp @@ -54,7 +54,7 @@ PairMDPD::PairMDPD(LAMMPS *lmp) : Pair(lmp) if (lmp->citeme) lmp->citeme->add(cite_pair_mdpd); writedata = 1; - random = NULL; + random = nullptr; } /* ---------------------------------------------------------------------- */ @@ -348,15 +348,15 @@ void PairMDPD::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&A_att[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&B_rep[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_r[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&A_att[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&B_rep[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_r[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&A_att[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&B_rep[i][j],1,MPI_DOUBLE,0,world); @@ -386,10 +386,10 @@ void PairMDPD::write_restart_settings(FILE *fp) void PairMDPD::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&temperature,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&temperature,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&temperature,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/USER-MESODPD/pair_tdpd.cpp b/src/USER-MESODPD/pair_tdpd.cpp index 65a518c07e525e6675952a708f46de520eac2b26..b1ffb5ce8dbda104aec3369147ec9a31ff999b0b 100644 --- a/src/USER-MESODPD/pair_tdpd.cpp +++ b/src/USER-MESODPD/pair_tdpd.cpp @@ -57,7 +57,7 @@ PairTDPD::PairTDPD(LAMMPS *lmp) : Pair(lmp) cc_species = atom->cc_species; writedata = 1; - random = NULL; + random = nullptr; } /* ---------------------------------------------------------------------- */ @@ -395,19 +395,19 @@ void PairTDPD::read_restart(FILE *fp) int me = comm->me; for (int i = 1; i <= atom->ntypes; i++) for (int j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&power[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cutcc[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&power[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cutcc[i][j],sizeof(double),1,fp,nullptr,error); for(int k=0; kme == 0) { - utils::sfread(FLERR,&temperature,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&temperature,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&temperature,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/USER-MESONT/compute_mesont.cpp b/src/USER-MESONT/compute_mesont.cpp index 96792c8988710fe1c2dbfb9752fbc9470ad87194..0321be7c569f96ae1f7b9e0002b5ce08b0be5e46 100644 --- a/src/USER-MESONT/compute_mesont.cpp +++ b/src/USER-MESONT/compute_mesont.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeMesoNT::ComputeMesoNT(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), energy(NULL) { + Compute(lmp, narg, arg), energy(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute mesont command"); std::string ctype = arg[3]; if (ctype == "estretch") compute_type = ES; @@ -62,7 +62,7 @@ double ComputeMesoNT::compute_scalar() { error->all(FLERR,"Energy was not tallied on needed timestep"); int i; - double* ptr = NULL; + double* ptr = nullptr; if (compute_type == ES) ptr = static_cast(force->pair->extract("mesonttpm_Es_tot",i)); else if (compute_type == EB) @@ -104,7 +104,7 @@ void ComputeMesoNT::compute_peratom() { int i; // clear local energy array for (int i = 0; i < ntotal; i++) energy[i] = 0.0; - double* ptr = NULL; + double* ptr = nullptr; if (compute_type == ES) ptr = static_cast(force->pair->extract("mesonttpm_Es",i)); else if (compute_type == EB) diff --git a/src/USER-MESONT/pair_mesocnt.cpp b/src/USER-MESONT/pair_mesocnt.cpp index 96d53bd41a641890c932b5c6ff96b55965f0275a..a7b4bf0575510afe6bbc82c033f31d0f6a3a24d4 100644 --- a/src/USER-MESONT/pair_mesocnt.cpp +++ b/src/USER-MESONT/pair_mesocnt.cpp @@ -244,7 +244,7 @@ void PairMesoCNT::compute(int eflag, int vflag) // infinite CNT case if (endflag == 0) { - geometry(r1,r2,p1,p2,NULL,p,m,param,basis); + geometry(r1,r2,p1,p2,nullptr,p,m,param,basis); if (param[0] > cutoff) continue; finf(param,evdwl,flocal); @@ -760,7 +760,7 @@ void PairMesoCNT::read_file() // open file fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open mesocnt file: {}",file)); utils::sfgets(FLERR,line,MAXLINE,fp,file,error); @@ -846,7 +846,7 @@ void PairMesoCNT::read_data(FILE *fp, double *data, double x,xtemp,dxtemp; for (int i = 0; i < ninput; i++) { - if (NULL == fgets(line,MAXLINE,fp)) + if (nullptr == fgets(line,MAXLINE,fp)) error->one(FLERR,fmt::format("Premature end of file in pair table: {}",file)); if (i > 0) xtemp = x; @@ -899,7 +899,7 @@ void PairMesoCNT::read_data(FILE *fp, double **data, for (int i = 0; i < ninput; i++) { if (i > 0) xtemp = x; for (int j = 0; j < ninput; j++) { - if (NULL == fgets(line,MAXLINE,fp)) + if (nullptr == fgets(line,MAXLINE,fp)) error->one(FLERR,fmt::format("Premature end of file in pair table: {}",file)); if (j > 0) ytemp = y; diff --git a/src/USER-MESONT/pair_mesont_tpm.cpp b/src/USER-MESONT/pair_mesont_tpm.cpp index 6d8c8126ae29f8e53859e34cfcdee3850bfb96e9..4e5f31c66167d2dfa91cbbda0d37a59f6848b3ac 100644 --- a/src/USER-MESONT/pair_mesont_tpm.cpp +++ b/src/USER-MESONT/pair_mesont_tpm.cpp @@ -166,7 +166,7 @@ void vector_union(std::vector& v1, std::vector& v2, } MESONTList::MESONTList(const Atom* atom, const NeighList* nblist, double /* rc2 */){ - if (atom == NULL || nblist == NULL) return; + if (atom == nullptr || nblist == nullptr) return; //number of local atoms at the node int nlocal = atom->nlocal; //total number of atoms in the node and ghost shell @@ -305,12 +305,12 @@ PairMESONTTPM::PairMESONTTPM(LAMMPS *lmp) : Pair(lmp) { writedata=1; BendingMode = 0; // Harmonic bending model TPMType = 0; // Inter-tube segment-segment interaction - tab_path = NULL; + tab_path = nullptr; tab_path_length = 0; - eatom_s = NULL; - eatom_b = NULL; - eatom_t = NULL; + eatom_s = nullptr; + eatom_b = nullptr; + eatom_t = nullptr; instance_count++; if(instance_count > 1) error->all(FLERR, "only a single instance of mesont/tpm pair style can be created"); @@ -330,7 +330,7 @@ PairMESONTTPM::~PairMESONTTPM() memory->destroy(eatom_t); } instance_count--; - if (tab_path != NULL) memory->destroy(tab_path); + if (tab_path != nullptr) memory->destroy(tab_path); } /* ---------------------------------------------------------------------- */ @@ -597,7 +597,7 @@ void PairMESONTTPM::settings(int narg, char **arg){ } std::string TPMAFile = (narg > 1) ? arg[1] : "MESONT-TABTP.xrs"; tab_path_length = TPMAFile.length(); - if (tab_path != NULL) memory->destroy(tab_path); + if (tab_path != nullptr) memory->destroy(tab_path); //c_str returns '\0' terminated string memory->create(tab_path,tab_path_length+1,"pair:path"); std::memcpy(tab_path, TPMAFile.c_str(), tab_path_length+1); @@ -738,7 +738,7 @@ void PairMESONTTPM::read_restart_settings(FILE *fp){ MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&tab_path_length,1,MPI_INT,0,world); - if (tab_path != NULL) memory->destroy(tab_path); + if (tab_path != nullptr) memory->destroy(tab_path); memory->create(tab_path,tab_path_length+1,"pair:path"); if (me == 0) fread(tab_path,tab_path_length+1,1,fp); MPI_Bcast(tab_path,tab_path_length+1,MPI_CHAR,0,world); @@ -793,5 +793,5 @@ void* PairMESONTTPM::extract(const char *str, int &){ else if (strcmp(str,"mesonttpm_Es") == 0) return eatom_s; else if (strcmp(str,"mesonttpm_Eb") == 0) return eatom_b; else if (strcmp(str,"mesonttpm_Et") == 0) return eatom_t; - else return NULL; + else return nullptr; }; diff --git a/src/USER-MGPT/mgpt_readpot.cpp b/src/USER-MGPT/mgpt_readpot.cpp index 144c661b050e12c202c1bb8f1a786908046ead82..c5f7c75d73a0cc492873b66bcb3fb301cc06dfbd 100644 --- a/src/USER-MGPT/mgpt_readpot.cpp +++ b/src/USER-MGPT/mgpt_readpot.cpp @@ -66,7 +66,7 @@ static void getparmindata(const char *potin_file,int nvol[1],double vol0[1],doub FILE *in = fopen(potin_file,"r"); char line[1024]; - if(in == NULL) { + if(in == nullptr) { fprintf(stderr,"@%s:%d: Error reading potin file. Can not open file \'%s\'.\n", __FILE__,__LINE__,potin_file); exit(1); @@ -75,7 +75,7 @@ static void getparmindata(const char *potin_file,int nvol[1],double vol0[1],doub vsize = 10; volarr = (double *) malloc(sizeof(double) * vsize); n = 0; - while(fgets(line,sizeof(line),in) != NULL) { + while(fgets(line,sizeof(line),in) != nullptr) { double zval,ivol,rws,mass; double r0x,r1x,drx; int nrx,i; @@ -408,7 +408,7 @@ void potdata::readpot(const char *parmin_file,const char *potin_file,const doubl vpairtab[i*nr+j] = vpairtab[i*nr+j]*fscr + v2a - v2b; if(0) if(fabs(vol-ivol) < 0.01) { - static FILE *xfile = NULL; + static FILE *xfile = nullptr; if(j == 0) { xfile = fopen("mgpt5-pot.dat","w"); fprintf(xfile,"%%%% vol = %15.5e ivol = %15.5e i = %d ii = %d\n", diff --git a/src/USER-MGPT/mgpt_readpot.h b/src/USER-MGPT/mgpt_readpot.h index 8f46592e8a56028ebc37f174eca7927cbe68270c..c2a6feabe0dbe8fc88114fc7553b18ad6562b35b 100644 --- a/src/USER-MGPT/mgpt_readpot.h +++ b/src/USER-MGPT/mgpt_readpot.h @@ -172,7 +172,7 @@ struct potdata2 { strcpy(s,nametemplate); p = strchr(s,'{'); - if(p != NULL) { + if(p != nullptr) { if(sscanf(p+1,"%d:%d:%d",i0,stride,i1) != 3) { fprintf(stderr,"Error in template (\'%s\'), can not parse range.\n",nametemplate); exit(1); @@ -217,12 +217,12 @@ struct potdata2 { const char *parmin_suffix = strchr(parmin_template,'}')+1; const char * potin_suffix = strchr( potin_template,'}')+1; - if(parmin_suffix-1 == NULL) { + if(parmin_suffix-1 == nullptr) { fprintf(stderr,"No closing }. parmin_template=\'%s\'\n", parmin_template); exit(1); } - if(potin_suffix-1 == NULL) { + if(potin_suffix-1 == nullptr) { fprintf(stderr,"No closing }. potin_template=\'%s\'\n", potin_template); exit(1); diff --git a/src/USER-MGPT/pair_mgpt.cpp b/src/USER-MGPT/pair_mgpt.cpp index 070e3cb61e24c3dce8ab266505518a97b1632a63..dd48295357c5be9ac7dca72e2e1ce335f045f1ec 100644 --- a/src/USER-MGPT/pair_mgpt.cpp +++ b/src/USER-MGPT/pair_mgpt.cpp @@ -54,7 +54,7 @@ static double gettime(int x = 0) { if(1) { /* struct timeval tv; - gettimeofday(&tv,NULL); + gettimeofday(&tv,nullptr); return tv.tv_sec + 1e-6 * tv.tv_usec; */ /* @@ -1859,7 +1859,7 @@ void PairMGPT::coeff(int narg, char **arg) if(strspn(arg[iarg+1],"1234") == strlen(arg[iarg+1])) { nbody_flag = 0; for(int i = 0; i<4; i++) - if(strchr(arg[iarg+1],'1'+i) != NULL) { + if(strchr(arg[iarg+1],'1'+i) != nullptr) { nbody_flag = nbody_flag + (1<me == 0) printf("Explicitly adding %d-tuple forces.\n",i+1); } @@ -1906,7 +1906,7 @@ void PairMGPT::coeff(int narg, char **arg) if(comm->me == 0) { FILE *parmin_fp = utils::open_potential(arg[2],lmp,nullptr); FILE *potin_fp = utils::open_potential(arg[3],lmp,nullptr); - if (parmin_fp == NULL || potin_fp == NULL) { + if (parmin_fp == nullptr || potin_fp == nullptr) { char str[128]; sprintf(str,"Cannot open MGPT potential files %s %s",arg[2],arg[3]); error->one(FLERR,str); diff --git a/src/USER-MISC/angle_cosine_shift.cpp b/src/USER-MISC/angle_cosine_shift.cpp index a986cb83220d4042f3ea4ad2597dae2b17ce5d3f..f6427171a73d82deae1c78aed889f5c2d598dfe3 100644 --- a/src/USER-MISC/angle_cosine_shift.cpp +++ b/src/USER-MISC/angle_cosine_shift.cpp @@ -37,7 +37,7 @@ using namespace MathConst; AngleCosineShift::AngleCosineShift(LAMMPS *lmp) : Angle(lmp) { - kcost = NULL; + kcost = nullptr; } /* ---------------------------------------------------------------------- */ @@ -225,10 +225,10 @@ void AngleCosineShift::read_restart(FILE *fp) if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&kcost[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ksint[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&kcost[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ksint[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&kcost[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/angle_cosine_shift_exp.cpp b/src/USER-MISC/angle_cosine_shift_exp.cpp index 52bfe751f14a77c008014e68a4294a443816f1d3..9e98c319f4e4e61c744abebb19719facdd638693 100644 --- a/src/USER-MISC/angle_cosine_shift_exp.cpp +++ b/src/USER-MISC/angle_cosine_shift_exp.cpp @@ -37,13 +37,13 @@ using namespace MathConst; AngleCosineShiftExp::AngleCosineShiftExp(LAMMPS *lmp) : Angle(lmp) { - doExpansion = NULL; - umin = NULL; - a = NULL; - opt1 = NULL; - theta0 = NULL; - sint = NULL; - cost = NULL; + doExpansion = nullptr; + umin = nullptr; + a = nullptr; + opt1 = nullptr; + theta0 = nullptr; + sint = nullptr; + cost = nullptr; } /* ---------------------------------------------------------------------- */ @@ -257,11 +257,11 @@ void AngleCosineShiftExp::read_restart(FILE *fp) if (comm->me == 0) { - utils::sfread(FLERR,&umin[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&a[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&cost[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&sint[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&umin[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&a[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&cost[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&sint[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&umin[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&a[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/angle_dipole.cpp b/src/USER-MISC/angle_dipole.cpp index 336638f25d6c0ccae74a84e75805e5dfa94ca0cf..6715bd118680d399f2e8d65ca6b23c64ddca31d4 100644 --- a/src/USER-MISC/angle_dipole.cpp +++ b/src/USER-MISC/angle_dipole.cpp @@ -35,8 +35,8 @@ using namespace MathConst; AngleDipole::AngleDipole(LAMMPS *lmp) : Angle(lmp) { - k = NULL; - gamma0 = NULL; + k = nullptr; + gamma0 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -206,8 +206,8 @@ void AngleDipole::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&gamma0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&gamma0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&gamma0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/angle_fourier.cpp b/src/USER-MISC/angle_fourier.cpp index 907ee973bde9f5d7fec4a7377e6457a04d51b535..fc14736a07e953b9dc5bb337c9f7caa001a7c284 100644 --- a/src/USER-MISC/angle_fourier.cpp +++ b/src/USER-MISC/angle_fourier.cpp @@ -38,10 +38,10 @@ using namespace MathConst; AngleFourier::AngleFourier(LAMMPS *lmp) : Angle(lmp) { - k = NULL; - C0 = NULL; - C1 = NULL; - C2 = NULL; + k = nullptr; + C0 = nullptr; + C1 = nullptr; + C2 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -232,10 +232,10 @@ void AngleFourier::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&C0[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&C1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&C2[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&C0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&C1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&C2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&C0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/angle_fourier_simple.cpp b/src/USER-MISC/angle_fourier_simple.cpp index 8894f7b4c9199cb0dec9d1929827ef6bc98aba6e..abd02535cf7dd66c169b2984d5da74696bfdb15d 100644 --- a/src/USER-MISC/angle_fourier_simple.cpp +++ b/src/USER-MISC/angle_fourier_simple.cpp @@ -38,9 +38,9 @@ using namespace MathConst; AngleFourierSimple::AngleFourierSimple(LAMMPS *lmp) : Angle(lmp) { - k = NULL; - C = NULL; - N = NULL; + k = nullptr; + C = nullptr; + N = nullptr; } /* ---------------------------------------------------------------------- */ @@ -238,9 +238,9 @@ void AngleFourierSimple::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&C[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&N[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&C[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&N[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&C[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/angle_quartic.cpp b/src/USER-MISC/angle_quartic.cpp index 93f45f9562b2cd0ba293344d8520c4233423bd8d..50a73af7b53d9e4e8335ef0e0bf1c5999fe02127 100644 --- a/src/USER-MISC/angle_quartic.cpp +++ b/src/USER-MISC/angle_quartic.cpp @@ -233,10 +233,10 @@ void AngleQuartic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k3[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k4[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k3[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k4[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k2[1],atom->nangletypes,MPI_DOUBLE,0,world); MPI_Bcast(&k3[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/bond_harmonic_shift.cpp b/src/USER-MISC/bond_harmonic_shift.cpp index 5889400b978fdf0b4ab9c4cea08ac8583a748ad4..28badce911a9584c8e00cdcf245fa02851c4c6ff 100644 --- a/src/USER-MISC/bond_harmonic_shift.cpp +++ b/src/USER-MISC/bond_harmonic_shift.cpp @@ -177,9 +177,9 @@ void BondHarmonicShift::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r1[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r1[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/bond_harmonic_shift_cut.cpp b/src/USER-MISC/bond_harmonic_shift_cut.cpp index 86e6263f93374ad1f9a6d64d2d480ef741c989b5..b875fb71b21983d829402a93b2c9374c659bb568 100644 --- a/src/USER-MISC/bond_harmonic_shift_cut.cpp +++ b/src/USER-MISC/bond_harmonic_shift_cut.cpp @@ -179,9 +179,9 @@ void BondHarmonicShiftCut::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r1[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r1[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/bond_special.cpp b/src/USER-MISC/bond_special.cpp index 87671655b1980d8506eb2a0c09f009c63fd2ebe1..4f79fea519fff2b13f64818ff0e39c691b953608 100644 --- a/src/USER-MISC/bond_special.cpp +++ b/src/USER-MISC/bond_special.cpp @@ -44,7 +44,7 @@ BondSpecial::~BondSpecial() void BondSpecial::init_style() { - if (force->pair == NULL) error->all(FLERR,"No pair style defined"); + if (force->pair == nullptr) error->all(FLERR,"No pair style defined"); else if ((force->pair->single_enable == 0) || force->pair->manybody_flag) error->all(FLERR,"Pair style does not support bond style special"); @@ -59,7 +59,7 @@ void BondSpecial::init_style() force->special_coul[3] != 1.0)) error->all(FLERR,"Invalid 1-4 setting for bond style special."); - if (force->kspace != NULL) + if (force->kspace != nullptr) error->all(FLERR,"Bond style special is not compatible with long range " "Coulombic interactions"); } diff --git a/src/USER-MISC/compute_ackland_atom.cpp b/src/USER-MISC/compute_ackland_atom.cpp index bcf41591ebb1b29fb2ed173fde0fa8c1cc9b5259..df0636d7b9f96f211bb6d332ed7d72e3036ce5ad 100644 --- a/src/USER-MISC/compute_ackland_atom.cpp +++ b/src/USER-MISC/compute_ackland_atom.cpp @@ -48,13 +48,13 @@ ComputeAcklandAtom::ComputeAcklandAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - structure = NULL; + structure = nullptr; maxneigh = 0; legacy = 0; - distsq = NULL; - nearest = NULL; - nearest_n0 = NULL; - nearest_n1 = NULL; + distsq = nullptr; + nearest = nullptr; + nearest_n0 = nullptr; + nearest_n1 = nullptr; int iarg = 3; while (narg > iarg) { diff --git a/src/USER-MISC/compute_basal_atom.cpp b/src/USER-MISC/compute_basal_atom.cpp index 3b9b38343d2aabe3ea67ffa737973d74cda24f71..fa59a02575cbec88740fcaaab4a09d5f75295117 100644 --- a/src/USER-MISC/compute_basal_atom.cpp +++ b/src/USER-MISC/compute_basal_atom.cpp @@ -44,12 +44,12 @@ ComputeBasalAtom::ComputeBasalAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 3; nmax = 0; - BPV = NULL; + BPV = nullptr; maxneigh = 0; - distsq = NULL; - nearest = NULL; - nearest_n0 = NULL; - nearest_n1 = NULL; + distsq = nullptr; + nearest = nullptr; + nearest_n0 = nullptr; + nearest_n1 = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-MISC/compute_cnp_atom.cpp b/src/USER-MISC/compute_cnp_atom.cpp index 52656ec9d68138efdb04c4e73a7dba6b11cdea30..5efab292b5533d4877a38660b838cfdc209c5f2d 100644 --- a/src/USER-MISC/compute_cnp_atom.cpp +++ b/src/USER-MISC/compute_cnp_atom.cpp @@ -49,7 +49,7 @@ enum{NCOMMON}; ComputeCNPAtom::ComputeCNPAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - list(NULL), nearest(NULL), nnearest(NULL), cnpv(NULL) + list(nullptr), nearest(nullptr), nnearest(nullptr), cnpv(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute cnp/atom command"); @@ -92,7 +92,7 @@ ComputeCNPAtom::~ComputeCNPAtom() void ComputeCNPAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute cnp/atom requires a pair style be defined"); if (sqrt(cutsq) > force->pair->cutforce) diff --git a/src/USER-MISC/compute_entropy_atom.cpp b/src/USER-MISC/compute_entropy_atom.cpp index d539d51e99b170e8b7af2d6c5e319e4ae5b6a310..2a308c427fed0deb0063da9c20d96f8d0c4fa34b 100644 --- a/src/USER-MISC/compute_entropy_atom.cpp +++ b/src/USER-MISC/compute_entropy_atom.cpp @@ -40,7 +40,7 @@ using namespace MathConst; ComputeEntropyAtom:: ComputeEntropyAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - pair_entropy(NULL), pair_entropy_avg(NULL) + pair_entropy(nullptr), pair_entropy_avg(nullptr) { if (narg < 5 || narg > 10) error->all(FLERR,"Illegal compute entropy/atom command; wrong number" @@ -118,7 +118,7 @@ ComputeEntropyAtom::~ComputeEntropyAtom() void ComputeEntropyAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute entropy/atom requires a pair style be" " defined"); diff --git a/src/USER-MISC/compute_gyration_shape.cpp b/src/USER-MISC/compute_gyration_shape.cpp index aef5ef91a3e080f58f7dabdf65829b7c7127d589..6aef8c80ec0af6a01cd23b82c365b167ac375a81 100644 --- a/src/USER-MISC/compute_gyration_shape.cpp +++ b/src/USER-MISC/compute_gyration_shape.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeGyrationShape::ComputeGyrationShape(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), id_gyration(NULL) + Compute(lmp, narg, arg), id_gyration(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute gyration/shape command"); diff --git a/src/USER-MISC/compute_gyration_shape_chunk.cpp b/src/USER-MISC/compute_gyration_shape_chunk.cpp index 116d851024ff37e7b996983ee48db0be02c6bce2..2c9bf9d3ed926da28b3f8193332f4cf73c088657 100644 --- a/src/USER-MISC/compute_gyration_shape_chunk.cpp +++ b/src/USER-MISC/compute_gyration_shape_chunk.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeGyrationShapeChunk::ComputeGyrationShapeChunk(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), id_gyration_chunk(NULL), shape_parameters(NULL) + Compute(lmp, narg, arg), id_gyration_chunk(nullptr), shape_parameters(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute gyration/shape/chunk command"); diff --git a/src/USER-MISC/compute_hma.cpp b/src/USER-MISC/compute_hma.cpp index f2ccf2694de3db2d14353164393a67b180dfa792..f7a9f9fcfa4a8d9164b7d810d076668f3f615050 100644 --- a/src/USER-MISC/compute_hma.cpp +++ b/src/USER-MISC/compute_hma.cpp @@ -73,7 +73,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputeHMA::ComputeHMA(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), id_temp(NULL), deltaR(NULL) + Compute(lmp, narg, arg), id_temp(nullptr), deltaR(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute hma command"); if (igroup) error->all(FLERR,"Compute hma must use group all"); @@ -199,7 +199,7 @@ ComputeHMA::~ComputeHMA() void ComputeHMA::init() { if (computeCv>-1) { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"No pair style is defined for compute hma cv"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute hma cv"); @@ -222,7 +222,7 @@ void ComputeHMA::setup() int ifix = modify->find_fix(id_temp); if (ifix < 0) error->all(FLERR,"Could not find compute hma temperature ID"); double * temperat = (double *) modify->fix[ifix]->extract("t_target",dummy); - if (temperat==NULL) error->all(FLERR,"Could not find compute hma temperature ID"); + if (temperat==nullptr) error->all(FLERR,"Could not find compute hma temperature ID"); finaltemp = * temperat; // set fix which stores original atom coords diff --git a/src/USER-MISC/compute_pressure_cylinder.cpp b/src/USER-MISC/compute_pressure_cylinder.cpp index 6cf375dd19d4f512b6dadc478cc75db40e89ea08..e050275f764732ea8c4d6b94bab70794766f4d60 100644 --- a/src/USER-MISC/compute_pressure_cylinder.cpp +++ b/src/USER-MISC/compute_pressure_cylinder.cpp @@ -48,10 +48,10 @@ static const char cite_compute_pressure_cylinder[] = ComputePressureCyl::ComputePressureCyl(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - Pr_temp(NULL), Pr_all(NULL), Pz_temp(NULL), Pz_all(NULL), Pphi_temp(NULL), - Pphi_all(NULL), R(NULL), Rinv(NULL), R2(NULL), PrAinv(NULL), PzAinv(NULL), - R2kin(NULL), density_temp(NULL), invVbin(NULL), density_all(NULL), - tangent(NULL), ephi_x(NULL), ephi_y(NULL), binz(NULL) + Pr_temp(nullptr), Pr_all(nullptr), Pz_temp(nullptr), Pz_all(nullptr), Pphi_temp(nullptr), + Pphi_all(nullptr), R(nullptr), Rinv(nullptr), R2(nullptr), PrAinv(nullptr), PzAinv(nullptr), + R2kin(nullptr), density_temp(nullptr), invVbin(nullptr), density_all(nullptr), + tangent(nullptr), ephi_x(nullptr), ephi_y(nullptr), binz(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_compute_pressure_cylinder); if (narg != 7) error->all(FLERR,"Illegal compute pressure/cylinder command"); @@ -143,7 +143,7 @@ ComputePressureCyl::~ComputePressureCyl() void ComputePressureCyl::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"No pair style is defined for compute pressure/cylinder"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute pressure/cylinder"); diff --git a/src/USER-MISC/compute_pressure_grem.cpp b/src/USER-MISC/compute_pressure_grem.cpp index ba949727b010b0da0e992243ea9dd2b2f45b7a89..6a5c36a06f5c6bb9c4fc65ced69f1c6025a69736 100644 --- a/src/USER-MISC/compute_pressure_grem.cpp +++ b/src/USER-MISC/compute_pressure_grem.cpp @@ -55,7 +55,7 @@ void ComputePressureGrem::init() int dim; scale_grem = (double *)modify->fix[ifix]->extract("scale_grem",dim); - if (scale_grem == NULL || dim != 0) + if (scale_grem == nullptr || dim != 0) error->all(FLERR,"Cannot extract gREM scale factor from fix grem"); } diff --git a/src/USER-MISC/compute_stress_mop.cpp b/src/USER-MISC/compute_stress_mop.cpp index c733c929ba4583244656f4a836475c2d012cd05c..2abe812f19bf73c8e6a5fc98f16a6fa66e73c87f 100644 --- a/src/USER-MISC/compute_stress_mop.cpp +++ b/src/USER-MISC/compute_stress_mop.cpp @@ -117,7 +117,7 @@ ComputeStressMop::ComputeStressMop(LAMMPS *lmp, int narg, char **arg) : // Initialize some variables - values_local = values_global = vector = NULL; + values_local = values_global = vector = nullptr; // this fix produces a global vector @@ -173,7 +173,7 @@ void ComputeStressMop::init() // This compute requires a pair style with pair_single method implemented - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"No pair style is defined for compute stress/mop"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute stress/mop"); @@ -185,15 +185,15 @@ void ComputeStressMop::init() //Compute stress/mop only accounts for pair interactions. // issue a warning if any intramolecular potential or Kspace is defined. - if (force->bond!=NULL) + if (force->bond!=nullptr) error->warning(FLERR,"compute stress/mop does not account for bond potentials"); - if (force->angle!=NULL) + if (force->angle!=nullptr) error->warning(FLERR,"compute stress/mop does not account for angle potentials"); - if (force->dihedral!=NULL) + if (force->dihedral!=nullptr) error->warning(FLERR,"compute stress/mop does not account for dihedral potentials"); - if (force->improper!=NULL) + if (force->improper!=nullptr) error->warning(FLERR,"compute stress/mop does not account for improper potentials"); - if (force->kspace!=NULL) + if (force->kspace!=nullptr) error->warning(FLERR,"compute stress/mop does not account for kspace contributions"); } diff --git a/src/USER-MISC/compute_stress_mop_profile.cpp b/src/USER-MISC/compute_stress_mop_profile.cpp index 323aee851ee50bc96eb67dc1b378a332784ff000..6beb3ffd83370470102ca990f93ea7231700f13f 100644 --- a/src/USER-MISC/compute_stress_mop_profile.cpp +++ b/src/USER-MISC/compute_stress_mop_profile.cpp @@ -112,8 +112,8 @@ ComputeStressMopProfile::ComputeStressMopProfile(LAMMPS *lmp, int narg, char **a // initialize some variables nbins = 0; - coord = coordp = NULL; - values_local = values_global = array = NULL; + coord = coordp = nullptr; + values_local = values_global = array = nullptr; // bin setup @@ -173,7 +173,7 @@ void ComputeStressMopProfile::init() //This compute requires a pair style with pair_single method implemented - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"No pair style is defined for compute stress/mop/profile"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute stress/mop/profile"); @@ -185,15 +185,15 @@ void ComputeStressMopProfile::init() //Compute stress/mop/profile only accounts for pair interactions. // issue a warning if any intramolecular potential or Kspace is defined. - if (force->bond!=NULL) + if (force->bond!=nullptr) error->warning(FLERR,"compute stress/mop/profile does not account for bond potentials"); - if (force->angle!=NULL) + if (force->angle!=nullptr) error->warning(FLERR,"compute stress/mop/profile does not account for angle potentials"); - if (force->dihedral!=NULL) + if (force->dihedral!=nullptr) error->warning(FLERR,"compute stress/mop/profile does not account for dihedral potentials"); - if (force->improper!=NULL) + if (force->improper!=nullptr) error->warning(FLERR,"compute stress/mop/profile does not account for improper potentials"); - if (force->kspace!=NULL) + if (force->kspace!=nullptr) error->warning(FLERR,"compute stress/mop/profile does not account for kspace contributions"); } diff --git a/src/USER-MISC/compute_temp_rotate.cpp b/src/USER-MISC/compute_temp_rotate.cpp index c333357a93df328eba2b60415047fc7f4a42b44d..5aafe19033f7cbba626eec4bac707232c796aa6c 100644 --- a/src/USER-MISC/compute_temp_rotate.cpp +++ b/src/USER-MISC/compute_temp_rotate.cpp @@ -42,7 +42,7 @@ ComputeTempRotate::ComputeTempRotate(LAMMPS *lmp, int narg, char **arg) : tempbias = 1; maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/USER-MISC/compute_viscosity_cos.cpp b/src/USER-MISC/compute_viscosity_cos.cpp index dae93a8d81a02bf35e39edb1be3d07218d047357..4a798eb1582bcd93d7969b944da6cf4181f35ad7 100644 --- a/src/USER-MISC/compute_viscosity_cos.cpp +++ b/src/USER-MISC/compute_viscosity_cos.cpp @@ -45,7 +45,7 @@ ComputeViscosityCos::ComputeViscosityCos(LAMMPS *lmp, int narg, char **arg) : tempbias = 1; maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[7]; } diff --git a/src/USER-MISC/dihedral_cosine_shift_exp.cpp b/src/USER-MISC/dihedral_cosine_shift_exp.cpp index 7c131682fa567ed4b000f25341b00f3477ea9949..d5cd27189df1ea0338098d04d095a15699dbf4ff 100644 --- a/src/USER-MISC/dihedral_cosine_shift_exp.cpp +++ b/src/USER-MISC/dihedral_cosine_shift_exp.cpp @@ -322,11 +322,11 @@ void DihedralCosineShiftExp::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&umin[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&a[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&cost[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&sint[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&theta[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&umin[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&a[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&cost[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&sint[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&theta[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&umin[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&a[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/dihedral_fourier.cpp b/src/USER-MISC/dihedral_fourier.cpp index 066447f92d91ccb4e4e4e7b6fe8868bb577acf45..cb620ae7d40b4cac1d9e7f6053d35885f8fc8b73 100644 --- a/src/USER-MISC/dihedral_fourier.cpp +++ b/src/USER-MISC/dihedral_fourier.cpp @@ -365,7 +365,7 @@ void DihedralFourier::read_restart(FILE *fp) allocate(); if (comm->me == 0) - utils::sfread(FLERR,&nterms[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&nterms[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); MPI_Bcast(&nterms[1],atom->ndihedraltypes,MPI_INT,0,world); @@ -380,9 +380,9 @@ void DihedralFourier::read_restart(FILE *fp) if (comm->me == 0) { for (int i=1; i<=atom->ndihedraltypes; i++) { - utils::sfread(FLERR,k[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,multiplicity[i],sizeof(int),nterms[i],fp,NULL,error); - utils::sfread(FLERR,shift[i],sizeof(double),nterms[i],fp,NULL,error); + utils::sfread(FLERR,k[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,multiplicity[i],sizeof(int),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,shift[i],sizeof(double),nterms[i],fp,nullptr,error); } } diff --git a/src/USER-MISC/dihedral_nharmonic.cpp b/src/USER-MISC/dihedral_nharmonic.cpp index bde8d84070bd68486a11603991f647ef25db94fc..bf1b2fa75da08bec2d7f1e3bf364e70565ef1b42 100644 --- a/src/USER-MISC/dihedral_nharmonic.cpp +++ b/src/USER-MISC/dihedral_nharmonic.cpp @@ -320,7 +320,7 @@ void DihedralNHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) - utils::sfread(FLERR,&nterms[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&nterms[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); MPI_Bcast(&nterms[1],atom->ndihedraltypes,MPI_INT,0,world); @@ -330,7 +330,7 @@ void DihedralNHarmonic::read_restart(FILE *fp) if (comm->me == 0) { for(int i = 1; i <= atom->ndihedraltypes; i++) - utils::sfread(FLERR,a[i],sizeof(double),nterms[i],fp,NULL,error); + utils::sfread(FLERR,a[i],sizeof(double),nterms[i],fp,nullptr,error); } for (int i = 1; i <= atom->ndihedraltypes; i++ ) diff --git a/src/USER-MISC/dihedral_quadratic.cpp b/src/USER-MISC/dihedral_quadratic.cpp index deafc8391f671dc577cb1b19a00af4b850d519fe..68be198332e819448a2c0b1aed2dc16b7599af8c 100644 --- a/src/USER-MISC/dihedral_quadratic.cpp +++ b/src/USER-MISC/dihedral_quadratic.cpp @@ -326,8 +326,8 @@ void DihedralQuadratic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); - utils::sfread(FLERR,&phi0[1],sizeof(double),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); + utils::sfread(FLERR,&phi0[1],sizeof(double),atom->ndihedraltypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); MPI_Bcast(&phi0[1],atom->ndihedraltypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/dihedral_spherical.cpp b/src/USER-MISC/dihedral_spherical.cpp index 15bb458c481631d5cef0bacb55e9ed78d685c444..d2004829994a7030e32e674fe6705aa178564e27 100644 --- a/src/USER-MISC/dihedral_spherical.cpp +++ b/src/USER-MISC/dihedral_spherical.cpp @@ -654,16 +654,16 @@ void DihedralSpherical::allocate() theta2_shift = new double * [n+1]; theta2_offset = new double * [n+1]; for (int i = 1; i <= n; i++) { - Ccoeff[i] = NULL; - phi_mult[i] = NULL; - phi_shift[i] = NULL; - phi_offset[i] = NULL; - theta1_mult[i] = NULL; - theta1_shift[i] = NULL; - theta1_offset[i] = NULL; - theta2_mult[i] = NULL; - theta2_shift[i] = NULL; - theta2_offset[i] = NULL; + Ccoeff[i] = nullptr; + phi_mult[i] = nullptr; + phi_shift[i] = nullptr; + phi_offset[i] = nullptr; + theta1_mult[i] = nullptr; + theta1_shift[i] = nullptr; + theta1_offset[i] = nullptr; + theta2_mult[i] = nullptr; + theta2_shift[i] = nullptr; + theta2_offset[i] = nullptr; } memory->create(setflag,n+1,"dihedral:setflag"); @@ -755,7 +755,7 @@ void DihedralSpherical::read_restart(FILE *fp) allocate(); if (comm->me == 0) - utils::sfread(FLERR,&nterms[1],sizeof(int),atom->ndihedraltypes,fp,NULL,error); + utils::sfread(FLERR,&nterms[1],sizeof(int),atom->ndihedraltypes,fp,nullptr,error); MPI_Bcast(&nterms[1],atom->ndihedraltypes,MPI_INT,0,world); @@ -775,16 +775,16 @@ void DihedralSpherical::read_restart(FILE *fp) if (comm->me == 0) { for (int i=1; i<=atom->ndihedraltypes; i++) { - utils::sfread(FLERR,Ccoeff[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,phi_mult[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,phi_shift[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,phi_offset[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,theta1_mult[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,theta1_shift[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,theta1_offset[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,theta2_mult[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,theta2_shift[i],sizeof(double),nterms[i],fp,NULL,error); - utils::sfread(FLERR,theta2_offset[i],sizeof(double),nterms[i],fp,NULL,error); + utils::sfread(FLERR,Ccoeff[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,phi_mult[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,phi_shift[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,phi_offset[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,theta1_mult[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,theta1_shift[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,theta1_offset[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,theta2_mult[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,theta2_shift[i],sizeof(double),nterms[i],fp,nullptr,error); + utils::sfread(FLERR,theta2_offset[i],sizeof(double),nterms[i],fp,nullptr,error); } } diff --git a/src/USER-MISC/dihedral_table.cpp b/src/USER-MISC/dihedral_table.cpp index 91a8642b10ec4480d8a91b19d665e33be32e9efb..d09684df987c335b944cadf5fe9ca996f5306a81 100644 --- a/src/USER-MISC/dihedral_table.cpp +++ b/src/USER-MISC/dihedral_table.cpp @@ -788,7 +788,7 @@ void DihedralTable::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } @@ -1014,8 +1014,8 @@ void DihedralTable::write_restart_settings(FILE *fp) void DihedralTable::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); @@ -1027,10 +1027,10 @@ void DihedralTable::read_restart_settings(FILE *fp) void DihedralTable::null_table(Table *tb) { - tb->phifile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->phi = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->phifile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->phi = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-MISC/dihedral_table_cut.cpp b/src/USER-MISC/dihedral_table_cut.cpp index f8a2f025966a8e1e02ae46e7f21406e140350f39..3933e393424d2e25941e6e30d47a29775f4e3546 100644 --- a/src/USER-MISC/dihedral_table_cut.cpp +++ b/src/USER-MISC/dihedral_table_cut.cpp @@ -412,8 +412,8 @@ DihedralTableCut::DihedralTableCut(LAMMPS *lmp) : Dihedral(lmp) { if (lmp->citeme) lmp->citeme->add(cite_dihedral_tablecut); ntables = 0; - tables = NULL; - checkU_fname = checkF_fname = NULL; + tables = nullptr; + checkU_fname = checkF_fname = nullptr; } /* ---------------------------------------------------------------------- */ @@ -779,7 +779,7 @@ void DihedralTableCut::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -1029,8 +1029,8 @@ void DihedralTableCut::write_restart_settings(FILE *fp) void DihedralTableCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); @@ -1041,10 +1041,10 @@ void DihedralTableCut::read_restart_settings(FILE *fp) void DihedralTableCut::null_table(Table *tb) { - tb->phifile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->phi = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->phifile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->phi = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- */ @@ -1079,7 +1079,7 @@ void DihedralTableCut::read_table(Table *tb, char *file, char *keyword) // open file FILE *fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { string err_msg = string("Cannot open file ") + string(file); error->one(FLERR,err_msg); } @@ -1087,7 +1087,7 @@ void DihedralTableCut::read_table(Table *tb, char *file, char *keyword) // loop until section found with matching keyword while (1) { - if (fgets(line,MAXLINE,fp) == NULL) { + if (fgets(line,MAXLINE,fp) == nullptr) { string err_msg=string("Did not find keyword \"") +string(keyword)+string("\" in dihedral table file."); error->one(FLERR, err_msg); @@ -1121,7 +1121,7 @@ void DihedralTableCut::read_table(Table *tb, char *file, char *keyword) // Skip blank lines and delete text following a '#' character char *pe = strchr(line, '#'); - if (pe != NULL) *pe = '\0'; //terminate string at '#' character + if (pe != nullptr) *pe = '\0'; //terminate string at '#' character char *pc = line; while ((*pc != '\0') && isspace(*pc)) pc++; @@ -1344,7 +1344,7 @@ void DihedralTableCut::param_extract(Table *tb, char *line) char *word = strtok(line," \t\n\r\f"); while (word) { if (strcmp(word,"N") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); tb->ninput = atoi(word); } else if (strcmp(word,"NOF") == 0) { @@ -1357,20 +1357,20 @@ void DihedralTableCut::param_extract(Table *tb, char *line) tb->use_degrees = false; } else if (strcmp(word,"CHECKU") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); memory->sfree(checkU_fname); memory->create(checkU_fname,strlen(word)+1,"dihedral_table:checkU"); strcpy(checkU_fname, word); } else if (strcmp(word,"CHECKF") == 0) { - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); memory->sfree(checkF_fname); memory->create(checkF_fname,strlen(word)+1,"dihedral_table:checkF"); strcpy(checkF_fname, word); } // COMMENTING OUT: equilibrium angles are not supported //else if (strcmp(word,"EQ") == 0) { - // word = strtok(NULL," \t\n\r\f"); + // word = strtok(nullptr," \t\n\r\f"); // tb->theta0 = atof(word); //} else { @@ -1378,7 +1378,7 @@ void DihedralTableCut::param_extract(Table *tb, char *line) err_msg += string(" (") + string(word) + string(")"); error->one(FLERR, err_msg); } - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); } if (tb->ninput == 0) diff --git a/src/USER-MISC/fix_addtorque.cpp b/src/USER-MISC/fix_addtorque.cpp index ed796280e79ea006841d2a0125343b78cd3fe035..f1b64817b1fe69e697f74608c2ee28eb30f1f0ad 100644 --- a/src/USER-MISC/fix_addtorque.cpp +++ b/src/USER-MISC/fix_addtorque.cpp @@ -51,7 +51,7 @@ FixAddTorque::FixAddTorque(LAMMPS *lmp, int narg, char **arg) : respa_level_support = 1; ilevel_respa = 0; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; diff --git a/src/USER-MISC/fix_ave_correlate_long.cpp b/src/USER-MISC/fix_ave_correlate_long.cpp index d92789f03fa2c6a7214f9501ed6f55a1b521dd48..57eb9705b7a0be70d3661b9e093a2dd03c20a335 100644 --- a/src/USER-MISC/fix_ave_correlate_long.cpp +++ b/src/USER-MISC/fix_ave_correlate_long.cpp @@ -118,13 +118,13 @@ FixAveCorrelateLong::FixAveCorrelateLong(LAMMPS * lmp, int narg, char **arg): type = AUTO; startstep = 0; - fp = NULL; + fp = nullptr; overwrite = 0; numcorrelators=20; p = 16; m = 2; - char *title1 = NULL; - char *title2 = NULL; + char *title1 = nullptr; + char *title2 = nullptr; while (iarg < narg) { if (strcmp(arg[iarg],"type") == 0) { @@ -163,7 +163,7 @@ FixAveCorrelateLong::FixAveCorrelateLong(LAMMPS * lmp, int narg, char **arg): error->all(FLERR,"Illegal fix ave/correlate/long command"); if (me == 0) { fp = fopen(arg[iarg+1],"w"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix ave/correlate/long file %s",arg[iarg+1]); error->one(FLERR,str); diff --git a/src/USER-MISC/fix_electron_stopping.cpp b/src/USER-MISC/fix_electron_stopping.cpp index 952ffe758418d0e9caac84b6f2ca8b1b2f914598..52ab44b0c8c7b5d2551d6f27e57f7654b3fa2758 100644 --- a/src/USER-MISC/fix_electron_stopping.cpp +++ b/src/USER-MISC/fix_electron_stopping.cpp @@ -242,7 +242,7 @@ void FixElectronStopping::read_table(const char *file) char line[MAXLINE]; FILE *fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str, 128, "Cannot open stopping range table %s", file); error->one(FLERR, str); @@ -252,21 +252,21 @@ void FixElectronStopping::read_table(const char *file) int l = 0; while (true) { - if (fgets(line, MAXLINE, fp) == NULL) break; // end of file + if (fgets(line, MAXLINE, fp) == nullptr) break; // end of file if (line[0] == '#') continue; // comment char *pch = strtok(line, " \t\n\r"); - if (pch == NULL) continue; // blank line + if (pch == nullptr) continue; // blank line if (l >= maxlines) grow_table(); int i = 0; - for ( ; i < ncol && pch != NULL; i++) { + for ( ; i < ncol && pch != nullptr; i++) { elstop_ranges[i][l] = utils::numeric(FLERR, pch,false,lmp); - pch = strtok(NULL, " \t\n\r"); + pch = strtok(nullptr, " \t\n\r"); } - if (i != ncol || pch != NULL) // too short or too long + if (i != ncol || pch != nullptr) // too short or too long error->one(FLERR, "fix electron/stopping: Invalid table line"); if (l >= 1 && elstop_ranges[0][l] <= elstop_ranges[0][l-1]) diff --git a/src/USER-MISC/fix_ffl.cpp b/src/USER-MISC/fix_ffl.cpp index cea6e8ed0ec36caa57e0b6968b33fc1f97b2dde3..6a74cf85f839412dcea21f34e7520249d86e9ebb 100644 --- a/src/USER-MISC/fix_ffl.cpp +++ b/src/USER-MISC/fix_ffl.cpp @@ -106,11 +106,11 @@ FixFFL::FixFFL(LAMMPS *lmp, int narg, char **arg) : random = new RanMars(lmp,seed + comm->me); // allocate per-type arrays for mass-scaling - sqrt_m=NULL; + sqrt_m=nullptr; memory->grow(sqrt_m, atom->ntypes+1,"ffl:sqrt_m"); // allocates space for temporaries - ffl_tmp1=ffl_tmp2=NULL; + ffl_tmp1=ffl_tmp2=nullptr; grow_arrays(atom->nmax); @@ -426,7 +426,7 @@ void *FixFFL::extract(const char *str, int &dim) { if (strcmp(str,"t_target") == 0) { return &t_target; } - return NULL; + return nullptr; } diff --git a/src/USER-MISC/fix_filter_corotate.cpp b/src/USER-MISC/fix_filter_corotate.cpp index eb663fbdefb356022bbf933168adec157f9ff027..bd0b29979bf54fedd063b6867425c47c84dd4227 100644 --- a/src/USER-MISC/fix_filter_corotate.cpp +++ b/src/USER-MISC/fix_filter_corotate.cpp @@ -149,22 +149,22 @@ FixFilterCorotate::FixFilterCorotate(LAMMPS *lmp, int narg, char **arg) : angle_distance = new double[atom->nangletypes+1]; //grow_arrays - array_atom = NULL; - shake_flag = NULL; - shake_atom = NULL; - shake_type = NULL; + array_atom = nullptr; + shake_flag = nullptr; + shake_atom = nullptr; + shake_type = nullptr; grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); //calls grow_arrays - x_store = NULL; + x_store = nullptr; //STUFF - g = NULL; - help2 = NULL; + g = nullptr; + help2 = nullptr; - dn1dx = dn2dx = dn3dx = NULL; - n1 = n2 = n3 = del1 = del2 = del3 = NULL; + dn1dx = dn2dx = dn3dx = nullptr; + n1 = n2 = n3 = del1 = del2 = del3 = nullptr; memory->grow(help2,15,15,"FilterCorotate:help2"); memory->grow(n1,3,"FilterCorotate:n1"); @@ -188,11 +188,11 @@ FixFilterCorotate::FixFilterCorotate(LAMMPS *lmp, int narg, char **arg) : // initialize list of clusters to constrain maxlist = 0; - list = NULL; - clist_derv = NULL; - clist_q0 = NULL; //list for derivative and ref. config - clist_nselect1 = clist_nselect2 = NULL; - clist_select1 = clist_select2 = NULL; + list = nullptr; + clist_derv = nullptr; + clist_q0 = nullptr; //list for derivative and ref. config + clist_nselect1 = clist_nselect2 = nullptr; + clist_select1 = clist_select2 = nullptr; } @@ -284,7 +284,7 @@ void FixFilterCorotate::init() // set equilibrium bond distances - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Bond potential must be defined for fix filter/corotate"); for (i = 1; i <= atom->nbondtypes; i++) bond_distance[i] = force->bond->equilibrium_distance(i); @@ -1225,7 +1225,7 @@ void FixFilterCorotate::find_clusters() // cycle buffer around ring of procs back to self - comm->ring(size,sizeof(tagint),buf,3,ring_shake,NULL,(void *)this); + comm->ring(size,sizeof(tagint),buf,3,ring_shake,nullptr,(void *)this); memory->destroy(buf); diff --git a/src/USER-MISC/fix_gle.cpp b/src/USER-MISC/fix_gle.cpp index 8e6fac34fbd323304b150058f07bd9593e25d11f..22cf37eeda2d9bd503f3b0935874600a8f0e90d8 100644 --- a/src/USER-MISC/fix_gle.cpp +++ b/src/USER-MISC/fix_gle.cpp @@ -218,11 +218,11 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : int seed = utils::inumeric(FLERR,arg[6],false,lmp); // LOADING A matrix - FILE *fgle = NULL; + FILE *fgle = nullptr; char *fname = arg[7]; if (comm->me == 0) { fgle = utils::open_potential(fname,lmp,nullptr); - if (fgle == NULL) { + if (fgle == nullptr) { char str[128]; snprintf(str,128,"Cannot open A-matrix file %s",fname); error->one(FLERR,str); @@ -238,7 +238,7 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fgle); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fgle); } else n = strlen(line) + 1; @@ -258,9 +258,9 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : ptr = strtok(line," \t\n\r\f"); do { A[ndone] = atof(ptr); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); ndone++; - } while ((ptr != NULL) && (ndone < ns1sq)); + } while ((ptr != nullptr) && (ndone < ns1sq)); } fnoneq=0; gle_every=1; gle_step=0; @@ -292,7 +292,7 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : } else { if (comm->me == 0) { fgle = utils::open_potential(fname,lmp,nullptr); - if (fgle == NULL) { + if (fgle == nullptr) { char str[128]; snprintf(str,128,"Cannot open C-matrix file %s",fname); error->one(FLERR,str); @@ -310,7 +310,7 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fgle); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fgle); } else n = strlen(line) + 1; @@ -330,9 +330,9 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : ptr = strtok(line," \t\n\r\f"); do { C[ndone] = cfac*atof(ptr); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); ndone++; - } while ((ptr != NULL) && (ndone < ns1sq)); + } while ((ptr != nullptr) && (ndone < ns1sq)); } } @@ -349,13 +349,13 @@ FixGLE::FixGLE(LAMMPS *lmp, int narg, char **arg) : random = new RanMars(lmp,seed + comm->me); // allocate per-type arrays for mass-scaling - sqrt_m=NULL; + sqrt_m=nullptr; memory->grow(sqrt_m, atom->ntypes+1,"gle:sqrt_m"); // allocates space for additional degrees of freedom - gle_s=NULL; + gle_s=nullptr; // allocates space for temporaries - gle_tmp1=gle_tmp2=NULL; + gle_tmp1=gle_tmp2=nullptr; grow_arrays(atom->nmax); init_gles(); @@ -720,7 +720,7 @@ void *FixGLE::extract(const char *str, int &dim) if (strcmp(str,"t_target") == 0) { return &t_target; } - return NULL; + return nullptr; } diff --git a/src/USER-MISC/fix_grem.cpp b/src/USER-MISC/fix_grem.cpp index b17c601f057dded39d39832b6bbcc0cf1805c49f..0a283522ea453c4a17298a8c455056164b781f53 100644 --- a/src/USER-MISC/fix_grem.cpp +++ b/src/USER-MISC/fix_grem.cpp @@ -132,7 +132,7 @@ FixGrem::FixGrem(LAMMPS *lmp, int narg, char **arg) : pressflag = 0; int *p_flag = (int *)nh->extract("p_flag",ifix); - if ((p_flag == NULL) || (ifix != 1) || (p_flag[0] == 0) + if ((p_flag == nullptr) || (ifix != 1) || (p_flag[0] == 0) || (p_flag[1] == 0) || (p_flag[2] == 0)) { pressflag = 0; } else if ((p_flag[0] == 1) && (p_flag[1] == 1) @@ -203,7 +203,7 @@ void FixGrem::init() double *t_start = (double *)nh->extract("t_start",ifix); double *t_stop = (double *)nh->extract("t_stop",ifix); - if ((t_start != NULL) && (t_stop != NULL) && (ifix == 0)) { + if ((t_start != nullptr) && (t_stop != nullptr) && (ifix == 0)) { tbath = *t_start; if (*t_start != *t_stop) error->all(FLERR,"Thermostat temperature ramp not allowed"); @@ -215,7 +215,7 @@ void FixGrem::init() int *p_flag = (int *)nh->extract("p_flag",ifix); double *p_start = (double *) nh->extract("p_start",ifix); double *p_stop = (double *) nh->extract("p_stop",ifix); - if ((p_flag != NULL) && (p_start != NULL) && (p_stop != NULL) + if ((p_flag != nullptr) && (p_start != nullptr) && (p_stop != nullptr) && (ifix == 1)) { ifix = 0; pressref = p_start[0]; @@ -291,5 +291,5 @@ void *FixGrem::extract(const char *str, int &dim) if (strcmp(str,"scale_grem") == 0) { return &scale_grem; } - return NULL; + return nullptr; } diff --git a/src/USER-MISC/fix_imd.cpp b/src/USER-MISC/fix_imd.cpp index 7c3fac9c339dc0ae3a88e57e43bc84ddb31bf106..d772998b16760394bdd72d4d89599dd6e87fa0d3 100644 --- a/src/USER-MISC/fix_imd.cpp +++ b/src/USER-MISC/fix_imd.cpp @@ -207,7 +207,7 @@ tagint taginthash_lookup(const taginthash_t *tptr, tagint key) { /* find the entry in the hash table */ h=taginthash(tptr, key); - for (node=tptr->bucket[h]; node!=NULL; node=node->next) { + for (node=tptr->bucket[h]; node!=nullptr; node=node->next) { if (node->key == key) break; } @@ -229,7 +229,7 @@ tagint *taginthash_keys(taginthash_t *tptr) { keys = (tagint *)calloc(tptr->entries, sizeof(tagint)); for (tagint i=0; i < tptr->size; ++i) { - for (node=tptr->bucket[i]; node != NULL; node=node->next) { + for (node=tptr->bucket[i]; node != nullptr; node=node->next) { keys[node->data] = node->key; } } @@ -280,7 +280,7 @@ void taginthash_destroy(taginthash_t *tptr) { for (i=0; isize; i++) { node = tptr->bucket[i]; - while (node != NULL) { + while (node != nullptr) { last = node; node = node->next; free(last); @@ -288,7 +288,7 @@ void taginthash_destroy(taginthash_t *tptr) { } /* free the entire array of buckets */ - if (tptr->bucket != NULL) { + if (tptr->bucket != nullptr) { free(tptr->bucket); memset(tptr, 0, sizeof(taginthash_t)); } @@ -492,25 +492,25 @@ FixIMD::FixIMD(LAMMPS *lmp, int narg, char **arg) : MPI_Comm_rank(world,&me); /* initialize various imd state variables. */ - clientsock = NULL; - localsock = NULL; + clientsock = nullptr; + localsock = nullptr; nlevels_respa = 0; imd_inactive = 0; imd_terminate = 0; imd_forces = 0; - force_buf = NULL; + force_buf = nullptr; maxbuf = 0; - msgdata = NULL; + msgdata = nullptr; msglen = 0; - comm_buf = NULL; - idmap = NULL; - rev_idmap = NULL; + comm_buf = nullptr; + idmap = nullptr; + rev_idmap = nullptr; if (me == 0) { /* set up incoming socket on MPI rank 0. */ imdsock_init(); localsock = imdsock_create(); - clientsock = NULL; + clientsock = nullptr; if (imdsock_bind(localsock,imd_port)) { perror("bind to socket failed"); imdsock_destroy(localsock); @@ -536,9 +536,9 @@ FixIMD::FixIMD(LAMMPS *lmp, int narg, char **arg) : /* set up mutex and condition variable for i/o thread */ /* hold mutex before creating i/o thread to keep it waiting. */ - pthread_mutex_init(&read_mutex, NULL); - pthread_mutex_init(&write_mutex, NULL); - pthread_cond_init(&write_cond, NULL); + pthread_mutex_init(&read_mutex, nullptr); + pthread_mutex_init(&write_mutex, nullptr); + pthread_cond_init(&write_cond, nullptr); pthread_mutex_lock(&write_mutex); buf_has_data=0; @@ -564,7 +564,7 @@ FixIMD::~FixIMD() buf_has_data=-1; pthread_cond_signal(&write_cond); pthread_mutex_unlock(&write_mutex); - pthread_join(iothread, NULL); + pthread_join(iothread, nullptr); /* cleanup */ pthread_attr_destroy(&iot_attr); @@ -584,8 +584,8 @@ FixIMD::~FixIMD() imdsock_destroy(clientsock); imdsock_shutdown(localsock); imdsock_destroy(localsock); - clientsock=NULL; - localsock=NULL; + clientsock=nullptr; + localsock=nullptr; return; } @@ -627,7 +627,7 @@ int FixIMD::reconnect() } } connect_msg = 0; - clientsock = NULL; + clientsock = nullptr; if (nowait_flag) { int retval = imdsock_selread(localsock,0); if (retval > 0) { @@ -774,7 +774,7 @@ void *fix_imd_ioworker(void *t) { FixIMD *imd=(FixIMD *)t; imd->ioworker(); - return NULL; + return nullptr; } /* the real i/o worker thread */ @@ -787,7 +787,7 @@ void FixIMD::ioworker() fprintf(screen,"Asynchronous I/O thread is exiting.\n"); buf_has_data=0; pthread_mutex_unlock(&write_mutex); - pthread_exit(NULL); + pthread_exit(nullptr); } else if (buf_has_data > 0) { /* send coordinate data, if client is able to accept */ if (clientsock && imdsock_selwrite(clientsock,0)) { @@ -855,9 +855,9 @@ void FixIMD::post_force(int /*vflag*/) imd_paused = 0; imd_forces = 0; memory->destroy(force_buf); - force_buf = NULL; + force_buf = nullptr; imdsock_destroy(clientsock); - clientsock = NULL; + clientsock = nullptr; if (screen) fprintf(screen, "IMD client detached. LAMMPS run continues.\n"); @@ -875,7 +875,7 @@ void FixIMD::post_force(int /*vflag*/) imd_terminate = 1; imd_paused = 0; imdsock_destroy(clientsock); - clientsock = NULL; + clientsock = nullptr; break; case IMD_PAUSE: @@ -958,7 +958,7 @@ void FixIMD::post_force(int /*vflag*/) /* check if we need to readjust the forces comm buffer on the receiving nodes. */ if (me != 0) { if (old_imd_forces < imd_forces) { /* grow holding space for forces, if needed. */ - if (force_buf != NULL) + if (force_buf != nullptr) memory->sfree(force_buf); force_buf = memory->smalloc(imd_forces*size_one, "imd:force_buf"); } @@ -1200,14 +1200,14 @@ void * imdsock_create(void) { imdsocket * s; s = (imdsocket *) malloc(sizeof(imdsocket)); - if (s != NULL) + if (s != nullptr) memset(s, 0, sizeof(imdsocket)); - else return NULL; + else return nullptr; if ((s->sd = socket(PF_INET, SOCK_STREAM, 0)) == -1) { printf("Failed to open socket."); free(s); - return NULL; + return nullptr; } return (void *) s; @@ -1229,7 +1229,7 @@ int imdsock_listen(void * v) { void *imdsock_accept(void * v) { int rc; - imdsocket *new_s = NULL, *s = (imdsocket *) v; + imdsocket *new_s = nullptr, *s = (imdsocket *) v; #if defined(ARCH_AIX5) || defined(ARCH_AIX5_64) || defined(ARCH_AIX6_64) unsigned int len; #define _SOCKLEN_TYPE unsigned int @@ -1248,7 +1248,7 @@ void *imdsock_accept(void * v) { rc = accept(s->sd, (struct sockaddr *) &s->addr, ( _SOCKLEN_TYPE * ) &len); if (rc >= 0) { new_s = (imdsocket *) malloc(sizeof(imdsocket)); - if (new_s != NULL) { + if (new_s != nullptr) { *new_s = *s; new_s->sd = rc; } @@ -1277,7 +1277,7 @@ int imdsock_read(void * v, void *buf, int len) { void imdsock_shutdown(void *v) { imdsocket * s = (imdsocket *) v; - if (s == NULL) + if (s == nullptr) return; #if defined(_MSC_VER) || defined(__MINGW32__) @@ -1289,7 +1289,7 @@ void imdsock_shutdown(void *v) { void imdsock_destroy(void * v) { imdsocket * s = (imdsocket *) v; - if (s == NULL) + if (s == nullptr) return; #if defined(_MSC_VER) || defined(__MINGW32__) @@ -1306,14 +1306,14 @@ int imdsock_selread(void *v, int sec) { struct timeval tv; int rc; - if (v == NULL) return 0; + if (v == nullptr) return 0; FD_ZERO(&rfd); FD_SET(s->sd, &rfd); memset((void *)&tv, 0, sizeof(struct timeval)); tv.tv_sec = sec; do { - rc = select(s->sd+1, &rfd, NULL, NULL, &tv); + rc = select(s->sd+1, &rfd, nullptr, nullptr, &tv); } while (rc < 0 && errno == EINTR); return rc; @@ -1325,14 +1325,14 @@ int imdsock_selwrite(void *v, int sec) { struct timeval tv; int rc; - if (v == NULL) return 0; + if (v == nullptr) return 0; FD_ZERO(&wfd); FD_SET(s->sd, &wfd); memset((void *)&tv, 0, sizeof(struct timeval)); tv.tv_sec = sec; do { - rc = select(s->sd + 1, NULL, &wfd, NULL, &tv); + rc = select(s->sd + 1, nullptr, &wfd, nullptr, &tv); } while (rc < 0 && errno == EINTR); return rc; } diff --git a/src/USER-MISC/fix_ipi.cpp b/src/USER-MISC/fix_ipi.cpp index b8045a9ff1412a902f22df17503c8afebf12e30a..2ddc965bb5a1b82337acd804ca56a0ce993e146a 100644 --- a/src/USER-MISC/fix_ipi.cpp +++ b/src/USER-MISC/fix_ipi.cpp @@ -167,7 +167,7 @@ static void readbuffer(int sockfd, char *data, int len, Error* error) /* ---------------------------------------------------------------------- */ FixIPI::FixIPI(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), irregular(NULL) + Fix(lmp, narg, arg), irregular(nullptr) { /* format for fix: * fix num group_id ipi host port [unix] diff --git a/src/USER-MISC/fix_npt_cauchy.cpp b/src/USER-MISC/fix_npt_cauchy.cpp index 9361d9ebd6f2b58a5ab91383f49f26de925442a8..a613ceb9be026930b967b02ab46b31d593454a58 100644 --- a/src/USER-MISC/fix_npt_cauchy.cpp +++ b/src/USER-MISC/fix_npt_cauchy.cpp @@ -53,10 +53,10 @@ enum{ISO,ANISO,TRICLINIC}; FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - rfix(NULL), id_dilate(NULL), irregular(NULL), id_temp(NULL), id_press(NULL), - eta(NULL), eta_dot(NULL), eta_dotdot(NULL), - eta_mass(NULL), etap(NULL), etap_dot(NULL), etap_dotdot(NULL), - etap_mass(NULL), id_store(NULL),init_store(NULL) + rfix(nullptr), id_dilate(nullptr), irregular(nullptr), id_temp(nullptr), id_press(nullptr), + eta(nullptr), eta_dot(nullptr), eta_dotdot(nullptr), + eta_mass(nullptr), etap(nullptr), etap_dot(nullptr), etap_dotdot(nullptr), + etap_mass(nullptr), id_store(nullptr),init_store(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix npt/cauchy command"); @@ -583,10 +583,10 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) : } nrigid = 0; - rfix = NULL; + rfix = nullptr; if (pre_exchange_flag) irregular = new Irregular(lmp); - else irregular = NULL; + else irregular = nullptr; // initialize vol0,t0 to zero to signal uninitialized // values then assigned in init(), if necessary @@ -794,7 +794,7 @@ void FixNPTCauchy::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigid++; @@ -821,7 +821,7 @@ void FixNPTCauchy::setup(int /*vflag*/) // If no thermostat or using fix nphug, // t_target must be defined by other means. - if (tstat_flag && strstr(style,"nphug") == NULL) { + if (tstat_flag && strstr(style,"nphug") == nullptr) { compute_temp_target(); } else if (pstat_flag) { @@ -1812,7 +1812,7 @@ void *FixNPTCauchy::extract(const char *str, int &dim) } else if (pstat_flag && strcmp(str,"p_target") == 0) { return &p_target; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-MISC/fix_orient_eco.cpp b/src/USER-MISC/fix_orient_eco.cpp index 5f1582d580c516e0b72db9ece8b161b5ee82e75d..2d8d16e405926cce13edf9725c0b7afd8d966be9 100644 --- a/src/USER-MISC/fix_orient_eco.cpp +++ b/src/USER-MISC/fix_orient_eco.cpp @@ -61,7 +61,7 @@ struct FixOrientECO::Nbr { FixOrientECO::FixOrientECO(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - dir_filename(NULL), order(NULL), nbr(NULL), list(NULL) + dir_filename(nullptr), order(nullptr), nbr(nullptr), list(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_orient_eco); @@ -96,7 +96,7 @@ FixOrientECO::FixOrientECO(LAMMPS *lmp, int narg, char **arg) : int count; FILE *infile = utils::open_potential(dir_filename,lmp,nullptr); - if (infile == NULL) + if (infile == nullptr) error->one(FLERR,fmt::format("Cannot open fix orient/eco file {}: {}", dir_filename, utils::getsyserror())); for (int i = 0; i < 6; ++i) { diff --git a/src/USER-MISC/fix_pafi.cpp b/src/USER-MISC/fix_pafi.cpp index 1ac0ffb188c8d5b7222164e58616eb5c9316655a..4b107c648630bc1fa93d5e859a121d8f75a2eff5 100644 --- a/src/USER-MISC/fix_pafi.cpp +++ b/src/USER-MISC/fix_pafi.cpp @@ -58,8 +58,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixPAFI::FixPAFI(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), computename(NULL), random(NULL), - h(NULL), step_respa(NULL) + Fix(lmp, narg, arg), computename(nullptr), random(nullptr), + h(nullptr), step_respa(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_pafi_package); diff --git a/src/USER-MISC/fix_pimd.cpp b/src/USER-MISC/fix_pimd.cpp index f07a89b9644079ab7f6431288c4293fd52acbf83..9d1eb7a39f431242a9a5b9a979adbffeb55ed1f2 100644 --- a/src/USER-MISC/fix_pimd.cpp +++ b/src/USER-MISC/fix_pimd.cpp @@ -87,27 +87,27 @@ FixPIMD::FixPIMD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) /* Initiation */ max_nsend = 0; - tag_send = NULL; - buf_send = NULL; + tag_send = nullptr; + buf_send = nullptr; max_nlocal = 0; - buf_recv = NULL; - buf_beads = NULL; + buf_recv = nullptr; + buf_beads = nullptr; size_plan = 0; - plan_send = plan_recv = NULL; + plan_send = plan_recv = nullptr; - M_x2xp = M_xp2x = M_f2fp = M_fp2f = NULL; - lam = NULL; - mode_index = NULL; + M_x2xp = M_xp2x = M_f2fp = M_fp2f = nullptr; + lam = nullptr; + mode_index = nullptr; - mass = NULL; + mass = nullptr; - array_atom = NULL; - nhc_eta = NULL; - nhc_eta_dot = NULL; - nhc_eta_dotdot = NULL; - nhc_eta_mass = NULL; + array_atom = nullptr; + nhc_eta = nullptr; + nhc_eta_dot = nullptr; + nhc_eta_dotdot = nullptr; + nhc_eta_mass = nullptr; size_peratom_cols = 12 * nhc_nchain + 3; @@ -601,7 +601,7 @@ void FixPIMD::comm_init() } buf_beads = new double* [np]; - for(int i=0; iall(FLERR, "Illegal fix propel/self command"); diff --git a/src/USER-MISC/fix_srp.cpp b/src/USER-MISC/fix_srp.cpp index b5956b98fd3daf9dc9443901dbc59abe4c245483..f0212affb2e53b2e0b9337ebf0cea1547d721f57 100644 --- a/src/USER-MISC/fix_srp.cpp +++ b/src/USER-MISC/fix_srp.cpp @@ -55,7 +55,7 @@ FixSRP::FixSRP(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) // initial allocation of atom-based array // register with Atom class - array = NULL; + array = nullptr; grow_arrays(atom->nmax); // extends pack_exchange() @@ -100,7 +100,7 @@ int FixSRP::setmask() void FixSRP::init() { - if (force->pair_match("hybrid",1) == NULL && force->pair_match("hybrid/overlay",1) == NULL) + if (force->pair_match("hybrid",1) == nullptr && force->pair_match("hybrid/overlay",1) == nullptr) error->all(FLERR,"Cannot use pair srp without pair_style hybrid"); int has_rigid = 0; diff --git a/src/USER-MISC/fix_ti_spring.cpp b/src/USER-MISC/fix_ti_spring.cpp index 8197b267e95408d3f1a69dd4665c53740b688abb..ceed99273e7fa88ced0745bacdebdd3e37deca73 100644 --- a/src/USER-MISC/fix_ti_spring.cpp +++ b/src/USER-MISC/fix_ti_spring.cpp @@ -74,7 +74,7 @@ FixTISpring::FixTISpring(LAMMPS *lmp, int narg, char **arg) : // Perform initial allocation of atom-based array // Register with Atom class - xoriginal = NULL; + xoriginal = nullptr; grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); atom->add_callback(Atom::RESTART); diff --git a/src/USER-MISC/fix_ttm_mod.cpp b/src/USER-MISC/fix_ttm_mod.cpp index 7a6494f0a3c7d7c59b98ae891d3473eb58221e71..9d8d8f5ea7e330e9c6eaa8fefddf95fa9d6713f6 100644 --- a/src/USER-MISC/fix_ttm_mod.cpp +++ b/src/USER-MISC/fix_ttm_mod.cpp @@ -67,11 +67,11 @@ static const char cite_fix_ttm_mod[] = FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - random(NULL), fp(NULL), nsum(NULL), nsum_all(NULL), - gfactor1(NULL), gfactor2(NULL), ratio(NULL), flangevin(NULL), - T_electron(NULL), T_electron_old(NULL), sum_vsq(NULL), sum_mass_vsq(NULL), - sum_vsq_all(NULL), sum_mass_vsq_all(NULL), net_energy_transfer(NULL), - net_energy_transfer_all(NULL) + random(nullptr), fp(nullptr), nsum(nullptr), nsum_all(nullptr), + gfactor1(nullptr), gfactor2(nullptr), ratio(nullptr), flangevin(nullptr), + T_electron(nullptr), T_electron_old(nullptr), sum_vsq(nullptr), sum_mass_vsq(nullptr), + sum_vsq_all(nullptr), sum_mass_vsq_all(nullptr), net_energy_transfer(nullptr), + net_energy_transfer_all(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_fix_ttm_mod); @@ -103,7 +103,7 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : if (narg != 11) error->all(FLERR,"Illegal fix ttm/mod command"); if (comm->me == 0) { fp = fopen(arg[10],"w"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix ttm/mod file %s",arg[10]); error->one(FLERR,str); @@ -151,7 +151,7 @@ FixTTMMod::FixTTMMod(LAMMPS *lmp, int narg, char **arg) : "ttm/mod:net_energy_transfer"); memory->create(net_energy_transfer_all,nxnodes,nynodes,nznodes, "ttm/mod:net_energy_transfer_all"); - flangevin = NULL; + flangevin = nullptr; grow_arrays(atom->nmax); // zero out the flangevin array @@ -560,7 +560,7 @@ void FixTTMMod::read_initial_electron_temperatures(const char *filename) int ixnode,iynode,iznode; double T_tmp; while (1) { - if (fgets(line,MAXLINE,fpr) == NULL) break; + if (fgets(line,MAXLINE,fpr) == nullptr) break; ValueTokenizer values(line); if (values.has_next()) ixnode = values.next_int(); if (values.has_next()) iynode = values.next_int(); diff --git a/src/USER-MISC/fix_wall_reflect_stochastic.cpp b/src/USER-MISC/fix_wall_reflect_stochastic.cpp index 9a8454b0173a94d8979aec55fde31e428c427bf1..6c3a58bc387d9a4dad86a01e1e21342ccf9fa9b7 100644 --- a/src/USER-MISC/fix_wall_reflect_stochastic.cpp +++ b/src/USER-MISC/fix_wall_reflect_stochastic.cpp @@ -38,7 +38,7 @@ enum{NONE,DIFFUSIVE,MAXWELL,CCL}; FixWallReflectStochastic:: FixWallReflectStochastic(LAMMPS *lmp, int narg, char **arg) : - FixWallReflect(lmp, narg, arg), random(NULL) + FixWallReflect(lmp, narg, arg), random(nullptr) { if (narg < 8) error->all(FLERR,"Illegal fix wall/reflect/stochastic command"); diff --git a/src/USER-MISC/improper_cossq.cpp b/src/USER-MISC/improper_cossq.cpp index 57149312154eb13301545b645aa33afbd3a8f990..9f6e7f114b0a04f11dcf37bd1a171801c8665913 100644 --- a/src/USER-MISC/improper_cossq.cpp +++ b/src/USER-MISC/improper_cossq.cpp @@ -302,8 +302,8 @@ void ImproperCossq::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/improper_distance.cpp b/src/USER-MISC/improper_distance.cpp index 476cf8ab43c558bd5d6866f4906ca158140b96c9..cbdb5130e9466ae46678846a1720466f7873abef 100644 --- a/src/USER-MISC/improper_distance.cpp +++ b/src/USER-MISC/improper_distance.cpp @@ -248,8 +248,8 @@ void ImproperDistance::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/improper_fourier.cpp b/src/USER-MISC/improper_fourier.cpp index 85f7809a028eb9f97fbda711089081ad53fd8b85..8f54c8b7aaf40e39c2b6a43ad513ca460158ea3c 100644 --- a/src/USER-MISC/improper_fourier.cpp +++ b/src/USER-MISC/improper_fourier.cpp @@ -326,11 +326,11 @@ void ImproperFourier::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&C0[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&C1[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&C2[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&all[1],sizeof(int),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&C0[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&C1[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&C2[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&all[1],sizeof(int),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&C0[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/improper_ring.cpp b/src/USER-MISC/improper_ring.cpp index c85e4850c839a899e237216a8ef814c94916ad99..b2a71b10a20f68b1209ae80afd935590de1d7e15 100644 --- a/src/USER-MISC/improper_ring.cpp +++ b/src/USER-MISC/improper_ring.cpp @@ -326,8 +326,8 @@ void ImproperRing::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/pair_agni.cpp b/src/USER-MISC/pair_agni.cpp index 41f9bc953172bc11b656ae21ae21c1c986938d54..0361942af15980c3c811248392bd96b7e90fc567 100644 --- a/src/USER-MISC/pair_agni.cpp +++ b/src/USER-MISC/pair_agni.cpp @@ -85,11 +85,11 @@ PairAGNI::PairAGNI(LAMMPS *lmp) : Pair(lmp) no_virial_fdotr_compute = 1; nelements = 0; - elements = NULL; - elem2param = NULL; + elements = nullptr; + elem2param = nullptr; nparams = 0; - params = NULL; - map = NULL; + params = nullptr; + map = nullptr; cutmax = 0.0; } @@ -114,7 +114,7 @@ PairAGNI::~PairAGNI() delete [] params[i].yU; } memory->destroy(params); - params = NULL; + params = nullptr; } if (allocated) { @@ -266,7 +266,7 @@ void PairAGNI::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -275,7 +275,7 @@ void PairAGNI::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -348,7 +348,7 @@ double PairAGNI::init_one(int i, int j) void PairAGNI::read_file(char *file) { memory->sfree(params); - params = NULL; + params = nullptr; nparams = 0; // open file on proc 0 only @@ -357,7 +357,7 @@ void PairAGNI::read_file(char *file) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open AGNI potential file %s",file); error->one(FLERR,str); @@ -373,7 +373,7 @@ void PairAGNI::read_file(char *file) n = 0; if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -396,7 +396,7 @@ void PairAGNI::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; --nwords; if ((nwords == 2) && (strcmp(words[0],"generation") == 0)) { diff --git a/src/USER-MISC/pair_buck_mdf.cpp b/src/USER-MISC/pair_buck_mdf.cpp index 9ef96f1188fb02bde50a7f46e411cd6400d5d395..8c1114c4dd527223f1984e26a1499d09d6478b3e 100644 --- a/src/USER-MISC/pair_buck_mdf.cpp +++ b/src/USER-MISC/pair_buck_mdf.cpp @@ -304,15 +304,15 @@ void PairBuckMDF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -343,11 +343,11 @@ void PairBuckMDF::write_restart_settings(FILE *fp) void PairBuckMDF::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_inner_global,1,MPI_DOUBLE,0,world); @@ -396,5 +396,5 @@ void *PairBuckMDF::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"a") == 0) return (void *) a; if (strcmp(str,"c") == 0) return (void *) c; - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_cosine_squared.cpp b/src/USER-MISC/pair_cosine_squared.cpp index 1203cea5f27caa935516babec014524d311d06fd..84383c102f6087333239281291e9f3c4c8fe98ef 100644 --- a/src/USER-MISC/pair_cosine_squared.cpp +++ b/src/USER-MISC/pair_cosine_squared.cpp @@ -271,14 +271,14 @@ void PairCosineSquared::read_restart(FILE *fp) for (i = 1; i <= atom->ntypes; i++) { for (j = i; j <= atom->ntypes; j++) { if (me == 0) - utils::sfread(FLERR,&setflag[i][j], sizeof(int), 1, fp,NULL,error); + utils::sfread(FLERR,&setflag[i][j], sizeof(int), 1, fp,nullptr,error); MPI_Bcast(&setflag[i][j], 1, MPI_INT, 0, world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j], sizeof(double), 1, fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j], sizeof(double), 1, fp,NULL,error); - utils::sfread(FLERR,&cut[i][j], sizeof(double), 1, fp,NULL,error); - utils::sfread(FLERR,&wcaflag[i][j], sizeof(int), 1, fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j], sizeof(double), 1, fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j], sizeof(double), 1, fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j], sizeof(double), 1, fp,nullptr,error); + utils::sfread(FLERR,&wcaflag[i][j], sizeof(int), 1, fp,nullptr,error); } MPI_Bcast(&epsilon[i][j], 1, MPI_DOUBLE, 0, world); MPI_Bcast(&sigma[i][j], 1, MPI_DOUBLE, 0, world); @@ -306,7 +306,7 @@ void PairCosineSquared::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global, sizeof(double), 1, fp,NULL,error); + utils::sfread(FLERR,&cut_global, sizeof(double), 1, fp,nullptr,error); } MPI_Bcast(&cut_global, 1, MPI_DOUBLE, 0, world); } diff --git a/src/USER-MISC/pair_coul_diel.cpp b/src/USER-MISC/pair_coul_diel.cpp index 5a3e12f1a5ed3800d539a45353ea1ff69748e9a7..35995717bdfc80f3d125948f5aa1e1c31bdf3c5a 100644 --- a/src/USER-MISC/pair_coul_diel.cpp +++ b/src/USER-MISC/pair_coul_diel.cpp @@ -281,13 +281,13 @@ void PairCoulDiel::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&rme[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigmae[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&rme[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigmae[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&rme[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigmae[i][j],1,MPI_DOUBLE,0,world); @@ -314,9 +314,9 @@ void PairCoulDiel::write_restart_settings(FILE *fp) void PairCoulDiel::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/USER-MISC/pair_coul_shield.cpp b/src/USER-MISC/pair_coul_shield.cpp index 44ab555b02121643738b78cb4f0471f2aa608702..54e3dbddb82f29930d4b031b59c13ea57dcb0d1f 100644 --- a/src/USER-MISC/pair_coul_shield.cpp +++ b/src/USER-MISC/pair_coul_shield.cpp @@ -297,12 +297,12 @@ void PairCoulShield::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&sigmae[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&sigmae[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&sigmae[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -328,9 +328,9 @@ void PairCoulShield::write_restart_settings(FILE *fp) void PairCoulShield::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/USER-MISC/pair_coul_slater_long.cpp b/src/USER-MISC/pair_coul_slater_long.cpp index 0c94254f481884f523000e98adb346e4447173e5..0f5ee9bd11d8645ee4c72d5c2c229257ed1efd80 100644 --- a/src/USER-MISC/pair_coul_slater_long.cpp +++ b/src/USER-MISC/pair_coul_slater_long.cpp @@ -44,7 +44,7 @@ using namespace LAMMPS_NS; PairCoulSlaterLong::PairCoulSlaterLong(LAMMPS *lmp) : Pair(lmp) { ewaldflag = pppmflag = 1; - //ftable = NULL; + //ftable = nullptr; qdist = 0.0; } @@ -250,13 +250,13 @@ void PairCoulSlaterLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; // setup force tables - // if (ncoultablebits) init_tables(cut_coul,NULL); + // if (ncoultablebits) init_tables(cut_coul,nullptr); } /* ---------------------------------------------------------------------- @@ -415,5 +415,5 @@ void *PairCoulSlaterLong::extract(const char *str, int &dim) dim = 2; return (void *) scale; } - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_drip.cpp b/src/USER-MISC/pair_drip.cpp index 7b56caa20586f17a21dce111190464f1028b58cf..b5b39a65a78091f58d697f03fc0d876298ed5c20 100644 --- a/src/USER-MISC/pair_drip.cpp +++ b/src/USER-MISC/pair_drip.cpp @@ -49,11 +49,11 @@ PairDRIP::PairDRIP(LAMMPS *lmp) : Pair(lmp) restartinfo = 0; manybody_flag = 1; - params = NULL; - nearest3neigh = NULL; - elements = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + nearest3neigh = nullptr; + elements = nullptr; + elem2param = nullptr; + map = nullptr; nelements = 0; cutmax = 0.0; } @@ -68,10 +68,10 @@ PairDRIP::~PairDRIP() delete [] map; } - if (elements != NULL) { + if (elements != nullptr) { for (int i = 0; i < nelements; i++) delete [] elements[i]; delete [] elements; - elements = NULL; + elements = nullptr; } memory->destroy(params); memory->destroy(elem2param); @@ -139,7 +139,7 @@ void PairDRIP::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -148,7 +148,7 @@ void PairDRIP::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -224,7 +224,7 @@ void PairDRIP::read_file(char *filename) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(filename,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open DRIP potential file %s",filename); error->one(FLERR,str); @@ -241,7 +241,7 @@ void PairDRIP::read_file(char *filename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -263,7 +263,7 @@ void PairDRIP::read_file(char *filename) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -283,7 +283,7 @@ void PairDRIP::read_file(char *filename) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement = 1st args // if these 2 args are in element list, then parse this line diff --git a/src/USER-MISC/pair_e3b.cpp b/src/USER-MISC/pair_e3b.cpp index a7ed0fcaad89185c40dc58e69cdf7321a57add93..96aeea66f6dba52a175da493dcce44e1829b808d 100644 --- a/src/USER-MISC/pair_e3b.cpp +++ b/src/USER-MISC/pair_e3b.cpp @@ -50,12 +50,12 @@ PairE3B::PairE3B(LAMMPS *lmp) : Pair(lmp),pairPerAtom(10) pvector = new double[nextra]; allocatedE3B = false; - pairO = NULL; - pairH = NULL; - exps = NULL; - del3 = NULL; - fpair3 = NULL; - sumExp = NULL; + pairO = nullptr; + pairH = nullptr; + exps = nullptr; + del3 = nullptr; + fpair3 = nullptr; + sumExp = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-MISC/pair_edip.cpp b/src/USER-MISC/pair_edip.cpp index 6ccaded35daaf7f5896dd0a958e26ffce641f79f..62d09e0c469d4d71266e162f0e7330e43d7e1092 100644 --- a/src/USER-MISC/pair_edip.cpp +++ b/src/USER-MISC/pair_edip.cpp @@ -52,12 +52,12 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ PairEDIP::PairEDIP(LAMMPS *lmp) : - Pair(lmp), preInvR_ij(NULL), preExp3B_ij(NULL), preExp3BDerived_ij(NULL), - preExp2B_ij(NULL), preExp2BDerived_ij(NULL), prePow2B_ij(NULL), - preForceCoord(NULL), cutoffFunction(NULL), cutoffFunctionDerived(NULL), - pow2B(NULL), exp2B(NULL), exp3B(NULL), qFunctionGrid(NULL), - expMinusBetaZeta_iZeta_iGrid(NULL), tauFunctionGrid(NULL), - tauFunctionDerivedGrid(NULL) + Pair(lmp), preInvR_ij(nullptr), preExp3B_ij(nullptr), preExp3BDerived_ij(nullptr), + preExp2B_ij(nullptr), preExp2BDerived_ij(nullptr), prePow2B_ij(nullptr), + preForceCoord(nullptr), cutoffFunction(nullptr), cutoffFunctionDerived(nullptr), + pow2B(nullptr), exp2B(nullptr), exp3B(nullptr), qFunctionGrid(nullptr), + expMinusBetaZeta_iZeta_iGrid(nullptr), tauFunctionGrid(nullptr), + tauFunctionDerivedGrid(nullptr) { single_enable = 0; restartinfo = 0; @@ -65,10 +65,10 @@ PairEDIP::PairEDIP(LAMMPS *lmp) : manybody_flag = 1; nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; + params = nullptr; + elem2param = nullptr; } /* ---------------------------------------------------------------------- @@ -779,7 +779,7 @@ void PairEDIP::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -788,7 +788,7 @@ void PairEDIP::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -876,7 +876,7 @@ void PairEDIP::read_file(char *file) char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -884,7 +884,7 @@ void PairEDIP::read_file(char *file) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open EDIP potential file %s",file); error->one(FLERR,str); @@ -902,7 +902,7 @@ void PairEDIP::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -924,7 +924,7 @@ void PairEDIP::read_file(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -944,7 +944,7 @@ void PairEDIP::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement,kelement = 1st args // if all 3 args are in element list, then parse this line diff --git a/src/USER-MISC/pair_edip_multi.cpp b/src/USER-MISC/pair_edip_multi.cpp index 4a81a41a260a5b9bf8be046357e62d3eb77002a1..07245b17289975960210d4bf232894ba24621c55 100644 --- a/src/USER-MISC/pair_edip_multi.cpp +++ b/src/USER-MISC/pair_edip_multi.cpp @@ -70,10 +70,10 @@ PairEDIPMulti::PairEDIPMulti(LAMMPS *lmp) : Pair(lmp) manybody_flag = 1; nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; + params = nullptr; + elem2param = nullptr; } /* ---------------------------------------------------------------------- @@ -539,7 +539,7 @@ void PairEDIPMulti::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -548,7 +548,7 @@ void PairEDIPMulti::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -633,7 +633,7 @@ void PairEDIPMulti::read_file(char *file) char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -641,7 +641,7 @@ void PairEDIPMulti::read_file(char *file) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open EDIP potential file %s",file); error->one(FLERR,str); @@ -659,7 +659,7 @@ void PairEDIPMulti::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -681,7 +681,7 @@ void PairEDIPMulti::read_file(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -701,7 +701,7 @@ void PairEDIPMulti::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement,kelement = 1st args // if all 3 args are in element list, then parse this line diff --git a/src/USER-MISC/pair_extep.cpp b/src/USER-MISC/pair_extep.cpp index 0db7f8739aa8d8a689bb992ebb38f6c5eeda7da2..d8fa565ae14038a7d1421e288b49878c73f40709 100644 --- a/src/USER-MISC/pair_extep.cpp +++ b/src/USER-MISC/pair_extep.cpp @@ -52,20 +52,20 @@ PairExTeP::PairExTeP(LAMMPS *lmp) : Pair(lmp) ghostneigh = 1; nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; + params = nullptr; + elem2param = nullptr; maxlocal = 0; - SR_numneigh = NULL; - SR_firstneigh = NULL; - ipage = NULL; + SR_numneigh = nullptr; + SR_firstneigh = nullptr; + ipage = nullptr; pgsize = oneatom = 0; - map = NULL; + map = nullptr; - Nt = NULL; - Nd = NULL; + Nt = nullptr; + Nd = nullptr; } /* ---------------------------------------------------------------------- @@ -467,7 +467,7 @@ void PairExTeP::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -476,7 +476,7 @@ void PairExTeP::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -544,7 +544,7 @@ void PairExTeP::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; @@ -582,7 +582,7 @@ void PairExTeP::read_file(char *file) char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -590,7 +590,7 @@ void PairExTeP::read_file(char *file) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(file,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open ExTeP potential file %s",file); error->one(FLERR,str); @@ -607,7 +607,7 @@ void PairExTeP::read_file(char *file) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -629,7 +629,7 @@ void PairExTeP::read_file(char *file) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -649,7 +649,7 @@ void PairExTeP::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement,kelement = 1st args // if all 3 args are in element list, then parse this line @@ -737,7 +737,7 @@ void PairExTeP::read_file(char *file) if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); //fputs(line,stdout); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -758,7 +758,7 @@ void PairExTeP::read_file(char *file) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); while ((nwords < params_per_line) - && (words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + && (words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // skip line if it is a leftover from the previous section, // which can be identified by having 3 elements (instead of 2) diff --git a/src/USER-MISC/pair_gauss_cut.cpp b/src/USER-MISC/pair_gauss_cut.cpp index c9601c416ec90ce2dd62f5607b2f349a8c983615..d7d7f6864575f7bfebb682e4134398ec0d82e578 100644 --- a/src/USER-MISC/pair_gauss_cut.cpp +++ b/src/USER-MISC/pair_gauss_cut.cpp @@ -301,14 +301,14 @@ void PairGaussCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&hgauss[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rmh[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigmah[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&hgauss[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rmh[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigmah[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&hgauss[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rmh[i][j],1,MPI_DOUBLE,0,world); @@ -337,9 +337,9 @@ void PairGaussCut::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/USER-MISC/pair_ilp_graphene_hbn.cpp b/src/USER-MISC/pair_ilp_graphene_hbn.cpp index 671dcb309dd3ca61723959e9c6a74700c969cb6d..63ba47448acaed97c8378b2e3ac6653bf16a7c13 100644 --- a/src/USER-MISC/pair_ilp_graphene_hbn.cpp +++ b/src/USER-MISC/pair_ilp_graphene_hbn.cpp @@ -54,23 +54,23 @@ PairILPGrapheneHBN::PairILPGrapheneHBN(LAMMPS *lmp) : Pair(lmp) // initialize element to parameter maps nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - cutILPsq = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + cutILPsq = nullptr; + map = nullptr; nmax = 0; maxlocal = 0; - ILP_numneigh = NULL; - ILP_firstneigh = NULL; - ipage = NULL; + ILP_numneigh = nullptr; + ILP_firstneigh = nullptr; + ipage = nullptr; pgsize = oneatom = 0; - normal = NULL; - dnormal = NULL; - dnormdri = NULL; + normal = nullptr; + dnormal = nullptr; + dnormdri = nullptr; // always compute energy offset offset_flag = 1; @@ -167,7 +167,7 @@ void PairILPGrapheneHBN::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -176,7 +176,7 @@ void PairILPGrapheneHBN::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -249,7 +249,7 @@ void PairILPGrapheneHBN::read_file(char *filename) int params_per_line = 13; char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -257,7 +257,7 @@ void PairILPGrapheneHBN::read_file(char *filename) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(filename,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open ILP potential file %s",filename); error->one(FLERR,str); @@ -274,7 +274,7 @@ void PairILPGrapheneHBN::read_file(char *filename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -296,7 +296,7 @@ void PairILPGrapheneHBN::read_file(char *filename) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -316,7 +316,7 @@ void PairILPGrapheneHBN::read_file(char *filename) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement = 1st args // if these 2 args are in element list, then parse this line @@ -414,7 +414,7 @@ void PairILPGrapheneHBN::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; diff --git a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp index 9f986fa101fc19f2dae7249fad64a602eec4b3eb..0804f42b86b709cbaf4487736bd806a8b2df05f1 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_full.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_full.cpp @@ -54,23 +54,23 @@ PairKolmogorovCrespiFull::PairKolmogorovCrespiFull(LAMMPS *lmp) : Pair(lmp) // initialize element to parameter maps nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - cutKCsq = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + cutKCsq = nullptr; + map = nullptr; nmax = 0; maxlocal = 0; - KC_numneigh = NULL; - KC_firstneigh = NULL; - ipage = NULL; + KC_numneigh = nullptr; + KC_firstneigh = nullptr; + ipage = nullptr; pgsize = oneatom = 0; - normal = NULL; - dnormal = NULL; - dnormdri = NULL; + normal = nullptr; + dnormal = nullptr; + dnormdri = nullptr; // always compute energy offset offset_flag = 1; @@ -168,7 +168,7 @@ void PairKolmogorovCrespiFull::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -177,7 +177,7 @@ void PairKolmogorovCrespiFull::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -250,7 +250,7 @@ void PairKolmogorovCrespiFull::read_file(char *filename) int params_per_line = 12; char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -258,7 +258,7 @@ void PairKolmogorovCrespiFull::read_file(char *filename) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(filename,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open KC potential file %s",filename); error->one(FLERR,str); @@ -275,7 +275,7 @@ void PairKolmogorovCrespiFull::read_file(char *filename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -297,7 +297,7 @@ void PairKolmogorovCrespiFull::read_file(char *filename) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -317,7 +317,7 @@ void PairKolmogorovCrespiFull::read_file(char *filename) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement = 1st args // if these 2 args are in element list, then parse this line @@ -415,7 +415,7 @@ void PairKolmogorovCrespiFull::init_style() // create pages if first time or if neighbor pgsize/oneatom has changed int create = 0; - if (ipage == NULL) create = 1; + if (ipage == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; diff --git a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp index 7ce6f8652a29d001492f2e976eef189d0213552c..617a48c0fe0585f3856b4f841dbcf9340c8f6b1b 100644 --- a/src/USER-MISC/pair_kolmogorov_crespi_z.cpp +++ b/src/USER-MISC/pair_kolmogorov_crespi_z.cpp @@ -48,11 +48,11 @@ PairKolmogorovCrespiZ::PairKolmogorovCrespiZ(LAMMPS *lmp) : Pair(lmp) // initialize element to parameter maps nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; // always compute energy offset offset_flag = 1; @@ -232,7 +232,7 @@ void PairKolmogorovCrespiZ::coeff(int narg, char **arg) utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -241,7 +241,7 @@ void PairKolmogorovCrespiZ::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -308,7 +308,7 @@ void PairKolmogorovCrespiZ::read_file(char *filename) int params_per_line = 11; char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -316,7 +316,7 @@ void PairKolmogorovCrespiZ::read_file(char *filename) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(filename,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open KC potential file %s",filename); error->one(FLERR,str); @@ -333,7 +333,7 @@ void PairKolmogorovCrespiZ::read_file(char *filename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -355,7 +355,7 @@ void PairKolmogorovCrespiZ::read_file(char *filename) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -375,7 +375,7 @@ void PairKolmogorovCrespiZ::read_file(char *filename) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement = 1st args // if these 2 args are in element list, then parse this line diff --git a/src/USER-MISC/pair_lebedeva_z.cpp b/src/USER-MISC/pair_lebedeva_z.cpp index b8f9e5c38f19038c84fe5f888b5e670da6a95f03..3168a35ab7c681ffcf2828a83fb685037935e344 100644 --- a/src/USER-MISC/pair_lebedeva_z.cpp +++ b/src/USER-MISC/pair_lebedeva_z.cpp @@ -49,11 +49,11 @@ PairLebedevaZ::PairLebedevaZ(LAMMPS *lmp) : Pair(lmp) // initialize element to parameter maps nelements = 0; - elements = NULL; + elements = nullptr; nparams = maxparam = 0; - params = NULL; - elem2param = NULL; - map = NULL; + params = nullptr; + elem2param = nullptr; + map = nullptr; // always compute energy offset offset_flag = 1; @@ -228,7 +228,7 @@ void PairLebedevaZ::coeff(int narg, char **arg) utils::bounds(FLERR,arg[1],1,atom->ntypes,jlo,jhi,error); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -237,7 +237,7 @@ void PairLebedevaZ::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -304,7 +304,7 @@ void PairLebedevaZ::read_file(char *filename) int params_per_line = 12; char **words = new char*[params_per_line+1]; memory->sfree(params); - params = NULL; + params = nullptr; nparams = maxparam = 0; // open file on proc 0 @@ -312,7 +312,7 @@ void PairLebedevaZ::read_file(char *filename) FILE *fp; if (comm->me == 0) { fp = utils::open_potential(filename,lmp,nullptr); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; sprintf(str,"Cannot open Lebedeva potential file %s",filename); error->one(FLERR,str); @@ -329,7 +329,7 @@ void PairLebedevaZ::read_file(char *filename) while (1) { if (comm->me == 0) { ptr = fgets(line,MAXLINE,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -351,7 +351,7 @@ void PairLebedevaZ::read_file(char *filename) n = strlen(line); if (comm->me == 0) { ptr = fgets(&line[n],MAXLINE-n,fp); - if (ptr == NULL) { + if (ptr == nullptr) { eof = 1; fclose(fp); } else n = strlen(line) + 1; @@ -371,7 +371,7 @@ void PairLebedevaZ::read_file(char *filename) nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + while ((words[nwords++] = strtok(nullptr," \t\n\r\f"))) continue; // ielement,jelement = 1st args // if these 2 args are in element list, then parse this line diff --git a/src/USER-MISC/pair_lennard_mdf.cpp b/src/USER-MISC/pair_lennard_mdf.cpp index 31d32db505ba9a888bed318cdd67b6c2611b1147..23c12ea9ddd462073f03841edb8e5ad690ebe4f1 100644 --- a/src/USER-MISC/pair_lennard_mdf.cpp +++ b/src/USER-MISC/pair_lennard_mdf.cpp @@ -304,14 +304,14 @@ void PairLennardMDF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&aparm[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&bparm[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&aparm[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&bparm[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&aparm[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&bparm[i][j],1,MPI_DOUBLE,0,world); @@ -340,9 +340,9 @@ void PairLennardMDF::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&mix_flag,1,MPI_INT,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); @@ -413,5 +413,5 @@ void *PairLennardMDF::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"a") == 0) return (void *) aparm; if (strcmp(str,"b") == 0) return (void *) bparm; - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_list.cpp b/src/USER-MISC/pair_list.cpp index 2f5e0a3ff726dab2d494c888921c0f49b12a7928..2b9e14ea54f6b7fe6b30c193cbacc7ce164c9014 100644 --- a/src/USER-MISC/pair_list.cpp +++ b/src/USER-MISC/pair_list.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; static const char * const stylename[] = { - "none", "harmonic", "morse", "lj126", NULL + "none", "harmonic", "morse", "lj126", nullptr }; // fast power function for integer exponent > 0 @@ -54,8 +54,8 @@ PairList::PairList(LAMMPS *lmp) : Pair(lmp) restartinfo = 0; respa_enable = 0; cut_global = 0.0; - style = NULL; - params = NULL; + style = nullptr; + params = nullptr; check_flag = 1; } @@ -211,7 +211,7 @@ void PairList::settings(int narg, char **arg) FILE *fp = utils::open_potential(arg[0],lmp,nullptr); char line[1024]; - if (fp == NULL) + if (fp == nullptr) error->all(FLERR,"Cannot open pair list file"); // count lines in file for upper limit of storage needed @@ -238,13 +238,13 @@ void PairList::settings(int narg, char **arg) // get atom ids of pair id1 = ATOTAGINT(ptr); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted pair list file"); id2 = ATOTAGINT(ptr); // get potential type - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted pair list file"); @@ -257,13 +257,13 @@ void PairList::settings(int narg, char **arg) if (strcmp(ptr,stylename[HARM]) == 0) { style[npairs] = HARM; - ptr = strtok(NULL," \t\n\r\f"); - if ((ptr == NULL) || (*ptr == '#')) + ptr = strtok(nullptr," \t\n\r\f"); + if ((ptr == nullptr) || (*ptr == '#')) error->all(FLERR,"Incorrectly formatted harmonic pair parameters"); par.parm.harm.k = utils::numeric(FLERR,ptr,false,lmp); - ptr = strtok(NULL," \t\n\r\f"); - if ((ptr == NULL) || (*ptr == '#')) + ptr = strtok(nullptr," \t\n\r\f"); + if ((ptr == nullptr) || (*ptr == '#')) error->all(FLERR,"Incorrectly formatted harmonic pair parameters"); par.parm.harm.r0 = utils::numeric(FLERR,ptr,false,lmp); @@ -273,17 +273,17 @@ void PairList::settings(int narg, char **arg) } else if (strcmp(ptr,stylename[MORSE]) == 0) { style[npairs] = MORSE; - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted morse pair parameters"); par.parm.morse.d0 = utils::numeric(FLERR,ptr,false,lmp); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted morse pair parameters"); par.parm.morse.alpha = utils::numeric(FLERR,ptr,false,lmp); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted morse pair parameters"); par.parm.morse.r0 = utils::numeric(FLERR,ptr,false,lmp); @@ -294,12 +294,12 @@ void PairList::settings(int narg, char **arg) // 12-6 lj potential style[npairs] = LJ126; - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted 12-6 LJ pair parameters"); par.parm.lj126.epsilon = utils::numeric(FLERR,ptr,false,lmp); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); if (!ptr) error->all(FLERR,"Incorrectly formatted 12-6 LJ pair parameters"); par.parm.lj126.sigma = utils::numeric(FLERR,ptr,false,lmp); @@ -311,8 +311,8 @@ void PairList::settings(int narg, char **arg) } // optional cutoff parameter. if not specified use global value - ptr = strtok(NULL," \t\n\r\f"); - if ((ptr != NULL) && (*ptr != '#')) { + ptr = strtok(nullptr," \t\n\r\f"); + if ((ptr != nullptr) && (*ptr != '#')) { double cut = utils::numeric(FLERR,ptr,false,lmp); par.cutsq = cut*cut; } else { diff --git a/src/USER-MISC/pair_lj_expand_coul_long.cpp b/src/USER-MISC/pair_lj_expand_coul_long.cpp index 92e869e58c345293db63979b5582bb7a4f618004..8951af77cd24d1ab9e4d189a337d1a9f7ba5ba11 100644 --- a/src/USER-MISC/pair_lj_expand_coul_long.cpp +++ b/src/USER-MISC/pair_lj_expand_coul_long.cpp @@ -51,9 +51,9 @@ PairLJExpandCoulLong::PairLJExpandCoulLong(LAMMPS *lmp) : Pair(lmp) ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -710,11 +710,11 @@ void PairLJExpandCoulLong::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -838,14 +838,14 @@ void PairLJExpandCoulLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shift[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shift[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -877,13 +877,13 @@ void PairLJExpandCoulLong::write_restart_settings(FILE *fp) void PairLJExpandCoulLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -997,5 +997,5 @@ void *PairLJExpandCoulLong::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"delta") == 0) return (void *) shift; - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_lj_mdf.cpp b/src/USER-MISC/pair_lj_mdf.cpp index baa0e233f226f9cc08e9683d6fd850b38be65b46..07f58aced134996cfb4c0de5bdbbb11fd94976a2 100644 --- a/src/USER-MISC/pair_lj_mdf.cpp +++ b/src/USER-MISC/pair_lj_mdf.cpp @@ -311,14 +311,14 @@ void PairLJMDF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -345,7 +345,7 @@ void PairLJMDF::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&mix_flag,1,MPI_INT,0,world); } @@ -414,5 +414,5 @@ void *PairLJMDF::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_lj_sf_dipole_sf.cpp b/src/USER-MISC/pair_lj_sf_dipole_sf.cpp index ab845e69d55f01d4bcf136c6663cd5fb372d4f6e..42a2d4bb7c122b11a014714762e663503b5faed0 100644 --- a/src/USER-MISC/pair_lj_sf_dipole_sf.cpp +++ b/src/USER-MISC/pair_lj_sf_dipole_sf.cpp @@ -487,15 +487,15 @@ void PairLJSFDipoleSF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&scale[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&scale[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -524,9 +524,9 @@ void PairLJSFDipoleSF::write_restart_settings(FILE *fp) void PairLJSFDipoleSF::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); @@ -638,5 +638,5 @@ void *PairLJSFDipoleSF::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"scale") == 0) return (void *) scale; - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_local_density.cpp b/src/USER-MISC/pair_local_density.cpp index 404f6e2db1d8fdcaeac6a9e72b48639c2042a8cc..61346a7fdce8c0c4b681d046a7c78fe9736ce5d3 100644 --- a/src/USER-MISC/pair_local_density.cpp +++ b/src/USER-MISC/pair_local_density.cpp @@ -62,28 +62,28 @@ PairLocalDensity::PairLocalDensity(LAMMPS *lmp) : Pair(lmp) // stuff read from tabulated file nLD = 0; nrho = 0; - rho_min = NULL; - rho_max = NULL; - a = NULL; - b = NULL; - c0 = NULL; - c2 = NULL; - c4 = NULL; - c6 = NULL; - uppercut = NULL; - lowercut = NULL; - uppercutsq = NULL; - lowercutsq = NULL; - frho = NULL; - rho = NULL; + rho_min = nullptr; + rho_max = nullptr; + a = nullptr; + b = nullptr; + c0 = nullptr; + c2 = nullptr; + c4 = nullptr; + c6 = nullptr; + uppercut = nullptr; + lowercut = nullptr; + uppercutsq = nullptr; + lowercutsq = nullptr; + frho = nullptr; + rho = nullptr; // splined arrays - frho_spline = NULL; + frho_spline = nullptr; // per-atom arrays nmax = 0; - fp = NULL; - localrho = NULL; + fp = nullptr; + localrho = nullptr; // set comm size needed by this pair comm_forward = 1; @@ -667,7 +667,7 @@ void PairLocalDensity::parse_file(char *filename) { if (me == 0) { fptr = fopen(filename, "r"); - if (fptr == NULL) { + if (fptr == nullptr) { char str[128]; sprintf(str,"Cannot open Local Density potential file %s",filename); error->one(FLERR,str); @@ -724,23 +724,23 @@ void PairLocalDensity::parse_file(char *filename) { for (k = 0; k < nLD; k++) { // parse upper and lower cut values - if (fgets(line,MAXLINE,fptr)==NULL) break; + if (fgets(line,MAXLINE,fptr)==nullptr) break; sscanf(line, "%lf %lf", &lowercut[k], &uppercut[k]); // parse and broadcast central atom filter utils::sfgets(FLERR,line, MAXLINE, fptr,filename,error); char *tmp = strtok(line, " /t/n/r/f"); - while (tmp != NULL) { + while (tmp != nullptr) { a[k][atoi(tmp)] = 1; - tmp = strtok(NULL, " /t/n/r/f"); + tmp = strtok(nullptr, " /t/n/r/f"); } // parse neighbor atom filter utils::sfgets(FLERR,line, MAXLINE, fptr,filename,error); tmp = strtok(line, " /t/n/r/f"); - while (tmp != NULL) { + while (tmp != nullptr) { b[k][atoi(tmp)] = 1; - tmp = strtok(NULL, " /t/n/r/f"); + tmp = strtok(nullptr, " /t/n/r/f"); } // parse min, max and delta rho values diff --git a/src/USER-MISC/pair_meam_spline.cpp b/src/USER-MISC/pair_meam_spline.cpp index 4d9b3866b768aa9dadd90f1ce222b9a2f6fc51ce..3be2a3858b48a3fc1b46cde69719e6a1c82f9c47 100644 --- a/src/USER-MISC/pair_meam_spline.cpp +++ b/src/USER-MISC/pair_meam_spline.cpp @@ -56,24 +56,24 @@ PairMEAMSpline::PairMEAMSpline(LAMMPS *lmp) : Pair(lmp) one_coeff = 1; nelements = 0; - elements = NULL; - map = NULL; + elements = nullptr; + map = nullptr; - Uprime_values = NULL; + Uprime_values = nullptr; nmax = 0; maxNeighbors = 0; - twoBodyInfo = NULL; + twoBodyInfo = nullptr; comm_forward = 1; comm_reverse = 0; - phis = NULL; - Us = NULL; - rhos = NULL; - fs = NULL; - gs = NULL; + phis = nullptr; + Us = nullptr; + rhos = nullptr; + fs = nullptr; + gs = nullptr; - zero_atom_energies = NULL; + zero_atom_energies = nullptr; } /* ---------------------------------------------------------------------- */ @@ -398,7 +398,7 @@ void PairMEAMSpline::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -459,7 +459,7 @@ void PairMEAMSpline::read_file(const char* filename) if(comm->me == 0) { FILE *fp = utils::open_potential(filename,lmp,nullptr); - if(fp == NULL) { + if(fp == nullptr) { char str[1024]; snprintf(str,128,"Cannot open spline MEAM potential file %s", filename); error->one(FLERR,str); @@ -480,8 +480,8 @@ void PairMEAMSpline::read_file(const char* filename) if (strcmp(ptr, "meam/spline") == 0) { isNewFormat = true; // parse the rest of the line! - ptr = strtok(NULL," \t\n\r\f"); - if (ptr == NULL) + ptr = strtok(nullptr," \t\n\r\f"); + if (ptr == nullptr) error->one(FLERR,"Need to include number of atomic species on" " meam/spline line in multi-element potential file"); nelements = atoi(ptr); @@ -493,8 +493,8 @@ void PairMEAMSpline::read_file(const char* filename) delete [] elements; elements = new char*[nelements]; for (int i=0; ione(FLERR, "Not enough atomic species in meam/spline" " line of multi-element potential file"); elements[i] = new char[strlen(ptr)+1]; @@ -674,27 +674,27 @@ void PairMEAMSpline::SplineFunction::parse(FILE* fp, Error* error, // If new format, read the spline format. Should always be "spline3eq" for now. if (isNewFormat) - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); // Parse number of spline knots. - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); int n = atoi(line); if(n < 2) error->one(FLERR,"Invalid number of spline knots in MEAM potential file"); // Parse first derivatives at beginning and end of spline. - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); double d0 = atof(strtok(line, " \t\n\r\f")); - double dN = atof(strtok(NULL, " \t\n\r\f")); + double dN = atof(strtok(nullptr, " \t\n\r\f")); init(n, d0, dN); // Skip line in old format if (!isNewFormat) - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); // Parse knot coordinates. for(int i=0; ione(FLERR,"Invalid knot line in MEAM potential file"); diff --git a/src/USER-MISC/pair_meam_spline.h b/src/USER-MISC/pair_meam_spline.h index 2e6e7e00f3be10d5a561bff977adeccd2eadbcc6..31be826d0d6014eedb2f4ee3e77c29722eef8137 100644 --- a/src/USER-MISC/pair_meam_spline.h +++ b/src/USER-MISC/pair_meam_spline.h @@ -74,7 +74,7 @@ protected: class SplineFunction { public: /// Default constructor. - SplineFunction() : X(NULL), Xs(NULL), Y(NULL), Y2(NULL), Ydelta(NULL), N(0) {} + SplineFunction() : X(nullptr), Xs(nullptr), Y(nullptr), Y2(nullptr), Ydelta(nullptr), N(0) {} /// Destructor. ~SplineFunction() { @@ -205,7 +205,7 @@ protected: double cutoff() const { return X[N-1]; } /// Writes a Gnuplot script that plots the spline function. - void writeGnuplot(const char* filename, const char* title = NULL) const; + void writeGnuplot(const char* filename, const char* title = nullptr) const; /// Broadcasts the spline function parameters to all processors. void communicate(MPI_Comm& world, int me); diff --git a/src/USER-MISC/pair_meam_sw_spline.cpp b/src/USER-MISC/pair_meam_sw_spline.cpp index 0a8aae233a41b18c9a2499687822f8b876568aa6..a8977a09d4cf7e6d7a70aba17c55b783eea7711b 100644 --- a/src/USER-MISC/pair_meam_sw_spline.cpp +++ b/src/USER-MISC/pair_meam_sw_spline.cpp @@ -49,13 +49,13 @@ PairMEAMSWSpline::PairMEAMSWSpline(LAMMPS *lmp) : Pair(lmp) manybody_flag = 1; nelements = 0; - elements = NULL; + elements = nullptr; - Uprime_values = NULL; - //ESWprime_values = NULL; + Uprime_values = nullptr; + //ESWprime_values = nullptr; nmax = 0; maxNeighbors = 0; - twoBodyInfo = NULL; + twoBodyInfo = nullptr; comm_forward = 1; comm_reverse = 0; @@ -393,7 +393,7 @@ void PairMEAMSWSpline::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -402,7 +402,7 @@ void PairMEAMSWSpline::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -461,7 +461,7 @@ void PairMEAMSWSpline::read_file(const char* filename) { if(comm->me == 0) { FILE *fp = utils::open_potential(filename,lmp,nullptr); - if(fp == NULL) { + if(fp == nullptr) { char str[1024]; snprintf(str,1024,"Cannot open spline MEAM potential file %s", filename); error->one(FLERR,str); @@ -601,23 +601,23 @@ void PairMEAMSWSpline::SplineFunction::parse(FILE* fp, Error* error) char line[MAXLINE]; // Parse number of spline knots. - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); int n = atoi(line); if(n < 2) error->one(FLERR,"Invalid number of spline knots in MEAM potential file"); // Parse first derivatives at beginning and end of spline. - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); double d0 = atof(strtok(line, " \t\n\r\f")); - double dN = atof(strtok(NULL, " \t\n\r\f")); + double dN = atof(strtok(nullptr, " \t\n\r\f")); init(n, d0, dN); // Skip line. - utils::sfgets(FLERR,line,MAXLINE,fp,NULL,error); + utils::sfgets(FLERR,line,MAXLINE,fp,nullptr,error); // Parse knot coordinates. for(int i=0; ione(FLERR,"Invalid knot line in MEAM potential file"); diff --git a/src/USER-MISC/pair_meam_sw_spline.h b/src/USER-MISC/pair_meam_sw_spline.h index b4480050db19c62da8ff2ceb36d305bd44caa0b0..1fd59b34a5468e7d026f697b9d8f0a19b89c20fe 100644 --- a/src/USER-MISC/pair_meam_sw_spline.h +++ b/src/USER-MISC/pair_meam_sw_spline.h @@ -62,7 +62,7 @@ protected: public: /// Default constructor. - SplineFunction() : X(NULL), Xs(NULL), Y(NULL), Y2(NULL), Ydelta(NULL), N(0) {} + SplineFunction() : X(nullptr), Xs(nullptr), Y(nullptr), Y2(nullptr), Ydelta(nullptr), N(0) {} /// Destructor. ~SplineFunction() { @@ -188,7 +188,7 @@ protected: double cutoff() const { return X[N-1]; } /// Writes a Gnuplot script that plots the spline function. - void writeGnuplot(const char* filename, const char* title = NULL) const; + void writeGnuplot(const char* filename, const char* title = nullptr) const; /// Broadcasts the spline function parameters to all processors. void communicate(MPI_Comm& world, int me); diff --git a/src/USER-MISC/pair_momb.cpp b/src/USER-MISC/pair_momb.cpp index d534284b578ef8b9bfb44e702d74f79a4bb77052..997e3345376cbf10034b68dd2a8be415f057bd11 100644 --- a/src/USER-MISC/pair_momb.cpp +++ b/src/USER-MISC/pair_momb.cpp @@ -308,16 +308,16 @@ void PairMomb::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rr[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rr[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&d0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&alpha[i][j],1,MPI_DOUBLE,0,world); @@ -349,11 +349,11 @@ void PairMomb::write_restart_settings(FILE *fp) void PairMomb::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sscale,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&dscale,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sscale,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&dscale,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&sscale,1,MPI_DOUBLE,0,world); diff --git a/src/USER-MISC/pair_morse_smooth_linear.cpp b/src/USER-MISC/pair_morse_smooth_linear.cpp index 9f895800df6c58830271330ebc19b400e6c9fa58..73e0bb3c694402df7a105f700f9341591d0b8426 100644 --- a/src/USER-MISC/pair_morse_smooth_linear.cpp +++ b/src/USER-MISC/pair_morse_smooth_linear.cpp @@ -269,14 +269,14 @@ void PairMorseSmoothLinear::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&d0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&alpha[i][j],1,MPI_DOUBLE,0,world); @@ -303,8 +303,8 @@ void PairMorseSmoothLinear::write_restart_settings(FILE *fp) void PairMorseSmoothLinear::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -361,5 +361,5 @@ void *PairMorseSmoothLinear::extract(const char *str, int &dim) if (strcmp(str,"d0") == 0) return (void *) d0; if (strcmp(str,"r0") == 0) return (void *) r0; if (strcmp(str,"alpha") == 0) return (void *) alpha; - return NULL; + return nullptr; } diff --git a/src/USER-MISC/pair_srp.cpp b/src/USER-MISC/pair_srp.cpp index 150895108e805e535cd7bfca564e0713d6397571..d26a0b28df29e398cd9712ab9b932ce005f2c616 100644 --- a/src/USER-MISC/pair_srp.cpp +++ b/src/USER-MISC/pair_srp.cpp @@ -76,7 +76,7 @@ PairSRP::PairSRP(LAMMPS *lmp) : Pair(lmp) if (lmp->citeme) lmp->citeme->add(cite_srp); nextra = 1; - segment = NULL; + segment = nullptr; // generate unique fix-id for this pair style instance @@ -704,12 +704,12 @@ void PairSRP::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -737,12 +737,12 @@ void PairSRP::write_restart_settings(FILE *fp) void PairSRP::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&bptype,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&btype,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&min,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&midpoint,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&exclude,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&bptype,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&btype,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&min,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&midpoint,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&exclude,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); } diff --git a/src/USER-MISC/pair_tersoff_table.cpp b/src/USER-MISC/pair_tersoff_table.cpp index 1f5cfddff162891ee6f034b4e00cedecdd3dfd2d..bc6be2d399bc2687bf7afe9bb99715a55b8d263b 100644 --- a/src/USER-MISC/pair_tersoff_table.cpp +++ b/src/USER-MISC/pair_tersoff_table.cpp @@ -755,7 +755,7 @@ void PairTersoffTable::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -764,7 +764,7 @@ void PairTersoffTable::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { diff --git a/src/USER-MISC/temper_grem.cpp b/src/USER-MISC/temper_grem.cpp index 8d7a4ee2c98e63cbea2d657a6dcb3d8fb43033d7..c3c6d89fb697086228cc28fb6d4ff34a5cb6a623 100644 --- a/src/USER-MISC/temper_grem.cpp +++ b/src/USER-MISC/temper_grem.cpp @@ -167,7 +167,7 @@ void TemperGrem::command(int narg, char **arg) // warm up Boltzmann RNG if (seed_swap) ranswap = new RanPark(lmp,seed_swap); - else ranswap = NULL; + else ranswap = nullptr; ranboltz = new RanPark(lmp,seed_boltz + me_universe); for (int i = 0; i < 100; i++) ranboltz->uniform(); diff --git a/src/USER-MISC/temper_npt.cpp b/src/USER-MISC/temper_npt.cpp index 69f4559cacd24573a22774c415dc7e0f6831869b..288be333f7134cfad418e1b54e73eb229d57a29f 100644 --- a/src/USER-MISC/temper_npt.cpp +++ b/src/USER-MISC/temper_npt.cpp @@ -148,7 +148,7 @@ void TemperNPT::command(int narg, char **arg) // warm up Boltzmann RNG if (seed_swap) ranswap = new RanPark(lmp,seed_swap); - else ranswap = NULL; + else ranswap = nullptr; ranboltz = new RanPark(lmp,seed_boltz + me_universe); for (int i = 0; i < 100; i++) ranboltz->uniform(); diff --git a/src/USER-MOFFF/angle_class2_p6.cpp b/src/USER-MOFFF/angle_class2_p6.cpp index 7ef134405def640ffa6b5f32ae8fd9e99a1c6aaf..4909746571390799cbb1415d29951d96eba0bb71 100644 --- a/src/USER-MOFFF/angle_class2_p6.cpp +++ b/src/USER-MOFFF/angle_class2_p6.cpp @@ -386,21 +386,21 @@ void AngleClass2P6::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k3[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k4[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k5[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&k6[1],sizeof(double),atom->nangletypes,fp,NULL,error); - - utils::sfread(FLERR,&bb_k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&bb_r1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&bb_r2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - - utils::sfread(FLERR,&ba_k1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ba_k2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ba_r1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&ba_r2[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k3[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k4[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k5[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&k6[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + + utils::sfread(FLERR,&bb_k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&bb_r1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&bb_r2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + + utils::sfread(FLERR,&ba_k1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ba_k2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ba_r1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&ba_r2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MOFFF/angle_cosine_buck6d.cpp b/src/USER-MOFFF/angle_cosine_buck6d.cpp index 1bede58751d2fa73cd8855bc6c7a41ac592f43c7..7d08467be4560da334f9404300c6cf70e5bd12c1 100644 --- a/src/USER-MOFFF/angle_cosine_buck6d.cpp +++ b/src/USER-MOFFF/angle_cosine_buck6d.cpp @@ -281,7 +281,7 @@ void AngleCosineBuck6d::init_style() { // set local ptrs to buck6d 13 arrays setup by Pair int itmp; - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Angle cosine/buck6d is incompatible with Pair style"); cut_ljsq = (double **) force->pair->extract("cut_ljsq",itmp); buck6d1 = (double **) force->pair->extract("buck6d1",itmp); @@ -332,9 +332,9 @@ void AngleCosineBuck6d::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&th0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&multiplicity[1],sizeof(int),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&th0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MOFFF/improper_inversion_harmonic.cpp b/src/USER-MOFFF/improper_inversion_harmonic.cpp index bbe6e48a352ab28cf5e9b453df60314774b8f83f..96faebc85c3aa299d32b359aa640deaf69a955ca 100644 --- a/src/USER-MOFFF/improper_inversion_harmonic.cpp +++ b/src/USER-MOFFF/improper_inversion_harmonic.cpp @@ -313,8 +313,8 @@ void ImproperInversionHarmonic::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&kw[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&w0[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&kw[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&w0[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&kw[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&w0[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp b/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp index 0de5423d30174328cbeed628b52a9aff7e21898e..1e6a0417e98c8b09d62ce6e2d588ff8e4e329726 100644 --- a/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp +++ b/src/USER-MOFFF/pair_buck6d_coul_gauss_dsf.cpp @@ -415,16 +415,16 @@ void PairBuck6dCoulGaussDSF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&buck6d1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck6d2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck6d3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck6d4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha_ij[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&buck6d1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck6d2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck6d3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck6d4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha_ij[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&buck6d1[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&buck6d2[i][j],1,MPI_DOUBLE,0,world); @@ -457,12 +457,12 @@ void PairBuck6dCoulGaussDSF::write_restart_settings(FILE *fp) void PairBuck6dCoulGaussDSF::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&vdwl_smooth,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&vdwl_smooth,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&vdwl_smooth,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); @@ -584,5 +584,5 @@ void *PairBuck6dCoulGaussDSF::extract(const char *str, int &dim) dim = 0; return (void *) &cut_coul; } - return NULL; + return nullptr; } diff --git a/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp b/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp index c6ba832fff44398fb29ebace665628c97652ef42..3286abe773158ff76bec9f2cee022e818b9110aa 100644 --- a/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp +++ b/src/USER-MOFFF/pair_buck6d_coul_gauss_long.cpp @@ -331,7 +331,7 @@ void PairBuck6dCoulGaussLong::init_style() // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -447,16 +447,16 @@ void PairBuck6dCoulGaussLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&buck6d1[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck6d2[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck6d3[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&buck6d4[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha_ij[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&buck6d1[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck6d2[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck6d3[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&buck6d4[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha_ij[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&buck6d1[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&buck6d2[i][j],1,MPI_DOUBLE,0,world); @@ -490,13 +490,13 @@ void PairBuck6dCoulGaussLong::write_restart_settings(FILE *fp) void PairBuck6dCoulGaussLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&vdwl_smooth,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&coul_smooth,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&vdwl_smooth,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&coul_smooth,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&vdwl_smooth,1,MPI_DOUBLE,0,world); MPI_Bcast(&coul_smooth,1,MPI_DOUBLE,0,world); @@ -639,5 +639,5 @@ void *PairBuck6dCoulGaussLong::extract(const char *str, int &dim) dim = 0; return (void *) &cut_coul; } - return NULL; + return nullptr; } diff --git a/src/USER-MOLFILE/dump_molfile.cpp b/src/USER-MOLFILE/dump_molfile.cpp index f83477833e06fc879f4695ce36e111f4b8d09541..6b25d62f33666415b3da66bf686b52767c2c01bc 100644 --- a/src/USER-MOLFILE/dump_molfile.cpp +++ b/src/USER-MOLFILE/dump_molfile.cpp @@ -72,10 +72,10 @@ DumpMolfile::DumpMolfile(LAMMPS *lmp, int narg, char **arg) ntotal = 0; me = comm->me; - coords = vels = masses = charges = radiuses = NULL; - types = molids = NULL; + coords = vels = masses = charges = radiuses = nullptr; + types = molids = nullptr; ntypes = atom->ntypes; - typenames = NULL; + typenames = nullptr; // allocate global array for atom coords @@ -132,7 +132,7 @@ DumpMolfile::~DumpMolfile() delete [] typenames[i]; delete [] typenames; - typenames = NULL; + typenames = nullptr; } } @@ -146,7 +146,7 @@ void DumpMolfile::init_style() if (me == 0) { /* initialize typenames array to numeric types by default */ - if (typenames == NULL) { + if (typenames == nullptr) { typenames = new char*[ntypes+1]; for (int itype = 1; itype <= ntypes; itype++) { /* a 32-bit int can be maximally 10 digits plus sign */ @@ -408,7 +408,7 @@ void DumpMolfile::write_data(int n, double *mybuf) need_structure = 0; } double simtime = update->ntimestep * update->dt; - mf->timestep(coords,NULL,cell,&simtime); + mf->timestep(coords,nullptr,cell,&simtime); } } } @@ -433,7 +433,7 @@ int DumpMolfile::modify_param(int narg, char **arg) delete [] typenames[i]; delete [] typenames; - typenames = NULL; + typenames = nullptr; } typenames = new char*[ntypes+1]; diff --git a/src/USER-MOLFILE/molfile_interface.cpp b/src/USER-MOLFILE/molfile_interface.cpp index 90a5781fff856ac11aacbec2f88436a295e88aa9..485be5172d8a03c7e8bf5734d009e9c23d9ac296 100644 --- a/src/USER-MOLFILE/molfile_interface.cpp +++ b/src/USER-MOLFILE/molfile_interface.cpp @@ -175,7 +175,7 @@ extern "C" { int i, ind; char atom[3]; - if (label != NULL) { + if (label != nullptr) { /* zap string */ atom[0] = atom[1] = atom[2] = '\0'; @@ -217,8 +217,8 @@ extern "C" { dirhandle_t *d; int len; - if (dirname == NULL) - return NULL; + if (dirname == nullptr) + return nullptr; d = new dirhandle_t; len = 2 + strlen(dirname); @@ -237,7 +237,7 @@ extern "C" { delete[] d->searchname; delete[] d->name; delete d; - return NULL; + return nullptr; } return d; } @@ -248,13 +248,13 @@ extern "C" { if (FindNextFile(d->h, &(d->fd))) { return d->fd.cFileName; } - return NULL; + return nullptr; } // close directory handle static void my_closedir(dirhandle_t *d) { - if (d->h != NULL) { + if (d->h != nullptr) { FindClose(d->h); } delete[] d->searchname; @@ -293,7 +293,7 @@ extern "C" { dirhandle_t *d; int len; - if (dirname == NULL) return NULL; + if (dirname == nullptr) return nullptr; d = new dirhandle_t; len = 2 + strlen(dirname); @@ -303,10 +303,10 @@ extern "C" { d->dlen = len; d->d = opendir(d->name); - if (d->d == NULL) { + if (d->d == nullptr) { delete[] d->name; delete d; - return NULL; + return nullptr; } return d; } @@ -316,17 +316,17 @@ extern "C" { { struct dirent *p; - if ((p = readdir(d->d)) != NULL) { + if ((p = readdir(d->d)) != nullptr) { return p->d_name; } - return NULL; + return nullptr; } // close directory handle static void my_closedir(dirhandle_t *d) { - if (d->d != NULL) { + if (d->d != nullptr) { closedir(d->d); } delete[] d->name; @@ -374,7 +374,7 @@ MolfileInterface::~MolfileInterface() if (_info) { molfile_atom_t *a = static_cast(_info); delete[] a; - _info = NULL; + _info = nullptr; } delete[] _name; delete[] _type; @@ -392,7 +392,7 @@ int MolfileInterface::find_plugin(const char *pluginpath) #else #define MY_PATHSEP ':' #endif - if (pluginpath == NULL) return E_DIR; + if (pluginpath == nullptr) return E_DIR; plugindir = path = strdup(pluginpath); while (plugindir) { @@ -413,11 +413,11 @@ int MolfileInterface::find_plugin(const char *pluginpath) int len; filename = my_readdir(dir); - if (filename == NULL) break; + if (filename == nullptr) break; // only look at .so files ext = strrchr(filename, '.'); - if (ext == NULL) continue; + if (ext == nullptr) continue; if (strcasecmp(ext,".so") != 0) continue; // construct full pathname of potential DSO @@ -450,14 +450,14 @@ int MolfileInterface::load_plugin(const char *filename) // access shared object dso = my_dlopen(filename); - if (dso == NULL) + if (dso == nullptr) return E_FILE; // check for required plugin symbols void *ifunc = my_dlsym(dso,"vmdplugin_init"); void *rfunc = my_dlsym(dso,"vmdplugin_register"); void *ffunc = my_dlsym(dso,"vmdplugin_fini"); - if (ifunc == NULL || rfunc == NULL || ffunc == NULL) { + if (ifunc == nullptr || rfunc == nullptr || ffunc == nullptr) { my_dlclose(dso); return E_SYMBOL; } @@ -472,7 +472,7 @@ int MolfileInterface::load_plugin(const char *filename) // the callback will be called for each plugin in the DSO and // check the file type. plugin->name will change if successful. plugin_reginfo_t reginfo; - reginfo.p = NULL; + reginfo.p = nullptr; reginfo.name=_type; ((regfunc)rfunc)(®info, plugin_register_cb); @@ -481,7 +481,7 @@ int MolfileInterface::load_plugin(const char *filename) // if the callback found a matching plugin and copied the struct, // its name element will point to a different location now. - if (plugin == NULL) { + if (plugin == nullptr) { retval = E_TYPE; // check if the ABI matches the one used to compile this code @@ -490,16 +490,16 @@ int MolfileInterface::load_plugin(const char *filename) // check if (basic) reading is supported } else if ((_mode & M_READ) && - ( (plugin->open_file_read == NULL) || - (plugin->read_next_timestep == NULL) || - (plugin->close_file_read == NULL) )) { + ( (plugin->open_file_read == nullptr) || + (plugin->read_next_timestep == nullptr) || + (plugin->close_file_read == nullptr) )) { retval = E_MODE; // check if (basic) writing is supported } else if ( (_mode & M_WRITE) && - ( (plugin->open_file_write == NULL) || - (plugin->write_timestep == NULL) || - (plugin->close_file_write == NULL) )) { + ( (plugin->open_file_write == nullptr) || + (plugin->write_timestep == nullptr) || + (plugin->close_file_write == nullptr) )) { retval = E_MODE; // make some additional check, if we @@ -579,7 +579,7 @@ void MolfileInterface::forget_plugin() close(); if (_plugin) - _plugin = NULL; + _plugin = nullptr; if (_dso) { void *ffunc = my_dlsym(_dso,"vmdplugin_fini"); @@ -587,7 +587,7 @@ void MolfileInterface::forget_plugin() ((finifunc)ffunc)(); my_dlclose(_dso); } - _dso = NULL; + _dso = nullptr; delete[] _name; _name = new char[5]; @@ -608,7 +608,7 @@ int MolfileInterface::open(const char *name, int *natoms) else if (_mode & M_READ) _ptr = p->open_file_read(name,_type,natoms); - if (_ptr == NULL) + if (_ptr == nullptr) return E_FILE; _natoms = *natoms; @@ -681,9 +681,9 @@ int MolfileInterface::close() if (_info) { molfile_atom_t *a = static_cast(_info); delete[] a; - _info = NULL; + _info = nullptr; } - _ptr = NULL; + _ptr = nullptr; _natoms = 0; return E_NONE; @@ -704,7 +704,7 @@ int MolfileInterface::timestep(float *coords, float *vels, if (_mode & M_WRITE) { t->coords = coords; t->velocities = vels; - if (cell != NULL) { + if (cell != nullptr) { t->A = cell[0]; t->B = cell[1]; t->C = cell[2]; @@ -729,8 +729,8 @@ int MolfileInterface::timestep(float *coords, float *vels, } else { // no coordinate storage => skip step - if (coords == NULL) { - rv = p->read_next_timestep(_ptr, _natoms, NULL); + if (coords == nullptr) { + rv = p->read_next_timestep(_ptr, _natoms, nullptr); } else { t->coords = coords; t->velocities = vels; @@ -742,7 +742,7 @@ int MolfileInterface::timestep(float *coords, float *vels, t->gamma = 90.0f; t->physical_time = 0.0; rv = p->read_next_timestep(_ptr, _natoms, t); - if (cell != NULL) { + if (cell != nullptr) { cell[0] = t->A; cell[1] = t->B; cell[2] = t->C; @@ -823,7 +823,7 @@ static int read_int_property(molfile_atom_t &a, const int propid) static const char *read_string_property(molfile_atom_t &a, const int propid) { - const char *prop = NULL; + const char *prop = nullptr; int iprop = 0; PROPUPDATE(MolfileInterface::P_NAME,name,prop); PROPUPDATE(MolfileInterface::P_TYPE,type,prop); @@ -910,7 +910,7 @@ static int write_atom_property(molfile_atom_t &a, // set/get atom floating point property int MolfileInterface::property(int propid, int idx, float *prop) { - if ((_info == NULL) || (prop == NULL) || (idx < 0) || (idx >= _natoms)) + if ((_info == nullptr) || (prop == nullptr) || (idx < 0) || (idx >= _natoms)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -927,7 +927,7 @@ int MolfileInterface::property(int propid, int idx, float *prop) // set/get per type floating point property int MolfileInterface::property(int propid, int *types, float *prop) { - if ((_info == NULL) || (types == NULL) || (prop == NULL)) + if ((_info == nullptr) || (types == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -947,7 +947,7 @@ int MolfileInterface::property(int propid, int *types, float *prop) // set/get per atom floating point property int MolfileInterface::property(int propid, float *prop) { - if ((_info == NULL) || (prop == NULL)) + if ((_info == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -968,7 +968,7 @@ int MolfileInterface::property(int propid, float *prop) // set/get atom floating point property int MolfileInterface::property(int propid, int idx, double *prop) { - if ((_info == NULL) || (prop == NULL) || (idx < 0) || (idx >= _natoms)) + if ((_info == nullptr) || (prop == nullptr) || (idx < 0) || (idx >= _natoms)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -985,7 +985,7 @@ int MolfileInterface::property(int propid, int idx, double *prop) // set/get per type floating point property int MolfileInterface::property(int propid, int *types, double *prop) { - if ((_info == NULL) || (types == NULL) || (prop == NULL)) + if ((_info == nullptr) || (types == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1005,7 +1005,7 @@ int MolfileInterface::property(int propid, int *types, double *prop) // set/get per atom floating point property int MolfileInterface::property(int propid, double *prop) { - if ((_info == NULL) || (prop == NULL)) + if ((_info == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1040,7 +1040,7 @@ int MolfileInterface::property(int propid, double *prop) // set/get atom integer property int MolfileInterface::property(int propid, int idx, int *prop) { - if ((_info == NULL) || (prop == NULL) || (idx < 0) || (idx >= _natoms)) + if ((_info == nullptr) || (prop == nullptr) || (idx < 0) || (idx >= _natoms)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1065,7 +1065,7 @@ int MolfileInterface::property(int propid, int idx, int *prop) // set/get per type integer property int MolfileInterface::property(int propid, int *types, int *prop) { - if ((_info == NULL) || (types == NULL) || (prop == NULL)) + if ((_info == nullptr) || (types == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1094,7 +1094,7 @@ int MolfileInterface::property(int propid, int *types, int *prop) // set/get per atom integer property int MolfileInterface::property(int propid, int *prop) { - if ((_info == NULL) || (prop == NULL)) + if ((_info == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1125,7 +1125,7 @@ int MolfileInterface::property(int propid, int *prop) // set/get atom string property int MolfileInterface::property(int propid, int idx, char *prop) { - if ((_info == NULL) || (prop == NULL) || (idx < 0) || (idx >= _natoms)) + if ((_info == nullptr) || (prop == nullptr) || (idx < 0) || (idx >= _natoms)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1143,7 +1143,7 @@ int MolfileInterface::property(int propid, int idx, char *prop) // set/get per type string property int MolfileInterface::property(int propid, int *types, char **prop) { - if ((_info == NULL) || (types == NULL) || (prop == NULL)) + if ((_info == nullptr) || (types == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); @@ -1164,7 +1164,7 @@ int MolfileInterface::property(int propid, int *types, char **prop) // set/get per atom string property int MolfileInterface::property(int propid, char **prop) { - if ((_info == NULL) || (prop == NULL)) + if ((_info == nullptr) || (prop == nullptr)) return P_NONE; molfile_atom_t *a = static_cast(_info); diff --git a/src/USER-MOLFILE/reader_molfile.cpp b/src/USER-MOLFILE/reader_molfile.cpp index d26a4d4ba01b8cdb0ddca7c2db151db652094dc7..c991318118b5779e31a26e5198ac86a74bc824c7 100644 --- a/src/USER-MOLFILE/reader_molfile.cpp +++ b/src/USER-MOLFILE/reader_molfile.cpp @@ -42,11 +42,11 @@ static bool is_smalldiff(const float &val1, const float &val2) ReaderMolfile::ReaderMolfile(LAMMPS *lmp) : Reader(lmp) { - mf = NULL; - coords = NULL; - vels = NULL; - types = NULL; - fieldindex = NULL; + mf = nullptr; + coords = nullptr; + vels = nullptr; + types = nullptr; + fieldindex = nullptr; nstep = 0; needvels = 0; me = comm->me; @@ -156,7 +156,7 @@ int ReaderMolfile::read_time(bigint &ntimestep) int rv; // try to read in the time step (coordinates, velocities and cell only) - rv = mf->timestep(coords, vels, cell, NULL); + rv = mf->timestep(coords, vels, cell, nullptr); if (rv != 0) return 1; // we fake time step numbers. @@ -187,7 +187,7 @@ void ReaderMolfile::skip() match Nfield fields to per-atom column labels allocate and set fieldindex = which column each field maps to fieldtype = X,VX,IZ etc - fieldlabel = user-specified label or NULL if use fieldtype default + fieldlabel = user-specified label or nullptr if use fieldtype default xyz flag = scaledflag if has fieldlabel name, else set by x,xs,xu,xsu only called by proc 0 ------------------------------------------------------------------------- */ diff --git a/src/USER-NETCDF/dump_netcdf.cpp b/src/USER-NETCDF/dump_netcdf.cpp index f936de6d02fbd9206c85c7258e56c16db6b3b24b..c48688df4dbd4680e6670f41c522ceccb66a136b 100644 --- a/src/USER-NETCDF/dump_netcdf.cpp +++ b/src/USER-NETCDF/dump_netcdf.cpp @@ -69,7 +69,7 @@ const int THIS_IS_A_BIGINT = -4; /* ---------------------------------------------------------------------- */ -#define NCERR(x) ncerr(x, NULL, __LINE__) +#define NCERR(x) ncerr(x, nullptr, __LINE__) #define NCERRX(x, descr) ncerr(x, descr, __LINE__) #if !defined(NC_64BIT_DATA) #define NC_64BIT_DATA NC_64BIT_OFFSET @@ -193,13 +193,13 @@ DumpNetCDF::DumpNetCDF(LAMMPS *lmp, int narg, char **arg) : } n_buffer = 0; - int_buffer = NULL; - double_buffer = NULL; + int_buffer = nullptr; + double_buffer = nullptr; double_precision = false; thermo = false; - thermovar = NULL; + thermovar = nullptr; framei = 0; } diff --git a/src/USER-NETCDF/dump_netcdf_mpiio.cpp b/src/USER-NETCDF/dump_netcdf_mpiio.cpp index 19b06329220fbb64fa8a45d13b9d9eef651e7a6f..4288bf6bab5231e8a8f5f96ec5a78146047ca464 100644 --- a/src/USER-NETCDF/dump_netcdf_mpiio.cpp +++ b/src/USER-NETCDF/dump_netcdf_mpiio.cpp @@ -69,7 +69,7 @@ const int THIS_IS_A_BIGINT = -4; /* ---------------------------------------------------------------------- */ -#define NCERR(x) ncerr(x, NULL, __LINE__) +#define NCERR(x) ncerr(x, nullptr, __LINE__) #define NCERRX(x, descr) ncerr(x, descr, __LINE__) #if !defined(NC_64BIT_DATA) #define NC_64BIT_DATA NC_64BIT_OFFSET @@ -190,13 +190,13 @@ DumpNetCDFMPIIO::DumpNetCDFMPIIO(LAMMPS *lmp, int narg, char **arg) : } n_buffer = 0; - int_buffer = NULL; - double_buffer = NULL; + int_buffer = nullptr; + double_buffer = nullptr; double_precision = false; thermo = false; - thermovar = NULL; + thermovar = nullptr; framei = 0; } @@ -767,7 +767,7 @@ void DumpNetCDFMPIIO::write() // pack my data into buf - pack(NULL); + pack(nullptr); // each process writes its data diff --git a/src/USER-OMP/bond_class2_omp.cpp b/src/USER-OMP/bond_class2_omp.cpp index 9c52bdb281887b1881cc78acb6ea19213bd34870..866538dacb69359f4e6577fae3c9e18fbf0bbe16 100644 --- a/src/USER-OMP/bond_class2_omp.cpp +++ b/src/USER-OMP/bond_class2_omp.cpp @@ -56,7 +56,7 @@ void BondClass2OMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_fene_expand_omp.cpp b/src/USER-OMP/bond_fene_expand_omp.cpp index 38df4f50dacb0606ba09a70aea3322e99521d31b..b881ae3b101073742d85ca26c6d467835bb5c664 100644 --- a/src/USER-OMP/bond_fene_expand_omp.cpp +++ b/src/USER-OMP/bond_fene_expand_omp.cpp @@ -57,7 +57,7 @@ void BondFENEExpandOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_fene_omp.cpp b/src/USER-OMP/bond_fene_omp.cpp index 5dde355a767ea784abf37c546da3270fbe7371cb..54a6cd5b3ce716c384b012601f170c7cfab4e0ed 100644 --- a/src/USER-OMP/bond_fene_omp.cpp +++ b/src/USER-OMP/bond_fene_omp.cpp @@ -57,7 +57,7 @@ void BondFENEOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_gromos_omp.cpp b/src/USER-OMP/bond_gromos_omp.cpp index 012737f77d75c8809f25c346c948bce96daafae5..2469329a52d28bec0bbb9c35b43dde4c82f9ee7e 100644 --- a/src/USER-OMP/bond_gromos_omp.cpp +++ b/src/USER-OMP/bond_gromos_omp.cpp @@ -53,7 +53,7 @@ void BondGromosOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_harmonic_omp.cpp b/src/USER-OMP/bond_harmonic_omp.cpp index e8f17d5eae4d3544d1625b9b9ae22c74a933ee8b..e9b2d5b103c11e86e9fb3b72d2de2589028bb252 100644 --- a/src/USER-OMP/bond_harmonic_omp.cpp +++ b/src/USER-OMP/bond_harmonic_omp.cpp @@ -55,7 +55,7 @@ void BondHarmonicOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp b/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp index 61a60fa995a7b4ad931620ff31240602f0f093c9..3d81098d4b0ef8de1a3e23a1fb139af16229d645 100644 --- a/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp +++ b/src/USER-OMP/bond_harmonic_shift_cut_omp.cpp @@ -55,7 +55,7 @@ void BondHarmonicShiftCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_harmonic_shift_omp.cpp b/src/USER-OMP/bond_harmonic_shift_omp.cpp index 50b4ed98a70553dd856fdd0fe1e753625127d9eb..ff85a9f0091dd33d72f475b46560ce0e67a31809 100644 --- a/src/USER-OMP/bond_harmonic_shift_omp.cpp +++ b/src/USER-OMP/bond_harmonic_shift_omp.cpp @@ -55,7 +55,7 @@ void BondHarmonicShiftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_morse_omp.cpp b/src/USER-OMP/bond_morse_omp.cpp index 51586370f5b3f965af7531410a57d45d16d14d4d..352a7e1e41cbedef957ea16c94e635da2832fdf7 100644 --- a/src/USER-OMP/bond_morse_omp.cpp +++ b/src/USER-OMP/bond_morse_omp.cpp @@ -55,7 +55,7 @@ void BondMorseOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_nonlinear_omp.cpp b/src/USER-OMP/bond_nonlinear_omp.cpp index 720d660eae93f19791e0341edc2d97068eae661d..f7330d1f3e70b8cbccc4ee20b1954891197be66f 100644 --- a/src/USER-OMP/bond_nonlinear_omp.cpp +++ b/src/USER-OMP/bond_nonlinear_omp.cpp @@ -55,7 +55,7 @@ void BondNonlinearOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_quartic_omp.cpp b/src/USER-OMP/bond_quartic_omp.cpp index bc1ae96ac99f8a1ece8b85d8502233af140af298..c48c8ae65f3129ea09a249959d27890d93dc80de 100644 --- a/src/USER-OMP/bond_quartic_omp.cpp +++ b/src/USER-OMP/bond_quartic_omp.cpp @@ -61,7 +61,7 @@ void BondQuarticOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/bond_table_omp.cpp b/src/USER-OMP/bond_table_omp.cpp index 3ccc65441acbd3500d66a6e4f39a7238a76abc1d..34f678a2243b53559bdfc164c615b3a96b03fe78 100644 --- a/src/USER-OMP/bond_table_omp.cpp +++ b/src/USER-OMP/bond_table_omp.cpp @@ -55,7 +55,7 @@ void BondTableOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (inum > 0) { if (evflag) { diff --git a/src/USER-OMP/ewald_omp.cpp b/src/USER-OMP/ewald_omp.cpp index d5480d2a9f5895a27513a7e0774160e1eab8258d..5f27c04e63aabc14b9cc01bcaac07e6d3ed2b736 100644 --- a/src/USER-OMP/ewald_omp.cpp +++ b/src/USER-OMP/ewald_omp.cpp @@ -120,7 +120,7 @@ void EwaldOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, nlocal, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, 0, NULL, NULL, NULL, thr); + ev_setup_thr(eflag, vflag, 0, nullptr, nullptr, nullptr, thr); for (i = ifrom; i < ito; i++) { ek[i][0] = 0.0; diff --git a/src/USER-OMP/fix_neigh_history_omp.cpp b/src/USER-OMP/fix_neigh_history_omp.cpp index 7acded0ab255c7c47d3da638d96913f1d123cab8..02da93ab7d7a0af54b4e1e1e84cafab0bd8d07bb 100644 --- a/src/USER-OMP/fix_neigh_history_omp.cpp +++ b/src/USER-OMP/fix_neigh_history_omp.cpp @@ -138,7 +138,7 @@ void FixNeighHistoryOMP::pre_exchange_onesided() n = npartner[i]; partner[i] = ipg.get(n); valuepartner[i] = dpg.get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) + if (partner[i] == nullptr || valuepartner[i] == nullptr) error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } } @@ -276,7 +276,7 @@ void FixNeighHistoryOMP::pre_exchange_newton() n = npartner[i]; partner[i] = ipg.get(n); valuepartner[i] = dpg.get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) + if (partner[i] == nullptr || valuepartner[i] == nullptr) error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } } @@ -289,7 +289,7 @@ void FixNeighHistoryOMP::pre_exchange_newton() n = npartner[i]; partner[i] = ipg.get(n); valuepartner[i] = dpg.get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) { + if (partner[i] == nullptr || valuepartner[i] == nullptr) { error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } } @@ -444,7 +444,7 @@ void FixNeighHistoryOMP::pre_exchange_no_newton() n = npartner[i]; partner[i] = ipg.get(n); valuepartner[i] = dpg.get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) + if (partner[i] == nullptr || valuepartner[i] == nullptr) error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } } diff --git a/src/USER-OMP/fix_omp.cpp b/src/USER-OMP/fix_omp.cpp index ef788dda804ac4cfa684c6a01b897d35153099d1..2bbfa22b998fec90698c34b2b9516f6e7f55295a 100644 --- a/src/USER-OMP/fix_omp.cpp +++ b/src/USER-OMP/fix_omp.cpp @@ -61,7 +61,7 @@ static int get_tid() FixOMP::FixOMP(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - thr(NULL), last_omp_style(NULL), last_pair_hybrid(NULL), + thr(nullptr), last_omp_style(nullptr), last_pair_hybrid(nullptr), _nthr(-1), _neighbor(true), _mixed(false), _reduced(true), _pair_compute_flag(false), _kspace_compute_flag(false) { @@ -203,8 +203,8 @@ void FixOMP::init() thr[i]->_timer_active=-1; } - if ((strstr(update->integrate_style,"respa") != NULL) - && (strstr(update->integrate_style,"respa/omp") == NULL)) + if ((strstr(update->integrate_style,"respa") != nullptr) + && (strstr(update->integrate_style,"respa/omp") == nullptr)) error->all(FLERR,"Need to use respa/omp for r-RESPA with /omp styles"); if (force->pair && force->pair->compute_flag) _pair_compute_flag = true; @@ -213,18 +213,18 @@ void FixOMP::init() else _kspace_compute_flag = false; int check_hybrid, kspace_split; - last_pair_hybrid = NULL; - last_omp_style = NULL; - const char *last_omp_name = NULL; - const char *last_hybrid_name = NULL; - const char *last_force_name = NULL; + last_pair_hybrid = nullptr; + last_omp_style = nullptr; + const char *last_omp_name = nullptr; + const char *last_hybrid_name = nullptr; + const char *last_force_name = nullptr; // support for verlet/split operation. // kspace_split == 0 : regular processing // kspace_split < 0 : master partition, does not do kspace // kspace_split > 0 : slave partition, only does kspace - if (strstr(update->integrate_style,"verlet/split") != NULL) { + if (strstr(update->integrate_style,"verlet/split") != nullptr) { if (universe->iworld == 0) kspace_split = -1; else kspace_split = 1; } else { diff --git a/src/USER-OMP/fix_qeq_comb_omp.cpp b/src/USER-OMP/fix_qeq_comb_omp.cpp index 5b2ee884200ae5ba477dd6c4a7576f9549baabfc..f88dada706bfcc92e6d4129e4cad72b68a4e1b18 100644 --- a/src/USER-OMP/fix_qeq_comb_omp.cpp +++ b/src/USER-OMP/fix_qeq_comb_omp.cpp @@ -48,13 +48,13 @@ void FixQEQCombOMP::init() if (!atom->q_flag) error->all(FLERR,"Fix qeq/comb/omp requires atom attribute q"); - if (NULL != force->pair_match("comb3",0)) + if (nullptr != force->pair_match("comb3",0)) error->all(FLERR,"No support for comb3 currently available in USER-OMP"); comb = (PairComb *) force->pair_match("comb/omp",1); - if (comb == NULL) + if (comb == nullptr) comb = (PairComb *) force->pair_match("comb",1); - if (comb == NULL) + if (comb == nullptr) error->all(FLERR,"Must use pair_style comb or " "comb/omp with fix qeq/comb/omp"); diff --git a/src/USER-OMP/fix_qeq_reax_omp.cpp b/src/USER-OMP/fix_qeq_reax_omp.cpp index 92c1b73e13e99c3d7262021dda1d2a1f95efe575..9a4e900840a4a87c5e084bdc2d7a1179c897f1bd 100644 --- a/src/USER-OMP/fix_qeq_reax_omp.cpp +++ b/src/USER-OMP/fix_qeq_reax_omp.cpp @@ -63,7 +63,7 @@ using namespace FixConst; FixQEqReaxOMP::FixQEqReaxOMP(LAMMPS *lmp, int narg, char **arg) : FixQEqReax(lmp, narg, arg) { - b_temp = NULL; + b_temp = nullptr; // ASPC: Kolafa, J. Comp. Chem., 25(3), 335 (2003) do_aspc = 0; @@ -71,7 +71,7 @@ FixQEqReaxOMP::FixQEqReaxOMP(LAMMPS *lmp, int narg, char **arg) : // Must be consistent with nprev to store history: nprev = aspc_order + 2 aspc_order_max = nprev - 2; aspc_omega = 0.0; - aspc_b = NULL; + aspc_b = nullptr; } FixQEqReaxOMP::~FixQEqReaxOMP() diff --git a/src/USER-OMP/msm_cg_omp.cpp b/src/USER-OMP/msm_cg_omp.cpp index 976ea836108727ac7921d4c38541dcc34638c2a9..1c5acd819f2280ff2bdc9f7917e843dcfc9825af 100644 --- a/src/USER-OMP/msm_cg_omp.cpp +++ b/src/USER-OMP/msm_cg_omp.cpp @@ -46,7 +46,7 @@ enum{FORWARD_RHO,FORWARD_AD,FORWARD_AD_PERATOM}; /* ---------------------------------------------------------------------- */ MSMCGOMP::MSMCGOMP(LAMMPS *lmp) : MSMOMP(lmp), - is_charged(NULL) + is_charged(nullptr) { triclinic_support = 0; diff --git a/src/USER-OMP/pair_adp_omp.cpp b/src/USER-OMP/pair_adp_omp.cpp index 97d94e55130c1fa65989ee1527844a5341d6b416..1197e9ebbe8bb1f8bb2ee24a9deb127f78c1ed51 100644 --- a/src/USER-OMP/pair_adp_omp.cpp +++ b/src/USER-OMP/pair_adp_omp.cpp @@ -71,7 +71,7 @@ void PairADPOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (force->newton_pair) thr->init_adp(nall, rho, mu, lambda); diff --git a/src/USER-OMP/pair_agni_omp.cpp b/src/USER-OMP/pair_agni_omp.cpp index de6903aab90617456b42a75405a9715f8db465b8..401f4a668baec03dac079c3c5019bdf9e0856ff0 100644 --- a/src/USER-OMP/pair_agni_omp.cpp +++ b/src/USER-OMP/pair_agni_omp.cpp @@ -56,7 +56,7 @@ void PairAGNIOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) eval<1>(ifrom, ito, thr); else eval<0>(ifrom, ito, thr); diff --git a/src/USER-OMP/pair_airebo_omp.cpp b/src/USER-OMP/pair_airebo_omp.cpp index 837734d6e493cde3f6defc3c55d9d151571da933..d2c3ef6a098f65497c5f852a82fcc6fa508fad2f 100644 --- a/src/USER-OMP/pair_airebo_omp.cpp +++ b/src/USER-OMP/pair_airebo_omp.cpp @@ -67,7 +67,7 @@ void PairAIREBOOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); FREBO_thr(ifrom,ito,evflag,eflag,vflag_atom,&pv0,thr); if (ljflag) FLJ_thr(ifrom,ito,evflag,eflag,vflag_atom,&pv1,thr); diff --git a/src/USER-OMP/pair_beck_omp.cpp b/src/USER-OMP/pair_beck_omp.cpp index 01e33dc5c519d791d4a27c28ae4ed5d5ae738b64..617c237dd9be69cb1f35ced41acdd5403b252edb 100644 --- a/src/USER-OMP/pair_beck_omp.cpp +++ b/src/USER-OMP/pair_beck_omp.cpp @@ -54,7 +54,7 @@ void PairBeckOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_born_coul_long_omp.cpp b/src/USER-OMP/pair_born_coul_long_omp.cpp index b410c998e10139b113b4f43e4de48464d694b549..be88df3e7ae16a0bf957c4509e64994c57e5392a 100644 --- a/src/USER-OMP/pair_born_coul_long_omp.cpp +++ b/src/USER-OMP/pair_born_coul_long_omp.cpp @@ -61,7 +61,7 @@ void PairBornCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_born_coul_msm_omp.cpp b/src/USER-OMP/pair_born_coul_msm_omp.cpp index 4adba396e8c6199a59b492c6c6e2e76b6f59efc5..b161250df8b1a745a4f39a78b19bc69fa44f2b92 100644 --- a/src/USER-OMP/pair_born_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_born_coul_msm_omp.cpp @@ -59,7 +59,7 @@ void PairBornCoulMSMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_born_coul_wolf_omp.cpp b/src/USER-OMP/pair_born_coul_wolf_omp.cpp index 9bc6507c6a5fe78d221205b41f009f3d3cb011f7..a426bc93d177d9a9e76ec0a5c22d2262ec621edb 100644 --- a/src/USER-OMP/pair_born_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_born_coul_wolf_omp.cpp @@ -54,7 +54,7 @@ void PairBornCoulWolfOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_born_omp.cpp b/src/USER-OMP/pair_born_omp.cpp index e74f0139c18d6ba050a84f23ce467ce069b21663..237685b9d2d4cab29b706f1b076789d953442129 100644 --- a/src/USER-OMP/pair_born_omp.cpp +++ b/src/USER-OMP/pair_born_omp.cpp @@ -52,7 +52,7 @@ void PairBornOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_brownian_omp.cpp b/src/USER-OMP/pair_brownian_omp.cpp index b7b82c3dac1ab38c059020a339cb8f4a22e9b1c9..afd41668ad9614c7fd9b022907e31656ff8d3da6 100644 --- a/src/USER-OMP/pair_brownian_omp.cpp +++ b/src/USER-OMP/pair_brownian_omp.cpp @@ -48,7 +48,7 @@ PairBrownianOMP::PairBrownianOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - random_thr = NULL; + random_thr = nullptr; nthreads = 0; } @@ -61,7 +61,7 @@ PairBrownianOMP::~PairBrownianOMP() delete random_thr[i]; delete[] random_thr; - random_thr = NULL; + random_thr = nullptr; } } @@ -127,7 +127,7 @@ void PairBrownianOMP::compute(int eflag, int vflag) nthreads = comm->nthreads; random_thr = new RanMars*[nthreads]; for (int i=1; i < nthreads; ++i) - random_thr[i] = NULL; + random_thr[i] = nullptr; // to ensure full compatibility with the serial Brownian style // we use is random number generator instance for thread 0 @@ -143,11 +143,11 @@ void PairBrownianOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); // generate a random number generator instance for // all threads != 0. make sure we use unique seeds. - if ((tid > 0) && (random_thr[tid] == NULL)) + if ((tid > 0) && (random_thr[tid] == nullptr)) random_thr[tid] = new RanMars(Pair::lmp, seed + comm->me + comm->nprocs*tid); diff --git a/src/USER-OMP/pair_brownian_poly_omp.cpp b/src/USER-OMP/pair_brownian_poly_omp.cpp index 4d8b4572810f727a68a06066d4ebfcf9dc48624e..6abd276bffb8449237af167670956a527fa95559 100644 --- a/src/USER-OMP/pair_brownian_poly_omp.cpp +++ b/src/USER-OMP/pair_brownian_poly_omp.cpp @@ -48,7 +48,7 @@ PairBrownianPolyOMP::PairBrownianPolyOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - random_thr = NULL; + random_thr = nullptr; nthreads = 0; } @@ -61,7 +61,7 @@ PairBrownianPolyOMP::~PairBrownianPolyOMP() delete random_thr[i]; delete[] random_thr; - random_thr = NULL; + random_thr = nullptr; } } @@ -128,7 +128,7 @@ void PairBrownianPolyOMP::compute(int eflag, int vflag) nthreads = comm->nthreads; random_thr = new RanMars*[nthreads]; for (int i=1; i < nthreads; ++i) - random_thr[i] = NULL; + random_thr[i] = nullptr; // to ensure full compatibility with the serial BrownianPoly style // we use is random number generator instance for thread 0 @@ -144,11 +144,11 @@ void PairBrownianPolyOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); // generate a random number generator instance for // all threads != 0. make sure we use unique seeds. - if ((tid > 0) && (random_thr[tid] == NULL)) + if ((tid > 0) && (random_thr[tid] == nullptr)) random_thr[tid] = new RanMars(Pair::lmp, seed + comm->me + comm->nprocs*tid); diff --git a/src/USER-OMP/pair_buck_coul_cut_omp.cpp b/src/USER-OMP/pair_buck_coul_cut_omp.cpp index 1c433f8083825b954209c7af307729620edcdd24..20a4953ef81f8e6e3e73bc7a1f3f16fadc513930 100644 --- a/src/USER-OMP/pair_buck_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_cut_omp.cpp @@ -53,7 +53,7 @@ void PairBuckCoulCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_buck_coul_long_omp.cpp b/src/USER-OMP/pair_buck_coul_long_omp.cpp index 264073a07e507f093e5f1befc6e7ca1441ef7ec3..f0e7edf71036118b28fa2459385f3479eb126b70 100644 --- a/src/USER-OMP/pair_buck_coul_long_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_long_omp.cpp @@ -61,7 +61,7 @@ void PairBuckCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_buck_coul_msm_omp.cpp b/src/USER-OMP/pair_buck_coul_msm_omp.cpp index 631a1ee61d90d97b04d8f6cc7184d4ba4dc4a66c..dd112ba99cce15090dad4184ba73ca79f9a358c5 100644 --- a/src/USER-OMP/pair_buck_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_buck_coul_msm_omp.cpp @@ -59,7 +59,7 @@ void PairBuckCoulMSMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_buck_long_coul_long_omp.cpp b/src/USER-OMP/pair_buck_long_coul_long_omp.cpp index 00ab1c248c571085c81f95a0f6c1c1389bc45f3e..2b5570097252a0dbed9361d2e085171d068a38bc 100644 --- a/src/USER-OMP/pair_buck_long_coul_long_omp.cpp +++ b/src/USER-OMP/pair_buck_long_coul_long_omp.cpp @@ -41,7 +41,7 @@ PairBuckLongCoulLongOMP::PairBuckLongCoulLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 1; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -66,7 +66,7 @@ void PairBuckLongCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (order6) { if (order1) { @@ -330,7 +330,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, NULL, thr); + ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr); eval_inner(ifrom, ito, thr); thr->timer(Timer::PAIR); @@ -355,7 +355,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, NULL, thr); + ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr); eval_middle(ifrom, ito, thr); thr->timer(Timer::PAIR); @@ -385,7 +385,7 @@ void PairBuckLongCoulLongOMP::compute_outer(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (order6) { if (order1) { diff --git a/src/USER-OMP/pair_buck_omp.cpp b/src/USER-OMP/pair_buck_omp.cpp index bddacaf5b5cc2efe5888fafe632ce987fc93b42e..ab037a204f50a4a279f8c4c7af024d40dbf5262f 100644 --- a/src/USER-OMP/pair_buck_omp.cpp +++ b/src/USER-OMP/pair_buck_omp.cpp @@ -52,7 +52,7 @@ void PairBuckOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_colloid_omp.cpp b/src/USER-OMP/pair_colloid_omp.cpp index 94325232fcbfb174215deab3bcf1c48209ade5ce..4509579549f89a848a9a964a20d2f73254d9d016 100644 --- a/src/USER-OMP/pair_colloid_omp.cpp +++ b/src/USER-OMP/pair_colloid_omp.cpp @@ -56,7 +56,7 @@ void PairColloidOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_comb_omp.cpp b/src/USER-OMP/pair_comb_omp.cpp index 9a0155d6d38cb6528789c50f616971c783a297b2..c07a6948aec8ea25334435bde7f613dddf0e9f56 100644 --- a/src/USER-OMP/pair_comb_omp.cpp +++ b/src/USER-OMP/pair_comb_omp.cpp @@ -63,7 +63,7 @@ void PairCombOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_cut_omp.cpp b/src/USER-OMP/pair_coul_cut_omp.cpp index 57b821cb8bc71d76bbbd6a1a023b460e82203e65..5f4a792c9d4b5ae16943ad9e8ad8173edd3e3d16 100644 --- a/src/USER-OMP/pair_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_coul_cut_omp.cpp @@ -52,7 +52,7 @@ void PairCoulCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_cut_soft_omp.cpp b/src/USER-OMP/pair_coul_cut_soft_omp.cpp index f8b3a36e394cea86c9f8fe423ff091d0f98906b3..36453b1b32c7ac8b5f0be43247dfa9a09fa0e3d5 100644 --- a/src/USER-OMP/pair_coul_cut_soft_omp.cpp +++ b/src/USER-OMP/pair_coul_cut_soft_omp.cpp @@ -53,7 +53,7 @@ void PairCoulCutSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_debye_omp.cpp b/src/USER-OMP/pair_coul_debye_omp.cpp index 1bb8676998d17ba757171c361ccfc6deab3cb0bf..8a3549b7302db2e315657d2f8cf1043f6eec9c7c 100644 --- a/src/USER-OMP/pair_coul_debye_omp.cpp +++ b/src/USER-OMP/pair_coul_debye_omp.cpp @@ -52,7 +52,7 @@ void PairCoulDebyeOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_diel_omp.cpp b/src/USER-OMP/pair_coul_diel_omp.cpp index 62f258042681edb5c92255eb1c09eff0499b1402..f6bdcf8cf866ad9e49628d88125096b2bd80f153 100644 --- a/src/USER-OMP/pair_coul_diel_omp.cpp +++ b/src/USER-OMP/pair_coul_diel_omp.cpp @@ -53,7 +53,7 @@ void PairCoulDielOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_dsf_omp.cpp b/src/USER-OMP/pair_coul_dsf_omp.cpp index 3a8db4563498b2f67cf2941167ccf75c03e16a0c..f7bb7adace1697d8cb6c1932c7009d3bdb4addb0 100644 --- a/src/USER-OMP/pair_coul_dsf_omp.cpp +++ b/src/USER-OMP/pair_coul_dsf_omp.cpp @@ -61,7 +61,7 @@ void PairCoulDSFOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_long_omp.cpp b/src/USER-OMP/pair_coul_long_omp.cpp index 92cb51f7a484346eb11adf2c13241c8e7b995d2f..12b8fdb2f6fb51b368956269f60ac10b20ae99a6 100644 --- a/src/USER-OMP/pair_coul_long_omp.cpp +++ b/src/USER-OMP/pair_coul_long_omp.cpp @@ -40,7 +40,7 @@ PairCoulLongOMP::PairCoulLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -62,7 +62,7 @@ void PairCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_long_soft_omp.cpp b/src/USER-OMP/pair_coul_long_soft_omp.cpp index 28ba13d5cfb8019c27f9d6f3a5a64ef4b1cf309e..0d4dd729db8b4ee9ffbde2e5c93c4ccfb83331dc 100644 --- a/src/USER-OMP/pair_coul_long_soft_omp.cpp +++ b/src/USER-OMP/pair_coul_long_soft_omp.cpp @@ -61,7 +61,7 @@ void PairCoulLongSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_msm_omp.cpp b/src/USER-OMP/pair_coul_msm_omp.cpp index e907d63eb17d27796e0fc7bdb858c24bc1f0b3a7..4c77b85ae4cdea1ab56fcd6fc66c5dae2444a7b6 100644 --- a/src/USER-OMP/pair_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_coul_msm_omp.cpp @@ -34,7 +34,7 @@ PairCoulMSMOMP::PairCoulMSMOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -60,7 +60,7 @@ void PairCoulMSMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_coul_wolf_omp.cpp b/src/USER-OMP/pair_coul_wolf_omp.cpp index 71e8148a50e19714967756b5def81eb0e4e82262..20d45102bd9123d78939c07e47e6f30edec530ad 100644 --- a/src/USER-OMP/pair_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_coul_wolf_omp.cpp @@ -54,7 +54,7 @@ void PairCoulWolfOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_dpd_omp.cpp b/src/USER-OMP/pair_dpd_omp.cpp index 6e3da77cbe6bb8164d586998f6fce380839822df..615908f06cc6b1947c1eae270261c67465f8db88 100644 --- a/src/USER-OMP/pair_dpd_omp.cpp +++ b/src/USER-OMP/pair_dpd_omp.cpp @@ -35,7 +35,7 @@ PairDPDOMP::PairDPDOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - random_thr = NULL; + random_thr = nullptr; nthreads = 0; } @@ -48,7 +48,7 @@ PairDPDOMP::~PairDPDOMP() delete random_thr[i]; delete[] random_thr; - random_thr = NULL; + random_thr = nullptr; } } @@ -73,7 +73,7 @@ void PairDPDOMP::compute(int eflag, int vflag) nthreads = comm->nthreads; random_thr = new RanMars*[nthreads]; for (int i=1; i < nthreads; ++i) - random_thr[i] = NULL; + random_thr[i] = nullptr; // to ensure full compatibility with the serial DPD style // we use the serial random number generator instance for thread 0 @@ -89,11 +89,11 @@ void PairDPDOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); // generate a random number generator instance for // all threads != 0. make sure we use unique seeds. - if ((tid > 0) && (random_thr[tid] == NULL)) + if ((tid > 0) && (random_thr[tid] == nullptr)) random_thr[tid] = new RanMars(Pair::lmp, seed + comm->me + comm->nprocs*tid); diff --git a/src/USER-OMP/pair_dpd_tstat_omp.cpp b/src/USER-OMP/pair_dpd_tstat_omp.cpp index 823367109b2ec8550fbc1f0dc310c4d0baa6a62a..844c79771f79bc7314cd2e775b400d47b1c3fe98 100644 --- a/src/USER-OMP/pair_dpd_tstat_omp.cpp +++ b/src/USER-OMP/pair_dpd_tstat_omp.cpp @@ -36,7 +36,7 @@ PairDPDTstatOMP::PairDPDTstatOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - random_thr = NULL; + random_thr = nullptr; nthreads = 0; } @@ -49,7 +49,7 @@ PairDPDTstatOMP::~PairDPDTstatOMP() delete random_thr[i]; delete[] random_thr; - random_thr = NULL; + random_thr = nullptr; } } @@ -74,7 +74,7 @@ void PairDPDTstatOMP::compute(int eflag, int vflag) nthreads = comm->nthreads; random_thr = new RanMars*[nthreads]; for (int i=1; i < nthreads; ++i) - random_thr[i] = NULL; + random_thr[i] = nullptr; // to ensure full compatibility with the serial DPD style // we use the serial random number generator instance for thread 0 @@ -89,11 +89,11 @@ void PairDPDTstatOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); // generate a random number generator instance for // all threads != 0. make sure we use unique seeds. - if ((tid > 0) && (random_thr[tid] == NULL)) + if ((tid > 0) && (random_thr[tid] == nullptr)) random_thr[tid] = new RanMars(Pair::lmp, seed + comm->me + comm->nprocs*tid); diff --git a/src/USER-OMP/pair_eam_alloy_omp.cpp b/src/USER-OMP/pair_eam_alloy_omp.cpp index c7559420bc06800657da9b157d162d1e410157ef..2f29aced65f5f1179f63947e3ba05d15b17cc517 100644 --- a/src/USER-OMP/pair_eam_alloy_omp.cpp +++ b/src/USER-OMP/pair_eam_alloy_omp.cpp @@ -69,7 +69,7 @@ void PairEAMAlloyOMP::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/USER-OMP/pair_eam_fs_omp.cpp b/src/USER-OMP/pair_eam_fs_omp.cpp index 66a7581c218f5d936158a11346560b68ff43c7d9..a7fd0cac51ce8d2e0cf0e27e6c87d7f21a5aafc8 100644 --- a/src/USER-OMP/pair_eam_fs_omp.cpp +++ b/src/USER-OMP/pair_eam_fs_omp.cpp @@ -69,7 +69,7 @@ void PairEAMFSOMP::coeff(int narg, char **arg) read_file(arg[2]); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" for (i = 3; i < narg; i++) { if (strcmp(arg[i],"NULL") == 0) { diff --git a/src/USER-OMP/pair_eam_omp.cpp b/src/USER-OMP/pair_eam_omp.cpp index e6ba299a4d84d8a0e56c959471dbcd290814a7a0..cbdf03a411b89b1e2182e6d0f5d2757a4c7ada07 100644 --- a/src/USER-OMP/pair_eam_omp.cpp +++ b/src/USER-OMP/pair_eam_omp.cpp @@ -67,7 +67,7 @@ void PairEAMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (force->newton_pair) thr->init_eam(nall, rho); diff --git a/src/USER-OMP/pair_edip_omp.cpp b/src/USER-OMP/pair_edip_omp.cpp index 864ff68f7a375bb3380b85880036f82ea6435b48..d0e84be4cf3977959ae1d87cd72071b8c800ecbd 100644 --- a/src/USER-OMP/pair_edip_omp.cpp +++ b/src/USER-OMP/pair_edip_omp.cpp @@ -58,7 +58,7 @@ void PairEDIPOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_eim_omp.cpp b/src/USER-OMP/pair_eim_omp.cpp index 74b460a788b28d621c7d1052c54b3b261506319e..7e25a14a029c386dbf207127a8ec310aba30c13c 100644 --- a/src/USER-OMP/pair_eim_omp.cpp +++ b/src/USER-OMP/pair_eim_omp.cpp @@ -65,7 +65,7 @@ void PairEIMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (force->newton_pair) thr->init_eim(nall, rho, fp); diff --git a/src/USER-OMP/pair_gauss_cut_omp.cpp b/src/USER-OMP/pair_gauss_cut_omp.cpp index a453915738fb3aea8bcad21c2a5650957c7cd05a..d2a197291a4c10654f1387266574a85f95c36197 100644 --- a/src/USER-OMP/pair_gauss_cut_omp.cpp +++ b/src/USER-OMP/pair_gauss_cut_omp.cpp @@ -53,7 +53,7 @@ void PairGaussCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_gauss_omp.cpp b/src/USER-OMP/pair_gauss_omp.cpp index 3e5777e4ecccc4a6cbe2f67a43263ac6865e2452..919ffbe7968d79cc833944e279274b2ee7bf20bb 100644 --- a/src/USER-OMP/pair_gauss_omp.cpp +++ b/src/USER-OMP/pair_gauss_omp.cpp @@ -55,7 +55,7 @@ void PairGaussOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_gayberne_omp.cpp b/src/USER-OMP/pair_gayberne_omp.cpp index 991c72a9be0b9e590af9936aeaff13089fe39059..d4ee5b26843dd58fd065a8a8e0443dfd55a9ff79 100644 --- a/src/USER-OMP/pair_gayberne_omp.cpp +++ b/src/USER-OMP/pair_gayberne_omp.cpp @@ -53,7 +53,7 @@ void PairGayBerneOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_gran_hertz_history_omp.cpp b/src/USER-OMP/pair_gran_hertz_history_omp.cpp index 9ad84afb920650667ea1e8b16f6bb873aee916be..2506c4e5b3e725fa4b8f0324c309418c8f040dd5 100644 --- a/src/USER-OMP/pair_gran_hertz_history_omp.cpp +++ b/src/USER-OMP/pair_gran_hertz_history_omp.cpp @@ -78,7 +78,7 @@ void PairGranHertzHistoryOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (shearupdate) { diff --git a/src/USER-OMP/pair_gran_hooke_history_omp.cpp b/src/USER-OMP/pair_gran_hooke_history_omp.cpp index 3e519fc0d01c44ba068300280419294e8974e1a3..ec87108716c33f9ff3aebe77157027078b0f379c 100644 --- a/src/USER-OMP/pair_gran_hooke_history_omp.cpp +++ b/src/USER-OMP/pair_gran_hooke_history_omp.cpp @@ -79,7 +79,7 @@ void PairGranHookeHistoryOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (shearupdate) { diff --git a/src/USER-OMP/pair_gran_hooke_omp.cpp b/src/USER-OMP/pair_gran_hooke_omp.cpp index 8de959a91dae94109ff340ca3a5f61e5174f70b8..1965c1676b852b141aec8bcab117248ed68d8dd5 100644 --- a/src/USER-OMP/pair_gran_hooke_omp.cpp +++ b/src/USER-OMP/pair_gran_hooke_omp.cpp @@ -74,7 +74,7 @@ void PairGranHookeOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) if (force->newton_pair) eval<1,1>(ifrom, ito, thr); diff --git a/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp b/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp index 6801e901ff32713a79936b2bcccb2620d3f2b269..68b24a38f07c330ba3e6e247ab5814743efef7bf 100644 --- a/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp +++ b/src/USER-OMP/pair_hbond_dreiding_lj_omp.cpp @@ -41,7 +41,7 @@ PairHbondDreidingLJOMP::PairHbondDreidingLJOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - hbcount_thr = hbeng_thr = NULL; + hbcount_thr = hbeng_thr = nullptr; } /* ---------------------------------------------------------------------- */ @@ -83,7 +83,7 @@ void PairHbondDreidingLJOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp b/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp index 5624b865f5070983f3fe87de9025ca60e5b907e8..aec6798033525752886c6670cd14d21844627dd3 100644 --- a/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp +++ b/src/USER-OMP/pair_hbond_dreiding_morse_omp.cpp @@ -41,7 +41,7 @@ PairHbondDreidingMorseOMP::PairHbondDreidingMorseOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - hbcount_thr = hbeng_thr = NULL; + hbcount_thr = hbeng_thr = nullptr; } /* ---------------------------------------------------------------------- */ @@ -83,7 +83,7 @@ void PairHbondDreidingMorseOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj96_cut_omp.cpp b/src/USER-OMP/pair_lj96_cut_omp.cpp index 5aeec25d13d334834c47e99ed46ca712ded7021d..ddbb7ae8e985102638fab9115524780b983f62d1 100644 --- a/src/USER-OMP/pair_lj96_cut_omp.cpp +++ b/src/USER-OMP/pair_lj96_cut_omp.cpp @@ -32,7 +32,7 @@ PairLJ96CutOMP::PairLJ96CutOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -54,7 +54,7 @@ void PairLJ96CutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp index 3ff02b61093a57480a94c78d49479a74b4ccca79..a7cd7aa76f9e3b0b557491b67543c1ef726a6da8 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_charmm_implicit_omp.cpp @@ -51,7 +51,7 @@ void PairLJCharmmCoulCharmmImplicitOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp index 77caf63f18dec62c33fb2a7766795a514d949e20..03d33a6a8a5811fe7c40c0ae9b598cca681cf9c5 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_charmm_omp.cpp @@ -53,7 +53,7 @@ void PairLJCharmmCoulCharmmOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp index 56cf0a68dd5fdb10250d7eb770e476134cb19e84..ed199dbfd7b2a4b41fcccaec6a0a8ecc5d165776 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_long_omp.cpp @@ -32,7 +32,7 @@ PairLJCharmmCoulLongOMP::PairLJCharmmCoulLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -54,7 +54,7 @@ void PairLJCharmmCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp index e19632dc7ef8c7f5005c93b02b8deb09c2b0c181..932460a6b9aee702fca27fa51f7a5d17f9f9a7f6 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_long_soft_omp.cpp @@ -32,7 +32,7 @@ PairLJCharmmCoulLongSoftOMP::PairLJCharmmCoulLongSoftOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -54,7 +54,7 @@ void PairLJCharmmCoulLongSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp b/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp index a39ef0aa81d7f3b1b58b5acc277b2ded5a92787b..1d9391206c6f307bd4464a3c448f9673967632a3 100644 --- a/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp @@ -34,7 +34,7 @@ PairLJCharmmCoulMSMOMP::PairLJCharmmCoulMSMOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -60,7 +60,7 @@ void PairLJCharmmCoulMSMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp b/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp index 63fb4fe52978910fba7b4f8b5c7195f69c195964..50baa7eb86c1c165f0477473e379299bbdbf1989 100644 --- a/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_coul_cut_omp.cpp @@ -53,7 +53,7 @@ void PairLJClass2CoulCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp b/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp index f618f7f423b8c1db2bfd3ac4393aac4f3a9c195c..85712f22cb322045e0e1755417a1cdd8a3b418f4 100644 --- a/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_coul_long_omp.cpp @@ -40,7 +40,7 @@ PairLJClass2CoulLongOMP::PairLJClass2CoulLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -62,7 +62,7 @@ void PairLJClass2CoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_class2_omp.cpp b/src/USER-OMP/pair_lj_class2_omp.cpp index 39cc320e44934c4e396df5315fa6c2bb335ad6e0..ae2243daa1daeadb131db9a796ed68b09446bac8 100644 --- a/src/USER-OMP/pair_lj_class2_omp.cpp +++ b/src/USER-OMP/pair_lj_class2_omp.cpp @@ -53,7 +53,7 @@ void PairLJClass2OMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cubic_omp.cpp b/src/USER-OMP/pair_lj_cubic_omp.cpp index 27f6132491e43966fa150f6034f20b179cb2de6c..1ccade4e62e6f0bdb6b3c80ee10919d5d0cd1db9 100644 --- a/src/USER-OMP/pair_lj_cubic_omp.cpp +++ b/src/USER-OMP/pair_lj_cubic_omp.cpp @@ -54,7 +54,7 @@ void PairLJCubicOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp index 2f46e0bfe70789c68e4e2a5f74bf0ddd55adca64..2ab0a4e8c056c64cb91d63b2f91b04a3b3640b8c 100644 --- a/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_cut_omp.cpp @@ -53,7 +53,7 @@ void PairLJCutCoulCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp index 03f0852b064348945ef56955825e4aaacb1aeab0..d8080656b083472168fd829f4c442490d77c52dc 100644 --- a/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_cut_soft_omp.cpp @@ -53,7 +53,7 @@ void PairLJCutCoulCutSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp index 82031f91ab82943dc8c9330958e74853d10816f2..d15456334483573f7fdb5debbd1751ad0d4c71a3 100644 --- a/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_debye_omp.cpp @@ -53,7 +53,7 @@ void PairLJCutCoulDebyeOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp index 7ab6f31b3fa523aa0d577b55ee829c9ec82366ce..fe47e947e5a566017d8475b9d0afd9a6b5661daa 100644 --- a/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_dsf_omp.cpp @@ -63,7 +63,7 @@ void PairLJCutCoulDSFOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp index c7b6de80226a382a53849193a29873968f118c2e..1edeb94b1743895b36d78b99564f553475db5ecb 100644 --- a/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_long_omp.cpp @@ -40,7 +40,7 @@ PairLJCutCoulLongOMP::PairLJCutCoulLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -62,7 +62,7 @@ void PairLJCutCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp index 6e804bd8aebb159a3b21e5e2d6fbd975ee3e2bf9..a024db5fc0cba3675ac1a983295b81a46bec7d06 100644 --- a/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_long_soft_omp.cpp @@ -40,7 +40,7 @@ PairLJCutCoulLongSoftOMP::PairLJCutCoulLongSoftOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -62,7 +62,7 @@ void PairLJCutCoulLongSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp index 0e6d11327afcfe70150b18bf4bfedcfbe8ce7e23..04afd428a0bf1ab6ed6aa2a360bf71746a9cde7d 100644 --- a/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_msm_omp.cpp @@ -34,7 +34,7 @@ PairLJCutCoulMSMOMP::PairLJCutCoulMSMOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -60,7 +60,7 @@ void PairLJCutCoulMSMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp b/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp index 0e9a333121a9adf8cb4d221992b204a0bd36702c..9f0577dacab8773f9144a60decdeb5a6d359fd66 100644 --- a/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_coul_wolf_omp.cpp @@ -55,7 +55,7 @@ void PairLJCutCoulWolfOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp index 2cc915a43532f3097a40cab8507c3680cf8f775f..b486ba33dd2498fd61171e2b7370cd1a88c5eea0 100644 --- a/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_dipole_cut_omp.cpp @@ -53,7 +53,7 @@ void PairLJCutDipoleCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_omp.cpp index 2aa71026e3691acdec02e69f84fe250140738b31..4f8c95a972cf17ccf017b919231e8f1259a42ab1 100644 --- a/src/USER-OMP/pair_lj_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_omp.cpp @@ -30,7 +30,7 @@ PairLJCutOMP::PairLJCutOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -52,7 +52,7 @@ void PairLJCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_soft_omp.cpp index 406c5f41d9ebb98c7d24634e759a25652e71c8cb..dc2441fed263530a99e94c2a2cef48a13d9d40a0 100644 --- a/src/USER-OMP/pair_lj_cut_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_soft_omp.cpp @@ -30,7 +30,7 @@ PairLJCutSoftOMP::PairLJCutSoftOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -52,7 +52,7 @@ void PairLJCutSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp b/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp index b921c8f1c169be70b06731bccef8a2236fa766d9..d79980493a8038c0cfd678758d1f208a0ae27df3 100644 --- a/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_thole_long_omp.cpp @@ -53,7 +53,7 @@ PairLJCutTholeLongOMP::PairLJCutTholeLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -75,7 +75,7 @@ void PairLJCutTholeLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp b/src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp index 2d1b8288220a4f4dea5f292281da40eb0ec2acc7..d11a018a82a0c325046edd88aacbdaf87924c995 100644 --- a/src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_tip4p_cut_omp.cpp @@ -42,8 +42,8 @@ PairLJCutTIP4PCutOMP::PairLJCutTIP4PCutOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - newsite_thr = NULL; - hneigh_thr = NULL; + newsite_thr = nullptr; + hneigh_thr = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -102,7 +102,7 @@ void PairLJCutTIP4PCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp b/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp index a60f9d6a5729339bef69e7b3fd470debb46faad4..b712ef843511c02492e72e56efa3571df559b86e 100644 --- a/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_tip4p_long_omp.cpp @@ -42,8 +42,8 @@ PairLJCutTIP4PLongOMP::PairLJCutTIP4PLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - newsite_thr = NULL; - hneigh_thr = NULL; + newsite_thr = nullptr; + hneigh_thr = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -102,7 +102,7 @@ void PairLJCutTIP4PLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (ncoultablebits) { if (evflag) { diff --git a/src/USER-OMP/pair_lj_cut_tip4p_long_soft_omp.cpp b/src/USER-OMP/pair_lj_cut_tip4p_long_soft_omp.cpp index f4a75b9af8f53e5542857a788686518e448391f1..d498da3e864751e5019fb053cdd21bae04c6b4dc 100644 --- a/src/USER-OMP/pair_lj_cut_tip4p_long_soft_omp.cpp +++ b/src/USER-OMP/pair_lj_cut_tip4p_long_soft_omp.cpp @@ -42,8 +42,8 @@ PairLJCutTIP4PLongSoftOMP::PairLJCutTIP4PLongSoftOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - newsite_thr = NULL; - hneigh_thr = NULL; + newsite_thr = nullptr; + hneigh_thr = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -102,7 +102,7 @@ void PairLJCutTIP4PLongSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_expand_omp.cpp b/src/USER-OMP/pair_lj_expand_omp.cpp index 89077ba6af6c22526ae886a8af8816209e962998..ba624ae7d04b3daa901160a4f356ded41b479291 100644 --- a/src/USER-OMP/pair_lj_expand_omp.cpp +++ b/src/USER-OMP/pair_lj_expand_omp.cpp @@ -53,7 +53,7 @@ void PairLJExpandOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp b/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp index 26a6e979b496a3b575b1fc8b665a99004f0deda6..7e8a38935dd723d052dab1e6e9fa6df24775751b 100644 --- a/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp +++ b/src/USER-OMP/pair_lj_gromacs_coul_gromacs_omp.cpp @@ -53,7 +53,7 @@ void PairLJGromacsCoulGromacsOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_gromacs_omp.cpp b/src/USER-OMP/pair_lj_gromacs_omp.cpp index 308209153990e8f9046fb7847466dcb1be540399..d179831e3084f1b9b33a90929537bdef8a34a6fd 100644 --- a/src/USER-OMP/pair_lj_gromacs_omp.cpp +++ b/src/USER-OMP/pair_lj_gromacs_omp.cpp @@ -53,7 +53,7 @@ void PairLJGromacsOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_long_coul_long_omp.cpp b/src/USER-OMP/pair_lj_long_coul_long_omp.cpp index cdd62ff96eb691f7efc643a6ef9bd53168165eb4..76768276c6040cfed2c1ff3150b4d4488cae9829 100644 --- a/src/USER-OMP/pair_lj_long_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_long_coul_long_omp.cpp @@ -42,7 +42,7 @@ PairLJLongCoulLongOMP::PairLJLongCoulLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 1; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -67,7 +67,7 @@ void PairLJLongCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (order6) { if (order1) { @@ -329,7 +329,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, NULL, thr); + ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr); eval_inner(ifrom, ito, thr); thr->timer(Timer::PAIR); @@ -354,7 +354,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, NULL, thr); + ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr); eval_middle(ifrom, ito, thr); thr->timer(Timer::PAIR); @@ -384,7 +384,7 @@ void PairLJLongCoulLongOMP::compute_outer(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (order6) { if (order1) { diff --git a/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp b/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp index af24e93a41ea8141a537cbff9b321d7f2e12c4da..4ba412c66e80b035a332fff9c52016f2f24925a9 100644 --- a/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp +++ b/src/USER-OMP/pair_lj_long_tip4p_long_omp.cpp @@ -44,9 +44,9 @@ PairLJLongTIP4PLongOMP::PairLJLongTIP4PLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 1; - cut_respa = NULL; - newsite_thr = NULL; - hneigh_thr = NULL; + cut_respa = nullptr; + newsite_thr = nullptr; + hneigh_thr = nullptr; tip4pflag = dispersionflag = 1; no_virial_fdotr_compute = 1; single_enable = 0; @@ -106,7 +106,7 @@ void PairLJLongTIP4PLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (order6) { if (order1) { @@ -389,7 +389,7 @@ void PairLJLongTIP4PLongOMP::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, NULL, thr); + ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr); eval_inner(ifrom, ito, thr); thr->timer(Timer::PAIR); @@ -414,7 +414,7 @@ void PairLJLongTIP4PLongOMP::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, NULL, thr); + ev_setup_thr(0, 0, nall, 0, 0, nullptr, thr); eval_middle(ifrom, ito, thr); thr->timer(Timer::PAIR); @@ -468,7 +468,7 @@ void PairLJLongTIP4PLongOMP::compute_outer(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (order6) { if (order1) { diff --git a/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp b/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp index 4a53f2c08326f11eafd93c9932cf576708ce18b0..f3af43cd50c06bdd822a5b24e46365bc9ab32485 100644 --- a/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_coul_long_omp.cpp @@ -54,7 +54,7 @@ void PairLJSDKCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp b/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp index 4b89375b5b84c5c2d064275fe20880447e92a864..f05f5e1200040a6d3288dfb58b4a1fd6991945f3 100644 --- a/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_coul_msm_omp.cpp @@ -60,7 +60,7 @@ void PairLJSDKCoulMSMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_sdk_omp.cpp b/src/USER-OMP/pair_lj_sdk_omp.cpp index d5146c6798309d00b5cd791726a0600965506003..a88a1ded032807a3b1a777f159881842b7638a3d 100644 --- a/src/USER-OMP/pair_lj_sdk_omp.cpp +++ b/src/USER-OMP/pair_lj_sdk_omp.cpp @@ -56,7 +56,7 @@ void PairLJSDKOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp b/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp index 8828b40b98486845e40339f441662149915a6f65..130ac6e5e700fedd1aa84b50f525a71f2847a545 100644 --- a/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp +++ b/src/USER-OMP/pair_lj_sf_dipole_sf_omp.cpp @@ -53,7 +53,7 @@ void PairLJSFDipoleSFOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_smooth_linear_omp.cpp b/src/USER-OMP/pair_lj_smooth_linear_omp.cpp index 2c0c0281893b7e9c665496e8e158138d272f12ce..d69cfea0a016b5e7f829c80a454c2c253d10b153 100644 --- a/src/USER-OMP/pair_lj_smooth_linear_omp.cpp +++ b/src/USER-OMP/pair_lj_smooth_linear_omp.cpp @@ -53,7 +53,7 @@ void PairLJSmoothLinearOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lj_smooth_omp.cpp b/src/USER-OMP/pair_lj_smooth_omp.cpp index 0b4ea4e5f82172710138bc2ee70e688f623276a6..1adccbf3cbacd134b47932e4c5c585fd086f0867 100644 --- a/src/USER-OMP/pair_lj_smooth_omp.cpp +++ b/src/USER-OMP/pair_lj_smooth_omp.cpp @@ -53,7 +53,7 @@ void PairLJSmoothOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_lubricate_omp.cpp b/src/USER-OMP/pair_lubricate_omp.cpp index caf5a11124e5821ab4dde9d422f3beed4fa9e788..17496830f15a0e7a9382d987a3ef977ca1b64bcf 100644 --- a/src/USER-OMP/pair_lubricate_omp.cpp +++ b/src/USER-OMP/pair_lubricate_omp.cpp @@ -116,7 +116,7 @@ void PairLubricateOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (flaglog) { if (evflag) { diff --git a/src/USER-OMP/pair_lubricate_poly_omp.cpp b/src/USER-OMP/pair_lubricate_poly_omp.cpp index feb110194f55e0231619f8cd5f84c18efe57bd3b..227c9430074738f50a0c78da9587d23f5cb6ac1b 100644 --- a/src/USER-OMP/pair_lubricate_poly_omp.cpp +++ b/src/USER-OMP/pair_lubricate_poly_omp.cpp @@ -113,7 +113,7 @@ void PairLubricatePolyOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (flaglog) { if (shearing) { diff --git a/src/USER-OMP/pair_meam_spline_omp.cpp b/src/USER-OMP/pair_meam_spline_omp.cpp index 782371e843815205cf9493e534f503bf8fe5aa39..e093e925f18ea2b6820f8446e596d2a657a7a113 100644 --- a/src/USER-OMP/pair_meam_spline_omp.cpp +++ b/src/USER-OMP/pair_meam_spline_omp.cpp @@ -65,7 +65,7 @@ void PairMEAMSplineOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); thr->init_eam(nall,Uprime_values); diff --git a/src/USER-OMP/pair_morse_omp.cpp b/src/USER-OMP/pair_morse_omp.cpp index 48687781ef70ba1f4049226b34f4c11aea9862b5..aa79a0f05a41ac3201b74b8fe301e207f22b47b0 100644 --- a/src/USER-OMP/pair_morse_omp.cpp +++ b/src/USER-OMP/pair_morse_omp.cpp @@ -53,7 +53,7 @@ void PairMorseOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_morse_smooth_linear_omp.cpp b/src/USER-OMP/pair_morse_smooth_linear_omp.cpp index 220fb9481d841030fa4a2ed58ee4a97197e25f7f..1896fdcbaddb6d7e076c778bbfdc6d215146eecd 100644 --- a/src/USER-OMP/pair_morse_smooth_linear_omp.cpp +++ b/src/USER-OMP/pair_morse_smooth_linear_omp.cpp @@ -55,7 +55,7 @@ void PairMorseSmoothLinearOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp b/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp index 1cfe576a32d796afde687a1299a83ba029fe03dc..ecdba46e055228a7495cb329384ac8c4794ff5e3 100644 --- a/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp +++ b/src/USER-OMP/pair_nm_cut_coul_cut_omp.cpp @@ -53,7 +53,7 @@ void PairNMCutCoulCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp b/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp index d9e123182703266f17c06e153974c7473043b40a..09ec46d1c4fd4afb569659a91793f08df6b84651 100644 --- a/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp +++ b/src/USER-OMP/pair_nm_cut_coul_long_omp.cpp @@ -61,7 +61,7 @@ void PairNMCutCoulLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_nm_cut_omp.cpp b/src/USER-OMP/pair_nm_cut_omp.cpp index a232da1a9017f4f6b2f9e30e07fff498a192e9a7..faa3acefb7d36dba1f5264ed5602fc586607621c 100644 --- a/src/USER-OMP/pair_nm_cut_omp.cpp +++ b/src/USER-OMP/pair_nm_cut_omp.cpp @@ -53,7 +53,7 @@ void PairNMCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_peri_lps_omp.cpp b/src/USER-OMP/pair_peri_lps_omp.cpp index 9bf707ad91666b8144662f813ff82d365a375eb8..b2be373918dedda6969faa5383cf007ca23af7b5 100644 --- a/src/USER-OMP/pair_peri_lps_omp.cpp +++ b/src/USER-OMP/pair_peri_lps_omp.cpp @@ -71,7 +71,7 @@ void PairPeriLPSOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_peri_pmb_omp.cpp b/src/USER-OMP/pair_peri_pmb_omp.cpp index 28df45b67f0d2ca0eb3da8fdff33cc8c860fc58c..b58cadc20c9e1c5e758f3abc0c7e6815d21ceccf 100644 --- a/src/USER-OMP/pair_peri_pmb_omp.cpp +++ b/src/USER-OMP/pair_peri_pmb_omp.cpp @@ -67,7 +67,7 @@ void PairPeriPMBOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index dfc1f428eb81f8559d327db1808e9139fe837dc6..54417f95363c0ea36af5cccb12faa6c69039127a 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -92,7 +92,7 @@ PairReaxCOMP::PairReaxCOMP(LAMMPS *lmp) : PairReaxC(lmp), ThrOMP(lmp, THR_PAIR) system->pair_ptr = this; system->omp_active = 1; - num_nbrs_offset = NULL; + num_nbrs_offset = nullptr; #ifdef OMP_TIMING for (int i=0;iget_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_soft_omp.cpp b/src/USER-OMP/pair_soft_omp.cpp index f733b5106f5f492dfe6dc2662a275a826e9a697b..382a995e2a27fd80d2dca68ff02c3bf91b263582 100644 --- a/src/USER-OMP/pair_soft_omp.cpp +++ b/src/USER-OMP/pair_soft_omp.cpp @@ -57,7 +57,7 @@ void PairSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_sw_omp.cpp b/src/USER-OMP/pair_sw_omp.cpp index c2eb4cb156949fb42f6b2d92c6120e0e61778ca9..dac252705382a0915a535e73284f17b68380c590 100644 --- a/src/USER-OMP/pair_sw_omp.cpp +++ b/src/USER-OMP/pair_sw_omp.cpp @@ -51,7 +51,7 @@ void PairSWOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_table_omp.cpp b/src/USER-OMP/pair_table_omp.cpp index f5fbabccabb19eac9974a694bd0b97a1def7acab..79128bea8f4b77d584eb6ffb6dc27902ce9f6fe2 100644 --- a/src/USER-OMP/pair_table_omp.cpp +++ b/src/USER-OMP/pair_table_omp.cpp @@ -51,7 +51,7 @@ void PairTableOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_tersoff_mod_c_omp.cpp b/src/USER-OMP/pair_tersoff_mod_c_omp.cpp index 83baa56e442ef36d9418cd04882afc6dbad6344e..6d2cbf71ac22001fbb95fefc5dc96644cf6c0cd9 100644 --- a/src/USER-OMP/pair_tersoff_mod_c_omp.cpp +++ b/src/USER-OMP/pair_tersoff_mod_c_omp.cpp @@ -50,7 +50,7 @@ void PairTersoffMODCOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_tersoff_mod_omp.cpp b/src/USER-OMP/pair_tersoff_mod_omp.cpp index ab2f07322de02ba4fc2a596a0f54eefefab2d3e7..45669dc6019cf60592eeae64d2c5849506162464 100644 --- a/src/USER-OMP/pair_tersoff_mod_omp.cpp +++ b/src/USER-OMP/pair_tersoff_mod_omp.cpp @@ -52,7 +52,7 @@ void PairTersoffMODOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_tersoff_omp.cpp b/src/USER-OMP/pair_tersoff_omp.cpp index a3677499781cb4d70600fda4ba484486829926c3..efafa7949b7d946c5c97d25cc6d95dd01aadb294 100644 --- a/src/USER-OMP/pair_tersoff_omp.cpp +++ b/src/USER-OMP/pair_tersoff_omp.cpp @@ -53,7 +53,7 @@ void PairTersoffOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_tersoff_table_omp.cpp b/src/USER-OMP/pair_tersoff_table_omp.cpp index 8321ad9d9ffd2aa53d0b7d8b1f1b115b96de015d..277b79b9e7bbc1850841bbfbf5bd2e56152169b7 100644 --- a/src/USER-OMP/pair_tersoff_table_omp.cpp +++ b/src/USER-OMP/pair_tersoff_table_omp.cpp @@ -43,8 +43,8 @@ PairTersoffTableOMP::PairTersoffTableOMP(LAMMPS *lmp) : suffix_flag |= Suffix::OMP; respa_enable = 0; - thrGtetaFunction = thrGtetaFunctionDerived = NULL; - thrCutoffFunction = thrCutoffFunctionDerived = NULL; + thrGtetaFunction = thrGtetaFunctionDerived = nullptr; + thrCutoffFunction = thrCutoffFunctionDerived = nullptr; } /* ---------------------------------------------------------------------- */ @@ -76,7 +76,7 @@ void PairTersoffTableOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) if (vflag_atom) eval<1,1>(ifrom, ito, thr); diff --git a/src/USER-OMP/pair_tip4p_cut_omp.cpp b/src/USER-OMP/pair_tip4p_cut_omp.cpp index 5b983d3db5df1a74f53b8e1ccf330e17f5ce27ff..a7e087e208773e265873c831d74fa7f2f53ad5f4 100644 --- a/src/USER-OMP/pair_tip4p_cut_omp.cpp +++ b/src/USER-OMP/pair_tip4p_cut_omp.cpp @@ -42,8 +42,8 @@ PairTIP4PCutOMP::PairTIP4PCutOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - newsite_thr = NULL; - hneigh_thr = NULL; + newsite_thr = nullptr; + hneigh_thr = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -101,7 +101,7 @@ void PairTIP4PCutOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_tip4p_long_omp.cpp b/src/USER-OMP/pair_tip4p_long_omp.cpp index 86bebdbeffb82986a25a2d2c6e3aeb2f72397b6d..75f6850ac39fe179763fd1bb3229a1c844a96bd9 100644 --- a/src/USER-OMP/pair_tip4p_long_omp.cpp +++ b/src/USER-OMP/pair_tip4p_long_omp.cpp @@ -42,8 +42,8 @@ PairTIP4PLongOMP::PairTIP4PLongOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - newsite_thr = NULL; - hneigh_thr = NULL; + newsite_thr = nullptr; + hneigh_thr = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -102,7 +102,7 @@ void PairTIP4PLongOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (!ncoultablebits) { if (evflag) { diff --git a/src/USER-OMP/pair_tip4p_long_soft_omp.cpp b/src/USER-OMP/pair_tip4p_long_soft_omp.cpp index 26e0420955ef7736bad51289847628086108787e..e408cb7ccbd36c2b1314fb8f36c03e51ac682d38 100644 --- a/src/USER-OMP/pair_tip4p_long_soft_omp.cpp +++ b/src/USER-OMP/pair_tip4p_long_soft_omp.cpp @@ -42,8 +42,8 @@ PairTIP4PLongSoftOMP::PairTIP4PLongSoftOMP(LAMMPS *lmp) : { suffix_flag |= Suffix::OMP; respa_enable = 0; - newsite_thr = NULL; - hneigh_thr = NULL; + newsite_thr = nullptr; + hneigh_thr = nullptr; // TIP4P cannot compute virial as F dot r // due to finding bonded H atoms which are not near O atom @@ -102,7 +102,7 @@ void PairTIP4PLongSoftOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_ufm_omp.cpp b/src/USER-OMP/pair_ufm_omp.cpp index e1c2ff457ea7d28a731ccc18606c8d834964a126..202cce567d6d1e953626c80a3e5ac68985209693 100644 --- a/src/USER-OMP/pair_ufm_omp.cpp +++ b/src/USER-OMP/pair_ufm_omp.cpp @@ -55,7 +55,7 @@ void PairUFMOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_vashishta_omp.cpp b/src/USER-OMP/pair_vashishta_omp.cpp index 0637fe3dfc6553d7f9f7040b22c8b6e48a128233..c1dd45d8b6815d04660cfb0ea9c76b0822c59a06 100644 --- a/src/USER-OMP/pair_vashishta_omp.cpp +++ b/src/USER-OMP/pair_vashishta_omp.cpp @@ -53,7 +53,7 @@ void PairVashishtaOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_vashishta_table_omp.cpp b/src/USER-OMP/pair_vashishta_table_omp.cpp index 9650a57e725558bbb18033afb7e97ef5e5d293b9..caf4bb4930133990545f4e5287fa7c78b96e1202 100644 --- a/src/USER-OMP/pair_vashishta_table_omp.cpp +++ b/src/USER-OMP/pair_vashishta_table_omp.cpp @@ -51,7 +51,7 @@ void PairVashishtaTableOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_yukawa_colloid_omp.cpp b/src/USER-OMP/pair_yukawa_colloid_omp.cpp index 227ec0744f3f4dcf06896e1a6e50f5e17bcd747d..4b595365fd5590684db6aee84b5e6eef3a7e5763 100644 --- a/src/USER-OMP/pair_yukawa_colloid_omp.cpp +++ b/src/USER-OMP/pair_yukawa_colloid_omp.cpp @@ -53,7 +53,7 @@ void PairYukawaColloidOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_yukawa_omp.cpp b/src/USER-OMP/pair_yukawa_omp.cpp index 347575e2837ba8cb3a6b27272738b1bf7eecf8b8..78f2a1213160bf27ff3ae8a1aca1d4f4394c03e6 100644 --- a/src/USER-OMP/pair_yukawa_omp.cpp +++ b/src/USER-OMP/pair_yukawa_omp.cpp @@ -53,7 +53,7 @@ void PairYukawaOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/pair_zbl_omp.cpp b/src/USER-OMP/pair_zbl_omp.cpp index 9679a00b245de35de3e4e5e09b169d3c778c84f1..2faf6d1bb0b9b8513937f223fe6c5e55496f512c 100644 --- a/src/USER-OMP/pair_zbl_omp.cpp +++ b/src/USER-OMP/pair_zbl_omp.cpp @@ -54,7 +54,7 @@ void PairZBLOMP::compute(int eflag, int vflag) loop_setup_thr(ifrom, ito, tid, inum, nthreads); ThrData *thr = fix->get_thr(tid); thr->timer(Timer::START); - ev_setup_thr(eflag, vflag, nall, eatom, vatom, NULL, thr); + ev_setup_thr(eflag, vflag, nall, eatom, vatom, nullptr, thr); if (evflag) { if (eflag) { diff --git a/src/USER-OMP/reaxc_bonds_omp.cpp b/src/USER-OMP/reaxc_bonds_omp.cpp index 80e9b90eccef8a1325ed7dff89561f027896818b..bcef3a3c8778f473e56c25bb651ca8f5f41f2d89 100644 --- a/src/USER-OMP/reaxc_bonds_omp.cpp +++ b/src/USER-OMP/reaxc_bonds_omp.cpp @@ -88,7 +88,7 @@ void BondsOMP( reax_system *system, control_params * /* control */, pair_reax_ptr->ev_setup_thr_proxy(system->pair_ptr->eflag_either, system->pair_ptr->vflag_either, system->N, system->pair_ptr->eatom, - system->pair_ptr->vatom, NULL, thr); + system->pair_ptr->vatom, nullptr, thr); #if defined(_OPENMP) #pragma omp for schedule(guided) diff --git a/src/USER-OMP/reaxc_forces_omp.cpp b/src/USER-OMP/reaxc_forces_omp.cpp index ad6ea35eb8780702fc7f66ff545e0e374f02c4b5..ad474a1cc882a3f0a3e6c587c4e58b1c12747691 100644 --- a/src/USER-OMP/reaxc_forces_omp.cpp +++ b/src/USER-OMP/reaxc_forces_omp.cpp @@ -165,7 +165,7 @@ void Compute_Total_ForceOMP( reax_system *system, control_params *control, class ThrData *thr = pair_reax_ptr->getFixOMP()->get_thr(tid); pair_reax_ptr->ev_setup_thr_proxy(0, 1, natoms, system->pair_ptr->eatom, - system->pair_ptr->vatom, NULL, thr); + system->pair_ptr->vatom, nullptr, thr); #if defined(_OPENMP) #pragma omp for schedule(guided) diff --git a/src/USER-OMP/thr_data.cpp b/src/USER-OMP/thr_data.cpp index 612c36053cd9a12b66155fe1d9951106dd6b1f2a..0ce2c3718acccd8ba02f8d404eacd61fb23b1175 100644 --- a/src/USER-OMP/thr_data.cpp +++ b/src/USER-OMP/thr_data.cpp @@ -82,33 +82,33 @@ void ThrData::init_force(int nall, double **f, double **torque, 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=NULL; - vatom_pair=vatom_bond=vatom_angle=vatom_dihed=vatom_imprp=vatom_kspce=NULL; + 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 = NULL; + } else _f = nullptr; if (nall >= 0 && torque) { _torque = torque + _tid*nall; memset(&(_torque[0][0]),0,nall*3*sizeof(double)); - } else _torque = NULL; + } else _torque = nullptr; if (nall >= 0 && erforce) { _erforce = erforce + _tid*nall; memset(&(_erforce[0]),0,nall*sizeof(double)); - } else _erforce = NULL; + } else _erforce = nullptr; if (nall >= 0 && de) { _de = de + _tid*nall; memset(&(_de[0]),0,nall*sizeof(double)); - } else _de = NULL; + } else _de = nullptr; if (nall >= 0 && drho) { _drho = drho + _tid*nall; memset(&(_drho[0]),0,nall*sizeof(double)); - } else _drho = NULL; + } else _drho = nullptr; } /* ---------------------------------------------------------------------- @@ -191,8 +191,8 @@ void ThrData::init_pppm(int order, Memory *memory) drho1d = static_cast(_drho1d); if (rho1d) memory->destroy2d_offset(rho1d,-order/2); if (drho1d) memory->destroy2d_offset(drho1d,-order/2); - _rho1d = NULL; - _drho1d = NULL; + _rho1d = nullptr; + _drho1d = nullptr; } } diff --git a/src/USER-OMP/thr_data.h b/src/USER-OMP/thr_data.h index 4b87357101dd506bb6a31b250f6ba2d7d6ce496c..c942083ef504aabeb0c6c08f9839a7a50c51be0b 100644 --- a/src/USER-OMP/thr_data.h +++ b/src/USER-OMP/thr_data.h @@ -31,7 +31,7 @@ class ThrData { public: ThrData(int tid, class Timer *t); - ~ThrData() { delete _timer; _timer = NULL; }; + ~ThrData() { delete _timer; _timer = nullptr; }; void check_tid(int); // thread id consistency check int get_tid() const { return _tid; }; // our thread id. @@ -140,7 +140,7 @@ class ThrData { // disabled default methods private: - ThrData() : _tid(-1), _timer(NULL) {}; + ThrData() : _tid(-1), _timer(nullptr) {}; }; //////////////////////////////////////////////////////////////////////// diff --git a/src/USER-OMP/thr_omp.cpp b/src/USER-OMP/thr_omp.cpp index a31a568933673a30c1d109507436ecebc42f74da..2e75e7c1e420d76e6278806ac14f65cc7b29cf21 100644 --- a/src/USER-OMP/thr_omp.cpp +++ b/src/USER-OMP/thr_omp.cpp @@ -43,7 +43,7 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ ThrOMP::ThrOMP(LAMMPS *ptr, int style) - : lmp(ptr), fix(NULL), thr_style(style), thr_error(0) + : lmp(ptr), fix(nullptr), thr_style(style), thr_error(0) { // register fix omp with this class int ifix = lmp->modify->find_fix("package_omp"); @@ -88,7 +88,7 @@ void ThrOMP::ev_setup_thr(int eflag, int vflag, int nall, double *eatom, if (nall > 0) memset(&(thr->cvatom_pair[0][0]),0,nall*9*sizeof(double)); } else { - thr->cvatom_pair = NULL; + thr->cvatom_pair = nullptr; } } @@ -199,7 +199,7 @@ void ThrOMP::reduce_thr(void *style, const int eflag, const int vflag, if (lmp->force->pair->vflag_fdotr) { // this is a non-hybrid pair style. compute per thread fdotr - if (fix->last_pair_hybrid == NULL) { + if (fix->last_pair_hybrid == nullptr) { if (lmp->neighbor->includegroup == 0) thr->virial_fdotr_compute(x, nlocal, nghost, -1); else diff --git a/src/USER-PHONON/dynamical_matrix.cpp b/src/USER-PHONON/dynamical_matrix.cpp index 19b310027739654e0e57b869c53e4d1d4e1c7b88..80ab531e70aecd6d739fa114f0c3067ff723810d 100644 --- a/src/USER-PHONON/dynamical_matrix.cpp +++ b/src/USER-PHONON/dynamical_matrix.cpp @@ -32,7 +32,7 @@ enum{REGULAR,ESKM}; /* ---------------------------------------------------------------------- */ -DynamicalMatrix::DynamicalMatrix(LAMMPS *lmp) : Pointers(lmp), fp(NULL) +DynamicalMatrix::DynamicalMatrix(LAMMPS *lmp) : Pointers(lmp), fp(nullptr) { external_force_clear = 1; } @@ -43,7 +43,7 @@ DynamicalMatrix::~DynamicalMatrix() { if (fp && me == 0) fclose(fp); memory->destroy(groupmap); - fp = NULL; + fp = nullptr; } /* ---------------------------------------------------------------------- @@ -223,7 +223,7 @@ void DynamicalMatrix::openfile(const char* filename) fp = fopen(filename,"w"); } - if (fp == NULL) error->one(FLERR,"Cannot open dump file"); + if (fp == nullptr) error->one(FLERR,"Cannot open dump file"); file_opened = 1; } diff --git a/src/USER-PHONON/fix_phonon.cpp b/src/USER-PHONON/fix_phonon.cpp index 382eabe82de7539af3e254fe7ef0a552c03c4388..d8900d2348a015a19c6ba3b52e3c7339fc185b26 100644 --- a/src/USER-PHONON/fix_phonon.cpp +++ b/src/USER-PHONON/fix_phonon.cpp @@ -162,7 +162,7 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) fft = new FFT3d(lmp,world,nz,ny,nx,0,nz-1,0,ny-1,nxlo,nxhi,0,nz-1,0,ny-1,nxlo,nxhi,0,0,&mysize,0); memory->create(fft_data, MAX(1,mynq)*2, "fix_phonon:fft_data"); - // allocate variables; MAX(1,... is used because NULL buffer will result in error for MPI + // allocate variables; MAX(1,... is used because a null buffer will result in error for MPI memory->create(RIloc,ngroup,(sysdim+1),"fix_phonon:RIloc"); memory->create(RIall,ngroup,(sysdim+1),"fix_phonon:RIall"); memory->create(Rsort,ngroup, sysdim, "fix_phonon:Rsort"); @@ -184,7 +184,7 @@ FixPhonon::FixPhonon(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) // output some information on the system to log file if (me == 0){ flog = fopen(logfile, "w"); - if (flog == NULL) { + if (flog == nullptr) { char str[MAXLINE]; sprintf(str,"Can not open output file %s",logfile); error->one(FLERR,str); @@ -563,34 +563,34 @@ void FixPhonon::readmap() // read from map file for others char line[MAXLINE]; FILE *fp = fopen(mapfile, "r"); - if (fp == NULL){ + if (fp == nullptr){ sprintf(line,"Cannot open input map file %s", mapfile); error->all(FLERR,line); } - if (fgets(line,MAXLINE,fp) == NULL) + if (fgets(line,MAXLINE,fp) == nullptr) error->all(FLERR,"Error while reading header of mapping file!"); nx = utils::inumeric(FLERR, strtok(line, " \n\t\r\f"),false,lmp); - ny = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); - nz = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); - nucell = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); + ny = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); + nz = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); + nucell = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); ntotal = nx*ny*nz; if (ntotal*nucell != ngroup) error->all(FLERR,"FFT mesh and number of atoms in group mismatch!"); // second line of mapfile is comment - if (fgets(line,MAXLINE,fp) == NULL) + if (fgets(line,MAXLINE,fp) == nullptr) error->all(FLERR,"Error while reading comment of mapping file!"); int ix, iy, iz, iu; // the remaining lines carry the mapping info for (int i = 0; i < ngroup; ++i){ - if (fgets(line,MAXLINE,fp) == NULL) {info = 1; break;} + if (fgets(line,MAXLINE,fp) == nullptr) {info = 1; break;} ix = utils::inumeric(FLERR, strtok(line, " \n\t\r\f"),false,lmp); - iy = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); - iz = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); - iu = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); - itag = utils::inumeric(FLERR, strtok(NULL, " \n\t\r\f"),false,lmp); + iy = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); + iz = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); + iu = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); + itag = utils::inumeric(FLERR, strtok(nullptr, " \n\t\r\f"),false,lmp); // check if index is in correct range if (ix < 0 || ix >= nx || iy < 0 || iy >= ny || diff --git a/src/USER-PHONON/third_order.cpp b/src/USER-PHONON/third_order.cpp index c7b24a9f60677a1d475dfdb8587b33f220461f13..955e5d940ed2cc6c73cf7f583dff23dd8dd0dc34 100644 --- a/src/USER-PHONON/third_order.cpp +++ b/src/USER-PHONON/third_order.cpp @@ -32,7 +32,7 @@ enum{REGULAR,BALLISTICO}; /* ---------------------------------------------------------------------- */ -ThirdOrder::ThirdOrder(LAMMPS *lmp) : Pointers(lmp), fp(NULL) +ThirdOrder::ThirdOrder(LAMMPS *lmp) : Pointers(lmp), fp(nullptr) { external_force_clear = 1; } @@ -42,7 +42,7 @@ ThirdOrder::ThirdOrder(LAMMPS *lmp) : Pointers(lmp), fp(NULL) ThirdOrder::~ThirdOrder() { if (fp && me == 0) fclose(fp); - fp = NULL; + fp = nullptr; memory->destroy(groupmap); } @@ -220,7 +220,7 @@ void ThirdOrder::openfile(const char* filename) fp = fopen(filename,"w"); } - if (fp == NULL) error->one(FLERR,"Cannot open dump file"); + if (fp == nullptr) error->one(FLERR,"Cannot open dump file"); file_opened = 1; } diff --git a/src/USER-PLUMED/fix_plumed.cpp b/src/USER-PLUMED/fix_plumed.cpp index b7a29c7bc96eda54d8514daa46466ba4f71311a5..3d2acacc1ed25e57567fff1f79dd333c2d6284dc 100644 --- a/src/USER-PLUMED/fix_plumed.cpp +++ b/src/USER-PLUMED/fix_plumed.cpp @@ -53,8 +53,8 @@ using namespace FixConst; FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - p(NULL), nlocal(0), gatindex(NULL), masses(NULL), charges(NULL), - id_pe(NULL), id_press(NULL) + p(nullptr), nlocal(0), gatindex(nullptr), masses(nullptr), charges(nullptr), + id_pe(nullptr), id_press(nullptr) { if (!atom->tag_enable) @@ -68,7 +68,7 @@ FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) : "Group will be ignored."); #if defined(__PLUMED_DEFAULT_KERNEL) - if (getenv("PLUMED_KERNEL") == NULL) + if (getenv("PLUMED_KERNEL") == nullptr) putenv(plumed_default_kernel); #endif @@ -101,7 +101,7 @@ FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) : // it is defined inside plumed. p->cmd("GREX setMPIIntercomm",&inter_comm); } - p->cmd("GREX init",NULL); + p->cmd("GREX init",nullptr); } // The general communicator is independent of the existence of partitions, diff --git a/src/USER-PTM/compute_ptm_atom.cpp b/src/USER-PTM/compute_ptm_atom.cpp index 309dd75c191065553bd92006064ed3945037d8fd..508c3d0ffde61408fc6c57b207b2d5d6ab9dc8ee 100644 --- a/src/USER-PTM/compute_ptm_atom.cpp +++ b/src/USER-PTM/compute_ptm_atom.cpp @@ -61,7 +61,7 @@ static const char cite_user_ptm_package[] = /* ---------------------------------------------------------------------- */ ComputePTMAtom::ComputePTMAtom(LAMMPS *lmp, int narg, char **arg) - : Compute(lmp, narg, arg), list(NULL), output(NULL) { + : Compute(lmp, narg, arg), list(nullptr), output(nullptr) { if (narg < 5 || narg > 6) error->all(FLERR, "Illegal compute ptm/atom command"); @@ -144,7 +144,7 @@ ComputePTMAtom::~ComputePTMAtom() { memory->destroy(output); } /* ---------------------------------------------------------------------- */ void ComputePTMAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR, "Compute ptm/atom requires a pair style be defined"); int count = 0; @@ -201,7 +201,7 @@ static int get_neighbours(void* vdata, size_t central_index, size_t atom_index, double **x = data->x; double *pos = x[atom_index]; - int *jlist = NULL; + int *jlist = nullptr; int jnum = 0; if (atom_index < data->nlocal) { jlist = data->firstneigh[atom_index]; @@ -307,7 +307,7 @@ void ComputePTMAtom::compute_peratom() { ptm_index(local_handle, i, get_neighbours, (void*)&nbrlist, input_flags, standard_orientations, &type, &alloy_type, &scale, &rmsd, q, - NULL, NULL, NULL, NULL, &interatomic_distance, NULL, NULL); + nullptr, nullptr, nullptr, nullptr, &interatomic_distance, nullptr, nullptr); if (rmsd > rmsd_threshold) { type = PTM_MATCH_NONE; diff --git a/src/USER-PTM/ptm_index.cpp b/src/USER-PTM/ptm_index.cpp index cedd35126d7398882183d2a2b759db6042cfaaf6..7c912ed5b912adb1237658ee820de46d02e62066 100644 --- a/src/USER-PTM/ptm_index.cpp +++ b/src/USER-PTM/ptm_index.cpp @@ -95,11 +95,11 @@ static void output_data(ptm::result_t *res, double (*points)[3], double *P, double *p_interatomic_distance, double *p_lattice_constant, size_t *output_indices) { const ptm::refdata_t *ref = res->ref_struct; - if (ref == NULL) + if (ref == nullptr) return; *p_type = ref->type; - if (p_alloy_type != NULL) + if (p_alloy_type != nullptr) *p_alloy_type = ptm::find_alloy_type(ref, res->mapping, numbers); int8_t temp[PTM_MAX_POINTS]; @@ -123,7 +123,7 @@ static void output_data(ptm::result_t *res, double (*points)[3], memcpy(res->mapping, temp, (ref->num_nbrs + 1) * sizeof(int8_t)); - if (F != NULL && F_res != NULL) { + if (F != nullptr && F_res != nullptr) { double scaled_points[PTM_MAX_INPUT_POINTS][3]; ptm::subtract_barycentre(ref->num_nbrs + 1, points, scaled_points); @@ -160,11 +160,11 @@ static void output_data(ptm::result_t *res, double (*points)[3], if (ref->type == PTM_MATCH_GRAPHENE) // hack for pseudo-2d structures F[8] = 1; - if (P != NULL && U != NULL) + if (P != nullptr && U != nullptr) ptm::polar_decomposition_3x3(F, false, U, P); } - if (output_indices != NULL) + if (output_indices != nullptr) for (int i = 0; i < ref->num_nbrs + 1; i++) output_indices[i] = ordering[res->mapping[i]]; @@ -173,10 +173,10 @@ static void output_data(ptm::result_t *res, double (*points)[3], double lattice_constant = calculate_lattice_constant(ref->type, interatomic_distance); - if (p_interatomic_distance != NULL) + if (p_interatomic_distance != nullptr) *p_interatomic_distance = interatomic_distance; - if (p_lattice_constant != NULL) + if (p_lattice_constant != nullptr) *p_lattice_constant = lattice_constant; *p_rmsd = res->rmsd; @@ -200,7 +200,7 @@ int ptm_index(ptm_local_handle_t local_handle, size_t atom_index, int ret = 0; ptm::result_t res; - res.ref_struct = NULL; + res.ref_struct = nullptr; res.rmsd = INFINITY; size_t ordering[PTM_MAX_INPUT_POINTS]; @@ -269,13 +269,13 @@ int ptm_index(ptm_local_handle_t local_handle, size_t atom_index, } *p_type = PTM_MATCH_NONE; - if (p_alloy_type != NULL) + if (p_alloy_type != nullptr) *p_alloy_type = PTM_ALLOY_NONE; - if (output_indices != NULL) + if (output_indices != nullptr) memset(output_indices, -1, PTM_MAX_INPUT_POINTS * sizeof(size_t)); - if (res.ref_struct == NULL) + if (res.ref_struct == nullptr) return PTM_NO_ERROR; if (res.ref_struct->type == PTM_MATCH_DCUB || diff --git a/src/USER-PTM/ptm_initialize_data.h b/src/USER-PTM/ptm_initialize_data.h index 87111b128283f4c42e2c1bcc829c3029460b2a8f..dd1cddd9f2f607b5fe2d44daafa555110f7aa936 100644 --- a/src/USER-PTM/ptm_initialize_data.h +++ b/src/USER-PTM/ptm_initialize_data.h @@ -50,17 +50,17 @@ const refdata_t structure_sc = { PTM_MATCH_SC, //. NUM_SC_GRAPHS, //.num_graphs graphs_sc, //.graphs ptm_template_sc, //.points - NULL, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt1 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_sc, //.penrose - NULL, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt1 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 NUM_CUBIC_MAPPINGS, //.num_mappings mapping_sc, //.mapping - NULL, //.mapping_conventional - NULL, //.template_indices + nullptr, //.mapping_conventional + nullptr, //.template_indices }; const refdata_t structure_fcc = { PTM_MATCH_FCC, //.type @@ -70,17 +70,17 @@ const refdata_t structure_fcc = { PTM_MATCH_FCC, / NUM_FCC_GRAPHS, //.num_graphs graphs_fcc, //.graphs ptm_template_fcc, //.points - NULL, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt1 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_fcc, //.penrose - NULL, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt1 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 NUM_CUBIC_MAPPINGS, //.num_mappings mapping_fcc, //.mapping - NULL, //.mapping_conventional - NULL, //.template_indices + nullptr, //.mapping_conventional + nullptr, //.template_indices }; const refdata_t structure_hcp = { PTM_MATCH_HCP, //.type @@ -91,12 +91,12 @@ const refdata_t structure_hcp = { PTM_MATCH_HCP, / graphs_hcp, //.graphs ptm_template_hcp, //.points ptm_template_hcp_alt1, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_hcp, //.penrose penrose_hcp_alt1, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 NUM_HEX_MAPPINGS, //.num_mappings mapping_hcp, //.mapping mapping_hcp_conventional, //.mapping_conventional @@ -110,17 +110,17 @@ const refdata_t structure_ico = { PTM_MATCH_ICO, / NUM_ICO_GRAPHS, //.num_graphs graphs_ico, //.graphs ptm_template_ico, //.points - NULL, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt1 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_ico, //.penrose - NULL, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt1 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 NUM_ICO_MAPPINGS, //.num_mappings mapping_ico, //.mapping - NULL, //.mapping_conventional - NULL, //.template_indices + nullptr, //.mapping_conventional + nullptr, //.template_indices }; const refdata_t structure_bcc = { PTM_MATCH_BCC, //.type @@ -130,17 +130,17 @@ const refdata_t structure_bcc = { PTM_MATCH_BCC, / NUM_BCC_GRAPHS, //.num_graphs graphs_bcc, //.graphs ptm_template_bcc, //.points - NULL, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt1 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_bcc, //.penrose - NULL, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt1 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 NUM_CUBIC_MAPPINGS, //.num_mappings mapping_bcc, //.mapping - NULL, //.mapping_conventional - NULL, //.template_indices + nullptr, //.mapping_conventional + nullptr, //.template_indices }; const refdata_t structure_dcub = { PTM_MATCH_DCUB, //.type @@ -151,12 +151,12 @@ const refdata_t structure_dcub = { PTM_MATCH_DCUB, graphs_dcub, //.graphs ptm_template_dcub, //.points ptm_template_dcub_alt1, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_dcub, //.penrose penrose_dcub_alt1, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 NUM_DCUB_MAPPINGS, //.num_mappings mapping_dcub, //.mapping mapping_dcub_conventional, //.mapping_conventional @@ -188,15 +188,15 @@ const refdata_t structure_graphene = { PTM_MATCH_GRAPHENE, -1, //.num_facets -1, //.max_degree -1, //.num_graphs - NULL, //.graphs + nullptr, //.graphs ptm_template_graphene, //.points ptm_template_graphene_alt1, //.points_alt1 - NULL, //.points_alt2 - NULL, //.points_alt3 + nullptr, //.points_alt2 + nullptr, //.points_alt3 penrose_graphene, //.penrose penrose_graphene_alt1, //.penrose_alt1 - NULL, //.penrose_alt2 - NULL, //.penrose_alt3 + nullptr, //.penrose_alt2 + nullptr, //.penrose_alt3 -1, //.num_mappings mapping_graphene, //.mapping mapping_graphene_conventional, //.mapping_conventional diff --git a/src/USER-QMMM/fix_qmmm.cpp b/src/USER-QMMM/fix_qmmm.cpp index 9f07030004c51b757db28a0a1b99b46befe58282..f6d0f9300a0e35025a8472a61ebc6c13eb9312cb 100644 --- a/src/USER-QMMM/fix_qmmm.cpp +++ b/src/USER-QMMM/fix_qmmm.cpp @@ -169,7 +169,7 @@ tagint taginthash_lookup(const taginthash_t *tptr, tagint key) { /* find the entry in the hash table */ h=taginthash(tptr, key); - for (node=tptr->bucket[h]; node!=NULL; node=node->next) { + for (node=tptr->bucket[h]; node!=nullptr; node=node->next) { if (node->key == key) break; } @@ -191,7 +191,7 @@ tagint *taginthash_keys(taginthash_t *tptr) { keys = (tagint *)calloc(tptr->entries, sizeof(tagint)); for (tagint i=0; i < tptr->size; ++i) { - for (node=tptr->bucket[i]; node != NULL; node=node->next) { + for (node=tptr->bucket[i]; node != nullptr; node=node->next) { keys[node->data] = node->key; } } @@ -242,7 +242,7 @@ void taginthash_destroy(taginthash_t *tptr) { for (i=0; isize; i++) { node = tptr->bucket[i]; - while (node != NULL) { + while (node != nullptr) { last = node; node = node->next; free(last); @@ -250,7 +250,7 @@ void taginthash_destroy(taginthash_t *tptr) { } /* free the entire array of buckets */ - if (tptr->bucket != NULL) { + if (tptr->bucket != nullptr) { free(tptr->bucket); memset(tptr, 0, sizeof(taginthash_t)); } @@ -353,11 +353,11 @@ FixQMMM::FixQMMM(LAMMPS *lmp, int narg, char **arg) : mm_comm = MPI_Comm_f2c(qmmmcfg.mm_comm); /* initialize storage */ - qm_idmap = mm_idmap = NULL; - qm_remap = mm_remap = NULL; - qm_coord = mm_coord = qm_force = mm_force = NULL; - qm_charge =NULL; - mm_type = NULL; + qm_idmap = mm_idmap = nullptr; + qm_remap = mm_remap = nullptr; + qm_coord = mm_coord = qm_force = mm_force = nullptr; + qm_charge =nullptr; + mm_type = nullptr; do_init = 1; diff --git a/src/USER-QTB/fix_qbmsst.cpp b/src/USER-QTB/fix_qbmsst.cpp index ac07d0e0ddb32469807429c911d9068db12648f3..94de771f740bac2af88397222ce2fbc58a204cfc 100644 --- a/src/USER-QTB/fix_qbmsst.cpp +++ b/src/USER-QTB/fix_qbmsst.cpp @@ -246,19 +246,19 @@ FixQBMSST::FixQBMSST(LAMMPS *lmp, int narg, char **arg) : peflag = 1; // allocate qbmsst - temperature = NULL; - pressure = NULL; - pe = NULL; - old_velocity = NULL; - rfix = NULL; - gfactor = NULL; - random = NULL; - omega_H = NULL; - time_H = NULL; - random_array_0 = NULL; - random_array_1 = NULL; - random_array_2 = NULL; - fran = NULL; + temperature = nullptr; + pressure = nullptr; + pe = nullptr; + old_velocity = nullptr; + rfix = nullptr; + gfactor = nullptr; + random = nullptr; + omega_H = nullptr; + time_H = nullptr; + random_array_0 = nullptr; + random_array_1 = nullptr; + random_array_2 = nullptr; + fran = nullptr; // initialize Marsagxlia RNG with processor-unique seed random = new RanMars(lmp,seed + comm->me); @@ -331,7 +331,7 @@ void FixQBMSST::init() boltz = force->boltz; nktv2p = force->nktv2p; mvv2e = force->mvv2e; - if (atom->mass == NULL) + if (atom->mass == nullptr) error->all(FLERR,"Cannot use fix qbmsst without per-type mass defined"); // set compute ptrs diff --git a/src/USER-QTB/fix_qtb.cpp b/src/USER-QTB/fix_qtb.cpp index fb26a580f0fa331993896d84c8450ae827a3cbcb..a53baf4083a66560329e9f97b09e21fc526eec87 100644 --- a/src/USER-QTB/fix_qtb.cpp +++ b/src/USER-QTB/fix_qtb.cpp @@ -94,16 +94,16 @@ FixQTB::FixQTB(LAMMPS *lmp, int narg, char **arg) : maxexchange = 6*N_f+3; // allocate qtb - gfactor1 = NULL; - gfactor3 = NULL; - omega_H = NULL; - time_H = NULL; - random_array_0 = NULL; - random_array_1 = NULL; - random_array_2 = NULL; - fran = NULL; - id_temp = NULL; - temperature = NULL; + gfactor1 = nullptr; + gfactor3 = nullptr; + omega_H = nullptr; + time_H = nullptr; + random_array_0 = nullptr; + random_array_1 = nullptr; + random_array_2 = nullptr; + fran = nullptr; + id_temp = nullptr; + temperature = nullptr; // initialize Marsaglia RNG with processor-unique seed random = new RanMars(lmp,seed + comm->me); @@ -158,7 +158,7 @@ void FixQTB::init() { // copy parameters from other classes double dtv = update->dt; - if (atom->mass == NULL) + if (atom->mass == nullptr) error->all(FLERR,"Cannot use fix msst without per-type mass defined"); //initiate the counter \mu diff --git a/src/USER-QUIP/pair_quip.cpp b/src/USER-QUIP/pair_quip.cpp index 5511efe681fc0ec910ee716f4d593756c0f6d095..d2093941a0673e18684b6be306c53102861ea843 100644 --- a/src/USER-QUIP/pair_quip.cpp +++ b/src/USER-QUIP/pair_quip.cpp @@ -45,10 +45,10 @@ PairQUIP::PairQUIP(LAMMPS *lmp) : Pair(lmp) no_virial_fdotr_compute = 1; manybody_flag = 1; - map = NULL; - quip_potential = NULL; - quip_file = NULL; - quip_string = NULL; + map = nullptr; + quip_potential = nullptr; + quip_file = nullptr; + quip_string = nullptr; } PairQUIP::~PairQUIP() diff --git a/src/USER-REACTION/fix_bond_react.cpp b/src/USER-REACTION/fix_bond_react.cpp index 2c801d23ff9630e37aa36ae3b3499eb4d2100723..9f9a1ce00d24e5ff5676b96155a8bf6371567843 100644 --- a/src/USER-REACTION/fix_bond_react.cpp +++ b/src/USER-REACTION/fix_bond_react.cpp @@ -92,10 +92,10 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : { if (lmp->citeme) lmp->citeme->add(cite_fix_bond_react); - fix1 = NULL; - fix2 = NULL; - fix3 = NULL; - reset_mol_ids = NULL; + fix1 = nullptr; + fix2 = nullptr; + fix3 = nullptr; + reset_mol_ids = nullptr; if (narg < 8) error->all(FLERR,"Illegal fix bond/react command: " "too few arguments"); @@ -116,12 +116,12 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : narrhenius = 0; status = PROCEED; - nxspecial = NULL; - onemol_nxspecial = NULL; - twomol_nxspecial = NULL; - xspecial = NULL; - onemol_xspecial = NULL; - twomol_xspecial = NULL; + nxspecial = nullptr; + onemol_nxspecial = nullptr; + twomol_nxspecial = nullptr; + xspecial = nullptr; + onemol_xspecial = nullptr; + twomol_xspecial = nullptr; // these group names are reserved for use exclusively by bond/react master_group = (char *) "bond_react_MASTER_group"; @@ -472,16 +472,16 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : // allocate arrays local to this fix nmax = 0; - partner = finalpartner = NULL; - distsq = NULL; - probability = NULL; + partner = finalpartner = nullptr; + distsq = nullptr; + probability = nullptr; maxcreate = 0; - created = NULL; - ncreate = NULL; + created = nullptr; + ncreate = nullptr; allncreate = 0; local_num_mega = 0; ghostly_num_mega = 0; - restore = NULL; + restore = nullptr; // zero out stats global_megasize = 0; @@ -489,17 +489,17 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : glove_counter = 0; guess_branch = new int[MAXGUESS](); pioneer_count = new int[max_natoms]; - local_mega_glove = NULL; - ghostly_mega_glove = NULL; - global_mega_glove = NULL; + local_mega_glove = nullptr; + ghostly_mega_glove = nullptr; + global_mega_glove = nullptr; // these are merely loop indices that became important pion = neigh = trace = 0; - id_fix1 = NULL; - id_fix2 = NULL; - id_fix3 = NULL; - statted_id = NULL; + id_fix1 = nullptr; + id_fix2 = nullptr; + id_fix3 = nullptr; + statted_id = nullptr; custom_exclude_flag = 0; // used to store restart info @@ -708,7 +708,7 @@ void FixBondReact::post_constructor() int unused; char * idprop; idprop = (char *) fix->extract("property",unused); - if (idprop == NULL) + if (idprop == nullptr) error->all(FLERR,"Exclude group must be a per-atom property group"); len = strlen(idprop) + 1; @@ -750,7 +750,7 @@ void FixBondReact::init() // check cutoff for iatomtype,jatomtype for (int i = 0; i < nreacts; i++) { - if (force->pair == NULL || cutsq[i][1] > force->pair->cutsq[iatomtype[i]][jatomtype[i]]) + if (force->pair == nullptr || cutsq[i][1] > force->pair->cutsq[iatomtype[i]][jatomtype[i]]) error->all(FLERR,"Bond/react: Fix bond/react cutoff is longer than pairwise cutoff"); } @@ -3132,7 +3132,7 @@ void FixBondReact::read(int myrxn) // skip 1st line of file eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Bond/react: Unexpected end of superimpose file"); + if (eof == nullptr) error->one(FLERR,"Bond/react: Unexpected end of superimpose file"); // read header lines // skip blank lines or lines that start with "#" @@ -3403,7 +3403,7 @@ void FixBondReact::readID(char *strarg, int iconstr, int mode, int myID) void FixBondReact::open(char *file) { fp = fopen(file,"r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Bond/react: Cannot open map file %s",file); error->one(FLERR,str); @@ -3414,7 +3414,7 @@ void FixBondReact::readline(char *line) { int n; if (me == 0) { - if (fgets(line,MAXLINE,fp) == NULL) n = 0; + if (fgets(line,MAXLINE,fp) == nullptr) n = 0; else n = strlen(line) + 1; } MPI_Bcast(&n,1,MPI_INT,0,world); @@ -3431,11 +3431,11 @@ void FixBondReact::parse_keyword(int flag, char *line, char *keyword) int eof = 0; if (me == 0) { - if (fgets(line,MAXLINE,fp) == NULL) eof = 1; + if (fgets(line,MAXLINE,fp) == nullptr) eof = 1; while (eof == 0 && strspn(line," \t\n\r") == strlen(line)) { - if (fgets(line,MAXLINE,fp) == NULL) eof = 1; + if (fgets(line,MAXLINE,fp) == nullptr) eof = 1; } - if (fgets(keyword,MAXLINE,fp) == NULL) eof = 1; + if (fgets(keyword,MAXLINE,fp) == nullptr) eof = 1; } // if eof, set keyword empty and return @@ -3477,7 +3477,7 @@ int FixBondReact::parse(char *line, char **words, int max) int nwords = 0; words[nwords++] = strtok(line," \t\n\r\f"); - while ((ptr = strtok(NULL," \t\n\r\f"))) { + while ((ptr = strtok(nullptr," \t\n\r\f"))) { if (nwords < max) words[nwords] = ptr; nwords++; } diff --git a/src/USER-REAXC/compute_spec_atom.cpp b/src/USER-REAXC/compute_spec_atom.cpp index bc5b26b69907040779d1dd2553bb7080cf67ee29..1c4856d7281ec91aadd1f2b0414ef27bc5d4c961 100644 --- a/src/USER-REAXC/compute_spec_atom.cpp +++ b/src/USER-REAXC/compute_spec_atom.cpp @@ -117,8 +117,8 @@ ComputeSpecAtom::ComputeSpecAtom(LAMMPS *lmp, int narg, char **arg) : } nmax = 0; - vector = NULL; - array = NULL; + vector = nullptr; + array = nullptr; } diff --git a/src/USER-REAXC/fix_qeq_reax.cpp b/src/USER-REAXC/fix_qeq_reax.cpp index 4bb3728a4b84b2f99c53a27d43213a7107a912c8..33a9633c0f4937fa86a81db9b2a894e6823d8ae3 100644 --- a/src/USER-REAXC/fix_qeq_reax.cpp +++ b/src/USER-REAXC/fix_qeq_reax.cpp @@ -60,7 +60,7 @@ static const char cite_fix_qeq_reax[] = /* ---------------------------------------------------------------------- */ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), pertype_option(NULL) + Fix(lmp, narg, arg), pertype_option(nullptr) { if (narg<8 || narg>11) error->all(FLERR,"Illegal fix qeq/reax command"); @@ -90,33 +90,33 @@ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : } else error->all(FLERR,"Illegal fix qeq/reax command"); iarg++; } - shld = NULL; + shld = nullptr; nn = n_cap = 0; NN = nmax = 0; m_fill = m_cap = 0; pack_flag = 0; - s = NULL; - t = NULL; + s = nullptr; + t = nullptr; nprev = 4; - Hdia_inv = NULL; - b_s = NULL; - b_t = NULL; - b_prc = NULL; - b_prm = NULL; + Hdia_inv = nullptr; + b_s = nullptr; + b_t = nullptr; + b_prc = nullptr; + b_prm = nullptr; // CG - p = NULL; - q = NULL; - r = NULL; - d = NULL; + p = nullptr; + q = nullptr; + r = nullptr; + d = nullptr; // H matrix - H.firstnbr = NULL; - H.numnbrs = NULL; - H.jlist = NULL; - H.val = NULL; + H.firstnbr = nullptr; + H.numnbrs = nullptr; + H.jlist = nullptr; + H.val = nullptr; // dual CG support // Update comm sizes for this fix @@ -126,10 +126,10 @@ FixQEqReax::FixQEqReax(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - reaxc = NULL; + reaxc = nullptr; reaxc = (PairReaxC *) force->pair_match("^reax/c",0); - s_hist = t_hist = NULL; + s_hist = t_hist = nullptr; atom->add_callback(Atom::GROW); } @@ -194,13 +194,13 @@ void FixQEqReax::pertype_parameters(char *arg) if (strcmp(arg,"reax/c") == 0) { reaxflag = 1; Pair *pair = force->pair_match("reax/c",0); - if (pair == NULL) error->all(FLERR,"No pair reax/c for fix qeq/reax"); + if (pair == nullptr) error->all(FLERR,"No pair reax/c for fix qeq/reax"); int tmp; chi = (double *) pair->extract("chi",tmp); eta = (double *) pair->extract("eta",tmp); gamma = (double *) pair->extract("gamma",tmp); - if (chi == NULL || eta == NULL || gamma == NULL) + if (chi == nullptr || eta == nullptr || gamma == nullptr) error->all(FLERR, "Fix qeq/reax could not extract params from pair reax/c"); return; @@ -218,7 +218,7 @@ void FixQEqReax::pertype_parameters(char *arg) memory->create(gamma,ntypes+1,"qeq/reax:gamma"); if (comm->me == 0) { - if ((pf = fopen(arg,"r")) == NULL) + if ((pf = fopen(arg,"r")) == nullptr) error->one(FLERR,"Fix qeq/reax parameter file could not be found"); for (i = 1; i <= ntypes && !feof(pf); i++) { @@ -389,7 +389,7 @@ void FixQEqReax::init_shielding() int ntypes; ntypes = atom->ntypes; - if (shld == NULL) + if (shld == nullptr) memory->create(shld,ntypes+1,ntypes+1,"qeq:shielding"); for (i = 1; i <= ntypes; ++i) diff --git a/src/USER-REAXC/fix_reaxc.cpp b/src/USER-REAXC/fix_reaxc.cpp index 8bda03a0233c66d104a873d303b232a2315bee54..2200d66daa4434f29370ef24480e02506cf97de6 100644 --- a/src/USER-REAXC/fix_reaxc.cpp +++ b/src/USER-REAXC/fix_reaxc.cpp @@ -41,8 +41,8 @@ FixReaxC::FixReaxC(LAMMPS *lmp,int narg, char **arg) : // register with atom class oldnmax = 0; - num_bonds = NULL; - num_hbonds = NULL; + num_bonds = nullptr; + num_hbonds = nullptr; grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); diff --git a/src/USER-REAXC/fix_reaxc_bonds.cpp b/src/USER-REAXC/fix_reaxc_bonds.cpp index c0ffd4c17e89d23d6c718f1f6ff856716b82aac1..a16446e769844a4ea30baab9dafb4523f5e49276 100644 --- a/src/USER-REAXC/fix_reaxc_bonds.cpp +++ b/src/USER-REAXC/fix_reaxc_bonds.cpp @@ -65,7 +65,7 @@ FixReaxCBonds::FixReaxCBonds(LAMMPS *lmp, int narg, char **arg) : #endif } else fp = fopen(arg[4],"w"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix reax/c/bonds file %s",arg[4]); error->one(FLERR,str); @@ -75,9 +75,9 @@ FixReaxCBonds::FixReaxCBonds(LAMMPS *lmp, int narg, char **arg) : if (atom->tag_consecutive() == 0) error->all(FLERR,"Atom IDs must be consecutive for fix reax/c bonds"); - abo = NULL; - neighid = NULL; - numneigh = NULL; + abo = nullptr; + neighid = nullptr; + numneigh = nullptr; allocate(); } @@ -114,7 +114,7 @@ void FixReaxCBonds::setup(int /*vflag*/) void FixReaxCBonds::init() { reaxc = (PairReaxC *) force->pair_match("reax/c",0); - if (reaxc == NULL) error->all(FLERR,"Cannot use fix reax/c/bonds without " + if (reaxc == nullptr) error->all(FLERR,"Cannot use fix reax/c/bonds without " "pair_style reax/c, reax/c/kk, or reax/c/omp"); } @@ -235,7 +235,7 @@ void FixReaxCBonds::PassBuffer(double *buf, int &nbuf_local) } j += (5+numbonds); - if (atom->molecule == NULL ) buf[j] = 0.0; + if (atom->molecule == nullptr ) buf[j] = 0.0; else buf[j] = atom->molecule[i]; j ++; diff --git a/src/USER-REAXC/fix_reaxc_species.cpp b/src/USER-REAXC/fix_reaxc_species.cpp index ec03ab18081177eee91531f39a06f6617dd693a6..95274857053392ce17731066f02117db170b3e5f 100644 --- a/src/USER-REAXC/fix_reaxc_species.cpp +++ b/src/USER-REAXC/fix_reaxc_species.cpp @@ -97,7 +97,7 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : error->warning(FLERR,"Resetting reneighboring criteria for fix reax/c/species"); } - tmparg = NULL; + tmparg = nullptr; memory->create(tmparg,4,4,"reax/c/species:tmparg"); strcpy(tmparg[0],arg[3]); strcpy(tmparg[1],arg[4]); @@ -119,28 +119,28 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : #endif } else fp = fopen(arg[6],"w"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open fix reax/c/species file %s",arg[6]); error->one(FLERR,str); } } - x0 = NULL; - clusterID = NULL; + x0 = nullptr; + clusterID = nullptr; int ntmp = 1; memory->create(x0,ntmp,"reax/c/species:x0"); memory->create(clusterID,ntmp,"reax/c/species:clusterID"); vector_atom = clusterID; - BOCut = NULL; - Name = NULL; - MolName = NULL; - MolType = NULL; - NMol = NULL; - nd = NULL; - molmap = NULL; + BOCut = nullptr; + Name = nullptr; + MolName = nullptr; + MolType = nullptr; + NMol = nullptr; + nd = nullptr; + molmap = nullptr; nmax = 0; setupflag = 0; @@ -156,8 +156,8 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : BOCut[i][j] = bg_cut; // optional args - eletype = NULL; - ele = filepos = NULL; + eletype = nullptr; + ele = filepos = nullptr; eleflag = posflag = padflag = 0; singlepos_opened = multipos_opened = 0; @@ -213,7 +213,7 @@ FixReaxCSpecies::FixReaxCSpecies(LAMMPS *lmp, int narg, char **arg) : } else { if (me == 0) { pos = fopen(filepos, "w"); - if (pos == NULL) error->one(FLERR,"Cannot open fix reax/c/species position file"); + if (pos == nullptr) error->one(FLERR,"Cannot open fix reax/c/species position file"); } singlepos_opened = 1; multipos = 0; @@ -278,7 +278,7 @@ int FixReaxCSpecies::setmask() void FixReaxCSpecies::setup(int /*vflag*/) { ntotal = static_cast (atom->natoms); - if (Name == NULL) + if (Name == nullptr) memory->create(Name,ntypes,"reax/c/species:Name"); post_integrate(); @@ -292,7 +292,7 @@ void FixReaxCSpecies::init() error->all(FLERR,"Cannot use fix reax/c/species unless atoms have IDs"); reaxc = (PairReaxC *) force->pair_match("reax/c",0); - if (reaxc == NULL) error->all(FLERR,"Cannot use fix reax/c/species without " + if (reaxc == nullptr) error->all(FLERR,"Cannot use fix reax/c/species without " "pair_style reax/c, reax/c/kk, or reax/c/omp"); reaxc->fixspecies_flag = 1; @@ -579,7 +579,7 @@ void FixReaxCSpecies::FindMolecule () void FixReaxCSpecies::SortMolecule(int &Nmole) { memory->destroy(molmap); - molmap = NULL; + molmap = nullptr; int n, idlo, idhi; int *mask =atom->mask; @@ -641,7 +641,7 @@ void FixReaxCSpecies::SortMolecule(int &Nmole) } memory->destroy(molmap); - molmap = NULL; + molmap = nullptr; } @@ -656,11 +656,11 @@ void FixReaxCSpecies::FindSpecies(int Nmole, int &Nspec) int *Nameall, *NMolall; memory->destroy(MolName); - MolName = NULL; + MolName = nullptr; memory->create(MolName,Nmole*(ntypes+1),"reax/c/species:MolName"); memory->destroy(NMol); - NMol = NULL; + NMol = nullptr; memory->create(NMol,Nmole,"reax/c/species:NMol"); for (m = 0; m < Nmole; m ++) NMol[m] = 1; @@ -705,11 +705,11 @@ void FixReaxCSpecies::FindSpecies(int Nmole, int &Nspec) memory->destroy(Nameall); memory->destroy(nd); - nd = NULL; + nd = nullptr; memory->create(nd,Nspec,"reax/c/species:nd"); memory->destroy(MolType); - MolType = NULL; + MolType = nullptr; memory->create(MolType,Nspec*(ntypes+2),"reax/c/species:MolType"); } @@ -793,8 +793,8 @@ void FixReaxCSpecies::OpenPos() if (me == 0) { pos = fopen(filecurrent, "w"); - if (pos == NULL) error->one(FLERR,"Cannot open fix reax/c/species position file"); - } else pos = NULL; + if (pos == nullptr) error->one(FLERR,"Cannot open fix reax/c/species position file"); + } else pos = nullptr; multipos_opened = 1; free(filecurrent); @@ -831,7 +831,7 @@ void FixReaxCSpecies::WritePos(int Nmole, int Nspec) fprintf(pos,"ID\tAtom_Count\tType\tAve_q\t\tCoM_x\t\tCoM_y\t\tCoM_z\n"); } - Nameall = NULL; + Nameall = nullptr; memory->create(Nameall,ntypes,"reax/c/species:Nameall"); for (m = 1; m <= Nmole; m ++) { diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index c38257ae30590ef433086e4b2b208e73891b7c28..fd97a26359f445f05d5d1cb4e77b760b6e54d8d5 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -117,16 +117,16 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) system->bndry_cuts.ghost_hbond = 0; system->bndry_cuts.ghost_bond = 0; system->bndry_cuts.ghost_cutoff = 0; - system->my_atoms = NULL; + system->my_atoms = nullptr; system->pair_ptr = this; system->error_ptr = error; control->error_ptr = error; system->omp_active = 0; - fix_reax = NULL; - tmpid = NULL; - tmpbo = NULL; + fix_reax = nullptr; + tmpid = nullptr; + tmpbo = nullptr; nextra = 14; pvector = new double[nextra]; @@ -318,7 +318,7 @@ void PairReaxC::coeff( int nargs, char **args ) char *file = args[2]; FILE *fp; fp = utils::open_potential(file,lmp,nullptr); - if (fp != NULL) + if (fp != nullptr) Read_Force_Field(fp, &(system->reax_param), control); else { char str[128]; @@ -327,7 +327,7 @@ void PairReaxC::coeff( int nargs, char **args ) } // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" int itmp = 0; int nreax_types = system->reax_param.num_atom_types; @@ -424,7 +424,7 @@ void PairReaxC::init_style( ) if (lists[i].allocated != 1) lists[i].allocated = 0; - if (fix_reax == NULL) { + if (fix_reax == nullptr) { char **fixarg = new char*[3]; fixarg[0] = (char *) fix_id; fixarg[1] = (char *) "all"; @@ -819,7 +819,7 @@ void *PairReaxC::extract(const char *str, int &dim) else gamma[i] = 0.0; return (void *) gamma; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-REAXC/reaxc_allocate.cpp b/src/USER-REAXC/reaxc_allocate.cpp index f0b0e822993f4ed85de7cf1b75bbf1226375b502..0390769b538a8489d1a513bea90e35eda2217684 100644 --- a/src/USER-REAXC/reaxc_allocate.cpp +++ b/src/USER-REAXC/reaxc_allocate.cpp @@ -57,10 +57,10 @@ int PreAllocate_Space( reax_system *system, control_params * /*control*/, // Nullify some arrays only used in omp styles // Should be safe to do here since called in pair->setup(); #ifdef LMP_USER_OMP - workspace->CdDeltaReduction = NULL; - workspace->forceReduction = NULL; - workspace->valence_angle_atom_myoffset = NULL; - workspace->my_ext_pressReduction = NULL; + workspace->CdDeltaReduction = nullptr; + workspace->forceReduction = nullptr; + workspace->valence_angle_atom_myoffset = nullptr; + workspace->my_ext_pressReduction = nullptr; #else LMP_UNUSED_PARAM(workspace); #endif diff --git a/src/USER-REAXC/reaxc_control.cpp b/src/USER-REAXC/reaxc_control.cpp index 12aa989fa211ee101bef0252600ef946474dbab5..1c8c24c3154d8ef1776631728039523c56be55fc 100644 --- a/src/USER-REAXC/reaxc_control.cpp +++ b/src/USER-REAXC/reaxc_control.cpp @@ -41,7 +41,7 @@ char Read_Control_File( char *control_file, control_params* control, double val; /* open control file */ - if ( (fp = fopen( control_file, "r" ) ) == NULL ) { + if ( (fp = fopen( control_file, "r" ) ) == nullptr ) { control->error_ptr->all(FLERR, "The control file cannot be opened"); } diff --git a/src/USER-REAXC/reaxc_io_tools.cpp b/src/USER-REAXC/reaxc_io_tools.cpp index f68a2a2abbc1aefbc26d0a491efe7a32aaa96b4c..866e3c98916bee1369aa7e157d81d830dc411d5e 100644 --- a/src/USER-REAXC/reaxc_io_tools.cpp +++ b/src/USER-REAXC/reaxc_io_tools.cpp @@ -50,7 +50,7 @@ int Init_Output_Files( reax_system *system, control_params *control, /* init potentials file */ sprintf( temp, "%s.pot", control->sim_name ); - if ((out_control->pot = fopen( temp, "w" )) != NULL) { + if ((out_control->pot = fopen( temp, "w" )) != nullptr) { fflush( out_control->pot ); } else { strcpy( msg, "init_out_controls: .pot file could not be opened\n" ); @@ -65,7 +65,7 @@ int Init_Output_Files( reax_system *system, control_params *control, control->ensemble == iNPT || control->ensemble == sNPT ) { sprintf( temp, "%s.prs", control->sim_name ); - if ((out_control->prs = fopen( temp, "w" )) != NULL) { + if ((out_control->prs = fopen( temp, "w" )) != nullptr) { fprintf(out_control->prs,"%8s%13s%13s%13s%13s%13s%13s%13s\n", "step", "Pint/norm[x]", "Pint/norm[y]", "Pint/norm[z]", "Pext/Ptot[x]", "Pext/Ptot[y]", "Pext/Ptot[z]", "Pkin/V" ); @@ -91,12 +91,12 @@ int Close_Output_Files( reax_system *system, control_params * /* control */, if (system->my_rank == MASTER_NODE) { if (out_control->pot) { fclose( out_control->pot ); - out_control->pot = NULL; + out_control->pot = nullptr; } if (out_control->prs) { fclose(out_control->prs); - out_control->prs = NULL; + out_control->prs = nullptr; } } diff --git a/src/USER-REAXC/reaxc_list.cpp b/src/USER-REAXC/reaxc_list.cpp index 0880d963114a71ffd2aa90f998695fffe8ef8615..ea59b84ff973f1dc0024f9efa063d30f9fdfe730 100644 --- a/src/USER-REAXC/reaxc_list.cpp +++ b/src/USER-REAXC/reaxc_list.cpp @@ -106,37 +106,37 @@ void Delete_List( reax_list *l ) sfree(l->error_ptr, l->index, "list:index" ); sfree(l->error_ptr, l->end_index, "list:end_index" ); - l->index = NULL; - l->end_index = NULL; + l->index = nullptr; + l->end_index = nullptr; switch(l->type) { case TYP_VOID: sfree(l->error_ptr, l->select.v, "list:v" ); - l->select.v = NULL; + l->select.v = nullptr; break; case TYP_HBOND: sfree(l->error_ptr, l->select.hbond_list, "list:hbonds" ); - l->select.hbond_list = NULL; + l->select.hbond_list = nullptr; break; case TYP_FAR_NEIGHBOR: sfree(l->error_ptr, l->select.far_nbr_list, "list:far_nbrs" ); - l->select.far_nbr_list = NULL; + l->select.far_nbr_list = nullptr; break; case TYP_BOND: sfree(l->error_ptr, l->select.bond_list, "list:bonds" ); - l->select.bond_list = NULL; + l->select.bond_list = nullptr; break; case TYP_DBO: sfree(l->error_ptr, l->select.dbo_list, "list:dbos" ); - l->select.dbo_list = NULL; + l->select.dbo_list = nullptr; break; case TYP_DDELTA: sfree(l->error_ptr, l->select.dDelta_list, "list:dDeltas" ); - l->select.dDelta_list = NULL; + l->select.dDelta_list = nullptr; break; case TYP_THREE_BODY: sfree(l->error_ptr, l->select.three_body_list, "list:three_bodies" ); - l->select.three_body_list = NULL; + l->select.three_body_list = nullptr; break; default: diff --git a/src/USER-REAXC/reaxc_tool_box.cpp b/src/USER-REAXC/reaxc_tool_box.cpp index 07a45b9467546fe80a8fa04005f58d6b32c444f4..b78b00568d62f2aa5f31a692e9d0c74c10371f24 100644 --- a/src/USER-REAXC/reaxc_tool_box.cpp +++ b/src/USER-REAXC/reaxc_tool_box.cpp @@ -48,7 +48,7 @@ double Get_Time( ) t /= 1000.0; return t; #else - gettimeofday(&tim, NULL ); + gettimeofday(&tim, nullptr ); return( tim.tv_sec + (tim.tv_usec / 1000000.0) ); #endif } @@ -62,7 +62,7 @@ int Tokenize( char* s, char*** tok ) strncpy( test, s, MAX_LINE-1); - for( word = strtok(test, sep); word; word = strtok(NULL, sep) ) { + for( word = strtok(test, sep); word; word = strtok(nullptr, sep) ) { strncpy( (*tok)[count], word, MAX_LINE ); count++; } @@ -84,11 +84,11 @@ void *smalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, const char *name ) if (error_ptr) error_ptr->one(FLERR,errmsg); else fputs(errmsg,stderr); - return NULL; + return nullptr; } ptr = malloc( n ); - if (ptr == NULL) { + if (ptr == nullptr) { snprintf(errmsg, 256, "Failed to allocate %ld bytes for array %s", n, name); if (error_ptr) error_ptr->one(FLERR,errmsg); else fputs(errmsg,stderr); @@ -109,7 +109,7 @@ void *scalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const c "returning NULL.\n", n, name ); if (error_ptr) error_ptr->one(FLERR,errmsg); else fputs(errmsg,stderr); - return NULL; + return nullptr; } if (size <= 0) { @@ -117,11 +117,11 @@ void *scalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const c "returning NULL", name, size ); if (error_ptr) error_ptr->one(FLERR,errmsg); else fputs(errmsg,stderr); - return NULL; + return nullptr; } ptr = calloc( n, size ); - if (ptr == NULL) { + if (ptr == nullptr) { char errmsg[256]; snprintf(errmsg, 256, "Failed to allocate %ld bytes for array %s", n*size, name); if (error_ptr) error_ptr->one(FLERR,errmsg); @@ -135,7 +135,7 @@ void *scalloc( LAMMPS_NS::Error *error_ptr, rc_bigint n, rc_bigint size, const c /* safe free */ void sfree( LAMMPS_NS::Error* error_ptr, void *ptr, const char *name ) { - if (ptr == NULL) { + if (ptr == nullptr) { char errmsg[256]; snprintf(errmsg, 256, "Trying to free the already NULL pointer %s", name ); if (error_ptr) error_ptr->one(FLERR,errmsg); @@ -144,6 +144,6 @@ void sfree( LAMMPS_NS::Error* error_ptr, void *ptr, const char *name ) } free( ptr ); - ptr = NULL; + ptr = nullptr; } diff --git a/src/USER-REAXC/reaxc_traj.cpp b/src/USER-REAXC/reaxc_traj.cpp index 717bf741e74cda1994a386249ca07203eecab181..698715de2204e04e7c79db7a81a1a0d68fc2ca39 100644 --- a/src/USER-REAXC/reaxc_traj.cpp +++ b/src/USER-REAXC/reaxc_traj.cpp @@ -41,7 +41,7 @@ int Reallocate_Output_Buffer( LAMMPS_NS::Error *error_ptr, output_controls *out_ out_control->buffer_len = (int)(req_space*REAX_SAFE_ZONE); out_control->buffer = (char*) malloc(out_control->buffer_len*sizeof(char)); - if (out_control->buffer == NULL) { + if (out_control->buffer == nullptr) { char errmsg[256]; snprintf(errmsg, 256, "Insufficient memory for required buffer size %d", (int) (req_space*REAX_SAFE_ZONE)); error_ptr->one(FLERR,errmsg); @@ -341,7 +341,7 @@ int Init_Traj( reax_system *system, control_params *control, /* allocate line & buffer space */ out_control->line = (char*) calloc( MAX_TRJ_LINE_LEN + 1, sizeof(char) ); out_control->buffer_len = 0; - out_control->buffer = NULL; + out_control->buffer = nullptr; /* write trajectory header and atom info, if applicable */ if (out_control->traj_method == REG_TRAJ) { diff --git a/src/USER-SCAFACOS/scafacos.cpp b/src/USER-SCAFACOS/scafacos.cpp index 72da2599c71ad22934f3e4051a570cc315cb2b7b..42f46cd005d565f7c212fc97a4677efba70f025f 100644 --- a/src/USER-SCAFACOS/scafacos.cpp +++ b/src/USER-SCAFACOS/scafacos.cpp @@ -42,10 +42,10 @@ Scafacos::Scafacos(LAMMPS *lmp) : KSpace(lmp) initialized = 0; maxatom = 0; - xpbc = NULL; - epot = NULL; - efield = NULL; - fcs = NULL; + xpbc = nullptr; + epot = nullptr; + efield = nullptr; + fcs = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SDPD/fix_meso_move.cpp b/src/USER-SDPD/fix_meso_move.cpp index a6320d5c19c5dffce9e2baa939dae2c58fb7d208..ca7696303399622c2956f4f41f7dd68f98aafb73 100644 --- a/src/USER-SDPD/fix_meso_move.cpp +++ b/src/USER-SDPD/fix_meso_move.cpp @@ -43,9 +43,9 @@ enum{EQUAL,ATOM}; FixMesoMove::FixMesoMove (LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xvarstr(NULL), yvarstr(NULL), zvarstr(NULL), - vxvarstr(NULL), vyvarstr(NULL), vzvarstr(NULL), - xoriginal(NULL), displace(NULL), velocity(NULL) { + xvarstr(nullptr), yvarstr(nullptr), zvarstr(nullptr), + vxvarstr(nullptr), vyvarstr(nullptr), vzvarstr(nullptr), + xoriginal(nullptr), displace(nullptr), velocity(nullptr) { if ((atom->esph_flag != 1) || (atom->rho_flag != 1)) error->all(FLERR, "fix meso/move command requires atom_style with both energy and density"); @@ -126,37 +126,37 @@ FixMesoMove::FixMesoMove (LAMMPS *lmp, int narg, char **arg) : if (narg < 10) error->all(FLERR,"Illegal fix meso/move command"); iarg = 10; mstyle = VARIABLE; - if (strcmp(arg[4],"NULL") == 0) xvarstr = NULL; + if (strcmp(arg[4],"NULL") == 0) xvarstr = nullptr; else if (strstr(arg[4],"v_") == arg[4]) { int n = strlen(&arg[4][2]) + 1; xvarstr = new char[n]; strcpy(xvarstr,&arg[4][2]); } else error->all(FLERR,"Illegal fix meso/move command"); - if (strcmp(arg[5],"NULL") == 0) yvarstr = NULL; + if (strcmp(arg[5],"NULL") == 0) yvarstr = nullptr; else if (strstr(arg[5],"v_") == arg[5]) { int n = strlen(&arg[5][2]) + 1; yvarstr = new char[n]; strcpy(yvarstr,&arg[5][2]); } else error->all(FLERR,"Illegal fix meso/move command"); - if (strcmp(arg[6],"NULL") == 0) zvarstr = NULL; + if (strcmp(arg[6],"NULL") == 0) zvarstr = nullptr; else if (strstr(arg[6],"v_") == arg[6]) { int n = strlen(&arg[6][2]) + 1; zvarstr = new char[n]; strcpy(zvarstr,&arg[6][2]); } else error->all(FLERR,"Illegal fix meso/move command"); - if (strcmp(arg[7],"NULL") == 0) vxvarstr = NULL; + if (strcmp(arg[7],"NULL") == 0) vxvarstr = nullptr; else if (strstr(arg[7],"v_") == arg[7]) { int n = strlen(&arg[7][2]) + 1; vxvarstr = new char[n]; strcpy(vxvarstr,&arg[7][2]); } else error->all(FLERR,"Illegal fix meso/move command"); - if (strcmp(arg[8],"NULL") == 0) vyvarstr = NULL; + if (strcmp(arg[8],"NULL") == 0) vyvarstr = nullptr; else if (strstr(arg[8],"v_") == arg[8]) { int n = strlen(&arg[8][2]) + 1; vyvarstr = new char[n]; strcpy(vyvarstr,&arg[8][2]); } else error->all(FLERR,"Illegal fix meso/move command"); - if (strcmp(arg[9],"NULL") == 0) vzvarstr = NULL; + if (strcmp(arg[9],"NULL") == 0) vzvarstr = nullptr; else if (strstr(arg[9],"v_") == arg[9]) { int n = strlen(&arg[9][2]) + 1; vzvarstr = new char[n]; @@ -237,7 +237,7 @@ FixMesoMove::FixMesoMove (LAMMPS *lmp, int narg, char **arg) : atom->add_callback(Atom::GROW); atom->add_callback(Atom::RESTART); - displace = velocity = NULL; + displace = velocity = nullptr; // xoriginal = initial unwrapped positions of atoms @@ -353,9 +353,9 @@ void FixMesoMove::init () { memory->destroy(displace); memory->destroy(velocity); if (displaceflag) memory->create(displace,maxatom,3,"move:displace"); - else displace = NULL; + else displace = nullptr; if (velocityflag) memory->create(velocity,maxatom,3,"move:velocity"); - else velocity = NULL; + else velocity = nullptr; } void FixMesoMove::setup_pre_force (int /*vflag*/) { @@ -731,7 +731,7 @@ void FixMesoMove::initial_integrate (int /*vflag*/) { } /* ---------------------------------------------------------------------- - final NVE of particles with NULL components + final NVE of particles with nullptr components ------------------------------------------------------------------------- */ void FixMesoMove::final_integrate () { diff --git a/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp b/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp index bf2fc73b015c97ea1506a56c59d80f8fc4f6593c..b3a084ab1d8ebdeff38b29b7db642eb035157a9f 100644 --- a/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp +++ b/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp @@ -307,7 +307,7 @@ void PairSDPDTaitwaterIsothermal::coeff (int narg, char **arg) { void PairSDPDTaitwaterIsothermal::init_style() { - if ((!atom->rho_flag) || (atom->drho == NULL)) + if ((!atom->rho_flag) || (atom->drho == nullptr)) error->all(FLERR,"Pair style dpd/taitwater/isothermal requires atom " "attributes rho and drho"); diff --git a/src/USER-SMD/compute_smd_contact_radius.cpp b/src/USER-SMD/compute_smd_contact_radius.cpp index 46cbc602f2792d56250ce7ac2cee977f45c83f77..ccab79f85e54d37ec387e3116b62ad19b5f86085 100644 --- a/src/USER-SMD/compute_smd_contact_radius.cpp +++ b/src/USER-SMD/compute_smd_contact_radius.cpp @@ -46,7 +46,7 @@ ComputeSMDContactRadius::ComputeSMDContactRadius(LAMMPS *lmp, int narg, char **a size_peratom_cols = 0; nmax = 0; - contact_radius_vector = NULL; + contact_radius_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_damage.cpp b/src/USER-SMD/compute_smd_damage.cpp index 96a936cd82b7dc83128278115ddc6af7fe189271..9e58903c956c70b664f88bf3b69cbd6c737e16f4 100644 --- a/src/USER-SMD/compute_smd_damage.cpp +++ b/src/USER-SMD/compute_smd_damage.cpp @@ -46,7 +46,7 @@ ComputeSMDDamage::ComputeSMDDamage(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - damage_vector = NULL; + damage_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_hourglass_error.cpp b/src/USER-SMD/compute_smd_hourglass_error.cpp index 3b6b9000048b84ec3637e3325d27c9f58b34ce11..41180250391716b31f107ccafd871aa458da2a41 100644 --- a/src/USER-SMD/compute_smd_hourglass_error.cpp +++ b/src/USER-SMD/compute_smd_hourglass_error.cpp @@ -49,7 +49,7 @@ ComputeSMDHourglassError::ComputeSMDHourglassError(LAMMPS *lmp, int narg, char * size_peratom_cols = 0; nmax = 0; - hourglass_error_vector = NULL; + hourglass_error_vector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -86,7 +86,7 @@ void ComputeSMDHourglassError::compute_peratom() { int itmp = 0; double *hourglass_error = (double *) force->pair->extract("smd/tlsph/hourglass_error_ptr", itmp); - if (hourglass_error == NULL) { + if (hourglass_error == nullptr) { error->all(FLERR, "compute smd/hourglass_error failed to access hourglass_error array"); } diff --git a/src/USER-SMD/compute_smd_internal_energy.cpp b/src/USER-SMD/compute_smd_internal_energy.cpp index 90ddb748399627a0dc52a3cd56ff019b57b1612e..c7b11e22cfd1ed14234b36a640721c06300b2c7e 100644 --- a/src/USER-SMD/compute_smd_internal_energy.cpp +++ b/src/USER-SMD/compute_smd_internal_energy.cpp @@ -46,7 +46,7 @@ ComputeSMDInternalEnergy::ComputeSMDInternalEnergy(LAMMPS *lmp, int narg, char * size_peratom_cols = 0; nmax = 0; - internal_energy_vector = NULL; + internal_energy_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_plastic_strain.cpp b/src/USER-SMD/compute_smd_plastic_strain.cpp index c1c001a5dd79a106f32c5e0c81cd90cd207b1385..842d848890ca92fa8c5cf3d686eb32fc4cba00a3 100644 --- a/src/USER-SMD/compute_smd_plastic_strain.cpp +++ b/src/USER-SMD/compute_smd_plastic_strain.cpp @@ -46,7 +46,7 @@ ComputeSMDPlasticStrain::ComputeSMDPlasticStrain(LAMMPS *lmp, int narg, char **a size_peratom_cols = 0; nmax = 0; - plastic_strain_vector = NULL; + plastic_strain_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_plastic_strain_rate.cpp b/src/USER-SMD/compute_smd_plastic_strain_rate.cpp index 272a2c59e5adedb984ae542ab418c09e4846542d..907e503f54f32f98c05483894ad59ca127ac6a4b 100644 --- a/src/USER-SMD/compute_smd_plastic_strain_rate.cpp +++ b/src/USER-SMD/compute_smd_plastic_strain_rate.cpp @@ -46,7 +46,7 @@ ComputeSMDPlasticStrainRate::ComputeSMDPlasticStrainRate(LAMMPS *lmp, int narg, size_peratom_cols = 0; nmax = 0; - plastic_strain_rate_vector = NULL; + plastic_strain_rate_vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_rho.cpp b/src/USER-SMD/compute_smd_rho.cpp index d9c0a99b070b65b680350580c4de285f1ef468f5..89db0b0acdea05d3b31b0923bc106cd2dd675d2d 100644 --- a/src/USER-SMD/compute_smd_rho.cpp +++ b/src/USER-SMD/compute_smd_rho.cpp @@ -46,7 +46,7 @@ ComputeSMDRho::ComputeSMDRho(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - rhoVector = NULL; + rhoVector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_tlsph_defgrad.cpp b/src/USER-SMD/compute_smd_tlsph_defgrad.cpp index 81792355e013d44c8eae8b1df9d9d8ae0e976d06..b283a41c4f72395b350362d57d5438cadba64862 100644 --- a/src/USER-SMD/compute_smd_tlsph_defgrad.cpp +++ b/src/USER-SMD/compute_smd_tlsph_defgrad.cpp @@ -49,7 +49,7 @@ ComputeSMDTLSPHDefgrad::ComputeSMDTLSPHDefgrad(LAMMPS *lmp, int narg, char **arg size_peratom_cols = 10; nmax = 0; - defgradVector = NULL; + defgradVector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_tlsph_dt.cpp b/src/USER-SMD/compute_smd_tlsph_dt.cpp index 7752436b8a40f67734d5e4596aec3fc0800e5545..a02ff838d49096dd3bea2750a44d3cd0c58b15c6 100644 --- a/src/USER-SMD/compute_smd_tlsph_dt.cpp +++ b/src/USER-SMD/compute_smd_tlsph_dt.cpp @@ -49,7 +49,7 @@ ComputeSMDTlsphDt::ComputeSMDTlsphDt(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - dt_vector = NULL; + dt_vector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -88,7 +88,7 @@ void ComputeSMDTlsphDt::compute_peratom() { int itmp = 0; double *particle_dt = (double *) force->pair->extract("smd/tlsph/particle_dt_ptr", itmp); - if (particle_dt == NULL) { + if (particle_dt == nullptr) { error->all(FLERR, "compute smd/tlsph_dt failed to access particle_dt array"); } diff --git a/src/USER-SMD/compute_smd_tlsph_num_neighs.cpp b/src/USER-SMD/compute_smd_tlsph_num_neighs.cpp index 347b1384123b180570ec2e48692f633c3692db19..f5f14fa5006cd6c6af43b5321fd99a2f805674ea 100644 --- a/src/USER-SMD/compute_smd_tlsph_num_neighs.cpp +++ b/src/USER-SMD/compute_smd_tlsph_num_neighs.cpp @@ -47,7 +47,7 @@ ComputeSMDTLSPHNumNeighs::ComputeSMDTLSPHNumNeighs(LAMMPS *lmp, int narg, char * size_peratom_cols = 0; nmax = 0; - numNeighsRefConfigOutput = NULL; + numNeighsRefConfigOutput = nullptr; } /* ---------------------------------------------------------------------- */ @@ -84,7 +84,7 @@ void ComputeSMDTLSPHNumNeighs::compute_peratom() { int itmp = 0; int *numNeighsRefConfig = (int *) force->pair->extract("smd/tlsph/numNeighsRefConfig_ptr", itmp); - if (numNeighsRefConfig == NULL) { + if (numNeighsRefConfig == nullptr) { error->all(FLERR, "compute smd/tlsph_num_neighs failed to access numNeighsRefConfig array"); } diff --git a/src/USER-SMD/compute_smd_tlsph_shape.cpp b/src/USER-SMD/compute_smd_tlsph_shape.cpp index a3727871de02ff3a62bca6f04e9ebc55bb6f32b2..a978fd2e9ea2770f4de88fcd8b13cd8f06ca9a68 100644 --- a/src/USER-SMD/compute_smd_tlsph_shape.cpp +++ b/src/USER-SMD/compute_smd_tlsph_shape.cpp @@ -51,7 +51,7 @@ ComputeSmdTlsphShape::ComputeSmdTlsphShape(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 7; nmax = 0; - strainVector = NULL; + strainVector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -89,12 +89,12 @@ void ComputeSmdTlsphShape::compute_peratom() { int itmp = 0; Matrix3d *R = (Matrix3d *) force->pair->extract("smd/tlsph/rotation_ptr", itmp); - if (R == NULL) { + if (R == nullptr) { error->all(FLERR, "compute smd/tlsph_shape failed to access rotation array"); } Matrix3d *F = (Matrix3d *) force->pair->extract("smd/tlsph/Fincr_ptr", itmp); - if (F == NULL) { + if (F == nullptr) { error->all(FLERR, "compute smd/tlsph_shape failed to access deformation gradient array"); } diff --git a/src/USER-SMD/compute_smd_tlsph_strain.cpp b/src/USER-SMD/compute_smd_tlsph_strain.cpp index db51ca412539a4eb2540ae7990281bedcab84bbe..5e86f4fd38a75f418708e5b3be2918deab392fd8 100644 --- a/src/USER-SMD/compute_smd_tlsph_strain.cpp +++ b/src/USER-SMD/compute_smd_tlsph_strain.cpp @@ -52,7 +52,7 @@ ComputeSMDTLSPHstrain::ComputeSMDTLSPHstrain(LAMMPS *lmp, int narg, char **arg) size_peratom_cols = 6; nmax = 0; - strainVector = NULL; + strainVector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -92,7 +92,7 @@ void ComputeSMDTLSPHstrain::compute_peratom() { // copy data to output array int itmp = 0; Matrix3d *Fincr = (Matrix3d *) force->pair->extract("smd/tlsph/Fincr_ptr", itmp); - if (Fincr == NULL) { + if (Fincr == nullptr) { error->all(FLERR, "compute smd/tlsph_strain failed to access Fincr array"); } diff --git a/src/USER-SMD/compute_smd_tlsph_strain_rate.cpp b/src/USER-SMD/compute_smd_tlsph_strain_rate.cpp index 577dc0e40f66b326214d6ee4528daf4697e59a60..3d9f467694d2bde892f785cda5f8046b77e06f97 100644 --- a/src/USER-SMD/compute_smd_tlsph_strain_rate.cpp +++ b/src/USER-SMD/compute_smd_tlsph_strain_rate.cpp @@ -52,7 +52,7 @@ ComputeSMDTLSPHStrainRate::ComputeSMDTLSPHStrainRate(LAMMPS *lmp, int narg, char size_peratom_cols = 6; nmax = 0; - strain_rate_array = NULL; + strain_rate_array = nullptr; } /* ---------------------------------------------------------------------- */ @@ -89,7 +89,7 @@ void ComputeSMDTLSPHStrainRate::compute_peratom() { int itmp = 0; Matrix3d *D = (Matrix3d *) force->pair->extract("smd/tlsph/strain_rate_ptr", itmp); - if (D == NULL) { + if (D == nullptr) { error->all(FLERR, "compute smd/tlsph_strain_rate could not access strain rate. Are the matching pair styles present?"); } diff --git a/src/USER-SMD/compute_smd_tlsph_stress.cpp b/src/USER-SMD/compute_smd_tlsph_stress.cpp index 9c78b192ce3fb9a4e7ce7fa78f2d377a9690ccde..f668a7f82b44be7e659d0e7c9324144219587fcb 100644 --- a/src/USER-SMD/compute_smd_tlsph_stress.cpp +++ b/src/USER-SMD/compute_smd_tlsph_stress.cpp @@ -60,7 +60,7 @@ ComputeSMDTLSPHStress::ComputeSMDTLSPHStress(LAMMPS *lmp, int narg, char **arg) size_peratom_cols = 7; nmax = 0; - stress_array = NULL; + stress_array = nullptr; } /* ---------------------------------------------------------------------- */ @@ -99,7 +99,7 @@ void ComputeSMDTLSPHStress::compute_peratom() { int itmp = 0; Matrix3d *T = (Matrix3d *) force->pair->extract("smd/tlsph/stressTensor_ptr", itmp); - if (T == NULL) { + if (T == nullptr) { error->all(FLERR, "compute smd/tlsph_stress could not access stress tensors. Are the matching pair styles present?"); } int nlocal = atom->nlocal; diff --git a/src/USER-SMD/compute_smd_triangle_vertices.cpp b/src/USER-SMD/compute_smd_triangle_vertices.cpp index 06706a85ad6a075509c8faaaeec2b1a396fc3150..46555559d3272d287ae79fff92f5a375fa047a51 100644 --- a/src/USER-SMD/compute_smd_triangle_vertices.cpp +++ b/src/USER-SMD/compute_smd_triangle_vertices.cpp @@ -46,7 +46,7 @@ ComputeSMDTriangleVertices::ComputeSMDTriangleVertices(LAMMPS *lmp, int narg, ch size_peratom_cols = 9; nmax = 0; - outputVector = NULL; + outputVector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_ulsph_effm.cpp b/src/USER-SMD/compute_smd_ulsph_effm.cpp index fc8637bbf01506114b0602d525fd52a79260458d..4285d1c9819c66407ff87634d84ef182e8f40bc9 100644 --- a/src/USER-SMD/compute_smd_ulsph_effm.cpp +++ b/src/USER-SMD/compute_smd_ulsph_effm.cpp @@ -49,7 +49,7 @@ ComputeSMD_Ulsph_Effm::ComputeSMD_Ulsph_Effm(LAMMPS *lmp, int narg, char **arg) size_peratom_cols = 0; nmax = 0; - dt_vector = NULL; + dt_vector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -88,7 +88,7 @@ void ComputeSMD_Ulsph_Effm::compute_peratom() { int itmp = 0; double *particle_dt = (double *) force->pair->extract("smd/ulsph/effective_modulus_ptr", itmp); - if (particle_dt == NULL) { + if (particle_dt == nullptr) { error->all(FLERR, "compute smd/ulsph_effm failed to access particle_dt array"); } diff --git a/src/USER-SMD/compute_smd_ulsph_num_neighs.cpp b/src/USER-SMD/compute_smd_ulsph_num_neighs.cpp index 4ef339db9812d91ac32eb85187612c263eba1300..57460c2929c223477494510364598cd2ef130d03 100644 --- a/src/USER-SMD/compute_smd_ulsph_num_neighs.cpp +++ b/src/USER-SMD/compute_smd_ulsph_num_neighs.cpp @@ -47,7 +47,7 @@ ComputeSMDULSPHNumNeighs::ComputeSMDULSPHNumNeighs(LAMMPS *lmp, int narg, char * size_peratom_cols = 0; nmax = 0; - numNeighsOutput = NULL; + numNeighsOutput = nullptr; } /* ---------------------------------------------------------------------- */ @@ -84,7 +84,7 @@ void ComputeSMDULSPHNumNeighs::compute_peratom() { int itmp = 0; int *numNeighs = (int *) force->pair->extract("smd/ulsph/numNeighs_ptr", itmp); - if (numNeighs == NULL) { + if (numNeighs == nullptr) { error->all(FLERR, "compute smd/ulsph_num_neighs failed to access numNeighs array"); } diff --git a/src/USER-SMD/compute_smd_ulsph_strain.cpp b/src/USER-SMD/compute_smd_ulsph_strain.cpp index cf1535759c7635c6bc51fc42ef85f7306d0b5828..a4211a6b60b9683dcbf6e138d5ccfb39af55026a 100644 --- a/src/USER-SMD/compute_smd_ulsph_strain.cpp +++ b/src/USER-SMD/compute_smd_ulsph_strain.cpp @@ -46,7 +46,7 @@ ComputeSMDULSPHstrain::ComputeSMDULSPHstrain(LAMMPS *lmp, int narg, char **arg) size_peratom_cols = 6; nmax = 0; - strainVector = NULL; + strainVector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/compute_smd_ulsph_strain_rate.cpp b/src/USER-SMD/compute_smd_ulsph_strain_rate.cpp index f5ff4fef98fc6ec308855be74c635b4d03465c87..9118e6dded0731ef9e6de55b9adad97232e2f451 100644 --- a/src/USER-SMD/compute_smd_ulsph_strain_rate.cpp +++ b/src/USER-SMD/compute_smd_ulsph_strain_rate.cpp @@ -49,7 +49,7 @@ ComputeSMDULSPHStrainRate::ComputeSMDULSPHStrainRate(LAMMPS *lmp, int narg, char size_peratom_cols = 6; nmax = 0; - strain_rate_array = NULL; + strain_rate_array = nullptr; } /* ---------------------------------------------------------------------- */ @@ -87,7 +87,7 @@ void ComputeSMDULSPHStrainRate::compute_peratom() { int itmp = 0; Matrix3d *L = (Matrix3d *) force->pair->extract("smd/ulsph/velocityGradient_ptr", itmp); - if (L == NULL) { + if (L == nullptr) { error->all(FLERR, "compute smd/ulsph_strain_rate could not access any velocity gradients. Are the matching pair styles present?"); } diff --git a/src/USER-SMD/compute_smd_ulsph_stress.cpp b/src/USER-SMD/compute_smd_ulsph_stress.cpp index ea477375ce95a49addccd5308d8992d888a730b5..c7078a574179a4291aa539720b57b8bcd11bfcfe 100644 --- a/src/USER-SMD/compute_smd_ulsph_stress.cpp +++ b/src/USER-SMD/compute_smd_ulsph_stress.cpp @@ -59,7 +59,7 @@ ComputeSMDULSPHStress::ComputeSMDULSPHStress(LAMMPS *lmp, int narg, char **arg) size_peratom_cols = 7; nmax = 0; - stress_array = NULL; + stress_array = nullptr; } /* ---------------------------------------------------------------------- */ @@ -99,7 +99,7 @@ void ComputeSMDULSPHStress::compute_peratom() { int itmp = 0; Matrix3d *T = (Matrix3d *) force->pair->extract("smd/ulsph/stressTensor_ptr", itmp); - if (T == NULL) { + if (T == nullptr) { error->all(FLERR, "compute smd/ulsph_stress could not access stress tensors. Are the matching pair styles present?"); } int nlocal = atom->nlocal; diff --git a/src/USER-SMD/compute_smd_vol.cpp b/src/USER-SMD/compute_smd_vol.cpp index 5999dfaa5df0c4a842ecdf538abb7cf221019bae..46aa7ea3c44d340c7a603cb0c44b7d4cc1a3398d 100644 --- a/src/USER-SMD/compute_smd_vol.cpp +++ b/src/USER-SMD/compute_smd_vol.cpp @@ -48,7 +48,7 @@ ComputeSMDVol::ComputeSMDVol(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - volVector = NULL; + volVector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/fix_smd_adjust_dt.cpp b/src/USER-SMD/fix_smd_adjust_dt.cpp index 2acf6bd3ece39f9a8f4351a1bafbf6215208f644..047406f25dd078f52b103daca71f5a6a0c685686 100644 --- a/src/USER-SMD/fix_smd_adjust_dt.cpp +++ b/src/USER-SMD/fix_smd_adjust_dt.cpp @@ -108,28 +108,28 @@ void FixSMDTlsphDtReset::end_of_step() { double *dt_HERTZ = (double *) force->pair->extract("smd/hertz/stable_time_increment_ptr", itmp); double *dt_PERI_IPMB = (double *) force->pair->extract("smd/peri_ipmb/stable_time_increment_ptr", itmp); - if ((dtCFL_TLSPH == NULL) && (dtCFL_ULSPH == NULL) && (dt_TRI == NULL) && (dt_HERTZ == NULL) - && (dt_PERI_IPMB == NULL)) { + if ((dtCFL_TLSPH == nullptr) && (dtCFL_ULSPH == nullptr) && (dt_TRI == nullptr) && (dt_HERTZ == nullptr) + && (dt_PERI_IPMB == nullptr)) { error->all(FLERR, "fix smd/adjust_dt failed to access a valid dtCFL"); } - if (dtCFL_TLSPH != NULL) { + if (dtCFL_TLSPH != nullptr) { dtmin = MIN(dtmin, *dtCFL_TLSPH); } - if (dtCFL_ULSPH != NULL) { + if (dtCFL_ULSPH != nullptr) { dtmin = MIN(dtmin, *dtCFL_ULSPH); } - if (dt_TRI != NULL) { + if (dt_TRI != nullptr) { dtmin = MIN(dtmin, *dt_TRI); } - if (dt_HERTZ != NULL) { + if (dt_HERTZ != nullptr) { dtmin = MIN(dtmin, *dt_HERTZ); } - if (dt_PERI_IPMB != NULL) { + if (dt_PERI_IPMB != nullptr) { dtmin = MIN(dtmin, *dt_PERI_IPMB); } diff --git a/src/USER-SMD/fix_smd_integrate_tlsph.cpp b/src/USER-SMD/fix_smd_integrate_tlsph.cpp index 6b3bfca9b4b1c534de0bda09bf9894b9a623071c..741bd6ba146684b9c5d5c7517169a1ef177587cc 100644 --- a/src/USER-SMD/fix_smd_integrate_tlsph.cpp +++ b/src/USER-SMD/fix_smd_integrate_tlsph.cpp @@ -139,7 +139,7 @@ void FixSMDIntegrateTlsph::initial_integrate(int /*vflag*/) { Vector3d *smoothVelDifference = (Vector3d *) force->pair->extract("smd/tlsph/smoothVel_ptr", itmp); if (xsphFlag) { - if (smoothVelDifference == NULL) { + if (smoothVelDifference == nullptr) { error->one(FLERR, "fix smd/integrate_tlsph failed to access smoothVel array. Check if a pair style exist which calculates this quantity."); } diff --git a/src/USER-SMD/fix_smd_integrate_ulsph.cpp b/src/USER-SMD/fix_smd_integrate_ulsph.cpp index f11b55aaf43ee8bdb31f1f678b7b3dca3667a633..fba327026deb97e5e025f585b0c02b36ddcbd155 100644 --- a/src/USER-SMD/fix_smd_integrate_ulsph.cpp +++ b/src/USER-SMD/fix_smd_integrate_ulsph.cpp @@ -171,7 +171,7 @@ void FixSMDIntegrateUlsph::initial_integrate(int /*vflag*/) { Vector3d *smoothVel = (Vector3d *) force->pair->extract("smd/ulsph/smoothVel_ptr", itmp); if (xsphFlag) { - if (smoothVel == NULL) { + if (smoothVel == nullptr) { error->one(FLERR, "fix smd/integrate_ulsph failed to access smoothVel array"); } } @@ -259,12 +259,12 @@ void FixSMDIntegrateUlsph::final_integrate() { int itmp; int *nn = (int *) force->pair->extract("smd/ulsph/numNeighs_ptr", itmp); - if (nn == NULL) { + if (nn == nullptr) { error->one(FLERR, "fix smd/integrate_ulsph failed to accesss num_neighs array"); } Matrix3d *L = (Matrix3d *) force->pair->extract("smd/ulsph/velocityGradient_ptr", itmp); - if (L == NULL) { + if (L == nullptr) { error->one(FLERR, "fix smd/integrate_ulsph failed to accesss velocityGradient array"); } diff --git a/src/USER-SMD/fix_smd_setvel.cpp b/src/USER-SMD/fix_smd_setvel.cpp index d3e71f0e50e92bd6140498360f7893b1857a5dba..3301999270eda154593153f971989f428e21f48c 100644 --- a/src/USER-SMD/fix_smd_setvel.cpp +++ b/src/USER-SMD/fix_smd_setvel.cpp @@ -57,7 +57,7 @@ FixSMDSetVel::FixSMDSetVel(LAMMPS *lmp, int narg, char **arg) : global_freq = 1; extvector = 1; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[3], "v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; @@ -93,7 +93,7 @@ FixSMDSetVel::FixSMDSetVel(LAMMPS *lmp, int narg, char **arg) : // optional args iregion = -1; - idregion = NULL; + idregion = nullptr; int iarg = 6; while (iarg < narg) { @@ -241,7 +241,7 @@ void FixSMDSetVel::post_force(int /*vflag*/) { // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/USER-SMD/fix_smd_tlsph_reference_configuration.cpp b/src/USER-SMD/fix_smd_tlsph_reference_configuration.cpp index 107d00f2eeb9cc1a6c3b54482b1e8e39b5aa5d4a..476445388a5867a8d17411604afbda4001c3a4ad 100644 --- a/src/USER-SMD/fix_smd_tlsph_reference_configuration.cpp +++ b/src/USER-SMD/fix_smd_tlsph_reference_configuration.cpp @@ -59,12 +59,12 @@ FixSMD_TLSPH_ReferenceConfiguration::FixSMD_TLSPH_ReferenceConfiguration(LAMMPS error->all(FLERR, "Pair tlsph with partner list requires an atom map, see atom_modify"); maxpartner = 1; - npartner = NULL; - partner = NULL; - wfd_list = NULL; - wf_list = NULL; - energy_per_bond = NULL; - degradation_ij = NULL; + npartner = nullptr; + partner = nullptr; + wfd_list = nullptr; + wf_list = nullptr; + energy_per_bond = nullptr; + degradation_ij = nullptr; grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); @@ -130,13 +130,13 @@ void FixSMD_TLSPH_ReferenceConfiguration::pre_exchange() { } int *updateFlag_ptr = (int *) force->pair->extract("smd/tlsph/updateFlag_ptr", itmp); - if (updateFlag_ptr == NULL) { + if (updateFlag_ptr == nullptr) { error->one(FLERR, "fix FixSMD_TLSPH_ReferenceConfiguration failed to access updateFlag pointer. Check if a pair style exist which calculates this quantity."); } int *nn = (int *) force->pair->extract("smd/tlsph/numNeighsRefConfig_ptr", itmp); - if (nn == NULL) { + if (nn == nullptr) { error->all(FLERR, "FixSMDIntegrateTlsph::updateReferenceConfiguration() failed to access numNeighsRefConfig_ptr array"); } @@ -468,7 +468,7 @@ int FixSMD_TLSPH_ReferenceConfiguration::pack_restart(int i, double *buf) { ------------------------------------------------------------------------- */ void FixSMD_TLSPH_ReferenceConfiguration::unpack_restart(int /*nlocal*/, int /*nth*/) { -// ipage = NULL if being called from granular pair style init() +// ipage = nullptr if being called from granular pair style init() // skip to Nth set of extra values // unpack the Nth first values this way because other fixes pack them diff --git a/src/USER-SMD/fix_smd_wall_surface.cpp b/src/USER-SMD/fix_smd_wall_surface.cpp index 769319bdd9ff63ba4d7839e4a30cc2bac7c702b8..b55268a3ecd127a0ffad04e74225f2c28a31be27 100644 --- a/src/USER-SMD/fix_smd_wall_surface.cpp +++ b/src/USER-SMD/fix_smd_wall_surface.cpp @@ -69,7 +69,7 @@ FixSMDWallSurface::FixSMDWallSurface(LAMMPS *lmp, int narg, char **arg) : FixSMDWallSurface::~FixSMDWallSurface() { free(filename); - filename = NULL; + filename = nullptr; // unregister this fix so atom class doesn't invoke it any more //atom->delete_callback(id,Atom::GROW); @@ -198,12 +198,12 @@ int FixSMDWallSurface::count_words(const char *line) { if ((ptr = strchr(copy, '#'))) *ptr = '\0'; - if (strtok(copy, " \t\n\r\f") == NULL) { + if (strtok(copy, " \t\n\r\f") == nullptr) { memory->destroy(copy); return 0; } n = 1; - while (strtok(NULL, " \t\n\r\f")) + while (strtok(nullptr, " \t\n\r\f")) n++; memory->destroy(copy); @@ -229,7 +229,7 @@ void FixSMDWallSurface::read_triangles(int pass) { Vector3d normal, center; FILE *fp = fopen(filename, "r"); - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128, "Cannot open file %s", filename); error->one(FLERR, str); @@ -261,7 +261,7 @@ void FixSMDWallSurface::read_triangles(int pass) { // read STL solid name retpointer = fgets(line, sizeof(line), fp); - if (retpointer == NULL) { + if (retpointer == nullptr) { error->one(FLERR,"error reading number of triangle pairs"); } @@ -272,11 +272,11 @@ void FixSMDWallSurface::read_triangles(int pass) { // values = new char*[nwords]; // values[0] = strtok(line, " \t\n\r\f"); -// if (values[0] == NULL) +// if (values[0] == nullptr) // error->all(FLERR, "Incorrect atom format in data file"); // for (m = 1; m < nwords; m++) { -// values[m] = strtok(NULL, " \t\n\r\f"); -// if (values[m] == NULL) +// values[m] = strtok(nullptr, " \t\n\r\f"); +// if (values[m] == nullptr) // error->all(FLERR, "Incorrect atom format in data file"); // } // delete[] values; @@ -301,11 +301,11 @@ void FixSMDWallSurface::read_triangles(int pass) { values = new char*[nwords]; values[0] = strtok(line, " \t\n\r\f"); - if (values[0] == NULL) + if (values[0] == nullptr) error->all(FLERR, "Incorrect atom format in data file"); for (m = 1; m < nwords; m++) { - values[m] = strtok(NULL, " \t\n\r\f"); - if (values[m] == NULL) + values[m] = strtok(nullptr, " \t\n\r\f"); + if (values[m] == nullptr) error->all(FLERR, "Incorrect atom format in data file"); } @@ -318,7 +318,7 @@ void FixSMDWallSurface::read_triangles(int pass) { // read outer loop line retpointer = fgets(line, sizeof(line), fp); - if (retpointer == NULL) { + if (retpointer == nullptr) { error->one(FLERR, "error reading outer loop"); } @@ -331,7 +331,7 @@ void FixSMDWallSurface::read_triangles(int pass) { for (int k = 0; k < 3; k++) { retpointer = fgets(line, sizeof(line), fp); - if (retpointer == NULL) { + if (retpointer == nullptr) { error->one(FLERR,"error reading vertex line"); } @@ -342,11 +342,11 @@ void FixSMDWallSurface::read_triangles(int pass) { values = new char*[nwords]; values[0] = strtok(line, " \t\n\r\f"); - if (values[0] == NULL) + if (values[0] == nullptr) error->all(FLERR,"Incorrect vertex line"); for (m = 1; m < nwords; m++) { - values[m] = strtok(NULL, " \t\n\r\f"); - if (values[m] == NULL) + values[m] = strtok(nullptr, " \t\n\r\f"); + if (values[m] == nullptr) error->all(FLERR, "Incorrect vertex line"); } @@ -362,7 +362,7 @@ void FixSMDWallSurface::read_triangles(int pass) { // read end loop line retpointer = fgets(line, sizeof(line), fp); - if (retpointer == NULL) { + if (retpointer == nullptr) { error->one(FLERR, "error reading endloop"); } @@ -373,7 +373,7 @@ void FixSMDWallSurface::read_triangles(int pass) { // read end facet line retpointer = fgets(line, sizeof(line), fp); - if (retpointer == NULL) { + if (retpointer == nullptr) { error->one(FLERR,"error reading endfacet"); } diff --git a/src/USER-SMD/pair_smd_hertz.cpp b/src/USER-SMD/pair_smd_hertz.cpp index 8d3c06d5e6d3519d17a9ae4ebbda4514b61b20f2..c966f5ba7585f08cf3e9c94b35d01ac53a0bdafe 100644 --- a/src/USER-SMD/pair_smd_hertz.cpp +++ b/src/USER-SMD/pair_smd_hertz.cpp @@ -51,9 +51,9 @@ using namespace LAMMPS_NS; PairHertz::PairHertz(LAMMPS *lmp) : Pair(lmp) { - onerad_dynamic = onerad_frozen = maxrad_dynamic = maxrad_frozen = NULL; - bulkmodulus = NULL; - kn = NULL; + onerad_dynamic = onerad_frozen = maxrad_dynamic = maxrad_frozen = nullptr; + bulkmodulus = nullptr; + kn = nullptr; scale = 1.0; } @@ -374,6 +374,6 @@ void *PairHertz::extract(const char *str, int &/*i*/) { return (void *) &stable_time_increment; } - return NULL; + return nullptr; } diff --git a/src/USER-SMD/pair_smd_tlsph.cpp b/src/USER-SMD/pair_smd_tlsph.cpp index 25301685a7376ddefc0f5ff88a80d9f50bcd9197..3c87119553a60b421e6d75a6a6ef34953155214a 100644 --- a/src/USER-SMD/pair_smd_tlsph.cpp +++ b/src/USER-SMD/pair_smd_tlsph.cpp @@ -63,28 +63,28 @@ using namespace SMD_Math; PairTlsph::PairTlsph(LAMMPS *lmp) : Pair(lmp) { - onerad_dynamic = onerad_frozen = maxrad_dynamic = maxrad_frozen = NULL; + onerad_dynamic = onerad_frozen = maxrad_dynamic = maxrad_frozen = nullptr; - failureModel = NULL; - strengthModel = eos = NULL; + failureModel = nullptr; + strengthModel = eos = nullptr; nmax = 0; // make sure no atom on this proc such that initial memory allocation is correct - Fdot = Fincr = K = PK1 = NULL; - R = FincrInv = W = D = NULL; - detF = NULL; - smoothVelDifference = NULL; - numNeighsRefConfig = NULL; - CauchyStress = NULL; - hourglass_error = NULL; - Lookup = NULL; - particle_dt = NULL; + Fdot = Fincr = K = PK1 = nullptr; + R = FincrInv = W = D = nullptr; + detF = nullptr; + smoothVelDifference = nullptr; + numNeighsRefConfig = nullptr; + CauchyStress = nullptr; + hourglass_error = nullptr; + Lookup = nullptr; + particle_dt = nullptr; updateFlag = 0; first = true; dtCFL = 0.0; // initialize dtCFL so it is set to safe value if extracted on zero-th timestep comm_forward = 22; // this pair style communicates 20 doubles to ghost atoms : PK1 tensor + F tensor + shepardWeight - fix_tlsph_reference_configuration = NULL; + fix_tlsph_reference_configuration = nullptr; cut_comm = MAX(neighbor->cutneighmax, comm->cutghostuser); // cutoff radius within which ghost atoms are communicated. } @@ -1748,7 +1748,7 @@ void PairTlsph::init_style() { if (igroup == -1) error->all(FLERR, "Pair style tlsph requires its particles to be part of a group named tlsph. This group does not exist."); - if (fix_tlsph_reference_configuration == NULL) { + if (fix_tlsph_reference_configuration == nullptr) { char **fixarg = new char*[3]; fixarg[0] = (char *) "SMD_TLSPH_NEIGHBORS"; fixarg[1] = (char *) "tlsph"; @@ -1824,7 +1824,7 @@ void *PairTlsph::extract(const char *str, int &/*i*/) { return (void *) R; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SMD/pair_smd_triangulated_surface.cpp b/src/USER-SMD/pair_smd_triangulated_surface.cpp index 8ccba562e26f4cdda6bdffa8a3f5e368947c155c..6e702ef825cc2fdc235d9729adb4657800404ad2 100644 --- a/src/USER-SMD/pair_smd_triangulated_surface.cpp +++ b/src/USER-SMD/pair_smd_triangulated_surface.cpp @@ -54,9 +54,9 @@ using namespace Eigen; PairTriSurf::PairTriSurf(LAMMPS *lmp) : Pair(lmp) { - onerad_dynamic = onerad_frozen = maxrad_dynamic = maxrad_frozen = NULL; - bulkmodulus = NULL; - kn = NULL; + onerad_dynamic = onerad_frozen = maxrad_dynamic = maxrad_frozen = nullptr; + bulkmodulus = nullptr; + kn = nullptr; scale = 1.0; } @@ -833,6 +833,6 @@ void *PairTriSurf::extract(const char *str, int &/*i*/) { return (void *) &stable_time_increment; } - return NULL; + return nullptr; } diff --git a/src/USER-SMD/pair_smd_ulsph.cpp b/src/USER-SMD/pair_smd_ulsph.cpp index 3a6cdf5d2f16672aa73d4d94a8dfc6ce9dbe12d6..bbb8cf3729243d45cba91e29503c58d81e0d458e 100644 --- a/src/USER-SMD/pair_smd_ulsph.cpp +++ b/src/USER-SMD/pair_smd_ulsph.cpp @@ -56,22 +56,22 @@ PairULSPH::PairULSPH(LAMMPS *lmp) : Pair(lmp) { // per-type arrays - Q1 = NULL; - eos = viscosity = strength = NULL; - c0_type = NULL; - c0 = NULL; - Lookup = NULL; - artificial_stress = NULL; - artificial_pressure = NULL; + Q1 = nullptr; + eos = viscosity = strength = nullptr; + c0_type = nullptr; + c0 = nullptr; + Lookup = nullptr; + artificial_stress = nullptr; + artificial_pressure = nullptr; nmax = 0; // make sure no atom on this proc such that initial memory allocation is correct - stressTensor = L = K = NULL; - shepardWeight = NULL; - smoothVel = NULL; - numNeighs = NULL; - F = NULL; - rho = NULL; - effm = NULL; + stressTensor = L = K = nullptr; + shepardWeight = nullptr; + smoothVel = nullptr; + numNeighs = nullptr; + F = nullptr; + rho = nullptr; + effm = nullptr; velocity_gradient_required = false; // turn off computation of velocity gradient by default density_summation = velocity_gradient = false; @@ -1575,7 +1575,7 @@ void *PairULSPH::extract(const char *str, int &/*i*/) { return (void *) K; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/USER-SMTBQ/pair_smtbq.cpp b/src/USER-SMTBQ/pair_smtbq.cpp index 875d254ac9b1a143a3588594cb319d2a827b448a..d84f302304ee33b77a6b1f4a633c6537e8469df6 100644 --- a/src/USER-SMTBQ/pair_smtbq.cpp +++ b/src/USER-SMTBQ/pair_smtbq.cpp @@ -101,50 +101,50 @@ PairSMTBQ::PairSMTBQ(LAMMPS *lmp) : Pair(lmp) kmax = 0; nelements = 0; - elements = NULL; + elements = nullptr; nparams = 0; maxparam = 0; - params = NULL; - intparams = NULL; - - intype = NULL; - coultype = NULL; - fafb = NULL; - dfafb = NULL; - potqn = NULL; - dpotqn = NULL; + params = nullptr; + intparams = nullptr; + + intype = nullptr; + coultype = nullptr; + fafb = nullptr; + dfafb = nullptr; + potqn = nullptr; + dpotqn = nullptr; Vself = 0.0; - tabsmb = NULL; - tabsmr = NULL; - dtabsmb = NULL; - dtabsmr = NULL; - - sbcov = NULL; - coord = NULL; - sbmet = NULL; - ecov = NULL; - - potmad = NULL; - potself = NULL; - potcov = NULL; - qf = NULL; - q1 = NULL; - q2 = NULL; - tab_comm = NULL; - - nvsm = NULL; - vsm = NULL; - flag_QEq = NULL; - nQEqaall = NULL; - nQEqcall = NULL; - nQEqall = NULL; + tabsmb = nullptr; + tabsmr = nullptr; + dtabsmb = nullptr; + dtabsmr = nullptr; + + sbcov = nullptr; + coord = nullptr; + sbmet = nullptr; + ecov = nullptr; + + potmad = nullptr; + potself = nullptr; + potcov = nullptr; + qf = nullptr; + q1 = nullptr; + q2 = nullptr; + tab_comm = nullptr; + + nvsm = nullptr; + vsm = nullptr; + flag_QEq = nullptr; + nQEqaall = nullptr; + nQEqcall = nullptr; + nQEqall = nullptr; nteam = 0; cluster = 0; Nevery = 0.0; Neverypot = 0.0; - fct = NULL; + fct = nullptr; maxpage = 0; @@ -277,7 +277,7 @@ void PairSMTBQ::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -286,7 +286,7 @@ void PairSMTBQ::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -392,9 +392,9 @@ void PairSMTBQ::read_file(char *file) char **words; memory->sfree(params); - params = NULL; + params = nullptr; memory->sfree(intparams); - intparams = NULL; + intparams = nullptr; nparams = 0; maxparam = 0; maxintparam = 0; @@ -411,7 +411,7 @@ void PairSMTBQ::read_file(char *file) // open file on all processors FILE *fp; fp = utils::open_potential(file,lmp,nullptr); - if ( fp == NULL ) { + if ( fp == nullptr ) { char str[128]; snprintf(str,128,"Cannot open SMTBQ potential file %s",file); error->one(FLERR,str); @@ -3562,12 +3562,12 @@ int PairSMTBQ::Tokenize( char* s, char*** tok ) const char *sep = "' "; char *mot; int count=0; - mot = NULL; + mot = nullptr; strncpy( test, s, MAXLINE-1 ); - for( mot = strtok(test, sep); mot; mot = strtok(NULL, sep) ) { + for( mot = strtok(test, sep); mot; mot = strtok(nullptr, sep) ) { strncpy( (*tok)[count], mot, MAXLINE ); count++; } diff --git a/src/USER-SPH/compute_sph_e_atom.cpp b/src/USER-SPH/compute_sph_e_atom.cpp index 8869dae5f7cb247bf8777f79b4bf9b32d619d64c..d8142fd7902b4f88dc5c7ea52a59c9ee61e8f6eb 100644 --- a/src/USER-SPH/compute_sph_e_atom.cpp +++ b/src/USER-SPH/compute_sph_e_atom.cpp @@ -36,7 +36,7 @@ ComputeSPHEAtom::ComputeSPHEAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - evector = NULL; + evector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SPH/compute_sph_rho_atom.cpp b/src/USER-SPH/compute_sph_rho_atom.cpp index 1d6d03811ce816895e1a4341fad41c9aef9df1cf..edc788a1ab7f06c332474351b2e159d80f067b5b 100644 --- a/src/USER-SPH/compute_sph_rho_atom.cpp +++ b/src/USER-SPH/compute_sph_rho_atom.cpp @@ -35,7 +35,7 @@ ComputeSPHRhoAtom::ComputeSPHRhoAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - rhoVector = NULL; + rhoVector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-SPH/compute_sph_t_atom.cpp b/src/USER-SPH/compute_sph_t_atom.cpp index 063af700260bf8e1a20202d55b828c2da46c1ee0..253e6374851fbc02baee6bb3057249439290da6a 100644 --- a/src/USER-SPH/compute_sph_t_atom.cpp +++ b/src/USER-SPH/compute_sph_t_atom.cpp @@ -36,7 +36,7 @@ ComputeSPHTAtom::ComputeSPHTAtom(LAMMPS *lmp, int narg, char **arg) : size_peratom_cols = 0; nmax = 0; - tvector = NULL; + tvector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/USER-TALLY/compute_force_tally.cpp b/src/USER-TALLY/compute_force_tally.cpp index d010b004d501f2642098f94ccd501271c2a90c08..a5ad46e77b3ef9b50727aa29e385d06be094bf1a 100644 --- a/src/USER-TALLY/compute_force_tally.cpp +++ b/src/USER-TALLY/compute_force_tally.cpp @@ -49,7 +49,7 @@ ComputeForceTally::ComputeForceTally(LAMMPS *lmp, int narg, char **arg) : did_setup = invoked_peratom = invoked_scalar = -1; nmax = -1; - fatom = NULL; + fatom = nullptr; vector = new double[size_peratom_cols]; } @@ -66,7 +66,7 @@ ComputeForceTally::~ComputeForceTally() void ComputeForceTally::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Trying to use compute force/tally without pair style"); else force->pair->add_tally_callback(this); diff --git a/src/USER-TALLY/compute_heat_flux_tally.cpp b/src/USER-TALLY/compute_heat_flux_tally.cpp index 1a2dd36285418fdf7d69081ddb042ea94b8aa2df..f57899c59329a7cc06cb6b029f0d1ac6c512531b 100644 --- a/src/USER-TALLY/compute_heat_flux_tally.cpp +++ b/src/USER-TALLY/compute_heat_flux_tally.cpp @@ -48,8 +48,8 @@ ComputeHeatFluxTally::ComputeHeatFluxTally(LAMMPS *lmp, int narg, char **arg) : did_setup = 0; invoked_peratom = invoked_scalar = -1; nmax = -1; - stress = NULL; - eatom = NULL; + stress = nullptr; + eatom = nullptr; vector = new double[size_vector]; heatj = new double[size_vector]; } @@ -69,7 +69,7 @@ ComputeHeatFluxTally::~ComputeHeatFluxTally() void ComputeHeatFluxTally::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Trying to use compute heat/flux/tally without pair style"); else force->pair->add_tally_callback(this); diff --git a/src/USER-TALLY/compute_pe_mol_tally.cpp b/src/USER-TALLY/compute_pe_mol_tally.cpp index 835d1e80bdac811407246bf8dcaea81b27830058..77bf7973da31863da5013f9c10923c0d3e4bc7ee 100644 --- a/src/USER-TALLY/compute_pe_mol_tally.cpp +++ b/src/USER-TALLY/compute_pe_mol_tally.cpp @@ -59,7 +59,7 @@ ComputePEMolTally::~ComputePEMolTally() void ComputePEMolTally::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Trying to use compute pe/mol/tally without pair style"); else force->pair->add_tally_callback(this); diff --git a/src/USER-TALLY/compute_pe_tally.cpp b/src/USER-TALLY/compute_pe_tally.cpp index ef7c13fed212e3a6d3e98276c528f8e3a918639f..e330b56a802f9341a0e4f9b20134653364ebe150 100644 --- a/src/USER-TALLY/compute_pe_tally.cpp +++ b/src/USER-TALLY/compute_pe_tally.cpp @@ -48,7 +48,7 @@ ComputePETally::ComputePETally(LAMMPS *lmp, int narg, char **arg) : did_setup = invoked_peratom = invoked_scalar = -1; nmax = -1; - eatom = NULL; + eatom = nullptr; vector = new double[size_peratom_cols]; } @@ -65,7 +65,7 @@ ComputePETally::~ComputePETally() void ComputePETally::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Trying to use compute pe/tally without a pair style"); else force->pair->add_tally_callback(this); diff --git a/src/USER-TALLY/compute_stress_tally.cpp b/src/USER-TALLY/compute_stress_tally.cpp index 2a0cbc8e4bf058f26dc50e89f70f2b6bdae9c742..58d42cd93d99909cfa6013268d1880db960ab5f3 100644 --- a/src/USER-TALLY/compute_stress_tally.cpp +++ b/src/USER-TALLY/compute_stress_tally.cpp @@ -49,7 +49,7 @@ ComputeStressTally::ComputeStressTally(LAMMPS *lmp, int narg, char **arg) : did_setup = invoked_peratom = invoked_scalar = -1; nmax = -1; - stress = NULL; + stress = nullptr; vector = new double[size_peratom_cols]; virial = new double[size_peratom_cols]; } @@ -68,7 +68,7 @@ ComputeStressTally::~ComputeStressTally() void ComputeStressTally::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Trying to use compute stress/tally without pair style"); else force->pair->add_tally_callback(this); diff --git a/src/USER-UEF/fix_nh_uef.cpp b/src/USER-UEF/fix_nh_uef.cpp index f910caac595e337ea479cf9b782bdc13db8e4c4e..e833502952ce452acd319deca1d7b229fbc434e8 100644 --- a/src/USER-UEF/fix_nh_uef.cpp +++ b/src/USER-UEF/fix_nh_uef.cpp @@ -57,7 +57,7 @@ static const char cite_user_uef_package[] = * temp/pressure fixes ---------------------------------------------------------------------- */ FixNHUef::FixNHUef(LAMMPS *lmp, int narg, char **arg) : - FixNH(lmp, narg, arg), uefbox(NULL) + FixNH(lmp, narg, arg), uefbox(nullptr) { if (lmp->citeme) lmp->citeme->add(cite_user_uef_package); diff --git a/src/USER-VTK/dump_vtk.cpp b/src/USER-VTK/dump_vtk.cpp index 794947f1b939a9bac693429a16f9cb9aebcf9860..1e0f520dc81693b002c48cd69a83b1b0c402f92a 100644 --- a/src/USER-VTK/dump_vtk.cpp +++ b/src/USER-VTK/dump_vtk.cpp @@ -128,11 +128,11 @@ DumpVTK::DumpVTK(LAMMPS *lmp, int narg, char **arg) : if (filewriter) reset_vtk_data_containers(); - label = NULL; + label = nullptr; { // parallel vtp/vtu requires proc number to be preceded by underscore '_' - multiname_ex = NULL; + multiname_ex = nullptr; char *ptr = strchr(filename,'%'); if (ptr) { multiname_ex = new char[strlen(filename) + 16]; @@ -160,12 +160,12 @@ DumpVTK::DumpVTK(LAMMPS *lmp, int narg, char **arg) : nclusterprocs = nprocs; } - filecurrent = NULL; - domainfilecurrent = NULL; - parallelfilecurrent = NULL; - header_choice = NULL; - write_choice = NULL; - boxcorners = NULL; + filecurrent = nullptr; + domainfilecurrent = nullptr; + parallelfilecurrent = nullptr; + header_choice = nullptr; + write_choice = nullptr; + boxcorners = nullptr; } /* ---------------------------------------------------------------------- */ @@ -185,7 +185,7 @@ void DumpVTK::init_style() { // default for element names = C - if (typenames == NULL) { + if (typenames == nullptr) { typenames = new char*[ntypes+1]; for (int itype = 1; itype <= ntypes; itype++) { typenames[itype] = new char[2]; @@ -880,7 +880,7 @@ void DumpVTK::write() // sort buf as needed if (sort_flag && sortcol == 0) pack(ids); - else pack(NULL); + else pack(nullptr); if (sort_flag) sort(); // filewriter = 1 = this proc writes to file @@ -939,13 +939,13 @@ void DumpVTK::write_data(int n, double *mybuf) void DumpVTK::setFileCurrent() { delete [] filecurrent; - filecurrent = NULL; + filecurrent = nullptr; char *filestar = filename; if (multiproc) { if (multiproc > 1) { // if dump_modify fileper or nfile was used delete [] multiname_ex; - multiname_ex = NULL; + multiname_ex = nullptr; char *ptr = strchr(filename,'%'); if (ptr) { int id; @@ -983,7 +983,7 @@ void DumpVTK::setFileCurrent() { // filename of domain box data file delete [] domainfilecurrent; - domainfilecurrent = NULL; + domainfilecurrent = nullptr; if (multiproc) { // remove '%' character char *ptr = strchr(filename,'%'); @@ -997,7 +997,7 @@ void DumpVTK::setFileCurrent() { *ptr = '\0'; sprintf(filestar,"%s_boundingBox.%s",domainfilecurrent,ptr+1); delete [] domainfilecurrent; - domainfilecurrent = NULL; + domainfilecurrent = nullptr; if (multifile == 0) { domainfilecurrent = new char[strlen(filestar) + 1]; @@ -1018,7 +1018,7 @@ void DumpVTK::setFileCurrent() { *ptr = '*'; } delete [] filestar; - filestar = NULL; + filestar = nullptr; } else { domainfilecurrent = new char[strlen(filecurrent) + 16]; char *ptr = strrchr(filecurrent,'.'); @@ -1030,7 +1030,7 @@ void DumpVTK::setFileCurrent() { // filename of parallel file if (multiproc && me == 0) { delete [] parallelfilecurrent; - parallelfilecurrent = NULL; + parallelfilecurrent = nullptr; // remove '%' character and add 'p' to file extension // -> string length stays the same @@ -1066,7 +1066,7 @@ void DumpVTK::setFileCurrent() { *ptr = '*'; } delete [] filestar; - filestar = NULL; + filestar = nullptr; } } @@ -1995,7 +1995,7 @@ int DumpVTK::add_variable(char *id) variable = new int[nvariable+1]; delete [] vbuf; vbuf = new double*[nvariable+1]; - for (int i = 0; i <= nvariable; i++) vbuf[i] = NULL; + for (int i = 0; i <= nvariable; i++) vbuf[i] = nullptr; int n = strlen(id) + 1; id_variable[nvariable] = new char[n]; @@ -2075,7 +2075,7 @@ int DumpVTK::modify_param(int narg, char **arg) if (typenames) { for (int i = 1; i <= ntypes; i++) delete [] typenames[i]; delete [] typenames; - typenames = NULL; + typenames = nullptr; } typenames = new char*[ntypes+1]; @@ -2094,9 +2094,9 @@ int DumpVTK::modify_param(int narg, char **arg) memory->destroy(thresh_array); memory->destroy(thresh_op); memory->destroy(thresh_value); - thresh_array = NULL; - thresh_op = NULL; - thresh_value = NULL; + thresh_array = nullptr; + thresh_op = nullptr; + thresh_value = nullptr; } nthresh = 0; return 2; diff --git a/src/USER-YAFF/angle_cross.cpp b/src/USER-YAFF/angle_cross.cpp index c45af1d1985d6d62dd9c7d39157846f85a6be0db..69dac7f58be60e6eff25498bff02411e1cfd89f2 100644 --- a/src/USER-YAFF/angle_cross.cpp +++ b/src/USER-YAFF/angle_cross.cpp @@ -279,12 +279,12 @@ void AngleCross::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&kss[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&kbs0[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&kbs1[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&r00[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&r01[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&kss[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&kbs0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&kbs1[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&r00[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&r01[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&kss[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-YAFF/angle_mm3.cpp b/src/USER-YAFF/angle_mm3.cpp index 34de7726724fe1e304921fd00ab584f8a300827e..d165a2d17cca055286b5218c0443170bd696de5a 100644 --- a/src/USER-YAFF/angle_mm3.cpp +++ b/src/USER-YAFF/angle_mm3.cpp @@ -226,8 +226,8 @@ void AngleMM3::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,NULL,error); - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->nangletypes,fp,nullptr,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&k2[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/USER-YAFF/bond_mm3.cpp b/src/USER-YAFF/bond_mm3.cpp index f5d5fed946fb058c1f85f2634c66a9f0f5b4fc37..2c310c631008701acdf88600fee69ad38c3b54fb 100644 --- a/src/USER-YAFF/bond_mm3.cpp +++ b/src/USER-YAFF/bond_mm3.cpp @@ -179,8 +179,8 @@ void BondMM3::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k2[1],sizeof(double),atom->nbondtypes,fp,NULL,error); - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&k2[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&k2[1],atom->nbondtypes,MPI_DOUBLE,0,world); MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); diff --git a/src/USER-YAFF/improper_distharm.cpp b/src/USER-YAFF/improper_distharm.cpp index 37039b27e4acac02eee7b16a501b4fc2b44a374d..757695c3c85a38da590f5a5ae2c2d668ccaa8e0b 100644 --- a/src/USER-YAFF/improper_distharm.cpp +++ b/src/USER-YAFF/improper_distharm.cpp @@ -257,8 +257,8 @@ void ImproperDistHarm::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-YAFF/improper_sqdistharm.cpp b/src/USER-YAFF/improper_sqdistharm.cpp index ddc4d78c93a0ebdc03b4d9d77f8c0d6f649e8027..79245d3413a46dfd49183c0b4625e15267246e44 100644 --- a/src/USER-YAFF/improper_sqdistharm.cpp +++ b/src/USER-YAFF/improper_sqdistharm.cpp @@ -257,8 +257,8 @@ void ImproperSQDistHarm::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); - utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,NULL,error); + utils::sfread(FLERR,&k[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); + utils::sfread(FLERR,&chi[1],sizeof(double),atom->nimpropertypes,fp,nullptr,error); } MPI_Bcast(&k[1],atom->nimpropertypes,MPI_DOUBLE,0,world); MPI_Bcast(&chi[1],atom->nimpropertypes,MPI_DOUBLE,0,world); diff --git a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp index 98fd317794ea0a336147b9f6f9ca4dcc0e55cc61..5508ffbfdc0b6d1f302f614bd21c36fe6c832561 100644 --- a/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_lj_switch3_coulgauss_long.cpp @@ -51,7 +51,7 @@ PairLJSwitch3CoulGaussLong::PairLJSwitch3CoulGaussLong(LAMMPS *lmp) : Pair(lmp) ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; } @@ -358,11 +358,11 @@ void PairLJSwitch3CoulGaussLong::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -521,14 +521,14 @@ void PairLJSwitch3CoulGaussLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -561,14 +561,14 @@ void PairLJSwitch3CoulGaussLong::write_restart_settings(FILE *fp) void PairLJSwitch3CoulGaussLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&truncw,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&truncw,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -705,5 +705,5 @@ void *PairLJSwitch3CoulGaussLong::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"gamma") == 0) return (void *) gamma; - return NULL; + return nullptr; } diff --git a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp index e1ee0e0b98ae7c6921b67fa3aff10bd313c258b2..d63f42cf3a986d47282ad21930cef658a2a4af99 100644 --- a/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp +++ b/src/USER-YAFF/pair_mm3_switch3_coulgauss_long.cpp @@ -51,7 +51,7 @@ PairMM3Switch3CoulGaussLong::PairMM3Switch3CoulGaussLong(LAMMPS *lmp) : Pair(lmp ewaldflag = pppmflag = 1; respa_enable = 1; writedata = 1; - ftable = NULL; + ftable = nullptr; qdist = 0.0; } @@ -360,11 +360,11 @@ void PairMM3Switch3CoulGaussLong::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; // insure use of KSpace long-range solver, set g_ewald - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; @@ -521,14 +521,14 @@ void PairMM3Switch3CoulGaussLong::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -561,14 +561,14 @@ void PairMM3Switch3CoulGaussLong::write_restart_settings(FILE *fp) void PairMM3Switch3CoulGaussLong::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&truncw,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&truncw,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ncoultablebits,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tabinner,sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -705,5 +705,5 @@ void *PairMM3Switch3CoulGaussLong::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"gamma") == 0) return (void *) gamma; - return NULL; + return nullptr; } diff --git a/src/VORONOI/compute_voronoi_atom.cpp b/src/VORONOI/compute_voronoi_atom.cpp index a3bc55253ea647ee60131d534f29882b3839d562..1d7d4b81495ee6f1dae6c08736c6fe5f3cea9ca7 100644 --- a/src/VORONOI/compute_voronoi_atom.cpp +++ b/src/VORONOI/compute_voronoi_atom.cpp @@ -41,10 +41,10 @@ using namespace voro; /* ---------------------------------------------------------------------- */ ComputeVoronoi::ComputeVoronoi(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), con_mono(NULL), con_poly(NULL), - radstr(NULL), voro(NULL), edge(NULL), sendvector(NULL), - rfield(NULL), tags(NULL), occvec(NULL), sendocc(NULL), - lroot(NULL), lnext(NULL), faces(NULL) + Compute(lmp, narg, arg), con_mono(nullptr), con_poly(nullptr), + radstr(nullptr), voro(nullptr), edge(nullptr), sendvector(nullptr), + rfield(nullptr), tags(nullptr), occvec(nullptr), sendocc(nullptr), + lroot(nullptr), lnext(nullptr), faces(nullptr) { int sgroup; @@ -56,16 +56,16 @@ ComputeVoronoi::ComputeVoronoi(LAMMPS *lmp, int narg, char **arg) : surface = VOROSURF_NONE; maxedge = 0; fthresh = ethresh = 0.0; - radstr = NULL; + radstr = nullptr; onlyGroup = false; occupation = false; - con_mono = NULL; - con_poly = NULL; - tags = NULL; + con_mono = nullptr; + con_poly = nullptr; + tags = nullptr; oldmaxtag = 0; - occvec = sendocc = lroot = lnext = NULL; - faces = NULL; + occvec = sendocc = lroot = lnext = nullptr; + faces = nullptr; int iarg = 3; while ( iargall(FLERR,"Compute voronoi/atom occupation requires an atom map, see atom_modify"); nmax = rmax = 0; - edge = rfield = sendvector = NULL; - voro = NULL; + edge = rfield = sendvector = nullptr; + voro = nullptr; if ( maxedge > 0 ) { vector_flag = 1; @@ -207,7 +207,7 @@ void ComputeVoronoi::compute_peratom() if (occupation) { // build cells only once int i, nall = atom->nlocal + atom->nghost; - if (con_mono==NULL && con_poly==NULL) { + if (con_mono==nullptr && con_poly==nullptr) { // generate the voronoi cell network for the initial structure buildCells(); @@ -218,7 +218,7 @@ void ComputeVoronoi::compute_peratom() // linked list structure for cell occupation count on the atoms oldnall= nall; memory->create(lroot,nall,"voronoi/atom:lroot"); // point to first atom index in cell (or -1 for empty cell) - lnext = NULL; + lnext = nullptr; lmax = 0; // build the occupation buffer. diff --git a/src/angle.cpp b/src/angle.cpp index 2796ae01b7a856df28fb984dd9b6c566a083baa4..4eedd7c69b93f6aa7930d4b05c961a2763ca1031 100644 --- a/src/angle.cpp +++ b/src/angle.cpp @@ -36,10 +36,10 @@ Angle::Angle(LAMMPS *lmp) : Pointers(lmp) suffix_flag = Suffix::NONE; maxeatom = maxvatom = maxcvatom = 0; - eatom = NULL; - vatom = NULL; - cvatom = NULL; - setflag = NULL; + eatom = nullptr; + vatom = nullptr; + cvatom = nullptr; + setflag = nullptr; execution_space = Host; datamask_read = ALL_MASK; diff --git a/src/angle_hybrid.cpp b/src/angle_hybrid.cpp index 56590d6757da47fef17466fe84992722d973ee84..70779aa7b2cfad9ef8dc16844463cd61164158df 100644 --- a/src/angle_hybrid.cpp +++ b/src/angle_hybrid.cpp @@ -174,7 +174,7 @@ void AngleHybrid::allocate() maxangle = new int[nstyles]; anglelist = new int**[nstyles]; for (int m = 0; m < nstyles; m++) maxangle[m] = 0; - for (int m = 0; m < nstyles; m++) anglelist[m] = NULL; + for (int m = 0; m < nstyles; m++) anglelist[m] = nullptr; } /* ---------------------------------------------------------------------- @@ -358,7 +358,7 @@ void AngleHybrid::write_restart(FILE *fp) void AngleHybrid::read_restart(FILE *fp) { int me = comm->me; - if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nstyles,1,MPI_INT,0,world); styles = new Angle*[nstyles]; keywords = new char*[nstyles]; @@ -367,10 +367,10 @@ void AngleHybrid::read_restart(FILE *fp) int n,dummy; for (int m = 0; m < nstyles; m++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); keywords[m] = new char[n]; - if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,nullptr,error); MPI_Bcast(keywords[m],n,MPI_CHAR,0,world); styles[m] = force->new_angle(keywords[m],0,dummy); styles[m]->read_restart_settings(fp); diff --git a/src/angle_zero.cpp b/src/angle_zero.cpp index e087b774e0c2aab68edbc50ad5645c6478020e01..9d8255e84c3ea1469f68424c5689425f68a1c563 100644 --- a/src/angle_zero.cpp +++ b/src/angle_zero.cpp @@ -128,7 +128,7 @@ void AngleZero::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,NULL,error); + utils::sfread(FLERR,&theta0[1],sizeof(double),atom->nangletypes,fp,nullptr,error); } MPI_Bcast(&theta0[1],atom->nangletypes,MPI_DOUBLE,0,world); diff --git a/src/atom.cpp b/src/atom.cpp index 35736d93e5e69b05a4188acd6a72a31bf00e3d0a..6d320fdf0b67d7b23ad98cb3dded2b0b9db4f8fb 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -83,113 +83,113 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) nbondtypes = nangletypes = ndihedraltypes = nimpropertypes = 0; nbonds = nangles = ndihedrals = nimpropers = 0; - firstgroupname = NULL; + firstgroupname = nullptr; sortfreq = 1000; nextsort = 0; userbinsize = 0.0; maxbin = maxnext = 0; - binhead = NULL; - next = permute = NULL; + binhead = nullptr; + next = permute = nullptr; // data structure with info on per-atom vectors/arrays nperatom = maxperatom = 0; - peratom = NULL; + peratom = nullptr; // -------------------------------------------------------------------- // 1st customization section: customize by adding new per-atom variables - tag = NULL; - type = mask = NULL; - image = NULL; - x = v = f = NULL; + tag = nullptr; + type = mask = nullptr; + image = nullptr; + x = v = f = nullptr; // charged and dipolar particles - q = NULL; - mu = NULL; + q = nullptr; + mu = nullptr; // finite-size particles - omega = angmom = torque = NULL; - radius = rmass = NULL; - ellipsoid = line = tri = body = NULL; + omega = angmom = torque = nullptr; + radius = rmass = nullptr; + ellipsoid = line = tri = body = nullptr; // molecular systems - molecule = NULL; - molindex = molatom = NULL; + molecule = nullptr; + molindex = molatom = nullptr; bond_per_atom = extra_bond_per_atom = 0; - num_bond = NULL; - bond_type = NULL; - bond_atom = NULL; + num_bond = nullptr; + bond_type = nullptr; + bond_atom = nullptr; angle_per_atom = extra_angle_per_atom = 0; - num_angle = NULL; - angle_type = NULL; - angle_atom1 = angle_atom2 = angle_atom3 = NULL; + num_angle = nullptr; + angle_type = nullptr; + angle_atom1 = angle_atom2 = angle_atom3 = nullptr; dihedral_per_atom = extra_dihedral_per_atom = 0; - num_dihedral = NULL; - dihedral_type = NULL; - dihedral_atom1 = dihedral_atom2 = dihedral_atom3 = dihedral_atom4 = NULL; + num_dihedral = nullptr; + dihedral_type = nullptr; + dihedral_atom1 = dihedral_atom2 = dihedral_atom3 = dihedral_atom4 = nullptr; improper_per_atom = extra_improper_per_atom = 0; - num_improper = NULL; - improper_type = NULL; - improper_atom1 = improper_atom2 = improper_atom3 = improper_atom4 = NULL; + num_improper = nullptr; + improper_type = nullptr; + improper_atom1 = improper_atom2 = improper_atom3 = improper_atom4 = nullptr; maxspecial = 1; - nspecial = NULL; - special = NULL; + nspecial = nullptr; + special = nullptr; // PERI package - vfrac = s0 = NULL; - x0 = NULL; + vfrac = s0 = nullptr; + x0 = nullptr; // SPIN package - sp = fm = fm_long = NULL; + sp = fm = fm_long = nullptr; // USER-EFF and USER-AWPMD packages - spin = NULL; - eradius = ervel = erforce = NULL; - ervelforce = NULL; - cs = csforce = vforce = NULL; - etag = NULL; + spin = nullptr; + eradius = ervel = erforce = nullptr; + ervelforce = nullptr; + cs = csforce = vforce = nullptr; + etag = nullptr; // USER-DPD package - uCond = uMech = uChem = uCG = uCGnew = NULL; - duChem = dpdTheta = NULL; + uCond = uMech = uChem = uCG = uCGnew = nullptr; + duChem = dpdTheta = nullptr; // USER-MESO package - cc = cc_flux = NULL; - edpd_temp = edpd_flux = edpd_cv = NULL; + cc = cc_flux = nullptr; + edpd_temp = edpd_flux = edpd_cv = nullptr; // USER-MESONT package - length = NULL; - buckling = NULL; - bond_nt = NULL; + length = nullptr; + buckling = nullptr; + bond_nt = nullptr; // USER-SMD package - contact_radius = NULL; - smd_data_9 = NULL; - smd_stress = NULL; - eff_plastic_strain = NULL; - eff_plastic_strain_rate = NULL; - damage = NULL; + contact_radius = nullptr; + smd_data_9 = nullptr; + smd_stress = nullptr; + eff_plastic_strain = nullptr; + eff_plastic_strain_rate = nullptr; + damage = nullptr; // USER-SPH package - rho = drho = esph = desph = cv = NULL; - vest = NULL; + rho = drho = esph = desph = cv = nullptr; + vest = nullptr; // end of customization section // -------------------------------------------------------------------- @@ -197,14 +197,14 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) // user-defined molecules nmolecule = 0; - molecules = NULL; + molecules = nullptr; // custom atom arrays nivector = ndvector = 0; - ivector = NULL; - dvector = NULL; - iname = dname = NULL; + ivector = nullptr; + dvector = nullptr; + iname = dname = nullptr; // initialize atom style and array existence flags @@ -216,16 +216,16 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) // ntype-length arrays - mass = NULL; - mass_setflag = NULL; + mass = nullptr; + mass_setflag = nullptr; // callback lists & extra restart info nextra_grow = nextra_restart = nextra_border = 0; - extra_grow = extra_restart = extra_border = NULL; + extra_grow = extra_restart = extra_border = nullptr; nextra_grow_max = nextra_restart_max = nextra_border_max = 0; nextra_store = 0; - extra = NULL; + extra = nullptr; // default atom ID and mapping values @@ -235,15 +235,15 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) map_maxarray = map_nhash = map_nbucket = -1; max_same = 0; - sametag = NULL; - map_array = NULL; - map_bucket = NULL; - map_hash = NULL; + sametag = nullptr; + map_array = nullptr; + map_bucket = nullptr; + map_hash = nullptr; unique_tags = nullptr; - atom_style = NULL; - avec = NULL; + atom_style = nullptr; + avec = nullptr; avec_map = new AtomVecCreatorMap(); @@ -288,7 +288,7 @@ Atom::~Atom() delete [] iname[i]; memory->destroy(ivector[i]); } - if (dvector != NULL) { + if (dvector != nullptr) { for (int i = 0; i < ndvector; i++) { delete [] dname[i]; memory->destroy(dvector[i]); @@ -352,7 +352,7 @@ void Atom::peratom_create() delete [] peratom[i].name; memory->sfree(peratom); - peratom = NULL; + peratom = nullptr; nperatom = maxperatom = 0; // -------------------------------------------------------------------- @@ -533,7 +533,7 @@ void Atom::add_peratom(const char *name, void *address, peratom[nperatom].datatype = datatype; peratom[nperatom].cols = cols; peratom[nperatom].threadflag = threadflag; - peratom[nperatom].address_length = NULL; + peratom[nperatom].address_length = nullptr; nperatom++; } @@ -629,8 +629,8 @@ void Atom::create_avec(const std::string &style, int narg, char **arg, int trysu { delete [] atom_style; if (avec) delete avec; - atom_style = NULL; - avec = NULL; + atom_style = nullptr; + avec = nullptr; // unset atom style and array existence flags // may have been set by old avec @@ -702,7 +702,7 @@ AtomVec *Atom::new_avec(const std::string &style, int trysuffix, int &sflag) } error->all(FLERR,utils::check_packages_for_style("atom",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -723,7 +723,7 @@ void Atom::init() if (nextra_store) { memory->destroy(extra); - extra = NULL; + extra = nullptr; nextra_store = 0; } @@ -756,7 +756,7 @@ void Atom::setup() /* ---------------------------------------------------------------------- return ptr to AtomVec class if matches style or to matching hybrid sub-class - return NULL if no match + return nullptr if no match ------------------------------------------------------------------------- */ AtomVec *Atom::style_match(const char *style) @@ -768,7 +768,7 @@ AtomVec *Atom::style_match(const char *style) if (strcmp(avec_hybrid->keywords[i],style) == 0) return avec_hybrid->styles[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -807,7 +807,7 @@ void Atom::modify_params(int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal atom_modify command"); if (strcmp(arg[iarg+1],"all") == 0) { delete [] firstgroupname; - firstgroupname = NULL; + firstgroupname = nullptr; } else { int n = strlen(arg[iarg+1]) + 1; firstgroupname = new char[n]; @@ -983,33 +983,33 @@ void Atom::deallocate_topology() { memory->destroy(atom->bond_type); memory->destroy(atom->bond_atom); - atom->bond_type = NULL; - atom->bond_atom = NULL; + atom->bond_type = nullptr; + atom->bond_atom = nullptr; memory->destroy(atom->angle_type); memory->destroy(atom->angle_atom1); memory->destroy(atom->angle_atom2); memory->destroy(atom->angle_atom3); - atom->angle_type = NULL; - atom->angle_atom1 = atom->angle_atom2 = atom->angle_atom3 = NULL; + atom->angle_type = nullptr; + atom->angle_atom1 = atom->angle_atom2 = atom->angle_atom3 = nullptr; memory->destroy(atom->dihedral_type); memory->destroy(atom->dihedral_atom1); memory->destroy(atom->dihedral_atom2); memory->destroy(atom->dihedral_atom3); memory->destroy(atom->dihedral_atom4); - atom->dihedral_type = NULL; + atom->dihedral_type = nullptr; atom->dihedral_atom1 = atom->dihedral_atom2 = - atom->dihedral_atom3 = atom->dihedral_atom4 = NULL; + atom->dihedral_atom3 = atom->dihedral_atom4 = nullptr; memory->destroy(atom->improper_type); memory->destroy(atom->improper_atom1); memory->destroy(atom->improper_atom2); memory->destroy(atom->improper_atom3); memory->destroy(atom->improper_atom4); - atom->improper_type = NULL; + atom->improper_type = nullptr; atom->improper_atom1 = atom->improper_atom2 = - atom->improper_atom3 = atom->improper_atom4 = NULL; + atom->improper_atom3 = atom->improper_atom4 = nullptr; } /* ---------------------------------------------------------------------- @@ -1108,11 +1108,11 @@ void Atom::data_atoms(int n, char *buf, tagint id_offset, tagint mol_offset, next = strchr(buf,'\n'); values[0] = strtok(buf," \t\n\r\f"); - if (values[0] == NULL) + if (values[0] == nullptr) error->all(FLERR,"Incorrect atom format in data file"); for (m = 1; m < nwords; m++) { - values[m] = strtok(NULL," \t\n\r\f"); - if (values[m] == NULL) + values[m] = strtok(nullptr," \t\n\r\f"); + if (values[m] == nullptr) error->all(FLERR,"Incorrect atom format in data file"); } @@ -1195,7 +1195,7 @@ void Atom::data_vels(int n, char *buf, tagint id_offset) values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) - values[j] = strtok(NULL," \t\n\r\f"); + values[j] = strtok(nullptr," \t\n\r\f"); tagdata = ATOTAGINT(values[0]) + id_offset; if (tagdata <= 0 || tagdata > map_tag_max) @@ -1210,7 +1210,7 @@ void Atom::data_vels(int n, char *buf, tagint id_offset) /* ---------------------------------------------------------------------- process N bonds read into buf from data files - if count is non-NULL, just count bonds per atom + if count is non-nullptr, just count bonds per atom else store them with atoms check that atom IDs are > 0 and <= map_tag_max ------------------------------------------------------------------------- */ @@ -1265,7 +1265,7 @@ void Atom::data_bonds(int n, char *buf, int *count, tagint id_offset, /* ---------------------------------------------------------------------- process N angles read into buf from data files - if count is non-NULL, just count angles per atom + if count is non-nullptr, just count angles per atom else store them with atoms check that atom IDs are > 0 and <= map_tag_max ------------------------------------------------------------------------- */ @@ -1337,7 +1337,7 @@ void Atom::data_angles(int n, char *buf, int *count, tagint id_offset, /* ---------------------------------------------------------------------- process N dihedrals read into buf from data files - if count is non-NULL, just count diihedrals per atom + if count is non-nullptr, just count diihedrals per atom else store them with atoms check that atom IDs are > 0 and <= map_tag_max ------------------------------------------------------------------------- */ @@ -1428,7 +1428,7 @@ void Atom::data_dihedrals(int n, char *buf, int *count, tagint id_offset, /* ---------------------------------------------------------------------- process N impropers read into buf from data files - if count is non-NULL, just count impropers per atom + if count is non-nullptr, just count impropers per atom else store them with atoms check that atom IDs are > 0 and <= map_tag_max ------------------------------------------------------------------------- */ @@ -1547,7 +1547,7 @@ void Atom::data_bonus(int n, char *buf, AtomVec *avec_bonus, tagint id_offset) values[0] = strtok(buf," \t\n\r\f"); for (j = 1; j < nwords; j++) - values[j] = strtok(NULL," \t\n\r\f"); + values[j] = strtok(nullptr," \t\n\r\f"); tagdata = ATOTAGINT(values[0]) + id_offset; if (tagdata <= 0 || tagdata > map_tag_max) @@ -1577,8 +1577,8 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset) int maxint = 0; int maxdouble = 0; - int *ivalues = NULL; - double *dvalues = NULL; + int *ivalues = nullptr; + double *dvalues = nullptr; if (!unique_tags) unique_tags = new std::set; @@ -1588,7 +1588,7 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset) for (int i = 0; i < n; i++) { if (i == 0) tagdata = ATOTAGINT(strtok(buf," \t\n\r\f")) + id_offset; - else tagdata = ATOTAGINT(strtok(NULL," \t\n\r\f")) + id_offset; + else tagdata = ATOTAGINT(strtok(nullptr," \t\n\r\f")) + id_offset; if (tagdata <= 0 || tagdata > map_tag_max) error->one(FLERR,"Invalid atom ID in Bodies section of data file"); @@ -1598,8 +1598,8 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset) else error->one(FLERR,"Duplicate atom ID in Bodies section of data file"); - ninteger = utils::inumeric(FLERR,strtok(NULL," \t\n\r\f"),false,lmp); - ndouble = utils::inumeric(FLERR,strtok(NULL," \t\n\r\f"),false,lmp); + ninteger = utils::inumeric(FLERR,strtok(nullptr," \t\n\r\f"),false,lmp); + ndouble = utils::inumeric(FLERR,strtok(nullptr," \t\n\r\f"),false,lmp); if ((m = map(tagdata)) >= 0) { if (ninteger > maxint) { @@ -1614,16 +1614,16 @@ void Atom::data_bodies(int n, char *buf, AtomVec *avec_body, tagint id_offset) } for (j = 0; j < ninteger; j++) - ivalues[j] = utils::inumeric(FLERR,strtok(NULL," \t\n\r\f"),false,lmp); + ivalues[j] = utils::inumeric(FLERR,strtok(nullptr," \t\n\r\f"),false,lmp); for (j = 0; j < ndouble; j++) - dvalues[j] = utils::numeric(FLERR,strtok(NULL," \t\n\r\f"),false,lmp); + dvalues[j] = utils::numeric(FLERR,strtok(nullptr," \t\n\r\f"),false,lmp); avec_body->data_body(m,ninteger,ndouble,ivalues,dvalues); } else { nvalues = ninteger + ndouble; // number of values to skip for (j = 0; j < nvalues; j++) - strtok(NULL," \t\n\r\f"); + strtok(nullptr," \t\n\r\f"); } } @@ -1680,7 +1680,7 @@ void Atom::allocate_type_arrays() void Atom::set_mass(const char *file, int line, const char *str, int type_offset) { - if (mass == NULL) error->all(file,line,"Cannot set mass for this atom style"); + if (mass == nullptr) error->all(file,line,"Cannot set mass for this atom style"); int itype; double mass_one; @@ -1704,7 +1704,7 @@ void Atom::set_mass(const char *file, int line, const char *str, int type_offset void Atom::set_mass(const char *file, int line, int itype, double value) { - if (mass == NULL) error->all(file,line,"Cannot set mass for this atom style"); + if (mass == nullptr) error->all(file,line,"Cannot set mass for this atom style"); if (itype < 1 || itype > ntypes) error->all(file,line,"Invalid type for mass set"); @@ -1721,7 +1721,7 @@ void Atom::set_mass(const char *file, int line, int itype, double value) void Atom::set_mass(const char *file, int line, int /*narg*/, char **arg) { - if (mass == NULL) error->all(file,line,"Cannot set mass for this atom style"); + if (mass == nullptr) error->all(file,line,"Cannot set mass for this atom style"); int lo,hi; utils::bounds(file,line,arg[0],1,ntypes,lo,hi,error); @@ -1754,7 +1754,7 @@ void Atom::set_mass(double *values) void Atom::check_mass(const char *file, int line) { - if (mass == NULL) return; + if (mass == nullptr) return; if (rmass_flag) return; for (int itype = 1; itype <= ntypes; itype++) if (mass_setflag[itype] == 0) @@ -1864,7 +1864,7 @@ void Atom::add_molecule(int narg, char **arg) int Atom::find_molecule(char *id) { - if(id == NULL) return -1; + if(id == nullptr) return -1; int imol; for (imol = 0; imol < nmolecule; imol++) if (strcmp(id,molecules[imol]->id) == 0) return imol; @@ -2201,14 +2201,14 @@ void Atom::add_callback(int flag) int ifix; // find the fix - // if find NULL ptr: + // if find null pointer: // it's this one, since it is being replaced and has just been deleted // at this point in re-creation - // if don't find NULL ptr: + // if don't find null pointer: // i is set to nfix = new one currently being added at end of list for (ifix = 0; ifix < modify->nfix; ifix++) - if (modify->fix[ifix] == NULL) break; + if (modify->fix[ifix] == nullptr) break; // add callback to lists and sort, reallocating if necessary // sorting is required in cases where fixes were replaced as it ensures atom @@ -2249,7 +2249,7 @@ void Atom::add_callback(int flag) void Atom::delete_callback(const char *id, int flag) { - if (id == NULL) return; + if (id == nullptr) return; int ifix = modify->find_fix(id); @@ -2310,7 +2310,7 @@ void Atom::update_callback(int ifix) int Atom::find_custom(const char *name, int &flag) { - if(name == NULL) return -1; + if(name == nullptr) return -1; for (int i = 0; i < nivector; i++) if (iname[i] && strcmp(iname[i],name) == 0) { @@ -2374,7 +2374,7 @@ int Atom::add_custom(const char *name, int flag) \verbatim embed:rst This will remove a property that was requested e.g. by the :doc:`fix property/atom ` command. It frees the -allocated memory and sets the pointer to ``NULL`` to the entry in +allocated memory and sets the pointer to ``nullptr`` to the entry in the list can be reused. The lists of those pointers will never be compacted or never shrink, so that index to name mappings remain valid. \endverbatim @@ -2386,14 +2386,14 @@ void Atom::remove_custom(int flag, int index) { if (flag == 0) { memory->destroy(ivector[index]); - ivector[index] = NULL; + ivector[index] = nullptr; delete [] iname[index]; - iname[index] = NULL; + iname[index] = nullptr; } else { memory->destroy(dvector[index]); - dvector[index] = NULL; + dvector[index] = nullptr; delete [] dname[index]; - dname[index] = NULL; + dname[index] = nullptr; } } @@ -2483,7 +2483,7 @@ length of the data area, and a short description. * - rmass - double - 1 - - per-atom mass of the particles. ``NULL`` if per-type masses are + - per-atom mass of the particles. ``nullptr`` if per-type masses are used. See the :cpp:func:`rmass_flag` setting. * - ellipsoid - int @@ -2506,7 +2506,7 @@ length of the data area, and a short description. * * \param name string with the keyword of the desired property. Typically the name of the pointer variable returned - * \return pointer to the requested data cast to ``void *`` or NULL */ + * \return pointer to the requested data cast to ``void *`` or nullptr */ void *Atom::extract(const char *name) { @@ -2577,7 +2577,7 @@ void *Atom::extract(const char *name) // end of customization section // -------------------------------------------------------------------- - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/atom.h b/src/atom.h index 72d92b46c2638f19bc5b4ae490b7c247dd7038cf..10631d24359f5fb8923e20b777c76a331771eb6d 100644 --- a/src/atom.h +++ b/src/atom.h @@ -58,7 +58,7 @@ class Atom : protected Pointers { int firstgroup; // store atoms in this group first, -1 if unset int nfirst; // # of atoms in first group on this proc - char *firstgroupname; // group-ID to store first, NULL if unset + char *firstgroupname; // group-ID to store first, null pointer if unset // -------------------------------------------------------------------- // 1st customization section: customize by adding new per-atom variable diff --git a/src/atom_map.cpp b/src/atom_map.cpp index f917b4f8e9136930829c87088af16799ddc1ac6b..8d8f4ef93438e32468fa045345b9edbc2bdf2caa 100644 --- a/src/atom_map.cpp +++ b/src/atom_map.cpp @@ -326,18 +326,18 @@ int Atom::map_style_set() void Atom::map_delete() { memory->destroy(sametag); - sametag = NULL; + sametag = nullptr; max_same = 0; if (map_style == MAP_ARRAY) { memory->destroy(map_array); - map_array = NULL; + map_array = nullptr; } else { if (map_nhash) { delete [] map_bucket; delete [] map_hash; - map_bucket = NULL; - map_hash = NULL; + map_bucket = nullptr; + map_hash = nullptr; } map_nhash = map_nbucket = 0; } diff --git a/src/atom_vec.cpp b/src/atom_vec.cpp index 2c046c6766805e4b01ca16ca72a0bb5457dcd9cf..b6275795f822cfeb7759c29d582d862d4ce03ff6 100644 --- a/src/atom_vec.cpp +++ b/src/atom_vec.cpp @@ -2060,7 +2060,7 @@ void AtomVec::write_vel(FILE *fp, int n, double **buf) } /* ---------------------------------------------------------------------- - pack bond info for data file into buf if non-NULL + pack bond info for data file into buf if non-nullptr return count of bonds from this proc do not count/pack bonds with bondtype = 0 if bondtype is negative, flip back to positive @@ -2118,7 +2118,7 @@ void AtomVec::write_bond(FILE *fp, int n, tagint **buf, int index) } /* ---------------------------------------------------------------------- - pack angle info for data file into buf if non-NULL + pack angle info for data file into buf if non-nullptr return count of angles from this proc do not count/pack angles with angletype = 0 if angletype is negative, flip back to positive diff --git a/src/atom_vec_body.cpp b/src/atom_vec_body.cpp index 179ca968eea74730435260d358bc2fa96d8d4da9..ad83b372a96de8fa4c4277343f256dc1b22b81ef 100644 --- a/src/atom_vec_body.cpp +++ b/src/atom_vec_body.cpp @@ -49,9 +49,9 @@ AtomVecBody::AtomVecBody(LAMMPS *lmp) : AtomVec(lmp) atom->radius_flag = 1; nlocal_bonus = nghost_bonus = nmax_bonus = 0; - bonus = NULL; + bonus = nullptr; - bptr = NULL; + bptr = nullptr; if (sizeof(double) == sizeof(int)) intdoubleratio = 1; else if (sizeof(double) == 2*sizeof(int)) intdoubleratio = 2; @@ -104,7 +104,7 @@ void AtomVecBody::process_args(int narg, char **arg) if (narg < 1) error->all(FLERR,"Invalid atom_style body command"); - if (0) bptr = NULL; + if (0) bptr = nullptr; #define BODY_CLASS #define BodyStyle(key,Class) \ @@ -582,7 +582,7 @@ void AtomVecBody::pack_data_pre(int ilocal) /* ---------------------------------------------------------------------- pack bonus body info for writing to data file - if buf is NULL, just return buffer size + if buf is nullptr, just return buffer size ------------------------------------------------------------------------- */ int AtomVecBody::pack_data_bonus(double *buf, int /*flag*/) diff --git a/src/atom_vec_ellipsoid.cpp b/src/atom_vec_ellipsoid.cpp index a82c9008c36aaed8392a2027f776d63c07e7491d..6518a5fc8981fd5b21c3bfba5cf59db9ad5a94c4 100644 --- a/src/atom_vec_ellipsoid.cpp +++ b/src/atom_vec_ellipsoid.cpp @@ -46,7 +46,7 @@ AtomVecEllipsoid::AtomVecEllipsoid(LAMMPS *lmp) : AtomVec(lmp) atom->rmass_flag = atom->angmom_flag = atom->torque_flag = 1; nlocal_bonus = nghost_bonus = nmax_bonus = 0; - bonus = NULL; + bonus = nullptr; // strings with peratom variables to include in each AtomVec method // strings cannot contain fields in corresponding AtomVec default strings @@ -484,7 +484,7 @@ void AtomVecEllipsoid::pack_data_post(int ilocal) /* ---------------------------------------------------------------------- pack bonus ellipsoid info for writing to data file - if buf is NULL, just return buffer size + if buf is nullptr, just return buffer size ------------------------------------------------------------------------- */ int AtomVecEllipsoid::pack_data_bonus(double *buf, int /*flag*/) diff --git a/src/atom_vec_hybrid.cpp b/src/atom_vec_hybrid.cpp index 4c0ce626e91fee8c29222bf510d5aa6b67f3567e..a8d2adb39a50cc9392d14ebd87792c27f935f0f9 100644 --- a/src/atom_vec_hybrid.cpp +++ b/src/atom_vec_hybrid.cpp @@ -30,13 +30,13 @@ enum{ELLIPSOID,LINE,TRIANGLE,BODY}; // also in WriteData AtomVecHybrid::AtomVecHybrid(LAMMPS *lmp) : AtomVec(lmp) { nstyles = 0; - styles = NULL; - keywords = NULL; - fieldstrings = NULL; + styles = nullptr; + keywords = nullptr; + fieldstrings = nullptr; bonus_flag = 0; nstyles_bonus = 0; - styles_bonus = NULL; + styles_bonus = nullptr; // these strings will be concatenated from sub-style strings // fields_data_atom & fields_data_vel start with fields common to all styles @@ -187,7 +187,7 @@ void AtomVecHybrid::process_args(int narg, char **arg) // save concat_grow to check for duplicates of special-case fields char *concat_grow;; - char *null = NULL; + char *null = nullptr; fields_grow = merge_fields(0,fields_grow,1,concat_grow); fields_copy = merge_fields(1,fields_copy,0,null); diff --git a/src/atom_vec_line.cpp b/src/atom_vec_line.cpp index f4211e97367856a16656ed1e2f7879414ef1f628..9dd1eba372562b1c2bfa5bc47ce7156591689b98 100644 --- a/src/atom_vec_line.cpp +++ b/src/atom_vec_line.cpp @@ -47,7 +47,7 @@ AtomVecLine::AtomVecLine(LAMMPS *lmp) : AtomVec(lmp) atom->sphere_flag = 1; nlocal_bonus = nghost_bonus = nmax_bonus = 0; - bonus = NULL; + bonus = nullptr; // strings with peratom variables to include in each AtomVec method // strings cannot contain fields in corresponding AtomVec default strings @@ -457,7 +457,7 @@ void AtomVecLine::pack_data_post(int ilocal) /* ---------------------------------------------------------------------- pack bonus line info for writing to data file - if buf is NULL, just return buffer size + if buf is nullptr, just return buffer size ------------------------------------------------------------------------- */ int AtomVecLine::pack_data_bonus(double *buf, int /*flag*/) diff --git a/src/atom_vec_tri.cpp b/src/atom_vec_tri.cpp index 77dd0c8bf3afe8e78af1c0ffba74ab12335aae24..f5b6ff4245cdb3b133cb39ac699eddd3a658f6a4 100644 --- a/src/atom_vec_tri.cpp +++ b/src/atom_vec_tri.cpp @@ -49,7 +49,7 @@ AtomVecTri::AtomVecTri(LAMMPS *lmp) : AtomVec(lmp) atom->sphere_flag = 1; nlocal_bonus = nghost_bonus = nmax_bonus = 0; - bonus = NULL; + bonus = nullptr; // strings with peratom variables to include in each AtomVec method // strings cannot contain fields in corresponding AtomVec default strings @@ -688,7 +688,7 @@ void AtomVecTri::pack_data_post(int ilocal) /* ---------------------------------------------------------------------- pack bonus tri info for writing to data file - if buf is NULL, just return buffer size + if buf is nullptr, just return buffer size ------------------------------------------------------------------------- */ int AtomVecTri::pack_data_bonus(double *buf, int /*flag*/) diff --git a/src/balance.cpp b/src/balance.cpp index f7059aa2c5f1e4e87792ed0e8a943d8c3fe58f09..5a8b787ce1d4bf39ce243680302c672d17de89b8 100644 --- a/src/balance.cpp +++ b/src/balance.cpp @@ -52,17 +52,17 @@ Balance::Balance(LAMMPS *lmp) : Pointers(lmp) MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); - user_xsplit = user_ysplit = user_zsplit = NULL; + user_xsplit = user_ysplit = user_zsplit = nullptr; shift_allocate = 0; - proccost = allproccost = NULL; + proccost = allproccost = nullptr; - rcb = NULL; + rcb = nullptr; nimbalance = 0; - imbalances = NULL; - fixstore = NULL; + imbalances = nullptr; + fixstore = nullptr; - fp = NULL; + fp = nullptr; firststep = 1; } @@ -97,7 +97,7 @@ Balance::~Balance() // check nfix in case all fixes have already been deleted if (fixstore && modify->nfix) modify->delete_fix(fixstore->id); - fixstore = NULL; + fixstore = nullptr; if (fp) fclose(fp); } @@ -246,7 +246,7 @@ void Balance::command(int narg, char **arg) // process remaining optional args options(iarg,narg,arg); - if (wtflag) weight_storage(NULL); + if (wtflag) weight_storage(nullptr); // insure particles are in current box & update box via shrink-wrap // init entire system since comm->setup is done @@ -425,7 +425,7 @@ void Balance::options(int iarg, int narg, char **arg) oldrcb = 0; outflag = 0; int outarg = 0; - fp = NULL; + fp = nullptr; while (iarg < narg) { if (strcmp(arg[iarg],"weight") == 0) { @@ -473,7 +473,7 @@ void Balance::options(int iarg, int narg, char **arg) if (outflag && comm->me == 0) { fp = fopen(arg[outarg],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open (fix) balance output file {}: {}", arg[outarg], utils::getsyserror())); } @@ -639,12 +639,12 @@ int *Balance::bisection(int sortflag) if (wtflag) { weight = fixstore->vstore; rcb->compute_old(dim,atom->nlocal,atom->x,weight,shrinklo,shrinkhi); - } else rcb->compute_old(dim,atom->nlocal,atom->x,NULL,shrinklo,shrinkhi); + } else rcb->compute_old(dim,atom->nlocal,atom->x,nullptr,shrinklo,shrinkhi); } else { if (wtflag) { weight = fixstore->vstore; rcb->compute(dim,atom->nlocal,atom->x,weight,shrinklo,shrinkhi); - } else rcb->compute(dim,atom->nlocal,atom->x,NULL,shrinklo,shrinkhi); + } else rcb->compute(dim,atom->nlocal,atom->x,nullptr,shrinklo,shrinkhi); } if (triclinic) domain->lamda2x(nlocal); @@ -1273,7 +1273,7 @@ void Balance::dumpout(bigint tstep) void Balance::debug_shift_output(int idim, int m, int np, double *split) { int i; - const char *dim = NULL; + const char *dim = nullptr; double *boxlo = domain->boxlo; double *prd = domain->prd; diff --git a/src/body.cpp b/src/body.cpp index c0e58d3f4c0525c2854e4fcbde7e8273a6c6cf60..9bc0bfc0415c952759440f7af528fbc288981ed7 100644 --- a/src/body.cpp +++ b/src/body.cpp @@ -23,8 +23,8 @@ Body::Body(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) int n = strlen(arg[0]) + 1; style = new char[n]; strcpy(style,arg[0]); - icp = NULL; - dcp = NULL; + icp = nullptr; + dcp = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/bond.cpp b/src/bond.cpp index 1f953bbd1904c007ccc378d26478ef37e8ca14a8..1ff7017132e7238379dea8a90599ed9eef413899 100644 --- a/src/bond.cpp +++ b/src/bond.cpp @@ -44,9 +44,9 @@ Bond::Bond(LAMMPS *lmp) : Pointers(lmp) suffix_flag = Suffix::NONE; maxeatom = maxvatom = 0; - eatom = NULL; - vatom = NULL; - setflag = NULL; + eatom = nullptr; + vatom = nullptr; + setflag = nullptr; execution_space = Host; datamask_read = ALL_MASK; @@ -276,7 +276,7 @@ void Bond::write_file(int narg, char **arg) fp = fopen(table_file.c_str(),"a"); } else { char datebuf[16]; - time_t tv = time(NULL); + time_t tv = time(nullptr); strftime(datebuf,15,"%Y-%m-%d",localtime(&tv)); utils::logmesg(lmp,fmt::format("Creating table file {} with " "DATE: {}\n", table_file, datebuf)); @@ -284,7 +284,7 @@ void Bond::write_file(int narg, char **arg) if (fp) fmt::print(fp,"# DATE: {} UNITS: {} Created by bond_write\n", datebuf, update->unit_style); } - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open bond_write file {}: {}", arg[4], utils::getsyserror())); } diff --git a/src/bond.h b/src/bond.h index 8d7585b3889d69ba0101f2d3c12e91f86b1fa7e6..5406aa3f027d576479d0c10ea9cb6eb20879fffa 100644 --- a/src/bond.h +++ b/src/bond.h @@ -52,7 +52,7 @@ class Bond : protected Pointers { virtual void write_data(FILE *) {} virtual double single(int, double, int, int, double &) = 0; virtual double memory_usage(); - virtual void *extract(const char *, int &) {return NULL;} + virtual void *extract(const char *, int &) {return nullptr;} virtual void reinit(); void write_file(int, char**); diff --git a/src/bond_hybrid.cpp b/src/bond_hybrid.cpp index b42683c3005655335b0e3f9e088e11c7f96ae897..46eeab5802d035813ce2761765e67afe47952f07 100644 --- a/src/bond_hybrid.cpp +++ b/src/bond_hybrid.cpp @@ -166,7 +166,7 @@ void BondHybrid::allocate() maxbond = new int[nstyles]; bondlist = new int**[nstyles]; for (int m = 0; m < nstyles; m++) maxbond[m] = 0; - for (int m = 0; m < nstyles; m++) bondlist[m] = NULL; + for (int m = 0; m < nstyles; m++) bondlist[m] = nullptr; } /* ---------------------------------------------------------------------- @@ -351,7 +351,7 @@ void BondHybrid::write_restart(FILE *fp) void BondHybrid::read_restart(FILE *fp) { int me = comm->me; - if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nstyles,1,MPI_INT,0,world); styles = new Bond*[nstyles]; keywords = new char*[nstyles]; @@ -360,10 +360,10 @@ void BondHybrid::read_restart(FILE *fp) int n,dummy; for (int m = 0; m < nstyles; m++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); keywords[m] = new char[n]; - if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,nullptr,error); MPI_Bcast(keywords[m],n,MPI_CHAR,0,world); styles[m] = force->new_bond(keywords[m],0,dummy); styles[m]->read_restart_settings(fp); diff --git a/src/bond_zero.cpp b/src/bond_zero.cpp index 71146ec4d66a6bc770c8a9e8ae48027a3fc439d1..06e55491616172bb0fc8c657516fbbe81cf33bb8 100644 --- a/src/bond_zero.cpp +++ b/src/bond_zero.cpp @@ -126,7 +126,7 @@ void BondZero::read_restart(FILE *fp) allocate(); if (comm->me == 0) { - utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,NULL,error); + utils::sfread(FLERR,&r0[1],sizeof(double),atom->nbondtypes,fp,nullptr,error); } MPI_Bcast(&r0[1],atom->nbondtypes,MPI_DOUBLE,0,world); @@ -157,5 +157,5 @@ void *BondZero::extract(const char *str, int &dim) { dim = 1; if (strcmp(str,"r0")==0) return (void*) r0; - return NULL; + return nullptr; } diff --git a/src/citeme.cpp b/src/citeme.cpp index c8745891cfbc2213be07dcaac14440d55728bf2c..b638eaf4752793174746c2cec23b59ae412abdee 100644 --- a/src/citeme.cpp +++ b/src/citeme.cpp @@ -28,7 +28,7 @@ static const char cite_nagline[] = "\nPlease see the log.cite file " CiteMe::CiteMe(LAMMPS *lmp) : Pointers(lmp) { - fp = NULL; + fp = nullptr; cs = new citeset(); } diff --git a/src/comm.cpp b/src/comm.cpp index 7b351e12fc384bd184fcd4b9fd93179b4c1fcbcf..32a41522949188bf98d6342175f339f6af72d4ec 100644 --- a/src/comm.cpp +++ b/src/comm.cpp @@ -57,15 +57,15 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp) mode = 0; bordergroup = 0; cutghostuser = 0.0; - cutusermulti = NULL; + cutusermulti = nullptr; ghost_velocity = 0; user_procgrid[0] = user_procgrid[1] = user_procgrid[2] = 0; coregrid[0] = coregrid[1] = coregrid[2] = 1; gridflag = ONELEVEL; mapflag = CART; - customfile = NULL; - outfile = NULL; + customfile = nullptr; + outfile = nullptr; recv_from_partition = send_to_partition = -1; otherflag = 0; @@ -73,8 +73,8 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp) maxexchange_fix_dynamic = 0; bufextra = BUFEXTRA; - grid2proc = NULL; - xsplit = ysplit = zsplit = NULL; + grid2proc = nullptr; + xsplit = ysplit = zsplit = nullptr; rcbnew = 0; // use of OpenMP threads @@ -88,7 +88,7 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp) #ifdef _OPENMP if (lmp->kokkos) { nthreads = lmp->kokkos->nthreads * lmp->kokkos->numa; - } else if (getenv("OMP_NUM_THREADS") == NULL) { + } else if (getenv("OMP_NUM_THREADS") == nullptr) { nthreads = 1; if (me == 0) error->message(FLERR,"OMP_NUM_THREADS environment is not set. " @@ -276,7 +276,7 @@ void Comm::modify_params(int narg, char **arg) // need to reset cutghostuser when switching comm mode if (mode == Comm::MULTI) cutghostuser = 0.0; memory->destroy(cutusermulti); - cutusermulti = NULL; + cutusermulti = nullptr; mode = Comm::SINGLE; } else if (strcmp(arg[iarg+1],"multi") == 0) { // need to reset cutghostuser when switching comm mode @@ -289,7 +289,7 @@ void Comm::modify_params(int narg, char **arg) bordergroup = group->find(arg[iarg+1]); if (bordergroup < 0) error->all(FLERR,"Invalid group in comm_modify command"); - if (bordergroup && (atom->firstgroupname == NULL || + if (bordergroup && (atom->firstgroupname == nullptr || strcmp(arg[iarg+1],atom->firstgroupname) != 0)) error->all(FLERR,"Comm_modify group != atom_modify first group"); iarg += 2; @@ -313,7 +313,7 @@ void Comm::modify_params(int narg, char **arg) const int ntypes = atom->ntypes; if (iarg+3 > narg) error->all(FLERR,"Illegal comm_modify command"); - if (cutusermulti == NULL) { + if (cutusermulti == nullptr) { memory->create(cutusermulti,ntypes+1,"comm:cutusermulti"); for (i=0; i < ntypes+1; ++i) cutusermulti[i] = -1.0; @@ -770,7 +770,7 @@ int Comm::binary(double value, int n, double *vec) callback() is invoked to allow caller to process/update each proc's inbuf if self=1 (default), then callback() is invoked on final iteration using original inbuf, which may have been updated - for non-NULL outbuf, final updated inbuf is copied to it + for non-nullptr outbuf, final updated inbuf is copied to it ok to specify outbuf = inbuf the ptr argument is a pointer to the instance of calling class ------------------------------------------------------------------------- */ @@ -792,7 +792,7 @@ void Comm::ring(int n, int nper, void *inbuf, int messtag, // sanity check - if ((nbytes > 0) && inbuf == NULL) + if ((nbytes > 0) && inbuf == nullptr) error->one(FLERR,"Cannot put data on ring from NULL pointer"); char *buf,*bufcopy; @@ -888,7 +888,7 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs, if (inorder) nrvous = irregular->create_data_grouped(n,procs); else nrvous = irregular->create_data(n,procs); - // add 1 item to the allocated buffer size, so the returned pointer is not NULL + // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer char *inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1, "rendezvous:inbuf"); @@ -925,7 +925,7 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs, nout = irregular->create_data_grouped(nrvous_out,procs_rvous); else nout = irregular->create_data(nrvous_out,procs_rvous); - // add 1 item to the allocated buffer size, so the returned pointer is not NULL + // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer outbuf = (char *) memory->smalloc((bigint) nout*outsize+1, "rendezvous:outbuf"); @@ -967,7 +967,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, if (!inorder) { memory->create(procs_a2a,nprocs,"rendezvous:procs"); - // add 1 item to the allocated buffer size, so the returned pointer is not NULL + // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer inbuf_a2a = (char *) memory->smalloc((bigint) n*insize+1, "rendezvous:inbuf"); @@ -1032,7 +1032,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, } // all2all comm of inbuf from caller decomp to rendezvous decomp - // add 1 item to the allocated buffer size, so the returned pointer is not NULL + // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer char *inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1, "rendezvous:inbuf"); @@ -1074,7 +1074,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, if (!outorder) { memory->create(procs_a2a,nprocs,"rendezvous_a2a:procs"); - // add 1 item to the allocated buffer size, so the returned pointer is not NULL + // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer outbuf_a2a = (char *) memory->smalloc((bigint) nrvous_out*outsize+1, "rendezvous:outbuf"); @@ -1135,7 +1135,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs, // all2all comm of outbuf from rendezvous decomp back to caller decomp // caller will free outbuf - // add 1 item to the allocated buffer size, so the returned pointer is not NULL + // add 1 item to the allocated buffer size, so the returned pointer is not a null pointer outbuf = (char *) memory->smalloc((bigint) nout*outsize+1,"rendezvous:outbuf"); diff --git a/src/comm.h b/src/comm.h index 6672891a42b38ac93f9b325182098cf9140712a9..c8d7add79c7329bc68c587b7a51c5c2716fff69c 100644 --- a/src/comm.h +++ b/src/comm.h @@ -118,7 +118,7 @@ class Comm : protected Pointers { int read_lines_from_file_universe(FILE *, int, int, char *); // extract data useful to other classes - virtual void *extract(const char *, int &) {return NULL;} + virtual void *extract(const char *, int &) {return nullptr;} protected: int bordergroup; // only communicate this group in borders @@ -242,7 +242,7 @@ E: Processor count in z must be 1 for 2d simulation Self-explanatory. -E: Cannot put data on ring from NULL pointer +E: Cannot put data on ring from nullptr pointer W: Communication cutoff is 0.0. No ghost atoms will be generated. Atoms may get lost. diff --git a/src/comm_brick.cpp b/src/comm_brick.cpp index 254082f98a6f485cd8c0cd706916b435c85c076b..374c394b0b79609c1a920ae84639dadbe8b60935 100644 --- a/src/comm_brick.cpp +++ b/src/comm_brick.cpp @@ -41,17 +41,17 @@ using namespace LAMMPS_NS; CommBrick::CommBrick(LAMMPS *lmp) : Comm(lmp), - sendnum(NULL), recvnum(NULL), sendproc(NULL), recvproc(NULL), - size_forward_recv(NULL), - size_reverse_send(NULL), size_reverse_recv(NULL), - slablo(NULL), slabhi(NULL), multilo(NULL), multihi(NULL), - cutghostmulti(NULL), pbc_flag(NULL), pbc(NULL), firstrecv(NULL), - sendlist(NULL), localsendlist(NULL), maxsendlist(NULL), - buf_send(NULL), buf_recv(NULL) + sendnum(nullptr), recvnum(nullptr), sendproc(nullptr), recvproc(nullptr), + size_forward_recv(nullptr), + size_reverse_send(nullptr), size_reverse_recv(nullptr), + slablo(nullptr), slabhi(nullptr), multilo(nullptr), multihi(nullptr), + cutghostmulti(nullptr), pbc_flag(nullptr), pbc(nullptr), firstrecv(nullptr), + sendlist(nullptr), localsendlist(nullptr), maxsendlist(nullptr), + buf_send(nullptr), buf_recv(nullptr) { style = 0; layout = Comm::LAYOUT_UNIFORM; - pbc_flag = NULL; + pbc_flag = nullptr; init_buffers(); } @@ -98,10 +98,10 @@ CommBrick::CommBrick(LAMMPS * /*lmp*/, Comm *oldcomm) : Comm(*oldcomm) void CommBrick::init_buffers() { - multilo = multihi = NULL; - cutghostmulti = NULL; + multilo = multihi = nullptr; + cutghostmulti = nullptr; - buf_send = buf_recv = NULL; + buf_send = buf_recv = nullptr; maxsend = maxrecv = BUFMIN; grow_send(maxsend,2); memory->create(buf_recv,maxrecv,"comm:buf_recv"); @@ -130,7 +130,7 @@ void CommBrick::init() // memory for multi-style communication - if (mode == Comm::MULTI && multilo == NULL) { + if (mode == Comm::MULTI && multilo == nullptr) { allocate_multi(maxswap); memory->create(cutghostmulti,atom->ntypes+1,3,"comm:cutghostmulti"); } @@ -1471,7 +1471,7 @@ void CommBrick::free_multi() { memory->destroy(multilo); memory->destroy(multihi); - multilo = multihi = NULL; + multilo = multihi = nullptr; } /* ---------------------------------------------------------------------- @@ -1500,7 +1500,7 @@ void *CommBrick::extract(const char *str, int &dim) return (void *) localsendlist; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/comm_tiled.cpp b/src/comm_tiled.cpp index 8332f9ca657314e680bf248caaea2d5aa6690a29..dbdc88709736a7369f103cdba8bdf2e757dfc004 100644 --- a/src/comm_tiled.cpp +++ b/src/comm_tiled.cpp @@ -47,12 +47,12 @@ CommTiled::CommTiled(LAMMPS *lmp) : Comm(lmp) { style = 1; layout = Comm::LAYOUT_UNIFORM; - pbc_flag = NULL; - buf_send = NULL; - buf_recv = NULL; - overlap = NULL; - rcbinfo = NULL; - cutghostmulti = NULL; + pbc_flag = nullptr; + buf_send = nullptr; + buf_recv = nullptr; + overlap = nullptr; + rcbinfo = nullptr; + cutghostmulti = nullptr; init_buffers(); } @@ -89,16 +89,16 @@ CommTiled::~CommTiled() void CommTiled::init_buffers() { - buf_send = buf_recv = NULL; + buf_send = buf_recv = nullptr; maxsend = maxrecv = BUFMIN; grow_send(maxsend,2); memory->create(buf_recv,maxrecv,"comm:buf_recv"); maxoverlap = 0; - overlap = NULL; - rcbinfo = NULL; - cutghostmulti = NULL; - sendbox_multi = NULL; + overlap = nullptr; + rcbinfo = nullptr; + cutghostmulti = nullptr; + sendbox_multi = nullptr; maxswap = 6; allocate_swap(maxswap); @@ -2093,22 +2093,22 @@ void CommTiled::allocate_swap(int n) sendlist = new int**[n]; for (int i = 0; i < n; i++) { - sendproc[i] = recvproc[i] = NULL; - sendnum[i] = recvnum[i] = NULL; - size_forward_recv[i] = firstrecv[i] = NULL; - size_reverse_send[i] = size_reverse_recv[i] = NULL; - forward_recv_offset[i] = reverse_recv_offset[i] = NULL; - - pbc_flag[i] = NULL; - pbc[i] = NULL; - sendbox[i] = NULL; - sendbox_multi[i] = NULL; - maxsendlist[i] = NULL; - sendlist[i] = NULL; + sendproc[i] = recvproc[i] = nullptr; + sendnum[i] = recvnum[i] = nullptr; + size_forward_recv[i] = firstrecv[i] = nullptr; + size_reverse_send[i] = size_reverse_recv[i] = nullptr; + forward_recv_offset[i] = reverse_recv_offset[i] = nullptr; + + pbc_flag[i] = nullptr; + pbc[i] = nullptr; + sendbox[i] = nullptr; + sendbox_multi[i] = nullptr; + maxsendlist[i] = nullptr; + sendlist[i] = nullptr; } maxrequest = 0; - requests = NULL; + requests = nullptr; for (int i = 0; i < n; i++) { nprocmax[i] = DELTA_PROCS; diff --git a/src/compute.cpp b/src/compute.cpp index 4cde9ff567ea8dc4a7920ce4e45c2a2fba5b48c9..bd07b0c6d65319647ecf14aced20e54f38b0ec41 100644 --- a/src/compute.cpp +++ b/src/compute.cpp @@ -37,10 +37,10 @@ int Compute::instance_total = 0; Compute::Compute(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp), - id(NULL), style(NULL), - vector(NULL), array(NULL), vector_atom(NULL), - array_atom(NULL), vector_local(NULL), array_local(NULL), extlist(NULL), - tlist(NULL), vbiasall(NULL) + id(nullptr), style(nullptr), + vector(nullptr), array(nullptr), vector_atom(nullptr), + array_atom(nullptr), vector_local(nullptr), array_local(nullptr), extlist(nullptr), + tlist(nullptr), vbiasall(nullptr) { instance_me = instance_total++; diff --git a/src/compute_adf.cpp b/src/compute_adf.cpp index 5d55f1fbbb0eecf974a658dd754b842996478aeb..e0213872d6c7d1a9b4231fa3bb9c8bf892a1d918 100644 --- a/src/compute_adf.cpp +++ b/src/compute_adf.cpp @@ -43,18 +43,18 @@ enum{DEGREE, RADIAN, COSINE}; ComputeADF::ComputeADF(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - ilo(NULL), ihi(NULL), jlo(NULL), jhi(NULL), klo(NULL), khi(NULL), - hist(NULL), histall(NULL), - rcutinnerj(NULL), rcutinnerk(NULL), - rcutouterj(NULL), rcutouterk(NULL), - list(NULL), - iatomcount(NULL), iatomcountall(NULL), iatomflag(NULL), - maxjatom(NULL), maxkatom(NULL), - numjatom(NULL), numkatom(NULL), - neighjatom(NULL),neighkatom(NULL), - jatomflag(NULL), katomflag(NULL), - maxjkatom(NULL), numjkatom(NULL), - neighjkatom(NULL), bothjkatom(NULL), delrjkatom(NULL) + ilo(nullptr), ihi(nullptr), jlo(nullptr), jhi(nullptr), klo(nullptr), khi(nullptr), + hist(nullptr), histall(nullptr), + rcutinnerj(nullptr), rcutinnerk(nullptr), + rcutouterj(nullptr), rcutouterk(nullptr), + list(nullptr), + iatomcount(nullptr), iatomcountall(nullptr), iatomflag(nullptr), + maxjatom(nullptr), maxkatom(nullptr), + numjatom(nullptr), numkatom(nullptr), + neighjatom(nullptr),neighkatom(nullptr), + jatomflag(nullptr), katomflag(nullptr), + maxjkatom(nullptr), numjkatom(nullptr), + neighjkatom(nullptr), bothjkatom(nullptr), delrjkatom(nullptr) { int nargsperadf = 7; diff --git a/src/compute_aggregate_atom.cpp b/src/compute_aggregate_atom.cpp index 6b6f376b4c5422aab406b6e65a6ce9e58985d137..97f8c6ff9e31bead3066fe26a1e00eca175a35d4 100644 --- a/src/compute_aggregate_atom.cpp +++ b/src/compute_aggregate_atom.cpp @@ -40,7 +40,7 @@ using namespace LAMMPS_NS; ComputeAggregateAtom::ComputeAggregateAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - aggregateID(NULL) + aggregateID(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute aggregate/atom command"); @@ -71,10 +71,10 @@ void ComputeAggregateAtom::init() { if (atom->tag_enable == 0) error->all(FLERR,"Cannot use compute aggregate/atom unless atoms have IDs"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Compute aggregate/atom requires a bond style to be defined"); - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute cluster/atom requires a pair style to be defined"); if (sqrt(cutsq) > force->pair->cutforce) error->all(FLERR, diff --git a/src/compute_angle.cpp b/src/compute_angle.cpp index e3e44efbbb71f911228b8e6c20721e065bfc1583..83daeedb9a92372fa5fa84f86a3e184a82226e0c 100644 --- a/src/compute_angle.cpp +++ b/src/compute_angle.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; ComputeAngle::ComputeAngle(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - emine(NULL) + emine(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute angle command"); diff --git a/src/compute_angle_local.cpp b/src/compute_angle_local.cpp index 57ee9b4acf19237d0e3e7a081fbd89eaf067d14f..ec031875eb5c5b9ed2ce38e29f19d80a9d3361d6 100644 --- a/src/compute_angle_local.cpp +++ b/src/compute_angle_local.cpp @@ -38,7 +38,7 @@ enum{THETA,ENG,VARIABLE}; ComputeAngleLocal::ComputeAngleLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - bstyle(NULL), vvar(NULL), tstr(NULL), vstr(NULL), vlocal(NULL), alocal(NULL) + bstyle(nullptr), vvar(nullptr), tstr(nullptr), vstr(nullptr), vlocal(nullptr), alocal(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute angle/local command"); @@ -77,7 +77,7 @@ ComputeAngleLocal::ComputeAngleLocal(LAMMPS *lmp, int narg, char **arg) : // optional args setflag = 0; - tstr = NULL; + tstr = nullptr; while (iarg < narg) { if (strcmp(arg[iarg],"set") == 0) { @@ -123,8 +123,8 @@ ComputeAngleLocal::ComputeAngleLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -146,7 +146,7 @@ ComputeAngleLocal::~ComputeAngleLocal() void ComputeAngleLocal::init() { - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"No angle style is defined for compute angle/local"); if (nvar) { diff --git a/src/compute_angmom_chunk.cpp b/src/compute_angmom_chunk.cpp index 6c9f1d65a20ed4cb34774ac7c97ddf3c0abf6675..eb22dcee5daea6979d67f0f616d63df5dd4823fc 100644 --- a/src/compute_angmom_chunk.cpp +++ b/src/compute_angmom_chunk.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; ComputeAngmomChunk::ComputeAngmomChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), massproc(NULL), masstotal(NULL), com(NULL), comall(NULL), angmom(NULL), angmomall(NULL) + idchunk(nullptr), massproc(nullptr), masstotal(nullptr), com(nullptr), comall(nullptr), angmom(nullptr), angmomall(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute angmom/chunk command"); diff --git a/src/compute_bond.cpp b/src/compute_bond.cpp index 503582bc65190b896bdd44a041284cedaf7cc3f5..f7c420685742cc0153b80e6f31baaddbf08e2b97 100644 --- a/src/compute_bond.cpp +++ b/src/compute_bond.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; ComputeBond::ComputeBond(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - emine(NULL) + emine(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute bond command"); diff --git a/src/compute_bond_local.cpp b/src/compute_bond_local.cpp index cb7ed3a4e066c4d74487e1aead0574bd0df5e524..1ae4d1b079f6b4d98bf1ccd81c9a362d748307ca 100644 --- a/src/compute_bond_local.cpp +++ b/src/compute_bond_local.cpp @@ -39,7 +39,7 @@ enum{DIST,VELVIB,OMEGA,ENGTRANS,ENGVIB,ENGROT,ENGPOT,FORCE,FX,FY,FZ,VARIABLE}; ComputeBondLocal::ComputeBondLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - bstyle(NULL), vvar(NULL), dstr(NULL), vstr(NULL), vlocal(NULL), alocal(NULL) + bstyle(nullptr), vvar(nullptr), dstr(nullptr), vstr(nullptr), vlocal(nullptr), alocal(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute bond/local command"); @@ -84,7 +84,7 @@ ComputeBondLocal::ComputeBondLocal(LAMMPS *lmp, int narg, char **arg) : // optional args setflag = 0; - dstr = NULL; + dstr = nullptr; while (iarg < narg) { if (strcmp(arg[iarg],"set") == 0) { @@ -142,8 +142,8 @@ ComputeBondLocal::ComputeBondLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -165,7 +165,7 @@ ComputeBondLocal::~ComputeBondLocal() void ComputeBondLocal::init() { - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"No bond style is defined for compute bond/local"); if (nvar) { diff --git a/src/compute_centro_atom.cpp b/src/compute_centro_atom.cpp index f88dea9ebed691d2aa2884bee1f191f40016e26f..af32a8e9a306aa9b764c04c415539483ae67b272 100644 --- a/src/compute_centro_atom.cpp +++ b/src/compute_centro_atom.cpp @@ -36,7 +36,7 @@ using namespace LAMMPS_NS; ComputeCentroAtom::ComputeCentroAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - distsq(NULL), nearest(NULL), centro(NULL) + distsq(nullptr), nearest(nullptr), centro(nullptr) { if (narg < 4 || narg > 6) error->all(FLERR,"Illegal compute centro/atom command"); @@ -88,7 +88,7 @@ ComputeCentroAtom::~ComputeCentroAtom() void ComputeCentroAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute centro/atom requires a pair style be defined"); int count = 0; diff --git a/src/compute_centroid_stress_atom.cpp b/src/compute_centroid_stress_atom.cpp index 7c979c66d7a3c5c41304b50b77f1e7178ab8035d..499d903451aff5d7e9cb834685c5847e2874f969 100644 --- a/src/compute_centroid_stress_atom.cpp +++ b/src/compute_centroid_stress_atom.cpp @@ -36,7 +36,7 @@ enum{NOBIAS,BIAS}; ComputeCentroidStressAtom::ComputeCentroidStressAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_temp(NULL), stress(NULL) + id_temp(nullptr), stress(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute centroid/stress/atom command"); @@ -49,7 +49,7 @@ ComputeCentroidStressAtom::ComputeCentroidStressAtom(LAMMPS *lmp, int narg, char // store temperature ID used by stress computation // insure it is valid for temperature computation - if (strcmp(arg[3],"NULL") == 0) id_temp = NULL; + if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr; else { int n = strlen(arg[3]) + 1; id_temp = new char[n]; @@ -237,7 +237,7 @@ void ComputeCentroidStressAtom::compute_peratom() } // add in per-atom contributions from relevant fixes - // skip if vatom = NULL + // skip if vatom = nullptr // possible during setup phase if fix has not initialized its vatom yet // e.g. fix ave/spatial defined before fix shake, // and fix ave/spatial uses a per-atom stress from this compute as input diff --git a/src/compute_chunk_atom.cpp b/src/compute_chunk_atom.cpp index d0044410d870c6a6a6d1cc32e1466e0d33aabb81..7fe9394b439ac38dda1e2fcc2ad792a05196b4a1 100644 --- a/src/compute_chunk_atom.cpp +++ b/src/compute_chunk_atom.cpp @@ -54,10 +54,10 @@ enum{LIMITMAX,LIMITEXACT}; ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - chunk_volume_vec(NULL), coord(NULL), ichunk(NULL), chunkID(NULL), - cfvid(NULL), idregion(NULL), region(NULL), cchunk(NULL), fchunk(NULL), - varatom(NULL), id_fix(NULL), fixstore(NULL), lockfix(NULL), chunk(NULL), - exclude(NULL), hash(NULL) + chunk_volume_vec(nullptr), coord(nullptr), ichunk(nullptr), chunkID(nullptr), + cfvid(nullptr), idregion(nullptr), region(nullptr), cchunk(nullptr), fchunk(nullptr), + varatom(nullptr), id_fix(nullptr), fixstore(nullptr), lockfix(nullptr), chunk(nullptr), + exclude(nullptr), hash(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute chunk/atom command"); @@ -73,7 +73,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : binflag = 0; ncoord = 0; - cfvid = NULL; + cfvid = nullptr; if (strcmp(arg[3],"bin/1d") == 0) { binflag = 1; @@ -177,7 +177,7 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : // optional args regionflag = 0; - idregion = NULL; + idregion = nullptr; nchunksetflag = 0; nchunkflag = EVERY; limit = 0; @@ -448,16 +448,16 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : // initialize chunk vector and per-chunk info nmax = 0; - chunk = NULL; + chunk = nullptr; nmaxint = -1; - ichunk = NULL; - exclude = NULL; + ichunk = nullptr; + exclude = nullptr; nchunk = 0; chunk_volume_scalar = 1.0; - chunk_volume_vec = NULL; - coord = NULL; - chunkID = NULL; + chunk_volume_vec = nullptr; + coord = nullptr; + chunkID = nullptr; // computeflag = 1 if this compute might invoke another compute // during assign_chunk_ids() @@ -470,17 +470,17 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) : invoked_setup = -1; invoked_ichunk = -1; - id_fix = NULL; - fixstore = NULL; + id_fix = nullptr; + fixstore = nullptr; if (compress) hash = new std::map(); - else hash = NULL; + else hash = nullptr; maxvar = 0; - varatom = NULL; + varatom = nullptr; lockcount = 0; - lockfix = NULL; + lockfix = nullptr; if (which == MOLECULE) molcheck = 1; else molcheck = 0; @@ -593,7 +593,7 @@ void ComputeChunkAtom::init() if ((idsflag != ONCE && !lockcount) && fixstore) { modify->delete_fix(id_fix); - fixstore = NULL; + fixstore = nullptr; } } @@ -665,7 +665,7 @@ double ComputeChunkAtom::compute_scalar() void ComputeChunkAtom::lock(Fix *fixptr, bigint startstep, bigint stopstep) { - if (lockfix == NULL) { + if (lockfix == nullptr) { lockfix = fixptr; lockstart = startstep; lockstop = stopstep; @@ -689,7 +689,7 @@ void ComputeChunkAtom::lock(Fix *fixptr, bigint startstep, bigint stopstep) void ComputeChunkAtom::unlock(Fix *fixptr) { if (fixptr != lockfix) return; - lockfix = NULL; + lockfix = nullptr; } /* ---------------------------------------------------------------------- @@ -1049,7 +1049,7 @@ void ComputeChunkAtom::compress_chunk_ids() // create my list of populated IDs - int *list = NULL; + int *list = nullptr; memory->create(list,n,"chunk/atom:list"); n = 0; @@ -1094,7 +1094,7 @@ void ComputeChunkAtom::compress_chunk_ids() memory->destroy(listall); } else { - comm->ring(n,sizeof(int),list,1,idring,NULL,(void *)this,0); + comm->ring(n,sizeof(int),list,1,idring,nullptr,(void *)this,0); } memory->destroy(list); diff --git a/src/compute_chunk_atom.h b/src/compute_chunk_atom.h index 98a3ea9a2babf50b05da7535fcf937ede8629371..392179043a0f16e777286ee722750463e8355a59 100644 --- a/src/compute_chunk_atom.h +++ b/src/compute_chunk_atom.h @@ -96,7 +96,7 @@ class ComputeChunkAtom : public Compute { class FixStore *fixstore; class Fix *lockfix; // ptr to FixAveChunk that is locking out setups - // NULL if no lock currently in place + // null pointer if no lock currently in place bigint lockstart,lockstop; // timesteps for start and stop of locking bigint invoked_setup; // last timestep setup_chunks and nchunk calculated diff --git a/src/compute_chunk_spread_atom.cpp b/src/compute_chunk_spread_atom.cpp index 953ae3a8cbfdefcd7d33a98a49652797b8c80f31..b3b57d75d3429ab8041d99dab6f313b1cd0f2da9 100644 --- a/src/compute_chunk_spread_atom.cpp +++ b/src/compute_chunk_spread_atom.cpp @@ -37,7 +37,7 @@ enum{COMPUTE,FIX}; ComputeChunkSpreadAtom:: ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), ids(NULL), which(NULL), argindex(NULL), value2index(NULL) + idchunk(nullptr), ids(nullptr), which(nullptr), argindex(nullptr), value2index(nullptr) { if (narg < 5) error->all(FLERR,"Illegal compute chunk/spread/atom command"); @@ -68,7 +68,7 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) : iarg = 0; while (iarg < nargnew) { - ids[nvalues] = NULL; + ids[nvalues] = nullptr; if (strncmp(arg[iarg],"c_",2) == 0 || strncmp(arg[iarg],"f_",2) == 0) { @@ -161,8 +161,8 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) : // per-atom vector or array nmax = 0; - vector_atom = NULL; - array_atom = NULL; + vector_atom = nullptr; + array_atom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_cluster_atom.cpp b/src/compute_cluster_atom.cpp index 8086ef3f41aee0272a8544d1fd880dee1d394e61..fa31e738bced3f14fb09b4b92f10d7883147bb0a 100644 --- a/src/compute_cluster_atom.cpp +++ b/src/compute_cluster_atom.cpp @@ -37,7 +37,7 @@ enum{CLUSTER,MASK,COORDS}; ComputeClusterAtom::ComputeClusterAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - clusterID(NULL) + clusterID(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute cluster/atom command"); @@ -64,7 +64,7 @@ void ComputeClusterAtom::init() { if (atom->tag_enable == 0) error->all(FLERR,"Cannot use compute cluster/atom unless atoms have IDs"); - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute cluster/atom requires a pair style to be defined"); if (sqrt(cutsq) > force->pair->cutforce) error->all(FLERR, diff --git a/src/compute_cna_atom.cpp b/src/compute_cna_atom.cpp index e9b6f1699057db5b809d834f9851ff61fd860a57..9a7a9b5d159fc03316edda639367ee8dfbe7b75f 100644 --- a/src/compute_cna_atom.cpp +++ b/src/compute_cna_atom.cpp @@ -44,7 +44,7 @@ enum{NCOMMON,NBOND,MAXBOND,MINBOND}; ComputeCNAAtom::ComputeCNAAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - list(NULL), nearest(NULL), nnearest(NULL), pattern(NULL) + list(nullptr), nearest(nullptr), nnearest(nullptr), pattern(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute cna/atom command"); @@ -71,7 +71,7 @@ ComputeCNAAtom::~ComputeCNAAtom() void ComputeCNAAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute cna/atom requires a pair style be defined"); if (sqrt(cutsq) > force->pair->cutforce) error->all(FLERR,"Compute cna/atom cutoff is longer than pairwise cutoff"); diff --git a/src/compute_com_chunk.cpp b/src/compute_com_chunk.cpp index 8398311a05de721fe2fbc7dd975d140b185e969f..39ea6cfa827cb4564fdb46d244d59ff92528cb29 100644 --- a/src/compute_com_chunk.cpp +++ b/src/compute_com_chunk.cpp @@ -31,7 +31,7 @@ enum{ONCE,NFREQ,EVERY}; ComputeCOMChunk::ComputeCOMChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), masstotal(NULL), massproc(NULL), com(NULL), comall(NULL) + idchunk(nullptr), masstotal(nullptr), massproc(nullptr), com(nullptr), comall(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute com/chunk command"); diff --git a/src/compute_contact_atom.cpp b/src/compute_contact_atom.cpp index 7a288afb438382e359d76b33fe601c97ffd73eca..11f0c14893a6443303fa00e31b2348171aadcb73 100644 --- a/src/compute_contact_atom.cpp +++ b/src/compute_contact_atom.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; ComputeContactAtom::ComputeContactAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - contact(NULL) + contact(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute contact/atom command"); @@ -57,7 +57,7 @@ ComputeContactAtom::~ComputeContactAtom() void ComputeContactAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute contact/atom requires a pair style be defined"); int count = 0; diff --git a/src/compute_coord_atom.cpp b/src/compute_coord_atom.cpp index cb919d3a836783317f19b4b9e231c770e732de19..05d299fa269b2492a2acaec84afbce2baaac637f 100644 --- a/src/compute_coord_atom.cpp +++ b/src/compute_coord_atom.cpp @@ -38,8 +38,8 @@ using namespace LAMMPS_NS; ComputeCoordAtom::ComputeCoordAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - typelo(NULL), typehi(NULL), cvec(NULL), carray(NULL), - group2(NULL), id_orientorder(NULL), normv(NULL) + typelo(nullptr), typehi(nullptr), cvec(nullptr), carray(nullptr), + group2(nullptr), id_orientorder(nullptr), normv(nullptr) { if (narg < 5) error->all(FLERR,"Illegal compute coord/atom command"); @@ -147,7 +147,7 @@ void ComputeCoordAtom::init() "option in compute orientorder/atom"); } - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute coord/atom requires a pair style be defined"); if (sqrt(cutsq) > force->pair->cutforce) error->all(FLERR, diff --git a/src/compute_dihedral.cpp b/src/compute_dihedral.cpp index 8853887f184a8f825593568e9e70e7c7586576bd..64d9c8b37e6a5fd28468107d8510bcb4351f7152 100644 --- a/src/compute_dihedral.cpp +++ b/src/compute_dihedral.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; ComputeDihedral::ComputeDihedral(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - emine(NULL) + emine(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute dihedral command"); diff --git a/src/compute_dihedral_local.cpp b/src/compute_dihedral_local.cpp index 26ff17f48e51dc78408ec9687fda3cd789a688d9..64bcdc16fbd157e6d8b8ae1f21d9c9c69bda8159 100644 --- a/src/compute_dihedral_local.cpp +++ b/src/compute_dihedral_local.cpp @@ -38,7 +38,7 @@ enum{PHI,VARIABLE}; ComputeDihedralLocal::ComputeDihedralLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - bstyle(NULL), vvar(NULL), pstr(NULL), vstr(NULL), vlocal(NULL), alocal(NULL) + bstyle(nullptr), vvar(nullptr), pstr(nullptr), vstr(nullptr), vlocal(nullptr), alocal(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute dihedral/local command"); @@ -74,7 +74,7 @@ ComputeDihedralLocal::ComputeDihedralLocal(LAMMPS *lmp, int narg, char **arg) : // optional args setflag = 0; - pstr = NULL; + pstr = nullptr; while (iarg < narg) { if (strcmp(arg[iarg],"set") == 0) { @@ -122,8 +122,8 @@ ComputeDihedralLocal::ComputeDihedralLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -145,7 +145,7 @@ ComputeDihedralLocal::~ComputeDihedralLocal() void ComputeDihedralLocal::init() { - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR,"No dihedral style is defined for compute dihedral/local"); if (nvar) { diff --git a/src/compute_dipole_chunk.cpp b/src/compute_dipole_chunk.cpp index 361ee36c1827f59fde2186bd4c2d4b65ecbe6ce3..f387786b839bc2e60058604a9c4c6b4ef0417c28 100644 --- a/src/compute_dipole_chunk.cpp +++ b/src/compute_dipole_chunk.cpp @@ -34,9 +34,9 @@ enum { MASSCENTER, GEOMCENTER }; ComputeDipoleChunk::ComputeDipoleChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), massproc(NULL), masstotal(NULL), chrgproc(NULL), - chrgtotal(NULL), com(NULL), - comall(NULL), dipole(NULL), dipoleall(NULL) + idchunk(nullptr), massproc(nullptr), masstotal(nullptr), chrgproc(nullptr), + chrgtotal(nullptr), com(nullptr), + comall(nullptr), dipole(nullptr), dipoleall(nullptr) { if ((narg != 4) && (narg != 5)) error->all(FLERR,"Illegal compute dipole/chunk command"); diff --git a/src/compute_displace_atom.cpp b/src/compute_displace_atom.cpp index 4b194cfab128cd2d951e9333614027a52c454e36..bd939f14020bc9323c4a6a5bf436270946cf75d1 100644 --- a/src/compute_displace_atom.cpp +++ b/src/compute_displace_atom.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; ComputeDisplaceAtom::ComputeDisplaceAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - displace(NULL), id_fix(NULL) + displace(nullptr), id_fix(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute displace/atom command"); @@ -44,7 +44,7 @@ ComputeDisplaceAtom::ComputeDisplaceAtom(LAMMPS *lmp, int narg, char **arg) : // optional args refreshflag = 0; - rvar = NULL; + rvar = nullptr; int iarg = 3; while (iarg < narg) { @@ -102,7 +102,7 @@ ComputeDisplaceAtom::ComputeDisplaceAtom(LAMMPS *lmp, int narg, char **arg) : // per-atom displacement array nmax = nvmax = 0; - varatom = NULL; + varatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_erotate_sphere_atom.cpp b/src/compute_erotate_sphere_atom.cpp index 78664a912f8ca4be54ee211417508731dc9112e0..d3f0d723c6e60a8609bb2e95f1425c8ac3b45674 100644 --- a/src/compute_erotate_sphere_atom.cpp +++ b/src/compute_erotate_sphere_atom.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; ComputeErotateSphereAtom:: ComputeErotateSphereAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - erot(NULL) + erot(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute erotate/sphere//atom command"); diff --git a/src/compute_fragment_atom.cpp b/src/compute_fragment_atom.cpp index db003c93e7ae63a1a96cd86cd5d2e49c7ba8c809..85497bce0297387864f7b7e942c6f96c25a4a5c3 100644 --- a/src/compute_fragment_atom.cpp +++ b/src/compute_fragment_atom.cpp @@ -36,7 +36,7 @@ using namespace LAMMPS_NS; ComputeFragmentAtom::ComputeFragmentAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - fragmentID(NULL) + fragmentID(nullptr) { if (atom->avec->bonds_allow == 0) error->all(FLERR,"Compute fragment/atom used when bonds are not allowed"); @@ -61,9 +61,9 @@ ComputeFragmentAtom::ComputeFragmentAtom(LAMMPS *lmp, int narg, char **arg) : } nmax = 0; - stack = NULL; - clist = NULL; - markflag = NULL; + stack = nullptr; + clist = nullptr; + markflag = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_global_atom.cpp b/src/compute_global_atom.cpp index b3e4f88bf3594aed1a204c6625629a15a7007b36..03d9ba4ecbd33d43911500d1c5908b8816a4aaae 100644 --- a/src/compute_global_atom.cpp +++ b/src/compute_global_atom.cpp @@ -39,8 +39,8 @@ enum{VECTOR,ARRAY}; ComputeGlobalAtom::ComputeGlobalAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idref(NULL), which(NULL), argindex(NULL), value2index(NULL), ids(NULL), - indices(NULL), varatom(NULL), vecglobal(NULL) + idref(nullptr), which(nullptr), argindex(nullptr), value2index(nullptr), ids(nullptr), + indices(nullptr), varatom(nullptr), vecglobal(nullptr) { if (narg < 5) error->all(FLERR,"Illegal compute global/atom command"); @@ -96,7 +96,7 @@ ComputeGlobalAtom::ComputeGlobalAtom(LAMMPS *lmp, int narg, char **arg) : iarg = 0; while (iarg < nargnew) { - ids[nvalues] = NULL; + ids[nvalues] = nullptr; if (strncmp(arg[iarg],"c_",2) == 0 || strncmp(arg[iarg],"f_",2) == 0 || strncmp(arg[iarg],"v_",2) == 0) { @@ -234,8 +234,8 @@ ComputeGlobalAtom::ComputeGlobalAtom(LAMMPS *lmp, int narg, char **arg) : else size_peratom_cols = nvalues; nmax = maxvector = 0; - vector_atom = NULL; - array_atom = NULL; + vector_atom = nullptr; + array_atom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_group_group.cpp b/src/compute_group_group.cpp index ca0483fce938245eeb821b48f3f5c31e0c96f60c..90956c6b151f4042ddd538e0662107766b791cf8 100644 --- a/src/compute_group_group.cpp +++ b/src/compute_group_group.cpp @@ -45,7 +45,7 @@ enum{OFF,INTER,INTRA}; ComputeGroupGroup::ComputeGroupGroup(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - group2(NULL) + group2(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute group/group command"); @@ -122,15 +122,15 @@ void ComputeGroupGroup::init() // if non-hybrid, then error if single_enable = 0 // if hybrid, let hybrid determine if sub-style sets single_enable = 0 - if (pairflag && force->pair == NULL) + if (pairflag && force->pair == nullptr) error->all(FLERR,"No pair style defined for compute group/group"); - if (force->pair_match("^hybrid",0) == NULL + if (force->pair_match("^hybrid",0) == nullptr && force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute group/group"); // error if Kspace style does not compute group/group interactions - if (kspaceflag && force->kspace == NULL) + if (kspaceflag && force->kspace == nullptr) error->all(FLERR,"No Kspace style defined for compute group/group"); if (kspaceflag && force->kspace->group_group_enable == 0) error->all(FLERR,"Kspace style does not support compute group/group"); @@ -138,10 +138,10 @@ void ComputeGroupGroup::init() if (pairflag) { pair = force->pair; cutsq = force->pair->cutsq; - } else pair = NULL; + } else pair = nullptr; if (kspaceflag) kspace = force->kspace; - else kspace = NULL; + else kspace = nullptr; // compute Kspace correction terms diff --git a/src/compute_gyration_chunk.cpp b/src/compute_gyration_chunk.cpp index ad0520bc01775ce3a5ab0daf2caeafe72d1bb686..f7e7c8ced90d030cf73d0d7bd7df525c4ebfc099 100644 --- a/src/compute_gyration_chunk.cpp +++ b/src/compute_gyration_chunk.cpp @@ -29,8 +29,8 @@ using namespace LAMMPS_NS; ComputeGyrationChunk::ComputeGyrationChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), massproc(NULL), masstotal(NULL), com(NULL), comall(NULL), - rg(NULL), rgall(NULL), rgt(NULL), rgtall(NULL) + idchunk(nullptr), massproc(nullptr), masstotal(nullptr), com(nullptr), comall(nullptr), + rg(nullptr), rgall(nullptr), rgt(nullptr), rgtall(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute gyration/chunk command"); diff --git a/src/compute_heat_flux.cpp b/src/compute_heat_flux.cpp index 15a17949eb6bc879300a95d0efbf725e93a83324..bcb10c833adc77b8ba04afb5ab6f1c04678ed185 100644 --- a/src/compute_heat_flux.cpp +++ b/src/compute_heat_flux.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; ComputeHeatFlux::ComputeHeatFlux(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_ke(NULL), id_pe(NULL), id_stress(NULL) + id_ke(nullptr), id_pe(nullptr), id_stress(nullptr) { if (narg != 6) error->all(FLERR,"Illegal compute heat/flux command"); diff --git a/src/compute_hexorder_atom.cpp b/src/compute_hexorder_atom.cpp index 00f81dc8456a2d08a51cf7665da812134e7e967b..736a7e64c62a40679fcce9fb4c64d331302bdd81 100644 --- a/src/compute_hexorder_atom.cpp +++ b/src/compute_hexorder_atom.cpp @@ -45,7 +45,7 @@ using namespace MathConst; ComputeHexOrderAtom::ComputeHexOrderAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - distsq(NULL), nearest(NULL), qnarray(NULL) + distsq(nullptr), nearest(nullptr), qnarray(nullptr) { if (narg < 3 ) error->all(FLERR,"Illegal compute hexorder/atom command"); @@ -104,7 +104,7 @@ ComputeHexOrderAtom::~ComputeHexOrderAtom() void ComputeHexOrderAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute hexorder/atom requires a pair style be defined"); if (cutsq == 0.0) cutsq = force->pair->cutforce * force->pair->cutforce; else if (sqrt(cutsq) > force->pair->cutforce) diff --git a/src/compute_improper.cpp b/src/compute_improper.cpp index 3721dbfd4821f94bd3bbc1d9c82ae2776290881c..aa65bde661829693078a08401ea1e8dc1a288391 100644 --- a/src/compute_improper.cpp +++ b/src/compute_improper.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; ComputeImproper::ComputeImproper(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - emine(NULL) + emine(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute improper command"); diff --git a/src/compute_improper_local.cpp b/src/compute_improper_local.cpp index 187ae93f5397197040f18d7df3a12a6fc957d51d..edad52050c9261cad99f92b1dfa07588b01c4f46 100644 --- a/src/compute_improper_local.cpp +++ b/src/compute_improper_local.cpp @@ -35,7 +35,7 @@ using namespace MathConst; ComputeImproperLocal::ComputeImproperLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - vlocal(NULL), alocal(NULL) + vlocal(nullptr), alocal(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute improper/local command"); @@ -57,8 +57,8 @@ ComputeImproperLocal::ComputeImproperLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -73,7 +73,7 @@ ComputeImproperLocal::~ComputeImproperLocal() void ComputeImproperLocal::init() { - if (force->improper == NULL) + if (force->improper == nullptr) error->all(FLERR,"No improper style is defined for compute improper/local"); // do initial memory allocation so that memory_usage() is correct @@ -135,7 +135,7 @@ int ComputeImproperLocal::compute_impropers(int flag) if (cflag >= 0) cbuf = vlocal; } else { if (cflag >= 0 && alocal) cbuf = &alocal[0][cflag]; - else cbuf = NULL; + else cbuf = nullptr; } } diff --git a/src/compute_inertia_chunk.cpp b/src/compute_inertia_chunk.cpp index 65de1d7bb53fee9579ac516960cf37c8e74b475e..ba7c4f36fc9ab9c05f47b070c11179873abc456c 100644 --- a/src/compute_inertia_chunk.cpp +++ b/src/compute_inertia_chunk.cpp @@ -28,8 +28,8 @@ using namespace LAMMPS_NS; ComputeInertiaChunk::ComputeInertiaChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), massproc(NULL), masstotal(NULL), com(NULL), comall(NULL), - inertia(NULL), inertiaall(NULL) + idchunk(nullptr), massproc(nullptr), masstotal(nullptr), com(nullptr), comall(nullptr), + inertia(nullptr), inertiaall(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute inertia/chunk command"); diff --git a/src/compute_ke_atom.cpp b/src/compute_ke_atom.cpp index 102d6364ffd730d66a1fd750265da4f3e4b28be3..65b3140d79a8d0a387ba70380ab63d10170b9f95 100644 --- a/src/compute_ke_atom.cpp +++ b/src/compute_ke_atom.cpp @@ -27,7 +27,7 @@ using namespace LAMMPS_NS; ComputeKEAtom::ComputeKEAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - ke(NULL) + ke(nullptr) { if (narg != 3) error->all(FLERR,"Illegal compute ke/atom command"); diff --git a/src/compute_msd.cpp b/src/compute_msd.cpp index d23c389ab6f70a3ee95cade68d696134489608dc..41ffa95fef9a1785191768b8da0545b50572f99b 100644 --- a/src/compute_msd.cpp +++ b/src/compute_msd.cpp @@ -30,7 +30,7 @@ using namespace LAMMPS_NS; ComputeMSD::ComputeMSD(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_fix(NULL) + id_fix(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute msd command"); diff --git a/src/compute_msd_chunk.cpp b/src/compute_msd_chunk.cpp index b0e2520f997e135398f3cf6fb512795287da2468..2c3c2811d2a751e1a49e36edb907947bea9e1f27 100644 --- a/src/compute_msd_chunk.cpp +++ b/src/compute_msd_chunk.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; ComputeMSDChunk::ComputeMSDChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), id_fix(NULL), massproc(NULL), masstotal(NULL), com(NULL), comall(NULL), msd(NULL) + idchunk(nullptr), id_fix(nullptr), massproc(nullptr), masstotal(nullptr), com(nullptr), comall(nullptr), msd(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute msd/chunk command"); diff --git a/src/compute_omega_chunk.cpp b/src/compute_omega_chunk.cpp index 4151b2cdb8ec2ce55e886b93d78df2b9a5fcafc8..40f13f74831623b897e2bb35b640a70225688c36 100644 --- a/src/compute_omega_chunk.cpp +++ b/src/compute_omega_chunk.cpp @@ -31,8 +31,8 @@ using namespace LAMMPS_NS; ComputeOmegaChunk::ComputeOmegaChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL),massproc(NULL),masstotal(NULL),com(NULL),comall(NULL), - inertia(NULL),inertiaall(NULL),angmom(NULL),angmomall(NULL),omega(NULL) + idchunk(nullptr),massproc(nullptr),masstotal(nullptr),com(nullptr),comall(nullptr), + inertia(nullptr),inertiaall(nullptr),angmom(nullptr),angmomall(nullptr),omega(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute omega/chunk command"); diff --git a/src/compute_orientorder_atom.cpp b/src/compute_orientorder_atom.cpp index 7323b6ef0122dfda227b5f33f1c9dd580838c85e..e76081e0b89cbe5cf3d9ca3bbeaa4bcace2f6e56 100644 --- a/src/compute_orientorder_atom.cpp +++ b/src/compute_orientorder_atom.cpp @@ -49,8 +49,8 @@ using namespace MathConst; ComputeOrientOrderAtom::ComputeOrientOrderAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - qlist(NULL), distsq(NULL), nearest(NULL), rlist(NULL), - qnarray(NULL), qnm_r(NULL), qnm_i(NULL), cglist(NULL) + qlist(nullptr), distsq(nullptr), nearest(nullptr), rlist(nullptr), + qnarray(nullptr), qnm_r(nullptr), qnm_i(nullptr), cglist(nullptr) { if (narg < 3 ) error->all(FLERR,"Illegal compute orientorder/atom command"); @@ -186,7 +186,7 @@ ComputeOrientOrderAtom::~ComputeOrientOrderAtom() void ComputeOrientOrderAtom::init() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Compute orientorder/atom requires a " "pair style be defined"); if (cutsq == 0.0) cutsq = force->pair->cutforce * force->pair->cutforce; diff --git a/src/compute_pair.cpp b/src/compute_pair.cpp index 7ace5615a782ed9c53a02e32abc99b2952f762c4..15b5bec19ac2fb07410da09ce29722b7881fc165 100644 --- a/src/compute_pair.cpp +++ b/src/compute_pair.cpp @@ -28,7 +28,7 @@ enum{EPAIR,EVDWL,ECOUL}; ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - pstyle(NULL), pair(NULL), one(NULL) + pstyle(nullptr), pair(nullptr), one(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute pair command"); @@ -82,7 +82,7 @@ ComputePair::ComputePair(LAMMPS *lmp, int narg, char **arg) : extvector = 1; one = new double[npair]; vector = new double[npair]; - } else one = vector = NULL; + } else one = vector = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_pair_local.cpp b/src/compute_pair_local.cpp index e41221f70bae072807b77088434d247886897b5e..a8fa247e4d3526f2402dcea43dc9d7e33531e961 100644 --- a/src/compute_pair_local.cpp +++ b/src/compute_pair_local.cpp @@ -37,7 +37,7 @@ enum{TYPE,RADIUS}; ComputePairLocal::ComputePairLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - pstyle(NULL), pindex(NULL), vlocal(NULL), alocal(NULL) + pstyle(nullptr), pindex(nullptr), vlocal(nullptr), alocal(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute pair/local command"); @@ -97,8 +97,8 @@ ComputePairLocal::ComputePairLocal(LAMMPS *lmp, int narg, char **arg) : else size_local_cols = nvalues; nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -115,7 +115,7 @@ ComputePairLocal::~ComputePairLocal() void ComputePairLocal::init() { - if (singleflag && force->pair == NULL) + if (singleflag && force->pair == nullptr) error->all(FLERR,"No pair style is defined for compute pair/local"); if (singleflag && force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute pair/local"); diff --git a/src/compute_pe_atom.cpp b/src/compute_pe_atom.cpp index 6bdd729502b1cb1c9c32c355527888de5349c0cc..374a3151ce49e1f798e00a184b01de6e80f91cec 100644 --- a/src/compute_pe_atom.cpp +++ b/src/compute_pe_atom.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; ComputePEAtom::ComputePEAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - energy(NULL) + energy(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute pe/atom command"); diff --git a/src/compute_pressure.cpp b/src/compute_pressure.cpp index 90e4f9b39c36b2958c3ba580d4b5bdb02edcffe6..ae1bb4747de313bab3cc11d81910fef3ac033ab1 100644 --- a/src/compute_pressure.cpp +++ b/src/compute_pressure.cpp @@ -36,7 +36,7 @@ using namespace LAMMPS_NS; ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - vptr(NULL), id_temp(NULL) + vptr(nullptr), id_temp(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute pressure command"); if (igroup) error->all(FLERR,"Compute pressure must use group all"); @@ -51,7 +51,7 @@ ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) : // store temperature ID used by pressure computation // insure it is valid for temperature computation - if (strcmp(arg[3],"NULL") == 0) id_temp = NULL; + if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr; else { int n = strlen(arg[3]) + 1; id_temp = new char[n]; @@ -130,13 +130,13 @@ ComputePressure::ComputePressure(LAMMPS *lmp, int narg, char **arg) : // error check - if (keflag && id_temp == NULL) + if (keflag && id_temp == nullptr) error->all(FLERR,"Compute pressure requires temperature ID " "to include kinetic energy"); vector = new double[size_vector]; nvirial = 0; - vptr = NULL; + vptr = nullptr; } /* ---------------------------------------------------------------------- */ @@ -185,7 +185,7 @@ void ComputePressure::init() delete [] vptr; nvirial = 0; - vptr = NULL; + vptr = nullptr; if (pairhybridflag && force->pair) nvirial++; if (pairflag && force->pair) nvirial++; @@ -221,7 +221,7 @@ void ComputePressure::init() // flag Kspace contribution separately, since not summed across procs if (kspaceflag && force->kspace) kspace_virial = force->kspace->virial; - else kspace_virial = NULL; + else kspace_virial = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/compute_property_atom.cpp b/src/compute_property_atom.cpp index 9c637edc1e49cd660aa7513f77a0c35af08c48e3..e23458d2016cf86ef84ec8c141746f356d91fe28 100644 --- a/src/compute_property_atom.cpp +++ b/src/compute_property_atom.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - index(NULL), pack_choice(NULL) + index(nullptr), pack_choice(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute property/atom command"); @@ -441,7 +441,7 @@ void ComputePropertyAtom::compute_peratom() (this->*pack_choice[0])(0); } else { if (nmax) buf = &array_atom[0][0]; - else buf = NULL; + else buf = nullptr; for (int n = 0; n < nvalues; n++) (this->*pack_choice[n])(n); } diff --git a/src/compute_property_chunk.cpp b/src/compute_property_chunk.cpp index c27cfc4096fa3c8a0a8a8745d53638d570beed43..ad21e802965cc469976ad6b07cebd30ec90bf105 100644 --- a/src/compute_property_chunk.cpp +++ b/src/compute_property_chunk.cpp @@ -27,7 +27,7 @@ using namespace LAMMPS_NS; ComputePropertyChunk::ComputePropertyChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), count_one(NULL), count_all(NULL) + idchunk(nullptr), count_one(nullptr), count_all(nullptr) { if (narg < 5) error->all(FLERR,"Illegal compute property/chunk command"); diff --git a/src/compute_property_local.cpp b/src/compute_property_local.cpp index 7cdc27000c5c726e20d8f05c0f9c04c696c4d973..36940164aac8938e2d2b7b7e41a255a55f3b7854 100644 --- a/src/compute_property_local.cpp +++ b/src/compute_property_local.cpp @@ -35,7 +35,7 @@ enum{TYPE,RADIUS}; ComputePropertyLocal::ComputePropertyLocal(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - vlocal(NULL), alocal(NULL), indices(NULL), pack_choice(NULL) + vlocal(nullptr), alocal(nullptr), indices(nullptr), pack_choice(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute property/local command"); @@ -254,8 +254,8 @@ ComputePropertyLocal::ComputePropertyLocal(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Compute property/local requires atom attribute radius"); nmax = 0; - vlocal = NULL; - alocal = NULL; + vlocal = nullptr; + alocal = nullptr; } /* ---------------------------------------------------------------------- */ @@ -273,7 +273,7 @@ ComputePropertyLocal::~ComputePropertyLocal() void ComputePropertyLocal::init() { if (kindflag == NEIGH || kindflag == PAIR) { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"No pair style is defined for compute property/local"); if (force->pair->single_enable == 0) error->all(FLERR,"Pair style does not support compute property/local"); diff --git a/src/compute_rdf.cpp b/src/compute_rdf.cpp index a28223b3a7cbe5e3978d5cfa43bb1049b5bbb38b..f4d553d2db979362313b2dc026680a77adbaefd5 100644 --- a/src/compute_rdf.cpp +++ b/src/compute_rdf.cpp @@ -41,9 +41,9 @@ using namespace MathConst; ComputeRDF::ComputeRDF(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - rdfpair(NULL), nrdfpair(NULL), ilo(NULL), ihi(NULL), jlo(NULL), jhi(NULL), - hist(NULL), histall(NULL), typecount(NULL), icount(NULL), jcount(NULL), - duplicates(NULL) + rdfpair(nullptr), nrdfpair(nullptr), ilo(nullptr), ihi(nullptr), jlo(nullptr), jhi(nullptr), + hist(nullptr), histall(nullptr), typecount(nullptr), icount(nullptr), jcount(nullptr), + duplicates(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute rdf command"); diff --git a/src/compute_reduce.cpp b/src/compute_reduce.cpp index b024b4365ca0a995dcded0e463e440a140930e25..66af301e48f1c99da7f240fec3ba1196559bf394 100644 --- a/src/compute_reduce.cpp +++ b/src/compute_reduce.cpp @@ -44,14 +44,14 @@ enum{PERATOM,LOCAL}; ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), flavor(NULL), - value2index(NULL), ids(NULL), onevec(NULL), replace(NULL), indices(NULL), - owner(NULL), idregion(NULL), varatom(NULL) + nvalues(0), which(nullptr), argindex(nullptr), flavor(nullptr), + value2index(nullptr), ids(nullptr), onevec(nullptr), replace(nullptr), indices(nullptr), + owner(nullptr), idregion(nullptr), varatom(nullptr) { int iarg = 0; if (strcmp(style,"reduce") == 0) { if (narg < 5) error->all(FLERR,"Illegal compute reduce command"); - idregion = NULL; + idregion = nullptr; iarg = 3; } else if (strcmp(style,"reduce/region") == 0) { if (narg < 6) error->all(FLERR,"Illegal compute reduce/region command"); @@ -93,13 +93,13 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : value2index = new int[nargnew]; for (int i=0; i < nargnew; ++i) { which[i] = argindex[i] = flavor[i] = value2index[i] = UNKNOWN; - ids[i] = NULL; + ids[i] = nullptr; } nvalues = 0; iarg = 0; while (iarg < nargnew) { - ids[nvalues] = NULL; + ids[nvalues] = nullptr; if (strcmp(arg[iarg],"x") == 0) { which[nvalues] = X; @@ -190,7 +190,7 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : if (replace[i] >= 0) flag = 1; if (!flag) { delete [] replace; - replace = NULL; + replace = nullptr; } // if wildcard expansion occurred, free earg memory from expand_args() @@ -285,8 +285,8 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : scalar_flag = 1; if (mode == SUM || mode == SUMSQ) extscalar = 1; else extscalar = 0; - vector = onevec = NULL; - indices = owner = NULL; + vector = onevec = nullptr; + indices = owner = nullptr; } else { vector_flag = 1; size_vector = nvalues; @@ -299,7 +299,7 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : } maxatom = 0; - varatom = NULL; + varatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_reduce_chunk.cpp b/src/compute_reduce_chunk.cpp index 6e8aa48410e67bcad5fd19842a0f845f0bc9fc5a..fbcf82619fbc24297988f23a2807d8f16b1a8cfe 100644 --- a/src/compute_reduce_chunk.cpp +++ b/src/compute_reduce_chunk.cpp @@ -40,8 +40,8 @@ enum{UNKNOWN=-1,COMPUTE,FIX,VARIABLE}; ComputeReduceChunk::ComputeReduceChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - which(NULL), argindex(NULL), value2index(NULL), idchunk(NULL), ids(NULL), - vlocal(NULL), vglobal(NULL), alocal(NULL), aglobal(NULL), varatom(NULL) + which(nullptr), argindex(nullptr), value2index(nullptr), idchunk(nullptr), ids(nullptr), + vlocal(nullptr), vglobal(nullptr), alocal(nullptr), aglobal(nullptr), varatom(nullptr) { if (narg < 6) error->all(FLERR,"Illegal compute reduce/chunk command"); @@ -78,13 +78,13 @@ ComputeReduceChunk::ComputeReduceChunk(LAMMPS *lmp, int narg, char **arg) : value2index = new int[nargnew]; for (int i=0; i < nargnew; ++i) { which[i] = argindex[i] = value2index[i] = UNKNOWN; - ids[i] = NULL; + ids[i] = nullptr; } nvalues = 0; iarg = 0; while (iarg < nargnew) { - ids[nvalues] = NULL; + ids[nvalues] = nullptr; if (strncmp(arg[iarg],"c_",2) == 0 || strncmp(arg[iarg],"f_",2) == 0 || @@ -193,11 +193,11 @@ ComputeReduceChunk::ComputeReduceChunk(LAMMPS *lmp, int narg, char **arg) : else if (mode == MAXX) initvalue = -BIG; maxchunk = 0; - vlocal = vglobal = NULL; - alocal = aglobal = NULL; + vlocal = vglobal = nullptr; + alocal = aglobal = nullptr; maxatom = 0; - varatom = NULL; + varatom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/compute_slice.cpp b/src/compute_slice.cpp index ca4b735d6e757c69284d0b230e891b54b5bdbf6a..036a9bb2890d5d29a18612190c5a8e1d31ef1fb0 100644 --- a/src/compute_slice.cpp +++ b/src/compute_slice.cpp @@ -34,7 +34,7 @@ enum{COMPUTE,FIX,VARIABLE}; ComputeSlice::ComputeSlice(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), ids(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), ids(nullptr) { if (narg < 7) error->all(FLERR,"Illegal compute slice command"); diff --git a/src/compute_stress_atom.cpp b/src/compute_stress_atom.cpp index 9c65ee86c25b6a977a1746e88bffc24b85ff5aed..279d2af07c86f0d42fcfe48b3f233d03d5a404cb 100644 --- a/src/compute_stress_atom.cpp +++ b/src/compute_stress_atom.cpp @@ -36,7 +36,7 @@ enum{NOBIAS,BIAS}; ComputeStressAtom::ComputeStressAtom(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_temp(NULL), stress(NULL) + id_temp(nullptr), stress(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute stress/atom command"); @@ -49,7 +49,7 @@ ComputeStressAtom::ComputeStressAtom(LAMMPS *lmp, int narg, char **arg) : // store temperature ID used by stress computation // insure it is valid for temperature computation - if (strcmp(arg[3],"NULL") == 0) id_temp = NULL; + if (strcmp(arg[3],"NULL") == 0) id_temp = nullptr; else { int n = strlen(arg[3]) + 1; id_temp = new char[n]; @@ -213,7 +213,7 @@ void ComputeStressAtom::compute_peratom() } // add in per-atom contributions from relevant fixes - // skip if vatom = NULL + // skip if vatom = nullptr // possible during setup phase if fix has not initialized its vatom yet // e.g. fix ave/spatial defined before fix shake, // and fix ave/spatial uses a per-atom stress from this compute as input diff --git a/src/compute_temp_chunk.cpp b/src/compute_temp_chunk.cpp index 54f052900626d8e3d2a51b93cbfbde40b8c14481..f3110cfeca519ffcb1be3a1e25b6710768a7cdda 100644 --- a/src/compute_temp_chunk.cpp +++ b/src/compute_temp_chunk.cpp @@ -31,8 +31,8 @@ enum{TEMP,KECOM,INTERNAL}; ComputeTempChunk::ComputeTempChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - which(NULL), idchunk(NULL), id_bias(NULL), sum(NULL), sumall(NULL), count(NULL), - countall(NULL), massproc(NULL), masstotal(NULL), vcm(NULL), vcmall(NULL) + which(nullptr), idchunk(nullptr), id_bias(nullptr), sum(nullptr), sumall(nullptr), count(nullptr), + countall(nullptr), massproc(nullptr), masstotal(nullptr), vcm(nullptr), vcmall(nullptr) { if (narg < 4) error->all(FLERR,"Illegal compute temp/chunk command"); @@ -71,7 +71,7 @@ ComputeTempChunk::ComputeTempChunk(LAMMPS *lmp, int narg, char **arg) : comflag = 0; biasflag = 0; - id_bias = NULL; + id_bias = nullptr; adof = domain->dimension; cdof = 0.0; diff --git a/src/compute_temp_deform.cpp b/src/compute_temp_deform.cpp index b50962a2c6e3b8ab01810f3a6549032653e80967..75b784c858501a4a6c215e37a55fbdeaa7d46d50 100644 --- a/src/compute_temp_deform.cpp +++ b/src/compute_temp_deform.cpp @@ -47,7 +47,7 @@ ComputeTempDeform::ComputeTempDeform(LAMMPS *lmp, int narg, char **arg) : tempbias = 1; maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/compute_temp_partial.cpp b/src/compute_temp_partial.cpp index 85e51d2a5d6203ffaee67cd3d6c579d0b7dc3996..5ce62dfeb24529ec4b8866d2f2e185c00bc10564 100644 --- a/src/compute_temp_partial.cpp +++ b/src/compute_temp_partial.cpp @@ -47,7 +47,7 @@ ComputeTempPartial::ComputeTempPartial(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR,"Compute temp/partial cannot use vz for 2d systemx"); maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/compute_temp_profile.cpp b/src/compute_temp_profile.cpp index eacca87e19b489f62ee649b4a87f49e7484f5aa0..0344880e134bdf968d7dc25d6de5423cdadbc238 100644 --- a/src/compute_temp_profile.cpp +++ b/src/compute_temp_profile.cpp @@ -30,7 +30,7 @@ enum{TENSOR,BIN}; ComputeTempProfile::ComputeTempProfile(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - bin(NULL), vbin(NULL), binave(NULL), tbin(NULL), tbinall(NULL) + bin(nullptr), vbin(nullptr), binave(nullptr), tbin(nullptr), tbinall(nullptr) { if (narg < 7) error->all(FLERR,"Illegal compute temp/profile command"); diff --git a/src/compute_temp_ramp.cpp b/src/compute_temp_ramp.cpp index 3874c1f286f07f4c967554ba71d97bd2fd967a0b..17509b85a058b022672187418e7ce6e600579daf 100644 --- a/src/compute_temp_ramp.cpp +++ b/src/compute_temp_ramp.cpp @@ -98,7 +98,7 @@ ComputeTempRamp::ComputeTempRamp(LAMMPS *lmp, int narg, char **arg) : } maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/compute_temp_region.cpp b/src/compute_temp_region.cpp index 74955da421eb435977d5ff4a15e046387a528491..8a8d671dfd5d93048c44d092152a67d28c9874fe 100644 --- a/src/compute_temp_region.cpp +++ b/src/compute_temp_region.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; ComputeTempRegion::ComputeTempRegion(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idregion(NULL) + idregion(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute temp/region command"); @@ -48,7 +48,7 @@ ComputeTempRegion::ComputeTempRegion(LAMMPS *lmp, int narg, char **arg) : tempbias = 1; maxbias = 0; - vbiasall = NULL; + vbiasall = nullptr; vector = new double[size_vector]; } diff --git a/src/compute_temp_sphere.cpp b/src/compute_temp_sphere.cpp index 6ef3038d68a3c8dadfcdd35514220d93840da7d4..42dc790a3aab197026d8c74badb4b9c6de4a6a7f 100644 --- a/src/compute_temp_sphere.cpp +++ b/src/compute_temp_sphere.cpp @@ -32,7 +32,7 @@ enum{ROTATE,ALL}; ComputeTempSphere::ComputeTempSphere(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_bias(NULL) + id_bias(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute temp/sphere command"); diff --git a/src/compute_torque_chunk.cpp b/src/compute_torque_chunk.cpp index c0b648418b7d46af8701951edcf5ba0a44f60bd7..df25591450939a2e5b1237504dee902e025bc749 100644 --- a/src/compute_torque_chunk.cpp +++ b/src/compute_torque_chunk.cpp @@ -28,7 +28,7 @@ using namespace LAMMPS_NS; ComputeTorqueChunk::ComputeTorqueChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), massproc(NULL), masstotal(NULL), com(NULL), comall(NULL), torque(NULL), torqueall(NULL) + idchunk(nullptr), massproc(nullptr), masstotal(nullptr), com(nullptr), comall(nullptr), torque(nullptr), torqueall(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute torque/chunk command"); diff --git a/src/compute_vacf.cpp b/src/compute_vacf.cpp index 635c3e416108ae8559da869d1e2e73e216b52840..a34c4bac8e7e64036cdda64c453c99751405cc9a 100644 --- a/src/compute_vacf.cpp +++ b/src/compute_vacf.cpp @@ -29,7 +29,7 @@ using namespace LAMMPS_NS; ComputeVACF::ComputeVACF(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - id_fix(NULL) + id_fix(nullptr) { if (narg < 3) error->all(FLERR,"Illegal compute vacf command"); diff --git a/src/compute_vcm_chunk.cpp b/src/compute_vcm_chunk.cpp index 6651110e77ee0ca1bd168d3ce639aa6d7cdd1b11..7edab91d54efbd93505368fc884386ffd4c8aab3 100644 --- a/src/compute_vcm_chunk.cpp +++ b/src/compute_vcm_chunk.cpp @@ -29,7 +29,7 @@ enum{ONCE,NFREQ,EVERY}; ComputeVCMChunk::ComputeVCMChunk(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), - idchunk(NULL), massproc(NULL), masstotal(NULL), vcm(NULL), vcmall(NULL) + idchunk(nullptr), massproc(nullptr), masstotal(nullptr), vcm(nullptr), vcmall(nullptr) { if (narg != 4) error->all(FLERR,"Illegal compute vcm/chunk command"); diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index ca90cc69961d87f39d718c203b09dc1aae80b2b2..a22273f0e2231f4ee37b1d0d238cd39dc5d7a6d7 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -130,7 +130,7 @@ void CreateAtoms::command(int narg, char **arg) mode = ATOM; int molseed; varflag = 0; - vstr = xstr = ystr = zstr = NULL; + vstr = xstr = ystr = zstr = nullptr; quatone[0] = quatone[1] = quatone[2] = 0.0; subsetflag = NONE; int subsetseed; @@ -245,7 +245,7 @@ void CreateAtoms::command(int narg, char **arg) // error check and further setup for mode = MOLECULE - ranmol = NULL; + ranmol = nullptr; if (mode == MOLECULE) { if (onemol->xflag == 0) error->all(FLERR,"Create_atoms molecule must have coordinates"); @@ -267,7 +267,7 @@ void CreateAtoms::command(int narg, char **arg) ranmol = new RanMars(lmp,molseed+me); } - ranlatt = NULL; + ranlatt = nullptr; if (subsetflag != NONE) ranlatt = new RanMars(lmp,subsetseed+me); // error check and further setup for variable test diff --git a/src/create_atoms.h b/src/create_atoms.h index 87d15d00bd51e7587ba4c044190d9f7eebf20e72..5508752f001e0dbb2ed01afc4506a5055482b635 100644 --- a/src/create_atoms.h +++ b/src/create_atoms.h @@ -62,7 +62,7 @@ class CreateAtoms : protected Pointers { void add_random(); void add_lattice(); void loop_lattice(int); - void add_molecule(double *, double * = NULL); + void add_molecule(double *, double * = nullptr); int vartest(double *); // evaluate a variable with new atom position }; diff --git a/src/create_bonds.cpp b/src/create_bonds.cpp index 9e3eb65801a8ea86d3c4e99f4ed11b6a2b4e8247..7bface4d0211e74a1d09a52ecb6b82b4f7e9e79c 100644 --- a/src/create_bonds.cpp +++ b/src/create_bonds.cpp @@ -197,14 +197,14 @@ void CreateBonds::many() // error check on cutoff // if no pair style, neighbor list will be empty - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Create_bonds requires a pair style be defined"); if (rmax > neighbor->cutneighmax) error->all(FLERR,"Create_bonds max distance > neighbor cutoff"); if (rmax > neighbor->cutneighmin && comm->me == 0) error->warning(FLERR,"Create_bonds max distance > minimum neighbor cutoff"); - // require special_bonds 1-2 weights = 0.0 and KSpace = NULL + // require special_bonds 1-2 weights = 0.0 and KSpace = nullptr // so that already bonded atom pairs do not appear in neighbor list // otherwise with newton_bond = 1, // would be hard to check if I-J bond already existed diff --git a/src/delete_atoms.cpp b/src/delete_atoms.cpp index 53d78602dca43ab37fb38f5e1b0a4ded4f56e86a..153e0c3bd7dbb866f4f1b6ec73a97101fcac7b15 100644 --- a/src/delete_atoms.cpp +++ b/src/delete_atoms.cpp @@ -299,7 +299,7 @@ void DeleteAtoms::delete_overlap(int narg, char **arg) // error check on cutoff // if no pair style, neighbor list will be empty - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Delete_atoms requires a pair style be defined"); if (cut > neighbor->cutneighmax) error->all(FLERR,"Delete_atoms cutoff > max neighbor cutoff"); @@ -476,7 +476,7 @@ void DeleteAtoms::delete_bond() for (int i = 0; i < nlocal; i++) if (dlist[i]) list[n++] = tag[i]; - comm->ring(n,sizeof(tagint),list,1,bondring,NULL,(void *)this); + comm->ring(n,sizeof(tagint),list,1,bondring,nullptr,(void *)this); delete hash; memory->destroy(list); @@ -514,7 +514,7 @@ void DeleteAtoms::delete_molecule() std::map::iterator pos; for (pos = hash->begin(); pos != hash->end(); ++pos) list[n++] = pos->first; - comm->ring(n,sizeof(tagint),list,1,molring,NULL,(void *)this); + comm->ring(n,sizeof(tagint),list,1,molring,nullptr,(void *)this); delete hash; memory->destroy(list); diff --git a/src/delete_bonds.cpp b/src/delete_bonds.cpp index b8ec5f78835860ab76da1bc77a18a1878882a5f2..4b68a461f18b70d642c16760d67c57876b6be1a5 100644 --- a/src/delete_bonds.cpp +++ b/src/delete_bonds.cpp @@ -75,7 +75,7 @@ void DeleteBonds::command(int narg, char **arg) // use utils::bounds(FLERR,) to allow setting of range of types // range can be 0 to ntypes inclusive - int *tlist = NULL; + int *tlist = nullptr; int iarg = 2; if (style != MULTI && style != STATS) { diff --git a/src/dihedral.cpp b/src/dihedral.cpp index ac2d432cfb8a231e830f503ed9d86b7d34519553..f75b89139f608f734402b0e7292dcbae92dff9f9 100644 --- a/src/dihedral.cpp +++ b/src/dihedral.cpp @@ -36,10 +36,10 @@ Dihedral::Dihedral(LAMMPS *lmp) : Pointers(lmp) suffix_flag = Suffix::NONE; maxeatom = maxvatom = maxcvatom = 0; - eatom = NULL; - vatom = NULL; - cvatom = NULL; - setflag = NULL; + eatom = nullptr; + vatom = nullptr; + cvatom = nullptr; + setflag = nullptr; execution_space = Host; datamask_read = ALL_MASK; diff --git a/src/dihedral_hybrid.cpp b/src/dihedral_hybrid.cpp index 61e0fdc72af23931dd14dd01b4b18193e808a885..83feb2f841af911a9e7dbd91345498c0ea01cdb9 100644 --- a/src/dihedral_hybrid.cpp +++ b/src/dihedral_hybrid.cpp @@ -161,7 +161,7 @@ void DihedralHybrid::allocate() maxdihedral = new int[nstyles]; dihedrallist = new int**[nstyles]; for (int m = 0; m < nstyles; m++) maxdihedral[m] = 0; - for (int m = 0; m < nstyles; m++) dihedrallist[m] = NULL; + for (int m = 0; m < nstyles; m++) dihedrallist[m] = nullptr; } /* ---------------------------------------------------------------------- @@ -329,7 +329,7 @@ void DihedralHybrid::write_restart(FILE *fp) void DihedralHybrid::read_restart(FILE *fp) { int me = comm->me; - if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nstyles,1,MPI_INT,0,world); styles = new Dihedral*[nstyles]; keywords = new char*[nstyles]; @@ -338,10 +338,10 @@ void DihedralHybrid::read_restart(FILE *fp) int n,dummy; for (int m = 0; m < nstyles; m++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); keywords[m] = new char[n]; - if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,nullptr,error); MPI_Bcast(keywords[m],n,MPI_CHAR,0,world); styles[m] = force->new_dihedral(keywords[m],0,dummy); styles[m]->read_restart_settings(fp); diff --git a/src/displace_atoms.cpp b/src/displace_atoms.cpp index 018288d470ad1b59bba622599e0073a5ca68ccde..4f8495699173fbc186f36dac959c7011a336d3a1 100644 --- a/src/displace_atoms.cpp +++ b/src/displace_atoms.cpp @@ -44,7 +44,7 @@ enum{MOVE,RAMP,RANDOM,ROTATE}; DisplaceAtoms::DisplaceAtoms(LAMMPS *lmp) : Pointers(lmp) { - mvec = NULL; + mvec = nullptr; } /* ---------------------------------------------------------------------- */ @@ -313,7 +313,7 @@ void DisplaceAtoms::command(int narg, char **arg) // quats for ellipsoids, tris, and bodies if (quat_flag) { - quat = NULL; + quat = nullptr; if (ellipsoid_flag && ellipsoid[i] >= 0) quat = avec_ellipsoid->bonus[ellipsoid[i]].quat; else if (tri_flag && tri[i] >= 0) @@ -384,7 +384,7 @@ void DisplaceAtoms::move(int idim, char *arg, double scale) for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) x[i][idim] += delta; } else if (input->variable->atomstyle(ivar)) { - if (mvec == NULL) memory->create(mvec,nlocal,"displace_atoms:mvec"); + if (mvec == nullptr) memory->create(mvec,nlocal,"displace_atoms:mvec"); input->variable->compute_atom(ivar,igroup,mvec,1,0); for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) x[i][idim] += scale*mvec[i]; diff --git a/src/domain.cpp b/src/domain.cpp index 759f5d74a55a866299482303a0efa6aa108a53df..b7254958287b288ff39993f6973b51eb8639afe8 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -89,7 +89,7 @@ Domain::Domain(LAMMPS *lmp) : Pointers(lmp) boxlo_lamda[0] = boxlo_lamda[1] = boxlo_lamda[2] = 0.0; boxhi_lamda[0] = boxhi_lamda[1] = boxhi_lamda[2] = 1.0; - lattice = NULL; + lattice = nullptr; char **args = new char*[2]; args[0] = (char *) "none"; args[1] = (char *) "1.0"; @@ -97,7 +97,7 @@ Domain::Domain(LAMMPS *lmp) : Pointers(lmp) delete [] args; nregion = maxregion = 0; - regions = NULL; + regions = nullptr; copymode = 0; @@ -1640,7 +1640,7 @@ void Domain::image_flip(int m, int n, int p) return 1 if this proc owns atom with coords x, else return 0 x is returned remapped into periodic box if image flag is passed, flag is updated via remap(x,image) - if image = NULL is passed, no update with remap(x) + if image = nullptr is passed, no update with remap(x) if shrinkexceed, atom can be outside shrinkwrap boundaries called from create_atoms() in library.cpp ------------------------------------------------------------------------- */ @@ -1727,7 +1727,7 @@ int Domain::ownatom(int /*id*/, double *x, imageint *image, int shrinkexceed) void Domain::set_lattice(int narg, char **arg) { if (lattice) delete lattice; - lattice = NULL; + lattice = nullptr; lattice = new Lattice(lmp,narg,arg); } diff --git a/src/dump.cpp b/src/dump.cpp index b4584ffd64eaf64abc7ddd772d7d6cce9eb0f9d8..23b8173f091fbf33fe76eb559154427b25854bd4 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -66,17 +66,17 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) first_flag = 0; flush_flag = 1; - format = NULL; - format_default = NULL; + format = nullptr; + format_default = nullptr; - format_line_user = NULL; - format_float_user = NULL; - format_int_user = NULL; - format_bigint_user = NULL; - format_column_user = NULL; + format_line_user = nullptr; + format_float_user = nullptr; + format_int_user = nullptr; + format_bigint_user = nullptr; + format_column_user = nullptr; refreshflag = 0; - refresh = NULL; + refresh = nullptr; clearstep = 0; sort_flag = 0; @@ -93,20 +93,20 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) maxfiles = -1; numfiles = 0; fileidx = 0; - nameslist = NULL; + nameslist = nullptr; maxbuf = maxids = maxsort = maxproc = 0; - buf = bufsort = NULL; - ids = idsort = NULL; - index = proclist = NULL; - irregular = NULL; + buf = bufsort = nullptr; + ids = idsort = nullptr; + index = proclist = nullptr; + irregular = nullptr; maxsbuf = 0; - sbuf = NULL; + sbuf = nullptr; maxpbc = 0; - xpbc = vpbc = NULL; - imagepbc = NULL; + xpbc = vpbc = nullptr; + imagepbc = nullptr; // parse filename for special syntax // if contains '%', write one file per proc and replace % with proc-ID @@ -117,7 +117,7 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) // else if ends in .zst = Zstd compressed text file // else ASCII text file - fp = NULL; + fp = nullptr; singlefile_opened = 0; compressed = 0; binary = 0; @@ -128,7 +128,7 @@ Dump::Dump(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp) filewriter = 0; if (me == 0) filewriter = 1; fileproc = 0; - multiname = NULL; + multiname = nullptr; char *ptr; if ((ptr = strchr(filename,'%'))) { @@ -202,15 +202,15 @@ Dump::~Dump() delete[] nameslist; } - // XTC style sets fp to NULL since it closes file in its destructor + // XTC style sets fp to a null pointer since it closes file in its destructor - if (multifile == 0 && fp != NULL) { + if (multifile == 0 && fp != nullptr) { if (compressed) { if (filewriter) pclose(fp); } else { if (filewriter) fclose(fp); } - fp = NULL; + fp = nullptr; } } @@ -229,10 +229,10 @@ void Dump::init() delete irregular; maxids = maxsort = maxproc = 0; - bufsort = NULL; - ids = idsort = NULL; - index = proclist = NULL; - irregular = NULL; + bufsort = nullptr; + ids = idsort = nullptr; + index = proclist = nullptr; + irregular = nullptr; } if (sort_flag) { @@ -243,7 +243,7 @@ void Dump::init() error->all(FLERR,"Cannot dump sort on atom IDs with no atom IDs defined"); if (sortcol && sortcol > size_one) error->all(FLERR,"Dump sort column is invalid"); - if (nprocs > 1 && irregular == NULL) + if (nprocs > 1 && irregular == nullptr) irregular = new Irregular(lmp); bigint size = group->count(igroup); @@ -438,7 +438,7 @@ void Dump::write() // sort buf as needed if (sort_flag && sortcol == 0) pack(ids); - else pack(NULL); + else pack(nullptr); if (sort_flag) sort(); // if buffering, convert doubles into strings @@ -528,11 +528,11 @@ void Dump::write() if (multifile) { if (compressed) { - if (filewriter && fp != NULL) pclose(fp); + if (filewriter && fp != nullptr) pclose(fp); } else { - if (filewriter && fp != NULL) fclose(fp); + if (filewriter && fp != nullptr) fclose(fp); } - fp = NULL; + fp = nullptr; } } @@ -609,8 +609,8 @@ void Dump::openfile() fp = fopen(filecurrent,"w"); } - if (fp == NULL) error->one(FLERR,"Cannot open dump file"); - } else fp = NULL; + if (fp == nullptr) error->one(FLERR,"Cannot open dump file"); + } else fp = nullptr; // delete string with timestep replaced @@ -1013,10 +1013,10 @@ void Dump::modify_params(int narg, char **arg) delete [] format_int_user; delete [] format_bigint_user; delete [] format_float_user; - format_line_user = NULL; - format_int_user = NULL; - format_bigint_user = NULL; - format_float_user = NULL; + format_line_user = nullptr; + format_int_user = nullptr; + format_bigint_user = nullptr; + format_float_user = nullptr; // pass format none to child classes which may use it // not an error if they don't modify_param(narg-iarg,&arg[iarg]); @@ -1055,7 +1055,7 @@ void Dump::modify_params(int narg, char **arg) nameslist = new char*[maxfiles]; numfiles = 0; for (int idx=0; idx < maxfiles; ++idx) - nameslist[idx] = NULL; + nameslist[idx] = nullptr; fileidx = 0; } iarg += 2; diff --git a/src/dump_atom.cpp b/src/dump_atom.cpp index a68e950597a6a31c20f40efcf5092ee91b047a21..f8d02904fa6945566d75fdb2687227beaac69ca8 100644 --- a/src/dump_atom.cpp +++ b/src/dump_atom.cpp @@ -34,7 +34,7 @@ DumpAtom::DumpAtom(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg) image_flag = 0; buffer_allow = 1; buffer_flag = 1; - format_default = NULL; + format_default = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/dump_cfg.cpp b/src/dump_cfg.cpp index da9740d9ca7f7f2056546c28a2fd31dfd819d475..ffff1e85c75ff7a172923d3230701e7ecbbdd680 100644 --- a/src/dump_cfg.cpp +++ b/src/dump_cfg.cpp @@ -32,7 +32,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ DumpCFG::DumpCFG(LAMMPS *lmp, int narg, char **arg) : - DumpCustom(lmp, narg, arg), auxname(NULL) + DumpCustom(lmp, narg, arg), auxname(nullptr) { multifile_override = 0; @@ -63,7 +63,7 @@ DumpCFG::DumpCFG(LAMMPS *lmp, int narg, char **arg) : // convert 'X_ID[m]' (X=c,f,v) to 'X_ID_m' if (nfield > 5) auxname = new char*[nfield]; - else auxname = NULL; + else auxname = nullptr; int i = 0; for (int iarg = 5; iarg < nfield; iarg++, i++) { diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 66d9d52170831f208d4eb36b0298699a427db9ef..cf034b0450ad4f5188bfebdd92e7440e4bc0faad 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -53,13 +53,13 @@ enum{LT,LE,GT,GE,EQ,NEQ,XOR}; DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), - idregion(NULL), thresh_array(NULL), thresh_op(NULL), thresh_value(NULL), - thresh_last(NULL), thresh_fix(NULL), thresh_fixID(NULL), thresh_first(NULL), - earg(NULL), vtype(NULL), vformat(NULL), columns(NULL), choose(NULL), - dchoose(NULL), clist(NULL), field2index(NULL), argindex(NULL), id_compute(NULL), - compute(NULL), id_fix(NULL), fix(NULL), id_variable(NULL), variable(NULL), - vbuf(NULL), id_custom(NULL), flag_custom(NULL), typenames(NULL), - pack_choice(NULL) + idregion(nullptr), thresh_array(nullptr), thresh_op(nullptr), thresh_value(nullptr), + thresh_last(nullptr), thresh_fix(nullptr), thresh_fixID(nullptr), thresh_first(nullptr), + earg(nullptr), vtype(nullptr), vformat(nullptr), columns(nullptr), choose(nullptr), + dchoose(nullptr), clist(nullptr), field2index(nullptr), argindex(nullptr), id_compute(nullptr), + compute(nullptr), id_fix(nullptr), fix(nullptr), id_variable(nullptr), variable(nullptr), + vbuf(nullptr), id_custom(nullptr), flag_custom(nullptr), typenames(nullptr), + pack_choice(nullptr) { if (narg == 5) error->all(FLERR,"No dump custom arguments specified"); @@ -87,37 +87,37 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : buffer_allow = 1; buffer_flag = 1; iregion = -1; - idregion = NULL; + idregion = nullptr; nthresh = 0; - thresh_array = NULL; - thresh_op = NULL; - thresh_value = NULL; - thresh_last = NULL; + thresh_array = nullptr; + thresh_op = nullptr; + thresh_value = nullptr; + thresh_last = nullptr; nthreshlast = 0; - thresh_fix = NULL; - thresh_fixID = NULL; - thresh_first = NULL; + thresh_fix = nullptr; + thresh_fixID = nullptr; + thresh_first = nullptr; // computes, fixes, variables which the dump accesses ncompute = 0; - id_compute = NULL; - compute = NULL; + id_compute = nullptr; + compute = nullptr; nfix = 0; - id_fix = NULL; - fix = NULL; + id_fix = nullptr; + fix = nullptr; nvariable = 0; - id_variable = NULL; - variable = NULL; - vbuf = NULL; + id_variable = nullptr; + variable = nullptr; + vbuf = nullptr; ncustom = 0; - id_custom = NULL; - flag_custom = NULL; + id_custom = nullptr; + flag_custom = nullptr; // process attributes // ioptional = start of additional optional args in expanded args @@ -142,9 +142,9 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : // atom selection arrays maxlocal = 0; - choose = NULL; - dchoose = NULL; - clist = NULL; + choose = nullptr; + dchoose = nullptr; + clist = nullptr; // default element name for all types = C @@ -167,11 +167,11 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) : else if (vtype[i] == Dump::DOUBLE) strcat(format_default,"%g "); else if (vtype[i] == Dump::STRING) strcat(format_default,"%s "); else if (vtype[i] == Dump::BIGINT) strcat(format_default,BIGINT_FORMAT " "); - vformat[i] = NULL; + vformat[i] = nullptr; } format_column_user = new char*[size_one]; - for (int i = 0; i < size_one; i++) format_column_user[i] = NULL; + for (int i = 0; i < size_one; i++) format_column_user[i] = nullptr; // setup column string @@ -279,8 +279,8 @@ void DumpCustom::init_style() char *ptr; for (int i = 0; i < size_one; i++) { if (i == 0) ptr = strtok(format," \0"); - else ptr = strtok(NULL," \0"); - if (ptr == NULL) error->all(FLERR,"Dump_modify format line is too short"); + else ptr = strtok(nullptr," \0"); + if (ptr == nullptr) error->all(FLERR,"Dump_modify format line is too short"); delete [] vformat[i]; if (format_column_user[i]) { @@ -1648,7 +1648,7 @@ int DumpCustom::add_variable(char *id) variable = new int[nvariable+1]; delete [] vbuf; vbuf = new double*[nvariable+1]; - for (int i = 0; i <= nvariable; i++) vbuf[i] = NULL; + for (int i = 0; i <= nvariable; i++) vbuf[i] = nullptr; int n = strlen(id) + 1; id_variable[nvariable] = new char[n]; @@ -1711,7 +1711,7 @@ int DumpCustom::modify_param(int narg, char **arg) // just clear format_column_user allocated by this dump child class for (int i = 0; i < size_one; i++) { delete [] format_column_user[i]; - format_column_user[i] = NULL; + format_column_user[i] = nullptr; } return 2; } @@ -1729,7 +1729,7 @@ int DumpCustom::modify_param(int narg, char **arg) // replace "d" in format_int_user with bigint format specifier // use of &str[1] removes leading '%' from BIGINT_FORMAT string char *ptr = strchr(format_int_user,'d'); - if (ptr == NULL) + if (ptr == nullptr) error->all(FLERR, "Dump_modify int format does not contain d character"); char str[8]; @@ -1791,17 +1791,17 @@ int DumpCustom::modify_param(int narg, char **arg) memory->destroy(thresh_array); memory->destroy(thresh_op); memory->destroy(thresh_value); - thresh_array = NULL; - thresh_op = NULL; - thresh_value = NULL; - thresh_last = NULL; + thresh_array = nullptr; + thresh_op = nullptr; + thresh_value = nullptr; + thresh_last = nullptr; for (int i = 0; i < nthreshlast; i++) { modify->delete_fix(thresh_fixID[i]); delete [] thresh_fixID[i]; } - thresh_fix = NULL; - thresh_fixID = NULL; - thresh_first = NULL; + thresh_fix = nullptr; + thresh_fixID = nullptr; + thresh_first = nullptr; } nthresh = nthreshlast = 0; return 2; diff --git a/src/dump_dcd.cpp b/src/dump_dcd.cpp index bb73d8975b92f6e1018237b40f09a10f54a97f4d..e1c57f2b7113ceb730e803f1b182c0cb3c723dc0 100644 --- a/src/dump_dcd.cpp +++ b/src/dump_dcd.cpp @@ -51,7 +51,7 @@ static inline void fwrite_int32(FILE* fd, uint32_t i) /* ---------------------------------------------------------------------- */ DumpDCD::DumpDCD(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), - coords(NULL) + coords(nullptr) { if (narg != 5) error->all(FLERR,"Illegal dump dcd command"); if (binary || compressed || multifile || multiproc) @@ -62,7 +62,7 @@ DumpDCD::DumpDCD(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), sortcol = 0; unwrap_flag = 0; - format_default = NULL; + format_default = nullptr; // allocate global array for atom coords @@ -115,7 +115,7 @@ void DumpDCD::openfile() { if (me == 0) { fp = fopen(filename,"wb"); - if (fp == NULL) error->one(FLERR,"Cannot open dump file"); + if (fp == nullptr) error->one(FLERR,"Cannot open dump file"); } } @@ -342,7 +342,7 @@ void DumpDCD::write_dcd_header(const char *remarks) strncpy(title_string,remarks,80); title_string[79] = '\0'; fwrite(title_string,80,1,fp); - cur_time=time(NULL); + cur_time=time(nullptr); tmbuf=localtime(&cur_time); memset(title_string,' ',81); strftime(title_string,80,"REMARKS Created %d %B,%Y at %H:%M",tmbuf); diff --git a/src/dump_image.cpp b/src/dump_image.cpp index a4c6fd8205c36702b91c4b17deb513d5ed502f0a..1362b6a6de3563fb1c85417643d80dc77dda4cb8 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -50,12 +50,12 @@ enum{NO,YES}; /* ---------------------------------------------------------------------- */ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : - DumpCustom(lmp, narg, arg), thetastr(NULL), phistr(NULL), cxstr(NULL), - cystr(NULL), czstr(NULL), upxstr(NULL), upystr(NULL), upzstr(NULL), - zoomstr(NULL), perspstr(NULL), diamtype(NULL), diamelement(NULL), - bdiamtype(NULL), colortype(NULL), colorelement(NULL), bcolortype(NULL), - avec_line(NULL), avec_tri(NULL), avec_body(NULL), fixptr(NULL), image(NULL), - chooseghost(NULL), bufcopy(NULL) + DumpCustom(lmp, narg, arg), thetastr(nullptr), phistr(nullptr), cxstr(nullptr), + cystr(nullptr), czstr(nullptr), upxstr(nullptr), upystr(nullptr), upzstr(nullptr), + zoomstr(nullptr), perspstr(nullptr), diamtype(nullptr), diamelement(nullptr), + bdiamtype(nullptr), colortype(nullptr), colorelement(nullptr), bcolortype(nullptr), + avec_line(nullptr), avec_tri(nullptr), avec_body(nullptr), fixptr(nullptr), image(nullptr), + chooseghost(nullptr), bufcopy(nullptr) { if (binary || multiproc) error->all(FLERR,"Invalid dump image filename"); @@ -124,16 +124,16 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : bdiam = NUMERIC; bdiamvalue = 0.5; } - char *fixID = NULL; + char *fixID = nullptr; - thetastr = phistr = NULL; + thetastr = phistr = nullptr; cflag = STATIC; cx = cy = cz = 0.5; - cxstr = cystr = czstr = NULL; + cxstr = cystr = czstr = nullptr; - upxstr = upystr = upzstr = NULL; - zoomstr = NULL; - perspstr = NULL; + upxstr = upystr = upzstr = nullptr; + zoomstr = nullptr; + perspstr = nullptr; boxflag = YES; boxdiam = 0.02; axesflag = NO; @@ -441,8 +441,8 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : else if (i % 6 == 0) bcolortype[i] = image->color2rgb("cyan"); } } else { - bdiamtype = NULL; - bcolortype = NULL; + bdiamtype = nullptr; + bcolortype = nullptr; } // viewflag = DYNAMIC if any view parameter is dynamic @@ -458,8 +458,8 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) : // local data maxbufcopy = 0; - chooseghost = NULL; - bufcopy = NULL; + chooseghost = nullptr; + bufcopy = nullptr; } /* ---------------------------------------------------------------------- */ @@ -566,7 +566,7 @@ void DumpImage::init_style() if (atomflag && acolor == ELEMENT) { for (int i = 1; i <= ntypes; i++) { colorelement[i] = image->element2color(typenames[i]); - if (colorelement[i] == NULL) + if (colorelement[i] == nullptr) error->all(FLERR,"Invalid dump image element name"); } } @@ -606,7 +606,7 @@ void DumpImage::write() // pack buf with color & diameter - pack(NULL); + pack(nullptr); // set minmax color range if using dynamic atom color map @@ -641,7 +641,7 @@ void DumpImage::write() else image->write_PPM(fp); if (multifile) { fclose(fp); - fp = NULL; + fp = nullptr; } } } @@ -1261,7 +1261,7 @@ int DumpImage::modify_param(int narg, char **arg) char **ptrs = new char*[ncount+1]; ncount = 0; ptrs[ncount++] = strtok(arg[2],"/"); - while ((ptrs[ncount++] = strtok(NULL,"/"))); + while ((ptrs[ncount++] = strtok(nullptr,"/"))); ncount--; // assign each of ncount colors in round-robin fashion to types @@ -1269,7 +1269,7 @@ int DumpImage::modify_param(int narg, char **arg) int m = 0; for (int i = nlo; i <= nhi; i++) { colortype[i] = image->color2rgb(ptrs[m%ncount]); - if (colortype[i] == NULL) + if (colortype[i] == nullptr) error->all(FLERR,"Invalid color in dump_modify command"); m++; } @@ -1324,7 +1324,7 @@ int DumpImage::modify_param(int narg, char **arg) char **ptrs = new char*[ncount+1]; ncount = 0; ptrs[ncount++] = strtok(arg[2],"/"); - while ((ptrs[ncount++] = strtok(NULL,"/"))); + while ((ptrs[ncount++] = strtok(nullptr,"/"))); ncount--; // assign each of ncount colors in round-robin fashion to types @@ -1332,7 +1332,7 @@ int DumpImage::modify_param(int narg, char **arg) int m = 0; for (int i = nlo; i <= nhi; i++) { bcolortype[i] = image->color2rgb(ptrs[m%ncount]); - if (bcolortype[i] == NULL) + if (bcolortype[i] == nullptr) error->all(FLERR,"Invalid color in dump_modify command"); m++; } @@ -1356,7 +1356,7 @@ int DumpImage::modify_param(int narg, char **arg) if (strcmp(arg[0],"backcolor") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); double *color = image->color2rgb(arg[1]); - if (color == NULL) error->all(FLERR,"Invalid color in dump_modify command"); + if (color == nullptr) error->all(FLERR,"Invalid color in dump_modify command"); image->background[0] = static_cast (color[0]*255.0); image->background[1] = static_cast (color[1]*255.0); image->background[2] = static_cast (color[2]*255.0); @@ -1366,7 +1366,7 @@ int DumpImage::modify_param(int narg, char **arg) if (strcmp(arg[0],"boxcolor") == 0) { if (narg < 2) error->all(FLERR,"Illegal dump_modify command"); image->boxcolor = image->color2rgb(arg[1]); - if (image->boxcolor == NULL) + if (image->boxcolor == nullptr) error->all(FLERR,"Invalid color in dump_modify command"); return 2; } diff --git a/src/dump_local.cpp b/src/dump_local.cpp index a71166ec574924f39d033a1b4d1cf721e231e375..988ff269dec0be45b57a91518b4adcf09538095a 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -35,9 +35,9 @@ enum{INT,DOUBLE}; DumpLocal::DumpLocal(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), - label(NULL), vtype(NULL), vformat(NULL), columns(NULL), field2index(NULL), - argindex(NULL), id_compute(NULL), compute(NULL), id_fix(NULL), fix(NULL), - pack_choice(NULL) + label(nullptr), vtype(nullptr), vformat(nullptr), columns(nullptr), field2index(nullptr), + argindex(nullptr), id_compute(nullptr), compute(nullptr), id_fix(nullptr), fix(nullptr), + pack_choice(nullptr) { if (narg == 5) error->all(FLERR,"No dump local arguments specified"); @@ -73,12 +73,12 @@ DumpLocal::DumpLocal(LAMMPS *lmp, int narg, char **arg) : argindex = new int[nfield]; ncompute = 0; - id_compute = NULL; - compute = NULL; + id_compute = nullptr; + compute = nullptr; nfix = 0; - id_fix = NULL; - fix = NULL; + id_fix = nullptr; + fix = nullptr; // process attributes @@ -95,11 +95,11 @@ DumpLocal::DumpLocal(LAMMPS *lmp, int narg, char **arg) : for (int i = 0; i < size_one; i++) { if (vtype[i] == INT) strcat(format_default,"%d "); else if (vtype[i] == DOUBLE) strcat(format_default,"%g "); - vformat[i] = NULL; + vformat[i] = nullptr; } format_column_user = new char*[size_one]; - for (int i = 0; i < size_one; i++) format_column_user[i] = NULL; + for (int i = 0; i < size_one; i++) format_column_user[i] = nullptr; // setup column string @@ -180,8 +180,8 @@ void DumpLocal::init_style() char *ptr; for (int i = 0; i < size_one; i++) { if (i == 0) ptr = strtok(format," \0"); - else ptr = strtok(NULL," \0"); - if (ptr == NULL) error->all(FLERR,"Dump_modify format line is too short"); + else ptr = strtok(nullptr," \0"); + if (ptr == nullptr) error->all(FLERR,"Dump_modify format line is too short"); delete [] vformat[i]; if (format_column_user[i]) { diff --git a/src/dump_movie.cpp b/src/dump_movie.cpp index 5f6d0b80d7c026eb2e2a741d9d2affc53d2f33ba..951768978c5e32858ca1759278a7fa99c3fb4bcc 100644 --- a/src/dump_movie.cpp +++ b/src/dump_movie.cpp @@ -35,7 +35,7 @@ DumpMovie::DumpMovie(LAMMPS *lmp, int narg, char **arg) : filetype = PPM; bitrate = 2000; framerate = 24; - fp = NULL; + fp = nullptr; } /* ---------------------------------------------------------------------- */ @@ -44,7 +44,7 @@ void DumpMovie::openfile() { char moviecmd[1024]; - if ((comm->me == 0) && (fp == NULL)) { + if ((comm->me == 0) && (fp == nullptr)) { #ifdef LAMMPS_FFMPEG sprintf(moviecmd,"ffmpeg -v error -y -r %.2f -f image2pipe -c:v ppm -i - " @@ -59,7 +59,7 @@ void DumpMovie::openfile() fp = popen(moviecmd,"w"); #endif - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Failed to open FFmpeg pipeline to " "file {}",filename)); } diff --git a/src/dump_xyz.cpp b/src/dump_xyz.cpp index 10ba10f9951d4a2b12e08c1ee0d76607ab9204a5..d4352b0747e326320abc265064ab6b32c98ce05d 100644 --- a/src/dump_xyz.cpp +++ b/src/dump_xyz.cpp @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ DumpXYZ::DumpXYZ(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), - typenames(NULL) + typenames(nullptr) { if (narg != 5) error->all(FLERR,"Illegal dump xyz command"); if (binary || multiproc) error->all(FLERR,"Invalid dump xyz filename"); @@ -46,7 +46,7 @@ DumpXYZ::DumpXYZ(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), strcpy(format_default,str); ntypes = atom->ntypes; - typenames = NULL; + typenames = nullptr; } /* ---------------------------------------------------------------------- */ @@ -54,13 +54,13 @@ DumpXYZ::DumpXYZ(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg), DumpXYZ::~DumpXYZ() { delete[] format_default; - format_default = NULL; + format_default = nullptr; if (typenames) { for (int i = 1; i <= ntypes; i++) delete [] typenames[i]; delete [] typenames; - typenames = NULL; + typenames = nullptr; } } @@ -83,7 +83,7 @@ void DumpXYZ::init_style() // initialize typenames array to be backward compatible by default // a 32-bit int can be maximally 10 digits plus sign - if (typenames == NULL) { + if (typenames == nullptr) { typenames = new char*[ntypes+1]; for (int itype = 1; itype <= ntypes; itype++) { typenames[itype] = new char[12]; @@ -114,7 +114,7 @@ int DumpXYZ::modify_param(int narg, char **arg) delete [] typenames[i]; delete [] typenames; - typenames = NULL; + typenames = nullptr; } typenames = new char*[ntypes+1]; diff --git a/src/error.cpp b/src/error.cpp index 0ea218887f66e70a35741088c50e1bb294fb15e9..fff3072bb1162aecacce4ce149c84441ad15c1f0 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -69,7 +69,7 @@ void Error::universe_all(const std::string &file, int line, const std::string &s #ifdef LAMMPS_EXCEPTIONS // allow commands if an exception was caught in a run - // update may be NULL when catching command line errors + // update may be a null pointer when catching command line errors if (update) update->whichflag = 0; @@ -95,7 +95,7 @@ void Error::universe_one(const std::string &file, int line, const std::string &s #ifdef LAMMPS_EXCEPTIONS // allow commands if an exception was caught in a run - // update may be NULL when catching command line errors + // update may be a null pointer when catching command line errors if (update) update->whichflag = 0; @@ -143,7 +143,7 @@ void Error::all(const std::string &file, int line, const std::string &str) #ifdef LAMMPS_EXCEPTIONS // allow commands if an exception was caught in a run - // update may be NULL when catching command line errors + // update may be a null pointer when catching command line errors if (update) update->whichflag = 0; @@ -169,7 +169,7 @@ void Error::all(const std::string &file, int line, const std::string &str) /* ---------------------------------------------------------------------- called by one proc in world - write to world screen only if non-NULL on this proc + write to world screen only if non-nullptr on this proc always write to universe screen forces abort of entire world (and universe) if any proc in world calls ------------------------------------------------------------------------- */ @@ -192,7 +192,7 @@ void Error::one(const std::string &file, int line, const std::string &str) #ifdef LAMMPS_EXCEPTIONS // allow commands if an exception was caught in a run - // update may be NULL when catching command line errors + // update may be a null pointer when catching command line errors if (update) update->whichflag = 0; @@ -207,7 +207,7 @@ void Error::one(const std::string &file, int line, const std::string &str) /* ---------------------------------------------------------------------- called by one proc in world - only write to screen if non-NULL on this proc since could be file + only write to screen if non-nullptr on this proc since could be file ------------------------------------------------------------------------- */ void Error::warning(const std::string &file, int line, const std::string &str, int logflag) diff --git a/src/fix.cpp b/src/fix.cpp index 03313739a11e0a2e496bab771f551197f36678aa..8d6d3f88293e157b7baed1577a6c510eb63cc2af 100644 --- a/src/fix.cpp +++ b/src/fix.cpp @@ -33,8 +33,8 @@ int Fix::instance_total = 0; Fix::Fix(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp), - id(NULL), style(NULL), extlist(NULL), vector_atom(NULL), array_atom(NULL), - vector_local(NULL), array_local(NULL), eatom(NULL), vatom(NULL) + id(nullptr), style(nullptr), extlist(nullptr), vector_atom(nullptr), array_atom(nullptr), + vector_local(nullptr), array_local(nullptr), eatom(nullptr), vatom(nullptr) { instance_me = instance_total++; diff --git a/src/fix.h b/src/fix.h index ab8dddf1d949d098ab4ad5828f7be569309a488d..07a222063c57177a96a935be3dbb209176cd3f50 100644 --- a/src/fix.h +++ b/src/fix.h @@ -215,7 +215,7 @@ class Fix : protected Pointers { virtual int image(int *&, double **&) {return 0;} virtual int modify_param(int, char **) {return 0;} - virtual void *extract(const char *, int &) {return NULL;} + virtual void *extract(const char *, int &) {return nullptr;} virtual double memory_usage() {return 0.0;} diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index dba4fde07759d885dde5e68e0d0678a5c20ad491..52f4236985c4b4938cad48f6af7ddf0ddb7fe111 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -43,7 +43,7 @@ enum{DIAMETER,CHARGE}; /* ---------------------------------------------------------------------- */ FixAdapt::FixAdapt(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -nadapt(0), id_fix_diam(NULL), id_fix_chg(NULL), adapt(NULL) +nadapt(0), id_fix_diam(nullptr), id_fix_chg(nullptr), adapt(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix adapt command"); nevery = utils::inumeric(FLERR,arg[3],false,lmp); @@ -96,7 +96,7 @@ nadapt(0), id_fix_diam(NULL), id_fix_chg(NULL), adapt(NULL) strcpy(adapt[nadapt].pstyle,arg[iarg+1]); n = strlen(arg[iarg+2]) + 1; adapt[nadapt].pparam = new char[n]; - adapt[nadapt].pair = NULL; + adapt[nadapt].pair = nullptr; strcpy(adapt[nadapt].pparam,arg[iarg+2]); utils::bounds(FLERR,arg[iarg+3],1,atom->ntypes, adapt[nadapt].ilo,adapt[nadapt].ihi,error); @@ -118,7 +118,7 @@ nadapt(0), id_fix_diam(NULL), id_fix_chg(NULL), adapt(NULL) strcpy(adapt[nadapt].bstyle,arg[iarg+1]); n = strlen(arg[iarg+2]) + 1; adapt[nadapt].bparam = new char[n]; - adapt[nadapt].bond = NULL; + adapt[nadapt].bond = nullptr; strcpy(adapt[nadapt].bparam,arg[iarg+2]); utils::bounds(FLERR,arg[iarg+3],1,atom->nbondtypes, adapt[nadapt].ilo,adapt[nadapt].ihi,error); @@ -263,8 +263,8 @@ void FixAdapt::post_constructor() // new id = fix-ID + FIX_STORE_ATTRIBUTE // new fix group = group for this fix - id_fix_diam = NULL; - id_fix_chg = NULL; + id_fix_diam = nullptr; + id_fix_chg = nullptr; if (diamflag && atom->radius_flag) { std::string fixcmd = id + std::string("_FIX_STORE_DIAM"); @@ -340,7 +340,7 @@ void FixAdapt::init() if (ad->which == PAIR) { anypair = 1; - ad->pair = NULL; + ad->pair = nullptr; // if ad->pstyle has trailing sub-style annotation ":N", // strip it for pstyle arg to pair_match() and set nsub = N @@ -366,12 +366,12 @@ void FixAdapt::init() ad->pair = force->pair_match(psuffix,1,nsub); delete[] psuffix; } - if (ad->pair == NULL) ad->pair = force->pair_match(pstyle,1,nsub); - if (ad->pair == NULL) + if (ad->pair == nullptr) ad->pair = force->pair_match(pstyle,1,nsub); + if (ad->pair == nullptr) error->all(FLERR,"Fix adapt pair style does not exist"); void *ptr = ad->pair->extract(ad->pparam,ad->pdim); - if (ptr == NULL) + if (ptr == nullptr) error->all(FLERR,"Fix adapt pair style param not supported"); // for pair styles only parameters that are 2-d arrays in atom types or @@ -396,7 +396,7 @@ void FixAdapt::init() delete [] pstyle; } else if (ad->which == BOND){ - ad->bond = NULL; + ad->bond = nullptr; anybond = 1; int n = strlen(ad->bstyle) + 1; @@ -412,13 +412,13 @@ void FixAdapt::init() ad->bond = force->bond_match(bsuffix); delete [] bsuffix; } - if (ad->bond == NULL) ad->bond = force->bond_match(bstyle); - if (ad->bond == NULL ) + if (ad->bond == nullptr) ad->bond = force->bond_match(bstyle); + if (ad->bond == nullptr ) error->all(FLERR,"Fix adapt bond style does not exist"); void *ptr = ad->bond->extract(ad->bparam,ad->bdim); - if (ptr == NULL) + if (ptr == nullptr) error->all(FLERR,"Fix adapt bond style param not supported"); // for bond styles, use a vector @@ -431,7 +431,7 @@ void FixAdapt::init() delete [] bstyle; } else if (ad->which == KSPACE) { - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Fix adapt kspace style does not exist"); kspace_scale = (double *) force->kspace->extract("scale"); diff --git a/src/fix_addforce.cpp b/src/fix_addforce.cpp index 0983728ea91e757f3c6b2760fc8a92a6159f11f9..a8b7a46e4fd552e57fc0ccf4f1dc5dedbb7e74ad 100644 --- a/src/fix_addforce.cpp +++ b/src/fix_addforce.cpp @@ -36,7 +36,7 @@ enum{NONE,CONSTANT,EQUAL,ATOM}; FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xstr(NULL), ystr(NULL), zstr(NULL), estr(NULL), idregion(NULL), sforce(NULL) + xstr(nullptr), ystr(nullptr), zstr(nullptr), estr(nullptr), idregion(nullptr), sforce(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix addforce command"); @@ -52,7 +52,7 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) : ilevel_respa = 0; virial_flag = 1; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; @@ -253,7 +253,7 @@ void FixAddForce::post_force(int vflag) // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/fix_ave_atom.cpp b/src/fix_ave_atom.cpp index 4cbd284317f0649d49431f970ec02bebb76a2721..b1b3d9b1b1932ed069e7c27efe0bc7b796612278 100644 --- a/src/fix_ave_atom.cpp +++ b/src/fix_ave_atom.cpp @@ -35,8 +35,8 @@ enum{X,V,F,COMPUTE,FIX,VARIABLE}; FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), - ids(NULL), array(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), + ids(nullptr), array(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix ave/atom command"); @@ -64,7 +64,7 @@ FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) : value2index = new int[nvalues]; for (int i = 0; i < nvalues; i++) { - ids[i] = NULL; + ids[i] = nullptr; if (strcmp(arg[i],"x") == 0) { which[i] = X; @@ -376,7 +376,7 @@ void FixAveAtom::end_of_step() } else if (which[m] == VARIABLE) { if (array) input->variable->compute_atom(n,igroup,&array[0][m],nvalues,1); - else input->variable->compute_atom(n,igroup,NULL,nvalues,1); + else input->variable->compute_atom(n,igroup,nullptr,nvalues,1); } } @@ -394,7 +394,7 @@ void FixAveAtom::end_of_step() nvalid = ntimestep+peratom_freq - (nrepeat-1)*nevery; modify->addstep_compute(nvalid); - if (array == NULL) return; + if (array == nullptr) return; // average the final result for the Nfreq timestep @@ -424,7 +424,7 @@ void FixAveAtom::grow_arrays(int nmax) memory->grow(array,nmax,nvalues,"fix_ave/atom:array"); array_atom = array; if (array) vector_atom = array[0]; - else vector_atom = NULL; + else vector_atom = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/fix_ave_chunk.cpp b/src/fix_ave_chunk.cpp index 18fb33527938cbea7680da75d936d60edc823b90..c178cf63c0e98e46f9d2b47626a278d50a5a3195 100644 --- a/src/fix_ave_chunk.cpp +++ b/src/fix_ave_chunk.cpp @@ -46,12 +46,12 @@ enum{ONE,RUNNING,WINDOW}; FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), nvalues(0), nrepeat(0), - which(NULL), argindex(NULL), value2index(NULL), ids(NULL), - fp(NULL), idchunk(NULL), varatom(NULL), - count_one(NULL), count_many(NULL), count_sum(NULL), - values_one(NULL), values_many(NULL), values_sum(NULL), - count_total(NULL), count_list(NULL), - values_total(NULL), values_list(NULL) + which(nullptr), argindex(nullptr), value2index(nullptr), ids(nullptr), + fp(nullptr), idchunk(nullptr), varatom(nullptr), + count_one(nullptr), count_many(nullptr), count_sum(nullptr), + values_one(nullptr), values_many(nullptr), values_sum(nullptr), + count_total(nullptr), count_list(nullptr), + values_total(nullptr), values_list(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix ave/chunk command"); @@ -88,7 +88,7 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : int iarg = 0; while (iarg < nargnew) { - ids[nvalues] = NULL; + ids[nvalues] = nullptr; if (strcmp(arg[iarg],"vx") == 0) { which[nvalues] = V; @@ -164,15 +164,15 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : ave = ONE; nwindow = 0; biasflag = 0; - id_bias = NULL; + id_bias = nullptr; adof = domain->dimension; cdof = 0.0; overwrite = 0; - format_user = NULL; + format_user = nullptr; format = (char *) " %g"; - char *title1 = NULL; - char *title2 = NULL; - char *title3 = NULL; + char *title1 = nullptr; + char *title2 = nullptr; + char *title3 = nullptr; while (iarg < nargnew) { if (strcmp(arg[iarg],"norm") == 0) { @@ -225,7 +225,7 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/chunk command"); if (me == 0) { fp = fopen(arg[iarg+1],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix ave/chunk file {}: {}", arg[iarg+1], utils::getsyserror())); } @@ -409,12 +409,12 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) : normcount = 0; maxvar = 0; - varatom = NULL; + varatom = nullptr; - count_one = count_many = count_sum = count_total = NULL; - count_list = NULL; - values_one = values_many = values_sum = values_total = NULL; - values_list = NULL; + count_one = count_many = count_sum = count_total = nullptr; + count_list = nullptr; + values_one = values_many = values_sum = values_total = nullptr; + values_list = nullptr; maxchunk = 0; nchunk = 1; @@ -466,24 +466,24 @@ FixAveChunk::~FixAveChunk() } delete [] idchunk; - which = NULL; - argindex = NULL; - ids = NULL; - value2index = NULL; - fp = NULL; - varatom = NULL; - count_one = NULL; - count_many = NULL; - count_sum = NULL; - count_total = NULL; - count_list = NULL; - values_one = NULL; - values_many = NULL; - values_sum = NULL; - values_total = NULL; - values_list = NULL; - idchunk = NULL; - cchunk = NULL; + which = nullptr; + argindex = nullptr; + ids = nullptr; + value2index = nullptr; + fp = nullptr; + varatom = nullptr; + count_one = nullptr; + count_many = nullptr; + count_sum = nullptr; + count_total = nullptr; + count_list = nullptr; + values_one = nullptr; + values_many = nullptr; + values_sum = nullptr; + values_total = nullptr; + values_list = nullptr; + idchunk = nullptr; + cchunk = nullptr; } /* ---------------------------------------------------------------------- */ @@ -1110,7 +1110,7 @@ void FixAveChunk::allocate() double FixAveChunk::compute_array(int i, int j) { - if (values_total == NULL) return 0.0; + if (values_total == nullptr) return 0.0; if (i >= nchunk) return 0.0; if (j < colextra) { if (cchunk->compress) { diff --git a/src/fix_ave_correlate.cpp b/src/fix_ave_correlate.cpp index 031dfc26bff713ef5171b5e2c55a737aaf94b953..5576c7fb666f60e920dad2902f4c3a862db122ab 100644 --- a/src/fix_ave_correlate.cpp +++ b/src/fix_ave_correlate.cpp @@ -45,8 +45,8 @@ enum{AUTO,UPPER,LOWER,AUTOUPPER,AUTOLOWER,FULL}; FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg): Fix (lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), ids(NULL), fp(NULL), - count(NULL), values(NULL), corr(NULL), save_count(NULL), save_corr(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), ids(nullptr), fp(nullptr), + count(nullptr), values(nullptr), corr(nullptr), save_count(nullptr), save_corr(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix ave/correlate command"); @@ -112,11 +112,11 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg): ave = ONE; startstep = 0; prefactor = 1.0; - fp = NULL; + fp = nullptr; overwrite = 0; - char *title1 = NULL; - char *title2 = NULL; - char *title3 = NULL; + char *title1 = nullptr; + char *title2 = nullptr; + char *title3 = nullptr; while (iarg < nargnew) { if (strcmp(arg[iarg],"type") == 0) { @@ -147,7 +147,7 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg): if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/correlate command"); if (me == 0) { fp = fopen(arg[iarg+1],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix ave/correlate file {}:"" {}", arg[iarg+1], utils::getsyserror())); } diff --git a/src/fix_ave_histo.cpp b/src/fix_ave_histo.cpp index 3a9346498fb4c7228ed1ffb309c1694d539ee551..4d1cd5b2dd7293f114c20f4044de7387117eaa61 100644 --- a/src/fix_ave_histo.cpp +++ b/src/fix_ave_histo.cpp @@ -45,10 +45,10 @@ enum{IGNORE,END,EXTRA}; FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), - ids(NULL), fp(NULL), stats_list(NULL), - bin(NULL), bin_total(NULL), bin_all(NULL), bin_list(NULL), - coord(NULL), vector(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), + ids(nullptr), fp(nullptr), stats_list(nullptr), + bin(nullptr), bin_total(nullptr), bin_all(nullptr), bin_list(nullptr), + coord(nullptr), vector(nullptr) { if (narg < 10) error->all(FLERR,"Illegal fix ave/histo command"); @@ -120,41 +120,41 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[i],"x") == 0) { which[i] = X; argindex[i] = 0; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"y") == 0) { which[i] = X; argindex[i] = 1; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"z") == 0) { which[i] = X; argindex[i] = 2; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"vx") == 0) { which[i] = V; argindex[i] = 0; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"vy") == 0) { which[i] = V; argindex[i] = 1; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"vz") == 0) { which[i] = V; argindex[i] = 2; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"fx") == 0) { which[i] = F; argindex[i] = 0; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"fy") == 0) { which[i] = F; argindex[i] = 1; - ids[i] = NULL; + ids[i] = nullptr; } else if (strcmp(arg[i],"fz") == 0) { which[i] = F; argindex[i] = 2; - ids[i] = NULL; + ids[i] = nullptr; } else if ((strncmp(arg[i],"c_",2) == 0) || (strncmp(arg[i],"f_",2) == 0) || @@ -467,9 +467,9 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) : bin_all = new double[nbins]; coord = new double[nbins]; - stats_list = NULL; - bin_list = NULL; - vector = NULL; + stats_list = nullptr; + bin_list = nullptr; + vector = nullptr; maxatom = 0; if (ave == WINDOW) { @@ -944,16 +944,16 @@ void FixAveHisto::options(int iarg, int narg, char **arg) { // option defaults - fp = NULL; + fp = nullptr; kind = DEFAULT; ave = ONE; startstep = 0; mode = SCALAR; beyond = IGNORE; overwrite = 0; - title1 = NULL; - title2 = NULL; - title3 = NULL; + title1 = nullptr; + title2 = nullptr; + title3 = nullptr; // optional args @@ -962,7 +962,7 @@ void FixAveHisto::options(int iarg, int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/histo command"); if (me == 0) { fp = fopen(arg[iarg+1],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix ave/histo file {}: {}", arg[iarg+1], utils::getsyserror())); } diff --git a/src/fix_ave_histo_weight.cpp b/src/fix_ave_histo_weight.cpp index 5e93df0313732c88653eb766e1b84f53aa805064..586c36af8a17b586c93be1f2ad9f498ce85a72af 100644 --- a/src/fix_ave_histo_weight.cpp +++ b/src/fix_ave_histo_weight.cpp @@ -126,7 +126,7 @@ void FixAveHistoWeight::end_of_step() // calculate weight factors which are 2nd value (i = 1) double weight = 0.0; - double *weights = NULL; + double *weights = nullptr; int stride = 0; i = 1; @@ -270,11 +270,11 @@ void FixAveHistoWeight::end_of_step() // atom attributes - if (which[i] == X && weights != NULL) + if (which[i] == X && weights != nullptr) bin_atoms_weights(&atom->x[0][j],3,weights,stride); - else if (which[i] == V && weights != NULL) + else if (which[i] == V && weights != nullptr) bin_atoms_weights(&atom->v[0][j],3,weights,stride); - else if (which[i] == F && weights != NULL) + else if (which[i] == F && weights != nullptr) bin_atoms_weights(&atom->f[0][j],3,weights,stride); // invoke compute if not previously invoked diff --git a/src/fix_ave_time.cpp b/src/fix_ave_time.cpp index 9c493b98462e7b40dd992d6c6836afaea7212d33..b40a7eb0093e598f563704025f10b25202c5906f 100644 --- a/src/fix_ave_time.cpp +++ b/src/fix_ave_time.cpp @@ -43,11 +43,11 @@ enum{SCALAR,VECTOR}; FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), - offcol(NULL), varlen(NULL), ids(NULL), - fp(NULL), offlist(NULL), format(NULL), format_user(NULL), - vector(NULL), vector_total(NULL), vector_list(NULL), - column(NULL), array(NULL), array_total(NULL), array_list(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), + offcol(nullptr), varlen(nullptr), ids(nullptr), + fp(nullptr), offlist(nullptr), format(nullptr), format_user(nullptr), + vector(nullptr), vector_total(nullptr), vector_list(nullptr), + column(nullptr), array(nullptr), array_total(nullptr), array_list(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix ave/time command"); @@ -243,7 +243,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : // nrows = # of rows in output array // if all columns are variable length, just set nrows = 1 for now - column = NULL; + column = nullptr; if (mode == VECTOR) { if (all_variable_length == 0) nrows = column_length(0); else nrows = 1; @@ -304,10 +304,10 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : // allocate memory for averaging - vector = vector_total = NULL; - vector_list = NULL; - array = array_total = NULL; - array_list = NULL; + vector = vector_total = nullptr; + vector_list = nullptr; + array = array_total = nullptr; + array_list = nullptr; if (mode == SCALAR) { vector = new double[nvalues]; @@ -321,7 +321,7 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) : // VECTOR mode produces either a vector or array // intensive/extensive flags set by compute,fix,variable that produces value - extlist = NULL; + extlist = nullptr; if (mode == SCALAR) { if (nvalues == 1) { @@ -1022,18 +1022,18 @@ void FixAveTime::options(int iarg, int narg, char **arg) { // option defaults - fp = NULL; + fp = nullptr; ave = ONE; startstep = 0; mode = SCALAR; noff = 0; - offlist = NULL; + offlist = nullptr; overwrite = 0; - format_user = NULL; + format_user = nullptr; format = (char *) " %g"; - title1 = NULL; - title2 = NULL; - title3 = NULL; + title1 = nullptr; + title2 = nullptr; + title3 = nullptr; // optional args @@ -1042,7 +1042,7 @@ void FixAveTime::options(int iarg, int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal fix ave/time command"); if (me == 0) { fp = fopen(arg[iarg+1],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix ave/time file {}: {}", arg[iarg+1], utils::getsyserror())); } diff --git a/src/fix_aveforce.cpp b/src/fix_aveforce.cpp index 00ec0d67ba967f9fd0da0cffbe871ffdf1e0aff6..324f6eaa6b82e741e590e7f0bef1c7bdcd59eba8 100644 --- a/src/fix_aveforce.cpp +++ b/src/fix_aveforce.cpp @@ -34,7 +34,7 @@ enum{NONE,CONSTANT,EQUAL}; FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xstr(NULL), ystr(NULL), zstr(NULL), idregion(NULL) + xstr(nullptr), ystr(nullptr), zstr(nullptr), idregion(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix aveforce command"); @@ -46,7 +46,7 @@ FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) : respa_level_support = 1; ilevel_respa = nlevels_respa = 0; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; @@ -82,7 +82,7 @@ FixAveForce::FixAveForce(LAMMPS *lmp, int narg, char **arg) : // optional args iregion = -1; - idregion = NULL; + idregion = nullptr; int iarg = 6; while (iarg < narg) { @@ -197,7 +197,7 @@ void FixAveForce::post_force(int /*vflag*/) { // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); @@ -265,7 +265,7 @@ void FixAveForce::post_force_respa(int vflag, int ilevel, int /*iloop*/) if (ilevel == ilevel_respa) post_force(vflag); else { - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/fix_balance.cpp b/src/fix_balance.cpp index 7cee835375837b39185471b7202879b8b00f59da..735b6b3bd0dc7415328b5388611fd935cbbc5170 100644 --- a/src/fix_balance.cpp +++ b/src/fix_balance.cpp @@ -35,7 +35,7 @@ enum{SHIFT,BISECTION}; /* ---------------------------------------------------------------------- */ FixBalance::FixBalance(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), balance(NULL), irregular(NULL) + Fix(lmp, narg, arg), balance(nullptr), irregular(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix balance command"); diff --git a/src/fix_box_relax.cpp b/src/fix_box_relax.cpp index 5fd9ef190e8638da8809e3921fd2ef60f1bbd229..8d8b4af1071167c2586c45a3561f07648461e844 100644 --- a/src/fix_box_relax.cpp +++ b/src/fix_box_relax.cpp @@ -43,7 +43,7 @@ enum{ISO,ANISO,TRICLINIC}; FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - id_temp(NULL), id_press(NULL), tflag(0), pflag(0) + id_temp(nullptr), id_press(nullptr), tflag(0), pflag(0) { if (narg < 5) error->all(FLERR,"Illegal fix box/relax command"); @@ -395,7 +395,7 @@ void FixBoxRelax::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigid++; diff --git a/src/fix_controller.cpp b/src/fix_controller.cpp index 92fd42f3dbaa1fb4feabae68e2909d2777260ae9..edeaf60f42f28aac2e59d1b404573762acd8e16d 100644 --- a/src/fix_controller.cpp +++ b/src/fix_controller.cpp @@ -34,7 +34,7 @@ enum{COMPUTE,FIX,VARIABLE}; FixController::FixController(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - pvID(NULL), cvID(NULL) + pvID(nullptr), cvID(nullptr) { if (narg != 11) error->all(FLERR,"Illegal fix controller command"); diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index b4c36ca43e644cd73cbaddfc0dd5b90612258dc2..4d3b1c647b87bf5fc7214c1ce5e9f36e4e0f1abb 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -42,7 +42,7 @@ enum{ONE_FROM_ONE,ONE_FROM_TWO,TWO_FROM_ONE}; /* ---------------------------------------------------------------------- */ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -rfix(NULL), irregular(NULL), set(NULL) +rfix(nullptr), irregular(nullptr), set(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix deform command"); @@ -353,7 +353,7 @@ rfix(NULL), irregular(NULL), set(NULL) flip = 0; if (force_reneighbor) irregular = new Irregular(lmp); - else irregular = NULL; + else irregular = nullptr; TWOPI = 2.0*MY_PI; } @@ -618,7 +618,7 @@ void FixDeform::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigid++; diff --git a/src/fix_enforce2d.cpp b/src/fix_enforce2d.cpp index be2a74d81b2af00f87200b2bb39f513c082185e1..02d76b8c27f57655404f66ea04bebc5defc68563 100644 --- a/src/fix_enforce2d.cpp +++ b/src/fix_enforce2d.cpp @@ -28,7 +28,7 @@ using namespace FixConst; FixEnforce2D::FixEnforce2D(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - flist(NULL) + flist(nullptr) { if (narg != 3) error->all(FLERR,"Illegal fix enforce2d command"); diff --git a/src/fix_external.cpp b/src/fix_external.cpp index e31092fd0785c83fb6b9b61e04b96c3f4b8cc104..5c7b90ee476f73e98f1b478b21c3c6e59a64f958 100644 --- a/src/fix_external.cpp +++ b/src/fix_external.cpp @@ -29,7 +29,7 @@ enum{PF_CALLBACK,PF_ARRAY}; FixExternal::FixExternal(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - fexternal(NULL), caller_vector(NULL) + fexternal(nullptr), caller_vector(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix external command"); @@ -53,7 +53,7 @@ FixExternal::FixExternal(LAMMPS *lmp, int narg, char **arg) : if (napply <= 0) error->all(FLERR,"Illegal fix external command"); } else error->all(FLERR,"Illegal fix external command"); - callback = NULL; + callback = nullptr; // perform initial allocation of atom-based array // register with Atom class @@ -66,7 +66,7 @@ FixExternal::FixExternal(LAMMPS *lmp, int narg, char **arg) : // optional vector of values provided by caller // vector_flag and size_vector are setup via set_vector_length() - caller_vector = NULL; + caller_vector = nullptr; } /* ---------------------------------------------------------------------- */ @@ -99,7 +99,7 @@ int FixExternal::setmask() void FixExternal::init() { - if (mode == PF_CALLBACK && callback == NULL) + if (mode == PF_CALLBACK && callback == nullptr) error->all(FLERR,"Fix external callback function not set"); } diff --git a/src/fix_gravity.cpp b/src/fix_gravity.cpp index 6dff9373850a3ff957229b00c14530fe37bd6ab6..abef474b4c580698f8184020ce84dc69a75ae004 100644 --- a/src/fix_gravity.cpp +++ b/src/fix_gravity.cpp @@ -37,8 +37,8 @@ enum{CONSTANT,EQUAL}; // same as FixPour FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - mstr(NULL), vstr(NULL), pstr(NULL), tstr(NULL), - xstr(NULL), ystr(NULL), zstr(NULL) + mstr(nullptr), vstr(nullptr), pstr(nullptr), tstr(nullptr), + xstr(nullptr), ystr(nullptr), zstr(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix gravity command"); @@ -49,7 +49,7 @@ FixGravity::FixGravity(LAMMPS *lmp, int narg, char **arg) : respa_level_support = 1; ilevel_respa = 0; - mstr = vstr = pstr = tstr = xstr = ystr = zstr = NULL; + mstr = vstr = pstr = tstr = xstr = ystr = zstr = nullptr; mstyle = vstyle = pstyle = tstyle = xstyle = ystyle = zstyle = CONSTANT; if (strstr(arg[3],"v_") == arg[3]) { @@ -394,5 +394,5 @@ void *FixGravity::extract(const char *name, int &dim) dim = 1; return (void *) gvec; } - return NULL; + return nullptr; } diff --git a/src/fix_group.cpp b/src/fix_group.cpp index bb51fafa12618d84e7b63b7fcc2aca77b726e581..108a97157e773ff919ca59a1409c1dd365b64292 100644 --- a/src/fix_group.cpp +++ b/src/fix_group.cpp @@ -34,7 +34,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixGroup::FixGroup(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -idregion(NULL), idvar(NULL), idprop(NULL) +idregion(nullptr), idvar(nullptr), idprop(nullptr) { // dgroupbit = bitmask of dynamic group // group ID is last part of fix ID @@ -210,9 +210,9 @@ void FixGroup::set_group() // operate differently due to invocation this early in timestep // e.g. perform ghost comm update due to atoms having just moved - double *var = NULL; - int *ivector = NULL; - double *dvector = NULL; + double *var = nullptr; + int *ivector = nullptr; + double *dvector = nullptr; if (varflag) { update->post_integrate = 1; @@ -265,5 +265,5 @@ void *FixGroup::extract(const char *str, int &/*unused*/) if (strcmp(str,"property") == 0 && propflag) return (void *) idprop; if (strcmp(str,"variable") == 0 && varflag) return (void *) idvar; if (strcmp(str,"region") == 0 && regionflag) return (void *) idregion; - return NULL; + return nullptr; } diff --git a/src/fix_halt.cpp b/src/fix_halt.cpp index f8222e3ece3c3bd7995dbe5d898ffd90d776ba41..42f5c46a8521ab41c56e7bff745ecb9adf7fa4a6 100644 --- a/src/fix_halt.cpp +++ b/src/fix_halt.cpp @@ -37,7 +37,7 @@ enum{NOMSG,YESMSG}; /* ---------------------------------------------------------------------- */ FixHalt::FixHalt(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), idvar(NULL), dlimit_path(NULL) + Fix(lmp, narg, arg), idvar(nullptr), dlimit_path(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix halt command"); nevery = utils::inumeric(FLERR,arg[3],false,lmp); @@ -45,7 +45,7 @@ FixHalt::FixHalt(LAMMPS *lmp, int narg, char **arg) : // comparison args - idvar = NULL; + idvar = nullptr; int iarg = 4; if (strcmp(arg[iarg],"tlimit") == 0) { diff --git a/src/fix_heat.cpp b/src/fix_heat.cpp index e2eb3993227d21daa978f6359d19461261de791d..3c91341940c56b71d544d3305f4ad7dc10c945fe 100644 --- a/src/fix_heat.cpp +++ b/src/fix_heat.cpp @@ -39,7 +39,7 @@ enum{CONSTANT,EQUAL,ATOM}; /* ---------------------------------------------------------------------- */ FixHeat::FixHeat(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -idregion(NULL), hstr(NULL), vheat(NULL), vscale(NULL) +idregion(nullptr), hstr(nullptr), vheat(nullptr), vscale(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix heat command"); @@ -50,7 +50,7 @@ idregion(NULL), hstr(NULL), vheat(NULL), vscale(NULL) nevery = utils::inumeric(FLERR,arg[3],false,lmp); if (nevery <= 0) error->all(FLERR,"Illegal fix heat command"); - hstr = NULL; + hstr = nullptr; if (strstr(arg[4],"v_") == arg[4]) { int n = strlen(&arg[4][2]) + 1; @@ -192,7 +192,7 @@ void FixHeat::end_of_step() // vsub = velocity subtracted from each atom to preserve momentum // overall KE cannot go negative - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/fix_indent.cpp b/src/fix_indent.cpp index ae58f27913ad833f8fb5495ca9e622b621ff7624..e96ad7ab8a19f040c5db0897b78d0ab341243d3e 100644 --- a/src/fix_indent.cpp +++ b/src/fix_indent.cpp @@ -40,7 +40,7 @@ enum{INSIDE,OUTSIDE}; FixIndent::FixIndent(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xstr(NULL), ystr(NULL), zstr(NULL), rstr(NULL), pstr(NULL) + xstr(nullptr), ystr(nullptr), zstr(nullptr), rstr(nullptr), pstr(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix indent command"); @@ -407,7 +407,7 @@ void FixIndent::options(int narg, char **arg) if (narg < 0) error->all(FLERR,"Illegal fix indent command"); istyle = NONE; - xstr = ystr = zstr = rstr = pstr = NULL; + xstr = ystr = zstr = rstr = pstr = nullptr; xvalue = yvalue = zvalue = rvalue = pvalue = 0.0; scaleflag = 1; side = OUTSIDE; diff --git a/src/fix_langevin.cpp b/src/fix_langevin.cpp index 5f67d5d77a9cd8b3fda614c782fa153ee3de9904..ecb7a9caf8864ca9a71888da08ad0079a0a3635e 100644 --- a/src/fix_langevin.cpp +++ b/src/fix_langevin.cpp @@ -53,8 +53,8 @@ enum{CONSTANT,EQUAL,ATOM}; FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - gjfflag(0), gfactor1(NULL), gfactor2(NULL), ratio(NULL), tstr(NULL), - flangevin(NULL), tforce(NULL), franprev(NULL), lv(NULL), id_temp(NULL), random(NULL) + gjfflag(0), gfactor1(nullptr), gfactor2(nullptr), ratio(nullptr), tstr(nullptr), + flangevin(nullptr), tforce(nullptr), franprev(nullptr), lv(nullptr), id_temp(nullptr), random(nullptr) { if (narg < 7) error->all(FLERR,"Illegal fix langevin command"); @@ -154,10 +154,10 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : } else error->all(FLERR,"Illegal fix langevin command"); } - // set temperature = NULL, user can override via fix_modify if wants bias + // set temperature = nullptr, user can override via fix_modify if wants bias - id_temp = NULL; - temperature = NULL; + id_temp = nullptr; + temperature = nullptr; energy = 0.0; @@ -165,11 +165,11 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : // compute_scalar checks for this and returns 0.0 // if flangevin_allocated is not set - flangevin = NULL; + flangevin = nullptr; flangevin_allocated = 0; - franprev = NULL; - lv = NULL; - tforce = NULL; + franprev = nullptr; + lv = nullptr; + tforce = nullptr; maxatom1 = maxatom2 = 0; // setup atom-based array for franprev @@ -1104,7 +1104,7 @@ void *FixLangevin::extract(const char *str, int &dim) if (strcmp(str,"t_target") == 0) { return &t_target; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/fix_minimize.cpp b/src/fix_minimize.cpp index a8e1e4834ef0a1b98e3e2ade312e2235b9d25c04..1fe86e2c06cafdcbdbbbf9d91659b13481e7f5a9 100644 --- a/src/fix_minimize.cpp +++ b/src/fix_minimize.cpp @@ -23,7 +23,7 @@ using namespace FixConst; FixMinimize::FixMinimize(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvector(0), peratom(NULL), vectors(NULL) + nvector(0), peratom(nullptr), vectors(nullptr) { // register callback to this fix from Atom class // don't perform initial allocation here, must wait until add_vector() diff --git a/src/fix_move.cpp b/src/fix_move.cpp index 582c0877deb1b1b38de8c3d7b299b56be09eab55..8c7a6c2f75015789452166f0a5e474cfd44894e9 100644 --- a/src/fix_move.cpp +++ b/src/fix_move.cpp @@ -46,10 +46,10 @@ enum{EQUAL,ATOM}; FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xvarstr(NULL), yvarstr(NULL), zvarstr(NULL), vxvarstr(NULL), - vyvarstr(NULL), vzvarstr(NULL), - xoriginal(NULL), toriginal(NULL), qoriginal(NULL), - displace(NULL), velocity(NULL) + xvarstr(nullptr), yvarstr(nullptr), zvarstr(nullptr), vxvarstr(nullptr), + vyvarstr(nullptr), vzvarstr(nullptr), + xoriginal(nullptr), toriginal(nullptr), qoriginal(nullptr), + displace(nullptr), velocity(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix move command"); @@ -127,37 +127,37 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) : if (narg < 10) error->all(FLERR,"Illegal fix move command"); iarg = 10; mstyle = VARIABLE; - if (strcmp(arg[4],"NULL") == 0) xvarstr = NULL; + if (strcmp(arg[4],"NULL") == 0) xvarstr = nullptr; else if (strstr(arg[4],"v_") == arg[4]) { int n = strlen(&arg[4][2]) + 1; xvarstr = new char[n]; strcpy(xvarstr,&arg[4][2]); } else error->all(FLERR,"Illegal fix move command"); - if (strcmp(arg[5],"NULL") == 0) yvarstr = NULL; + if (strcmp(arg[5],"NULL") == 0) yvarstr = nullptr; else if (strstr(arg[5],"v_") == arg[5]) { int n = strlen(&arg[5][2]) + 1; yvarstr = new char[n]; strcpy(yvarstr,&arg[5][2]); } else error->all(FLERR,"Illegal fix move command"); - if (strcmp(arg[6],"NULL") == 0) zvarstr = NULL; + if (strcmp(arg[6],"NULL") == 0) zvarstr = nullptr; else if (strstr(arg[6],"v_") == arg[6]) { int n = strlen(&arg[6][2]) + 1; zvarstr = new char[n]; strcpy(zvarstr,&arg[6][2]); } else error->all(FLERR,"Illegal fix move command"); - if (strcmp(arg[7],"NULL") == 0) vxvarstr = NULL; + if (strcmp(arg[7],"NULL") == 0) vxvarstr = nullptr; else if (strstr(arg[7],"v_") == arg[7]) { int n = strlen(&arg[7][2]) + 1; vxvarstr = new char[n]; strcpy(vxvarstr,&arg[7][2]); } else error->all(FLERR,"Illegal fix move command"); - if (strcmp(arg[8],"NULL") == 0) vyvarstr = NULL; + if (strcmp(arg[8],"NULL") == 0) vyvarstr = nullptr; else if (strstr(arg[8],"v_") == arg[8]) { int n = strlen(&arg[8][2]) + 1; vyvarstr = new char[n]; strcpy(vyvarstr,&arg[8][2]); } else error->all(FLERR,"Illegal fix move command"); - if (strcmp(arg[9],"NULL") == 0) vzvarstr = NULL; + if (strcmp(arg[9],"NULL") == 0) vzvarstr = nullptr; else if (strstr(arg[9],"v_") == arg[9]) { int n = strlen(&arg[9][2]) + 1; vzvarstr = new char[n]; @@ -259,7 +259,7 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) : atom->add_callback(Atom::GROW); atom->add_callback(Atom::RESTART); - displace = velocity = NULL; + displace = velocity = nullptr; // AtomVec pointers to retrieve per-atom storage of extra quantities @@ -297,7 +297,7 @@ FixMove::FixMove(LAMMPS *lmp, int narg, char **arg) : if (quat_flag) { double *quat; for (int i = 0; i < nlocal; i++) { - quat = NULL; + quat = nullptr; if (mask[i] & groupbit) { if (ellipsoid_flag && ellipsoid[i] >= 0) quat = avec_ellipsoid->bonus[ellipsoid[i]].quat; @@ -439,9 +439,9 @@ void FixMove::init() memory->destroy(displace); memory->destroy(velocity); if (displaceflag) memory->create(displace,maxatom,3,"move:displace"); - else displace = NULL; + else displace = nullptr; if (velocityflag) memory->create(velocity,maxatom,3,"move:velocity"); - else velocity = NULL; + else velocity = nullptr; if (strstr(update->integrate_style,"respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; @@ -664,7 +664,7 @@ void FixMove::initial_integrate(int /*vflag*/) // angmom for ellipsoids, tris, and bodies if (angmom_flag) { - quat = inertia = NULL; + quat = inertia = nullptr; if (ellipsoid_flag && ellipsoid[i] >= 0) { quat = avec_ellipsoid->bonus[ellipsoid[i]].quat; shape = avec_ellipsoid->bonus[ellipsoid[i]].shape; @@ -701,7 +701,7 @@ void FixMove::initial_integrate(int /*vflag*/) // quats for ellipsoids, tris, and bodies if (quat_flag) { - quat = NULL; + quat = nullptr; if (ellipsoid_flag && ellipsoid[i] >= 0) quat = avec_ellipsoid->bonus[ellipsoid[i]].quat; else if (tri_flag && tri[i] >= 0) @@ -873,7 +873,7 @@ void FixMove::initial_integrate(int /*vflag*/) } /* ---------------------------------------------------------------------- - final NVE of particles with NULL components + final NVE of particles with nullptr components ------------------------------------------------------------------------- */ void FixMove::final_integrate() @@ -1121,7 +1121,7 @@ void FixMove::set_arrays(int i) // quats for ellipsoids, tris, and bodies if (quat_flag) { - quat = NULL; + quat = nullptr; if (ellipsoid_flag && ellipsoid[i] >= 0) quat = avec_ellipsoid->bonus[ellipsoid[i]].quat; else if (tri_flag && tri[i] >= 0) diff --git a/src/fix_neigh_history.cpp b/src/fix_neigh_history.cpp index cf0b9b49b2ebb2f5a03a808b7371f308cb5d0469..88cb3fa64e8a54b268c960e2c8e486a0a266f7ec 100644 --- a/src/fix_neigh_history.cpp +++ b/src/fix_neigh_history.cpp @@ -34,8 +34,8 @@ enum{DEFAULT,NPARTNER,PERPARTNER}; // also set in fix neigh/history/omp FixNeighHistory::FixNeighHistory(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - pair(NULL), npartner(NULL), partner(NULL), valuepartner(NULL), - ipage_atom(NULL), dpage_atom(NULL), ipage_neigh(NULL), dpage_neigh(NULL) + pair(nullptr), npartner(nullptr), partner(nullptr), valuepartner(nullptr), + ipage_atom(nullptr), dpage_atom(nullptr), ipage_neigh(nullptr), dpage_neigh(nullptr) { if (narg != 4) error->all(FLERR,"Illegal fix NEIGH_HISTORY command"); @@ -70,16 +70,16 @@ FixNeighHistory::FixNeighHistory(LAMMPS *lmp, int narg, char **arg) : // other per-atom vectors - firstflag = NULL; - firstvalue = NULL; + firstflag = nullptr; + firstvalue = nullptr; maxatom = 0; // per-atom and per-neighbor data structs - ipage_atom = NULL; - dpage_atom = NULL; - ipage_neigh = NULL; - dpage_neigh = NULL; + ipage_atom = nullptr; + dpage_atom = nullptr; + ipage_neigh = nullptr; + dpage_neigh = nullptr; // initialize npartner to 0 so neighbor list creation is OK the 1st time @@ -120,13 +120,13 @@ FixNeighHistory::~FixNeighHistory() // to better detect use-after-delete errors - firstflag = NULL; - firstvalue = NULL; + firstflag = nullptr; + firstvalue = nullptr; - pair = NULL; - npartner = NULL; - partner = NULL; - valuepartner = NULL; + pair = nullptr; + npartner = nullptr; + partner = nullptr; + valuepartner = nullptr; } /* ---------------------------------------------------------------------- */ @@ -172,7 +172,7 @@ void FixNeighHistory::init() void FixNeighHistory::allocate_pages() { int create = 0; - if (ipage_atom == NULL) create = 1; + if (ipage_atom == nullptr) create = 1; if (pgsize != neighbor->pgsize) create = 1; if (oneatom != neighbor->oneatom) create = 1; @@ -279,7 +279,7 @@ void FixNeighHistory::pre_exchange_onesided() n = npartner[i]; partner[i] = ipage_atom->get(n); valuepartner[i] = dpage_atom->get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) + if (partner[i] == nullptr || valuepartner[i] == nullptr) error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } @@ -383,7 +383,7 @@ void FixNeighHistory::pre_exchange_newton() n = npartner[i]; partner[i] = ipage_atom->get(n); valuepartner[i] = dpage_atom->get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) { + if (partner[i] == nullptr || valuepartner[i] == nullptr) { error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } } @@ -392,7 +392,7 @@ void FixNeighHistory::pre_exchange_newton() n = npartner[i]; partner[i] = ipage_atom->get(n); valuepartner[i] = dpage_atom->get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) { + if (partner[i] == nullptr || valuepartner[i] == nullptr) { error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } } @@ -506,7 +506,7 @@ void FixNeighHistory::pre_exchange_no_newton() n = npartner[i]; partner[i] = ipage_atom->get(n); valuepartner[i] = dpage_atom->get(dnum*n); - if (partner[i] == NULL || valuepartner[i] == NULL) + if (partner[i] == nullptr || valuepartner[i] == nullptr) error->one(FLERR,"Neighbor history overflow, boost neigh_modify one"); } @@ -864,9 +864,9 @@ int FixNeighHistory::pack_restart(int i, double *buf) void FixNeighHistory::unpack_restart(int nlocal, int nth) { - // ipage_atom = NULL if being called from granular pair style init() + // ipage_atom = nullptr if being called from granular pair style init() - if (ipage_atom == NULL) allocate_pages(); + if (ipage_atom == nullptr) allocate_pages(); // skip to Nth set of extra values // unpack the Nth first values this way because other fixes pack them diff --git a/src/fix_nh.cpp b/src/fix_nh.cpp index 0e3dc8931fc35435bb047308c52c7f1a97bad508..aa353b19a2b7eda7fa18594139035a5b4a290a54 100644 --- a/src/fix_nh.cpp +++ b/src/fix_nh.cpp @@ -51,10 +51,10 @@ enum{ISO,ANISO,TRICLINIC}; FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - rfix(NULL), id_dilate(NULL), irregular(NULL), id_temp(NULL), id_press(NULL), - eta(NULL), eta_dot(NULL), eta_dotdot(NULL), - eta_mass(NULL), etap(NULL), etap_dot(NULL), etap_dotdot(NULL), - etap_mass(NULL) + rfix(nullptr), id_dilate(nullptr), irregular(nullptr), id_temp(nullptr), id_press(nullptr), + eta(nullptr), eta_dot(nullptr), eta_dotdot(nullptr), + eta_mass(nullptr), etap(nullptr), etap_dot(nullptr), etap_dotdot(nullptr), + etap_mass(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix nvt/npt/nph command"); @@ -72,7 +72,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : pcouple = NONE; drag = 0.0; allremap = 1; - id_dilate = NULL; + id_dilate = nullptr; mtchain = mpchain = 3; nc_tchain = nc_pchain = 1; mtk_flag = 1; @@ -88,8 +88,8 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : tcomputeflag = 0; pcomputeflag = 0; - id_temp = NULL; - id_press = NULL; + id_temp = nullptr; + id_press = nullptr; // turn on tilt factor scaling, whenever applicable @@ -579,10 +579,10 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : } nrigid = 0; - rfix = NULL; + rfix = nullptr; if (pre_exchange_flag) irregular = new Irregular(lmp); - else irregular = NULL; + else irregular = nullptr; // initialize vol0,t0 to zero to signal uninitialized // values then assigned in init(), if necessary @@ -740,7 +740,7 @@ void FixNH::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigid++; @@ -767,7 +767,7 @@ void FixNH::setup(int /*vflag*/) // If no thermostat or using fix nphug, // t_target must be defined by other means. - if (tstat_flag && strstr(style,"nphug") == NULL) { + if (tstat_flag && strstr(style,"nphug") == nullptr) { compute_temp_target(); } else if (pstat_flag) { @@ -1768,7 +1768,7 @@ void *FixNH::extract(const char *str, int &dim) } else if (pstat_flag && strcmp(str,"p_target") == 0) { return &p_target; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/fix_numdiff.cpp b/src/fix_numdiff.cpp index 42f5f193ea0d02c66560e711fe2b6797ab01f373..b05d36a5794543a4df19c3e5f2375967d0e5edbf 100644 --- a/src/fix_numdiff.cpp +++ b/src/fix_numdiff.cpp @@ -40,8 +40,8 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixNumDiff::FixNumDiff(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), id_pe(NULL), numdiff_forces(NULL), - temp_x(NULL), temp_f(NULL) + Fix(lmp, narg, arg), id_pe(nullptr), numdiff_forces(nullptr), + temp_x(nullptr), temp_f(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix numdiff command"); diff --git a/src/fix_press_berendsen.cpp b/src/fix_press_berendsen.cpp index a90bf86c56a3ea0898f8c5aebcede87a030d5918..a156c0d5888348a708ff0728ebefd6440af834c5 100644 --- a/src/fix_press_berendsen.cpp +++ b/src/fix_press_berendsen.cpp @@ -37,7 +37,7 @@ enum{ISO,ANISO}; FixPressBerendsen::FixPressBerendsen(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - id_temp(NULL), id_press(NULL), tflag(0), pflag(0) + id_temp(nullptr), id_press(nullptr), tflag(0), pflag(0) { if (narg < 5) error->all(FLERR,"Illegal fix press/berendsen command"); @@ -239,7 +239,7 @@ FixPressBerendsen::FixPressBerendsen(LAMMPS *lmp, int narg, char **arg) : pflag = 1; nrigid = 0; - rfix = NULL; + rfix = nullptr; } /* ---------------------------------------------------------------------- */ @@ -308,7 +308,7 @@ void FixPressBerendsen::init() delete [] rfix; nrigid = 0; - rfix = NULL; + rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigid++; diff --git a/src/fix_print.cpp b/src/fix_print.cpp index 78fceea1841dbeb4d0063cefb88ae4ae6398e071..c8a7c8e610dbaccdc2cb9cb15a1b712fe5c0cb82 100644 --- a/src/fix_print.cpp +++ b/src/fix_print.cpp @@ -29,7 +29,7 @@ using namespace FixConst; FixPrint::FixPrint(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - fp(NULL), string(NULL), copy(NULL), work(NULL), var_print(NULL) + fp(nullptr), string(nullptr), copy(nullptr), work(nullptr), var_print(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix print command"); if (strstr(arg[3],"v_") == arg[3]) { @@ -54,9 +54,9 @@ FixPrint::FixPrint(LAMMPS *lmp, int narg, char **arg) : // parse optional args - fp = NULL; + fp = nullptr; screenflag = 1; - char *title = NULL; + char *title = nullptr; int iarg = 5; while (iarg < narg) { @@ -65,7 +65,7 @@ FixPrint::FixPrint(LAMMPS *lmp, int narg, char **arg) : if (me == 0) { if (strcmp(arg[iarg],"file") == 0) fp = fopen(arg[iarg+1],"w"); else fp = fopen(arg[iarg+1],"a"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix print file {}: {}", arg[iarg+1], utils::getsyserror())); } diff --git a/src/fix_property_atom.cpp b/src/fix_property_atom.cpp index c20a9dc0291fe373e5785a744336b2c49c0c895d..41de71152b4bf06b554dc27d6dae99433a2b82bf 100644 --- a/src/fix_property_atom.cpp +++ b/src/fix_property_atom.cpp @@ -30,7 +30,7 @@ enum{MOLECULE,CHARGE,RMASS,INTEGER,DOUBLE}; FixPropertyAtom::FixPropertyAtom(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvalue(0), style(NULL), index(NULL), astyle(NULL) + nvalue(0), style(nullptr), index(nullptr), astyle(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix property/atom command"); @@ -152,21 +152,21 @@ FixPropertyAtom::~FixPropertyAtom() if (border) atom->delete_callback(id,Atom::BORDER); // deallocate per-atom vectors in Atom class - // set ptrs to NULL, so they no longer exist for Atom class + // set ptrs to a null pointer, so they no longer exist for Atom class for (int m = 0; m < nvalue; m++) { if (style[m] == MOLECULE) { atom->molecule_flag = 0; memory->destroy(atom->molecule); - atom->molecule = NULL; + atom->molecule = nullptr; } else if (style[m] == CHARGE) { atom->q_flag = 0; memory->destroy(atom->q); - atom->q = NULL; + atom->q = nullptr; } else if (style[m] == RMASS) { atom->rmass_flag = 0; memory->destroy(atom->rmass); - atom->rmass = NULL; + atom->rmass = nullptr; } else if (style[m] == INTEGER) { atom->remove_custom(0,index[m]); } else if (style[m] == DOUBLE) { @@ -237,13 +237,13 @@ void FixPropertyAtom::read_data_section(char *keyword, int n, char *buf, next = strchr(buf,'\n'); values[0] = strtok(buf," \t\n\r\f"); - if (values[0] == NULL) + if (values[0] == nullptr) error->all(FLERR,fmt::format("Too few lines in {} section of data file",keyword)); int format_ok = 1; for (j = 1; j < nwords; j++) { - values[j] = strtok(NULL," \t\n\r\f"); - if (values[j] == NULL) format_ok = 0; + values[j] = strtok(nullptr," \t\n\r\f"); + if (values[j] == nullptr) format_ok = 0; } if (!format_ok) error->all(FLERR,fmt::format("Incorrect {} format in data file",keyword)); diff --git a/src/fix_read_restart.cpp b/src/fix_read_restart.cpp index 7fa799c04ae005903006fcbd3505ced547eb0f28..6fa215711350a3958ffb243157e5b2a6cdee9ff3 100644 --- a/src/fix_read_restart.cpp +++ b/src/fix_read_restart.cpp @@ -23,7 +23,7 @@ using namespace FixConst; FixReadRestart::FixReadRestart(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - count(NULL), extra(NULL) + count(nullptr), extra(nullptr) { nextra = utils::inumeric(FLERR,arg[3],false,lmp); int nfix = utils::inumeric(FLERR,arg[4],false,lmp); diff --git a/src/fix_respa.cpp b/src/fix_respa.cpp index 0c71912ffa56178f9335fa386f978bcc6e675bf6..a17c79abc7561dd491626d76716a408d59a724ab 100644 --- a/src/fix_respa.cpp +++ b/src/fix_respa.cpp @@ -25,7 +25,7 @@ using namespace FixConst; FixRespa::FixRespa(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - store_torque(0), f_level(NULL), t_level(NULL) + store_torque(0), f_level(nullptr), t_level(nullptr) { // nlevels = # of rRESPA levels @@ -41,8 +41,8 @@ FixRespa::FixRespa(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based arrays // register with Atom class - f_level = NULL; - t_level = NULL; + f_level = nullptr; + t_level = nullptr; grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); } diff --git a/src/fix_restrain.cpp b/src/fix_restrain.cpp index 266b0c60e18f69721307cfb2229bd55c3a69fab3..ad0877ba4cb6520a76171f2a44aad1bbaa582fdd 100644 --- a/src/fix_restrain.cpp +++ b/src/fix_restrain.cpp @@ -45,9 +45,9 @@ enum{BOND,LBOUND,ANGLE,DIHEDRAL}; FixRestrain::FixRestrain(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - rstyle(NULL), mult(NULL), ids(NULL), kstart(NULL), kstop(NULL), - deqstart(NULL), deqstop(NULL), target(NULL), cos_target(NULL), - sin_target(NULL) + rstyle(nullptr), mult(nullptr), ids(nullptr), kstart(nullptr), kstop(nullptr), + deqstart(nullptr), deqstop(nullptr), target(nullptr), cos_target(nullptr), + sin_target(nullptr) { if (narg < 4) error->all(FLERR,"Illegal fix restrain command"); diff --git a/src/fix_setforce.cpp b/src/fix_setforce.cpp index 229890c5df7eb6cc1b5a5f9e67207844d7d88b74..3acd44964679c9c43321fa8d99a28bf75abfdf23 100644 --- a/src/fix_setforce.cpp +++ b/src/fix_setforce.cpp @@ -35,7 +35,7 @@ enum{NONE,CONSTANT,EQUAL,ATOM}; FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xstr(NULL), ystr(NULL), zstr(NULL), idregion(NULL), sforce(NULL) + xstr(nullptr), ystr(nullptr), zstr(nullptr), idregion(nullptr), sforce(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix setforce command"); @@ -46,7 +46,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) : extvector = 1; respa_level_support = 1; ilevel_respa = nlevels_respa = 0; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; @@ -82,7 +82,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) : // optional args iregion = -1; - idregion = NULL; + idregion = nullptr; int iarg = 6; while (iarg < narg) { @@ -228,7 +228,7 @@ void FixSetForce::post_force(int /*vflag*/) // update region if necessary - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); @@ -305,7 +305,7 @@ void FixSetForce::post_force_respa(int vflag, int ilevel, int /*iloop*/) foriginal[1] += foriginal_saved[1]; foriginal[2] += foriginal_saved[2]; } else { - Region *region = NULL; + Region *region = nullptr; if (iregion >= 0) { region = domain->regions[iregion]; region->prematch(); diff --git a/src/fix_spring.cpp b/src/fix_spring.cpp index 2d695add269c413160ea823606a789aafc6025e1..ac08cbb497497d942b4ce2ad3895d83caf078789 100644 --- a/src/fix_spring.cpp +++ b/src/fix_spring.cpp @@ -37,7 +37,7 @@ enum{TETHER,COUPLE}; FixSpring::FixSpring(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - group2(NULL) + group2(nullptr) { if (narg < 9) error->all(FLERR,"Illegal fix spring command"); diff --git a/src/fix_spring_chunk.cpp b/src/fix_spring_chunk.cpp index d8de88bd637b8b47c85cc6bcaa6ecb16b379fb14..b7ffea3d6891190ed87976da6017cd694aafbe7b 100644 --- a/src/fix_spring_chunk.cpp +++ b/src/fix_spring_chunk.cpp @@ -35,7 +35,7 @@ using namespace FixConst; FixSpringChunk::FixSpringChunk(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idchunk(NULL), idcom(NULL), com0(NULL), fcom(NULL) + idchunk(nullptr), idcom(nullptr), com0(nullptr), fcom(nullptr) { if (narg != 6) error->all(FLERR,"Illegal fix spring/chunk command"); @@ -155,7 +155,7 @@ void FixSpringChunk::post_force(int /*vflag*/) // will be unlocked in destructor // necessary b/c this fix stores original COM - if (com0 == NULL) cchunk->lock(this,update->ntimestep,-1); + if (com0 == nullptr) cchunk->lock(this,update->ntimestep,-1); // calculate current centers of mass for each chunk // extract pointers from idchunk and idcom @@ -170,7 +170,7 @@ void FixSpringChunk::post_force(int /*vflag*/) // check if first time cchunk was queried via ccom // if so, allocate com0,fcom and store initial COM - if (com0 == NULL) { + if (com0 == nullptr) { memory->create(com0,nchunk,3,"spring/chunk:com0"); memory->create(fcom,nchunk,3,"spring/chunk:fcom"); diff --git a/src/fix_spring_rg.cpp b/src/fix_spring_rg.cpp index 5715e7eb887035e146a1fb61d886f7d374de5224..6cd8637a5c1c6978de1ed05e646b499149fc9ac4 100644 --- a/src/fix_spring_rg.cpp +++ b/src/fix_spring_rg.cpp @@ -67,7 +67,7 @@ void FixSpringRG::init() { masstotal = group->mass(igroup); - // if rg0 was specified as NULL, compute current Rg + // Compute current Rg // only occurs on 1st run if (rg0_flag) { diff --git a/src/fix_spring_self.cpp b/src/fix_spring_self.cpp index 54e20ca2859de76b3f399413df4d38b893a7d526..2e5ca0962fc5d7450512756e049d7baa8bfd04ba 100644 --- a/src/fix_spring_self.cpp +++ b/src/fix_spring_self.cpp @@ -33,7 +33,7 @@ using namespace FixConst; FixSpringSelf::FixSpringSelf(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - xoriginal(NULL) + xoriginal(nullptr) { if ((narg < 4) || (narg > 5)) error->all(FLERR,"Illegal fix spring/self command"); @@ -70,7 +70,7 @@ FixSpringSelf::FixSpringSelf(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based array // register with Atom class - xoriginal = NULL; + xoriginal = nullptr; grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); atom->add_callback(Atom::RESTART); diff --git a/src/fix_store.cpp b/src/fix_store.cpp index adb0985ff2aa688c3b3f350cd0b6c1d4bbfc124e..e1d102aff036c4b695e1dbc0400eb0faea1ea008 100644 --- a/src/fix_store.cpp +++ b/src/fix_store.cpp @@ -28,7 +28,7 @@ enum{UNKNOWN,GLOBAL,PERATOM}; /* ---------------------------------------------------------------------- */ FixStore::FixStore(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -vstore(NULL), astore(NULL), rbuf(NULL) +vstore(nullptr), astore(nullptr), rbuf(nullptr) { if (narg != 6) error->all(FLERR,"Illegal fix store command"); @@ -69,8 +69,8 @@ vstore(NULL), astore(NULL), rbuf(NULL) if (nvalues == 1) vecflag = 1; } - vstore = NULL; - astore = NULL; + vstore = nullptr; + astore = nullptr; // allocate vector or array and restart buffer rbuf // for PERATOM, register with Atom class @@ -84,7 +84,7 @@ vstore(NULL), astore(NULL), rbuf(NULL) grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); if (restart_peratom) atom->add_callback(Atom::RESTART); - rbuf = NULL; + rbuf = nullptr; } // zero the storage @@ -145,8 +145,8 @@ void FixStore::reset_global(int nrow_caller, int ncol_caller) memory->destroy(vstore); memory->destroy(astore); memory->destroy(rbuf); - vstore = NULL; - astore = NULL; + vstore = nullptr; + astore = nullptr; vecflag = 0; if (ncol_caller == 1) vecflag = 1; @@ -199,8 +199,8 @@ void FixStore::restart(char *buf) memory->destroy(vstore); memory->destroy(astore); memory->destroy(rbuf); - vstore = NULL; - astore = NULL; + vstore = nullptr; + astore = nullptr; vecflag = 0; if (ncol_restart == 1) vecflag = 1; diff --git a/src/fix_store_force.cpp b/src/fix_store_force.cpp index 5c25f0e162870357939ee12de4e18916a4cf7a10..ae01848d7b0e74fd0bd41841baba019093a12332 100644 --- a/src/fix_store_force.cpp +++ b/src/fix_store_force.cpp @@ -26,7 +26,7 @@ using namespace FixConst; FixStoreForce::FixStoreForce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - foriginal(NULL) + foriginal(nullptr) { if (narg < 3) error->all(FLERR,"Illegal fix store/coord command"); diff --git a/src/fix_store_state.cpp b/src/fix_store_state.cpp index de76276905cd761c9b0962f0eeee6991dc41557b..79c9c18ed3814a6b7698ff8d295c8b3f92c2918d 100644 --- a/src/fix_store_state.cpp +++ b/src/fix_store_state.cpp @@ -38,9 +38,9 @@ enum{KEYWORD,COMPUTE,FIX,VARIABLE,DNAME,INAME}; FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), - ids(NULL), values(NULL), - vbuf(NULL), pack_choice(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), + ids(nullptr), values(nullptr), + vbuf(nullptr), pack_choice(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix store/state command"); @@ -64,7 +64,7 @@ FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) : int iarg = 4; while (iarg < narg) { which[nvalues] = KEYWORD; - ids[nvalues] = NULL; + ids[nvalues] = nullptr; if (strcmp(arg[iarg],"id") == 0) { pack_choice[nvalues++] = &FixStoreState::pack_id; @@ -348,7 +348,7 @@ FixStoreState::FixStoreState(LAMMPS *lmp, int narg, char **arg) : // perform initial allocation of atom-based array // register with Atom class - values = NULL; + values = nullptr; grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); atom->add_callback(Atom::RESTART); @@ -479,7 +479,7 @@ void FixStoreState::end_of_step() // fill vector or array with per-atom values if (values) vbuf = &values[0][0]; - else vbuf = NULL; + else vbuf = nullptr; for (int m = 0; m < nvalues; m++) { if (which[m] == KEYWORD && kflag) (this->*pack_choice[m])(m); @@ -572,7 +572,7 @@ void FixStoreState::grow_arrays(int nmax) memory->grow(values,nmax,nvalues,"store/state:values"); if (nvalues == 1) { if (nmax) vector_atom = &values[0][0]; - else vector_atom = NULL; + else vector_atom = nullptr; } else array_atom = values; } diff --git a/src/fix_temp_berendsen.cpp b/src/fix_temp_berendsen.cpp index ec2965d072f668dd7cae71f52deb541307e92e5c..610cc7310a6eee747e64fc42d88419ea638bca62 100644 --- a/src/fix_temp_berendsen.cpp +++ b/src/fix_temp_berendsen.cpp @@ -37,7 +37,7 @@ enum{CONSTANT,EQUAL}; FixTempBerendsen::FixTempBerendsen(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - tstr(NULL), id_temp(NULL), tflag(0) + tstr(nullptr), id_temp(nullptr), tflag(0) { if (narg != 6) error->all(FLERR,"Illegal fix temp/berendsen command"); @@ -50,7 +50,7 @@ FixTempBerendsen::FixTempBerendsen(LAMMPS *lmp, int narg, char **arg) : global_freq = nevery; extscalar = 1; - tstr = NULL; + tstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; tstr = new char[n]; @@ -280,5 +280,5 @@ void *FixTempBerendsen::extract(const char *str, int &dim) if (strcmp(str,"t_target") == 0) { return &t_target; } - return NULL; + return nullptr; } diff --git a/src/fix_temp_csld.cpp b/src/fix_temp_csld.cpp index cf7e9e9fe289b49d3cfcd4011e715783ee41833d..c8016f3200583533244b557c011cfa3ab53ade31 100644 --- a/src/fix_temp_csld.cpp +++ b/src/fix_temp_csld.cpp @@ -43,7 +43,7 @@ enum{CONSTANT,EQUAL}; FixTempCSLD::FixTempCSLD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - vhold(NULL), tstr(NULL), id_temp(NULL), random(NULL) + vhold(nullptr), tstr(nullptr), id_temp(nullptr), random(nullptr) { if (narg != 7) error->all(FLERR,"Illegal fix temp/csld command"); @@ -56,7 +56,7 @@ FixTempCSLD::FixTempCSLD(LAMMPS *lmp, int narg, char **arg) : dynamic_group_allow = 1; extscalar = 1; - tstr = NULL; + tstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; tstr = new char[n]; @@ -90,7 +90,7 @@ FixTempCSLD::FixTempCSLD(LAMMPS *lmp, int narg, char **arg) : modify->add_compute(cmd); tflag = 1; - vhold = NULL; + vhold = nullptr; nmax = -1; energy = 0.0; } @@ -108,7 +108,7 @@ FixTempCSLD::~FixTempCSLD() delete random; memory->destroy(vhold); - vhold = NULL; + vhold = nullptr; nmax = -1; } @@ -350,5 +350,5 @@ void *FixTempCSLD::extract(const char *str, int &dim) if (strcmp(str,"t_target") == 0) { return &t_target; } - return NULL; + return nullptr; } diff --git a/src/fix_temp_csvr.cpp b/src/fix_temp_csvr.cpp index c6209051028df466b4a0bf26a78f55c3904e7612..649f0d987055e85117700e3cb88af12e1011ab63 100644 --- a/src/fix_temp_csvr.cpp +++ b/src/fix_temp_csvr.cpp @@ -120,7 +120,7 @@ double FixTempCSVR::resamplekin(double ekin_old, double ekin_new){ FixTempCSVR::FixTempCSVR(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - tstr(NULL), id_temp(NULL), random(NULL) + tstr(nullptr), id_temp(nullptr), random(nullptr) { if (narg != 7) error->all(FLERR,"Illegal fix temp/csvr command"); @@ -133,7 +133,7 @@ FixTempCSVR::FixTempCSVR(LAMMPS *lmp, int narg, char **arg) : dynamic_group_allow = 1; extscalar = 1; - tstr = NULL; + tstr = nullptr; if (strstr(arg[3],"v_") == arg[3]) { int n = strlen(&arg[3][2]) + 1; tstr = new char[n]; @@ -383,5 +383,5 @@ void *FixTempCSVR::extract(const char *str, int &dim) if (strcmp(str,"t_target") == 0) { return &t_target; } - return NULL; + return nullptr; } diff --git a/src/fix_temp_rescale.cpp b/src/fix_temp_rescale.cpp index b5cb9c9a1b54e3f8350401c8c669e248949d1862..bd3ae9ecdce4d1f561622b5c268d12d599e3d5d4 100644 --- a/src/fix_temp_rescale.cpp +++ b/src/fix_temp_rescale.cpp @@ -37,7 +37,7 @@ enum{CONSTANT,EQUAL}; FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - tstr(NULL), id_temp(NULL), tflag(0) + tstr(nullptr), id_temp(nullptr), tflag(0) { if (narg < 8) error->all(FLERR,"Illegal fix temp/rescale command"); @@ -50,7 +50,7 @@ FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) : extscalar = 1; dynamic_group_allow = 1; - tstr = NULL; + tstr = nullptr; if (strstr(arg[4],"v_") == arg[4]) { int n = strlen(&arg[4][2]) + 1; tstr = new char[n]; @@ -278,5 +278,5 @@ void *FixTempRescale::extract(const char *str, int &dim) dim = 0; return &t_target; } - return NULL; + return nullptr; } diff --git a/src/fix_tmd.cpp b/src/fix_tmd.cpp index 74273ea69e35a9a3fc54daee6953b843d48e097c..5f925b9d934836bbceffe2b3f26e39d1fcb682eb 100644 --- a/src/fix_tmd.cpp +++ b/src/fix_tmd.cpp @@ -41,7 +41,7 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ FixTMD::FixTMD(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), -nfileevery(0), fp(NULL), xf(NULL), xold(NULL) +nfileevery(0), fp(nullptr), xf(nullptr), xold(nullptr) { if (narg < 6) error->all(FLERR,"Illegal fix tmd command"); @@ -74,7 +74,7 @@ nfileevery(0), fp(NULL), xf(NULL), xold(NULL) if (narg != 7) error->all(FLERR,"Illegal fix tmd command"); if (me == 0) { fp = fopen(arg[6],"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open fix tmd file {}: {}", arg[6], utils::getsyserror())); fprintf(fp,"%s %s\n","# Step rho_target rho_old gamma_back", @@ -396,7 +396,7 @@ void FixTMD::readfile(char *file) int firstline = 1; int ncount = 0; - char *eof = NULL; + char *eof = nullptr; xprd = yprd = zprd = -1.0; do { @@ -404,7 +404,7 @@ void FixTMD::readfile(char *file) m = 0; for (nlines = 0; nlines < CHUNK; nlines++) { eof = fgets(&buffer[m],MAXLINE,fp); - if (eof == NULL) break; + if (eof == nullptr) break; m += strlen(&buffer[m]); } if (buffer[m-1] != '\n') strcpy(&buffer[m++],"\n"); @@ -486,7 +486,7 @@ void FixTMD::readfile(char *file) } bufptr = next + 1; } - } while (eof != NULL); + } while (eof != nullptr); // clean up @@ -540,7 +540,7 @@ void FixTMD::open(char *file) #endif } - if (fp == NULL) { + if (fp == nullptr) { char str[128]; snprintf(str,128,"Cannot open file %s",file); error->one(FLERR,str); diff --git a/src/fix_vector.cpp b/src/fix_vector.cpp index 6bcdfe948e7af095fbee19fc12159c7d5708fbf4..141f00e65ecb0c8ff298ed56dc93bde51479e525 100644 --- a/src/fix_vector.cpp +++ b/src/fix_vector.cpp @@ -38,7 +38,7 @@ enum{SCALAR,VECTOR}; FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - nvalues(0), which(NULL), argindex(NULL), value2index(NULL), ids(NULL), vector(NULL), array(NULL) + nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), ids(nullptr), vector(nullptr), array(nullptr) { if (narg < 5) error->all(FLERR,"Illegal fix vector command"); @@ -154,8 +154,8 @@ FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) : // ncount = current size of vector or array - vector = NULL; - array = NULL; + vector = nullptr; + array = nullptr; ncount = ncountmax = 0; if (nvalues == 1) size_vector = 0; else size_array_rows = 0; diff --git a/src/fix_viscous.cpp b/src/fix_viscous.cpp index 08649280d87c30a23a475cc33941f8d4893ba58b..d07d547c29ca8fb15fb3879e98e4b394a006fa3b 100644 --- a/src/fix_viscous.cpp +++ b/src/fix_viscous.cpp @@ -27,7 +27,7 @@ using namespace FixConst; FixViscous::FixViscous(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - gamma(NULL) + gamma(nullptr) { dynamic_group_allow = 1; diff --git a/src/fix_wall.cpp b/src/fix_wall.cpp index cb822f10909cc2eec8d2dd968d30353f11724490..2394922e26cf68741eb4f68655566669f635e17d 100644 --- a/src/fix_wall.cpp +++ b/src/fix_wall.cpp @@ -51,7 +51,7 @@ FixWall::FixWall(LAMMPS *lmp, int narg, char **arg) : fldflag = 0; int pbcflag = 0; - for (int i = 0; i < 6; i++) xstr[i] = estr[i] = sstr[i] = NULL; + for (int i = 0; i < 6; i++) xstr[i] = estr[i] = sstr[i] = nullptr; int iarg = 3; while (iarg < narg) { diff --git a/src/fix_wall_region.cpp b/src/fix_wall_region.cpp index fc3735cfbfb6f49082644753346f88f80fa09e1a..6ec3a27a5813abf06de444c67c5780b6af54024c 100644 --- a/src/fix_wall_region.cpp +++ b/src/fix_wall_region.cpp @@ -34,7 +34,7 @@ enum{LJ93,LJ126,LJ1043,COLLOID,HARMONIC,MORSE}; FixWallRegion::FixWallRegion(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), - idregion(NULL) + idregion(nullptr) { if (narg < 8) error->all(FLERR,"Illegal fix wall/region command"); diff --git a/src/force.cpp b/src/force.cpp index 11c21df752f056e795b86e23af3e9558a874c299..3547f7c964102e2ebe3d785b128d7c912f3b6e42 100644 --- a/src/force.cpp +++ b/src/force.cpp @@ -54,12 +54,12 @@ Force::Force(LAMMPS *lmp) : Pointers(lmp) qqr2e_lammps_real = 332.06371; // these constants are toggled qqr2e_charmm_real = 332.0716; // by new CHARMM pair styles - pair = NULL; - bond = NULL; - angle = NULL; - dihedral = NULL; - improper = NULL; - kspace = NULL; + pair = nullptr; + bond = nullptr; + angle = nullptr; + dihedral = nullptr; + improper = nullptr; + kspace = nullptr; char *str = (char *) "none"; int n = strlen(str) + 1; @@ -76,7 +76,7 @@ Force::Force(LAMMPS *lmp) : Pointers(lmp) kspace_style = new char[n]; strcpy(kspace_style,str); - pair_restart = NULL; + pair_restart = nullptr; create_factories(); } @@ -159,12 +159,12 @@ Force::~Force() if (improper) delete improper; if (kspace) delete kspace; - pair = NULL; - bond = NULL; - angle = NULL; - dihedral = NULL; - improper = NULL; - kspace = NULL; + pair = nullptr; + bond = nullptr; + angle = nullptr; + dihedral = nullptr; + improper = nullptr; + kspace = nullptr; delete pair_map; delete bond_map; @@ -233,9 +233,9 @@ void Force::create_pair(const std::string &style, int trysuffix) delete [] pair_style; if (pair) delete pair; if (pair_restart) delete [] pair_restart; - pair_style = NULL; - pair = NULL; - pair_restart = NULL; + pair_style = nullptr; + pair = nullptr; + pair_restart = nullptr; int sflag; pair = new_pair(style,trysuffix,sflag); @@ -270,7 +270,7 @@ Pair *Force::new_pair(const std::string &style, int trysuffix, int &sflag) } sflag = 0; - if (style == "none") return NULL; + if (style == "none") return nullptr; if (pair_map->find(style) != pair_map->end()) { PairCreator &pair_creator = (*pair_map)[style]; return pair_creator(lmp); @@ -278,7 +278,7 @@ Pair *Force::new_pair(const std::string &style, int trysuffix, int &sflag) error->all(FLERR,utils::check_packages_for_style("pair",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -296,7 +296,7 @@ Pair *Force::pair_creator(LAMMPS *lmp) if exact, then style name must be exact match to word if not exact, style name must contain word if nsub > 0, match Nth hybrid sub-style - return NULL if no match or if nsub=0 and multiple sub-styles match + return nullptr if no match or if nsub=0 and multiple sub-styles match ------------------------------------------------------------------------- */ Pair *Force::pair_match(const std::string &word, int exact, int nsub) @@ -318,13 +318,13 @@ Pair *Force::pair_match(const std::string &word, int exact, int nsub) if (count == 1) return hybrid->styles[iwhich]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- return style name of Pair class that matches Pair ptr called by Neighbor::print_neigh_info() - return NULL if no match + return nullptr if no match ------------------------------------------------------------------------- */ char *Force::pair_match_ptr(Pair *ptr) @@ -337,7 +337,7 @@ char *Force::pair_match_ptr(Pair *ptr) if (ptr == hybrid->styles[i]) return hybrid->keywords[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -381,7 +381,7 @@ Bond *Force::new_bond(const std::string &style, int trysuffix, int &sflag) } sflag = 0; - if (style == "none") return NULL; + if (style == "none") return nullptr; if (bond_map->find(style) != bond_map->end()) { BondCreator &bond_creator = (*bond_map)[style]; return bond_creator(lmp); @@ -389,7 +389,7 @@ Bond *Force::new_bond(const std::string &style, int trysuffix, int &sflag) error->all(FLERR,utils::check_packages_for_style("bond",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -414,7 +414,7 @@ Bond *Force::bond_match(const std::string &style) for (int i = 0; i < hybrid->nstyles; i++) if (style == hybrid->keywords[i]) return hybrid->styles[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -458,7 +458,7 @@ Angle *Force::new_angle(const std::string &style, int trysuffix, int &sflag) } sflag = 0; - if (style == "none") return NULL; + if (style == "none") return nullptr; if (angle_map->find(style) != angle_map->end()) { AngleCreator &angle_creator = (*angle_map)[style]; return angle_creator(lmp); @@ -466,7 +466,7 @@ Angle *Force::new_angle(const std::string &style, int trysuffix, int &sflag) error->all(FLERR,utils::check_packages_for_style("angle",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -491,7 +491,7 @@ Angle *Force::angle_match(const std::string &style) for (int i = 0; i < hybrid->nstyles; i++) if (style == hybrid->keywords[i]) return hybrid->styles[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -535,7 +535,7 @@ Dihedral *Force::new_dihedral(const std::string &style, int trysuffix, int &sfla } sflag = 0; - if (style == "none") return NULL; + if (style == "none") return nullptr; if (dihedral_map->find(style) != dihedral_map->end()) { DihedralCreator &dihedral_creator = (*dihedral_map)[style]; return dihedral_creator(lmp); @@ -543,7 +543,7 @@ Dihedral *Force::new_dihedral(const std::string &style, int trysuffix, int &sfla error->all(FLERR,utils::check_packages_for_style("dihedral",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -568,7 +568,7 @@ Dihedral *Force::dihedral_match(const std::string &style) for (int i = 0; i < hybrid->nstyles; i++) if (style == hybrid->keywords[i]) return hybrid->styles[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -612,7 +612,7 @@ Improper *Force::new_improper(const std::string &style, int trysuffix, int &sfla } sflag = 0; - if (style == "none") return NULL; + if (style == "none") return nullptr; if (improper_map->find(style) != improper_map->end()) { ImproperCreator &improper_creator = (*improper_map)[style]; return improper_creator(lmp); @@ -620,7 +620,7 @@ Improper *Force::new_improper(const std::string &style, int trysuffix, int &sfla error->all(FLERR,utils::check_packages_for_style("improper",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -645,7 +645,7 @@ Improper *Force::improper_match(const std::string &style) for (int i = 0; i < hybrid->nstyles; i++) if (style == hybrid->keywords[i]) return hybrid->styles[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -689,7 +689,7 @@ KSpace *Force::new_kspace(const std::string &style, int trysuffix, int &sflag) } sflag = 0; - if (style == "none") return NULL; + if (style == "none") return nullptr; if (kspace_map->find(style) != kspace_map->end()) { KSpaceCreator &kspace_creator = (*kspace_map)[style]; return kspace_creator(lmp); @@ -697,7 +697,7 @@ KSpace *Force::new_kspace(const std::string &style, int trysuffix, int &sflag) error->all(FLERR,utils::check_packages_for_style("kspace",style,lmp)); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -714,14 +714,14 @@ KSpace *Force::kspace_creator(LAMMPS *lmp) return ptr to Kspace class if matches word if exact, then style name must be exact match to word if not exact, style name must contain word - return NULL if no match + return nullptr if no match ------------------------------------------------------------------------- */ KSpace *Force::kspace_match(const std::string &word, int exact) { if (exact && (word == kspace_style)) return kspace; else if (!exact && utils::strmatch(kspace_style,word)) return kspace; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/group.cpp b/src/group.cpp index a2e20a6ab173ba2a07dcbf22e053c61dddd1d226..6b9121f506122019697488dc410a4533c5af8ea8 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -58,7 +58,7 @@ Group::Group(LAMMPS *lmp) : Pointers(lmp) inversemask = new int[MAX_GROUP]; dynamic = new int[MAX_GROUP]; - for (int i = 0; i < MAX_GROUP; i++) names[i] = NULL; + for (int i = 0; i < MAX_GROUP; i++) names[i] = nullptr; for (int i = 0; i < MAX_GROUP; i++) bitmask[i] = 1 << i; for (int i = 0; i < MAX_GROUP; i++) inversemask[i] = bitmask[i] ^ ~0; for (int i = 0; i < MAX_GROUP; i++) dynamic[i] = 0; @@ -126,7 +126,7 @@ void Group::assign(int narg, char **arg) modify->delete_fix(std::string("GROUP_") + names[igroup]); delete [] names[igroup]; - names[igroup] = NULL; + names[igroup] = nullptr; dynamic[igroup] = 0; ngroup--; @@ -235,8 +235,8 @@ void Group::assign(int narg, char **arg) bound2 = utils::tnumeric(FLERR,arg[4],false,lmp); } else if (narg != 4) error->all(FLERR,"Illegal group command"); - int *attribute = NULL; - tagint *tattribute = NULL; + int *attribute = nullptr; + tagint *tattribute = nullptr; if (category == TYPE) attribute = atom->type; else if (category == MOLECULE) tattribute = atom->molecule; else if (category == ID) tattribute = atom->tag; @@ -296,8 +296,8 @@ void Group::assign(int narg, char **arg) // args = list of values } else { - int *attribute = NULL; - tagint *tattribute = NULL; + int *attribute = nullptr; + tagint *tattribute = nullptr; if (category == TYPE) attribute = atom->type; else if (category == MOLECULE) tattribute = atom->molecule; else if (category == ID) tattribute = atom->tag; @@ -310,9 +310,9 @@ void Group::assign(int narg, char **arg) if (strchr(arg[iarg],':')) { ptr = strtok(arg[iarg],":"); start = utils::tnumeric(FLERR,ptr,false,lmp); - ptr = strtok(NULL,":"); + ptr = strtok(nullptr,":"); stop = utils::tnumeric(FLERR,ptr,false,lmp); - ptr = strtok(NULL,":"); + ptr = strtok(nullptr,":"); if (ptr) delta = utils::tnumeric(FLERR,ptr,false,lmp); } else { start = stop = utils::tnumeric(FLERR,arg[iarg],false,lmp); @@ -617,7 +617,7 @@ int Group::find_or_create(const char *name) int Group::find_unused() { for (int igroup = 0; igroup < MAX_GROUP; igroup++) - if (names[igroup] == NULL) return igroup; + if (names[igroup] == nullptr) return igroup; return -1; } @@ -654,7 +654,7 @@ void Group::add_molecules(int /*igroup*/, int bit) for (pos = hash->begin(); pos != hash->end(); ++pos) list[n++] = pos->first; molbit = bit; - comm->ring(n,sizeof(tagint),list,1,molring,NULL,(void *)this); + comm->ring(n,sizeof(tagint),list,1,molring,nullptr,(void *)this); delete hash; memory->destroy(list); @@ -724,7 +724,7 @@ void Group::read_restart(FILE *fp) for (i = 0; i < MAX_GROUP; i++) delete [] names[i]; - if (me == 0) utils::sfread(FLERR,&ngroup,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&ngroup,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&ngroup,1,MPI_INT,0,world); // use count to not change restart format with deleted groups @@ -733,17 +733,17 @@ void Group::read_restart(FILE *fp) int count = 0; for (i = 0; i < MAX_GROUP; i++) { if (count == ngroup) { - names[i] = NULL; + names[i] = nullptr; continue; } - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); if (n) { names[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,names[i],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,names[i],sizeof(char),n,fp,nullptr,error); MPI_Bcast(names[i],n,MPI_CHAR,0,world); count++; - } else names[i] = NULL; + } else names[i] = nullptr; } } diff --git a/src/image.cpp b/src/image.cpp index 755be587d887e3de11b7d3c101232e4c781f85e1..6912bdee806214acef02aebfa6aaa3e7b820024f 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -74,8 +74,8 @@ Image::Image(LAMMPS *lmp, int nmap_caller) : Pointers(lmp) // colors ncolors = 0; - username = NULL; - userrgb = NULL; + username = nullptr; + userrgb = nullptr; boxcolor = color2rgb("yellow"); background[0] = background[1] = background[2] = 0; @@ -112,7 +112,7 @@ Image::Image(LAMMPS *lmp, int nmap_caller) : Pointers(lmp) backLightColor[1] = 0.9; backLightColor[2] = 0.9; - random = NULL; + random = nullptr; } /* ---------------------------------------------------------------------- */ @@ -1029,13 +1029,13 @@ void Image::write_PNG(FILE *fp) png_structp png_ptr; png_infop info_ptr; - png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); if (!png_ptr) return; info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { - png_destroy_write_struct(&png_ptr, NULL); + png_destroy_write_struct(&png_ptr, nullptr); return; } @@ -1166,7 +1166,7 @@ int Image::addcolor(char *name, double r, double g, double b) if index < 0, return ptr to -index-1 color from userrgb if index = 0, search the 2 lists of color names for the string color search user-defined color names first, then the list of NCOLORS names - return a pointer to the 3 floating point RGB values or NULL if didn't find + return a pointer to the 3 floating point RGB values or nullptr if didn't find ------------------------------------------------------------------------- */ double *Image::color2rgb(const char *color, int index) @@ -1458,11 +1458,11 @@ double *Image::color2rgb(const char *color, int index) }; if (index > 0) { - if (index > NCOLORS) return NULL; + if (index > NCOLORS) return nullptr; return rgb[index-1]; } if (index < 0) { - if (-index > ncolors) return NULL; + if (-index > ncolors) return nullptr; return userrgb[-index-1]; } @@ -1472,7 +1472,7 @@ double *Image::color2rgb(const char *color, int index) for (int i = 0; i < NCOLORS; i++) if (strcmp(color,name[i]) == 0) return rgb[i]; } - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -1620,7 +1620,7 @@ double *Image::element2color(char *element) for (int i = 0; i < NELEMENTS; i++) if (strcmp(element,name[i]) == 0) return rgb[i]; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -1791,13 +1791,13 @@ int ColorMap::reset(int narg, char **arg) if (n+1 > narg) return 1; mentry[i].color = image->color2rgb(arg[n]); } else if (expandflag == 1) { - mentry[i].color = image->color2rgb(NULL,i+1); + mentry[i].color = image->color2rgb(nullptr,i+1); } else if (expandflag == 2) { - mentry[i].color = image->color2rgb(NULL,-(i+1)); + mentry[i].color = image->color2rgb(nullptr,-(i+1)); } n += 1; } - if (mentry[i].color == NULL) return 1; + if (mentry[i].color == nullptr) return 1; } if (mstyle == CONTINUOUS) { @@ -1915,5 +1915,5 @@ double *ColorMap::value2color(double value) return mentry[ibin%nentry].color; } - return NULL; + return nullptr; } diff --git a/src/improper.cpp b/src/improper.cpp index ad79a1a9725b12e5071bb0c0fbd97a26fdbc3853..c657530a40a2b464352ad3615b5dc15fe05440c1 100644 --- a/src/improper.cpp +++ b/src/improper.cpp @@ -33,10 +33,10 @@ Improper::Improper(LAMMPS *lmp) : Pointers(lmp) suffix_flag = Suffix::NONE; maxeatom = maxvatom = maxcvatom = 0; - eatom = NULL; - vatom = NULL; - cvatom = NULL; - setflag = NULL; + eatom = nullptr; + vatom = nullptr; + cvatom = nullptr; + setflag = nullptr; execution_space = Host; datamask_read = ALL_MASK; diff --git a/src/improper_hybrid.cpp b/src/improper_hybrid.cpp index 096e0c36142f8dc74d6d9265544dce82d74d24d5..474d8c0c5a4ce2b442a479ed33a1087cd2eb528d 100644 --- a/src/improper_hybrid.cpp +++ b/src/improper_hybrid.cpp @@ -160,7 +160,7 @@ void ImproperHybrid::allocate() maximproper = new int[nstyles]; improperlist = new int**[nstyles]; for (int m = 0; m < nstyles; m++) maximproper[m] = 0; - for (int m = 0; m < nstyles; m++) improperlist[m] = NULL; + for (int m = 0; m < nstyles; m++) improperlist[m] = nullptr; } /* ---------------------------------------------------------------------- */ @@ -325,7 +325,7 @@ void ImproperHybrid::write_restart(FILE *fp) void ImproperHybrid::read_restart(FILE *fp) { int me = comm->me; - if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nstyles,1,MPI_INT,0,world); styles = new Improper*[nstyles]; keywords = new char*[nstyles]; @@ -334,10 +334,10 @@ void ImproperHybrid::read_restart(FILE *fp) int n,dummy; for (int m = 0; m < nstyles; m++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); keywords[m] = new char[n]; - if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,nullptr,error); MPI_Bcast(keywords[m],n,MPI_CHAR,0,world); styles[m] = force->new_improper(keywords[m],0,dummy); styles[m]->read_restart_settings(fp); diff --git a/src/info.cpp b/src/info.cpp index cdd769fdeb41c018df1edd162714070fed43b115..890919fdbf687a4d952030966eeb5d5362df75ca 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -259,10 +259,10 @@ void Info::command(int narg, char **arg) } } - if (out == NULL) return; + if (out == nullptr) return; fputs("\nInfo-Info-Info-Info-Info-Info-Info-Info-Info-Info-Info\n",out); - time_t now = time(NULL); + time_t now = time(nullptr); fmt::print(out,"Printed on {}\n",ctime(&now)); if (flags & CONFIG) { @@ -774,7 +774,7 @@ void Info::command_styles(FILE *out) bool Info::is_active(const char *category, const char *name) { - if ((category == NULL) || (name == NULL)) return false; + if ((category == nullptr) || (name == nullptr)) return false; const char *style = "none"; if (strcmp(category,"package") == 0) { @@ -795,7 +795,7 @@ bool Info::is_active(const char *category, const char *name) else error->all(FLERR,"Unknown name for info newton category"); } else if (strcmp(category,"pair") == 0) { - if (force->pair == NULL) return false; + if (force->pair == nullptr) return false; if (strcmp(name,"single") == 0) return (force->pair->single_enable != 0); else if (strcmp(name,"respa") == 0) return (force->pair->respa_enable != 0); else if (strcmp(name,"manybody") == 0) return (force->pair->manybody_flag != 0); @@ -849,7 +849,7 @@ bool Info::is_active(const char *category, const char *name) bool Info::is_available(const char *category, const char *name) { - if ((category == NULL) || (name == NULL)) return false; + if ((category == nullptr) || (name == nullptr)) return false; if (has_style(category, name)) { return true; @@ -879,7 +879,7 @@ bool Info::is_available(const char *category, const char *name) bool Info::is_defined(const char *category, const char *name) { - if ((category == NULL) || (name == NULL)) return false; + if ((category == nullptr) || (name == nullptr)) return false; if (strcmp(category,"compute") == 0) { int ncompute = modify->ncompute; @@ -1119,7 +1119,7 @@ bool Info::has_exceptions() { } bool Info::has_package(const char * package_name) { - for(int i = 0; LAMMPS::installed_packages[i] != NULL; ++i) { + for(int i = 0; LAMMPS::installed_packages[i] != nullptr; ++i) { if(strcmp(package_name, LAMMPS::installed_packages[i]) == 0) { return true; } diff --git a/src/input.cpp b/src/input.cpp index 451442a7bd2736254897ad07fc04e88726791cda..78086906c5fbe11ed6c41e831ed73b331aaaaee9 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -96,15 +96,15 @@ Input::Input(LAMMPS *lmp, int argc, char **argv) : Pointers(lmp) MPI_Comm_rank(world,&me); maxline = maxcopy = maxwork = 0; - line = copy = work = NULL; + line = copy = work = nullptr; narg = maxarg = 0; - arg = NULL; + arg = nullptr; echo_screen = 0; echo_log = 1; label_active = 0; - labelstr = NULL; + labelstr = nullptr; jump_skip = 0; if (me == 0) { @@ -112,7 +112,7 @@ Input::Input(LAMMPS *lmp, int argc, char **argv) : Pointers(lmp) maxfile = 16; infiles = new FILE *[maxfile]; infiles[0] = infile; - } else infiles = NULL; + } else infiles = nullptr; variable = new Variable(lmp); @@ -196,7 +196,7 @@ void Input::file() // end of file reached, so break // n == 0 if nothing read, else n = line with str terminator - if (fgets(&line[m],maxline-m,infile) == NULL) { + if (fgets(&line[m],maxline-m,infile) == nullptr) { if (m) n = strlen(line) + 1; else n = 0; break; @@ -252,7 +252,7 @@ void Input::file() // if no command, skip to next line in input script parse(); - if (command == NULL) continue; + if (command == nullptr) continue; // if scanning for label, skip command unless it's a label command @@ -292,7 +292,7 @@ void Input::file(const char *filename) error->one(FLERR,"Too many nested levels of input scripts"); infile = fopen(filename,"r"); - if (infile == NULL) + if (infile == nullptr) error->one(FLERR,fmt::format("Cannot open input script {}: {}", filename, utils::getsyserror())); @@ -317,7 +317,7 @@ void Input::file(const char *filename) This function takes the text in *single*, makes a copy, parses that, executes the command and returns the name of the command (without the arguments). If there was no command in *single* it will return -``NULL``. +``nullptr``. \endverbatim * @@ -338,14 +338,14 @@ char *Input::one(const std::string &single) } // parse the line - // if no command, just return NULL + // if no command, just return a null pointer parse(); - if (command == NULL) return NULL; + if (command == nullptr) return nullptr; // if scanning for label, skip command unless it's a label command - if (label_active && strcmp(command,"label") != 0) return NULL; + if (label_active && strcmp(command,"label") != 0) return nullptr; // execute the command and return its name @@ -423,7 +423,7 @@ void Input::parse() char *next; command = nextword(copy,&next); - if (command == NULL) return; + if (command == nullptr) return; // point arg[] at each subsequent arg in copy string // nextword() inserts string terminators into copy string to delimit args @@ -450,7 +450,7 @@ void Input::parse() treat text between single/double/triple quotes as one arg matching quote must be followed by whitespace char if not end of string strip quotes from returned word - return ptr to start of word or NULL if no word in string + return ptr to start of word or null pointer if no word in string also return next = ptr after word ------------------------------------------------------------------------- */ @@ -461,16 +461,16 @@ char *Input::nextword(char *str, char **next) // start = first non-whitespace char start = &str[strspn(str," \t\n\v\f\r")]; - if (*start == '\0') return NULL; + if (*start == '\0') return nullptr; // if start is single/double/triple quote: // start = first char beyond quote // stop = first char of matching quote // next = first char beyond matching quote - // next must be NULL or whitespace + // next must be null char or whitespace // if start is not single/double/triple quote: // stop = first whitespace char after start - // next = char after stop, or stop itself if stop is NULL + // next = char after stop, or stop itself if stop is null char if (strstr(start,"\"\"\"") == start) { stop = strstr(&start[3],"\"\"\""); @@ -492,7 +492,7 @@ char *Input::nextword(char *str, char **next) else *next = stop+1; } - // set stop to NULL to terminate word + // set stop to null char to terminate word *stop = '\0'; return start; @@ -510,9 +510,9 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag) // use str2 as scratch space to expand str, then copy back to str // reallocate str and str2 as necessary // do not replace $ inside single/double/triple quotes - // var = pts at variable name, ended by NULL - // if $ is followed by '{', trailing '}' becomes NULL - // else $x becomes x followed by NULL + // var = pts at variable name, ended by null char + // if $ is followed by '{', trailing '}' becomes null char + // else $x becomes x followed by null char // beyond = points to text following variable int i,n,paren_count; @@ -593,7 +593,7 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag) value = variable->retrieve(var); } - if (value == NULL) + if (value == nullptr) error->one(FLERR,fmt::format("Substitution for illegal " "variable {}",var)); @@ -950,7 +950,7 @@ void Input::include() error->one(FLERR,"Too many nested levels of input scripts"); infile = fopen(arg[0],"r"); - if (infile == NULL) + if (infile == nullptr) error->one(FLERR,fmt::format("Cannot open input script {}: {}", arg[0], utils::getsyserror())); @@ -984,7 +984,7 @@ void Input::jump() else { if (infile && infile != stdin) fclose(infile); infile = fopen(arg[0],"r"); - if (infile == NULL) + if (infile == nullptr) error->one(FLERR,fmt::format("Cannot open input script {}: {}", arg[0], utils::getsyserror())); @@ -1023,12 +1023,12 @@ void Input::log() if (me == 0) { if (logfile) fclose(logfile); - if (strcmp(arg[0],"none") == 0) logfile = NULL; + if (strcmp(arg[0],"none") == 0) logfile = nullptr; else { if (appendflag) logfile = fopen(arg[0],"a"); else logfile = fopen(arg[0],"w"); - if (logfile == NULL) + if (logfile == nullptr) error->one(FLERR,fmt::format("Cannot open logfile {}: {}", arg[0], utils::getsyserror())); @@ -1063,8 +1063,8 @@ void Input::partition() strcpy(copy,line); char *ptr = strtok(copy," \t\n\r\f"); - ptr = strtok(NULL," \t\n\r\f"); - ptr = strtok(NULL," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); + ptr = strtok(nullptr," \t\n\r\f"); ptr += strlen(ptr) + 1; ptr += strspn(ptr," \t\n\r\f"); @@ -1094,7 +1094,7 @@ void Input::print() // parse optional args - FILE *fp = NULL; + FILE *fp = nullptr; int screenflag = 1; int universeflag = 0; @@ -1103,10 +1103,10 @@ void Input::print() if (strcmp(arg[iarg],"file") == 0 || strcmp(arg[iarg],"append") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal print command"); if (me == 0) { - if (fp != NULL) fclose(fp); + if (fp != nullptr) fclose(fp); if (strcmp(arg[iarg],"file") == 0) fp = fopen(arg[iarg+1],"w"); else fp = fopen(arg[iarg+1],"a"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open print file {}: {}", arg[iarg+1], utils::getsyserror())); } @@ -1237,9 +1237,9 @@ void Input::shell() char *ptr = strdup(arg[i]); rv = 0; #ifdef _WIN32 - if (ptr != NULL) rv = _putenv(ptr); + if (ptr != nullptr) rv = _putenv(ptr); #else - if (ptr != NULL) rv = putenv(ptr); + if (ptr != nullptr) rv = putenv(ptr); #endif rv = (rv < 0) ? errno : 0; MPI_Reduce(&rv,&err,1,MPI_INT,MPI_MAX,0,world); @@ -1291,7 +1291,7 @@ void Input::angle_coeff() { if (domain->box_exist == 0) error->all(FLERR,"Angle_coeff command before simulation box is defined"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Angle_coeff command before angle_style is defined"); if (atom->avec->angles_allow == 0) error->all(FLERR,"Angle_coeff command when no angles allowed"); @@ -1332,7 +1332,7 @@ void Input::bond_coeff() { if (domain->box_exist == 0) error->all(FLERR,"Bond_coeff command before simulation box is defined"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Bond_coeff command before bond_style is defined"); if (atom->avec->bonds_allow == 0) error->all(FLERR,"Bond_coeff command when no bonds allowed"); @@ -1356,7 +1356,7 @@ void Input::bond_write() { if (atom->avec->bonds_allow == 0) error->all(FLERR,"Bond_write command when no bonds allowed"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Bond_write command before bond_style is defined"); else force->bond->write_file(narg,arg); } @@ -1435,7 +1435,7 @@ void Input::dihedral_coeff() { if (domain->box_exist == 0) error->all(FLERR,"Dihedral_coeff command before simulation box is defined"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR,"Dihedral_coeff command before dihedral_style is defined"); if (atom->avec->dihedrals_allow == 0) error->all(FLERR,"Dihedral_coeff command when no dihedrals allowed"); @@ -1512,7 +1512,7 @@ void Input::improper_coeff() { if (domain->box_exist == 0) error->all(FLERR,"Improper_coeff command before simulation box is defined"); - if (force->improper == NULL) + if (force->improper == nullptr) error->all(FLERR,"Improper_coeff command before improper_style is defined"); if (atom->avec->impropers_allow == 0) error->all(FLERR,"Improper_coeff command when no impropers allowed"); @@ -1534,7 +1534,7 @@ void Input::improper_style() void Input::kspace_modify() { - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"KSpace style has not yet been set"); force->kspace->modify_params(narg,arg); } @@ -1650,7 +1650,7 @@ void Input::package() modify->add_fix(fixcmd); } else if (strcmp(arg[0],"kokkos") == 0) { - if (lmp->kokkos == NULL || lmp->kokkos->kokkos_exists == 0) + if (lmp->kokkos == nullptr || lmp->kokkos->kokkos_exists == 0) error->all(FLERR, "Package kokkos command without KOKKOS package enabled"); lmp->kokkos->accelerator(narg-1,&arg[1]); @@ -1682,7 +1682,7 @@ void Input::pair_coeff() { if (domain->box_exist == 0) error->all(FLERR,"Pair_coeff command before simulation box is defined"); - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Pair_coeff command before pair_style is defined"); force->pair->coeff(narg,arg); } @@ -1691,7 +1691,7 @@ void Input::pair_coeff() void Input::pair_modify() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Pair_modify command before pair_style is defined"); force->pair->modify_params(narg,arg); } @@ -1729,7 +1729,7 @@ void Input::pair_style() void Input::pair_write() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Pair_write command before pair_style is defined"); force->pair->write_file(narg,arg); } diff --git a/src/integrate.cpp b/src/integrate.cpp index 1f50ff76c5427133b4e55878590a7180aa8b4680..720e8ba2760fa41baa684394aed9a86239bfdb44 100644 --- a/src/integrate.cpp +++ b/src/integrate.cpp @@ -25,8 +25,8 @@ using namespace LAMMPS_NS; Integrate::Integrate(LAMMPS *lmp, int /*narg*/, char **/*arg*/) : Pointers(lmp) { - elist_global = elist_atom = NULL; - vlist_global = vlist_atom = cvlist_atom = NULL; + elist_global = elist_atom = nullptr; + vlist_global = vlist_atom = cvlist_atom = nullptr; external_force_clear = 0; } @@ -74,8 +74,8 @@ void Integrate::ev_setup() delete [] vlist_global; delete [] vlist_atom; delete [] cvlist_atom; - elist_global = elist_atom = NULL; - vlist_global = vlist_atom = cvlist_atom = NULL; + elist_global = elist_atom = nullptr; + vlist_global = vlist_atom = cvlist_atom = nullptr; nelist_global = nelist_atom = 0; nvlist_global = nvlist_atom = ncvlist_atom = 0; diff --git a/src/irregular.cpp b/src/irregular.cpp index 47ee864abc9a5a9d4cfbb0fe7beb1d5cd97f6531..25815709864cb90d5707c74c1e8d20990640352a 100644 --- a/src/irregular.cpp +++ b/src/irregular.cpp @@ -52,15 +52,15 @@ Irregular::Irregular(LAMMPS *lmp) : Pointers(lmp) // migrate work vectors maxlocal = 0; - mproclist = NULL; - msizes = NULL; + mproclist = nullptr; + msizes = nullptr; // send buffers maxdbuf = 0; - dbuf = NULL; + dbuf = nullptr; maxbuf = 0; - buf = NULL; + buf = nullptr; // universal work vectors @@ -70,7 +70,7 @@ Irregular::Irregular(LAMMPS *lmp) : Pointers(lmp) // initialize buffers for migrate atoms, not used for datum comm // these can persist for multiple irregular operations - buf_send = buf_recv = NULL; + buf_send = buf_recv = nullptr; maxsend = maxrecv = BUFMIN; bufextra = BUFEXTRA; grow_send(maxsend,2); diff --git a/src/irregular.h b/src/irregular.h index 9af6e52557d26121fb6f5bc808fe7d5c3d3fc158..c6ea7bc691b1e8ee95eb985bfa25f269e278ca24 100644 --- a/src/irregular.h +++ b/src/irregular.h @@ -30,7 +30,7 @@ class Irregular : protected Pointers { Irregular(class LAMMPS *); ~Irregular(); void migrate_atoms(int sortflag = 0, int preassign = 0, - int *procassign = NULL); + int *procassign = nullptr); int migrate_check(); int create_data(int, int *, int sortflag = 0); int create_data_grouped(int, int *, int sortflag = 0); diff --git a/src/kspace.cpp b/src/kspace.cpp index e51cc54c973a3e8e4d86c5a54e52466e7d36aad0..117ae5465ff9511a786f8eab992ee49b7eeebc0a 100644 --- a/src/kspace.cpp +++ b/src/kspace.cpp @@ -86,8 +86,8 @@ KSpace::KSpace(LAMMPS *lmp) : Pointers(lmp) splittol = 1.0e-6; maxeatom = maxvatom = 0; - eatom = NULL; - vatom = NULL; + eatom = nullptr; + vatom = nullptr; execution_space = Host; datamask_read = ALL_MASK; @@ -188,7 +188,7 @@ void KSpace::compute_dummy(int eflag, int vflag) void KSpace::pair_check() { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"KSpace solver requires a pair style"); if (ewaldflag && !force->pair->ewaldflag) @@ -610,5 +610,5 @@ void KSpace::modify_params(int narg, char **arg) void *KSpace::extract(const char *str) { if (strcmp(str,"scale") == 0) return (void *) &scale; - return NULL; + return nullptr; } diff --git a/src/lammps.cpp b/src/lammps.cpp index f6952354ba260e73ddbbb892c83099e846964f64..1d655f6fc4ecbc218a64480f099b6f6680455e0f 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -105,22 +105,22 @@ using namespace LAMMPS_NS; * \param communicator MPI communicator used by this LAMMPS instance */ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : - memory(NULL), error(NULL), universe(NULL), input(NULL), atom(NULL), - update(NULL), neighbor(NULL), comm(NULL), domain(NULL), force(NULL), - modify(NULL), group(NULL), output(NULL), timer(NULL), kokkos(NULL), - atomKK(NULL), memoryKK(NULL), python(NULL), citeme(NULL) + memory(nullptr), error(nullptr), universe(nullptr), input(nullptr), atom(nullptr), + update(nullptr), neighbor(nullptr), comm(nullptr), domain(nullptr), force(nullptr), + modify(nullptr), group(nullptr), output(nullptr), timer(nullptr), kokkos(nullptr), + atomKK(nullptr), memoryKK(nullptr), python(nullptr), citeme(nullptr) { memory = new Memory(this); error = new Error(this); universe = new Universe(this,communicator); clientserver = 0; - cslib = NULL; + cslib = nullptr; cscomm = 0; - screen = NULL; - logfile = NULL; - infile = NULL; + screen = nullptr; + logfile = nullptr; + infile = nullptr; initclock = MPI_Wtime(); @@ -170,19 +170,19 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : int citeflag = 1; int helpflag = 0; - suffix = suffix2 = NULL; + suffix = suffix2 = nullptr; suffix_enable = 0; if (arg) exename = arg[0]; - else exename = NULL; - packargs = NULL; + else exename = nullptr; + packargs = nullptr; num_package = 0; - char *restartfile = NULL; + char *restartfile = nullptr; int wfirst,wlast; int kkfirst,kklast; int npack = 0; - int *pfirst = NULL; - int *plast = NULL; + int *pfirst = nullptr; + int *plast = nullptr; iarg = 1; while (iarg < narg) { @@ -348,7 +348,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : error->universe_all(FLERR,"Invalid command-line argument"); delete [] suffix; delete [] suffix2; - suffix = suffix2 = NULL; + suffix = suffix2 = nullptr; suffix_enable = 1; // hybrid option to set fall-back for suffix2 if (strcmp(arg[iarg+1],"hybrid") == 0) { @@ -380,7 +380,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : // if no partition command-line switch, universe is one world with all procs - if (universe->existflag == 0) universe->add_world(NULL); + if (universe->existflag == 0) universe->add_world(nullptr); // sum of procs in all worlds must equal total # of procs @@ -409,10 +409,10 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : if (screenflag == 0) universe->uscreen = stdout; else if (strcmp(arg[screenflag],"none") == 0) - universe->uscreen = NULL; + universe->uscreen = nullptr; else { universe->uscreen = fopen(arg[screenflag],"w"); - if (universe->uscreen == NULL) + if (universe->uscreen == nullptr) error->universe_one(FLERR,fmt::format("Cannot open universe screen " "file {}: {}",arg[screenflag], utils::getsyserror())); @@ -420,15 +420,15 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : if (logflag == 0) { if (helpflag == 0) { universe->ulogfile = fopen("log.lammps","w"); - if (universe->ulogfile == NULL) + if (universe->ulogfile == nullptr) error->universe_warn(FLERR,"Cannot open log.lammps for writing: " + utils::getsyserror()); } } else if (strcmp(arg[logflag],"none") == 0) - universe->ulogfile = NULL; + universe->ulogfile = nullptr; else { universe->ulogfile = fopen(arg[logflag],"w"); - if (universe->ulogfile == NULL) + if (universe->ulogfile == nullptr) error->universe_one(FLERR,fmt::format("Cannot open universe log " "file {}: {}",arg[logflag], utils::getsyserror())); @@ -437,8 +437,8 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : if (universe->me > 0) { if (screenflag == 0) universe->uscreen = stdout; - else universe->uscreen = NULL; - universe->ulogfile = NULL; + else universe->uscreen = nullptr; + universe->ulogfile = nullptr; } // make universe and single world the same, since no partition switch @@ -454,7 +454,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : if (universe->me == 0) { if (inflag == 0) infile = stdin; else infile = fopen(arg[inflag],"r"); - if (infile == NULL) + if (infile == nullptr) error->one(FLERR,fmt::format("Cannot open input script {}: {}", arg[inflag], utils::getsyserror())); } @@ -472,31 +472,31 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : MPI_Comm_split(universe->uworld,universe->iworld,0,&world); MPI_Comm_rank(world,&me); - screen = logfile = infile = NULL; + screen = logfile = infile = nullptr; if (me == 0) { std::string str; if (partscreenflag == 0) { if (screenflag == 0) { str = fmt::format("screen.{}",universe->iworld); screen = fopen(str.c_str(),"w"); - if (screen == NULL) + if (screen == nullptr) error->one(FLERR,fmt::format("Cannot open screen file {}: {}", str,utils::getsyserror())); } else if (strcmp(arg[screenflag],"none") == 0) { - screen = NULL; + screen = nullptr; } else { str = fmt::format("{}.{}",arg[screenflag],universe->iworld); screen = fopen(str.c_str(),"w"); - if (screen == NULL) + if (screen == nullptr) error->one(FLERR,fmt::format("Cannot open screen file {}: {}", arg[screenflag],utils::getsyserror())); } } else if (strcmp(arg[partscreenflag],"none") == 0) { - screen = NULL; + screen = nullptr; } else { str = fmt::format("{}.{}",arg[partscreenflag],universe->iworld); screen = fopen(str.c_str(),"w"); - if (screen == NULL) + if (screen == nullptr) error->one(FLERR,fmt::format("Cannot open screen file {}: {}", str,utils::getsyserror())); } @@ -505,30 +505,30 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : if (logflag == 0) { str = fmt::format("log.lammps.{}",universe->iworld); logfile = fopen(str.c_str(),"w"); - if (logfile == NULL) + if (logfile == nullptr) error->one(FLERR,fmt::format("Cannot open logfile {}: {}", str, utils::getsyserror())); } else if (strcmp(arg[logflag],"none") == 0) { - logfile = NULL; + logfile = nullptr; } else { str = fmt::format("{}.{}",arg[logflag],universe->iworld); logfile = fopen(str.c_str(),"w"); - if (logfile == NULL) + if (logfile == nullptr) error->one(FLERR,fmt::format("Cannot open logfile {}: {}", str, utils::getsyserror())); } } else if (strcmp(arg[partlogflag],"none") == 0) { - logfile = NULL; + logfile = nullptr; } else { str = fmt::format("{}.{}",arg[partlogflag],universe->iworld); logfile = fopen(str.c_str(),"w"); - if (logfile == NULL) + if (logfile == nullptr) error->one(FLERR,fmt::format("Cannot open logfile {}: {}", str, utils::getsyserror())); } infile = fopen(arg[inflag],"r"); - if (infile == NULL) + if (infile == nullptr) error->one(FLERR,fmt::format("Cannot open input script {}: {}", arg[inflag], utils::getsyserror())); } @@ -590,7 +590,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : // instantiation creates dummy Kokkos class if KOKKOS is not installed // add args between kkfirst and kklast to Kokkos instantiation - kokkos = NULL; + kokkos = nullptr; if (kokkosflag == 1) { kokkos = new KokkosLMP(this,kklast-kkfirst,&arg[kkfirst]); if (!kokkos->kokkos_exists) @@ -600,7 +600,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : // allocate CiteMe class if enabled if (citeflag) citeme = new CiteMe(this); - else citeme = NULL; + else citeme = nullptr; // allocate input class now that MPI is fully setup @@ -616,7 +616,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : packargs[i] = new char*[n+1]; for (int j=0; j < n; ++j) packargs[i][j] = strdup(arg[pfirst[i]+j]); - packargs[i][n] = NULL; + packargs[i][n] = nullptr; } memory->destroy(pfirst); memory->destroy(plast); @@ -668,14 +668,14 @@ LAMMPS::~LAMMPS() if (num_package) { for (int i = 0; i < num_package; i++) { - for (char **ptr = packargs[i]; *ptr != NULL; ++ptr) + for (char **ptr = packargs[i]; *ptr != nullptr; ++ptr) free(*ptr); delete[] packargs[i]; } delete[] packargs; } num_package = 0; - packargs = NULL; + packargs = nullptr; double totalclock = MPI_Wtime() - initclock; if ((me == 0) && (screen || logfile)) { @@ -690,14 +690,14 @@ LAMMPS::~LAMMPS() if (universe->nworlds == 1) { if (screen && screen != stdout) fclose(screen); if (logfile) fclose(logfile); - logfile = NULL; - if (screen != stdout) screen = NULL; + logfile = nullptr; + if (screen != stdout) screen = nullptr; } else { if (screen && screen != stdout) fclose(screen); if (logfile) fclose(logfile); if (universe->ulogfile) fclose(universe->ulogfile); - logfile = NULL; - if (screen != stdout) screen = NULL; + logfile = nullptr; + if (screen != stdout) screen = nullptr; } if (infile && infile != stdin) fclose(infile); @@ -733,7 +733,7 @@ LAMMPS::~LAMMPS() void LAMMPS::create() { - force = NULL; // Domain->Lattice checks if Force exists + force = nullptr; // Domain->Lattice checks if Force exists // Comm class must be created before Atom class // so that nthreads is defined when create_avec invokes grow() @@ -755,9 +755,9 @@ void LAMMPS::create() else atom = new Atom(this); if (kokkos) - atom->create_avec("atomic/kk",0,NULL,1); + atom->create_avec("atomic/kk",0,nullptr,1); else - atom->create_avec("atomic",0,NULL,1); + atom->create_avec("atomic",0,nullptr,1); group = new Group(this); force = new Force(this); // must be after group, to create temperature @@ -799,7 +799,7 @@ void LAMMPS::post_create() if (strcmp(suffix,"intel") == 0 && !modify->check_package("INTEL")) error->all(FLERR,"Using suffix intel without USER-INTEL package installed"); if (strcmp(suffix,"kk") == 0 && - (kokkos == NULL || kokkos->kokkos_exists == 0)) + (kokkos == nullptr || kokkos->kokkos_exists == 0)) error->all(FLERR,"Using suffix kk without KOKKOS package enabled"); if (strcmp(suffix,"omp") == 0 && !modify->check_package("OMP")) error->all(FLERR,"Using suffix omp without USER-OMP package installed"); @@ -821,7 +821,7 @@ void LAMMPS::post_create() char str[256]; for (int i = 0; i < num_package; i++) { strcpy(str,"package"); - for (char **ptr = packargs[i]; *ptr != NULL; ++ptr) { + for (char **ptr = packargs[i]; *ptr != nullptr; ++ptr) { if (strlen(str) + strlen(*ptr) + 2 > 256) error->all(FLERR,"Too many -pk arguments in command line"); strcat(str," "); @@ -861,41 +861,41 @@ void LAMMPS::init() void LAMMPS::destroy() { delete update; - update = NULL; + update = nullptr; delete neighbor; - neighbor = NULL; + neighbor = nullptr; delete force; - force = NULL; + force = nullptr; delete group; - group = NULL; + group = nullptr; delete output; - output = NULL; + output = nullptr; delete modify; // modify must come after output, force, update // since they delete fixes - modify = NULL; + modify = nullptr; delete comm; // comm must come after modify // since fix destructors may access comm - comm = NULL; + comm = nullptr; delete domain; // domain must come after modify // since fix destructors access domain - domain = NULL; + domain = nullptr; delete atom; // atom must come after modify, neighbor // since fixes delete callbacks in atom - atom = NULL; + atom = nullptr; delete timer; - timer = NULL; + timer = nullptr; delete python; - python = NULL; + python = nullptr; } /* ---------------------------------------------------------------------- @@ -1011,7 +1011,7 @@ void _noopt LAMMPS::init_pkg_lists() */ bool LAMMPS::is_installed_pkg(const char *pkg) { - for (int i=0; installed_packages[i] != NULL; ++i) + for (int i=0; installed_packages[i] != nullptr; ++i) if (strcmp(installed_packages[i],pkg) == 0) return true; return false; @@ -1053,7 +1053,7 @@ const char *LAMMPS::match_style(const char *style, const char *name) check_for_match(pair,style,name); check_for_match(reader,style,name); check_for_match(region,style,name); - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -1063,7 +1063,7 @@ const char *LAMMPS::match_style(const char *style, const char *name) void _noopt LAMMPS::help() { FILE *fp = screen; - const char *pager = NULL; + const char *pager = nullptr; // if output is "stdout", use a pipe to a pager for paged output. // this will avoid the most important help text to rush past the @@ -1072,7 +1072,7 @@ void _noopt LAMMPS::help() if (fp == stdout) { pager = getenv("PAGER"); - if (pager == NULL) pager = "more"; + if (pager == nullptr) pager = "more"; #if defined(_WIN32) fp = _popen(pager,"w"); #else @@ -1080,9 +1080,9 @@ void _noopt LAMMPS::help() #endif // reset to original state, if pipe command failed - if (fp == NULL) { + if (fp == nullptr) { fp = stdout; - pager = NULL; + pager = nullptr; } } @@ -1236,7 +1236,7 @@ void _noopt LAMMPS::help() // close pipe to pager, if active - if (pager != NULL) pclose(fp); + if (pager != nullptr) pclose(fp); } /* ---------------------------------------------------------------------- @@ -1309,7 +1309,7 @@ void LAMMPS::print_config(FILE *fp) sizeof(tagint)*8, sizeof(bigint)*8); fputs("\nInstalled packages:\n\n",fp); - for (int i = 0; NULL != (pkg = installed_packages[i]); ++i) { + for (int i = 0; nullptr != (pkg = installed_packages[i]); ++i) { ncword = strlen(pkg); if (ncline + ncword > 78) { ncline = 0; diff --git a/src/lattice.cpp b/src/lattice.cpp index 68f3e7abe12050ab4eeee7f95beb9cb924c80049..625e243d646627c60dbe0815be7aeb889ccf20b2 100644 --- a/src/lattice.cpp +++ b/src/lattice.cpp @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) { nbasis = 0; - basis = NULL; + basis = nullptr; // parse style arg @@ -164,7 +164,7 @@ Lattice::Lattice(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) else if (strcmp(arg[iarg+1],"y") == 0) dim = 1; else if (strcmp(arg[iarg+1],"z") == 0) dim = 2; else error->all(FLERR,"Illegal lattice command"); - int *orient = NULL; + int *orient = nullptr; if (dim == 0) orient = orientx; else if (dim == 1) orient = orienty; else if (dim == 2) orient = orientz; diff --git a/src/library.cpp b/src/library.cpp index e7cb8ec1f2477f80ecead68fc79b35f201c38228..eee74b9936fd79e3bb1a1218ecbae3d267d78dfd 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -105,7 +105,7 @@ LAMMPS executable, and an MPI communicator for LAMMPS to run under. Since the list of arguments is **exactly** as when called from the command line, the first argument would be the name of the executable and thus is otherwise ignored. However ``argc`` may be set to 0 and then -``argv`` may be ``NULL``. If MPI is not yet initialized, ``MPI_Init()`` +``argv`` may be ``nullptr``. If MPI is not yet initialized, ``MPI_Init()`` will be called during creation of the LAMMPS class instance. If for some reason the creation or initialization of the LAMMPS instance @@ -117,7 +117,7 @@ fails a null pointer is returned. instance as return value. For backward compatibility it is still possible to provide the address of a pointer variable as final argument *ptr*\ . This use is deprecated and may be removed in - the future. The *ptr* argument may be ``NULL`` and is then ignored. + the future. The *ptr* argument may be ``nullptr`` and is then ignored. .. note:: @@ -133,12 +133,12 @@ fails a null pointer is returned. * \param argv list of command line argument strings * \param comm MPI communicator for this LAMMPS instance * \param ptr pointer to a void pointer variable which serves - * as a handle; may be ``NULL`` + * as a handle; may be ``nullptr`` * \return pointer to new LAMMPS instance cast to ``void *`` */ void *lammps_open(int argc, char **argv, MPI_Comm comm, void **ptr) { - LAMMPS *lmp = NULL; + LAMMPS *lmp = nullptr; lammps_mpi_init(); #ifdef LAMMPS_EXCEPTIONS @@ -149,7 +149,7 @@ void *lammps_open(int argc, char **argv, MPI_Comm comm, void **ptr) } catch(LAMMPSException & e) { fmt::print(stderr, "LAMMPS Exception: {}", e.message); - *ptr = (void *) NULL; + *ptr = nullptr; } #else lmp = new LAMMPS(argc, argv, comm); @@ -183,14 +183,14 @@ fails a null pointer is returned. instance as return value. For backward compatibility it is still possible to provide the address of a pointer variable as final argument *ptr*\ . This use is deprecated and may be removed in - the future. The *ptr* argument may be ``NULL`` and is then ignored. + the future. The *ptr* argument may be ``nullptr`` and is then ignored. \endverbatim * * \param argc number of command line arguments * \param argv list of command line argument strings * \param ptr pointer to a void pointer variable - * which serves as a handle; may be ``NULL`` + * which serves as a handle; may be ``nullptr`` * \return pointer to new LAMMPS instance cast to ``void *`` */ void *lammps_open_no_mpi(int argc, char **argv, void **ptr) @@ -275,7 +275,7 @@ void lammps_mpi_init() if (!flag) { // provide a dummy argc and argv for MPI_Init(). int argc = 1; - char *args[] = { (char *)"liblammps" , NULL }; + char *args[] = { (char *)"liblammps" , nullptr }; char **argv = args; MPI_Init(&argc,&argv); } @@ -375,19 +375,19 @@ string, however, will be treated as part of the command and will **not** start a second command. The function :cpp:func:`lammps_commands_string` processes a string with multiple command lines. -The function returns the name of the command on success or ``NULL`` when +The function returns the name of the command on success or ``nullptr`` when passing a string without a command. \endverbatim * * \param handle pointer to a previously created LAMMPS instance * \param cmd string with a single LAMMPS command - * \return string with parsed command name or ``NULL`` */ + * \return string with parsed command name or ``nullptr`` */ char *lammps_command(void *handle, const char *cmd) { LAMMPS *lmp = (LAMMPS *) handle; - char *result = NULL; + char *result = nullptr; BEGIN_CAPTURE { @@ -671,7 +671,7 @@ double lammps_get_thermo(void *handle, const char *keyword) This function (re-)initializes the simulation box and boundary information and then assign the designated data to the locations in the pointers passed as arguments. Any argument (except the first) may be -a NULL pointer and then will not be assigned. +a nullptr pointer and then will not be assigned. \endverbatim * @@ -1104,7 +1104,7 @@ to be either an ``int`` or an ``int64_t``. This is selected at * \param handle pointer to a previously created LAMMPS instance * \param name string with the name of the extracted property * \return pointer (cast to ``void *``) to the location of the - requested property. NULL if name is not known. */ + requested property. nullptr if name is not known. */ void *lammps_extract_global(void *handle, const char *name) { @@ -1167,7 +1167,7 @@ void *lammps_extract_global(void *handle, const char *name) if (strcmp(name,"femtosecond") == 0) return (void *) &lmp->force->femtosecond; if (strcmp(name,"qelectron") == 0) return (void *) &lmp->force->qelectron; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -1196,7 +1196,7 @@ of the :cpp:func:`Atom::extract() ` function. * \param handle pointer to a previously created LAMMPS instance * \param name string with the name of the extracted property * \return pointer (cast to ``void *``) to the location of the - * requested data or ``NULL`` if not found. */ + * requested data or ``nullptr`` if not found. */ void *lammps_extract_atom(void *handle, const char *name) { @@ -1246,13 +1246,13 @@ X(1),Y(1),Z(1),X(2),Y(2),Z(2),...,X(N),Y(N),Z(N). * * \param handle pointer to a previously created LAMMPS instance * \param n number of atoms, N, to be added to the system - * \param id pointer to N atom IDs; ``NULL`` will generate IDs + * \param id pointer to N atom IDs; ``nullptr`` will generate IDs * \param type pointer to N atom types (required) * \param x pointer to 3N doubles with x-,y-,z- positions of the new atoms (required) * \param v pointer to 3N doubles with x-,y-,z- velocities - of the new atoms (set to 0.0 if ``NULL``) - * \param image pointer to N imageint sets of image flags, or ``NULL`` + of the new atoms (set to 0.0 if ``nullptr``) + * \param image pointer to N imageint sets of image flags, or ``nullptr`` * \param bexpand if 1, atoms outside of shrink-wrap boundaries will still be created and not dropped and the box extended * \return number of atoms created on success; @@ -1300,7 +1300,7 @@ int lammps_create_atoms(void *handle, int n, tagint *id, int *type, xdata[0] = x[3*i]; xdata[1] = x[3*i+1]; xdata[2] = x[3*i+2]; - imageint * img = image ? image + i : NULL; + imageint * img = image ? image + i : nullptr; tagint tag = id ? id[i] : 0; // create atom only on MPI rank that would own it @@ -1321,7 +1321,7 @@ int lammps_create_atoms(void *handle, int n, tagint *id, int *type, // if no tags are given explicitly, create new and unique tags - if (id == NULL) atom->tag_extend(); + if (id == nullptr) atom->tag_extend(); // reset box info, if extended when adding atoms. @@ -1365,7 +1365,7 @@ dimensions of the respective data. Since computes may provide multiple kinds of data, it is required to set style and type flags representing what specific data is desired. This also determines to what kind of pointer the returned pointer needs to be cast to access the data -correctly. The function returns ``NULL`` if the compute ID is not found +correctly. The function returns ``nullptr`` if the compute ID is not found or the requested data is not available or current. The following table lists the available options. @@ -1453,7 +1453,7 @@ be used after other LAMMPS commands have been issued. * \param type constant indicating type of data (scalar, vector, or array) or size of rows or columns * \return pointer (cast to ``void *``) to the location of the - * requested data or ``NULL`` if not found. */ + * requested data or ``nullptr`` if not found. */ void *lammps_extract_compute(void *handle, char *id, int style, int type) { @@ -1462,18 +1462,18 @@ void *lammps_extract_compute(void *handle, char *id, int style, int type) BEGIN_CAPTURE { int icompute = lmp->modify->find_compute(id); - if (icompute < 0) return NULL; + if (icompute < 0) return nullptr; Compute *compute = lmp->modify->compute[icompute]; if (style == LMP_STYLE_GLOBAL) { if (type == LMP_TYPE_SCALAR) { - if (!compute->scalar_flag) return NULL; + if (!compute->scalar_flag) return nullptr; if (compute->invoked_scalar != lmp->update->ntimestep) compute->compute_scalar(); return (void *) &compute->scalar; } if ((type == LMP_TYPE_VECTOR) || (type == LMP_SIZE_VECTOR)) { - if (!compute->vector_flag) return NULL; + if (!compute->vector_flag) return nullptr; if (compute->invoked_vector != lmp->update->ntimestep) compute->compute_vector(); if (type == LMP_TYPE_VECTOR) @@ -1482,7 +1482,7 @@ void *lammps_extract_compute(void *handle, char *id, int style, int type) return (void *) &compute->size_vector; } if ((type == LMP_TYPE_ARRAY) || (type == LMP_SIZE_ROWS) || (type == LMP_SIZE_COLS)) { - if (!compute->array_flag) return NULL; + if (!compute->array_flag) return nullptr; if (compute->invoked_array != lmp->update->ntimestep) compute->compute_array(); if (type == LMP_TYPE_ARRAY) @@ -1495,7 +1495,7 @@ void *lammps_extract_compute(void *handle, char *id, int style, int type) } if (style == LMP_STYLE_ATOM) { - if (!compute->peratom_flag) return NULL; + if (!compute->peratom_flag) return nullptr; if (compute->invoked_peratom != lmp->update->ntimestep) compute->compute_peratom(); if (type == LMP_TYPE_VECTOR) return (void *) compute->vector_atom; @@ -1504,7 +1504,7 @@ void *lammps_extract_compute(void *handle, char *id, int style, int type) } if (style == LMP_STYLE_LOCAL) { - if (!compute->local_flag) return NULL; + if (!compute->local_flag) return nullptr; if (compute->invoked_local != lmp->update->ntimestep) compute->compute_local(); if (type == LMP_TYPE_SCALAR) return (void *) &compute->size_local_rows; /* for backward compatibility */ @@ -1516,7 +1516,7 @@ void *lammps_extract_compute(void *handle, char *id, int style, int type) } END_CAPTURE - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -1533,7 +1533,7 @@ Since individual fixes may provide multiple kinds of data, it is required to set style and type flags representing what specific data is desired. This also determines to what kind of pointer the returned pointer needs to be cast to access the data correctly. The function -returns ``NULL`` if the fix ID is not found or the requested data is not +returns ``nullptr`` if the fix ID is not found or the requested data is not available. .. note:: @@ -1637,7 +1637,7 @@ been issued. * \param nrow row index (only used for global vectors and arrays) * \param ncol column index (only used for global arrays) * \return pointer (cast to ``void *``) to the location of the - * requested data or ``NULL`` if not found. */ + * requested data or ``nullptr`` if not found. */ void *lammps_extract_fix(void *handle, char *id, int style, int type, int nrow, int ncol) @@ -1647,34 +1647,34 @@ void *lammps_extract_fix(void *handle, char *id, int style, int type, BEGIN_CAPTURE { int ifix = lmp->modify->find_fix(id); - if (ifix < 0) return NULL; + if (ifix < 0) return nullptr; Fix *fix = lmp->modify->fix[ifix]; if (style == LMP_STYLE_GLOBAL) { if (type == LMP_TYPE_SCALAR) { - if (!fix->scalar_flag) return NULL; + if (!fix->scalar_flag) return nullptr; double *dptr = (double *) malloc(sizeof(double)); *dptr = fix->compute_scalar(); return (void *) dptr; } if (type == LMP_TYPE_VECTOR) { - if (!fix->vector_flag) return NULL; + if (!fix->vector_flag) return nullptr; double *dptr = (double *) malloc(sizeof(double)); *dptr = fix->compute_vector(nrow); return (void *) dptr; } if (type == LMP_TYPE_ARRAY) { - if (!fix->array_flag) return NULL; + if (!fix->array_flag) return nullptr; double *dptr = (double *) malloc(sizeof(double)); *dptr = fix->compute_array(nrow,ncol); return (void *) dptr; } if (type == LMP_SIZE_VECTOR) { - if (!fix->vector_flag) return NULL; + if (!fix->vector_flag) return nullptr; return (void *) &fix->size_vector; } if ((type == LMP_SIZE_ROWS) || (type == LMP_SIZE_COLS)) { - if (!fix->array_flag) return NULL; + if (!fix->array_flag) return nullptr; if (type == LMP_SIZE_ROWS) return (void *) &fix->size_array_rows; else @@ -1683,14 +1683,14 @@ void *lammps_extract_fix(void *handle, char *id, int style, int type, } if (style == LMP_STYLE_ATOM) { - if (!fix->peratom_flag) return NULL; + if (!fix->peratom_flag) return nullptr; if (type == LMP_TYPE_VECTOR) return (void *) fix->vector_atom; if (type == LMP_TYPE_ARRAY) return (void *) fix->array_atom; if (type == LMP_SIZE_COLS) return (void *) &fix->size_peratom_cols; } if (style == LMP_STYLE_LOCAL) { - if (!fix->local_flag) return NULL; + if (!fix->local_flag) return nullptr; if (type == LMP_TYPE_SCALAR) return (void *) &fix->size_local_rows; if (type == LMP_TYPE_VECTOR) return (void *) fix->vector_local; if (type == LMP_TYPE_ARRAY) return (void *) fix->array_local; @@ -1700,7 +1700,7 @@ void *lammps_extract_fix(void *handle, char *id, int style, int type, } END_CAPTURE - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -1714,9 +1714,9 @@ identified by its name. The variable must be either an *equal*\ -style compatible or an *atom*\ -style variable. Variables of style *internal* are compatible with *equal*\ -style variables and so are *python*\ -style variables, if they return a numeric value. The function returns -``NULL`` when a variable of the provided *name* is not found or of an +``nullptr`` when a variable of the provided *name* is not found or of an incompatible style. The *group* argument is only used for *atom*\ --style variables and ignored otherwise. If set to ``NULL`` when +-style variables and ignored otherwise. If set to ``nullptr`` when extracting data from and *atom*\ -style variable, the group is assumed to be "all". @@ -1730,7 +1730,7 @@ to be "all". .. code-block:: c - double *dptr = (double *) lammps_extract_variable(handle,name,NULL); + double *dptr = (double *) lammps_extract_variable(handle,name,nullptr); double value = *dptr; lammps_free((void *)dptr); @@ -1753,9 +1753,9 @@ values will not be updated, in case the variable is re-evaluated. * * \param handle pointer to a previously created LAMMPS instance * \param name name of the variable - * \param group group-ID for atom style variable or ``NULL`` + * \param group group-ID for atom style variable or ``nullptr`` * \return pointer (cast to ``void *``) to the location of the - * requested data or ``NULL`` if not found. */ + * requested data or ``nullptr`` if not found. */ void *lammps_extract_variable(void *handle, char *name, char *group) { @@ -1764,7 +1764,7 @@ void *lammps_extract_variable(void *handle, char *name, char *group) BEGIN_CAPTURE { int ivar = lmp->input->variable->find(name); - if (ivar < 0) return NULL; + if (ivar < 0) return nullptr; if (lmp->input->variable->equalstyle(ivar)) { double *dptr = (double *) malloc(sizeof(double)); @@ -1773,9 +1773,9 @@ void *lammps_extract_variable(void *handle, char *name, char *group) } if (lmp->input->variable->atomstyle(ivar)) { - if (group == NULL) group = (char *)"all"; + if (group == nullptr) group = (char *)"all"; int igroup = lmp->group->find(group); - if (igroup < 0) return NULL; + if (igroup < 0) return nullptr; int nlocal = lmp->atom->nlocal; double *vector = (double *) malloc(nlocal*sizeof(double)); lmp->input->variable->compute_atom(ivar,igroup,vector,1,0); @@ -1784,7 +1784,7 @@ void *lammps_extract_variable(void *handle, char *name, char *group) } END_CAPTURE - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ @@ -1878,7 +1878,7 @@ void lammps_gather_atoms(void *handle, char *name, int natoms = static_cast (lmp->atom->natoms); void *vptr = lmp->atom->extract(name); - if (vptr == NULL) { + if (vptr == nullptr) { lmp->error->warning(FLERR,"lammps_gather_atoms: unknown property name"); return; } @@ -1888,8 +1888,8 @@ void lammps_gather_atoms(void *handle, char *name, // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgunpack) vector = (int *) vptr; @@ -1927,8 +1927,8 @@ void lammps_gather_atoms(void *handle, char *name, lmp->memory->destroy(copy); } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; @@ -2018,7 +2018,7 @@ void lammps_gather_atoms_concat(void *handle, char *name, int natoms = static_cast (lmp->atom->natoms); void *vptr = lmp->atom->extract(name); - if (vptr == NULL) { + if (vptr == nullptr) { lmp->error->warning(FLERR,"lammps_gather_atoms: unknown property name"); return; } @@ -2032,8 +2032,8 @@ void lammps_gather_atoms_concat(void *handle, char *name, lmp->memory->create(displs,nprocs,"lib/gather:displs"); if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgunpack) vector = (int *) vptr; @@ -2083,8 +2083,8 @@ void lammps_gather_atoms_concat(void *handle, char *name, } } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; @@ -2178,7 +2178,7 @@ void lammps_gather_atoms_subset(void *handle, char *name, } void *vptr = lmp->atom->extract(name); - if (vptr == NULL) { + if (vptr == nullptr) { lmp->error->warning(FLERR,"lammps_gather_atoms_subset: " "unknown property name"); return; @@ -2189,8 +2189,8 @@ void lammps_gather_atoms_subset(void *handle, char *name, // MPI_Allreduce with MPI_SUM to merge into data if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgunpack) vector = (int *) vptr; @@ -2236,8 +2236,8 @@ void lammps_gather_atoms_subset(void *handle, char *name, lmp->memory->destroy(copy); } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; @@ -2329,7 +2329,7 @@ void lammps_scatter_atoms(void *handle, char *name, int natoms = static_cast (lmp->atom->natoms); void *vptr = lmp->atom->extract(name); - if(vptr == NULL) { + if(vptr == nullptr) { lmp->error->warning(FLERR, "lammps_scatter_atoms: unknown property name"); return; @@ -2340,8 +2340,8 @@ void lammps_scatter_atoms(void *handle, char *name, // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgpack) vector = (int *) vptr; @@ -2373,8 +2373,8 @@ void lammps_scatter_atoms(void *handle, char *name, } } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; double *dptr = (double *) data; @@ -2457,7 +2457,7 @@ void lammps_scatter_atoms_subset(void *handle, char *name, } void *vptr = lmp->atom->extract(name); - if(vptr == NULL) { + if(vptr == nullptr) { lmp->error->warning(FLERR, "lammps_scatter_atoms_subset: unknown property name"); return; @@ -2468,8 +2468,8 @@ void lammps_scatter_atoms_subset(void *handle, char *name, // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgpack) vector = (int *) vptr; @@ -2507,8 +2507,8 @@ void lammps_scatter_atoms_subset(void *handle, char *name, } } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; double *dptr = (double *) data; @@ -2598,7 +2598,7 @@ void lammps_gather(void *ptr, char *name, int type, int count, void *data) void *vptr = lmp->atom->extract(name); - if (vptr==NULL && strstr(name,"f_") == name) { // fix + if (vptr==nullptr && strstr(name,"f_") == name) { // fix fcid = lmp->modify->find_fix(&name[2]); if (fcid < 0) { @@ -2629,7 +2629,7 @@ void lammps_gather(void *ptr, char *name, int type, int count, void *data) } - if (vptr==NULL && strstr(name,"c_") == name) { // compute + if (vptr==nullptr && strstr(name,"c_") == name) { // compute fcid = lmp->modify->find_compute(&name[2]); if (fcid < 0) { @@ -2657,7 +2657,7 @@ void lammps_gather(void *ptr, char *name, int type, int count, void *data) } - if (vptr==NULL && strstr(name,"d_") == name) { // property / atom + if (vptr==nullptr && strstr(name,"d_") == name) { // property / atom fcid = lmp->atom->find_custom(&name[2], ltype); if (fcid < 0) { @@ -2678,7 +2678,7 @@ void lammps_gather(void *ptr, char *name, int type, int count, void *data) } - if (vptr == NULL) { + if (vptr == nullptr) { lmp->error->warning(FLERR,"lammps_gather: unknown property name"); return; } @@ -2687,8 +2687,8 @@ void lammps_gather(void *ptr, char *name, int type, int count, void *data) // use atom ID to insert each atom's values into copy // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID if (type==0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); @@ -2728,8 +2728,8 @@ void lammps_gather(void *ptr, char *name, int type, int count, void *data) } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; @@ -2819,7 +2819,7 @@ void lammps_gather_concat(void *ptr, char *name, int type, int count, void *data void *vptr = lmp->atom->extract(name); - if (vptr==NULL && strstr(name,"f_") == name) { // fix + if (vptr==nullptr && strstr(name,"f_") == name) { // fix fcid = lmp->modify->find_fix(&name[2]); if (fcid < 0) { @@ -2851,7 +2851,7 @@ void lammps_gather_concat(void *ptr, char *name, int type, int count, void *data } - if (vptr==NULL && strstr(name,"c_") == name) { // compute + if (vptr==nullptr && strstr(name,"c_") == name) { // compute fcid = lmp->modify->find_compute(&name[2]); if (fcid < 0) { @@ -2879,7 +2879,7 @@ void lammps_gather_concat(void *ptr, char *name, int type, int count, void *data } - if (vptr==NULL && strstr(name,"d_") == name) { // property / atom + if (vptr==nullptr && strstr(name,"d_") == name) { // property / atom fcid = lmp->atom->find_custom(&name[2], ltype); if (fcid < 0) { @@ -2902,7 +2902,7 @@ void lammps_gather_concat(void *ptr, char *name, int type, int count, void *data } - if (vptr == NULL) { + if (vptr == nullptr) { lmp->error->warning(FLERR,"lammps_gather_concat: unknown property name"); return; } @@ -2916,8 +2916,8 @@ void lammps_gather_concat(void *ptr, char *name, int type, int count, void *data lmp->memory->create(displs,nprocs,"lib/gather:displs"); if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgunpack) vector = (int *) vptr; @@ -2967,8 +2967,8 @@ void lammps_gather_concat(void *ptr, char *name, int type, int count, void *data } } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; @@ -3064,7 +3064,7 @@ void lammps_gather_subset(void *ptr, char *name, void *vptr = lmp->atom->extract(name); - if (vptr==NULL && strstr(name,"f_") == name) { // fix + if (vptr==nullptr && strstr(name,"f_") == name) { // fix fcid = lmp->modify->find_fix(&name[2]); if (fcid < 0) { @@ -3096,7 +3096,7 @@ void lammps_gather_subset(void *ptr, char *name, } - if (vptr==NULL && strstr(name,"c_") == name) { // compute + if (vptr==nullptr && strstr(name,"c_") == name) { // compute fcid = lmp->modify->find_compute(&name[2]); if (fcid < 0) { @@ -3124,7 +3124,7 @@ void lammps_gather_subset(void *ptr, char *name, } - if (vptr==NULL && strstr(name,"d_") == name) { // property / atom + if (vptr==nullptr && strstr(name,"d_") == name) { // property / atom fcid = lmp->atom->find_custom(&name[2], ltype); if (fcid < 0) { @@ -3147,7 +3147,7 @@ void lammps_gather_subset(void *ptr, char *name, } - if (vptr == NULL) { + if (vptr == nullptr) { lmp->error->warning(FLERR,"lammps_gather_subset: " "unknown property name"); return; @@ -3158,8 +3158,8 @@ void lammps_gather_subset(void *ptr, char *name, // MPI_Allreduce with MPI_SUM to merge into data if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgunpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgunpack) vector = (int *) vptr; @@ -3205,8 +3205,8 @@ void lammps_gather_subset(void *ptr, char *name, lmp->memory->destroy(copy); } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; @@ -3306,7 +3306,7 @@ void lammps_scatter(void *ptr, char *name, void *vptr = lmp->atom->extract(name); - if (vptr==NULL && strstr(name,"f_") == name) { // fix + if (vptr==nullptr && strstr(name,"f_") == name) { // fix fcid = lmp->modify->find_fix(&name[2]); if (fcid < 0) { @@ -3331,7 +3331,7 @@ void lammps_scatter(void *ptr, char *name, } - if (vptr==NULL && strstr(name,"c_") == name) { // compute + if (vptr==nullptr && strstr(name,"c_") == name) { // compute fcid = lmp->modify->find_compute(&name[2]); if (fcid < 0) { @@ -3359,7 +3359,7 @@ void lammps_scatter(void *ptr, char *name, } - if (vptr==NULL && strstr(name,"d_") == name) { // property / atom + if (vptr==nullptr && strstr(name,"d_") == name) { // property / atom fcid = lmp->atom->find_custom(&name[2], ltype); if (fcid < 0) { @@ -3379,7 +3379,7 @@ void lammps_scatter(void *ptr, char *name, } - if(vptr == NULL) { + if(vptr == nullptr) { lmp->error->warning(FLERR,"lammps_scatter: unknown property name"); return; } @@ -3389,8 +3389,8 @@ void lammps_scatter(void *ptr, char *name, // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgpack) vector = (int *) vptr; @@ -3422,8 +3422,8 @@ void lammps_scatter(void *ptr, char *name, } } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; double *dptr = (double *) data; @@ -3508,7 +3508,7 @@ void lammps_scatter_subset(void *ptr, char *name, void *vptr = lmp->atom->extract(name); - if (vptr==NULL && strstr(name,"f_") == name) { // fix + if (vptr==nullptr && strstr(name,"f_") == name) { // fix fcid = lmp->modify->find_fix(&name[2]); if (fcid < 0) { @@ -3533,7 +3533,7 @@ void lammps_scatter_subset(void *ptr, char *name, } - if (vptr==NULL && strstr(name,"c_") == name) { // compute + if (vptr==nullptr && strstr(name,"c_") == name) { // compute fcid = lmp->modify->find_compute(&name[2]); if (fcid < 0) { @@ -3561,7 +3561,7 @@ void lammps_scatter_subset(void *ptr, char *name, } - if (vptr==NULL && strstr(name,"d_") == name) { // property / atom + if (vptr==nullptr && strstr(name,"d_") == name) { // property / atom fcid = lmp->atom->find_custom(&name[2], ltype); if (fcid < 0) { @@ -3584,7 +3584,7 @@ void lammps_scatter_subset(void *ptr, char *name, } - if(vptr == NULL) { + if(vptr == nullptr) { lmp->error->warning(FLERR,"lammps_scatter_atoms_subset: " "unknown property name"); return; @@ -3595,8 +3595,8 @@ void lammps_scatter_subset(void *ptr, char *name, // MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID if (type == 0) { - int *vector = NULL; - int **array = NULL; + int *vector = nullptr; + int **array = nullptr; const int imgpack = (count == 3) && (strcmp(name,"image") == 0); if ((count == 1) || imgpack) vector = (int *) vptr; @@ -3634,8 +3634,8 @@ void lammps_scatter_subset(void *ptr, char *name, } } else { - double *vector = NULL; - double **array = NULL; + double *vector = nullptr; + double **array = nullptr; if (count == 1) vector = (double *) vptr; else array = (double **) vptr; double *dptr = (double *) data; @@ -3774,7 +3774,7 @@ included in the LAMMPS library in use. */ int lammps_config_package_count() { int i = 0; - while(LAMMPS::installed_packages[i] != NULL) { + while(LAMMPS::installed_packages[i] != nullptr) { ++i; } return i; @@ -4021,7 +4021,7 @@ int lammps_find_pair_neighlist(void* handle, char * style, int exact, int nsub, LAMMPS * lmp = (LAMMPS *) handle; Pair* pair = lmp->force->pair_match(style, exact, nsub); - if (pair != NULL) { + if (pair != nullptr) { // find neigh list for (int i = 0; i < lmp->neighbor->nlist; i++) { NeighList * list = lmp->neighbor->lists[i]; @@ -4047,7 +4047,7 @@ int lammps_find_pair_neighlist(void* handle, char * style, int exact, int nsub, */ int lammps_find_fix_neighlist(void* handle, char * id, int request) { LAMMPS * lmp = (LAMMPS *) handle; - Fix* fix = NULL; + Fix* fix = nullptr; const int nfix = lmp->modify->nfix; // find fix with name @@ -4058,7 +4058,7 @@ int lammps_find_fix_neighlist(void* handle, char * id, int request) { } } - if (fix != NULL) { + if (fix != nullptr) { // find neigh list for (int i = 0; i < lmp->neighbor->nlist; i++) { NeighList * list = lmp->neighbor->lists[i]; @@ -4084,7 +4084,7 @@ int lammps_find_fix_neighlist(void* handle, char * id, int request) { */ int lammps_find_compute_neighlist(void* handle, char * id, int request) { LAMMPS * lmp = (LAMMPS *) handle; - Compute* compute = NULL; + Compute* compute = nullptr; const int ncompute = lmp->modify->ncompute; // find compute with name @@ -4095,7 +4095,7 @@ int lammps_find_compute_neighlist(void* handle, char * id, int request) { } } - if (compute == NULL) { + if (compute == nullptr) { // find neigh list for (int i = 0; i < lmp->neighbor->nlist; i++) { NeighList * list = lmp->neighbor->lists[i]; @@ -4142,14 +4142,14 @@ int lammps_neighlist_num_elements(void * handle, int idx) { invalid idx or element value * \param[out] numneigh number of neighbors of atom iatom or 0 * \param[out] neighbors pointer to array of neighbor atom local indices or - * NULL + * nullptr */ void lammps_neighlist_element_neighbors(void * handle, int idx, int element, int * iatom, int * numneigh, int ** neighbors) { LAMMPS * lmp = (LAMMPS *) handle; Neighbor * neighbor = lmp->neighbor; *iatom = -1; *numneigh = 0; - *neighbors = NULL; + *neighbors = nullptr; if(idx < 0 || idx >= neighbor->nlist) { return; diff --git a/src/lmppython.cpp b/src/lmppython.cpp index 67bbca15b65fc6cf7cd4cea0e5967dc4c3e128b6..080a22cb600bb3e5c8d165685c61d45683c26010 100644 --- a/src/lmppython.cpp +++ b/src/lmppython.cpp @@ -26,7 +26,7 @@ Python::Python(LAMMPS *lmp) : Pointers(lmp) { // implementation of Python interface is only loaded on demand // and only if PYTHON package has been installed and compiled into binary - impl = NULL; + impl = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/memory.cpp b/src/memory.cpp index bbbc233bbf81b5eef5bff16ae398f984eb7e28f2..f0d8976ad17744b989251b1fbf71736bdc3ab05f 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -45,7 +45,7 @@ Memory::Memory(LAMMPS *lmp) : Pointers(lmp) {} void *Memory::smalloc(bigint nbytes, const char *name) { - if (nbytes == 0) return NULL; + if (nbytes == 0) return nullptr; #if defined(LAMMPS_MEMALIGN) void *ptr; @@ -54,13 +54,13 @@ void *Memory::smalloc(bigint nbytes, const char *name) ptr = scalable_aligned_malloc(nbytes, LAMMPS_MEMALIGN); #else int retval = posix_memalign(&ptr, LAMMPS_MEMALIGN, nbytes); - if (retval) ptr = NULL; + if (retval) ptr = nullptr; #endif #else void *ptr = malloc(nbytes); #endif - if (ptr == NULL) + if (ptr == nullptr) error->one(FLERR,fmt::format("Failed to allocate {} bytes for array {}", nbytes,name)); return ptr; @@ -74,7 +74,7 @@ void *Memory::srealloc(void *ptr, bigint nbytes, const char *name) { if (nbytes == 0) { destroy(ptr); - return NULL; + return nullptr; } #if defined(LMP_USE_TBB_ALLOCATOR) @@ -99,7 +99,7 @@ void *Memory::srealloc(void *ptr, bigint nbytes, const char *name) #else ptr = realloc(ptr,nbytes); #endif - if (ptr == NULL) + if (ptr == nullptr) error->one(FLERR,fmt::format("Failed to reallocate {} bytes for array {}", nbytes,name)); return ptr; @@ -111,7 +111,7 @@ void *Memory::srealloc(void *ptr, bigint nbytes, const char *name) void Memory::sfree(void *ptr) { - if (ptr == NULL) return; + if (ptr == nullptr) return; #if defined(LMP_USE_TBB_ALLOCATOR) scalable_aligned_free(ptr); #else diff --git a/src/memory.h b/src/memory.h index ef55dc2c8700089f49b418965909d103e8f03b13..64685feac04dd17d3c1f99dc7a9fe8ae69b6a8d3 100644 --- a/src/memory.h +++ b/src/memory.h @@ -50,7 +50,7 @@ class Memory : protected Pointers { template TYPE **create(TYPE **& /*array*/, int /*n*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- grow or shrink 1d array @@ -59,7 +59,7 @@ class Memory : protected Pointers { template TYPE *grow(TYPE *&array, int n, const char *name) { - if (array == NULL) return create(array,n,name); + if (array == nullptr) return create(array,n,name); bigint nbytes = ((bigint) sizeof(TYPE)) * n; array = (TYPE *) srealloc(array,nbytes,name); @@ -68,7 +68,7 @@ class Memory : protected Pointers { template TYPE **grow(TYPE **& /*array*/, int /*n*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- destroy a 1d array @@ -77,7 +77,7 @@ class Memory : protected Pointers { template void destroy(TYPE *&array) { sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -96,7 +96,7 @@ class Memory : protected Pointers { template TYPE **create1d_offset(TYPE **& /*array*/, int /*nlo*/, int /*nhi*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- destroy a 1d array with index offset @@ -106,7 +106,7 @@ class Memory : protected Pointers { void destroy1d_offset(TYPE *&array, int offset) { if (array) sfree(&array[offset]); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -131,7 +131,7 @@ class Memory : protected Pointers { template TYPE ***create(TYPE ***& /*array*/, int /*n1*/, int /*n2*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- grow or shrink 1st dim of a 2d array @@ -141,7 +141,7 @@ class Memory : protected Pointers { template TYPE **grow(TYPE **&array, int n1, int n2, const char *name) { - if (array == NULL) return create(array,n1,n2,name); + if (array == nullptr) return create(array,n1,n2,name); bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2; TYPE *data = (TYPE *) srealloc(array[0],nbytes,name); @@ -158,7 +158,7 @@ class Memory : protected Pointers { template TYPE ***grow(TYPE ***& /*array*/, int /*n1*/, int /*n2*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- destroy a 2d array @@ -167,10 +167,10 @@ class Memory : protected Pointers { template void destroy(TYPE **&array) { - if (array == NULL) return; + if (array == nullptr) return; sfree(array[0]); sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -198,7 +198,7 @@ class Memory : protected Pointers { template TYPE ***create_ragged(TYPE ***& /*array*/, int /*n1*/, int * /*n2*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- create a 2d array with 2nd index from n2lo to n2hi inclusive @@ -217,7 +217,7 @@ class Memory : protected Pointers { template TYPE ***create2d_offset(TYPE ***& /*array*/, int /*n1*/, int /*n2lo*/, int /*n2hi*/, - const char *name) {fail(name); return NULL;} + const char *name) {fail(name); return nullptr;} /* ---------------------------------------------------------------------- destroy a 2d array with 2nd index offset @@ -226,10 +226,10 @@ class Memory : protected Pointers { template void destroy2d_offset(TYPE **&array, int offset) { - if (array == NULL) return; + if (array == nullptr) return; sfree(&array[0][offset]); sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -262,7 +262,7 @@ class Memory : protected Pointers { template TYPE ****create(TYPE ****& /*array*/, int /*n1*/, int /*n2*/, int /*n3*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- grow or shrink 1st dim of a 3d array @@ -272,7 +272,7 @@ class Memory : protected Pointers { template TYPE ***grow(TYPE ***&array, int n1, int n2, int n3, const char *name) { - if (array == NULL) return create(array,n1,n2,n3,name); + if (array == nullptr) return create(array,n1,n2,n3,name); bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2*n3; TYPE *data = (TYPE *) srealloc(array[0][0],nbytes,name); @@ -297,7 +297,7 @@ class Memory : protected Pointers { template TYPE ****grow(TYPE ****& /*array*/, int /*n1*/, int /*n2*/, int /*n3*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- destroy a 3d array @@ -306,11 +306,11 @@ class Memory : protected Pointers { template void destroy(TYPE ***&array) { - if (array == NULL) return; + if (array == nullptr) return; sfree(array[0][0]); sfree(array[0]); sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -331,7 +331,7 @@ class Memory : protected Pointers { template TYPE ****create3d_offset(TYPE ****& /*array*/, int /*n1lo*/, int /*n1hi*/, int /*n2*/, int /*n3*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- free a 3d array with 1st index offset @@ -340,11 +340,11 @@ class Memory : protected Pointers { template void destroy3d_offset(TYPE ***&array, int offset) { - if (array == NULL) return; + if (array == nullptr) return; sfree(&array[offset][0][0]); sfree(&array[offset][0]); sfree(&array[offset]); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -376,7 +376,7 @@ class Memory : protected Pointers { TYPE ****create3d_offset(TYPE ****& /*array*/, int /*n1lo*/, int /*n1hi*/, int /*n2lo*/, int /*n2hi*/, int /*n3lo*/, int /*n3hi*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- free a 3d array with all 3 indices offset @@ -386,11 +386,11 @@ class Memory : protected Pointers { void destroy3d_offset(TYPE ***&array, int n1_offset, int n2_offset, int n3_offset) { - if (array == NULL) return; + if (array == nullptr) return; sfree(&array[n1_offset][n2_offset][n3_offset]); sfree(&array[n1_offset][n2_offset]); sfree(&array[n1_offset]); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -433,7 +433,7 @@ class Memory : protected Pointers { template TYPE *****create(TYPE *****& /*array*/, int /*n1*/, int /*n2*/, int /*n3*/, int /*n4*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- grow or shrink 1st dim of a 4d array @@ -444,7 +444,7 @@ class Memory : protected Pointers { TYPE ****grow(TYPE ****&array, int n1, int n2, int n3, int n4, const char *name) { - if (array == NULL) return create(array, n1, n2, n3, n4, name); + if (array == nullptr) return create(array, n1, n2, n3, n4, name); bigint nbytes = ((bigint) sizeof(TYPE)) * n1*n2*n3*n4; TYPE *data = (TYPE *)srealloc(array[0][0][0], nbytes, name); @@ -479,7 +479,7 @@ class Memory : protected Pointers { TYPE *****grow(TYPE *****& /*array*/, int /*n1*/, int /*n2*/, int /*n3*/, int /*n4*/, const char *name) { - fail(name); return NULL; + fail(name); return nullptr; } /* ---------------------------------------------------------------------- @@ -489,12 +489,12 @@ class Memory : protected Pointers { template void destroy(TYPE ****&array) { - if (array == NULL) return; + if (array == nullptr) return; sfree(array[0][0][0]); sfree(array[0][0]); sfree(array[0]); sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -527,7 +527,7 @@ class Memory : protected Pointers { TYPE ****create4d_offset(TYPE *****& /*array*/, int /*n1*/, int /*n2lo*/, int /*n2hi*/, int /*n3lo*/, int /*n3hi*/, int /*n4lo*/, int /*n4hi*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- free a 4d array with indices 2,3, and 4 offset @@ -537,12 +537,12 @@ class Memory : protected Pointers { void destroy4d_offset(TYPE ****&array, int n2_offset, int n3_offset, int n4_offset) { - if (array == NULL) return; + if (array == nullptr) return; sfree(&array[0][n2_offset][n3_offset][n4_offset]); sfree(&array[0][n2_offset][n3_offset]); sfree(&array[0][n2_offset]); sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- @@ -594,7 +594,7 @@ class Memory : protected Pointers { template TYPE ******create(TYPE ******& /*array*/, int /*n1*/, int /*n2*/, int /*n3*/, int /*n4*/, int /*n5*/, const char *name) - {fail(name); return NULL;} + {fail(name); return nullptr;} /* ---------------------------------------------------------------------- destroy a 5d array @@ -603,13 +603,13 @@ class Memory : protected Pointers { template void destroy(TYPE *****&array) { - if (array == NULL) return; + if (array == nullptr) return; sfree(array[0][0][0][0]); sfree(array[0][0][0]); sfree(array[0][0]); sfree(array[0]); sfree(array); - array = NULL; + array = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/min.cpp b/src/min.cpp index 6bcb4b4e2e1e11f17b6e4b26c0bf91a1aee1ef37..ea07820e53b4becc979c61330faa003e06e43a66 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -71,17 +71,17 @@ Min::Min(LAMMPS *lmp) : Pointers(lmp) delaystep_start_flag = 1; max_vdotf_negatif = 2000; - elist_global = elist_atom = NULL; - vlist_global = vlist_atom = cvlist_atom = NULL; + elist_global = elist_atom = nullptr; + vlist_global = vlist_atom = cvlist_atom = nullptr; nextra_global = 0; - fextra = NULL; + fextra = nullptr; nextra_atom = 0; - xextra_atom = fextra_atom = NULL; - extra_peratom = extra_nlen = NULL; - extra_max = NULL; - requestor = NULL; + xextra_atom = fextra_atom = nullptr; + extra_peratom = extra_nlen = nullptr; + extra_max = nullptr; + requestor = nullptr; external_force_clear = 0; @@ -128,7 +128,7 @@ void Min::init() nextra_global = 0; delete [] fextra; - fextra = NULL; + fextra = nullptr; nextra_atom = 0; memory->sfree(xextra_atom); @@ -137,10 +137,10 @@ void Min::init() memory->destroy(extra_nlen); memory->destroy(extra_max); memory->sfree(requestor); - xextra_atom = fextra_atom = NULL; - extra_peratom = extra_nlen = NULL; - extra_max = NULL; - requestor = NULL; + xextra_atom = fextra_atom = nullptr; + extra_peratom = extra_nlen = nullptr; + extra_max = nullptr; + requestor = nullptr; // virial_style: // 1 if computed explicitly by pair->compute via sum over pair interactions @@ -760,8 +760,8 @@ void Min::ev_setup() delete [] vlist_global; delete [] vlist_atom; delete [] cvlist_atom; - elist_global = elist_atom = NULL; - vlist_global = vlist_atom = cvlist_atom = NULL; + elist_global = elist_atom = nullptr; + vlist_global = vlist_atom = cvlist_atom = nullptr; nelist_global = nelist_atom = 0; nvlist_global = nvlist_atom = ncvlist_atom = 0; diff --git a/src/min_hftn.cpp b/src/min_hftn.cpp index 909f0b0689cfc4c74a0a3726dbab770b2f4c5991..54b1ee63615c54c1d209f81005202415879aa192 100644 --- a/src/min_hftn.cpp +++ b/src/min_hftn.cpp @@ -81,11 +81,11 @@ MinHFTN::MinHFTN(LAMMPS *lmp) : Min(lmp) searchflag = 1; for (int i = 1; i < NUM_HFTN_ATOM_BASED_VECTORS; i++) - _daExtraGlobal[i] = NULL; + _daExtraGlobal[i] = nullptr; for (int i = 0; i < NUM_HFTN_ATOM_BASED_VECTORS; i++) - _daExtraAtom[i] = NULL; + _daExtraAtom[i] = nullptr; - _fpPrint = NULL; + _fpPrint = nullptr; return; } @@ -97,10 +97,10 @@ MinHFTN::MinHFTN(LAMMPS *lmp) : Min(lmp) MinHFTN::~MinHFTN (void) { for (int i = 1; i < NUM_HFTN_ATOM_BASED_VECTORS; i++) - if (_daExtraGlobal[i] != NULL) + if (_daExtraGlobal[i] != nullptr) delete [] _daExtraGlobal[i]; for (int i = 0; i < NUM_HFTN_ATOM_BASED_VECTORS; i++) - if (_daExtraAtom[i] != NULL) + if (_daExtraAtom[i] != nullptr) delete [] _daExtraAtom[i]; return; @@ -118,14 +118,14 @@ void MinHFTN::init() error->all(FLERR,"Incorrect min_modify option"); for (int i = 1; i < NUM_HFTN_ATOM_BASED_VECTORS; i++) { - if (_daExtraGlobal[i] != NULL) + if (_daExtraGlobal[i] != nullptr) delete [] _daExtraGlobal[i]; - _daExtraGlobal[i] = NULL; + _daExtraGlobal[i] = nullptr; } for (int i = 0; i < NUM_HFTN_ATOM_BASED_VECTORS; i++) { - if (_daExtraAtom[i] != NULL) + if (_daExtraAtom[i] != nullptr) delete [] _daExtraAtom[i]; - _daExtraAtom[i] = NULL; + _daExtraAtom[i] = nullptr; } return; @@ -1618,7 +1618,7 @@ void MinHFTN::open_hftn_print_file_(void) char szTmp[50]; sprintf (szTmp, "progress_MinHFTN_%d.txt", nMyRank); _fpPrint = fopen (szTmp, "w"); - if (_fpPrint == NULL) { + if (_fpPrint == nullptr) { printf ("*** MinHFTN cannot open file '%s'\n", szTmp); printf ("*** continuing...\n"); return; @@ -1655,7 +1655,7 @@ void MinHFTN::hftn_print_line_(const bool bIsStepAccepted, const char sFormatR[] = "r %4d %5d %14.8f %11.5e %3s %9.3e %8.2e %10.3e %10.3e\n"; - if (_fpPrint == NULL) + if (_fpPrint == nullptr) return; char sStepType[4]; @@ -1701,6 +1701,6 @@ void MinHFTN::hftn_print_line_(const bool bIsStepAccepted, void MinHFTN::close_hftn_print_file_(void) { - if (_fpPrint != NULL) fclose (_fpPrint); + if (_fpPrint != nullptr) fclose (_fpPrint); return; } diff --git a/src/min_linesearch.cpp b/src/min_linesearch.cpp index 7226f616147deb4d811d321a47831ac665b2a55b..4ae8873129a8a0c8399e937bfd2bbf5a08c3f435 100644 --- a/src/min_linesearch.cpp +++ b/src/min_linesearch.cpp @@ -54,8 +54,8 @@ using namespace LAMMPS_NS; MinLineSearch::MinLineSearch(LAMMPS *lmp) : Min(lmp) { searchflag = 1; - gextra = hextra = NULL; - x0extra_atom = gextra_atom = hextra_atom = NULL; + gextra = hextra = nullptr; + x0extra_atom = gextra_atom = hextra_atom = nullptr; } /* ---------------------------------------------------------------------- */ @@ -81,12 +81,12 @@ void MinLineSearch::init() delete [] gextra; delete [] hextra; - gextra = hextra = NULL; + gextra = hextra = nullptr; delete [] x0extra_atom; delete [] gextra_atom; delete [] hextra_atom; - x0extra_atom = gextra_atom = hextra_atom = NULL; + x0extra_atom = gextra_atom = hextra_atom = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/modify.cpp b/src/modify.cpp index 9d0511ca6ff452b8d134cad49f8c2b454da61065..476f7ea9abb47da3a718ab8b32ff83a0e22651a3 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -54,34 +54,34 @@ Modify::Modify(LAMMPS *lmp) : Pointers(lmp) n_min_post_force = n_min_energy = 0; n_timeflag = -1; - fix = NULL; - fmask = NULL; - list_initial_integrate = list_post_integrate = NULL; - list_pre_exchange = list_pre_neighbor = list_post_neighbor = NULL; - list_pre_force = list_pre_reverse = list_post_force = NULL; - list_final_integrate = list_end_of_step = NULL; - list_thermo_energy = list_thermo_energy_atom = NULL; - list_initial_integrate_respa = list_post_integrate_respa = NULL; - list_pre_force_respa = list_post_force_respa = NULL; - list_final_integrate_respa = NULL; - list_min_pre_exchange = list_min_pre_neighbor = list_min_post_neighbor = NULL; - list_min_pre_force = list_min_pre_reverse = list_min_post_force = NULL; - list_min_energy = NULL; - - end_of_step_every = NULL; - - list_timeflag = NULL; + fix = nullptr; + fmask = nullptr; + list_initial_integrate = list_post_integrate = nullptr; + list_pre_exchange = list_pre_neighbor = list_post_neighbor = nullptr; + list_pre_force = list_pre_reverse = list_post_force = nullptr; + list_final_integrate = list_end_of_step = nullptr; + list_thermo_energy = list_thermo_energy_atom = nullptr; + list_initial_integrate_respa = list_post_integrate_respa = nullptr; + list_pre_force_respa = list_post_force_respa = nullptr; + list_final_integrate_respa = nullptr; + list_min_pre_exchange = list_min_pre_neighbor = list_min_post_neighbor = nullptr; + list_min_pre_force = list_min_pre_reverse = list_min_post_force = nullptr; + list_min_energy = nullptr; + + end_of_step_every = nullptr; + + list_timeflag = nullptr; nfix_restart_global = 0; - id_restart_global = style_restart_global = NULL; - state_restart_global = NULL; - used_restart_global = NULL; + id_restart_global = style_restart_global = nullptr; + state_restart_global = nullptr; + used_restart_global = nullptr; nfix_restart_peratom = 0; - id_restart_peratom = style_restart_peratom = NULL; - index_restart_peratom = used_restart_peratom = NULL; + id_restart_peratom = style_restart_peratom = nullptr; + index_restart_peratom = used_restart_peratom = nullptr; ncompute = maxcompute = 0; - compute = NULL; + compute = nullptr; create_factories(); } @@ -795,17 +795,17 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) // but can't think of better way // too late if instantiate fix, then check flag set in fix constructor, // since some fixes access domain settings in their constructor - // NULL must be last entry in this list + // nullptr must be last entry in this list const char *exceptions[] = {"GPU", "OMP", "INTEL", "property/atom", "cmap", "cmap3", "rx", - "deprecated", "STORE/KIM", NULL}; + "deprecated", "STORE/KIM", nullptr}; if (domain->box_exist == 0) { int m; - for (m = 0; exceptions[m] != NULL; m++) + for (m = 0; exceptions[m] != nullptr; m++) if (strcmp(arg[2],exceptions[m]) == 0) break; - if (exceptions[m] == NULL) + if (exceptions[m] == nullptr) error->all(FLERR,"Fix command before simulation box is defined"); } @@ -821,7 +821,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) // warn if new group != old group // delete old fix, but do not call update_callback(), // since will replace this fix and thus other fix locs will not change - // set ptr to NULL in case new fix scans list of fixes, + // set ptr to a null pointer in case new fix scans list of fixes, // e.g. scan will occur in add_callback() if called by new fix // if fix ID does not exist: // set newflag = 1 so create new fix @@ -852,7 +852,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) if (fix[ifix]->igroup != igroup && comm->me == 0) error->warning(FLERR,"Replacing a fix, but new group != old group"); delete fix[ifix]; - fix[ifix] = NULL; + fix[ifix] = nullptr; } else { newflag = 1; @@ -866,7 +866,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) // create the Fix // try first with suffix appended - fix[ifix] = NULL; + fix[ifix] = nullptr; if (trysuffix && lmp->suffix_enable) { if (lmp->suffix) { @@ -879,7 +879,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) strcpy(fix[ifix]->style,estyle.c_str()); } } - if (fix[ifix] == NULL && lmp->suffix2) { + if (fix[ifix] == nullptr && lmp->suffix2) { std::string estyle = arg[2] + std::string("/") + lmp->suffix2; if (fix_map->find(estyle) != fix_map->end()) { FixCreator &fix_creator = (*fix_map)[estyle]; @@ -891,12 +891,12 @@ void Modify::add_fix(int narg, char **arg, int trysuffix) } } - if (fix[ifix] == NULL && fix_map->find(arg[2]) != fix_map->end()) { + if (fix[ifix] == nullptr && fix_map->find(arg[2]) != fix_map->end()) { FixCreator &fix_creator = (*fix_map)[arg[2]]; fix[ifix] = fix_creator(lmp,narg,arg); } - if (fix[ifix] == NULL) + if (fix[ifix] == nullptr) error->all(FLERR,utils::check_packages_for_style("fix",arg[2],lmp)); // check if Fix is in restart_global list @@ -1105,7 +1105,7 @@ int Modify::check_rigid_group_overlap(int groupbit) for (int ifix = 0; ifix < nfix; ifix++) { if (utils::strmatch(fix[ifix]->style,"^rigid")) { const int * const body = (const int *)fix[ifix]->extract("body",dim); - if ((body == NULL) || (dim != 1)) break; + if ((body == nullptr) || (dim != 1)) break; for (int i=0; (i < nlocal) && (n == 0); ++i) if ((mask[i] & groupbit) && (body[i] >= 0)) ++n; @@ -1137,7 +1137,7 @@ int Modify::check_rigid_region_overlap(int groupbit, Region *reg) for (int ifix = 0; ifix < nfix; ifix++) { if (strncmp("rigid",fix[ifix]->style,5) == 0) { const int * const body = (const int *)fix[ifix]->extract("body",dim); - if ((body == NULL) || (dim != 1)) break; + if ((body == nullptr) || (dim != 1)) break; for (int i=0; (i < nlocal) && (n == 0); ++i) if ((mask[i] & groupbit) && (body[i] >= 0) @@ -1167,7 +1167,7 @@ int Modify::check_rigid_list_overlap(int *select) for (int ifix = 0; ifix < nfix; ifix++) { if (utils::strmatch(fix[ifix]->style,"^rigid")) { const int * const body = (const int *)fix[ifix]->extract("body",dim); - if ((body == NULL) || (dim != 1)) break; + if ((body == nullptr) || (dim != 1)) break; for (int i=0; (i < nlocal) && (n == 0); ++i) if ((body[i] >= 0) && select[i]) ++n; @@ -1206,7 +1206,7 @@ void Modify::add_compute(int narg, char **arg, int trysuffix) // create the Compute // try first with suffix appended - compute[ncompute] = NULL; + compute[ncompute] = nullptr; if (trysuffix && lmp->suffix_enable) { if (lmp->suffix) { @@ -1219,7 +1219,7 @@ void Modify::add_compute(int narg, char **arg, int trysuffix) strcpy(compute[ncompute]->style,estyle.c_str()); } } - if (compute[ncompute] == NULL && lmp->suffix2) { + if (compute[ncompute] == nullptr && lmp->suffix2) { std::string estyle = arg[2] + std::string("/") + lmp->suffix2; if (compute_map->find(estyle) != compute_map->end()) { ComputeCreator &compute_creator = (*compute_map)[estyle]; @@ -1231,13 +1231,13 @@ void Modify::add_compute(int narg, char **arg, int trysuffix) } } - if (compute[ncompute] == NULL && + if (compute[ncompute] == nullptr && compute_map->find(arg[2]) != compute_map->end()) { ComputeCreator &compute_creator = (*compute_map)[arg[2]]; compute[ncompute] = compute_creator(lmp,narg,arg); } - if (compute[ncompute] == NULL) + if (compute[ncompute] == nullptr) error->all(FLERR,utils::check_packages_for_style("compute",arg[2],lmp)); ncompute++; @@ -1428,7 +1428,7 @@ int Modify::read_restart(FILE *fp) // nfix_restart_global = # of restart entries with global state info int me = comm->me; - if (me == 0) utils::sfread(FLERR,&nfix_restart_global,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nfix_restart_global,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nfix_restart_global,1,MPI_INT,0,world); // allocate space for each entry @@ -1445,22 +1445,22 @@ int Modify::read_restart(FILE *fp) int n; for (int i = 0; i < nfix_restart_global; i++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); id_restart_global[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,id_restart_global[i],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,id_restart_global[i],sizeof(char),n,fp,nullptr,error); MPI_Bcast(id_restart_global[i],n,MPI_CHAR,0,world); - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); style_restart_global[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,style_restart_global[i],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,style_restart_global[i],sizeof(char),n,fp,nullptr,error); MPI_Bcast(style_restart_global[i],n,MPI_CHAR,0,world); - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); state_restart_global[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,state_restart_global[i],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,state_restart_global[i],sizeof(char),n,fp,nullptr,error); MPI_Bcast(state_restart_global[i],n,MPI_CHAR,0,world); used_restart_global[i] = 0; @@ -1470,7 +1470,7 @@ int Modify::read_restart(FILE *fp) int maxsize = 0; - if (me == 0) utils::sfread(FLERR,&nfix_restart_peratom,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nfix_restart_peratom,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nfix_restart_peratom,1,MPI_INT,0,world); // allocate space for each entry @@ -1487,19 +1487,19 @@ int Modify::read_restart(FILE *fp) // set index = which set of extra data this fix represents for (int i = 0; i < nfix_restart_peratom; i++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); id_restart_peratom[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,id_restart_peratom[i],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,id_restart_peratom[i],sizeof(char),n,fp,nullptr,error); MPI_Bcast(id_restart_peratom[i],n,MPI_CHAR,0,world); - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); style_restart_peratom[i] = new char[n]; - if (me == 0) utils::sfread(FLERR,style_restart_peratom[i],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,style_restart_peratom[i],sizeof(char),n,fp,nullptr,error); MPI_Bcast(style_restart_peratom[i],n,MPI_CHAR,0,world); - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); maxsize += n; diff --git a/src/molecule.cpp b/src/molecule.cpp index 7cc4707c8a31baeb167d96ee6d0add8e757ec1c7..4612d50a7faa02ebad147e06a99419314e791528 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -39,16 +39,16 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ Molecule::Molecule(LAMMPS *lmp, int narg, char **arg, int &index) : - Pointers(lmp), id(NULL), x(NULL), type(NULL), molecule(NULL), q(NULL), radius(NULL), - rmass(NULL), num_bond(NULL), bond_type(NULL), bond_atom(NULL), - num_angle(NULL), angle_type(NULL), angle_atom1(NULL), angle_atom2(NULL), - angle_atom3(NULL), num_dihedral(NULL), dihedral_type(NULL), dihedral_atom1(NULL), - dihedral_atom2(NULL), dihedral_atom3(NULL), dihedral_atom4(NULL), num_improper(NULL), - improper_type(NULL), improper_atom1(NULL), improper_atom2(NULL), - improper_atom3(NULL), improper_atom4(NULL), nspecial(NULL), special(NULL), - shake_flag(NULL), shake_atom(NULL), shake_type(NULL), avec_body(NULL), ibodyparams(NULL), - dbodyparams(NULL), fragmentmask(NULL), - dx(NULL), dxcom(NULL), dxbody(NULL), quat_external(NULL), fp(NULL), count(NULL) + Pointers(lmp), id(nullptr), x(nullptr), type(nullptr), molecule(nullptr), q(nullptr), radius(nullptr), + rmass(nullptr), num_bond(nullptr), bond_type(nullptr), bond_atom(nullptr), + num_angle(nullptr), angle_type(nullptr), angle_atom1(nullptr), angle_atom2(nullptr), + angle_atom3(nullptr), num_dihedral(nullptr), dihedral_type(nullptr), dihedral_atom1(nullptr), + dihedral_atom2(nullptr), dihedral_atom3(nullptr), dihedral_atom4(nullptr), num_improper(nullptr), + improper_type(nullptr), improper_atom1(nullptr), improper_atom2(nullptr), + improper_atom3(nullptr), improper_atom4(nullptr), nspecial(nullptr), special(nullptr), + shake_flag(nullptr), shake_atom(nullptr), shake_type(nullptr), avec_body(nullptr), ibodyparams(nullptr), + dbodyparams(nullptr), fragmentmask(nullptr), + dx(nullptr), dxcom(nullptr), dxbody(nullptr), quat_external(nullptr), fp(nullptr), count(nullptr) { me = comm->me; @@ -406,7 +406,7 @@ void Molecule::read(int flag) if (me == 0) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of molecule file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of molecule file"); } // read header lines @@ -511,7 +511,7 @@ void Molecule::read(int flag) // count = vector for tallying bonds,angles,etc per atom if (flag == 0) memory->create(count,natoms,"molecule:count"); - else count = NULL; + else count = nullptr; // grab keyword and skip next line @@ -1703,41 +1703,41 @@ void Molecule::initialize() centerflag = massflag = comflag = inertiaflag = 0; tag_require = 0; - x = NULL; - type = NULL; - q = NULL; - radius = NULL; - rmass = NULL; + x = nullptr; + type = nullptr; + q = nullptr; + radius = nullptr; + rmass = nullptr; - num_bond = NULL; - bond_type = NULL; - bond_atom = NULL; + num_bond = nullptr; + bond_type = nullptr; + bond_atom = nullptr; - num_angle = NULL; - angle_type = NULL; - angle_atom1 = angle_atom2 = angle_atom3 = NULL; + num_angle = nullptr; + angle_type = nullptr; + angle_atom1 = angle_atom2 = angle_atom3 = nullptr; - num_dihedral = NULL; - dihedral_type = NULL; - dihedral_atom1 = dihedral_atom2 = dihedral_atom3 = dihedral_atom4 = NULL; + num_dihedral = nullptr; + dihedral_type = nullptr; + dihedral_atom1 = dihedral_atom2 = dihedral_atom3 = dihedral_atom4 = nullptr; - num_improper = NULL; - improper_type = NULL; - improper_atom1 = improper_atom2 = improper_atom3 = improper_atom4 = NULL; + num_improper = nullptr; + improper_type = nullptr; + improper_atom1 = improper_atom2 = improper_atom3 = improper_atom4 = nullptr; - nspecial = NULL; - special = NULL; + nspecial = nullptr; + special = nullptr; - shake_flag = NULL; - shake_atom = NULL; - shake_type = NULL; + shake_flag = nullptr; + shake_atom = nullptr; + shake_type = nullptr; - ibodyparams = NULL; - dbodyparams = NULL; + ibodyparams = nullptr; + dbodyparams = nullptr; - dx = NULL; - dxcom = NULL; - dxbody = NULL; + dx = nullptr; + dxcom = nullptr; + dxbody = nullptr; } /* ---------------------------------------------------------------------- @@ -1901,7 +1901,7 @@ void Molecule::deallocate() void Molecule::open(char *file) { fp = fopen(file,"r"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open molecule file {}: {}", file, utils::getsyserror())); } @@ -1914,7 +1914,7 @@ void Molecule::readline(char *line) { int n; if (me == 0) { - if (fgets(line,MAXLINE,fp) == NULL) n = 0; + if (fgets(line,MAXLINE,fp) == nullptr) n = 0; else n = strlen(line) + 1; } MPI_Bcast(&n,1,MPI_INT,0,world); @@ -1937,11 +1937,11 @@ void Molecule::parse_keyword(int flag, char *line, char *keyword) int eof = 0; if (me == 0) { - if (fgets(line,MAXLINE,fp) == NULL) eof = 1; + if (fgets(line,MAXLINE,fp) == nullptr) eof = 1; while (eof == 0 && strspn(line," \t\n\r") == strlen(line)) { - if (fgets(line,MAXLINE,fp) == NULL) eof = 1; + if (fgets(line,MAXLINE,fp) == nullptr) eof = 1; } - if (fgets(keyword,MAXLINE,fp) == NULL) eof = 1; + if (fgets(keyword,MAXLINE,fp) == nullptr) eof = 1; } // if eof, set keyword empty and return diff --git a/src/my_page.cpp b/src/my_page.cpp index 95dd56fecdffaeffbff2c3aff591dcedca87b57c..2416c7e76b52ff20680ba9847161d207760d2b4e 100644 --- a/src/my_page.cpp +++ b/src/my_page.cpp @@ -113,7 +113,7 @@ template T *MyPage::get(int n) { if (n > maxchunk) { errorflag = 1; - return NULL; + return nullptr; } ndatum += n; nchunk++; @@ -129,7 +129,7 @@ T *MyPage::get(int n) { ipage++; if (ipage == npage) { allocate(); - if (errorflag) return NULL; + if (errorflag) return nullptr; } page = pages[ipage]; index = n; diff --git a/src/my_page.h b/src/my_page.h index 4beb397ae206623b1e53c6c74a2fede1d352084f..0e4375ed7f96944b97524da344a41442c54b39e4 100644 --- a/src/my_page.h +++ b/src/my_page.h @@ -53,7 +53,7 @@ class MyPage { ipage++; if (ipage == npage) { allocate(); - if (errorflag) return NULL; + if (errorflag) return nullptr; } page = pages[ipage]; index = 0; diff --git a/src/nbin.cpp b/src/nbin.cpp index 66c5bd41596867b55a195128fe112a981ae1a94a..1fe011e9f2d644713226545c9bb8180e575fe1ee 100644 --- a/src/nbin.cpp +++ b/src/nbin.cpp @@ -27,9 +27,9 @@ NBin::NBin(LAMMPS *lmp) : Pointers(lmp) { last_bin = -1; mbins = maxbin = maxatom = 0; - binhead = NULL; - bins = NULL; - atom2bin = NULL; + binhead = nullptr; + bins = nullptr; + atom2bin = nullptr; neighbor->last_setup_bins = -1; diff --git a/src/neigh_list.cpp b/src/neigh_list.cpp index 8798ec8f9966c8fee2a7dfa3b2d1a10b37fbb246..1ed21b49e65065d6f6890abe0dca95ae727e3381 100644 --- a/src/neigh_list.cpp +++ b/src/neigh_list.cpp @@ -33,9 +33,9 @@ NeighList::NeighList(LAMMPS *lmp) : Pointers(lmp) maxatom = 0; inum = gnum = 0; - ilist = NULL; - numneigh = NULL; - firstneigh = NULL; + ilist = nullptr; + numneigh = nullptr; + firstneigh = nullptr; // defaults, but may be reset by post_constructor() @@ -51,31 +51,31 @@ NeighList::NeighList(LAMMPS *lmp) : Pointers(lmp) // ptrs - iskip = NULL; - ijskip = NULL; + iskip = nullptr; + ijskip = nullptr; - listcopy = NULL; - listskip = NULL; - listfull = NULL; + listcopy = nullptr; + listskip = nullptr; + listfull = nullptr; - fix_bond = NULL; + fix_bond = nullptr; - ipage = NULL; + ipage = nullptr; // extra rRESPA lists inum_inner = gnum_inner = 0; - ilist_inner = NULL; - numneigh_inner = NULL; - firstneigh_inner = NULL; + ilist_inner = nullptr; + numneigh_inner = nullptr; + firstneigh_inner = nullptr; inum_middle = gnum_middle = 0; - ilist_middle = NULL; - numneigh_middle = NULL; - firstneigh_middle = NULL; + ilist_middle = nullptr; + numneigh_middle = nullptr; + firstneigh_middle = nullptr; - ipage_inner = NULL; - ipage_middle = NULL; + ipage_inner = nullptr; + ipage_middle = nullptr; // Kokkos package @@ -85,9 +85,9 @@ NeighList::NeighList(LAMMPS *lmp) : Pointers(lmp) // USER-DPD package - np = NULL; + np = nullptr; - requestor = NULL; + requestor = nullptr; requestor_type = NeighList::NONE; } diff --git a/src/neigh_request.cpp b/src/neigh_request.cpp index 006ff5e87b21637b765caf0970834c915dbd87eb..f4c7e7e0bfd65aedd88becdf31a9cecb9fd5fb10 100644 --- a/src/neigh_request.cpp +++ b/src/neigh_request.cpp @@ -71,12 +71,12 @@ NeighRequest::NeighRequest(LAMMPS *lmp) : Pointers(lmp) // skip info, default is no skipping skip = 0; - iskip = NULL; - ijskip = NULL; + iskip = nullptr; + ijskip = nullptr; // only set when command = 1; - command_style = NULL; + command_style = nullptr; // info set by Neighbor class when morphing original requests @@ -217,8 +217,8 @@ void NeighRequest::copy_request(NeighRequest *other, int skipflag) cut = other->cut; cutoff = other->cutoff; - iskip = NULL; - ijskip = NULL; + iskip = nullptr; + ijskip = nullptr; if (!skipflag) return; diff --git a/src/neighbor.cpp b/src/neighbor.cpp index b15a359ceea48f2ff416a6e3c6bdd73b1b8574ee..4eabdcc7b4afa6f8e788767914c97c14658570a1 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -76,7 +76,7 @@ static const char cite_neigh_multi[] = /* ---------------------------------------------------------------------- */ Neighbor::Neighbor(LAMMPS *lmp) : Pointers(lmp), -pairclass(NULL), pairnames(NULL), pairmasks(NULL) +pairclass(nullptr), pairnames(nullptr), pairmasks(nullptr) { MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); @@ -95,62 +95,62 @@ pairclass(NULL), pairnames(NULL), pairmasks(NULL) ago = -1; cutneighmax = 0.0; - cutneighsq = NULL; - cutneighghostsq = NULL; - cuttype = NULL; - cuttypesq = NULL; - fixchecklist = NULL; + cutneighsq = nullptr; + cutneighghostsq = nullptr; + cuttype = nullptr; + cuttypesq = nullptr; + fixchecklist = nullptr; // pairwise neighbor lists and associated data structs nlist = 0; - lists = NULL; + lists = nullptr; nbin = 0; - neigh_bin = NULL; + neigh_bin = nullptr; nstencil = 0; - neigh_stencil = NULL; + neigh_stencil = nullptr; - neigh_pair = NULL; + neigh_pair = nullptr; nstencil_perpetual = 0; - slist = NULL; + slist = nullptr; npair_perpetual = 0; - plist = NULL; + plist = nullptr; nrequest = maxrequest = 0; - requests = NULL; + requests = nullptr; old_nrequest = 0; - old_requests = NULL; + old_requests = nullptr; old_style = style; old_triclinic = 0; old_pgsize = pgsize; old_oneatom = oneatom; - binclass = NULL; - binnames = NULL; - binmasks = NULL; - stencilclass = NULL; - stencilnames = NULL; - stencilmasks = NULL; + binclass = nullptr; + binnames = nullptr; + binmasks = nullptr; + stencilclass = nullptr; + stencilnames = nullptr; + stencilmasks = nullptr; // topology lists bondwhich = anglewhich = dihedralwhich = improperwhich = NONE; - neigh_bond = NULL; - neigh_angle = NULL; - neigh_dihedral = NULL; - neigh_improper = NULL; + neigh_bond = nullptr; + neigh_angle = nullptr; + neigh_dihedral = nullptr; + neigh_improper = nullptr; // coords at last neighboring maxhold = 0; - xhold = NULL; + xhold = nullptr; lastcall = -1; last_setup_bins = -1; @@ -159,14 +159,14 @@ pairclass(NULL), pairnames(NULL), pairmasks(NULL) includegroup = 0; nex_type = maxex_type = 0; - ex1_type = ex2_type = NULL; - ex_type = NULL; + ex1_type = ex2_type = nullptr; + ex_type = nullptr; nex_group = maxex_group = 0; - ex1_group = ex2_group = ex1_bit = ex2_bit = NULL; + ex1_group = ex2_group = ex1_bit = ex2_bit = nullptr; nex_mol = maxex_mol = 0; - ex_mol_group = ex_mol_bit = ex_mol_intra = NULL; + ex_mol_group = ex_mol_bit = ex_mol_intra = nullptr; // Kokkos setting @@ -270,7 +270,7 @@ void Neighbor::init() // set neighbor cutoffs (force cutoff + skin) // trigger determines when atoms migrate and neighbor lists are rebuilt // needs to be non-zero for migration distance check - // even if pair = NULL and no neighbor lists are used + // even if pair = nullptr and no neighbor lists are used // cutneigh = force cutoff + skin if cutforce > 0, else cutneigh = 0 // cutneighghost = pair cutghost if it requests it, else same as cutneigh @@ -281,7 +281,7 @@ void Neighbor::init() boxcheck = 1; n = atom->ntypes; - if (cutneighsq == NULL) { + if (cutneighsq == nullptr) { if (lmp->kokkos) init_cutneighsq_kokkos(n); else memory->create(cutneighsq,n+1,n+1,"neigh:cutneighsq"); memory->create(cutneighghostsq,n+1,n+1,"neigh:cutneighghostsq"); @@ -338,7 +338,7 @@ void Neighbor::init() if (output->restart_flag) restart_check = 1; delete [] fixchecklist; - fixchecklist = NULL; + fixchecklist = nullptr; fixchecklist = new int[modify->nfix]; fix_check = 0; @@ -378,7 +378,7 @@ void Neighbor::init() // We cannot remove special neighbors with kspace or kspace-like pair styles // as the exclusion needs to remove the full coulomb and not the damped interaction. // Special treatment is required for hybrid pair styles since Force::pair_match() - // will only return a non-NULL pointer if there is only one substyle of the kind. + // will only return a non-null pointer if there is only one substyle of the kind. if (force->kspace) { special_flag[1] = special_flag[2] = special_flag[3] = 2; @@ -410,7 +410,7 @@ void Neighbor::init() if (dist_check == 0) { memory->destroy(xhold); maxhold = 0; - xhold = NULL; + xhold = nullptr; } // first time allocation @@ -515,7 +515,7 @@ void Neighbor::init() for (int i = 0; i < nrequest; i++) { delete requests[i]; - requests[i] = NULL; + requests[i] = nullptr; } nrequest = 0; @@ -809,7 +809,7 @@ int Neighbor::init_pair() if (lists[i]->bin_method > 0) { neigh_stencil[nstencil]->nb = neigh_bin[requests[i]->index_bin]; - if (neigh_stencil[nstencil]->nb == NULL) + if (neigh_stencil[nstencil]->nb == nullptr) error->all(FLERR,"Could not assign bin method to neighbor stencil"); } @@ -823,7 +823,7 @@ int Neighbor::init_pair() requests[i]->index_pair = -1; flag = lists[i]->pair_method; if (flag == 0) { - neigh_pair[i] = NULL; + neigh_pair[i] = nullptr; continue; } @@ -834,12 +834,12 @@ int Neighbor::init_pair() if (lists[i]->bin_method > 0) { neigh_pair[i]->nb = neigh_bin[requests[i]->index_bin]; - if (neigh_pair[i]->nb == NULL) + if (neigh_pair[i]->nb == nullptr) error->all(FLERR,"Could not assign bin method to neighbor pair"); } if (lists[i]->stencil_method > 0) { neigh_pair[i]->ns = neigh_stencil[requests[i]->index_stencil]; - if (neigh_pair[i]->ns == NULL) + if (neigh_pair[i]->ns == nullptr) error->all(FLERR,"Could not assign stencil method to neighbor pair"); } @@ -905,11 +905,11 @@ int Neighbor::init_pair() done = 1; for (i = 0; i < npair_perpetual; i++) { for (k = 0; k < 3; k++) { - ptr = NULL; + ptr = nullptr; if (k == 0) ptr = lists[plist[i]]->listcopy; if (k == 1) ptr = lists[plist[i]]->listskip; if (k == 2) ptr = lists[plist[i]]->listfull; - if (ptr == NULL) continue; + if (ptr == nullptr) continue; for (m = 0; m < nrequest; m++) if (ptr == lists[m]) break; for (j = 0; j < npair_perpetual; j++) @@ -1575,17 +1575,17 @@ void Neighbor::requests_new2old() /* ---------------------------------------------------------------------- find and return request made by classptr - if not found or classpt = NULL, return NULL + if not found or classpt = nullptr, return nullptr ------------------------------------------------------------------------- */ NeighRequest *Neighbor::find_request(void *classptr) { - if (classptr == NULL) return NULL; + if (classptr == nullptr) return nullptr; for (int i = 0; i < nrequest; i++) if (requests[i]->requestor == classptr) return requests[i]; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- @@ -2138,7 +2138,7 @@ void Neighbor::build_one(class NeighList *mylist, int preflag) { // check if list structure is initialized - if (mylist == NULL) + if (mylist == nullptr) error->all(FLERR,"Trying to build an occasional neighbor list " "before initialization completed"); @@ -2283,7 +2283,7 @@ void Neighbor::modify_params(int narg, char **arg) includegroup = group->find(arg[iarg+1]); if (includegroup < 0) error->all(FLERR,"Invalid group ID in neigh_modify command"); - if (includegroup && (atom->firstgroupname == NULL || + if (includegroup && (atom->firstgroupname == nullptr || strcmp(arg[iarg+1],atom->firstgroupname) != 0)) error->all(FLERR, "Neigh_modify include group != atom_modify first group"); diff --git a/src/npair.cpp b/src/npair.cpp index b63135fad6baeb8081bdcb899f9bfdf1469f46cb..698ff280674cd17bfff5ff231ec0ae835cd01405 100644 --- a/src/npair.cpp +++ b/src/npair.cpp @@ -27,10 +27,10 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ NPair::NPair(LAMMPS *lmp) - : Pointers(lmp), nb(NULL), ns(NULL), bins(NULL), stencil(NULL) + : Pointers(lmp), nb(nullptr), ns(nullptr), bins(nullptr), stencil(nullptr) { last_build = -1; - mycutneighsq = NULL; + mycutneighsq = nullptr; molecular = atom->molecular; copymode = 0; execution_space = Host; diff --git a/src/nstencil.cpp b/src/nstencil.cpp index 9eb1818b8345fff0700217303af0894b78d7dcb3..861fcd537ec167afe8f397e3590a0d95b8e5dc11 100644 --- a/src/nstencil.cpp +++ b/src/nstencil.cpp @@ -59,11 +59,11 @@ NStencil::NStencil(LAMMPS *lmp) : Pointers(lmp) xyzflag = 0; maxstencil = maxstencil_multi = 0; - stencil = NULL; - stencilxyz = NULL; - nstencil_multi = NULL; - stencil_multi = NULL; - distsq_multi = NULL; + stencil = nullptr; + stencilxyz = nullptr; + nstencil_multi = nullptr; + stencil_multi = nullptr; + distsq_multi = nullptr; dimension = domain->dimension; } @@ -179,8 +179,8 @@ void NStencil::create_setup() distsq_multi = new double*[n+1]; for (i = 1; i <= n; i++) { nstencil_multi[i] = 0; - stencil_multi[i] = NULL; - distsq_multi[i] = NULL; + stencil_multi[i] = nullptr; + distsq_multi[i] = nullptr; } } if (smax > maxstencil_multi) { diff --git a/src/ntopo.cpp b/src/ntopo.cpp index a53d88505be3ea62bd6fc02fa3a531f69a76cfbb..d4163b014033d543b586704da09f5821133c96b4 100644 --- a/src/ntopo.cpp +++ b/src/ntopo.cpp @@ -33,7 +33,7 @@ NTopo::NTopo(LAMMPS *lmp) : Pointers(lmp) nbondlist = nanglelist = ndihedrallist = nimproperlist = 0; maxbond = maxangle = maxdihedral = maximproper = 0; - bondlist = anglelist = dihedrallist = improperlist = NULL; + bondlist = anglelist = dihedrallist = improperlist = nullptr; cluster_check = neighbor->cluster_check; } diff --git a/src/output.cpp b/src/output.cpp index d4fd5ae75e75754c98fb4968efa2976cea00044b..450bc46750df3bf0bac6e5bd2327d88659f47bc7 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -57,23 +57,23 @@ Output::Output(LAMMPS *lmp) : Pointers(lmp) delete [] newarg; thermo_every = 0; - var_thermo = NULL; + var_thermo = nullptr; ndump = 0; max_dump = 0; - every_dump = NULL; - next_dump = NULL; - last_dump = NULL; - var_dump = NULL; - ivar_dump = NULL; - dump = NULL; + every_dump = nullptr; + next_dump = nullptr; + last_dump = nullptr; + var_dump = nullptr; + ivar_dump = nullptr; + dump = nullptr; restart_flag = restart_flag_single = restart_flag_double = 0; restart_every_single = restart_every_double = 0; last_restart = -1; - restart1 = restart2a = restart2b = NULL; - var_restart_single = var_restart_double = NULL; - restart = NULL; + restart1 = restart2a = restart2b = nullptr; + var_restart_single = var_restart_double = nullptr; + restart = nullptr; dump_map = new DumpCreatorMap(); @@ -561,7 +561,7 @@ void Output::add_dump(int narg, char **arg) every_dump[ndump] = 0; last_dump[ndump] = -1; - var_dump[ndump] = NULL; + var_dump[ndump] = nullptr; ivar_dump[ndump] = -1; // create the Dump @@ -574,7 +574,7 @@ void Output::add_dump(int narg, char **arg) every_dump[ndump] = utils::inumeric(FLERR,arg[3],false,lmp); if (every_dump[ndump] <= 0) error->all(FLERR,"Illegal dump command"); last_dump[ndump] = -1; - var_dump[ndump] = NULL; + var_dump[ndump] = nullptr; ndump++; } @@ -642,7 +642,7 @@ void Output::delete_dump(char *id) int Output::find_dump(const char *id) { - if (id == NULL) return -1; + if (id == nullptr) return -1; int idump; for (idump = 0; idump < ndump; idump++) if (strcmp(id,dump[idump]->id) == 0) break; @@ -662,7 +662,7 @@ void Output::set_thermo(int narg, char **arg) // variable spaced thermo outputs to constant spaced ones. delete [] var_thermo; - var_thermo = NULL; + var_thermo = nullptr; if (strstr(arg[0],"v_") == arg[0]) { int n = strlen(&arg[0][2]) + 1; @@ -693,10 +693,10 @@ void Output::create_thermo(int narg, char **arg) error->warning(FLERR,"New thermo_style command, " "previous thermo_modify settings will be lost"); - // set thermo = NULL in case new Thermo throws an error + // set thermo = nullptr in case new Thermo throws an error delete thermo; - thermo = NULL; + thermo = nullptr; thermo = new Thermo(lmp,narg,arg); } @@ -722,14 +722,14 @@ void Output::create_restart(int narg, char **arg) last_restart = -1; delete restart; - restart = NULL; + restart = nullptr; delete [] restart1; delete [] restart2a; delete [] restart2b; - restart1 = restart2a = restart2b = NULL; + restart1 = restart2a = restart2b = nullptr; delete [] var_restart_single; delete [] var_restart_double; - var_restart_single = var_restart_double = NULL; + var_restart_single = var_restart_double = nullptr; return; } @@ -755,7 +755,7 @@ void Output::create_restart(int narg, char **arg) delete [] restart1; restart1 = new char[n]; strcpy(restart1,arg[1]); - if (strchr(restart1,'*') == NULL) strcat(restart1,".*"); + if (strchr(restart1,'*') == nullptr) strcat(restart1,".*"); } if (nfile == 2) { diff --git a/src/output.h b/src/output.h index 06be7b244a8c2535d72e687e5a70182841ec6efc..1af03df228607a4fd4ab55b3c2e2ab8ede9c7f21 100644 --- a/src/output.h +++ b/src/output.h @@ -29,7 +29,7 @@ class Output : protected Pointers { bigint next_thermo; // next timestep for thermo output int thermo_every; // output freq for thermo, 0 if first/last only bigint last_thermo; // last timestep thermo was output - char *var_thermo; // variable name for thermo freq, NULL if every + char *var_thermo; // variable name for thermo freq, null pointer if every int ivar_thermo; // variable index for thermo frequency class Thermo *thermo; // Thermodynamic computations diff --git a/src/pair.cpp b/src/pair.cpp index d869bbe8d8e98bd64c47f0692aa6e3edc77c9d43..60a5c0d8bfecc3972a0a30a35a58abde891d48dc 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -67,12 +67,12 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp) unit_convert_flag = utils::NOCONVERT; nextra = 0; - pvector = NULL; + pvector = nullptr; single_extra = 0; - svector = NULL; + svector = nullptr; - setflag = NULL; - cutsq = NULL; + setflag = nullptr; + cutsq = nullptr; ewaldflag = pppmflag = msmflag = dispersionflag = tip4pflag = dipoleflag = spinflag = 0; reinitflag = 1; @@ -91,19 +91,19 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp) ndisptablebits = 12; tabinner = sqrt(2.0); tabinner_disp = sqrt(2.0); - ftable = NULL; - fdisptable = NULL; + ftable = nullptr; + fdisptable = nullptr; allocated = 0; suffix_flag = Suffix::NONE; maxeatom = maxvatom = maxcvatom = 0; - eatom = NULL; - vatom = NULL; - cvatom = NULL; + eatom = nullptr; + vatom = nullptr; + cvatom = nullptr; num_tally_compute = 0; - list_tally_compute = NULL; + list_tally_compute = nullptr; nondefault_history_transfer = 0; beyond_contact = 0; @@ -123,7 +123,7 @@ Pair::~Pair() { num_tally_compute = 0; memory->sfree((void *) list_tally_compute); - list_tally_compute = NULL; + list_tally_compute = nullptr; if (copymode) return; @@ -331,7 +331,7 @@ void Pair::init_tables(double cut_coul, double *cut_respa) double r,grij,expm2,derfc,egamma,fgamma,rsw; double qqrd2e = force->qqrd2e; - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); double g_ewald = force->kspace->g_ewald; @@ -359,8 +359,8 @@ void Pair::init_tables(double cut_coul, double *cut_respa) memory->create(dctable,ntable,"pair:dctable"); memory->create(detable,ntable,"pair:detable"); - if (cut_respa == NULL) { - vtable = ptable = dvtable = dptable = NULL; + if (cut_respa == nullptr) { + vtable = ptable = dvtable = dptable = nullptr; } else { memory->create(vtable,ntable,"pair:vtable"); memory->create(ptable,ntable,"pair:ptable"); @@ -391,7 +391,7 @@ void Pair::init_tables(double cut_coul, double *cut_respa) expm2 = exp(-grij*grij); derfc = erfc(grij); } - if (cut_respa == NULL) { + if (cut_respa == nullptr) { rtable[i] = rsq_lookup.f; ctable[i] = qqrd2e/r; if (msmflag) { @@ -488,7 +488,7 @@ void Pair::init_tables(double cut_coul, double *cut_respa) expm2 = exp(-grij*grij); derfc = erfc(grij); } - if (cut_respa == NULL) { + if (cut_respa == nullptr) { c_tmp = qqrd2e/r; if (msmflag) { f_tmp = qqrd2e/r * fgamma; @@ -1664,7 +1664,7 @@ void Pair::write_file(int narg, char **arg) fp = fopen(table_file.c_str(),"a"); } else { char datebuf[16]; - time_t tv = time(NULL); + time_t tv = time(nullptr); strftime(datebuf,15,"%Y-%m-%d",localtime(&tv)); utils::logmesg(lmp,fmt::format("Creating table file {} with " "DATE: {}\n", table_file, datebuf)); @@ -1672,7 +1672,7 @@ void Pair::write_file(int narg, char **arg) if (fp) fmt::print(fp,"# DATE: {} UNITS: {} Created by pair_write\n", datebuf, update->unit_style); } - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open pair_write file {}: {}", table_file, utils::getsyserror())); fprintf(fp,"# Pair potential %s for atom types %d %d: i,r,energy,force\n", diff --git a/src/pair.h b/src/pair.h index 00f433233ede87536cf0c63a0a413a8df7abb505..ace233539f11f5d8abc0574bdff42e31cb62e9e0 100644 --- a/src/pair.h +++ b/src/pair.h @@ -197,7 +197,7 @@ class Pair : protected Pointers { // specific child-class methods for certain Pair styles - virtual void *extract(const char *, int &) {return NULL;} + virtual void *extract(const char *, int &) {return nullptr;} virtual void swap_eam(double *, double **) {} virtual void reset_dt() {} virtual void min_xf_pointers(int, double **, double **) {} diff --git a/src/pair_beck.cpp b/src/pair_beck.cpp index 87aa0bab5f2dc69380623b0cdedad775907d25d6..777c7e4c480b0a88040c5a7093f71d6e5c4e1f49 100644 --- a/src/pair_beck.cpp +++ b/src/pair_beck.cpp @@ -281,16 +281,16 @@ void PairBeck::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&AA[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&BB[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&aa[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&beta[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&AA[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&BB[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&aa[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&beta[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&AA[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&BB[i][j],1,MPI_DOUBLE,0,world); @@ -320,8 +320,8 @@ void PairBeck::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); diff --git a/src/pair_born.cpp b/src/pair_born.cpp index 5b0d3a656210af8b078da355f4eafe33b45822fd..fee494fd9c55c9a28621a4f91702497796792aba 100644 --- a/src/pair_born.cpp +++ b/src/pair_born.cpp @@ -330,16 +330,16 @@ void PairBorn::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -370,10 +370,10 @@ void PairBorn::write_restart_settings(FILE *fp) void PairBorn::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -433,5 +433,5 @@ void *PairBorn::extract(const char *str, int &dim) if (strcmp(str,"a") == 0) return (void *) a; if (strcmp(str,"c") == 0) return (void *) c; if (strcmp(str,"d") == 0) return (void *) d; - return NULL; + return nullptr; } diff --git a/src/pair_born_coul_dsf.cpp b/src/pair_born_coul_dsf.cpp index e4617b5c4b847d0a70c6b95bd9fb6ac5d6c454bc..abe3d1e0710671b7ff9e1f75123b0eebb628d438 100644 --- a/src/pair_born_coul_dsf.cpp +++ b/src/pair_born_coul_dsf.cpp @@ -361,16 +361,16 @@ void PairBornCoulDSF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -402,11 +402,11 @@ void PairBornCoulDSF::write_restart_settings(FILE *fp) void PairBornCoulDSF::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&alpha,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&alpha,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&alpha,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_born_coul_wolf.cpp b/src/pair_born_coul_wolf.cpp index 30fe8fcde9021d542857509782d347df715ff71c..a873ec6c62983ae7dfbf9a8238527b67c3f157e7 100644 --- a/src/pair_born_coul_wolf.cpp +++ b/src/pair_born_coul_wolf.cpp @@ -360,16 +360,16 @@ void PairBornCoulWolf::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&d[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -401,11 +401,11 @@ void PairBornCoulWolf::write_restart_settings(FILE *fp) void PairBornCoulWolf::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&alf,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&alf,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&alf,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_buck.cpp b/src/pair_buck.cpp index 1abdbcc68bd618011bb6b41dddd040bc1a181e37..6de115a0e5a1b274ada92faf28d0e3087ab03f2b 100644 --- a/src/pair_buck.cpp +++ b/src/pair_buck.cpp @@ -309,14 +309,14 @@ void PairBuck::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -345,10 +345,10 @@ void PairBuck::write_restart_settings(FILE *fp) void PairBuck::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -405,5 +405,5 @@ void *PairBuck::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"a") == 0) return (void *) a; if (strcmp(str,"c") == 0) return (void *) c; - return NULL; + return nullptr; } diff --git a/src/pair_buck_coul_cut.cpp b/src/pair_buck_coul_cut.cpp index 9fac17aede4e9a2a8dfa68d6627cb5df9781568a..9cc90ebc8198023d2051e0f75c4e7802424927be 100644 --- a/src/pair_buck_coul_cut.cpp +++ b/src/pair_buck_coul_cut.cpp @@ -364,15 +364,15 @@ void PairBuckCoulCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&rho[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&c[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&rho[i][j],1,MPI_DOUBLE,0,world); @@ -403,11 +403,11 @@ void PairBuckCoulCut::write_restart_settings(FILE *fp) void PairBuckCoulCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_coul_cut.cpp b/src/pair_coul_cut.cpp index 67c471a5e3e52f665e859286f14add67ec5beee7..5aa281190e5772303c5b31d00c43192b7b85e5e5 100644 --- a/src/pair_coul_cut.cpp +++ b/src/pair_coul_cut.cpp @@ -247,10 +247,10 @@ void PairCoulCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { - if (me == 0) utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); } } @@ -274,9 +274,9 @@ void PairCoulCut::write_restart_settings(FILE *fp) void PairCoulCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -307,5 +307,5 @@ void *PairCoulCut::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"cut_coul") == 0) return (void *) &cut; if (strcmp(str,"scale") == 0) return (void *) scale; - return NULL; + return nullptr; } diff --git a/src/pair_coul_debye.cpp b/src/pair_coul_debye.cpp index 20937182455d6dfbc28f0ad27284c1c6a04e11d4..31838fbee5e80033df34053d73c8dc406a33ead5 100644 --- a/src/pair_coul_debye.cpp +++ b/src/pair_coul_debye.cpp @@ -146,10 +146,10 @@ void PairCoulDebye::write_restart_settings(FILE *fp) void PairCoulDebye::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&kappa,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&kappa,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&kappa,1,MPI_DOUBLE,0,world); diff --git a/src/pair_coul_dsf.cpp b/src/pair_coul_dsf.cpp index ee124c7f59f500dfa83652c88ec9f7acd2faedbf..94106405b08bafcf6248c008d4fc00a02ed61930 100644 --- a/src/pair_coul_dsf.cpp +++ b/src/pair_coul_dsf.cpp @@ -254,7 +254,7 @@ void PairCoulDSF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); } } @@ -278,10 +278,10 @@ void PairCoulDSF::write_restart_settings(FILE *fp) void PairCoulDSF::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&alpha,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&alpha,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&alpha,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); @@ -327,5 +327,5 @@ void *PairCoulDSF::extract(const char *str, int &dim) dim = 0; return (void *) &cut_coul; } - return NULL; + return nullptr; } diff --git a/src/pair_coul_streitz.cpp b/src/pair_coul_streitz.cpp index e538275b3ca3fd1b4bcaf65964ca8ce273c463d7..101aaf36a3d1e4cb000c5b8da8b8ecdb7038fa86 100644 --- a/src/pair_coul_streitz.cpp +++ b/src/pair_coul_streitz.cpp @@ -51,11 +51,11 @@ PairCoulStreitz::PairCoulStreitz(LAMMPS *lmp) : Pair(lmp) nmax = 0; nelements = 0; - elements = NULL; + elements = nullptr; nparams = 0; maxparam = 0; - params = NULL; - elem2param = NULL; + params = nullptr; + elem2param = nullptr; } /* ---------------------------------------------------------------------- @@ -143,7 +143,7 @@ void PairCoulStreitz::coeff(int narg, char **arg) error->all(FLERR,"Incorrect args for pair coefficients"); // read args that map atom types to elements in potential file - // map[i] = which element the Ith atom type is, -1 if NULL + // map[i] = which element the Ith atom type is, -1 if "NULL" // nelements = # of unique elements // elements = list of element names @@ -152,7 +152,7 @@ void PairCoulStreitz::coeff(int narg, char **arg) delete [] elements; } elements = new char*[atom->ntypes]; - for (i = 0; i < atom->ntypes; i++) elements[i] = NULL; + for (i = 0; i < atom->ntypes; i++) elements[i] = nullptr; nelements = 0; for (i = 3; i < narg; i++) { @@ -215,7 +215,7 @@ void PairCoulStreitz::init_style() // insure use of KSpace long-range solver when ewald specified, set g_ewald if (ewaldflag) { - if (force->kspace == NULL) + if (force->kspace == nullptr) error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; } @@ -799,5 +799,5 @@ void *PairCoulStreitz::extract(const char *str, int &dim) if (kspacetype == 1) return (void *) &g_wolf; if (kspacetype == 2) return (void *) &g_ewald; } - return NULL; + return nullptr; } diff --git a/src/pair_coul_wolf.cpp b/src/pair_coul_wolf.cpp index e3079dcaf659e8c6e77d1e62625e134e75d7452b..994e74fc902d53741439fc2315573ed48c320c48 100644 --- a/src/pair_coul_wolf.cpp +++ b/src/pair_coul_wolf.cpp @@ -250,7 +250,7 @@ void PairCoulWolf::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); } } @@ -274,10 +274,10 @@ void PairCoulWolf::write_restart_settings(FILE *fp) void PairCoulWolf::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&alf,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&alf,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&alf,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world); diff --git a/src/pair_dpd.cpp b/src/pair_dpd.cpp index d0d9b98fc9f4bbd60eac9ad20c8cd46e065f9c92..d92f4b7cca8c0572b8b65120154a9e913bb46c95 100644 --- a/src/pair_dpd.cpp +++ b/src/pair_dpd.cpp @@ -38,7 +38,7 @@ using namespace LAMMPS_NS; PairDPD::PairDPD(LAMMPS *lmp) : Pair(lmp) { writedata = 1; - random = NULL; + random = nullptr; } /* ---------------------------------------------------------------------- */ @@ -314,13 +314,13 @@ void PairDPD::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&gamma[i][j],1,MPI_DOUBLE,0,world); @@ -348,10 +348,10 @@ void PairDPD::write_restart_settings(FILE *fp) void PairDPD::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&temperature,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&temperature,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&temperature,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_dpd_tstat.cpp b/src/pair_dpd_tstat.cpp index dd0e144953a4b15650cf7bfa970ccefcece2be4a..4b9c186dab302179f1ff9de71bc68b0a8d35527d 100644 --- a/src/pair_dpd_tstat.cpp +++ b/src/pair_dpd_tstat.cpp @@ -232,12 +232,12 @@ void PairDPDTstat::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&gamma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&gamma[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -265,11 +265,11 @@ void PairDPDTstat::write_restart_settings(FILE *fp) void PairDPDTstat::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&t_start,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&t_stop,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&seed,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&t_start,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&t_stop,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&seed,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&t_start,1,MPI_DOUBLE,0,world); MPI_Bcast(&t_stop,1,MPI_DOUBLE,0,world); diff --git a/src/pair_gauss.cpp b/src/pair_gauss.cpp index 67322967641dc952d98d4a4a6686d4f079264555..39c8caa732fc3ca0a1038e8c45932ea3519a154c 100644 --- a/src/pair_gauss.cpp +++ b/src/pair_gauss.cpp @@ -280,13 +280,13 @@ void PairGauss::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&b[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&b[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&b[i][j],1,MPI_DOUBLE,0,world); @@ -313,9 +313,9 @@ void PairGauss::write_restart_settings(FILE *fp) void PairGauss::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -361,5 +361,5 @@ void *PairGauss::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"a") == 0) return (void *) a; - return NULL; + return nullptr; } diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 0b1882f12be0d299df7beb772fd0c413640d1d5a..7f7f795b80182db93613ff8574117c8909192170 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -35,8 +35,8 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ PairHybrid::PairHybrid(LAMMPS *lmp) : Pair(lmp), - styles(NULL), keywords(NULL), multiple(NULL), nmap(NULL), - map(NULL), special_lj(NULL), special_coul(NULL), compute_tally(NULL) + styles(nullptr), keywords(nullptr), multiple(nullptr), nmap(nullptr), + map(nullptr), special_lj(nullptr), special_coul(nullptr), compute_tally(nullptr) { nstyles = 0; @@ -116,7 +116,7 @@ void PairHybrid::compute(int eflag, int vflag) // check if we are running with r-RESPA using the hybrid keyword - Respa *respa = NULL; + Respa *respa = nullptr; respaflag = 0; if (strstr(update->integrate_style,"respa")) { respa = (Respa *) update->integrate; @@ -324,7 +324,7 @@ void PairHybrid::settings(int narg, char **arg) styles[nstyles] = force->new_pair(arg[iarg],1,dummy); force->store_style(keywords[nstyles],arg[iarg],0); - special_lj[nstyles] = special_coul[nstyles] = NULL; + special_lj[nstyles] = special_coul[nstyles] = nullptr; compute_tally[nstyles] = 1; // determine list of arguments for pair style settings @@ -706,10 +706,10 @@ void PairHybrid::write_restart(FILE *fp) fwrite(keywords[m],sizeof(char),n,fp); styles[m]->write_restart_settings(fp); // write out per style special settings, if present - n = (special_lj[m] == NULL) ? 0 : 1; + n = (special_lj[m] == nullptr) ? 0 : 1; fwrite(&n,sizeof(int),1,fp); if (n) fwrite(special_lj[m],sizeof(double),4,fp); - n = (special_coul[m] == NULL) ? 0 : 1; + n = (special_coul[m] == nullptr) ? 0 : 1; fwrite(&n,sizeof(int),1,fp); if (n) fwrite(special_coul[m],sizeof(double),4,fp); } @@ -722,7 +722,7 @@ void PairHybrid::write_restart(FILE *fp) void PairHybrid::read_restart(FILE *fp) { int me = comm->me; - if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&nstyles,1,MPI_INT,0,world); // allocate list of sub-styles @@ -745,32 +745,32 @@ void PairHybrid::read_restart(FILE *fp) // each sub-style is created via new_pair() // each reads its settings, but no coeff info - if (me == 0) utils::sfread(FLERR,compute_tally,sizeof(int),nstyles,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,compute_tally,sizeof(int),nstyles,fp,nullptr,error); MPI_Bcast(compute_tally,nstyles,MPI_INT,0,world); int n,dummy; for (int m = 0; m < nstyles; m++) { - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); keywords[m] = new char[n]; - if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,nullptr,error); MPI_Bcast(keywords[m],n,MPI_CHAR,0,world); styles[m] = force->new_pair(keywords[m],1,dummy); styles[m]->read_restart_settings(fp); // read back per style special settings, if present - special_lj[m] = special_coul[m] = NULL; - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + special_lj[m] = special_coul[m] = nullptr; + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); if (n > 0 ) { special_lj[m] = new double[4]; - if (me == 0) utils::sfread(FLERR,special_lj[m],sizeof(double),4,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,special_lj[m],sizeof(double),4,fp,nullptr,error); MPI_Bcast(special_lj[m],4,MPI_DOUBLE,0,world); } - if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); MPI_Bcast(&n,1,MPI_INT,0,world); if (n > 0 ) { special_coul[m] = new double[4]; - if (me == 0) utils::sfread(FLERR,special_coul[m],sizeof(double),4,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,special_coul[m],sizeof(double),4,fp,nullptr,error); MPI_Bcast(special_coul[m],4,MPI_DOUBLE,0,world); } } @@ -813,8 +813,8 @@ double PairHybrid::single(int i, int j, int itype, int jtype, if (styles[map[itype][jtype][m]]->single_enable == 0) error->one(FLERR,"Pair hybrid sub-style does not support single call"); - if ((special_lj[map[itype][jtype][m]] != NULL) || - (special_coul[map[itype][jtype][m]] != NULL)) + if ((special_lj[map[itype][jtype][m]] != nullptr) || + (special_coul[map[itype][jtype][m]] != nullptr)) error->one(FLERR,"Pair hybrid single calls do not support" " per sub-style special bond values"); @@ -1006,13 +1006,13 @@ void PairHybrid::restore_special(double *saved) /* ---------------------------------------------------------------------- extract a ptr to a particular quantity stored by pair pass request thru to sub-styles - return first non-NULL result except for cut_coul request - for cut_coul, insure all non-NULL results are equal since required by Kspace + return first non-nullptr result except for cut_coul request + for cut_coul, insure all non-nullptr results are equal since required by Kspace ------------------------------------------------------------------------- */ void *PairHybrid::extract(const char *str, int &dim) { - void *cutptr = NULL; + void *cutptr = nullptr; void *ptr; double cutvalue = 0.0; int couldim = -1; @@ -1037,7 +1037,7 @@ void *PairHybrid::extract(const char *str, int &dim) } if (strcmp(str,"cut_coul") == 0) return cutptr; - return NULL; + return nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/pair_hybrid_overlay.cpp b/src/pair_hybrid_overlay.cpp index 34c4cfe41864e7d7fdbd808beb1623c30dafce9f..8d352e9f2ee909280b6a68dc2962f424b3cfebff 100644 --- a/src/pair_hybrid_overlay.cpp +++ b/src/pair_hybrid_overlay.cpp @@ -140,7 +140,7 @@ void PairHybridOverlay::copy_svector(int itype, int jtype) if (m == map[itype][jtype][k]) { this_style = styles[m]; } else { - this_style = NULL; + this_style = nullptr; } } for (int l = 0; l < styles[m]->single_extra; ++l) { diff --git a/src/pair_lj96_cut.cpp b/src/pair_lj96_cut.cpp index a4ba3b858517e66152c229d6ea17c3f9555017d8..444538b253a7b6c5abbf536b267de9634cdcb6e2 100644 --- a/src/pair_lj96_cut.cpp +++ b/src/pair_lj96_cut.cpp @@ -41,7 +41,7 @@ PairLJ96Cut::PairLJ96Cut(LAMMPS *lmp) : Pair(lmp) { respa_enable = 1; writedata = 1; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -508,7 +508,7 @@ void PairLJ96Cut::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -607,13 +607,13 @@ void PairLJ96Cut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -642,10 +642,10 @@ void PairLJ96Cut::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); diff --git a/src/pair_lj_cubic.cpp b/src/pair_lj_cubic.cpp index b6c91cafe205d15a12af7283f60cba098da54477..f5f8038bef620d8f0f57b176f6335396bd7e65d6 100644 --- a/src/pair_lj_cubic.cpp +++ b/src/pair_lj_cubic.cpp @@ -279,14 +279,14 @@ void PairLJCubic::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -313,7 +313,7 @@ void PairLJCubic::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&mix_flag,1,MPI_INT,0,world); } diff --git a/src/pair_lj_cut.cpp b/src/pair_lj_cut.cpp index bd42801f3b1c3e77d5095b594ccada83256594f2..f9b5a25523a9c40040d8bc8cc4f3769834fd53c2 100644 --- a/src/pair_lj_cut.cpp +++ b/src/pair_lj_cut.cpp @@ -502,7 +502,7 @@ void PairLJCut::init_style() if (utils::strmatch(update->integrate_style,"^respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -601,13 +601,13 @@ void PairLJCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -636,10 +636,10 @@ void PairLJCut::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -693,5 +693,5 @@ void *PairLJCut::extract(const char *str, int &dim) dim = 2; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/pair_lj_cut_coul_cut.cpp b/src/pair_lj_cut_coul_cut.cpp index 669d48c86090ac159b82d19d34cf891c303e68c4..38f4316d29e5110f1c3d020eef86e370b97fe67b 100644 --- a/src/pair_lj_cut_coul_cut.cpp +++ b/src/pair_lj_cut_coul_cut.cpp @@ -354,14 +354,14 @@ void PairLJCutCoulCut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -391,11 +391,11 @@ void PairLJCutCoulCut::write_restart_settings(FILE *fp) void PairLJCutCoulCut::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); @@ -466,5 +466,5 @@ void *PairLJCutCoulCut::extract(const char *str, int &dim) if (strcmp(str,"cut_coul") == 0) return (void *) &cut_coul; if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; - return NULL; + return nullptr; } diff --git a/src/pair_lj_cut_coul_debye.cpp b/src/pair_lj_cut_coul_debye.cpp index 3ddb898c8feeb7e65599b7e1f61c4e2450958f18..ed09e98062b9401fc590a85f2793a166da0e3e71 100644 --- a/src/pair_lj_cut_coul_debye.cpp +++ b/src/pair_lj_cut_coul_debye.cpp @@ -171,11 +171,11 @@ void PairLJCutCoulDebye::write_restart_settings(FILE *fp) void PairLJCutCoulDebye::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&kappa,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&kappa,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_coul_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_lj_cut_coul_dsf.cpp b/src/pair_lj_cut_coul_dsf.cpp index 952a140039db532bee480a57840019f03f27d8c0..f2c48b2229f5c1225d5fe0b5a69ed8ee1fb6f4ae 100644 --- a/src/pair_lj_cut_coul_dsf.cpp +++ b/src/pair_lj_cut_coul_dsf.cpp @@ -377,13 +377,13 @@ void PairLJCutCoulDSF::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -413,12 +413,12 @@ void PairLJCutCoulDSF::write_restart_settings(FILE *fp) void PairLJCutCoulDSF::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&alpha,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&alpha,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&alpha,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); @@ -477,5 +477,5 @@ void *PairLJCutCoulDSF::extract(const char *str, int &dim) dim = 0; return (void *) &cut_coul; } - return NULL; + return nullptr; } diff --git a/src/pair_lj_cut_coul_wolf.cpp b/src/pair_lj_cut_coul_wolf.cpp index 749cc9e6a952cbbaff5b1818d455ea5ffe330733..e6b00b9a56f5b4575ccde015d12c015dcd29be76 100644 --- a/src/pair_lj_cut_coul_wolf.cpp +++ b/src/pair_lj_cut_coul_wolf.cpp @@ -370,13 +370,13 @@ void PairLJCutCoulWolf::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -407,12 +407,12 @@ void PairLJCutCoulWolf::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&alf,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&alf,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&alf,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_lj_expand.cpp b/src/pair_lj_expand.cpp index 3f711e2a159b700d04b7dcdd738e68050ba51884..c68c2298e5b4edecb142a03386c97148f7f9494c 100644 --- a/src/pair_lj_expand.cpp +++ b/src/pair_lj_expand.cpp @@ -325,14 +325,14 @@ void PairLJExpand::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&shift[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&shift[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -361,10 +361,10 @@ void PairLJExpand::write_restart_settings(FILE *fp) void PairLJExpand::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -423,5 +423,5 @@ void *PairLJExpand::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"delta") == 0) return (void *) shift; - return NULL; + return nullptr; } diff --git a/src/pair_lj_gromacs.cpp b/src/pair_lj_gromacs.cpp index 0818c60f315caadf640bfbd66f75e03df1250021..05f30bcdd598fa99b31e231415319ba1ec9b2237 100644 --- a/src/pair_lj_gromacs.cpp +++ b/src/pair_lj_gromacs.cpp @@ -339,14 +339,14 @@ void PairLJGromacs::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -376,10 +376,10 @@ void PairLJGromacs::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_inner_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_lj_gromacs_coul_gromacs.cpp b/src/pair_lj_gromacs_coul_gromacs.cpp index 005bc44061d3a4a591f0bbfeb1674e723ede817f..481e65723620bef5d3023381cb5f0026b5550596 100644 --- a/src/pair_lj_gromacs_coul_gromacs.cpp +++ b/src/pair_lj_gromacs_coul_gromacs.cpp @@ -379,12 +379,12 @@ void PairLJGromacsCoulGromacs::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -413,12 +413,12 @@ void PairLJGromacsCoulGromacs::write_restart_settings(FILE *fp) void PairLJGromacsCoulGromacs::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_lj_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_lj,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_lj_inner,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_lj,1,MPI_DOUBLE,0,world); diff --git a/src/pair_lj_smooth.cpp b/src/pair_lj_smooth.cpp index a53d703b8bbe7fb67f35cdac5958b9a6612750ae..7afc667358d783be4556abf2bdaf6dec62e226a1 100644 --- a/src/pair_lj_smooth.cpp +++ b/src/pair_lj_smooth.cpp @@ -353,14 +353,14 @@ void PairLJSmooth::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -390,10 +390,10 @@ void PairLJSmooth::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_inner_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_inner_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_lj_smooth_linear.cpp b/src/pair_lj_smooth_linear.cpp index 3697208d42bf7358b36161b32afa568a9cd054e3..78a538f13139a62eaec4dfeb441b64b6661ab2c9 100644 --- a/src/pair_lj_smooth_linear.cpp +++ b/src/pair_lj_smooth_linear.cpp @@ -286,13 +286,13 @@ void PairLJSmoothLinear::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -319,8 +319,8 @@ void PairLJSmoothLinear::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); diff --git a/src/pair_mie_cut.cpp b/src/pair_mie_cut.cpp index 7447e143f7de53a33462fae644378c0f64d72efa..5030ffc2affaebd1f192f8e51b03c7958f81b7ac 100644 --- a/src/pair_mie_cut.cpp +++ b/src/pair_mie_cut.cpp @@ -40,7 +40,7 @@ using namespace MathConst; PairMIECut::PairMIECut(LAMMPS *lmp) : Pair(lmp) { respa_enable = 1; - cut_respa = NULL; + cut_respa = nullptr; } /* ---------------------------------------------------------------------- */ @@ -517,7 +517,7 @@ void PairMIECut::init_style() if (strstr(update->integrate_style,"respa") && ((Respa *) update->integrate)->level_inner >= 0) cut_respa = ((Respa *) update->integrate)->cutoff; - else cut_respa = NULL; + else cut_respa = nullptr; } /* ---------------------------------------------------------------------- @@ -628,15 +628,15 @@ void PairMIECut::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamR[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&gamA[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamR[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&gamA[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -667,10 +667,10 @@ void PairMIECut::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -706,5 +706,5 @@ void *PairMIECut::extract(const char *str, int &dim) if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"gamR") == 0) return (void *) gamR; if (strcmp(str,"gamA") == 0) return (void *) gamA; - return NULL; + return nullptr; } diff --git a/src/pair_morse.cpp b/src/pair_morse.cpp index efcc1aa81182d476a54b16750fcb64a166f9a92b..b55fc7a8588e19d4fdaed13ceefa4aab81d6e161 100644 --- a/src/pair_morse.cpp +++ b/src/pair_morse.cpp @@ -266,14 +266,14 @@ void PairMorse::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&d0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&alpha[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&r0[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&d0[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&alpha[i][j],1,MPI_DOUBLE,0,world); @@ -301,9 +301,9 @@ void PairMorse::write_restart_settings(FILE *fp) void PairMorse::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -357,5 +357,5 @@ void *PairMorse::extract(const char *str, int &dim) if (strcmp(str,"d0") == 0) return (void *) d0; if (strcmp(str,"r0") == 0) return (void *) r0; if (strcmp(str,"alpha") == 0) return (void *) alpha; - return NULL; + return nullptr; } diff --git a/src/pair_soft.cpp b/src/pair_soft.cpp index f3dd139b694ddfb15095d3ce7d6f66d016312c7e..b6a3151987a489b18d09d5192d664a40d874bf82 100644 --- a/src/pair_soft.cpp +++ b/src/pair_soft.cpp @@ -245,12 +245,12 @@ void PairSoft::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&prefactor[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&prefactor[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&prefactor[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -275,8 +275,8 @@ void PairSoft::write_restart_settings(FILE *fp) void PairSoft::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); @@ -326,5 +326,5 @@ void *PairSoft::extract(const char *str, int &dim) { dim = 2; if (strcmp(str,"a") == 0) return (void *) prefactor; - return NULL; + return nullptr; } diff --git a/src/pair_table.cpp b/src/pair_table.cpp index 1711465ffa551d72217c791eeb571ac05a4f76cd..a92d2e4911f4075c9ffab061133a66b6eda51405 100644 --- a/src/pair_table.cpp +++ b/src/pair_table.cpp @@ -43,7 +43,7 @@ enum{NONE,RLINEAR,RSQ,BMP}; PairTable::PairTable(LAMMPS *lmp) : Pair(lmp) { ntables = 0; - tables = NULL; + tables = nullptr; unit_convert_flag = utils::get_supported_conversions(utils::ENERGY); } @@ -246,7 +246,7 @@ void PairTable::settings(int narg, char **arg) allocated = 0; ntables = 0; - tables = NULL; + tables = nullptr; } /* ---------------------------------------------------------------------- @@ -821,15 +821,15 @@ void PairTable::compute_table(Table *tb) } /* ---------------------------------------------------------------------- - set all ptrs in a table to NULL, so can be freed safely + set all ptrs in a table to a null pointer, so can be freed safely ------------------------------------------------------------------------- */ void PairTable::null_table(Table *tb) { - tb->rfile = tb->efile = tb->ffile = NULL; - tb->e2file = tb->f2file = NULL; - tb->rsq = tb->drsq = tb->e = tb->de = NULL; - tb->f = tb->df = tb->e2 = tb->f2 = NULL; + tb->rfile = tb->efile = tb->ffile = nullptr; + tb->e2file = tb->f2file = nullptr; + tb->rsq = tb->drsq = tb->e = tb->de = nullptr; + tb->f = tb->df = tb->e2 = tb->f2 = nullptr; } /* ---------------------------------------------------------------------- @@ -951,13 +951,13 @@ void PairTable::write_restart_settings(FILE *fp) void PairTable::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tablength,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&ewaldflag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&pppmflag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&msmflag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tip4pflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&tabstyle,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tablength,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&ewaldflag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&pppmflag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&msmflag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&dispersionflag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tip4pflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&tabstyle,1,MPI_INT,0,world); MPI_Bcast(&tablength,1,MPI_INT,0,world); @@ -1029,7 +1029,7 @@ double PairTable::single(int /*i*/, int /*j*/, int itype, int jtype, double rsq, void *PairTable::extract(const char *str, int &dim) { - if (strcmp(str,"cut_coul") != 0) return NULL; + if (strcmp(str,"cut_coul") != 0) return nullptr; if (ntables == 0) error->all(FLERR,"All pair coeffs are not set"); // only check for cutoff consistency if claiming to be KSpace compatible @@ -1042,5 +1042,5 @@ void *PairTable::extract(const char *str, int &dim) "Pair table cutoffs must all be equal to use with KSpace"); dim = 0; return &tables[0].cut; - } else return NULL; + } else return nullptr; } diff --git a/src/pair_ufm.cpp b/src/pair_ufm.cpp index 50cc87cf96234afc18b2a4acfaa03955e95a0f2d..e1e378155a17e94490a55f2da31eacb565b92d7b 100644 --- a/src/pair_ufm.cpp +++ b/src/pair_ufm.cpp @@ -278,14 +278,14 @@ void PairUFM::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&scale[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&scale[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world); @@ -314,9 +314,9 @@ void PairUFM::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); @@ -365,5 +365,5 @@ void *PairUFM::extract(const char *str, int &dim) if (strcmp(str,"epsilon") == 0) return (void *) epsilon; if (strcmp(str,"sigma") == 0) return (void *) sigma; if (strcmp(str,"scale") == 0) return (void *) scale; - return NULL; + return nullptr; } diff --git a/src/pair_yukawa.cpp b/src/pair_yukawa.cpp index 64294923462a9807620f3c362d431b5d2d28c7ef..6118e5f36b2114a03b8fa64c4520735756144117 100644 --- a/src/pair_yukawa.cpp +++ b/src/pair_yukawa.cpp @@ -253,12 +253,12 @@ void PairYukawa::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&a[i][j],sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&a[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); @@ -285,10 +285,10 @@ void PairYukawa::write_restart_settings(FILE *fp) void PairYukawa::read_restart_settings(FILE *fp) { if (comm->me == 0) { - utils::sfread(FLERR,&kappa,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&kappa,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&kappa,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); diff --git a/src/pair_zbl.cpp b/src/pair_zbl.cpp index 68c63c98060e8bab8f84cd425871fe757a00c4b4..7b028de65a15af2a4cf3b98a9cf57b6e6169f56c 100644 --- a/src/pair_zbl.cpp +++ b/src/pair_zbl.cpp @@ -285,10 +285,10 @@ void PairZBL::read_restart(FILE *fp) int i,j; int me = comm->me; for (i = 1; i <= atom->ntypes; i++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][i],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][i],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][i],1,MPI_INT,0,world); if (setflag[i][i]) { - if (me == 0) utils::sfread(FLERR,&z[i],sizeof(double),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&z[i],sizeof(double),1,fp,nullptr,error); MPI_Bcast(&z[i],1,MPI_DOUBLE,0,world); } } @@ -319,11 +319,11 @@ void PairZBL::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&cut_inner,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error); - utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&cut_inner,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,nullptr,error); + utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&cut_inner,1,MPI_DOUBLE,0,world); diff --git a/src/pair_zero.cpp b/src/pair_zero.cpp index 976bb1ba332db7aa7e4c9ee9cb02df23ce07fb91..a45fef67a54ea30f81ca620bede76fb55216f3d9 100644 --- a/src/pair_zero.cpp +++ b/src/pair_zero.cpp @@ -178,11 +178,11 @@ void PairZero::read_restart(FILE *fp) int me = comm->me; for (i = 1; i <= atom->ntypes; i++) for (j = i; j <= atom->ntypes; j++) { - if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,nullptr,error); MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world); if (setflag[i][j]) { if (me == 0) { - utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error); + utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,nullptr,error); } MPI_Bcast(&cut[i][j],1,MPI_DOUBLE,0,world); } @@ -207,8 +207,8 @@ void PairZero::read_restart_settings(FILE *fp) { int me = comm->me; if (me == 0) { - utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,NULL,error); - utils::sfread(FLERR,&coeffflag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&cut_global,sizeof(double),1,fp,nullptr,error); + utils::sfread(FLERR,&coeffflag,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&coeffflag,1,MPI_INT,0,world); diff --git a/src/procmap.cpp b/src/procmap.cpp index f80af9330eeae4269a04caef17e9ee58f57b32e7..b85b0abd019351f084ed7ace070a462e81777025 100644 --- a/src/procmap.cpp +++ b/src/procmap.cpp @@ -49,7 +49,7 @@ void ProcMap::onelevel_grid(int nprocs, int *user_procgrid, int *procgrid, // factors = list of all possible 3 factors of processor count - int npossible = factor(nprocs,NULL); + int npossible = factor(nprocs,nullptr); memory->create(factors,npossible,3,"procmap:factors"); npossible = factor(nprocs,factors); @@ -93,7 +93,7 @@ void ProcMap::twolevel_grid(int nprocs, int *user_procgrid, int *procgrid, // nfactors = list of all possible 3 factors of node count // constrain by 2d - int nnpossible = factor(nprocs/ncores,NULL); + int nnpossible = factor(nprocs/ncores,nullptr); memory->create(nfactors,nnpossible,3,"procmap:nfactors"); nnpossible = factor(nprocs/ncores,nfactors); @@ -102,7 +102,7 @@ void ProcMap::twolevel_grid(int nprocs, int *user_procgrid, int *procgrid, // cfactors = list of all possible 3 factors of core count // constrain by 2d - int ncpossible = factor(ncores,NULL); + int ncpossible = factor(ncores,nullptr); memory->create(cfactors,ncpossible,3,"procmap:cfactors"); ncpossible = factor(ncores,cfactors); @@ -205,7 +205,7 @@ void ProcMap::numa_grid(int nprocs, int *user_procgrid, int *procgrid, // initial factorization within NUMA node int **numafactors; - int numapossible = factor(procs_per_numa,NULL); + int numapossible = factor(procs_per_numa,nullptr); memory->create(numafactors,numapossible,3,"procmap:numafactors"); numapossible = factor(procs_per_numa,numafactors); @@ -230,7 +230,7 @@ void ProcMap::numa_grid(int nprocs, int *user_procgrid, int *procgrid, int node_count = nprocs / procs_per_numa; int **nodefactors; - int nodepossible = factor(node_count,NULL); + int nodepossible = factor(node_count,nullptr); memory->create(nodefactors,nodepossible,3,"procmap:nodefactors"); nodepossible = factor(node_count,nodefactors); @@ -281,11 +281,11 @@ void ProcMap::custom_grid(char *cfile, int nprocs, MPI_Comm_rank(world,&me); char line[MAXLINE]; - FILE *fp = NULL; + FILE *fp = nullptr; if (me == 0) { fp = fopen(cfile,"r"); - if (fp == NULL) error->one(FLERR,"Cannot open custom file"); + if (fp == nullptr) error->one(FLERR,"Cannot open custom file"); // skip header = blank and comment lines @@ -662,7 +662,7 @@ void ProcMap::output(char *file, int *procgrid, int ***grid2proc) FILE *fp; if (me == 0) { fp = fopen(file,"w"); - if (fp == NULL) error->one(FLERR,"Cannot open processors output file"); + if (fp == nullptr) error->one(FLERR,"Cannot open processors output file"); fprintf(fp,"LAMMPS mapping of processors to 3d grid\n"); fprintf(fp,"partition = %d\n",universe->iworld+1); fprintf(fp,"Px Py Pz = %d %d %d\n",procgrid[0],procgrid[1],procgrid[2]); @@ -722,7 +722,7 @@ void ProcMap::output(char *file, int *procgrid, int ***grid2proc) /* ---------------------------------------------------------------------- generate all possible 3-integer factorizations of N - store them in factors if non-NULL + store them in factors if non-nullptr return # of factorizations ------------------------------------------------------------------------- */ diff --git a/src/random_mars.cpp b/src/random_mars.cpp index 29314525a51477bef27b44f1eb0b5d531db2405f..3f5bd7a62f2d509ac3368dd4a42f99ef1e1753eb 100644 --- a/src/random_mars.cpp +++ b/src/random_mars.cpp @@ -27,7 +27,7 @@ enum{ADD,SUBTRACT}; /* ---------------------------------------------------------------------- */ RanMars::RanMars(LAMMPS *lmp, int seed) : Pointers(lmp), - u(NULL) + u(nullptr) { int ij,kl,i,j,k,l,ii,jj,m; double s,t; diff --git a/src/rcb.cpp b/src/rcb.cpp index 9cb4248ab02cd47f3199c01cc2bd8030242f0516..1d319187426d66dd1608eb957ffb3ed0f2e0f84e 100644 --- a/src/rcb.cpp +++ b/src/rcb.cpp @@ -39,19 +39,19 @@ RCB::RCB(LAMMPS *lmp) : Pointers(lmp) MPI_Comm_size(world,&nprocs); ndot = maxdot = 0; - dots = NULL; + dots = nullptr; nlist = maxlist = 0; - dotlist = dotmark = dotmark_select = NULL; + dotlist = dotmark = dotmark_select = nullptr; maxbuf = 0; - buf = NULL; + buf = nullptr; maxrecv = maxsend = 0; - recvproc = recvindex = sendproc = sendindex = NULL; + recvproc = recvindex = sendproc = sendindex = nullptr; - tree = NULL; - irregular = NULL; + tree = nullptr; + irregular = nullptr; // create MPI data and function types for box and median AllReduce ops @@ -95,7 +95,7 @@ RCB::~RCB() NEW version: each RCB cut is tested in all dimensions dimeension that produces 2 boxes with largest min size is selected this is to prevent very narrow boxes from being produced - if wt = NULL, ignore per-particle weights + if wt = nullptr, ignore per-particle weights if wt defined, per-particle weights > 0.0 dimension = 2 or 3 as documented in rcb.h: @@ -573,10 +573,10 @@ void RCB::compute(int dimension, int n, double **x, double *wt, // handshake before sending dots to insure recvs have been posted if (readnumber > 0) { - MPI_Send(NULL,0,MPI_INT,procpartner,0,world); - if (readnumber == 2) MPI_Send(NULL,0,MPI_INT,procpartner2,0,world); + MPI_Send(nullptr,0,MPI_INT,procpartner,0,world); + if (readnumber == 2) MPI_Send(nullptr,0,MPI_INT,procpartner2,0,world); } - MPI_Recv(NULL,0,MPI_INT,procpartner,0,world,MPI_STATUS_IGNORE); + MPI_Recv(nullptr,0,MPI_INT,procpartner,0,world,MPI_STATUS_IGNORE); // send dots to partner @@ -632,7 +632,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt, /* ---------------------------------------------------------------------- perform RCB balancing of N particles at coords X in bounding box LO/HI OLD version: each RCB cut is made in longest dimension of sub-box - if wt = NULL, ignore per-particle weights + if wt = nullptr, ignore per-particle weights if wt defined, per-particle weights > 0.0 dimension = 2 or 3 as documented in rcb.h: @@ -1065,10 +1065,10 @@ void RCB::compute_old(int dimension, int n, double **x, double *wt, // handshake before sending dots to insure recvs have been posted if (readnumber > 0) { - MPI_Send(NULL,0,MPI_INT,procpartner,0,world); - if (readnumber == 2) MPI_Send(NULL,0,MPI_INT,procpartner2,0,world); + MPI_Send(nullptr,0,MPI_INT,procpartner,0,world); + if (readnumber == 2) MPI_Send(nullptr,0,MPI_INT,procpartner2,0,world); } - MPI_Recv(NULL,0,MPI_INT,procpartner,0,world,MPI_STATUS_IGNORE); + MPI_Recv(nullptr,0,MPI_INT,procpartner,0,world,MPI_STATUS_IGNORE); // send dots to partner diff --git a/src/read_data.cpp b/src/read_data.cpp index 6197c5477f574a83618b9b0af59fb15a671f69c3..06113baf778403740e58e6b547507662a6812c9a 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -62,7 +62,7 @@ enum{NONE,APPEND,VALUE,MERGE}; const char *suffixes[] = {"/cuda","/gpu","/opt","/omp","/kk", "/coul/cut","/coul/long","/coul/msm", "/coul/dsf","/coul/debye","/coul/charmm", - NULL}; + nullptr}; /* ---------------------------------------------------------------------- */ @@ -74,8 +74,8 @@ ReadData::ReadData(LAMMPS *lmp) : Pointers(lmp) style = new char[MAXLINE]; buffer = new char[CHUNK*MAXLINE]; narg = maxarg = 0; - arg = NULL; - fp = NULL; + arg = nullptr; + fp = nullptr; // customize for new sections // pointers to atom styles that store bonus info @@ -132,9 +132,9 @@ void ReadData::command(int narg, char **arg) groupbit = 0; nfix = 0; - fix_index = NULL; - fix_header = NULL; - fix_section = NULL; + fix_index = nullptr; + fix_header = nullptr; + fix_section = nullptr; int iarg = 1; while (iarg < narg) { @@ -277,7 +277,7 @@ void ReadData::command(int narg, char **arg) fix_index[nfix] = modify->find_fix(arg[iarg+1]); if (fix_index[nfix] < 0) error->all(FLERR,"Fix ID for read_data does not exist"); - if (strcmp(arg[iarg+2],"NULL") == 0) fix_header[nfix] = NULL; + if (strcmp(arg[iarg+2],"NULL") == 0) fix_header[nfix] = nullptr; else { int n = strlen(arg[iarg+2]) + 1; fix_header[nfix] = new char[n]; @@ -337,12 +337,12 @@ void ReadData::command(int narg, char **arg) // set up pointer to hold original styles while we replace them with "zero" - Pair *saved_pair = NULL; - Bond *saved_bond = NULL; - Angle *saved_angle = NULL; - Dihedral *saved_dihedral = NULL; - Improper *saved_improper = NULL; - KSpace *saved_kspace = NULL; + Pair *saved_pair = nullptr; + Bond *saved_bond = nullptr; + Angle *saved_angle = nullptr; + Dihedral *saved_dihedral = nullptr; + Improper *saved_improper = nullptr; + KSpace *saved_kspace = nullptr; if (coeffflag == 0) { char *coeffs[2]; @@ -350,33 +350,33 @@ void ReadData::command(int narg, char **arg) coeffs[1] = (char *) "nocoeff"; saved_pair = force->pair; - force->pair = NULL; + force->pair = nullptr; force->create_pair("zero",0); if (force->pair) force->pair->settings(2,coeffs); coeffs[0] = coeffs[1]; saved_bond = force->bond; - force->bond = NULL; + force->bond = nullptr; force->create_bond("zero",0); if (force->bond) force->bond->settings(1,coeffs); saved_angle = force->angle; - force->angle = NULL; + force->angle = nullptr; force->create_angle("zero",0); if (force->angle) force->angle->settings(1,coeffs); saved_dihedral = force->dihedral; - force->dihedral = NULL; + force->dihedral = nullptr; force->create_dihedral("zero",0); if (force->dihedral) force->dihedral->settings(1,coeffs); saved_improper = force->improper; - force->improper = NULL; + force->improper = nullptr; force->create_improper("zero",0); if (force->improper) force->improper->settings(1,coeffs); saved_kspace = force->kspace; - force->kspace = NULL; + force->kspace = nullptr; } // ----------------------------------------------------------------- @@ -417,7 +417,7 @@ void ReadData::command(int narg, char **arg) if (me == 0) { if (firstpass) utils::logmesg(lmp,"Reading data file ...\n"); open(arg[0]); - } else fp = NULL; + } else fp = nullptr; // read header info @@ -581,7 +581,7 @@ void ReadData::command(int narg, char **arg) if (firstpass) mass(); else skip_lines(ntypes); } else if (strcmp(keyword,"Pair Coeffs") == 0) { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Must define pair_style before Pair Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->pair_style)) @@ -590,7 +590,7 @@ void ReadData::command(int narg, char **arg) paircoeffs(); } else skip_lines(ntypes); } else if (strcmp(keyword,"PairIJ Coeffs") == 0) { - if (force->pair == NULL) + if (force->pair == nullptr) error->all(FLERR,"Must define pair_style before PairIJ Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->pair_style)) @@ -601,7 +601,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"Bond Coeffs") == 0) { if (atom->avec->bonds_allow == 0) error->all(FLERR,"Invalid data file section: Bond Coeffs"); - if (force->bond == NULL) + if (force->bond == nullptr) error->all(FLERR,"Must define bond_style before Bond Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->bond_style)) @@ -612,7 +612,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"Angle Coeffs") == 0) { if (atom->avec->angles_allow == 0) error->all(FLERR,"Invalid data file section: Angle Coeffs"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must define angle_style before Angle Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->angle_style)) @@ -623,7 +623,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"Dihedral Coeffs") == 0) { if (atom->avec->dihedrals_allow == 0) error->all(FLERR,"Invalid data file section: Dihedral Coeffs"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR,"Must define dihedral_style before Dihedral Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->dihedral_style)) @@ -634,7 +634,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"Improper Coeffs") == 0) { if (atom->avec->impropers_allow == 0) error->all(FLERR,"Invalid data file section: Improper Coeffs"); - if (force->improper == NULL) + if (force->improper == nullptr) error->all(FLERR,"Must define improper_style before Improper Coeffs"); if (firstpass) { if (me == 0 && !style_match(style,force->improper_style)) @@ -646,14 +646,14 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"BondBond Coeffs") == 0) { if (atom->avec->angles_allow == 0) error->all(FLERR,"Invalid data file section: BondBond Coeffs"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must define angle_style before BondBond Coeffs"); if (firstpass) anglecoeffs(1); else skip_lines(nangletypes); } else if (strcmp(keyword,"BondAngle Coeffs") == 0) { if (atom->avec->angles_allow == 0) error->all(FLERR,"Invalid data file section: BondAngle Coeffs"); - if (force->angle == NULL) + if (force->angle == nullptr) error->all(FLERR,"Must define angle_style before BondAngle Coeffs"); if (firstpass) anglecoeffs(2); else skip_lines(nangletypes); @@ -662,7 +662,7 @@ void ReadData::command(int narg, char **arg) if (atom->avec->dihedrals_allow == 0) error->all(FLERR, "Invalid data file section: MiddleBondTorsion Coeffs"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR, "Must define dihedral_style before " "MiddleBondTorsion Coeffs"); @@ -671,7 +671,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"EndBondTorsion Coeffs") == 0) { if (atom->avec->dihedrals_allow == 0) error->all(FLERR,"Invalid data file section: EndBondTorsion Coeffs"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR, "Must define dihedral_style before EndBondTorsion Coeffs"); if (firstpass) dihedralcoeffs(2); @@ -679,7 +679,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"AngleTorsion Coeffs") == 0) { if (atom->avec->dihedrals_allow == 0) error->all(FLERR,"Invalid data file section: AngleTorsion Coeffs"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR, "Must define dihedral_style before AngleTorsion Coeffs"); if (firstpass) dihedralcoeffs(3); @@ -688,7 +688,7 @@ void ReadData::command(int narg, char **arg) if (atom->avec->dihedrals_allow == 0) error->all(FLERR, "Invalid data file section: AngleAngleTorsion Coeffs"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR, "Must define dihedral_style before " "AngleAngleTorsion Coeffs"); @@ -697,7 +697,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"BondBond13 Coeffs") == 0) { if (atom->avec->dihedrals_allow == 0) error->all(FLERR,"Invalid data file section: BondBond13 Coeffs"); - if (force->dihedral == NULL) + if (force->dihedral == nullptr) error->all(FLERR, "Must define dihedral_style before BondBond13 Coeffs"); if (firstpass) dihedralcoeffs(5); @@ -706,7 +706,7 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(keyword,"AngleAngle Coeffs") == 0) { if (atom->avec->impropers_allow == 0) error->all(FLERR,"Invalid data file section: AngleAngle Coeffs"); - if (force->improper == NULL) + if (force->improper == nullptr) error->all(FLERR, "Must define improper_style before AngleAngle Coeffs"); if (firstpass) impropercoeffs(1); @@ -728,7 +728,7 @@ void ReadData::command(int narg, char **arg) if (me == 0) { if (compressed) pclose(fp); else fclose(fp); - fp = NULL; + fp = nullptr; } // done if this was 2nd pass @@ -932,7 +932,7 @@ void ReadData::header(int firstpass) if (me == 0) { char *eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of data file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of data file"); } while (1) { @@ -940,7 +940,7 @@ void ReadData::header(int firstpass) // read a line and bcast length if (me == 0) { - if (fgets(line,MAXLINE,fp) == NULL) n = 0; + if (fgets(line,MAXLINE,fp) == nullptr) n = 0; else n = strlen(line) + 1; } MPI_Bcast(&n,1,MPI_INT,0,world); @@ -1292,7 +1292,7 @@ void ReadData::bonds(int firstpass) // allocate count if firstpass int nlocal = atom->nlocal; - int *count = NULL; + int *count = nullptr; if (firstpass) { memory->create(count,nlocal,"read_data:count"); memset(count,0,nlocal*sizeof(int)); @@ -1366,7 +1366,7 @@ void ReadData::angles(int firstpass) // allocate count if firstpass int nlocal = atom->nlocal; - int *count = NULL; + int *count = nullptr; if (firstpass) { memory->create(count,nlocal,"read_data:count"); memset(count,0,nlocal*sizeof(int)); @@ -1440,7 +1440,7 @@ void ReadData::dihedrals(int firstpass) // allocate count if firstpass int nlocal = atom->nlocal; - int *count = NULL; + int *count = nullptr; if (firstpass) { memory->create(count,nlocal,"read_data:count"); memset(count,0,nlocal*sizeof(int)); @@ -1514,7 +1514,7 @@ void ReadData::impropers(int firstpass) // allocate count if firstpass int nlocal = atom->nlocal; - int *count = NULL; + int *count = nullptr; if (firstpass) { memory->create(count,nlocal,"read_data:count"); memset(count,0,nlocal*sizeof(int)); @@ -1644,7 +1644,7 @@ void ReadData::bodies(int firstpass, AtomVec *ptr) while (nchunk < nmax && nline <= CHUNK-MAXBODY) { eof = fgets(&buffer[m],MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of data file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of data file"); rv = sscanf(&buffer[m],"%d %d %d",&tmp,&ninteger,&ndouble); if (rv != 3) error->one(FLERR,"Incorrect format in Bodies section of data file"); @@ -1658,7 +1658,7 @@ void ReadData::bodies(int firstpass, AtomVec *ptr) nword = 0; while (nword < ninteger) { eof = fgets(&buffer[m],MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of data file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of data file"); ncount = utils::trim_and_count_words(&buffer[m]); if (ncount == 0) error->one(FLERR,"Too few values in body lines in data file"); @@ -1672,7 +1672,7 @@ void ReadData::bodies(int firstpass, AtomVec *ptr) nword = 0; while (nword < ndouble) { eof = fgets(&buffer[m],MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of data file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of data file"); ncount = utils::trim_and_count_words(&buffer[m]); if (ncount == 0) error->one(FLERR,"Too few values in body lines in data file"); @@ -1746,7 +1746,7 @@ void ReadData::paircoeffs() for (int i = 0; i < ntypes; i++) { next = strchr(buf,'\n'); *next = '\0'; - parse_coeffs(buf,NULL,1,2,toffset); + parse_coeffs(buf,nullptr,1,2,toffset); if (narg == 0) error->all(FLERR,"Unexpected empty line in PairCoeffs section"); force->pair->coeff(narg,arg); @@ -1773,7 +1773,7 @@ void ReadData::pairIJcoeffs() for (j = i; j < ntypes; j++) { next = strchr(buf,'\n'); *next = '\0'; - parse_coeffs(buf,NULL,0,2,toffset); + parse_coeffs(buf,nullptr,0,2,toffset); if (narg == 0) error->all(FLERR,"Unexpected empty line in PairCoeffs section"); force->pair->coeff(narg,arg); @@ -1798,7 +1798,7 @@ void ReadData::bondcoeffs() for (int i = 0; i < nbondtypes; i++) { next = strchr(buf,'\n'); *next = '\0'; - parse_coeffs(buf,NULL,0,1,boffset); + parse_coeffs(buf,nullptr,0,1,boffset); if (narg == 0) error->all(FLERR,"Unexpected empty line in BondCoeffs section"); force->bond->coeff(narg,arg); @@ -1823,7 +1823,7 @@ void ReadData::anglecoeffs(int which) for (int i = 0; i < nangletypes; i++) { next = strchr(buf,'\n'); *next = '\0'; - if (which == 0) parse_coeffs(buf,NULL,0,1,aoffset); + if (which == 0) parse_coeffs(buf,nullptr,0,1,aoffset); else if (which == 1) parse_coeffs(buf,"bb",0,1,aoffset); else if (which == 2) parse_coeffs(buf,"ba",0,1,aoffset); if (narg == 0) error->all(FLERR,"Unexpected empty line in AngleCoeffs section"); @@ -1849,7 +1849,7 @@ void ReadData::dihedralcoeffs(int which) for (int i = 0; i < ndihedraltypes; i++) { next = strchr(buf,'\n'); *next = '\0'; - if (which == 0) parse_coeffs(buf,NULL,0,1,doffset); + if (which == 0) parse_coeffs(buf,nullptr,0,1,doffset); else if (which == 1) parse_coeffs(buf,"mbt",0,1,doffset); else if (which == 2) parse_coeffs(buf,"ebt",0,1,doffset); else if (which == 3) parse_coeffs(buf,"at",0,1,doffset); @@ -1879,7 +1879,7 @@ void ReadData::impropercoeffs(int which) for (int i = 0; i < nimpropertypes; i++) { next = strchr(buf,'\n'); *next = '\0'; - if (which == 0) parse_coeffs(buf,NULL,0,1,ioffset); + if (which == 0) parse_coeffs(buf,nullptr,0,1,ioffset); else if (which == 1) parse_coeffs(buf,"aa",0,1,ioffset); if (narg == 0) error->all(FLERR,"Unexpected empty line in ImproperCoeffs section"); force->improper->coeff(narg,arg); @@ -1948,7 +1948,7 @@ void ReadData::open(char *file) #endif } - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open file {}: {}", file, utils::getsyserror())); } @@ -1973,15 +1973,15 @@ void ReadData::parse_keyword(int first) if (me == 0) { if (!first) { - if (fgets(line,MAXLINE,fp) == NULL) eof = 1; + if (fgets(line,MAXLINE,fp) == nullptr) eof = 1; } while (eof == 0 && done == 0) { int blank = strspn(line," \t\n\r"); if ((blank == (int)strlen(line)) || (line[blank] == '#')) { - if (fgets(line,MAXLINE,fp) == NULL) eof = 1; + if (fgets(line,MAXLINE,fp) == nullptr) eof = 1; } else done = 1; } - if (fgets(buffer,MAXLINE,fp) == NULL) { + if (fgets(buffer,MAXLINE,fp) == nullptr) { eof = 1; buffer[0] = '\0'; } @@ -2034,16 +2034,16 @@ void ReadData::skip_lines(bigint n) { if (me) return; if (n <= 0) return; - char *eof = NULL; + char *eof = nullptr; for (bigint i = 0; i < n; i++) eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of data file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of data file"); } /* ---------------------------------------------------------------------- parse a line of coeffs into words, storing them in narg,arg trim anything from '#' onward word strings remain in line, are not copied - if addstr != NULL, add addstr as extra arg for class2 angle/dihedral/improper + if addstr != nullptr, add addstr as extra arg for class2 angle/dihedral/improper if 2nd word starts with letter, then is hybrid style, add addstr after it else add addstr before 2nd word if dupflag, duplicate 1st word, so pair_coeff "2" becomes "2 2" @@ -2068,7 +2068,7 @@ void ReadData::parse_coeffs(char *line, const char *addstr, arg[narg++] = word; if (addstr && narg == 2 && islower(word[0])) arg[narg++] = (char *) addstr; if (dupflag && narg == 1) arg[narg++] = word; - word = strtok(NULL," \t\n\r\f"); + word = strtok(nullptr," \t\n\r\f"); } // to avoid segfaults on empty lines @@ -2097,12 +2097,12 @@ int ReadData::style_match(const char *one, const char *two) { int i,delta,len,len1,len2; - if ((one == NULL) || (two == NULL)) return 1; + if ((one == nullptr) || (two == nullptr)) return 1; len1 = strlen(one); len2 = strlen(two); - for (i = 0; suffixes[i] != NULL; i++) { + for (i = 0; suffixes[i] != nullptr; i++) { len = strlen(suffixes[i]); if ((delta = len1 - len) > 0) if (strcmp(one+delta,suffixes[i]) == 0) len1 = delta; diff --git a/src/read_dump.cpp b/src/read_dump.cpp index 8a4cbf05869fe541c8d8d750e5ef5b6dafe9151b..8ea965b8e15d820651e3d3ec8ec6097120f5d806 100644 --- a/src/read_dump.cpp +++ b/src/read_dump.cpp @@ -55,22 +55,22 @@ ReadDump::ReadDump(LAMMPS *lmp) : Pointers(lmp) triclinic = domain->triclinic; nfile = 0; - files = NULL; + files = nullptr; nnew = maxnew = 0; nfield = 0; - fieldtype = NULL; - fieldlabel = NULL; - fields = NULL; - buf = NULL; + fieldtype = nullptr; + fieldlabel = nullptr; + fields = nullptr; + buf = nullptr; int n = strlen("native") + 1; readerstyle = new char[n]; strcpy(readerstyle,"native"); nreader = 0; - readers = NULL; - nsnapatoms = NULL; + readers = nullptr; + nsnapatoms = nullptr; clustercomm = MPI_COMM_NULL; filereader = 0; parallel = 0; @@ -111,9 +111,9 @@ void ReadDump::command(int narg, char **arg) int nremain = narg - 2; if (nremain) nremain = fields_and_keywords(nremain,&arg[narg-nremain]); - else nremain = fields_and_keywords(0,NULL); + else nremain = fields_and_keywords(0,nullptr); if (nremain) setup_reader(nremain,&arg[narg-nremain]); - else setup_reader(0,NULL); + else setup_reader(0,nullptr); // find the snapshot and read/bcast/process header info @@ -713,7 +713,7 @@ void ReadDump::read_atoms() if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid NULL ptr + maxnew = MAX(nnew,1); // avoid null pointer memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -753,7 +753,7 @@ void ReadDump::read_atoms() nnew = static_cast (olast - ofirst); if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid NULL ptr + maxnew = MAX(nnew,1); // avoid null pointer memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -779,7 +779,7 @@ void ReadDump::read_atoms() nnew = static_cast (sum); if (nnew > maxnew || maxnew == 0) { memory->destroy(fields); - maxnew = MAX(nnew,1); // avoid NULL ptr + maxnew = MAX(nnew,1); // avoid null pointer memory->create(fields,maxnew,nfield,"read_dump:fields"); } @@ -1105,7 +1105,7 @@ void ReadDump::migrate_new_atoms() Irregular *irregular = new Irregular(lmp); int nrecv = irregular->create_data(nnew,procassign,1); int newmaxnew = MAX(nrecv,maxnew); - newmaxnew = MAX(newmaxnew,1); // avoid NULL ptr + newmaxnew = MAX(newmaxnew,1); // avoid null pointer memory->create(newfields,newmaxnew,nfield,"read_dump:newfields"); irregular->exchange_data((char *) &fields[0][0],nfield*sizeof(double), (char *) &newfields[0][0]); @@ -1207,7 +1207,7 @@ int ReadDump::fields_and_keywords(int narg, char **arg) purgeflag = 0; trimflag = 0; addflag = NOADD; - for (int i = 0; i < nfield; i++) fieldlabel[i] = NULL; + for (int i = 0; i < nfield; i++) fieldlabel[i] = nullptr; scaleflag = 0; wrapflag = 1; diff --git a/src/read_restart.cpp b/src/read_restart.cpp index d3213523322fbcf7cb4ee60c7b797c3da7027037..ff7718f0f9a2ada8e749ad7a85e094067e4ffe3c 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -108,7 +108,7 @@ void ReadRestart::command(int narg, char **arg) hfile.replace(hfile.find("%"),1,"base"); } fp = fopen(hfile.c_str(),"rb"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open restart file {}: {}", hfile, utils::getsyserror())); } @@ -166,7 +166,7 @@ void ReadRestart::command(int narg, char **arg) if (multiproc && me == 0) { fclose(fp); - fp = NULL; + fp = nullptr; } // read per-proc info @@ -174,7 +174,7 @@ void ReadRestart::command(int narg, char **arg) AtomVec *avec = atom->avec; int maxbuf = 0; - double *buf = NULL; + double *buf = nullptr; int m,flag; // MPI-IO input from single file @@ -255,7 +255,7 @@ void ReadRestart::command(int narg, char **arg) if (me == 0) { fclose(fp); - fp = NULL; + fp = nullptr; } } @@ -270,34 +270,34 @@ void ReadRestart::command(int narg, char **arg) std::string procfile = file; procfile.replace(procfile.find("%"),1,fmt::format("{}",iproc)); fp = fopen(procfile.c_str(),"rb"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open restart file {}: {}", procfile, utils::getsyserror())); - utils::sfread(FLERR,&flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&flag,sizeof(int),1,fp,nullptr,error); if (flag != PROCSPERFILE) error->one(FLERR,"Invalid flag in peratom section of restart file"); int procsperfile; - utils::sfread(FLERR,&procsperfile,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&procsperfile,sizeof(int),1,fp,nullptr,error); for (int i = 0; i < procsperfile; i++) { - utils::sfread(FLERR,&flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&flag,sizeof(int),1,fp,nullptr,error); if (flag != PERPROC) error->one(FLERR,"Invalid flag in peratom section of restart file"); - utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); if (n > maxbuf) { maxbuf = n; memory->destroy(buf); memory->create(buf,maxbuf,"read_restart:buf"); } - utils::sfread(FLERR,buf,sizeof(double),n,fp,NULL,error); + utils::sfread(FLERR,buf,sizeof(double),n,fp,nullptr,error); m = 0; while (m < n) m += avec->unpack_restart(&buf[m]); } fclose(fp); - fp = NULL; + fp = nullptr; } } @@ -334,7 +334,7 @@ void ReadRestart::command(int narg, char **arg) std::string procfile = file; procfile.replace(procfile.find("%"),1,fmt::format("{}",icluster)); fp = fopen(procfile.c_str(),"rb"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open restart file {}: {}", procfile, utils::getsyserror())); } @@ -342,10 +342,10 @@ void ReadRestart::command(int narg, char **arg) int flag,procsperfile; if (filereader) { - utils::sfread(FLERR,&flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&flag,sizeof(int),1,fp,nullptr,error); if (flag != PROCSPERFILE) error->one(FLERR,"Invalid flag in peratom section of restart file"); - utils::sfread(FLERR,&procsperfile,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&procsperfile,sizeof(int),1,fp,nullptr,error); } MPI_Bcast(&procsperfile,1,MPI_INT,0,clustercomm); @@ -354,17 +354,17 @@ void ReadRestart::command(int narg, char **arg) for (int i = 0; i < procsperfile; i++) { if (filereader) { - utils::sfread(FLERR,&flag,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&flag,sizeof(int),1,fp,nullptr,error); if (flag != PERPROC) error->one(FLERR,"Invalid flag in peratom section of restart file"); - utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error); + utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error); if (n > maxbuf) { maxbuf = n; memory->destroy(buf); memory->create(buf,maxbuf,"read_restart:buf"); } - utils::sfread(FLERR,buf,sizeof(double),n,fp,NULL,error); + utils::sfread(FLERR,buf,sizeof(double),n,fp,nullptr,error); if (i % nclusterprocs) { iproc = me + (i % nclusterprocs); @@ -391,9 +391,9 @@ void ReadRestart::command(int narg, char **arg) } } - if (filereader && fp != NULL) { + if (filereader && fp != nullptr) { fclose(fp); - fp = NULL; + fp = nullptr; } MPI_Comm_free(&clustercomm); } @@ -570,11 +570,11 @@ void ReadRestart::file_search(char *inpfile, char *outfile) struct dirent *ep; DIR *dp = opendir(dirname); - if (dp == NULL) + if (dp == nullptr) error->one(FLERR,"Cannot open dir to search for restart file"); while ((ep = readdir(dp))) { if (strstr(ep->d_name,begin) != ep->d_name) continue; - if ((ptr = strstr(&ep->d_name[nbegin],end)) == NULL) continue; + if ((ptr = strstr(&ep->d_name[nbegin],end)) == nullptr) continue; if (strlen(end) == 0) ptr = ep->d_name + strlen(ep->d_name); *ptr = '\0'; if ((int)strlen(&ep->d_name[nbegin]) < n) { @@ -1034,7 +1034,7 @@ void ReadRestart::file_layout() memory->create(nproc_chunk_number,nprocs, "write_restart:nproc_chunk_number"); - utils::sfread(FLERR,all_written_send_sizes,sizeof(int),nprocs_file,fp,NULL,error); + utils::sfread(FLERR,all_written_send_sizes,sizeof(int),nprocs_file,fp,nullptr,error); if ((nprocs != nprocs_file) && !(atom->nextra_store)) { // nprocs differ, but atom sizes are fixed length, yeah! @@ -1232,7 +1232,7 @@ double ReadRestart::read_double() } /* ---------------------------------------------------------------------- - read a char string (including NULL) and bcast it + read a char string (including nullptr) and bcast it str is allocated here, ptr is returned, caller must deallocate ------------------------------------------------------------------------- */ @@ -1241,7 +1241,7 @@ char *ReadRestart::read_string() int n = read_int(); if (n < 0) error->all(FLERR,"Illegal size string or corrupt restart"); char *value = new char[n]; - if (me == 0) utils::sfread(FLERR,value,sizeof(char),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,value,sizeof(char),n,fp,nullptr,error); MPI_Bcast(value,n,MPI_CHAR,0,world); return value; } @@ -1253,7 +1253,7 @@ char *ReadRestart::read_string() void ReadRestart::read_int_vec(int n, int *vec) { if (n < 0) error->all(FLERR,"Illegal size integer vector read requested"); - if (me == 0) utils::sfread(FLERR,vec,sizeof(int),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,vec,sizeof(int),n,fp,nullptr,error); MPI_Bcast(vec,n,MPI_INT,0,world); } @@ -1264,6 +1264,6 @@ void ReadRestart::read_int_vec(int n, int *vec) void ReadRestart::read_double_vec(int n, double *vec) { if (n < 0) error->all(FLERR,"Illegal size double vector read requested"); - if (me == 0) utils::sfread(FLERR,vec,sizeof(double),n,fp,NULL,error); + if (me == 0) utils::sfread(FLERR,vec,sizeof(double),n,fp,nullptr,error); MPI_Bcast(vec,n,MPI_DOUBLE,0,world); } diff --git a/src/reader.cpp b/src/reader.cpp index 8230fa3ed306f452a8a887e86593594e28701586..218fd75dfaeddd10476e421e673d4a4e86be554f 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; Reader::Reader(LAMMPS *lmp) : Pointers(lmp) { - fp = NULL; + fp = nullptr; } /* ---------------------------------------------------------------------- @@ -35,7 +35,7 @@ Reader::Reader(LAMMPS *lmp) : Pointers(lmp) void Reader::open_file(const char *file) { - if (fp != NULL) close_file(); + if (fp != nullptr) close_file(); compressed = 0; const char *suffix = file + strlen(file) - 3; @@ -55,7 +55,7 @@ void Reader::open_file(const char *file) #endif } - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open file {}: {}", file, utils::getsyserror())); } @@ -67,10 +67,10 @@ void Reader::open_file(const char *file) void Reader::close_file() { - if (fp == NULL) return; + if (fp == nullptr) return; if (compressed) pclose(fp); else fclose(fp); - fp = NULL; + fp = nullptr; } /* ---------------------------------------------------------------------- diff --git a/src/reader_native.cpp b/src/reader_native.cpp index e0f0d7792b3d41b815d456c5050f762fc7387490..11241047a1c44d13a71cac14b9b5bbd183a95c10 100644 --- a/src/reader_native.cpp +++ b/src/reader_native.cpp @@ -34,7 +34,7 @@ enum{UNSET,NOSCALE_NOWRAP,NOSCALE_WRAP,SCALE_NOWRAP,SCALE_WRAP}; ReaderNative::ReaderNative(LAMMPS *lmp) : Reader(lmp) { line = new char[MAXLINE]; - fieldindex = NULL; + fieldindex = nullptr; } /* ---------------------------------------------------------------------- */ @@ -54,7 +54,7 @@ ReaderNative::~ReaderNative() int ReaderNative::read_time(bigint &ntimestep) { char *eof = fgets(line,MAXLINE,fp); - if (eof == NULL) return 1; + if (eof == nullptr) return 1; // skip over unit and time information, if present. @@ -110,7 +110,7 @@ void ReaderNative::skip() match Nfield fields to per-atom column labels allocate and set fieldindex = which column each field maps to fieldtype = X,VX,IZ etc - fieldlabel = user-specified label or NULL if use fieldtype default + fieldlabel = user-specified label or nullptr if use fieldtype default xyz flags = scaleflag+wrapflag if has fieldlabel name, else set by x,xs,xu,xsu only called by proc 0 @@ -315,7 +315,7 @@ void ReaderNative::read_atoms(int n, int nfield, double **fields) for (i = 0; i < n; i++) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of dump file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of dump file"); // tokenize the line std::vector words = Tokenizer(line).as_vector(); @@ -351,8 +351,8 @@ int ReaderNative::find_label(const std::string & label, const std::mapone(FLERR,"Unexpected end of dump file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of dump file"); } diff --git a/src/reader_xyz.cpp b/src/reader_xyz.cpp index 8a2f7a39891e077e723b771c843ab66844fd8cbe..82fe756c2eb09e006b8bd19062435e9bc56d1fab 100644 --- a/src/reader_xyz.cpp +++ b/src/reader_xyz.cpp @@ -31,7 +31,7 @@ enum{ID,TYPE,X,Y,Z}; ReaderXYZ::ReaderXYZ(LAMMPS *lmp) : Reader(lmp) { line = new char[MAXLINE]; - fieldindex = NULL; + fieldindex = nullptr; nstep = 0; } @@ -52,7 +52,7 @@ ReaderXYZ::~ReaderXYZ() int ReaderXYZ::read_time(bigint &ntimestep) { char *eof = fgets(line,MAXLINE,fp); - if (eof == NULL) return 1; + if (eof == nullptr) return 1; // first line has to have the number of atoms // truncate the string to the first whitespace, @@ -109,7 +109,7 @@ void ReaderXYZ::skip() match Nfield fields to per-atom column labels allocate and set fieldindex = which column each field maps to fieldtype = X,VX,IZ etc - fieldlabel = user-specified label or NULL if use fieldtype default + fieldlabel = user-specified label or nullptr if use fieldtype default xyz flag = scaledflag if has fieldlabel name, else set by x,xs,xu,xsu only called by proc 0 ------------------------------------------------------------------------- */ @@ -174,7 +174,7 @@ void ReaderXYZ::read_atoms(int n, int nfield, double **fields) for (i = 0; i < n; i++) { eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of dump file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of dump file"); ++nid; rv = sscanf(line,"%*s%lg%lg%lg", &myx, &myy, &myz); @@ -216,8 +216,8 @@ void ReaderXYZ::read_atoms(int n, int nfield, double **fields) void ReaderXYZ::read_lines(int n) { - char *eof = NULL; + char *eof = nullptr; if (n <= 0) return; for (int i = 0; i < n; i++) eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of dump file"); + if (eof == nullptr) error->one(FLERR,"Unexpected end of dump file"); } diff --git a/src/region.cpp b/src/region.cpp index 15b6fee27212768af60b6234440950f174c1ef50..c7c262788594bdfab27a2e166e61979b55aded74 100644 --- a/src/region.cpp +++ b/src/region.cpp @@ -30,8 +30,8 @@ using namespace LAMMPS_NS; Region::Region(LAMMPS *lmp, int /*narg*/, char **arg) : Pointers(lmp), - id(NULL), style(NULL), contact(NULL), list(NULL), - xstr(NULL), ystr(NULL), zstr(NULL), tstr(NULL) + id(nullptr), style(nullptr), contact(nullptr), list(nullptr), + xstr(nullptr), ystr(nullptr), zstr(nullptr), tstr(nullptr) { int n = strlen(arg[0]) + 1; id = new char[n]; @@ -42,13 +42,13 @@ Region::Region(LAMMPS *lmp, int /*narg*/, char **arg) : strcpy(style,arg[1]); varshape = 0; - xstr = ystr = zstr = tstr = NULL; + xstr = ystr = zstr = tstr = nullptr; dx = dy = dz = 0.0; size_restart = 5; reset_vel(); copymode = 0; - list = NULL; + list = nullptr; nregion = 1; } diff --git a/src/region_cylinder.cpp b/src/region_cylinder.cpp index f7676a3d7475781c8e9fb54c727f000d042d2b03..2d40052e062b8c92d347c29737163940df4da09e 100644 --- a/src/region_cylinder.cpp +++ b/src/region_cylinder.cpp @@ -30,7 +30,7 @@ enum{CONSTANT,VARIABLE}; /* ---------------------------------------------------------------------- */ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : - Region(lmp, narg, arg), c1str(NULL), c2str(NULL), rstr(NULL) + Region(lmp, narg, arg), c1str(nullptr), c2str(nullptr), rstr(nullptr) { options(narg-8,&arg[8]); diff --git a/src/region_intersect.cpp b/src/region_intersect.cpp index a61e2556b04480612b6b6045a7cfbbb044dcbc21..35c6c502abdfedaf677dd6ccc740ecaf28ee6b0d 100644 --- a/src/region_intersect.cpp +++ b/src/region_intersect.cpp @@ -23,7 +23,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) : - Region(lmp, narg, arg), idsub(NULL) + Region(lmp, narg, arg), idsub(nullptr) { nregion = 0; diff --git a/src/region_sphere.cpp b/src/region_sphere.cpp index 4256af421381f7e557fc7642dce00430214a4a8f..5282095c879fe9882b138a23c99ce9cac8e7d8c7 100644 --- a/src/region_sphere.cpp +++ b/src/region_sphere.cpp @@ -28,7 +28,7 @@ enum{CONSTANT,VARIABLE}; /* ---------------------------------------------------------------------- */ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) : - Region(lmp, narg, arg), xstr(NULL), ystr(NULL), zstr(NULL), rstr(NULL) + Region(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr), rstr(nullptr) { options(narg-6,&arg[6]); diff --git a/src/region_union.cpp b/src/region_union.cpp index 677f1022f92d3fb2e14450c9746864d473955558..3ee0765f0b38749b894c018ea9ed42b3199f8500 100644 --- a/src/region_union.cpp +++ b/src/region_union.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg), - idsub(NULL) + idsub(nullptr) { nregion = 0; if (narg < 5) error->all(FLERR,"Illegal region command"); diff --git a/src/replicate.cpp b/src/replicate.cpp index 19f3fd0bc98b3980f0c30396b55aa3f20b1b2b25..b555a442bd9811733743f4d1ab409340fa236308 100644 --- a/src/replicate.cpp +++ b/src/replicate.cpp @@ -154,7 +154,7 @@ void Replicate::command(int narg, char **arg) // also set atomKK for Kokkos version of Atom class Atom *old = atom; - atomKK = NULL; + atomKK = nullptr; if (lmp->kokkos) atom = atomKK = new AtomKokkos(lmp); else atom = new Atom(lmp); diff --git a/src/rerun.cpp b/src/rerun.cpp index 51c0f6fdb25ac352602e8ad364972d17c59abe52..00cd1d40808f49544acd3bdaa82cf9a31e2235a8 100644 --- a/src/rerun.cpp +++ b/src/rerun.cpp @@ -120,9 +120,9 @@ void Rerun::command(int narg, char **arg) rd->store_files(nfile,arg); if (nremain) nremain = rd->fields_and_keywords(nremain,&arg[narg-nremain]); - else nremain = rd->fields_and_keywords(0,NULL); + else nremain = rd->fields_and_keywords(0,nullptr); if (nremain) rd->setup_reader(nremain,&arg[narg-nremain]); - else rd->setup_reader(0,NULL); + else rd->setup_reader(0,nullptr); // perform the pseudo run // invoke lmp->init() only once diff --git a/src/reset_mol_ids.cpp b/src/reset_mol_ids.cpp index ad2caad6568230854227ea0755d015702ea0c24b..10337fd18f1b1fcf2cdd8e290f102a2876382c60 100644 --- a/src/reset_mol_ids.cpp +++ b/src/reset_mol_ids.cpp @@ -33,8 +33,8 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ResetMolIDs::ResetMolIDs(LAMMPS *lmp) : Pointers(lmp) { - cfa = NULL; - cca = NULL; + cfa = nullptr; + cca = nullptr; // default settings diff --git a/src/respa.cpp b/src/respa.cpp index c970c63a19e8fd3d8a0124fa7fc565b3d89abfd1..ecc6cc58f378182bda8e17d17233c3bfb2424051 100644 --- a/src/respa.cpp +++ b/src/respa.cpp @@ -46,8 +46,8 @@ using namespace LAMMPS_NS; Respa::Respa(LAMMPS *lmp, int narg, char **arg) : Integrate(lmp, narg, arg), - step(NULL), loop(NULL), hybrid_level(NULL), hybrid_compute(NULL), - newton(NULL), fix_respa(NULL) + step(nullptr), loop(nullptr), hybrid_level(nullptr), hybrid_compute(nullptr), + newton(nullptr), fix_respa(nullptr) { nhybrid_styles = 0; if (narg < 1) error->all(FLERR,"Illegal run_style respa command"); diff --git a/src/run.cpp b/src/run.cpp index 166955d6acca198ac1593046e846f8374713de1c..2e55fba439acca60e987dbf66014324592827c2b 100644 --- a/src/run.cpp +++ b/src/run.cpp @@ -91,7 +91,7 @@ void Run::command(int narg, char **arg) // all remaining args are commands // first,last = arg index of first/last commands - // set ncommands = 0 if single command and it is NULL + // set ncommands = 0 if single command and it is "NULL" } else if (strcmp(arg[iarg],"every") == 0) { if (iarg+3 > narg) error->all(FLERR,"Illegal run command"); @@ -140,7 +140,7 @@ void Run::command(int narg, char **arg) // if nevery, make copies of arg strings that are commands // required because re-parsing commands via input->one() will wipe out args - char **commands = NULL; + char **commands = nullptr; if (nevery && ncommands > 0) { commands = new char*[ncommands]; ncommands = 0; diff --git a/src/set.cpp b/src/set.cpp index 83bfb99968dae36d705a09708186f6fb44c64ae0..bda5c51248b026c6f98f3a268b72cb55d280d195 100644 --- a/src/set.cpp +++ b/src/set.cpp @@ -74,7 +74,7 @@ void Set::command(int narg, char **arg) int n = strlen(arg[1]) + 1; id = new char[n]; strcpy(id,arg[1]); - select = NULL; + select = nullptr; selection(atom->nlocal); // loop over keyword/value pairs @@ -689,7 +689,7 @@ void Set::set(int keyword) { // evaluate atom-style variable(s) if necessary - vec1 = vec2 = vec3 = vec4 = NULL; + vec1 = vec2 = vec3 = vec4 = nullptr; if (varflag) { int nlocal = atom->nlocal; @@ -907,7 +907,7 @@ void Set::set(int keyword) // enforce quat rotation vector in z dir for 2d systems else if (keyword == QUAT) { - double *quat = NULL; + double *quat = nullptr; if (avec_ellipsoid && atom->ellipsoid[i] >= 0) quat = avec_ellipsoid->bonus[atom->ellipsoid[i]].quat; else if (avec_tri && atom->tri[i] >= 0) diff --git a/src/special.cpp b/src/special.cpp index eb74f534f7d679434507b35e12d39f97264b8df7..9661fa5ad8996eac6cfaf922c9780fd658544fc8 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -34,7 +34,7 @@ Special::Special(LAMMPS *lmp) : Pointers(lmp) MPI_Comm_rank(world,&me); MPI_Comm_size(world,&nprocs); - onetwo = onethree = onefour = NULL; + onetwo = onethree = onefour = nullptr; } /* ---------------------------------------------------------------------- */ diff --git a/src/thermo.cpp b/src/thermo.cpp index 787b0cdda843961025a62a932d3b00e46b3286e0..485974cc81e6db1cf7e160aec364f18ba4cab4cf 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -147,9 +147,9 @@ Thermo::Thermo(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) // ptrs, flags, IDs for compute objects thermo may use or create - temperature = NULL; - pressure = NULL; - pe = NULL; + temperature = nullptr; + pressure = nullptr; + pe = nullptr; index_temp = index_press_scalar = index_press_vector = index_pe = -1; @@ -179,10 +179,10 @@ Thermo::Thermo(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) sprintf(format_bigint_one_def,"%%8%s",&bigint_format[1]); sprintf(format_bigint_multi_def,"%%14%s",&bigint_format[1]); - format_line_user = NULL; - format_float_user = NULL; - format_int_user = NULL; - format_bigint_user = NULL; + format_line_user = nullptr; + format_float_user = nullptr; + format_int_user = nullptr; + format_bigint_user = nullptr; } /* ---------------------------------------------------------------------- */ @@ -563,13 +563,13 @@ void Thermo::modify_params(int narg, char **arg) delete [] format_int_user; delete [] format_bigint_user; delete [] format_float_user; - format_line_user = NULL; - format_int_user = NULL; - format_bigint_user = NULL; - format_float_user = NULL; + format_line_user = nullptr; + format_int_user = nullptr; + format_bigint_user = nullptr; + format_float_user = nullptr; for (int i = 0; i < nfield_initial+1; i++) { delete [] format_column_user[i]; - format_column_user[i] = NULL; + format_column_user[i] = nullptr; } iarg += 2; continue; @@ -593,7 +593,7 @@ void Thermo::modify_params(int narg, char **arg) // replace "d" in format_int_user with bigint format specifier // use of &str[1] removes leading '%' from BIGINT_FORMAT string char *ptr = strchr(format_int_user,'d'); - if (ptr == NULL) + if (ptr == nullptr) error->all(FLERR, "Thermo_modify int format does not contain d character"); char str[8]; @@ -632,14 +632,14 @@ void Thermo::allocate() int n = nfield_initial + 1; keyword = new char*[n]; - for (int i = 0; i < n; i++) keyword[i] = NULL; + for (int i = 0; i < n; i++) keyword[i] = nullptr; vfunc = new FnPtr[n]; vtype = new int[n]; format = new char*[n]; for (int i = 0; i < n; i++) format[i] = new char[32]; format_column_user = new char*[n]; - for (int i = 0; i < n; i++) format_column_user[i] = NULL; + for (int i = 0; i < n; i++) format_column_user[i] = nullptr; field2index = new int[n]; argindex1 = new int[n]; @@ -893,7 +893,7 @@ void Thermo::parse_fields(char *str) // argindex1,argindex2 = int inside each bracket pair, 0 if no bracket char *ptr = strchr(id,'['); - if (ptr == NULL) argindex1[nfield] = argindex2[nfield] = 0; + if (ptr == nullptr) argindex1[nfield] = argindex2[nfield] = 0; else { *ptr = '\0'; argindex1[nfield] = diff --git a/src/universe.cpp b/src/universe.cpp index cd079a45c099b442a906a9f9fd81fe39a4a311bd..ecdd5aa04d6db03a71426902c44719edb31ea86b 100644 --- a/src/universe.cpp +++ b/src/universe.cpp @@ -40,12 +40,12 @@ Universe::Universe(LAMMPS *lmp, MPI_Comm communicator) : Pointers(lmp) MPI_Comm_size(uworld,&nprocs); uscreen = stdout; - ulogfile = NULL; + ulogfile = nullptr; existflag = 0; nworlds = 0; - procs_per_world = NULL; - root_proc = NULL; + procs_per_world = nullptr; + root_proc = nullptr; memory->create(uni2orig,nprocs,"universe:uni2orig"); for (int i = 0; i < nprocs; i++) uni2orig[i] = i; @@ -95,7 +95,7 @@ void Universe::reorder(char *style, char *arg) if (me == 0) { FILE *fp = fopen(arg,"r"); - if (fp == NULL) + if (fp == nullptr) error->universe_one(FLERR,fmt::format("Cannot open -reorder " "file {}: {}",arg, utils::getsyserror())); @@ -156,7 +156,7 @@ void Universe::reorder(char *style, char *arg) /* ---------------------------------------------------------------------- add 1 or more worlds to universe - str == NULL -> add 1 world with all procs in universe + str == nullptr -> add 1 world with all procs in universe str = NxM -> add N worlds, each with M procs str = P -> add 1 world with P procs ------------------------------------------------------------------------- */ @@ -169,7 +169,7 @@ void Universe::add_world(char *str) n = 1; nper = 0; - if (str != NULL) { + if (str != nullptr) { // check for valid partition argument @@ -184,7 +184,7 @@ void Universe::add_world(char *str) else valid = false; if (valid) { - if ((ptr = strchr(str,'x')) != NULL) { + if ((ptr = strchr(str,'x')) != nullptr) { // 'x' may not be the first or last character diff --git a/src/update.cpp b/src/update.cpp index f6ed47dcd2a7d7f164ce91b9f72c5301ccd98d80..492db2bd7c715ad78fb4ea66338f6938c6b4e6e0 100644 --- a/src/update.cpp +++ b/src/update.cpp @@ -53,13 +53,13 @@ Update::Update(LAMMPS *lmp) : Pointers(lmp) eflag_global = vflag_global = -1; dt_default = 1; - unit_style = NULL; + unit_style = nullptr; set_units("lj"); - integrate_style = NULL; - integrate = NULL; - minimize_style = NULL; - minimize = NULL; + integrate_style = nullptr; + integrate = nullptr; + minimize_style = nullptr; + minimize = nullptr; integrate_map = new IntegrateCreatorMap(); diff --git a/src/utils.cpp b/src/utils.cpp index f63deac0dc3ba5ed35bd1400e355eda27f51e23e..b0928fd18aa4232515f978f7dcff0b06b34b622a 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -152,7 +152,7 @@ void utils::sfgets(const char *srcname, int srcline, char *s, int size, FILE *fp, const char *filename, Error *error) { char *rv = fgets(s,size,fp); - if (rv == NULL) { // something went wrong + if (rv == nullptr) { // something went wrong char buf[MAXPATHLENBUF]; std::string errmsg; @@ -171,7 +171,7 @@ void utils::sfgets(const char *srcname, int srcline, char *s, int size, errmsg += "'"; if (error) error->one(srcname,srcline,errmsg); - if (s) *s = '\0'; // truncate string to empty in case error is NULL + if (s) *s = '\0'; // truncate string to empty in case error is null pointer } return; } @@ -377,19 +377,19 @@ void utils::bounds(const char *file, int line, const std::string &str, nlo = nhi = -1; if (found == std::string::npos) { // contains no '*' - nlo = nhi = strtol(str.c_str(),NULL,10); + nlo = nhi = strtol(str.c_str(),nullptr,10); } else if (str.size() == 1) { // is only '*' nlo = nmin; nhi = nmax; } else if (found == 0) { // is '*j' nlo = nmin; - nhi = strtol(str.substr(1).c_str(),NULL,10); + nhi = strtol(str.substr(1).c_str(),nullptr,10); } else if (str.size() == found+1) { // is 'i*' - nlo = strtol(str.c_str(),NULL,10); + nlo = strtol(str.c_str(),nullptr,10); nhi = nmax; } else { // is 'i*j' - nlo = strtol(str.c_str(),NULL,10); - nhi = strtol(str.substr(found+1).c_str(),NULL,10); + nlo = strtol(str.c_str(),nullptr,10); + nhi = strtol(str.substr(found+1).c_str(),nullptr,10); } if (error) { @@ -422,7 +422,7 @@ int utils::expand_args(const char *file, int line, int narg, char **arg, int n,iarg,index,nlo,nhi,nmax,expandflag,icompute,ifix; char *ptr1,*ptr2,*str; - ptr1 = NULL; + ptr1 = nullptr; for (iarg = 0; iarg < narg; iarg++) { ptr1 = strchr(arg[iarg],'*'); if (ptr1) break; @@ -1000,10 +1000,10 @@ double utils::timespec2seconds(const std::string ×pec) int utils::date2num(const std::string &date) { std::size_t found = date.find_first_not_of("0123456789 "); - int num = strtol(date.substr(0,found).c_str(),NULL,10); + int num = strtol(date.substr(0,found).c_str(),nullptr,10); auto month = date.substr(found); found = month.find_first_of("0123456789 "); - num += strtol(month.substr(found).c_str(),NULL,10)*10000; + num += strtol(month.substr(found).c_str(),nullptr,10)*10000; if (num < 1000000) num += 20000000; if (strmatch(month,"^Jan")) num += 100; diff --git a/src/utils.h b/src/utils.h index 06aef4654f06f80160562b8f701c32cbb64363c1..c9e958365dc2acfd0f11343b67a9fda8b41c1e74 100644 --- a/src/utils.h +++ b/src/utils.h @@ -60,7 +60,7 @@ namespace LAMMPS_NS { * \param s buffer for storing the result of fgets() * \param size size of buffer s (max number of bytes read by fgets()) * \param fp file pointer used by fgets() - * \param filename file name associated with fp (may be NULL; then LAMMPS will try to detect) + * \param filename file name associated with fp (may be a null pointer; then LAMMPS will try to detect) * \param error pointer to Error class instance (for abort) */ void sfgets(const char *srcname, int srcline, char *s, int size, @@ -75,7 +75,7 @@ namespace LAMMPS_NS { * \param size size of data elements read by fread() * \param num number of data elements read by fread() * \param fp file pointer used by fread() - * \param filename file name associated with fp (may be NULL; then LAMMPS will try to detect) + * \param filename file name associated with fp (may be a null pointer; then LAMMPS will try to detect) * \param error pointer to Error class instance (for abort) */ void sfread(const char *srcname, int srcline, void *s, size_t size, @@ -354,7 +354,7 @@ namespace LAMMPS_NS { * If the potential file has a ``UNITS`` tag in the first line, the * tag's value is compared to the current unit style setting. * The behavior of the function then depends on the value of the - * *auto_convert* parameter. If it is ``NULL``, then the unit values + * *auto_convert* parameter. If it is ``nullptr``, then the unit values * must match or else the open will fail with an error. Otherwise * the bitmask that *auto_convert* points to is used check for * compatibility with possible automatic conversions by the calling @@ -363,8 +363,8 @@ namespace LAMMPS_NS { * * \param name file- or pathname of the potential file * \param lmp pointer to top-level LAMMPS class instance - * \param auto_convert pointer to unit conversion bitmask or NULL - * \return FILE pointer of the opened potential file or NULL*/ + * \param auto_convert pointer to unit conversion bitmask or nullptr + * \return FILE pointer of the opened potential file or nullptr*/ FILE *open_potential(const std::string &name, LAMMPS *lmp, int *auto_convert); diff --git a/src/variable.cpp b/src/variable.cpp index b935516ff12191e5700a4d632fd713845be47b6b..bc47d451d1c516b0051d966f31bd7be65fa1a8c3 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -86,20 +86,20 @@ Variable::Variable(LAMMPS *lmp) : Pointers(lmp) MPI_Comm_rank(world,&me); nvar = maxvar = 0; - names = NULL; - style = NULL; - num = NULL; - which = NULL; - pad = NULL; - reader = NULL; - data = NULL; - dvalue = NULL; - vecs = NULL; + names = nullptr; + style = nullptr; + num = nullptr; + which = nullptr; + pad = nullptr; + reader = nullptr; + data = nullptr; + dvalue = nullptr; + vecs = nullptr; - eval_in_progress = NULL; + eval_in_progress = nullptr; - randomequal = NULL; - randomatom = NULL; + randomequal = nullptr; + randomatom = nullptr; // customize by assigning a precedence level @@ -207,7 +207,7 @@ void Variable::set(int narg, char **arg) num[nvar] = nlast; which[nvar] = nfirst-1; data[nvar] = new char*[1]; - data[nvar][0] = NULL; + data[nvar][0] = nullptr; // WORLD // num = listed args, which = partition this proc is in, data = copied args @@ -251,7 +251,7 @@ void Variable::set(int narg, char **arg) style[nvar] = ULOOP; num[nvar] = utils::inumeric(FLERR,arg[2],false,lmp); data[nvar] = new char*[1]; - data[nvar][0] = NULL; + data[nvar][0] = nullptr; if (narg == 4) { char digits[12]; sprintf(digits,"%d",num[nvar]); @@ -265,12 +265,12 @@ void Variable::set(int narg, char **arg) if (universe->me == 0) { FILE *fp = fopen("tmp.lammps.variable","w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,"Cannot open temporary file for world counter: " + utils::getsyserror()); fprintf(fp,"%d\n",universe->nworlds); fclose(fp); - fp = NULL; + fp = nullptr; } for (int jvar = 0; jvar < nvar; jvar++) @@ -355,7 +355,7 @@ void Variable::set(int narg, char **arg) // ATOMFILE for numbers // which = 1st value - // data = NULL + // data = nullptr } else if (strcmp(arg[1],"atomfile") == 0) { if (narg != 3) error->all(FLERR,"Illegal variable command"); @@ -366,7 +366,7 @@ void Variable::set(int narg, char **arg) which[nvar] = 0; pad[nvar] = 0; data[nvar] = new char*[num[nvar]]; - data[nvar][0] = NULL; + data[nvar][0] = nullptr; reader[nvar] = new VarReader(lmp,arg[0],arg[2],ATOMFILE); int flag = reader[nvar]->read_peratom(); if (flag) error->all(FLERR,"Atomfile variable could not read values"); @@ -706,7 +706,7 @@ int Variable::next(int narg, char **arg) char buf[64]; for (int loopmax = 0; loopmax < 100; ++loopmax) { fp = fopen("tmp.lammps.variable.lock","r"); - if (fp == NULL) goto uloop_again; + if (fp == nullptr) goto uloop_again; buf[0] = buf[1] = '\0'; fread(buf,1,64,fp); @@ -731,7 +731,7 @@ int Variable::next(int narg, char **arg) fprintf(fp,"%d\n",nextindex+1); //printf("WRITE %d %d\n",universe->me,nextindex+1); fclose(fp); - fp = NULL; + fp = nullptr; rename("tmp.lammps.variable.lock","tmp.lammps.variable"); if (universe->uscreen) fprintf(universe->uscreen, @@ -840,15 +840,15 @@ int Variable::vectorstyle(int ivar) check if variable with name is PYTHON and matches funcname called by Python class before it invokes a Python function return data storage so Python function can return a value for this variable - return NULL if not a match + return nullptr if not a match ------------------------------------------------------------------------- */ char *Variable::pythonstyle(char *name, char *funcname) { int ivar = find(name); - if (ivar < 0) return NULL; - if (style[ivar] != PYTHON) return NULL; - if (strcmp(data[ivar][0],funcname) != 0) return NULL; + if (ivar < 0) return nullptr; + if (style[ivar] != PYTHON) return nullptr; + if (strcmp(data[ivar][0],funcname) != 0) return nullptr; return data[ivar][1]; } @@ -873,23 +873,23 @@ int Variable::internalstyle(int ivar) if GETENV, query environment and put result in str if PYTHON, evaluate Python function, it will put result in str if INTERNAL, convert dvalue and put result in str - if ATOM or ATOMFILE or VECTOR, return NULL - return NULL if no variable with name, or which value is bad, + if ATOM or ATOMFILE or VECTOR, return nullptr + return nullptr if no variable with name, or which value is bad, caller must respond ------------------------------------------------------------------------- */ char *Variable::retrieve(const char *name) { int ivar = find(name); - if (ivar < 0) return NULL; - if (which[ivar] >= num[ivar]) return NULL; + if (ivar < 0) return nullptr; + if (which[ivar] >= num[ivar]) return nullptr; if (eval_in_progress[ivar]) print_var_error(FLERR,"Variable has a circular dependency",ivar); eval_in_progress[ivar] = 1; - char *str = NULL; + char *str = nullptr; if (style[ivar] == INDEX || style[ivar] == WORLD || style[ivar] == UNIVERSE || style[ivar] == STRING || style[ivar] == SCALARFILE) { @@ -908,19 +908,19 @@ char *Variable::retrieve(const char *name) strcpy(data[ivar][0],result); str = data[ivar][0]; } else if (style[ivar] == EQUAL) { - double answer = evaluate(data[ivar][0],NULL,ivar); + double answer = evaluate(data[ivar][0],nullptr,ivar); sprintf(data[ivar][1],"%.15g",answer); str = data[ivar][1]; } else if (style[ivar] == FORMAT) { int jvar = find(data[ivar][0]); - if (jvar == -1) return NULL; - if (!equalstyle(jvar)) return NULL; + if (jvar == -1) return nullptr; + if (!equalstyle(jvar)) return nullptr; double answer = compute_equal(jvar); sprintf(data[ivar][2],data[ivar][1],answer); str = data[ivar][2]; } else if (style[ivar] == GETENV) { const char *result = getenv(data[ivar][0]); - if (result == NULL) result = (const char *) ""; + if (result == nullptr) result = (const char *) ""; int n = strlen(result) + 1; if (n > VALUELENGTH) { delete [] data[ivar][1]; @@ -943,7 +943,7 @@ char *Variable::retrieve(const char *name) sprintf(data[ivar][0],"%.15g",dvalue[ivar]); str = data[ivar][0]; } else if (style[ivar] == ATOM || style[ivar] == ATOMFILE || - style[ivar] == VECTOR) return NULL; + style[ivar] == VECTOR) return nullptr; eval_in_progress[ivar] = 0; @@ -965,7 +965,7 @@ double Variable::compute_equal(int ivar) eval_in_progress[ivar] = 1; double value = 0.0; - if (style[ivar] == EQUAL) value = evaluate(data[ivar][0],NULL,ivar); + if (style[ivar] == EQUAL) value = evaluate(data[ivar][0],nullptr,ivar); else if (style[ivar] == INTERNAL) value = dvalue[ivar]; else if (style[ivar] == PYTHON) { int ifunc = python->find(data[ivar][0]); @@ -987,7 +987,7 @@ double Variable::compute_equal(int ivar) double Variable::compute_equal(char *str) { - return evaluate(str,NULL,-1); + return evaluate(str,nullptr,-1); } /* ---------------------------------------------------------------------- @@ -1000,7 +1000,7 @@ double Variable::compute_equal(char *str) void Variable::compute_atom(int ivar, int igroup, double *result, int stride, int sumflag) { - Tree *tree = NULL; + Tree *tree = nullptr; double *vstore; if (eval_in_progress[ivar]) @@ -1014,7 +1014,7 @@ void Variable::compute_atom(int ivar, int igroup, collapse_tree(tree); } else vstore = reader[ivar]->fixstore->vstore; - if (result == NULL) { + if (result == nullptr) { if (style[ivar] == ATOM) free_tree(tree); eval_in_progress[ivar] = 0; return; @@ -1073,7 +1073,7 @@ void Variable::compute_atom(int ivar, int igroup, int Variable::compute_vector(int ivar, double **result) { - Tree *tree = NULL; + Tree *tree = nullptr; if (vecs[ivar].currentstep == update->ntimestep) { *result = vecs[ivar].values; return vecs[ivar].n; @@ -1166,7 +1166,7 @@ void Variable::grow() reader = (VarReader **) memory->srealloc(reader,maxvar*sizeof(VarReader *),"var:reader"); - for (int i = old; i < maxvar; i++) reader[i] = NULL; + for (int i = old; i < maxvar; i++) reader[i] = nullptr; data = (char ***) memory->srealloc(data,maxvar*sizeof(char **),"var:data"); memory->grow(dvalue,maxvar,"var:dvalue"); @@ -1175,7 +1175,7 @@ void Variable::grow() for (int i = old; i < maxvar; i++) { vecs[i].nmax = 0; vecs[i].currentstep = -1; - vecs[i].values = NULL; + vecs[i].values = nullptr; } memory->grow(eval_in_progress,maxvar,"var:eval_in_progress"); @@ -1214,9 +1214,9 @@ void Variable::copy(int narg, char **from, char **to) compute = c_ID, c_ID[i], c_ID[i][j] fix = f_ID, f_ID[i], f_ID[i][j] variable = v_name, v_name[i] - equal-style variables passes in tree = NULL: + equal-style variables passes in tree = nullptr: evaluate the formula, return result as a double - atom-style and vector-style variables pass in tree = non-NULL: + atom-style and vector-style variables pass in tree = non-nullptr: parse the formula but do not evaluate it create a parse tree and return it ------------------------------------------------------------------------- */ @@ -1261,10 +1261,10 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) // evaluate contents and push on stack if (tree) { - Tree *newtree = NULL; + Tree *newtree = nullptr; evaluate(contents,&newtree,ivar); treestack[ntreestack++] = newtree; - } else argstack[nargstack++] = evaluate(contents,NULL,ivar); + } else argstack[nargstack++] = evaluate(contents,nullptr,ivar); delete [] contents; @@ -1297,7 +1297,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = atof(number); - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->extra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = atof(number); @@ -1389,7 +1389,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1418,7 +1418,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1450,7 +1450,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1459,7 +1459,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 0 && compute->vector_flag) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Compute global vector in " "equal-style variable formula",ivar); if (treetype == ATOM) @@ -1483,7 +1483,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->nvector = compute->size_vector; newtree->nstride = 1; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1491,7 +1491,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 1 && compute->array_flag) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Compute global vector in " "equal-style variable formula",ivar); if (treetype == ATOM) @@ -1515,7 +1515,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->nvector = compute->size_array_rows; newtree->nstride = compute->size_array_cols; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1533,7 +1533,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) compute->invoked_flag |= INVOKED_PERATOM; } - peratom2global(1,NULL,compute->vector_atom,1,index1, + peratom2global(1,nullptr,compute->vector_atom,1,index1, tree,treestack,ntreestack,argstack,nargstack); // c_ID[i][j] = scalar from per-atom array @@ -1554,11 +1554,11 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } if (compute->array_atom) - peratom2global(1,NULL,&compute->array_atom[0][index2-1], + peratom2global(1,nullptr,&compute->array_atom[0][index2-1], compute->size_peratom_cols,index1, tree,treestack,ntreestack,argstack,nargstack); else - peratom2global(1,NULL,NULL, + peratom2global(1,nullptr,nullptr, compute->size_peratom_cols,index1, tree,treestack,ntreestack,argstack,nargstack); @@ -1567,7 +1567,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 0 && compute->peratom_flag && compute->size_peratom_cols == 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Per-atom compute in " "equal-style variable formula",ivar); if (treetype == VECTOR) @@ -1587,7 +1587,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->array = compute->vector_atom; newtree->nstride = 1; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1596,7 +1596,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 1 && compute->peratom_flag && compute->size_peratom_cols > 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Per-atom compute in " "equal-style variable formula",ivar); if (treetype == VECTOR) @@ -1619,10 +1619,10 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (compute->array_atom) newtree->array = &compute->array_atom[0][index1-1]; else - newtree->array = NULL; + newtree->array = nullptr; newtree->nstride = compute->size_peratom_cols; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1686,7 +1686,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1708,7 +1708,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1733,7 +1733,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1745,7 +1745,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (update->whichflag > 0 && update->ntimestep % fix->global_freq) print_var_error(FLERR,"Fix in variable not computed at " "compatible time",ivar); - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Fix global vector in " "equal-style variable formula",ivar); if (treetype == ATOM) @@ -1767,7 +1767,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->nvector = nvec; newtree->nstride = 1; newtree->selfalloc = 1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1778,7 +1778,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (update->whichflag > 0 && update->ntimestep % fix->global_freq) print_var_error(FLERR,"Fix in variable not computed " "at a compatible time",ivar); - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Fix global vector in " "equal-style variable formula",ivar); if (treetype == ATOM) @@ -1800,7 +1800,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->nvector = nvec; newtree->nstride = 1; newtree->selfalloc = 1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1814,7 +1814,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) print_var_error(FLERR,"Fix in variable not computed " "at a compatible time",ivar); - peratom2global(1,NULL,fix->vector_atom,1,index1, + peratom2global(1,nullptr,fix->vector_atom,1,index1, tree,treestack,ntreestack,argstack,nargstack); // f_ID[i][j] = scalar from per-atom array @@ -1831,11 +1831,11 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) "at a compatible time",ivar); if (fix->array_atom) - peratom2global(1,NULL,&fix->array_atom[0][index2-1], + peratom2global(1,nullptr,&fix->array_atom[0][index2-1], fix->size_peratom_cols,index1, tree,treestack,ntreestack,argstack,nargstack); else - peratom2global(1,NULL,NULL, + peratom2global(1,nullptr,nullptr, fix->size_peratom_cols,index1, tree,treestack,ntreestack,argstack,nargstack); @@ -1844,7 +1844,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 0 && fix->peratom_flag && fix->size_peratom_cols == 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Per-atom fix in " "equal-style variable formula",ivar); if (update->whichflag > 0 && @@ -1857,7 +1857,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->array = fix->vector_atom; newtree->nstride = 1; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1866,7 +1866,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 1 && fix->peratom_flag && fix->size_peratom_cols > 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Per-atom fix in " "equal-style variable formula",ivar); if (index1 > fix->size_peratom_cols) @@ -1882,10 +1882,10 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (fix->array_atom) newtree->array = &fix->array_atom[0][index1-1]; else - newtree->array = NULL; + newtree->array = nullptr; newtree->nstride = fix->size_peratom_cols; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1929,7 +1929,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -1941,14 +1941,14 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) style[ivar] != ATOMFILE && style[ivar] != VECTOR) { char *var = retrieve(word+2); - if (var == NULL) + if (var == nullptr) print_var_error(FLERR,"Invalid variable evaluation in " "variable formula",ivar); if (tree) { Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = atof(var); - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = atof(var); @@ -1958,14 +1958,14 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 0 && style[ivar] == ATOM) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Atom-style variable in " "equal-style variable formula",ivar); if (treetype == VECTOR) print_var_error(FLERR,"Atom-style variable in " "vector-style variable formula",ivar); - Tree *newtree = NULL; + Tree *newtree = nullptr; evaluate(data[ivar][0],&newtree,ivar); treestack[ntreestack++] = newtree; @@ -1973,7 +1973,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 0 && style[ivar] == ATOMFILE) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Atomfile-style variable in " "equal-style variable formula",ivar); if (treetype == VECTOR) @@ -1985,7 +1985,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->array = reader[ivar]->fixstore->vstore; newtree->nstride = 1; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -1994,7 +1994,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket == 0 && style[ivar] == VECTOR) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Vector-style variable in " "equal-style variable formula",ivar); if (treetype == ATOM) @@ -2010,7 +2010,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->nvector = nvec; newtree->nstride = 1; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -2023,7 +2023,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) double *result; memory->create(result,atom->nlocal,"variable:result"); compute_atom(ivar,0,result,1,0); - peratom2global(1,NULL,result,1,index, + peratom2global(1,nullptr,result,1,index, tree,treestack,ntreestack,argstack,nargstack); memory->destroy(result); @@ -2031,7 +2031,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) } else if (nbracket && style[ivar] == ATOMFILE) { - peratom2global(1,NULL,reader[ivar]->fixstore->vstore,1,index, + peratom2global(1,nullptr,reader[ivar]->fixstore->vstore,1,index, tree,treestack,ntreestack,argstack,nargstack); // v_name[N] = scalar from vector-style variable @@ -2050,7 +2050,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = vec[m-1]; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = vec[m-1]; @@ -2098,7 +2098,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) tagint id = int_between_brackets(ptr,1); i = ptr-str+1; - peratom2global(0,word,NULL,0,id, + peratom2global(0,word,nullptr,0,id, tree,treestack,ntreestack,argstack,nargstack); // ---------------- @@ -2122,7 +2122,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -2144,7 +2144,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value1; @@ -2224,7 +2224,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->type = opprevious; if ((opprevious == UNARY) || (opprevious == NOT)) { newtree->first = treestack[--ntreestack]; - newtree->second = NULL; + newtree->second = nullptr; newtree->nextra = 0; } else { newtree->second = treestack[--ntreestack]; @@ -2627,7 +2627,7 @@ double Variable::collapse_tree(Tree *tree) if (tree->type == RANDOM) { collapse_tree(tree->first); collapse_tree(tree->second); - if (randomatom == NULL) { + if (randomatom == nullptr) { int seed = static_cast (collapse_tree(tree->extra[0])); if (seed <= 0) error->one(FLERR,"Invalid math function in variable formula"); @@ -2641,7 +2641,7 @@ double Variable::collapse_tree(Tree *tree) double sigma = collapse_tree(tree->second); if (sigma < 0.0) error->one(FLERR,"Invalid math function in variable formula"); - if (randomatom == NULL) { + if (randomatom == nullptr) { int seed = static_cast (collapse_tree(tree->extra[0])); if (seed <= 0) error->one(FLERR,"Invalid math function in variable formula"); @@ -3021,7 +3021,7 @@ double Variable::eval_tree(Tree *tree, int i) if (tree->type == RANDOM) { double lower = eval_tree(tree->first,i); double upper = eval_tree(tree->second,i); - if (randomatom == NULL) { + if (randomatom == nullptr) { int seed = static_cast (eval_tree(tree->extra[0],i)); if (seed <= 0) error->one(FLERR,"Invalid math function in variable formula"); @@ -3034,7 +3034,7 @@ double Variable::eval_tree(Tree *tree, int i) double sigma = eval_tree(tree->second,i); if (sigma < 0.0) error->one(FLERR,"Invalid math function in variable formula"); - if (randomatom == NULL) { + if (randomatom == nullptr) { int seed = static_cast (eval_tree(tree->extra[0],i)); if (seed <= 0) error->one(FLERR,"Invalid math function in variable formula"); @@ -3344,7 +3344,7 @@ tagint Variable::int_between_brackets(char *&ptr, int varallow) error->all(FLERR,"Invalid variable name in variable formula"); char *var = retrieve(id); - if (var == NULL) + if (var == nullptr) error->all(FLERR,"Invalid variable evaluation in variable formula"); index = static_cast (atof(var)); @@ -3399,15 +3399,15 @@ int Variable::math_function(char *word, char *contents, Tree **tree, char *args[MAXFUNCARG]; int narg = parse_args(contents,args); - Tree *newtree = NULL; + Tree *newtree = nullptr; double value1,value2; double values[MAXFUNCARG-2]; if (tree) { newtree = new Tree(); - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; - Tree *argtree = NULL; + Tree *argtree = nullptr; evaluate(args[0],&argtree,ivar); newtree->first = argtree; if (narg > 1) { @@ -3425,12 +3425,12 @@ int Variable::math_function(char *word, char *contents, Tree **tree, treestack[ntreestack++] = newtree; } else { - value1 = evaluate(args[0],NULL,ivar); + value1 = evaluate(args[0],nullptr,ivar); if (narg > 1) { - value2 = evaluate(args[1],NULL,ivar); + value2 = evaluate(args[1],nullptr,ivar); if (narg > 2) { for (int i = 2; i < narg; i++) - values[i-2] = evaluate(args[i],NULL,ivar); + values[i-2] = evaluate(args[i],nullptr,ivar); } } } @@ -3530,7 +3530,7 @@ int Variable::math_function(char *word, char *contents, Tree **tree, print_var_error(FLERR,"Invalid math function in variable formula",ivar); if (tree) newtree->type = RANDOM; else { - if (randomequal == NULL) { + if (randomequal == nullptr) { int seed = static_cast (values[0]); if (seed <= 0) print_var_error(FLERR,"Invalid math function in variable formula",ivar); @@ -3545,7 +3545,7 @@ int Variable::math_function(char *word, char *contents, Tree **tree, else { if (value2 < 0.0) print_var_error(FLERR,"Invalid math function in variable formula",ivar); - if (randomequal == NULL) { + if (randomequal == nullptr) { int seed = static_cast (values[0]); if (seed <= 0) print_var_error(FLERR,"Invalid math function in variable formula",ivar); @@ -4029,7 +4029,7 @@ int Variable::group_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4107,8 +4107,8 @@ int Variable::special_function(char *word, char *contents, Tree **tree, if (narg != 1) print_var_error(FLERR,"Invalid special function in variable formula",ivar); - Compute *compute = NULL; - Fix *fix = NULL; + Compute *compute = nullptr; + Fix *fix = nullptr; int ivar = -1; int index,nvec,nstride; char *ptr1,*ptr2; @@ -4239,7 +4239,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, double *vec; if (index) { if (compute->array) vec = &compute->array[0][index-1]; - else vec = NULL; + else vec = nullptr; } else vec = compute->vector; int j = 0; @@ -4320,7 +4320,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4328,7 +4328,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, // mask special functions } else if (strcmp(word,"gmask") == 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Gmask function in equal-style " "variable formula",ivar); if (narg != 1) @@ -4341,12 +4341,12 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = GMASK; newtree->ivalue1 = group->bitmask[igroup]; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else if (strcmp(word,"rmask") == 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Rmask function in equal-style " "variable formula",ivar); if (narg != 1) @@ -4358,12 +4358,12 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = RMASK; newtree->ivalue1 = iregion; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else if (strcmp(word,"grmask") == 0) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Grmask function in equal-style " "variable formula",ivar); if (narg != 2) @@ -4379,7 +4379,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, newtree->type = GRMASK; newtree->ivalue1 = group->bitmask[igroup]; newtree->ivalue2 = iregion; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -4409,7 +4409,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4419,7 +4419,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, // set selfalloc = 1 so result will be deleted by free_tree() after eval } else if (style[ivar] == ATOMFILE) { - if (tree == NULL) + if (tree == nullptr) print_var_error(FLERR,"Atomfile variable in " "equal-style variable formula",ivar); @@ -4435,7 +4435,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, newtree->array = result; newtree->nstride = 1; newtree->selfalloc = 1; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -4456,7 +4456,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4475,7 +4475,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4494,7 +4494,7 @@ int Variable::special_function(char *word, char *contents, Tree **tree, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4579,7 +4579,7 @@ void Variable::peratom2global(int flag, char *word, Tree *newtree = new Tree(); newtree->type = VALUE; newtree->value = value; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; } else argstack[nargstack++] = value; @@ -4622,14 +4622,14 @@ int Variable::is_atom_vector(char *word) void Variable::atom_vector(char *word, Tree **tree, Tree **treestack, int &ntreestack) { - if (tree == NULL) + if (tree == nullptr) error->all(FLERR,"Atom vector in equal-style variable formula"); Tree *newtree = new Tree(); newtree->type = ATOMARRAY; newtree->nstride = 3; newtree->selfalloc = 0; - newtree->first = newtree->second = NULL; + newtree->first = newtree->second = nullptr; newtree->nextra = 0; treestack[ntreestack++] = newtree; @@ -4756,7 +4756,7 @@ int Variable::parse_args(char *str, char **args) /* ---------------------------------------------------------------------- find next comma in str skip commas inside one or more nested parenthesis - only return ptr to comma at level 0, else NULL if not found + only return ptr to comma at level 0, else nullptr if not found ------------------------------------------------------------------------- */ char *Variable::find_next_comma(char *str) @@ -4767,7 +4767,7 @@ char *Variable::find_next_comma(char *str) else if (')' == *p) level--; else if (',' == *p && !level) return p; } - return NULL; + return nullptr; } @@ -5069,11 +5069,11 @@ VarReader::VarReader(LAMMPS *lmp, char *name, char *file, int flag) : { me = comm->me; style = flag; - fp = NULL; + fp = nullptr; if (me == 0) { fp = fopen(file,"r"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open file variable file {}: {}", file, utils::getsyserror())); } @@ -5082,9 +5082,9 @@ VarReader::VarReader(LAMMPS *lmp, char *name, char *file, int flag) : // allocate a new fix STORE, so they persist // id = variable-ID + VARIABLE_STORE, fix group = all - fixstore = NULL; - id_fix = NULL; - buffer = NULL; + fixstore = nullptr; + id_fix = nullptr; + buffer = nullptr; if (style == ATOMFILE) { if (atom->map_style == Atom::MAP_NONE) @@ -5109,7 +5109,7 @@ VarReader::~VarReader() { if (me == 0) { fclose(fp); - fp = NULL; + fp = nullptr; } // check modify in case all fixes have already been deleted @@ -5137,12 +5137,12 @@ int VarReader::read_scalar(char *str) if (me == 0) { while (1) { - if (fgets(str,MAXLINE,fp) == NULL) n = 0; + if (fgets(str,MAXLINE,fp) == nullptr) n = 0; else n = strlen(str); if (n == 0) break; // end of file str[n-1] = '\0'; // strip newline if ((ptr = strchr(str,'#'))) *ptr = '\0'; // strip comment - if (strtok(str," \t\n\r\f") == NULL) continue; // skip if blank + if (strtok(str," \t\n\r\f") == nullptr) continue; // skip if blank n = strlen(str) + 1; break; } @@ -5180,12 +5180,12 @@ int VarReader::read_peratom() char str[MAXLINE]; if (me == 0) { while (1) { - if (fgets(str,MAXLINE,fp) == NULL) n = 0; + if (fgets(str,MAXLINE,fp) == nullptr) n = 0; else n = strlen(str); if (n == 0) break; // end of file str[n-1] = '\0'; // strip newline if ((ptr = strchr(str,'#'))) *ptr = '\0'; // strip comment - if (strtok(str," \t\n\r\f") == NULL) continue; // skip if blank + if (strtok(str," \t\n\r\f") == nullptr) continue; // skip if blank n = strlen(str) + 1; break; } diff --git a/src/variable.h b/src/variable.h index efffacc7bba4cf2a7132ef7e8ca2f8319e0ecd32..58548bc27658466c8b2d222dc2cffb2d80baffa4 100644 --- a/src/variable.h +++ b/src/variable.h @@ -93,9 +93,9 @@ class Variable : protected Pointers { Tree **extra; // ptrs further down tree for nextra args Tree() : - array(NULL), iarray(NULL), barray(NULL), + array(nullptr), iarray(nullptr), barray(nullptr), selfalloc(0), ivalue1(0), ivalue2(0), nextra(0), - first(NULL), second(NULL), extra(NULL) {} + first(nullptr), second(nullptr), extra(nullptr) {} }; int compute_python(int); diff --git a/src/velocity.cpp b/src/velocity.cpp index 94a5081e39e5990e8c493f52ac0ce1d46f1d37a3..7057d68bcec84f73713affc5598ecdac1519a0d4 100644 --- a/src/velocity.cpp +++ b/src/velocity.cpp @@ -82,7 +82,7 @@ void Velocity::command(int narg, char **arg) // set defaults - temperature = NULL; + temperature = nullptr; dist_flag = 0; sum_flag = 0; momentum_flag = 1; @@ -147,7 +147,7 @@ void Velocity::init_external(const char *extgroup) if (igroup == -1) error->all(FLERR,"Could not find velocity group ID"); groupbit = group->bitmask[igroup]; - temperature = NULL; + temperature = nullptr; dist_flag = 0; sum_flag = 0; momentum_flag = 1; @@ -179,18 +179,18 @@ void Velocity::create(double t_desired, int seed) } } - // if temperature = NULL or bias_flag set, + // if temperature = nullptr or bias_flag set, // create a new ComputeTemp with the velocity group int tcreate_flag = 0; - Compute *temperature_nobias = NULL; + Compute *temperature_nobias = nullptr; - if (temperature == NULL || bias_flag) { + if (temperature == nullptr || bias_flag) { char **arg = new char*[3]; arg[0] = (char *) "velocity_temp"; arg[1] = group->names[igroup]; arg[2] = (char *) "temp"; - if (temperature == NULL) { + if (temperature == nullptr) { temperature = new ComputeTemp(lmp,3,arg); tcreate_flag = 1; } else temperature_nobias = new ComputeTemp(lmp,3,arg); @@ -245,7 +245,7 @@ void Velocity::create(double t_desired, int seed) int m; double vx,vy,vz,factor; - RanPark *random = NULL; + RanPark *random = nullptr; if (loop_flag == ALL) { @@ -368,7 +368,7 @@ void Velocity::create(double t_desired, int seed) // no-bias compute calculates temp only for new thermal velocities double t; - if ((bias_flag == 0) || (temperature_nobias == NULL)) + if ((bias_flag == 0) || (temperature_nobias == nullptr)) t = temperature->compute_scalar(); else t = temperature_nobias->compute_scalar(); rescale(t,t_desired); @@ -417,7 +417,7 @@ void Velocity::set(int /*narg*/, char **arg) // parse 3 args xstyle = ystyle = zstyle = CONSTANT; - xstr = ystr = zstr = NULL; + xstr = ystr = zstr = nullptr; if (strstr(arg[0],"v_") == arg[0]) { int n = strlen(&arg[0][2]) + 1; @@ -501,7 +501,7 @@ void Velocity::set(int /*narg*/, char **arg) // allocate vfield array if necessary - double **vfield = NULL; + double **vfield = nullptr; if (varflag == ATOM) memory->create(vfield,atom->nlocal,3,"velocity:vfield"); // set velocities via constants @@ -531,17 +531,17 @@ void Velocity::set(int /*narg*/, char **arg) if (xstyle == EQUAL) vx = input->variable->compute_equal(xvar); else if (xstyle == ATOM) { if (vfield) input->variable->compute_atom(xvar,igroup,&vfield[0][0],3,0); - else input->variable->compute_atom(xvar,igroup,NULL,3,0); + else input->variable->compute_atom(xvar,igroup,nullptr,3,0); } if (ystyle == EQUAL) vy = input->variable->compute_equal(yvar); else if (ystyle == ATOM) { if (vfield) input->variable->compute_atom(yvar,igroup,&vfield[0][1],3,0); - else input->variable->compute_atom(yvar,igroup,NULL,3,0); + else input->variable->compute_atom(yvar,igroup,nullptr,3,0); } if (zstyle == EQUAL) vz = input->variable->compute_equal(zvar); else if (zstyle == ATOM) { if (vfield) input->variable->compute_atom(zvar,igroup,&vfield[0][2],3,0); - else input->variable->compute_atom(zvar,igroup,NULL,3,0); + else input->variable->compute_atom(zvar,igroup,nullptr,3,0); } for (int i = 0; i < nlocal; i++) @@ -580,10 +580,10 @@ void Velocity::scale(int /*narg*/, char **arg) { double t_desired = utils::numeric(FLERR,arg[0],false,lmp); - // if temperature = NULL, create a new ComputeTemp with the velocity group + // if temperature = nullptr, create a new ComputeTemp with the velocity group int tflag = 0; - if (temperature == NULL) { + if (temperature == nullptr) { char **arg = new char*[3]; arg[0] = (char *) "velocity_temp"; arg[1] = group->names[igroup]; @@ -901,7 +901,7 @@ void Velocity::options(int narg, char **arg) // error check - if (bias_flag && temperature == NULL) + if (bias_flag && temperature == nullptr) error->all(FLERR,"Cannot use velocity bias command without temp keyword"); if (bias_flag && temperature->tempbias == 0) error->all(FLERR,"Velocity temperature ID does calculate a velocity bias"); diff --git a/src/write_coeff.cpp b/src/write_coeff.cpp index 121a2ed1fda68f95a05d4da70347811a6f247330..3e247f19ce6e9d1fa3aa9a4406edea8995d74fe4 100644 --- a/src/write_coeff.cpp +++ b/src/write_coeff.cpp @@ -56,7 +56,7 @@ void WriteCoeff::command(int narg, char **arg) char str[256], coeff[256]; FILE *one = fopen(file,"wb+"); - if (one == NULL) + if (one == nullptr) error->one(FLERR,fmt::format("Cannot open coeff file {}: {}", file, utils::getsyserror())); @@ -90,7 +90,7 @@ void WriteCoeff::command(int narg, char **arg) rewind(one); FILE *two = fopen(file+4,"w"); - if (two == NULL) + if (two == nullptr) error->one(FLERR,fmt::format("Cannot open coeff file {}: {}", file+4, utils::getsyserror())); @@ -99,15 +99,15 @@ void WriteCoeff::command(int narg, char **arg) while(1) { int coeff_mode = REGULAR_MODE; - if (fgets(str,256,one) == NULL) break; + if (fgets(str,256,one) == nullptr) break; // some coeffs need special treatment - if (strstr(str,"class2") != NULL) { - if (strstr(str,"angle_style") != NULL) + if (strstr(str,"class2") != nullptr) { + if (strstr(str,"angle_style") != nullptr) coeff_mode = CLASS2_MODE; - else if (strstr(str,"dihedral_style") != NULL) + else if (strstr(str,"dihedral_style") != nullptr) coeff_mode = CLASS2_MODE; - else if (strstr(str,"improper_style") != NULL) + else if (strstr(str,"improper_style") != nullptr) coeff_mode = CLASS2_MODE; } diff --git a/src/write_data.cpp b/src/write_data.cpp index 34d45ccde653c8e5c809c2f2c9b2038eaddc7767..d0490b192059ac2c2bf1973840baa1b7924eb128 100644 --- a/src/write_data.cpp +++ b/src/write_data.cpp @@ -153,21 +153,21 @@ void WriteData::write(const std::string &file) // may be different than atom->nbonds,nangles, etc. if broken/turned-off if (atom->molecular == Atom::MOLECULAR && (atom->nbonds || atom->nbondtypes)) { - nbonds_local = atom->avec->pack_bond(NULL); + nbonds_local = atom->avec->pack_bond(nullptr); MPI_Allreduce(&nbonds_local,&nbonds,1,MPI_LMP_BIGINT,MPI_SUM,world); } if (atom->molecular == Atom::MOLECULAR && (atom->nangles || atom->nangletypes)) { - nangles_local = atom->avec->pack_angle(NULL); + nangles_local = atom->avec->pack_angle(nullptr); MPI_Allreduce(&nangles_local,&nangles,1,MPI_LMP_BIGINT,MPI_SUM,world); } if (atom->molecular == Atom::MOLECULAR && (atom->ndihedrals || atom->ndihedraltypes)) { - ndihedrals_local = atom->avec->pack_dihedral(NULL); + ndihedrals_local = atom->avec->pack_dihedral(nullptr); MPI_Allreduce(&ndihedrals_local,&ndihedrals,1,MPI_LMP_BIGINT,MPI_SUM,world); } if (atom->molecular == Atom::MOLECULAR && (atom->nimpropers || atom->nimpropertypes)) { - nimpropers_local = atom->avec->pack_improper(NULL); + nimpropers_local = atom->avec->pack_improper(nullptr); MPI_Allreduce(&nimpropers_local,&nimpropers,1,MPI_LMP_BIGINT,MPI_SUM,world); } @@ -175,7 +175,7 @@ void WriteData::write(const std::string &file) if (me == 0) { fp = fopen(file.c_str(),"w"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR,fmt::format("Cannot open data file {}: {}", file, utils::getsyserror())); } @@ -665,7 +665,7 @@ void WriteData::bonus(int flag) // communication buffer for all my Bonus info // maxvalues = largest buffer needed by any proc - int nvalues = atom->avec->pack_data_bonus(NULL,flag); + int nvalues = atom->avec->pack_data_bonus(nullptr,flag); int maxvalues; MPI_Allreduce(&nvalues,&maxvalues,1,MPI_INT,MPI_MAX,world); diff --git a/src/write_dump.cpp b/src/write_dump.cpp index 56839a2f5e47ffcd96b55d05e5f669aa8f956219..fd359ec2ba47ba44ace7be1c527a5e4e1a51d007 100644 --- a/src/write_dump.cpp +++ b/src/write_dump.cpp @@ -45,7 +45,7 @@ void WriteDump::command(int narg, char **arg) // create the Dump instance // create dump command line with extra required args - Dump *dump = NULL; + Dump *dump = nullptr; char **dumpargs = new char*[modindex+2]; dumpargs[0] = (char *) "WRITE_DUMP"; // dump id diff --git a/src/write_restart.cpp b/src/write_restart.cpp index 256d7a377ee5b1c7668501efb39bc682bcd301c6..09fe85fd1ade2f951ab9063d35f904ba28eb2dbe 100644 --- a/src/write_restart.cpp +++ b/src/write_restart.cpp @@ -49,7 +49,7 @@ WriteRestart::WriteRestart(LAMMPS *lmp) : Pointers(lmp) MPI_Comm_size(world,&nprocs); multiproc = 0; noinit = 0; - fp = NULL; + fp = nullptr; } /* ---------------------------------------------------------------------- @@ -231,7 +231,7 @@ void WriteRestart::write(std::string file) if (multiproc) base.replace(base.find("%"),1,"base"); fp = fopen(base.c_str(),"wb"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR, fmt::format("Cannot open restart file {}: {}", base, utils::getsyserror())); } @@ -286,7 +286,7 @@ void WriteRestart::write(std::string file) magic_string(); if (ferror(fp)) io_error = 1; fclose(fp); - fp = NULL; + fp = nullptr; } std::string multiname = file; @@ -294,7 +294,7 @@ void WriteRestart::write(std::string file) if (filewriter) { fp = fopen(multiname.c_str(),"wb"); - if (fp == NULL) + if (fp == nullptr) error->one(FLERR, fmt::format("Cannot open restart file {}: {}", multiname, utils::getsyserror())); write_int(PROCSPERFILE,nclusterprocs); @@ -363,7 +363,7 @@ void WriteRestart::write(std::string file) magic_string(); if (ferror(fp)) io_error = 1; fclose(fp); - fp = NULL; + fp = nullptr; } mpiio->openForWrite(file.c_str()); mpiio->write(headerOffset,send_size,buf); @@ -393,7 +393,7 @@ void WriteRestart::write(std::string file) magic_string(); if (ferror(fp)) io_error = 1; fclose(fp); - fp = NULL; + fp = nullptr; } else { MPI_Recv(&tmp,0,MPI_INT,fileproc,0,world,MPI_STATUS_IGNORE); @@ -631,7 +631,7 @@ void WriteRestart::version_numeric() } /* ---------------------------------------------------------------------- - write a flag and an int into restart file + write a flag and an int into the restart file ------------------------------------------------------------------------- */ void WriteRestart::write_int(int flag, int value) @@ -641,7 +641,7 @@ void WriteRestart::write_int(int flag, int value) } /* ---------------------------------------------------------------------- - write a flag and a bigint into restart file + write a flag and a bigint into the restart file ------------------------------------------------------------------------- */ void WriteRestart::write_bigint(int flag, bigint value) @@ -651,7 +651,7 @@ void WriteRestart::write_bigint(int flag, bigint value) } /* ---------------------------------------------------------------------- - write a flag and a double into restart file + write a flag and a double into the restart file ------------------------------------------------------------------------- */ void WriteRestart::write_double(int flag, double value) @@ -661,7 +661,8 @@ void WriteRestart::write_double(int flag, double value) } /* ---------------------------------------------------------------------- - write a flag and a char string (including NULL) into restart file + write a flag and a C-style char string (including the terminating null + byte) into the restart file ------------------------------------------------------------------------- */ void WriteRestart::write_string(int flag, const char *value) @@ -673,7 +674,7 @@ void WriteRestart::write_string(int flag, const char *value) } /* ---------------------------------------------------------------------- - write a flag and vector of N ints into restart file + write a flag and vector of N ints into the restart file ------------------------------------------------------------------------- */ void WriteRestart::write_int_vec(int flag, int n, int *vec) @@ -684,7 +685,7 @@ void WriteRestart::write_int_vec(int flag, int n, int *vec) } /* ---------------------------------------------------------------------- - write a flag and vector of N doubles into restart file + write a flag and vector of N doubles into the restart file ------------------------------------------------------------------------- */ void WriteRestart::write_double_vec(int flag, int n, double *vec) diff --git a/unittest/force-styles/tests/kspace-msm_nopbc.yaml b/unittest/force-styles/tests/kspace-msm_nopbc.yaml index 99bbd2ae977b300a08478e7e543b2edaf415e10f..028ee43aaf25b19cfc85146796e7c70172deab1b 100644 --- a/unittest/force-styles/tests/kspace-msm_nopbc.yaml +++ b/unittest/force-styles/tests/kspace-msm_nopbc.yaml @@ -1,6 +1,6 @@ --- lammps_version: 24 Aug 2020 -date_generated: Sat Sep 12 10:33:36 202 +date_generated: Tue Sep 15 14:47:38 202 epsilon: 5e-11 prerequisites: ! | atom full @@ -58,33 +58,33 @@ run_coul: 0 run_stress: ! |2- 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 run_forces: ! |2 - 1 -1.0348864007239668e-01 3.2761800817797082e-01 -2.7223154925249687e-01 - 2 1.1547721105281426e-02 -2.2227221129297944e-01 1.9829831292225819e-01 - 3 -6.1369788686855553e-03 1.1473670690755385e-02 -1.2235119385263003e-02 - 4 2.8809534480886322e-02 -4.5070713784827680e-02 4.5263724656363712e-02 - 5 4.2323185781698226e-02 -5.2976717776467216e-02 4.9736627529403242e-02 - 6 3.8194733647326694e-02 -2.4587855825158134e-01 4.1856615868672892e-01 - 7 4.5246314631942265e-02 2.0099417967365288e-01 -4.3512916657147588e-01 - 8 2.2478550451619471e-02 2.0362301286740869e-01 -4.3516590120465981e-01 - 9 -1.4178329999306901e-03 -1.5368030392367521e-01 2.6080100301013964e-01 - 10 -2.0495450209946312e-02 -2.0851530662446178e-02 7.4319850349891012e-02 - 11 -3.0029358892398838e-02 -2.0702279983167187e-02 9.8520949030575691e-02 - 12 1.3289689675296273e-01 9.3775108342107519e-02 -3.0419584939008770e-01 - 13 -5.5922486140088226e-02 -2.4843666409380370e-02 1.0515381624429042e-01 - 14 -4.4208019862361184e-02 -2.8633675987750289e-02 9.8140924300998925e-02 - 15 -3.8534805055538454e-02 -4.3447767456428393e-02 9.5052177465633700e-02 - 16 -2.0197663776900704e-01 -9.6067608908760441e-02 5.1267317994067874e-01 - 17 1.1536172816123620e-01 1.2150176721849106e-01 -4.0576909205923889e-01 - 18 3.2654836490027450e-01 4.3181659922436294e-01 -6.4631937847140064e-01 - 19 -1.7012391318923387e-01 -1.9294196901436866e-01 3.0171461650625692e-01 - 20 -1.6090393021018687e-01 -1.8797301084913640e-01 2.9016061976069074e-01 - 21 4.6464803590088510e-01 2.0966755173124815e-01 -8.4865286121979111e-01 - 22 -2.2714234064511640e-01 -1.1056430229170305e-01 3.8599855632265567e-01 - 23 -1.9865351580467286e-01 -1.1110079780224448e-01 3.9440435138483038e-01 - 24 -1.1755770692492392e-02 7.9361803570205403e-01 -3.4523386783293764e-01 - 25 5.0411795551073120e-02 -3.8916839645964540e-01 1.9278646898979940e-01 - 26 -2.9733815594164319e-02 -4.1142305819442143e-01 1.7495936527287648e-01 - 27 -5.2243746980854566e-01 2.4806539986837281e-01 -3.8666209074075969e-01 - 28 2.9308687168280761e-01 -1.5702803664966208e-01 2.0612286277862657e-01 - 29 2.5153793410884945e-01 -1.2745488321867574e-01 1.8930202039662150e-01 + 1 -1.0725057415020919e-01 3.3019907950838151e-01 -2.9323265400347975e-01 + 2 1.4273516924286595e-02 -2.2195304769099961e-01 2.1172398888943439e-01 + 3 -6.2191160687439613e-03 1.1636479086601327e-02 -1.3193542766995693e-02 + 4 2.8789530000554349e-02 -4.5707077957577419e-02 4.8949304170325961e-02 + 5 4.2918140819301939e-02 -5.3982290008046191e-02 5.4071851700930415e-02 + 6 4.0693195898835278e-02 -2.5124364388294529e-01 4.4409525619111351e-01 + 7 4.3902199408654773e-02 2.0718378754835146e-01 -4.5693181215217060e-01 + 8 1.8355056045104463e-02 2.1019458646438235e-01 -4.5977818830587547e-01 + 9 1.6926987410114289e-03 -1.5785316258950571e-01 2.7688718669924633e-01 + 10 -1.9845368939794925e-02 -2.2016564601343797e-02 7.7877659664832483e-02 + 11 -2.9242294066982408e-02 -2.2678746148089381e-02 1.0272772972867131e-01 + 12 1.2960469545860479e-01 9.7367043788644400e-02 -3.1763881493481549e-01 + 13 -5.4829808348627301e-02 -2.6026456048508360e-02 1.0948080578658986e-01 + 14 -4.3113220503693823e-02 -2.9962591673432723e-02 1.0219446255502410e-01 + 15 -3.7688395823574243e-02 -4.4115392571750824e-02 9.9676983434799277e-02 + 16 -1.9855722830658068e-01 -1.0361163893486998e-01 5.3648057305505858e-01 + 17 1.1217353766495122e-01 1.2665752635347602e-01 -4.2776774483665475e-01 + 18 3.1619456057296186e-01 4.2101932424007404e-01 -6.7203553906529401e-01 + 19 -1.6723605125535490e-01 -1.8745079364937817e-01 3.1118730606879103e-01 + 20 -1.5510498316646221e-01 -1.8060202958376245e-01 3.0126314730021070e-01 + 21 4.5618585311145787e-01 2.3416325579619782e-01 -8.7525764015858531e-01 + 22 -2.2272028927958532e-01 -1.2422014484239144e-01 3.9660449946839177e-01 + 23 -1.9381556909487696e-01 -1.2213865056926680e-01 4.0697283949615592e-01 + 24 -1.7632222754297714e-02 8.0868006192947306e-01 -3.6871343152445346e-01 + 25 5.5196078243586418e-02 -3.9602778003476646e-01 2.0694223014380941e-01 + 26 -2.8010525620160029e-02 -4.1949748612714061e-01 1.8579634676877732e-01 + 27 -5.3081154989654455e-01 2.5084075406488837e-01 -4.1028201045412238e-01 + 28 2.9697439332712672e-01 -1.5978637451711275e-01 2.1926787644097381e-01 + 29 2.5525638787732113e-01 -1.2899390363572455e-01 2.0303208126884240e-01 ...