Merge remote-tracking branch 'origin/master' into python_interface_guide

This commit is contained in:
Richard Berger
2020-09-17 12:08:12 -04:00
1708 changed files with 26482 additions and 22921 deletions

View File

@ -2,6 +2,8 @@ set(COLVARS_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars)
file(GLOB COLVARS_SOURCES ${COLVARS_SOURCE_DIR}/[^.]*.cpp) file(GLOB COLVARS_SOURCES ${COLVARS_SOURCE_DIR}/[^.]*.cpp)
option(COLVARS_DEBUG "Debugging messages for Colvars (quite verbose)" OFF)
# Build Lepton by default # Build Lepton by default
option(COLVARS_LEPTON "Build and link the Lepton library" ON) option(COLVARS_LEPTON "Build and link the Lepton library" ON)
@ -21,6 +23,11 @@ set_target_properties(colvars PROPERTIES OUTPUT_NAME lammps_colvars${LAMMPS_MACH
target_include_directories(colvars PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/colvars) target_include_directories(colvars PUBLIC ${LAMMPS_LIB_SOURCE_DIR}/colvars)
target_link_libraries(lammps PRIVATE colvars) target_link_libraries(lammps PRIVATE colvars)
if(COLVARS_DEBUG)
# Need to export the macro publicly to also affect the proxy
target_compile_definitions(colvars PUBLIC -DCOLVARS_DEBUG)
endif()
if(COLVARS_LEPTON) if(COLVARS_LEPTON)
target_link_libraries(lammps PRIVATE lepton) target_link_libraries(lammps PRIVATE lepton)
target_compile_definitions(colvars PRIVATE -DLEPTON) target_compile_definitions(colvars PRIVATE -DLEPTON)

View File

@ -431,6 +431,7 @@ INPUT = @LAMMPS_SOURCE_DIR@/utils.cpp \
@LAMMPS_SOURCE_DIR@/my_page.h \ @LAMMPS_SOURCE_DIR@/my_page.h \
@LAMMPS_SOURCE_DIR@/my_pool_chunk.cpp \ @LAMMPS_SOURCE_DIR@/my_pool_chunk.cpp \
@LAMMPS_SOURCE_DIR@/my_pool_chunk.h \ @LAMMPS_SOURCE_DIR@/my_pool_chunk.h \
@LAMMPS_SOURCE_DIR@/math_eigen.h \
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded # directories that are symbolic links (a Unix file system feature) are excluded

View File

@ -10,7 +10,7 @@ strings into specific types of numbers with checking for validity. This
reduces redundant implementations and encourages consistent behavior. reduces redundant implementations and encourages consistent behavior.
I/O with status check I/O with status check
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
These are wrappers around the corresponding C library calls like These are wrappers around the corresponding C library calls like
``fgets()`` or ``fread()``. They will check if there were errors ``fgets()`` or ``fread()``. They will check if there were errors
@ -26,6 +26,8 @@ indicating the name of the problematic file, if possible.
.. doxygenfunction:: sfread .. doxygenfunction:: sfread
:project: progguide :project: progguide
----------
String to number conversions with validity check String to number conversions with validity check
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -281,6 +283,8 @@ This code example should produce the following output:
:project: progguide :project: progguide
:members: what :members: what
----------
File reader classes File reader classes
==================== ====================
@ -333,6 +337,8 @@ convert numbers, so that LAMMPS will be aborted.
A file that would be parsed by the reader code fragment looks like this: A file that would be parsed by the reader code fragment looks like this:
.. parsed-literal::
# DATE: 2015-02-19 UNITS: metal CONTRIBUTOR: Ray Shan CITATION: Streitz and Mintmire, Phys Rev B, 50, 11996-12003 (1994) # DATE: 2015-02-19 UNITS: metal CONTRIBUTOR: Ray Shan CITATION: Streitz and Mintmire, Phys Rev B, 50, 11996-12003 (1994)
# #
# X (eV) J (eV) gamma (1/\AA) zeta (1/\AA) Z (e) # X (eV) J (eV) gamma (1/\AA) zeta (1/\AA) Z (e)
@ -351,7 +357,6 @@ A file that would be parsed by the reader code fragment looks like this:
:project: progguide :project: progguide
:members: :members:
---------- ----------
Memory pool classes Memory pool classes
@ -415,3 +420,43 @@ its size is registered later with :cpp:func:`vgot()
.. doxygenclass:: LAMMPS_NS::MyPoolChunk .. doxygenclass:: LAMMPS_NS::MyPoolChunk
:project: progguide :project: progguide
:members: :members:
----------
Eigensolver functions
=====================
The ``MathEigen`` sub-namespace of the ``LAMMPS_NS`` namespace contains
functions and classes for eigensolvers. Currently only the
:cpp:func:`jacobi3 function <MathEigen::jacobi3>` is used in various
places in LAMMPS. That function is built on top of a group of more
generic eigensolvers that are maintained in the ``math_eigen_impl.h``
header file. This header contains the implementation of three template
classes:
#. "Jacobi" calculates all of the eigenvalues and eigenvectors
of a dense, symmetric, real matrix.
#. The "PEigenDense" class only calculates the principal eigenvalue
(ie. the largest or smallest eigenvalue), and its corresponding
eigenvector. However it is much more efficient than "Jacobi" when
applied to large matrices (larger than 13x13). PEigenDense also can
understand complex-valued Hermitian matrices.
#. The "LambdaLanczos" class is a generalization of "PEigenDense" which can be
applied to arbitrary sparse matrices.
The "math_eigen_impl.h" code is an amalgamation of `jacobi_pd
<https://github.com/jewettaij/jacobi_pd>`_ by Andrew Jewett at Scripps
Research (under CC0-1.0 license) and `Lambda Lanczos
<https://github.com/mrcdr/lambda-lanczos>`_ by Yuya Kurebayashi at
Tohoku University (under MIT license)
----------
.. doxygenfunction:: MathEigen::jacobi3(double const *const *mat, double *eval, double **evec)
:project: progguide
.. doxygenfunction:: MathEigen::jacobi3(double const mat[3][3], double *eval, double evec[3][3])
:project: progguide

View File

@ -1,9 +1,51 @@
Retrieving LAMMPS configuration information Retrieving LAMMPS configuration information
=========================================== ===========================================
The following library functions can be used to query the The following library functions can be used to query the LAMMPS library
LAMMPS library about compile time settings and included about compile time settings and included packages and styles. This
packages and styles. enables programs that use the library interface to run LAMMPS
simulations to determine, whether the linked LAMMPS library is compatible
with the requirements of the application without crashing during the
LAMMPS functions (e.g. due to missing pair styles from packages) or to
choose between different options (e.g. whether to use ``lj/cut``,
``lj/cut/opt``, ``lj/cut/omp`` or ``lj/cut/intel``). Most of the
functions can be called directly without first creating a LAMMPS
instance. While crashes within LAMMPS may be recovered from through
enabling :ref:`exceptions <exceptions>`, avoiding them proactively is
a safer approach.
.. code-block:: C
:caption: Example for using configuration settings functions
#include "library.h"
#include <stdio.h>
int main(int argc, char **argv)
{
void *handle;
handle = lammps_open_no_mpi(0, NULL, NULL);
lammps_file(handle, "in.missing");
if (lammps_has_error(handle)) {
char errmsg[256];
int errtype;
errtype = lammps_get_last_error_message(handle, errmsg, 256);
fprintf(stderr, "LAMMPS failed with error: %s\n", errmsg);
return 1;
}
/* write compressed dump file depending on available of options */
if (lammps_has_style(handle, "dump", "atom/zstd")) {
lammps_command(handle, "dump d1 all atom/zstd 100 dump.zst");
} else if (lammps_has_style(handle, "dump", "atom/gz")) {
lammps_command(handle, "dump d1 all atom/gz 100 dump.gz");
} else if (lammps_config_has_gzip_support()) {
lammps_command(handle, "dump d1 all atom 100 dump.gz");
} else {
lammps_command(handle, "dump d1 all atom 100 dump");
}
lammps_close(handle);
return 0;
}
----------------------- -----------------------

View File

@ -2,8 +2,8 @@ Retrieving or setting LAMMPS system properties
============================================== ==============================================
The library interface allows to extract different kinds of information The library interface allows to extract different kinds of information
about the active simulation instance and also to modify some of them. about the active simulation instance and also to modify some of it.
This allows to combine MD simulation steps with other processing and This enables combining MD simulation steps with other processing and
simulation methods computed in the calling code or another code that is simulation methods computed in the calling code or another code that is
coupled to LAMMPS via the library interface. In some cases the data coupled to LAMMPS via the library interface. In some cases the data
returned is direct reference to the original data inside LAMMPS cast returned is direct reference to the original data inside LAMMPS cast
@ -14,6 +14,34 @@ is the per-processor **local** data and indexed accordingly. These arrays
can change sizes and order at every neighbor list rebuild and atom sort can change sizes and order at every neighbor list rebuild and atom sort
event as atoms are migrating between sub-domains. event as atoms are migrating between sub-domains.
.. code-block:: C
#include "library.h"
#include <stdio.h>
int main(int argc, char **argv)
{
void *handle;
int i;
handle = lammps_open_no_mpi(0, NULL, NULL);
lammps_file(handle,"in.sysinit");
printf("running simulation with %g atoms\n",
lammps_get_natoms(handle));
lammps_command(handle,"run 1000 post no");
for (i=0; i < 10; ++i) {
lammps_command(handle,"run 100 pre no post no");
printf("PE = %g\nKE = %g\n",
lammps_get_thermo(handle,"pe"),
lammps_get_thermo(handle,"ke"));
}
lammps_close(handle);
return 0;
}
----------------------- -----------------------
.. doxygenfunction:: lammps_version .. doxygenfunction:: lammps_version
@ -21,6 +49,11 @@ event as atoms are migrating between sub-domains.
----------------------- -----------------------
.. doxygenfunction:: lammps_memory_usage
:project: progguide
-----------------------
.. doxygenfunction:: lammps_get_mpi_comm .. doxygenfunction:: lammps_get_mpi_comm
:project: progguide :project: progguide

View File

@ -325,6 +325,7 @@ Buyl
Bybee Bybee
bz bz
cadetblue cadetblue
calc
calibre calibre
caltech caltech
Caltech Caltech
@ -397,6 +398,7 @@ ChiralIDs
chiralIDs chiralIDs
chirality chirality
Cho Cho
ChooseOffset
chris chris
Christoph Christoph
Chu Chu
@ -469,6 +471,7 @@ config
configfile configfile
configurational configurational
conformational conformational
ConstMatrix
Contrib Contrib
cooperativity cooperativity
coord coord
@ -639,7 +642,10 @@ dhex
dia dia
diag diag
diagonalization diagonalization
diagonalize
diagonalized diagonalized
diagonalizers
diagonalizing
Diallo Diallo
diel diel
differentiable differentiable
@ -778,8 +784,15 @@ Eggebrecht
ehex ehex
eHEX eHEX
Ei Ei
Eigen eigen
Eigensolve eigensolve
eigensolver
eigensolvers
eigendecomposition
eigenvalue
eigenvalues
eigenvector
eigenvectors
eij eij
Eij Eij
Eijnden Eijnden
@ -893,6 +906,11 @@ eV
evalue evalue
Evanseck Evanseck
evdwl evdwl
evector
evec
evecs
eval
evals
Everaers Everaers
Evgeny Evgeny
evirials evirials
@ -1069,6 +1087,7 @@ Germann
Germano Germano
gerolf gerolf
Gerolf Gerolf
Gershgorin
gettimeofday gettimeofday
gewald gewald
Gezelter Gezelter
@ -1184,6 +1203,7 @@ Henkelman
Henkes Henkes
henrich henrich
Henrich Henrich
Hermitian
Herrmann Herrmann
Hertizian Hertizian
hertzian hertzian
@ -1257,6 +1277,7 @@ icosahedral
idealgas idealgas
IDR IDR
idx idx
ie
ielement ielement
ieni ieni
ifdefs ifdefs
@ -1279,6 +1300,7 @@ Imageint
Imagemagick Imagemagick
imd imd
Impey Impey
impl
impropers impropers
Impropers Impropers
includelink includelink
@ -1348,6 +1370,8 @@ isothermal
isotropically isotropically
isovolume isovolume
Isralewitz Isralewitz
iter
iters
iteratively iteratively
Ith Ith
Itsets Itsets
@ -1524,6 +1548,7 @@ Kub
Kubo Kubo
Kumagai Kumagai
Kumar Kumar
Kurebayashi
Kuronen Kuronen
Kusters Kusters
Kutta Kutta
@ -1534,12 +1559,14 @@ Ladd
lagrangian lagrangian
lambdai lambdai
lamda lamda
LambdaLanczos
lammps lammps
Lammps Lammps
LAMMPS LAMMPS
lammpsplot lammpsplot
Lampis Lampis
Lamoureux Lamoureux
Lanczos
Lande Lande
Landron Landron
langevin langevin
@ -1847,6 +1874,7 @@ Microscale
midnightblue midnightblue
mie mie
Mie Mie
Mij
Mikami Mikami
Militzer Militzer
Minary Minary
@ -1945,6 +1973,7 @@ Muccioli
mui mui
Mukherjee Mukherjee
Mulders Mulders
mult
multi multi
multibody multibody
Multibody Multibody
@ -2332,6 +2361,7 @@ peachpuff
Pearlman Pearlman
Pedersen Pedersen
peID peID
PEigenDense
Peng Peng
peptide peptide
peratom peratom
@ -2560,6 +2590,8 @@ rdf
RDideal RDideal
rdx rdx
reacter reacter
realTypeMap
real_t
README README
realtime realtime
reamin reamin
@ -2742,6 +2774,7 @@ Schuring
Schwen Schwen
screenshot screenshot
screenshots screenshots
Scripps
Scripta Scripta
sdk sdk
sdpd sdpd
@ -3070,6 +3103,7 @@ Tmin
tmp tmp
tN tN
Tobias Tobias
Tohoku
tokenizer tokenizer
tokyo tokyo
tol tol
@ -3133,6 +3167,8 @@ tu
Tuckerman Tuckerman
tue tue
tunable tunable
tuple
tuples
Turkand Turkand
Tutein Tutein
tweakable tweakable
@ -3426,6 +3462,7 @@ Yuh
yukawa yukawa
Yukawa Yukawa
Yusof Yusof
Yuya
yx yx
yy yy
yz yz

View File

@ -1,7 +1,7 @@
configuration { configuration {
step 200 step 200
dt 2.000000e+00 dt 2.000000e+00
version 2018-11-16 version 2020-07-07
} }
colvar { colvar {

View File

@ -1,7 +1,7 @@
configuration { configuration {
step 100 step 100
dt 2.000000e+00 dt 2.000000e+00
version 2018-11-16 version 2020-07-07
} }
colvar { colvar {

View File

@ -1,7 +1,7 @@
configuration { configuration {
step 300 step 300
dt 2.000000e+00 dt 2.000000e+00
version 2018-11-16 version 2020-07-07
} }
colvar { colvar {

View File

@ -1,7 +1,7 @@
configuration { configuration {
step 100 step 100
dt 2.000000e+00 dt 2.000000e+00
version 2018-11-16 version 2020-07-07
} }
colvar { colvar {

View File

@ -30,26 +30,26 @@ namespace ATC {
useFeMdMassMatrix_(false), useFeMdMassMatrix_(false),
trackCharge_(false), trackCharge_(false),
temperatureDef_(NONE), temperatureDef_(NONE),
prescribedDataMgr_(NULL), prescribedDataMgr_(nullptr),
physicsModel_(NULL), physicsModel_(nullptr),
extrinsicModelManager_(this), extrinsicModelManager_(this),
atomicRegulator_(NULL), atomicRegulator_(nullptr),
atomQuadForInternal_(true), atomQuadForInternal_(true),
elementMask_(NULL), elementMask_(nullptr),
elementMaskMass_(NULL), elementMaskMass_(nullptr),
elementMaskMassMd_(NULL), elementMaskMassMd_(nullptr),
nodalAtomicMass_(NULL), nodalAtomicMass_(nullptr),
nodalAtomicCount_(NULL), nodalAtomicCount_(nullptr),
nodalAtomicHeatCapacity_(NULL), nodalAtomicHeatCapacity_(nullptr),
internalToMask_(NULL), internalToMask_(nullptr),
internalElement_(NULL), internalElement_(nullptr),
ghostElement_(NULL), ghostElement_(nullptr),
nodalGeometryType_(NULL), nodalGeometryType_(nullptr),
bndyIntType_(NO_QUADRATURE), bndyIntType_(NO_QUADRATURE),
bndyFaceSet_(NULL), bndyFaceSet_(nullptr),
atomicWeightsMask_(NULL), atomicWeightsMask_(nullptr),
shpFcnMask_(NULL), shpFcnMask_(nullptr),
shpFcnDerivsMask_(NULL), shpFcnDerivsMask_(nullptr),
sourceIntegration_(FULL_DOMAIN) sourceIntegration_(FULL_DOMAIN)
{ {
// size the field mask // size the field mask
@ -68,7 +68,7 @@ namespace ATC {
ATC_Coupling::~ATC_Coupling() ATC_Coupling::~ATC_Coupling()
{ {
interscaleManager_.clear(); interscaleManager_.clear();
if (feEngine_) { delete feEngine_; feEngine_ = NULL; } if (feEngine_) { delete feEngine_; feEngine_ = nullptr; }
if (physicsModel_) delete physicsModel_; if (physicsModel_) delete physicsModel_;
if (atomicRegulator_) delete atomicRegulator_; if (atomicRegulator_) delete atomicRegulator_;
if (prescribedDataMgr_) delete prescribedDataMgr_; if (prescribedDataMgr_) delete prescribedDataMgr_;
@ -127,7 +127,7 @@ namespace ATC {
argIdx++; argIdx++;
parse_field(arg,argIdx,thisField,thisIndex); parse_field(arg,argIdx,thisField,thisIndex);
string nsetName(arg[argIdx++]); string nsetName(arg[argIdx++]);
XT_Function * f = NULL; XT_Function * f = nullptr;
// parse constant // parse constant
if (narg == argIdx+1) { if (narg == argIdx+1) {
f = XT_Function_Mgr::instance()->constant_function(atof(arg[argIdx])); f = XT_Function_Mgr::instance()->constant_function(atof(arg[argIdx]));
@ -164,7 +164,7 @@ namespace ATC {
argIdx++; argIdx++;
parse_field(arg,argIdx,thisField,thisIndex); parse_field(arg,argIdx,thisField,thisIndex);
string nsetName(arg[argIdx++]); string nsetName(arg[argIdx++]);
XT_Function * f = NULL; XT_Function * f = nullptr;
// fix current value // fix current value
if (narg == argIdx) { if (narg == argIdx) {
set<int> nodeSet = (feEngine_->fe_mesh())->nodeset(nsetName); set<int> nodeSet = (feEngine_->fe_mesh())->nodeset(nsetName);
@ -258,7 +258,7 @@ namespace ATC {
argIdx++; argIdx++;
parse_field(arg,argIdx,thisField,thisIndex); parse_field(arg,argIdx,thisField,thisIndex);
string esetName(arg[argIdx++]); string esetName(arg[argIdx++]);
XT_Function * f = NULL; XT_Function * f = nullptr;
// parse constant // parse constant
if (narg == argIdx+1) { if (narg == argIdx+1) {
string a(arg[argIdx]); string a(arg[argIdx]);
@ -367,7 +367,7 @@ namespace ATC {
argIdx++; argIdx++;
parse_field(arg,argIdx,thisField,thisIndex); parse_field(arg,argIdx,thisField,thisIndex);
string fsetName(arg[argIdx++]); string fsetName(arg[argIdx++]);
XT_Function * f = NULL; XT_Function * f = nullptr;
// parse constant // parse constant
if (narg == argIdx+1) { if (narg == argIdx+1) {
f = XT_Function_Mgr::instance()->constant_function(atof(arg[argIdx])); f = XT_Function_Mgr::instance()->constant_function(atof(arg[argIdx]));
@ -529,7 +529,7 @@ namespace ATC {
argIdx++; argIdx++;
parse_field(arg,argIdx,thisField,thisIndex); parse_field(arg,argIdx,thisField,thisIndex);
string fsetName(arg[argIdx++]); string fsetName(arg[argIdx++]);
UXT_Function * f = NULL; UXT_Function * f = nullptr;
// parse linear // parse linear
if (narg == argIdx+2) { if (narg == argIdx+2) {
f = UXT_Function_Mgr::instance()->linear_function(atof(arg[argIdx]),atof(arg[argIdx+1])); 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 WeakEquation::PDE_Type ATC_Coupling::pde_type(const FieldName fieldName) const
{ {
const WeakEquation * weakEq = physicsModel_->weak_equation(fieldName); const WeakEquation * weakEq = physicsModel_->weak_equation(fieldName);
if (weakEq == NULL) return WeakEquation::PROJECTION_PDE; if (weakEq == nullptr) return WeakEquation::PROJECTION_PDE;
return weakEq->type(); return weakEq->type();
} }
//-------------------------------------------------- //--------------------------------------------------
@ -768,7 +768,7 @@ namespace ATC {
bool ATC_Coupling::is_dynamic(const FieldName fieldName) const bool ATC_Coupling::is_dynamic(const FieldName fieldName) const
{ {
const WeakEquation * weakEq = physicsModel_->weak_equation(fieldName); 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); return (physicsModel_->weak_equation(fieldName)->type() == WeakEquation::DYNAMIC_PDE);
} }

View File

@ -114,10 +114,10 @@ namespace ATC {
FIELDS &rhs, FIELDS &rhs,
const Array< std::set <int> > atomMaterialGroups, const Array< std::set <int> > atomMaterialGroups,
const VectorDependencyManager<SPAR_MAT * > * shpFcnDerivs, const VectorDependencyManager<SPAR_MAT * > * shpFcnDerivs,
const SPAR_MAN * shpFcn = NULL, const SPAR_MAN * shpFcn = nullptr,
const DIAG_MAN * atomicWeights = NULL, const DIAG_MAN * atomicWeights = nullptr,
const MatrixDependencyManager<DenseMatrix, bool> * elementMask = NULL, const MatrixDependencyManager<DenseMatrix, bool> * elementMask = nullptr,
const SetDependencyManager<int> * nodeSet = NULL); const SetDependencyManager<int> * nodeSet = nullptr);
/** access to full right hand side / forcing vector */ /** access to full right hand side / forcing vector */
FIELDS &rhs() {return rhs_;}; FIELDS &rhs() {return rhs_;};
Array2D <bool> rhs_mask() const { Array2D <bool> rhs_mask() const {
@ -152,14 +152,14 @@ namespace ATC {
const FIELDS &fields, const FIELDS &fields,
FIELDS &rhs, FIELDS &rhs,
const IntegrationDomainType domain, // = FULL_DOMAIN const IntegrationDomainType domain, // = FULL_DOMAIN
const PhysicsModel * physicsModel=NULL); const PhysicsModel * physicsModel=nullptr);
/** wrapper for FE_Engine's compute_tangent_matrix */ /** wrapper for FE_Engine's compute_tangent_matrix */
void compute_rhs_tangent(const std::pair<FieldName,FieldName> row_col, void compute_rhs_tangent(const std::pair<FieldName,FieldName> row_col,
const RHS_MASK & rhsMask, const RHS_MASK & rhsMask,
const FIELDS & fields, const FIELDS & fields,
SPAR_MAT & stiffness, SPAR_MAT & stiffness,
const IntegrationDomainType integrationType, const IntegrationDomainType integrationType,
const PhysicsModel * physicsModel=NULL); const PhysicsModel * physicsModel=nullptr);
void tangent_matrix(const std::pair<FieldName,FieldName> row_col, void tangent_matrix(const std::pair<FieldName,FieldName> row_col,
const RHS_MASK & rhsMask, const RHS_MASK & rhsMask,
const PhysicsModel * physicsModel, const PhysicsModel * physicsModel,
@ -197,7 +197,7 @@ namespace ATC {
return & (it->second).quantity(); return & (it->second).quantity();
} }
else { else {
return NULL; return nullptr;
} }
} }
else { else {
@ -206,7 +206,7 @@ namespace ATC {
return & (it->second).quantity(); return & (it->second).quantity();
} }
else { else {
return NULL; return nullptr;
} }
} }
} }
@ -233,7 +233,7 @@ namespace ATC {
/** access to time integrator */ /** access to time integrator */
const TimeIntegrator * time_integrator(const FieldName & field) const { const TimeIntegrator * time_integrator(const FieldName & field) const {
_ctiIt_ = timeIntegrators_.find(field); _ctiIt_ = timeIntegrators_.find(field);
if (_ctiIt_ == timeIntegrators_.end()) return NULL; if (_ctiIt_ == timeIntegrators_.end()) return nullptr;
return _ctiIt_->second; return _ctiIt_->second;
}; };
@ -322,7 +322,7 @@ namespace ATC {
void compute_flux(const Array2D<bool> & rhs_mask, void compute_flux(const Array2D<bool> & rhs_mask,
const FIELDS &fields, const FIELDS &fields,
GRAD_FIELD_MATS &flux, GRAD_FIELD_MATS &flux,
const PhysicsModel * physicsModel=NULL, const PhysicsModel * physicsModel=nullptr,
const bool normalize = false); const bool normalize = false);
/** evaluate rhs on the atomic domain which is near the FE region */ /** evaluate rhs on the atomic domain which is near the FE region */
void masked_atom_domain_rhs_integral(const Array2D<bool> & rhs_mask, void masked_atom_domain_rhs_integral(const Array2D<bool> & rhs_mask,
@ -334,7 +334,7 @@ namespace ATC {
const FIELDS &fields, const FIELDS &fields,
FIELDS &rhs, FIELDS &rhs,
const IntegrationDomainType domain, const IntegrationDomainType domain,
const PhysicsModel * physicsModel=NULL); const PhysicsModel * physicsModel=nullptr);
/** access to boundary fluxes */ /** access to boundary fluxes */
DENS_MAT &get_boundary_flux(FieldName thisField){return boundaryFlux_[thisField].set_quantity();}; DENS_MAT &get_boundary_flux(FieldName thisField){return boundaryFlux_[thisField].set_quantity();};
DENS_MAN &boundary_flux(FieldName thisField){return boundaryFlux_[thisField];}; DENS_MAN &boundary_flux(FieldName thisField){return boundaryFlux_[thisField];};
@ -352,7 +352,7 @@ namespace ATC {
// mass matrix filtering // mass matrix filtering
void delete_mass_mat_time_filter(FieldName thisField); void delete_mass_mat_time_filter(FieldName thisField);
/** compute mass matrix for requested field */ /** 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 */ /** updates filtering of MD contributions */
void update_mass_matrix(FieldName thisField); void update_mass_matrix(FieldName thisField);
/** compute the mass matrix components coming from MD integration */ /** compute the mass matrix components coming from MD integration */

View File

@ -30,8 +30,8 @@ namespace ATC {
string matParamFile, string matParamFile,
ExtrinsicModelType extrinsicModel) ExtrinsicModelType extrinsicModel)
: ATC_Coupling(groupName,perAtomArray,thisFix), : ATC_Coupling(groupName,perAtomArray,thisFix),
nodalAtomicKineticTemperature_(NULL), nodalAtomicKineticTemperature_(nullptr),
nodalAtomicConfigurationalTemperature_(NULL) nodalAtomicConfigurationalTemperature_(nullptr)
{ {
// Allocate PhysicsModel // Allocate PhysicsModel
create_physics_model(THERMAL, matParamFile); create_physics_model(THERMAL, matParamFile);
@ -103,7 +103,7 @@ namespace ATC {
// always need kinetic energy // always need kinetic energy
AtomicEnergyForTemperature * atomicTwiceKineticEnergy = new TwiceKineticEnergy(this); AtomicEnergyForTemperature * atomicTwiceKineticEnergy = new TwiceKineticEnergy(this);
AtomicEnergyForTemperature * atomEnergyForTemperature = NULL; AtomicEnergyForTemperature * atomEnergyForTemperature = nullptr;
// Appropriate per-atom quantity based on desired temperature definition // Appropriate per-atom quantity based on desired temperature definition
if (temperatureDef_==KINETIC) { if (temperatureDef_==KINETIC) {

View File

@ -32,8 +32,8 @@ namespace ATC {
string matParamFile, string matParamFile,
ExtrinsicModelType extrinsicModel) ExtrinsicModelType extrinsicModel)
: ATC_Coupling(groupName,perAtomArray,thisFix), : ATC_Coupling(groupName,perAtomArray,thisFix),
nodalAtomicKineticTemperature_(NULL), nodalAtomicKineticTemperature_(nullptr),
nodalAtomicConfigurationalTemperature_(NULL), nodalAtomicConfigurationalTemperature_(nullptr),
refPE_(0) refPE_(0)
{ {
// Allocate PhysicsModel // Allocate PhysicsModel
@ -190,7 +190,7 @@ namespace ATC {
FieldManager fieldManager(this); FieldManager fieldManager(this);
PerAtomQuantity<double> * fluctuatingAtomicVelocity = fieldManager.per_atom_quantity("AtomicFluctuatingVelocity"); // also creates ProlongedVelocity PerAtomQuantity<double> * fluctuatingAtomicVelocity = fieldManager.per_atom_quantity("AtomicFluctuatingVelocity"); // also creates ProlongedVelocity
AtomicEnergyForTemperature * atomicTwiceKineticEnergy = new TwiceKineticEnergy(this,fluctuatingAtomicVelocity); AtomicEnergyForTemperature * atomicTwiceKineticEnergy = new TwiceKineticEnergy(this,fluctuatingAtomicVelocity);
AtomicEnergyForTemperature * atomEnergyForTemperature = NULL; AtomicEnergyForTemperature * atomEnergyForTemperature = nullptr;
// Appropriate per-atom quantity based on desired temperature definition // Appropriate per-atom quantity based on desired temperature definition
if (temperatureDef_==KINETIC) { if (temperatureDef_==KINETIC) {

View File

@ -35,37 +35,37 @@ using std::pair;
namespace ATC { namespace ATC {
ATC_Method::ATC_Method(string groupName, double ** & perAtomArray, LAMMPS_NS::Fix * thisFix) : ATC_Method::ATC_Method(string groupName, double ** & perAtomArray, LAMMPS_NS::Fix * thisFix) :
nodalAtomicVolume_(NULL), nodalAtomicVolume_(nullptr),
needReset_(true), needReset_(true),
lammpsInterface_(LammpsInterface::instance()), lammpsInterface_(LammpsInterface::instance()),
interscaleManager_(this), interscaleManager_(this),
timeFilterManager_(this), timeFilterManager_(this),
integrateInternalAtoms_(false), integrateInternalAtoms_(false),
atomTimeIntegrator_(NULL), atomTimeIntegrator_(nullptr),
ghostManager_(this), ghostManager_(this),
feEngine_(NULL), feEngine_(nullptr),
initialized_(false), initialized_(false),
meshDataInitialized_(false), meshDataInitialized_(false),
localStep_(0), localStep_(0),
sizeComm_(8), // 3 positions + 1 material id * 2 for output sizeComm_(8), // 3 positions + 1 material id * 2 for output
atomCoarseGrainingPositions_(NULL), atomCoarseGrainingPositions_(nullptr),
atomGhostCoarseGrainingPositions_(NULL), atomGhostCoarseGrainingPositions_(nullptr),
atomProcGhostCoarseGrainingPositions_(NULL), atomProcGhostCoarseGrainingPositions_(nullptr),
atomReferencePositions_(NULL), atomReferencePositions_(nullptr),
nNodes_(0), nNodes_(0),
nsd_(lammpsInterface_->dimension()), nsd_(lammpsInterface_->dimension()),
xref_(NULL), xref_(nullptr),
readXref_(false), readXref_(false),
needXrefProcessorGhosts_(false), needXrefProcessorGhosts_(false),
trackDisplacement_(false), trackDisplacement_(false),
needsAtomToElementMap_(true), needsAtomToElementMap_(true),
atomElement_(NULL), atomElement_(nullptr),
atomGhostElement_(NULL), atomGhostElement_(nullptr),
internalElementSet_(""), internalElementSet_(""),
atomMasses_(NULL), atomMasses_(nullptr),
atomPositions_(NULL), atomPositions_(nullptr),
atomVelocities_(NULL), atomVelocities_(nullptr),
atomForces_(NULL), atomForces_(nullptr),
parallelConsistency_(true), parallelConsistency_(true),
outputNow_(false), outputNow_(false),
outputTime_(true), outputTime_(true),
@ -79,13 +79,13 @@ namespace ATC {
sizeVector_(0), sizeVector_(0),
scalarVectorFreq_(0), scalarVectorFreq_(0),
sizePerAtomCols_(4), sizePerAtomCols_(4),
perAtomOutput_(NULL), perAtomOutput_(nullptr),
perAtomArray_(perAtomArray), perAtomArray_(perAtomArray),
extScalar_(0), extScalar_(0),
extVector_(0), extVector_(0),
extList_(NULL), extList_(nullptr),
thermoEnergyFlag_(0), thermoEnergyFlag_(0),
atomVolume_(NULL), atomVolume_(nullptr),
atomicWeightsWriteFlag_(false), atomicWeightsWriteFlag_(false),
atomicWeightsWriteFrequency_(0), atomicWeightsWriteFrequency_(0),
atomWeightType_(LATTICE), atomWeightType_(LATTICE),
@ -103,12 +103,12 @@ namespace ATC {
mdMassNormalization_(false), mdMassNormalization_(false),
kernelBased_(false), kernelBased_(false),
kernelOnTheFly_(false), kernelOnTheFly_(false),
kernelFunction_(NULL), kernelFunction_(nullptr),
bondOnTheFly_(false), bondOnTheFly_(false),
accumulant_(NULL), accumulant_(nullptr),
accumulantMol_(NULL), accumulantMol_(nullptr),
accumulantMolGrad_(NULL), accumulantMolGrad_(nullptr),
accumulantWeights_(NULL), accumulantWeights_(nullptr),
accumulantInverseVolumes_(&invNodeVolumes_), accumulantInverseVolumes_(&invNodeVolumes_),
accumulantBandwidth_(0), accumulantBandwidth_(0),
useRestart_(false), useRestart_(false),
@ -117,7 +117,7 @@ namespace ATC {
setRefPEvalue_(false), setRefPEvalue_(false),
refPEvalue_(0.), refPEvalue_(0.),
readRefPE_(false), readRefPE_(false),
nodalRefPotentialEnergy_(NULL), nodalRefPotentialEnergy_(nullptr),
simTime_(0.0), simTime_(0.0),
stepCounter_(0) stepCounter_(0)
{ {
@ -1122,7 +1122,7 @@ pecified
FieldName & thisField, int & thisIndex) FieldName & thisField, int & thisIndex)
{ {
string thisName = args[argIdx++]; string thisName = args[argIdx++];
if (args[argIdx] == NULL) { if (args[argIdx] == nullptr) {
throw ATC_Error("Need to give field '"+thisName+"' more args"); throw ATC_Error("Need to give field '"+thisName+"' more args");
} }
thisField = string_to_field(thisName); thisField = string_to_field(thisName);
@ -1282,7 +1282,7 @@ pecified
if (this->reset_methods()) { if (this->reset_methods()) {
// clear memory manager // clear memory manager
interscaleManager_.clear_temporary_data(); interscaleManager_.clear_temporary_data();
atomVolume_ = NULL; atomVolume_ = nullptr;
// reference positions and energy // reference positions and energy
if (!initialized_) { if (!initialized_) {
@ -1517,7 +1517,7 @@ pecified
} }
else { else {
// set variables to compute atomic weights // set variables to compute atomic weights
DENS_MAN * nodalVolume(NULL); DENS_MAN * nodalVolume(nullptr);
switch (atomWeightType_) { switch (atomWeightType_) {
case USER: case USER:
atomVolume_ = new AtomVolumeUser(this,Valpha_); atomVolume_ = new AtomVolumeUser(this,Valpha_);

View File

@ -423,7 +423,7 @@ namespace ATC {
bool use_md_mass_normalization() const { return mdMassNormalization_;} bool use_md_mass_normalization() const { return mdMassNormalization_;}
bool kernel_based() { return kernelBased_; } bool kernel_based() { return kernelBased_; }
bool kernel_on_the_fly() const { return kernelOnTheFly_;} 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_; } KernelFunction * kernel_function() { return kernelFunction_; }
std::vector<int> & type_list() { return typeList_; } std::vector<int> & type_list() { return typeList_; }
std::vector<int> & group_list() { return groupList_; } std::vector<int> & group_list() { return groupList_; }

View File

@ -68,19 +68,19 @@ namespace ATC {
LAMMPS_NS::Fix * thisFix, LAMMPS_NS::Fix * thisFix,
string matParamFile) string matParamFile)
: ATC_Method(groupName,perAtomArray,thisFix), : ATC_Method(groupName,perAtomArray,thisFix),
xPointer_(NULL), xPointer_(nullptr),
outputStepZero_(true), outputStepZero_(true),
neighborReset_(false), neighborReset_(false),
pairMap_(NULL), pairMap_(nullptr),
bondMatrix_(NULL), bondMatrix_(nullptr),
pairVirial_(NULL), pairVirial_(nullptr),
pairHeatFlux_(NULL), pairHeatFlux_(nullptr),
nComputes_(0), nComputes_(0),
hasPairs_(true), hasPairs_(true),
hasBonds_(false), hasBonds_(false),
resetKernelFunction_(false), resetKernelFunction_(false),
dxaExactMode_(true), dxaExactMode_(true),
cauchyBornStress_(NULL) cauchyBornStress_(nullptr)
{ {
nTypes_ = lammpsInterface_->ntypes(); nTypes_ = lammpsInterface_->ntypes();
@ -114,7 +114,7 @@ namespace ATC {
rateFlags_ = false; rateFlags_ = false;
outputFields_.resize(NUM_TOTAL_FIELDS); 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 // Hardy requires ref positions for processor ghosts for bond list
@ -491,7 +491,7 @@ namespace ATC {
ComputedAtomQuantity * c = new ComputedAtomQuantity(this, tag); ComputedAtomQuantity * c = new ComputedAtomQuantity(this, tag);
interscaleManager_.add_per_atom_quantity(c,tag); interscaleManager_.add_per_atom_quantity(c,tag);
int projection = iter->second; int projection = iter->second;
DIAG_MAN * w = NULL; DIAG_MAN * w = nullptr;
if (projection == VOLUME_NORMALIZATION ) if (projection == VOLUME_NORMALIZATION )
{ w = accumulantInverseVolumes_; } { w = accumulantInverseVolumes_; }
else if (projection == NUMBER_NORMALIZATION ) else if (projection == NUMBER_NORMALIZATION )
@ -976,7 +976,7 @@ namespace ATC {
DENS_MAT & H = hardyData_["displacement_gradient"].set_quantity(); DENS_MAT & H = hardyData_["displacement_gradient"].set_quantity();
DENS_MAT E(H.nRows(),1); DENS_MAT E(H.nRows(),1);
ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature"); 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"]; //DENS_MAT & T = hardyData_["temperature"];
//cauchy_born_entropic_energy(H,E,T); E += hardyData_["internal_energy"]; //cauchy_born_entropic_energy(H,E,T); E += hardyData_["internal_energy"];
cauchy_born_energy(H, E, temp); cauchy_born_energy(H, E, temp);
@ -988,14 +988,14 @@ namespace ATC {
// compute: cauchy born stress // compute: cauchy born stress
if (fieldFlags_(CAUCHY_BORN_STRESS)) { if (fieldFlags_(CAUCHY_BORN_STRESS)) {
ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature"); 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(), cauchy_born_stress(hardyData_["displacement_gradient"].quantity(),
hardyData_["cauchy_born_stress"].set_quantity(), temp); hardyData_["cauchy_born_stress"].set_quantity(), temp);
} }
// compute: cauchy born energy // compute: cauchy born energy
if (fieldFlags_(CAUCHY_BORN_ENERGY)) { if (fieldFlags_(CAUCHY_BORN_ENERGY)) {
ATOMIC_DATA::const_iterator tfield = hardyData_.find("temperature"); 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(), cauchy_born_energy(hardyData_["displacement_gradient"].quantity(),
hardyData_["cauchy_born_energy"].set_quantity(), temp); hardyData_["cauchy_born_energy"].set_quantity(), temp);
} }

View File

@ -78,7 +78,7 @@ protected:
template<typename T> template<typename T>
Array<T>::Array(void) { Array<T>::Array(void) {
len_ = 0; len_ = 0;
data_ = NULL; data_ = nullptr;
} }
template<typename T> template<typename T>
@ -90,8 +90,8 @@ Array<T>::Array(int len) {
template<typename T> template<typename T>
Array<T>::Array(const Array<T>& A) { Array<T>::Array(const Array<T>& A) {
len_ = A.len_; len_ = A.len_;
if (A.data_==NULL) if (A.data_==nullptr)
data_ = NULL; data_ = nullptr;
else { else {
data_ = new T[len_]; data_ = new T[len_];
for(int i=0;i<len_;i++) for(int i=0;i<len_;i++)
@ -101,7 +101,7 @@ Array<T>::Array(const Array<T>& A) {
template<typename T> template<typename T>
Array<T>::~Array() { Array<T>::~Array() {
if (data_ != NULL) delete[] data_; if (data_ != nullptr) delete[] data_;
} }
template<typename T> template<typename T>
@ -111,12 +111,12 @@ void Array<T>::reset(int len) {
} }
else { // size change, realloc memory else { // size change, realloc memory
len_ = len; len_ = len;
if (data_ != NULL) if (data_ != nullptr)
delete[] data_; delete[] data_;
if (len_ > 0) if (len_ > 0)
data_ = new T[len_]; data_ = new T[len_];
else { else {
data_ = NULL; data_ = nullptr;
len_ = 0; len_ = 0;
} }
} }
@ -130,7 +130,7 @@ void Array<T>::resize(int len, bool copy) {
else { // size change, realloc memory else { // size change, realloc memory
len_ = len; len_ = len;
if (len_ > 0) { if (len_ > 0) {
if (copy && data_ != NULL) { if (copy && data_ != nullptr) {
Array<T> temp(*this); Array<T> temp(*this);
delete[] data_; delete[] data_;
data_ = new T[len_]; data_ = new T[len_];
@ -140,12 +140,12 @@ void Array<T>::resize(int len, bool copy) {
} }
} }
else { else {
if (data_ != NULL) delete[] data_; if (data_ != nullptr) delete[] data_;
data_ = new T[len_]; data_ = new T[len_];
} }
} }
else { else {
data_ = NULL; data_ = nullptr;
len_ = 0; len_ = 0;
} }
} }
@ -158,10 +158,10 @@ T& Array<T>::operator() (int i) {
template<typename T> template<typename T>
Array<T>& Array<T>::operator= (const Array<T> &other) { Array<T>& Array<T>::operator= (const Array<T> &other) {
if (data_ == NULL) { // initialize my internal storage to match LHS if (data_ == nullptr) { // initialize my internal storage to match LHS
len_ = other.len_; len_ = other.len_;
if (other.data_==NULL) if (other.data_==nullptr)
data_ = NULL; data_ = nullptr;
else else
data_ = new T[len_]; data_ = new T[len_];
} }
@ -250,7 +250,7 @@ T* Array<T>::ptr() const {
template<typename T> template<typename T>
void Array<T>::print(std::string name) const { void Array<T>::print(std::string name) const {
std::cout << "------- Begin "<<name<<" -----------------\n"; std::cout << "------- Begin "<<name<<" -----------------\n";
if (data_ != NULL) { if (data_ != nullptr) {
for(int i=0;i<len_;i++) std::cout << data_[i] << " "; for(int i=0;i<len_;i++) std::cout << data_[i] << " ";
std::cout << "\n"; std::cout << "\n";
} }
@ -283,7 +283,7 @@ AliasArray<T>::AliasArray(const Array<T>& A) {
template<typename T> template<typename T>
AliasArray<T>::~AliasArray(void) { AliasArray<T>::~AliasArray(void) {
len_ = 0; len_ = 0;
data_ = NULL; // trick base class into not deleting parent data data_ = nullptr; // trick base class into not deleting parent data
} }
template<typename T> template<typename T>

View File

@ -57,7 +57,7 @@ template<typename T>
Array2D<T>::Array2D() { Array2D<T>::Array2D() {
nrows_ = 0; nrows_ = 0;
ncols_ = 0; ncols_ = 0;
data_ = NULL; data_ = nullptr;
} }
template<typename T> template<typename T>
@ -71,8 +71,8 @@ template<typename T>
Array2D<T>::Array2D(const Array2D<T>& A) { Array2D<T>::Array2D(const Array2D<T>& A) {
nrows_ = A.nrows_; nrows_ = A.nrows_;
ncols_ = A.ncols_; ncols_ = A.ncols_;
if (A.data_==NULL) if (A.data_==nullptr)
data_ = NULL; data_ = nullptr;
else { else {
data_ = new T[nrows_ * ncols_]; data_ = new T[nrows_ * ncols_];
for(int i=0;i<nrows_*ncols_;i++) for(int i=0;i<nrows_*ncols_;i++)
@ -88,12 +88,12 @@ void Array2D<T>::reset(int nrows, int ncols) {
else { // size changed; realloc memory else { // size changed; realloc memory
nrows_ = nrows; nrows_ = nrows;
ncols_ = ncols; ncols_ = ncols;
if (data_ != NULL) if (data_ != nullptr)
delete [] data_; delete [] data_;
if (ncols_ > 0 && nrows_ > 0) if (ncols_ > 0 && nrows_ > 0)
data_ = new T[nrows_ * ncols_]; data_ = new T[nrows_ * ncols_];
else { else {
data_ = NULL; data_ = nullptr;
nrows_ = 0; nrows_ = 0;
ncols_ = 0; ncols_ = 0;
} }
@ -120,11 +120,11 @@ AliasArray<T> Array2D<T>::column(int col) const {
template<typename T> template<typename T>
Array2D<T>& Array2D<T>::operator= (const Array2D<T>& other) { Array2D<T>& Array2D<T>::operator= (const Array2D<T>& other) {
if (data_ == NULL) { // initialize my internal storage to match LHS if (data_ == nullptr) { // initialize my internal storage to match LHS
nrows_ = other.nrows_; nrows_ = other.nrows_;
ncols_ = other.ncols_; ncols_ = other.ncols_;
if (other.data_==NULL) if (other.data_==nullptr)
data_ = NULL; data_ = nullptr;
else else
data_ = new T[nrows_ * ncols_]; data_ = new T[nrows_ * ncols_];
} }
@ -170,14 +170,14 @@ void Array2D<T>::write_restart(FILE *f) const {
template<typename T> template<typename T>
Array2D<T>::~Array2D() { Array2D<T>::~Array2D() {
if (data_ != NULL) if (data_ != nullptr)
delete[] data_; delete[] data_;
} }
template<typename T> template<typename T>
void Array2D<T>::print(std::string name) const { void Array2D<T>::print(std::string name) const {
std::cout << "------- Begin "<<name<<" -----------------\n"; std::cout << "------- Begin "<<name<<" -----------------\n";
if (data_ != NULL) { if (data_ != nullptr) {
for(int col=0;col<ncols_;col++) { for(int col=0;col<ncols_;col++) {
for(int row=0;row<nrows_;row++) { for(int row=0;row<nrows_;row++) {
std::cout << data_[col*nrows_ + row] << " "; std::cout << data_[col*nrows_ + row] << " ";

View File

@ -47,8 +47,8 @@ namespace ATC {
nLocal_(0), nLocal_(0),
useLocalizedLambda_(false), useLocalizedLambda_(false),
useLumpedLambda_(false), useLumpedLambda_(false),
timeFilter_(NULL), timeFilter_(nullptr),
regulatorMethod_(NULL), regulatorMethod_(nullptr),
boundaryIntegrationType_(NO_QUADRATURE), boundaryIntegrationType_(NO_QUADRATURE),
regulatorPrefix_(regulatorPrefix) regulatorPrefix_(regulatorPrefix)
{ {
@ -97,7 +97,7 @@ namespace ATC {
//-------------------------------------------------------- //--------------------------------------------------------
DENS_MAN * AtomicRegulator::regulator_data(const string tag, int nCols) DENS_MAN * AtomicRegulator::regulator_data(const string tag, int nCols)
{ {
DENS_MAN * data(NULL); DENS_MAN * data(nullptr);
map<string, pair<bool,DENS_MAN * > >::iterator it = regulatorData_.find(tag); map<string, pair<bool,DENS_MAN * > >::iterator it = regulatorData_.find(tag);
if (it == regulatorData_.end()) { if (it == regulatorData_.end()) {
data = new DENS_MAN(nNodes_,nCols); data = new DENS_MAN(nNodes_,nCols);
@ -115,14 +115,14 @@ namespace ATC {
//-------------------------------------------------------- //--------------------------------------------------------
// get_regulator_data: // 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 // if doesn't exist
//-------------------------------------------------------- //--------------------------------------------------------
const DENS_MAN * AtomicRegulator::regulator_data(const string tag) const const DENS_MAN * AtomicRegulator::regulator_data(const string tag) const
{ {
map<string, pair<bool,DENS_MAN * > >::const_iterator it = regulatorData_.find(tag); map<string, pair<bool,DENS_MAN * > >::const_iterator it = regulatorData_.find(tag);
if (it == regulatorData_.end()) { if (it == regulatorData_.end()) {
return NULL; return nullptr;
} }
else { else {
return const_cast<DENS_MAN * >((it->second).second); return const_cast<DENS_MAN * >((it->second).second);
@ -521,7 +521,7 @@ namespace ATC {
fieldMask_(NUM_FIELDS,NUM_FLUX), fieldMask_(NUM_FIELDS,NUM_FLUX),
nNodes_(atomicRegulator_->num_nodes()), nNodes_(atomicRegulator_->num_nodes()),
regulatorPrefix_(atomicRegulator->regulator_prefix()+regulatorPrefix), regulatorPrefix_(atomicRegulator->regulator_prefix()+regulatorPrefix),
shpFcnDerivs_(NULL) shpFcnDerivs_(nullptr)
{ {
fieldMask_ = false; fieldMask_ = false;
} }
@ -552,21 +552,21 @@ namespace ATC {
RegulatorShapeFunction::RegulatorShapeFunction(AtomicRegulator * atomicRegulator, RegulatorShapeFunction::RegulatorShapeFunction(AtomicRegulator * atomicRegulator,
const string & regulatorPrefix) : const string & regulatorPrefix) :
RegulatorMethod(atomicRegulator,regulatorPrefix), RegulatorMethod(atomicRegulator,regulatorPrefix),
lambda_(NULL), lambda_(nullptr),
atomLambdas_(NULL), atomLambdas_(nullptr),
shapeFunctionMatrix_(NULL), shapeFunctionMatrix_(nullptr),
linearSolverType_(AtomicRegulator::NO_SOLVE), linearSolverType_(AtomicRegulator::NO_SOLVE),
maxIterations_(atomicRegulator->max_iterations()), maxIterations_(atomicRegulator->max_iterations()),
tolerance_(atomicRegulator->tolerance()), tolerance_(atomicRegulator->tolerance()),
matrixSolver_(NULL), matrixSolver_(nullptr),
regulatedNodes_(NULL), regulatedNodes_(nullptr),
applicationNodes_(NULL), applicationNodes_(nullptr),
boundaryNodes_(NULL), boundaryNodes_(nullptr),
shpFcn_(NULL), shpFcn_(nullptr),
atomicWeights_(NULL), atomicWeights_(nullptr),
elementMask_(NULL), elementMask_(nullptr),
lambdaAtomMap_(NULL), lambdaAtomMap_(nullptr),
weights_(NULL), weights_(nullptr),
nsd_(atomicRegulator_->nsd()), nsd_(atomicRegulator_->nsd()),
nLocal_(atomicRegulator_->nlocal()) nLocal_(atomicRegulator_->nlocal())
{ {

View File

@ -143,7 +143,7 @@ namespace ATC {
/** can externally set regulator dynamic contributions */ /** 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 */, const FieldName /* field */) {};
virtual void reset_lambda_contribution(const DENS_MAT & target) { reset_lambda_contribution(target,NUM_TOTAL_FIELDS); } 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; const DENS_MAN * regulator_data(const std::string tag) const;
/** return the maximum number of iterations */ /** return the maximum number of iterations */
int max_iterations() {return maxIterations_;}; int max_iterations() {return maxIterations_;};

View File

@ -426,7 +426,7 @@ namespace ATC {
for (INDEX j=i; j<3; j++) for (INDEX j=i; j<3; j++)
s(i,j) += factor * dd(i,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); if (F_w) *F_w += 0.5*kb*T*log(detD);
} }
//============================================================================ //============================================================================

View File

@ -164,7 +164,7 @@ namespace ATC {
chargeRegulator_(chargeRegulator), chargeRegulator_(chargeRegulator),
lammpsInterface_(LammpsInterface::instance()), lammpsInterface_(LammpsInterface::instance()),
rC_(0), rCsq_(0), rC_(0), rCsq_(0),
targetValue_(NULL), targetValue_(nullptr),
targetPhi_(p.value), targetPhi_(p.value),
surface_(p.faceset), surface_(p.faceset),
atomGroupBit_(p.groupBit), atomGroupBit_(p.groupBit),

View File

@ -52,7 +52,7 @@ private:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template<typename T> template<typename T>
CloneVector<T>::CloneVector(const Vector<T> &c) CloneVector<T>::CloneVector(const Vector<T> &c)
: Vector<T>(), _baseV(const_cast<Vector<T>*>(&c)), _baseM(NULL) : Vector<T>(), _baseV(const_cast<Vector<T>*>(&c)), _baseM(nullptr)
{} {}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Construct from a matrix, the const_cast isn't pretty // Construct from a matrix, the const_cast isn't pretty
@ -65,7 +65,7 @@ CloneVector<T>::CloneVector(const Vector<T> &c)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template<typename T> template<typename T>
CloneVector<T>::CloneVector(const Matrix<T> &c, int dim, INDEX idx) CloneVector<T>::CloneVector(const Matrix<T> &c, int dim, INDEX idx)
: Vector<T>(), _baseV(NULL), _baseM(const_cast<Matrix<T>*>(&c)) : Vector<T>(), _baseV(nullptr), _baseM(const_cast<Matrix<T>*>(&c))
, _clone_type(dim), _idx(idx) , _clone_type(dim), _idx(idx)
{} {}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -73,7 +73,7 @@ CloneVector<T>::CloneVector(const Matrix<T> &c, int dim, INDEX idx)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template<typename T> template<typename T>
CloneVector<T>::CloneVector(const DiagonalMatrix<T> &c, INDEX /* idx */) CloneVector<T>::CloneVector(const DiagonalMatrix<T> &c, INDEX /* idx */)
: Vector<T>(), _baseV(NULL), _baseM(const_cast<DiagonalMatrix<T>*>(&c)) : Vector<T>(), _baseV(nullptr), _baseM(const_cast<DiagonalMatrix<T>*>(&c))
, _clone_type(CLONE_DIAG), _idx(0) , _clone_type(CLONE_DIAG), _idx(0)
{} {}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -186,14 +186,14 @@ const double kMinScale_ = 10000.;
ConcentrationRegulator::ConcentrationRegulatorParameters & p) ConcentrationRegulator::ConcentrationRegulatorParameters & p)
: ConcentrationRegulatorMethod(concReg), : ConcentrationRegulatorMethod(concReg),
concentrationRegulator_(concReg), concentrationRegulator_(concReg),
interscaleManager_(NULL), interscaleManager_(nullptr),
lammpsInterface_(LammpsInterface::instance()), lammpsInterface_(LammpsInterface::instance()),
list_(NULL), list_(nullptr),
targetConcentration_(p.value), targetConcentration_(p.value),
targetCount_(0), targetCount_(0),
elemset_(p.elemset), elemset_(p.elemset),
p_(NULL), p_(nullptr),
randomNumberGenerator_(NULL), randomNumberGenerator_(nullptr),
q0_(0), q0_(0),
controlType_(p.type), controlType_(p.type),
controlIndex_(0), controlIndex_(0),

View File

@ -16,10 +16,10 @@ template <typename T>
class DenseMatrix : public Matrix<T> class DenseMatrix : public Matrix<T>
{ {
public: public:
DenseMatrix(INDEX rows=0, INDEX cols=0, bool z=1): _data(NULL){ _create(rows, cols, z); } DenseMatrix(INDEX rows=0, INDEX cols=0, bool z=1): _data(nullptr){ _create(rows, cols, z); }
DenseMatrix(const DenseMatrix<T>& c) : Matrix<T>(), _data(NULL){ _copy(c); } DenseMatrix(const DenseMatrix<T>& c) : Matrix<T>(), _data(nullptr){ _copy(c); }
DenseMatrix(const SparseMatrix<T>& c): Matrix<T>(), _data(NULL){ c.dense_copy(*this);} DenseMatrix(const SparseMatrix<T>& c): Matrix<T>(), _data(nullptr){ c.dense_copy(*this);}
DenseMatrix(const Matrix<T>& c) : Matrix<T>(), _data(NULL){ _copy(c); } DenseMatrix(const Matrix<T>& c) : Matrix<T>(), _data(nullptr){ _copy(c); }
// const SparseMatrix<T> * p = sparse_cast(&c); // const SparseMatrix<T> * p = sparse_cast(&c);
// (p) ? p->dense_copy(*this) : _copy(c); } // (p) ? p->dense_copy(*this) : _copy(c); }
~DenseMatrix() { _delete();} ~DenseMatrix() { _delete();}
@ -261,7 +261,7 @@ void DenseMatrix<T>::_delete()
_nRows = _nCols = 0; _nRows = _nCols = 0;
if (_data){ if (_data){
delete [] _data; delete [] _data;
_data = NULL; _data = nullptr;
} }
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -273,7 +273,7 @@ void DenseMatrix<T>::_create(INDEX rows, INDEX cols, bool zero)
_nRows=rows; _nRows=rows;
_nCols=cols; _nCols=cols;
_data = (this->size() ? new T [_nCols*_nRows] : NULL); _data = (this->size() ? new T [_nCols*_nRows] : nullptr);
if (zero) this->zero(); if (zero) this->zero();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -16,9 +16,9 @@ class DenseVector : public Vector<T>
{ {
public: public:
explicit DenseVector(INDEX n=0, bool z=1) { _create(n,z); } explicit DenseVector(INDEX n=0, bool z=1) { _create(n,z); }
DenseVector(const DenseVector<T> &c) : Vector<T>(), _data(NULL) { _copy(c); } DenseVector(const DenseVector<T> &c) : Vector<T>(), _data(nullptr) { _copy(c); }
DenseVector(const Vector<T> &c) : Vector<T>(), _data(NULL) { _copy(c); } DenseVector(const Vector<T> &c) : Vector<T>(), _data(nullptr) { _copy(c); }
DenseVector(const T * ptr, INDEX nrows) : Vector<T>(), _data(NULL) { copy(ptr,nrows); } DenseVector(const T * ptr, INDEX nrows) : Vector<T>(), _data(nullptr) { copy(ptr,nrows); }
virtual ~DenseVector() { _delete(); } virtual ~DenseVector() { _delete(); }
//* resizes the Vector, ignores nCols, optionally copys what fits //* resizes the Vector, ignores nCols, optionally copys what fits
@ -123,7 +123,7 @@ template <typename T>
inline void DenseVector<T>::_create(INDEX n, bool zero) inline void DenseVector<T>::_create(INDEX n, bool zero)
{ {
_size=n; _size=n;
_data = _size ? new T [_size] : NULL ; _data = _size ? new T [_size] : nullptr ;
if (zero) this->zero(); if (zero) this->zero();
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -205,7 +205,7 @@ DiagonalMatrix<T> operator-(const DiagonalMatrix<T> &A, const DiagonalMatrix<T>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template<typename T> template<typename T>
DiagonalMatrix<T>::DiagonalMatrix(INDEX rows, bool zero) DiagonalMatrix<T>::DiagonalMatrix(INDEX rows, bool zero)
: _data(NULL) : _data(nullptr)
{ {
reset(rows, zero); reset(rows, zero);
} }
@ -214,7 +214,7 @@ DiagonalMatrix<T>::DiagonalMatrix(INDEX rows, bool zero)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template<typename T> template<typename T>
DiagonalMatrix<T>::DiagonalMatrix(const DiagonalMatrix<T>& c) DiagonalMatrix<T>::DiagonalMatrix(const DiagonalMatrix<T>& c)
: Matrix<T>(), _data(NULL) : Matrix<T>(), _data(nullptr)
{ {
reset(c); reset(c);
} }
@ -223,7 +223,7 @@ DiagonalMatrix<T>::DiagonalMatrix(const DiagonalMatrix<T>& c)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template<typename T> template<typename T>
DiagonalMatrix<T>::DiagonalMatrix(const Vector<T>& v) DiagonalMatrix<T>::DiagonalMatrix(const Vector<T>& v)
: Matrix<T>(), _data(NULL) : Matrix<T>(), _data(nullptr)
{ {
reset(v); reset(v);
} }

View File

@ -197,7 +197,7 @@ protected:
a.pos.Y = atom->x[i][1]; a.pos.Y = atom->x[i][1];
a.pos.Z = atom->x[i][2]; a.pos.Z = atom->x[i][2];
a.flags = 0; a.flags = 0;
a.cluster = NULL; a.cluster = nullptr;
a.numNeighbors = 0; a.numNeighbors = 0;
a.setFlag(ATOM_IS_LOCAL_ATOM); a.setFlag(ATOM_IS_LOCAL_ATOM);
} }
@ -290,7 +290,7 @@ protected:
currentAtom->pos.Y = atom->x[i][1]; currentAtom->pos.Y = atom->x[i][1];
currentAtom->pos.Z = atom->x[i][2]; currentAtom->pos.Z = atom->x[i][2];
currentAtom->flags = 0; currentAtom->flags = 0;
currentAtom->cluster = NULL; currentAtom->cluster = nullptr;
currentAtom->numNeighbors = 0; currentAtom->numNeighbors = 0;
currentAtom->setFlag(ATOM_IS_LOCAL_ATOM); currentAtom->setFlag(ATOM_IS_LOCAL_ATOM);
} }
@ -302,7 +302,7 @@ protected:
// Receive atoms from other processors. // Receive atoms from other processors.
for(int iproc = 1; iproc < comm->nprocs; iproc++) { for(int iproc = 1; iproc < comm->nprocs; iproc++) {
MPI_Status status; 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; int ndoubles;
MPI_Get_count(&status, MPI_DOUBLE, &ndoubles); MPI_Get_count(&status, MPI_DOUBLE, &ndoubles);
int nReceived = ndoubles / 3; int nReceived = ndoubles / 3;
@ -314,7 +314,7 @@ protected:
currentAtom->pos.Y = *data++; currentAtom->pos.Y = *data++;
currentAtom->pos.Z = *data++; currentAtom->pos.Z = *data++;
currentAtom->flags = 0; currentAtom->flags = 0;
currentAtom->cluster = NULL; currentAtom->cluster = nullptr;
currentAtom->numNeighbors = 0; currentAtom->numNeighbors = 0;
currentAtom->setFlag(ATOM_IS_LOCAL_ATOM); currentAtom->setFlag(ATOM_IS_LOCAL_ATOM);
} }
@ -332,11 +332,11 @@ protected:
*data++ = atom->x[i][2]; *data++ = atom->x[i][2];
} }
// Send local atom coordinates to master proc. // 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. // Make sure all input atoms are wrapped at periodic boundary conditions.
wrapInputAtoms(NULL_VECTOR); wrapInputAtoms(nullptr_VECTOR);
// Build nearest neighbor lists. // Build nearest neighbor lists.
buildNearestNeighborLists(); buildNearestNeighborLists();
@ -376,7 +376,7 @@ protected:
} }
} }
// Broadcast segments. // 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) { if(processor != 0) {
// Extract segments from receive buffer. // Extract segments from receive buffer.
@ -402,7 +402,7 @@ protected:
DISLOCATIONS_ASSERT(sendItem == pointBuffer.end()); DISLOCATIONS_ASSERT(sendItem == pointBuffer.end());
} }
// Broadcast segments. // 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) { if(processor != 0) {
// Extract points from receive buffer. // Extract points from receive buffer.

View File

@ -184,8 +184,8 @@ namespace ATC {
displacement_(atc_->field(DISPLACEMENT)), displacement_(atc_->field(DISPLACEMENT)),
nodalAtomicDisplacementOut_(atc_->nodal_atomic_field(DISPLACEMENT)), nodalAtomicDisplacementOut_(atc_->nodal_atomic_field(DISPLACEMENT)),
nodalAtomicForceFiltered_(momentumTimeIntegrator->nodal_atomic_force_filtered()), nodalAtomicForceFiltered_(momentumTimeIntegrator->nodal_atomic_force_filtered()),
nodalAtomicDisplacement_(NULL), nodalAtomicDisplacement_(nullptr),
nodalAtomicForce_(NULL) nodalAtomicForce_(nullptr)
{ {
// do nothing // do nothing
} }
@ -410,9 +410,9 @@ namespace ATC {
displacement_(atc_->field(DISPLACEMENT)), displacement_(atc_->field(DISPLACEMENT)),
nodalAtomicDisplacementOut_(atc_->nodal_atomic_field(DISPLACEMENT)), nodalAtomicDisplacementOut_(atc_->nodal_atomic_field(DISPLACEMENT)),
nodalAtomicForceFiltered_(momentumTimeIntegrator->nodal_atomic_force_filtered()), nodalAtomicForceFiltered_(momentumTimeIntegrator->nodal_atomic_force_filtered()),
nodalAtomicMomentum_(NULL), nodalAtomicMomentum_(nullptr),
nodalAtomicMomentumFiltered_(momentumTimeIntegrator->nodal_atomic_momentum_filtered()), nodalAtomicMomentumFiltered_(momentumTimeIntegrator->nodal_atomic_momentum_filtered()),
nodalAtomicDisplacement_(NULL), nodalAtomicDisplacement_(nullptr),
nodalAtomicMomentumOld_(atc_->num_nodes(),atc_->nsd()), nodalAtomicMomentumOld_(atc_->num_nodes(),atc_->nsd()),
nodalAtomicVelocityOld_(atc_->num_nodes(),atc_->nsd()) nodalAtomicVelocityOld_(atc_->num_nodes(),atc_->nsd())
{ {
@ -633,7 +633,7 @@ namespace ATC {
FluidsTimeIntegratorGear::FluidsTimeIntegratorGear(MomentumTimeIntegrator * momentumTimeIntegrator) : FluidsTimeIntegratorGear::FluidsTimeIntegratorGear(MomentumTimeIntegrator * momentumTimeIntegrator) :
MomentumIntegrationMethod(momentumTimeIntegrator), MomentumIntegrationMethod(momentumTimeIntegrator),
nodalAtomicForceFiltered_(momentumTimeIntegrator->nodal_atomic_force_filtered()), nodalAtomicForceFiltered_(momentumTimeIntegrator->nodal_atomic_force_filtered()),
nodalAtomicMomentum_(NULL), nodalAtomicMomentum_(nullptr),
nodalAtomicMomentumFiltered_(momentumTimeIntegrator->nodal_atomic_momentum_filtered()), nodalAtomicMomentumFiltered_(momentumTimeIntegrator->nodal_atomic_momentum_filtered()),
atomicVelocityDelta_(atc_->num_nodes(),atc_->nsd()), atomicVelocityDelta_(atc_->num_nodes(),atc_->nsd()),
nodalAtomicMomentumOld_(atc_->num_nodes(),atc_->nsd()), nodalAtomicMomentumOld_(atc_->num_nodes(),atc_->nsd()),

View File

@ -17,7 +17,7 @@ namespace ATC {
class ElectronHeatFlux class ElectronHeatFlux
{ {
public: public:
ElectronHeatFlux(/*const*/ ElectronHeatCapacity * electronHeatCapacity = NULL); ElectronHeatFlux(/*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr);
virtual ~ElectronHeatFlux() {}; virtual ~ElectronHeatFlux() {};
/** computes heat flux */ /** computes heat flux */
virtual void electron_heat_flux(const FIELD_MATS &fields, virtual void electron_heat_flux(const FIELD_MATS &fields,
@ -68,7 +68,7 @@ namespace ATC {
{ {
public: public:
ElectronHeatFluxLinear(std::fstream &matfile,std::map<std::string,double> & parameters, ElectronHeatFluxLinear(std::fstream &matfile,std::map<std::string,double> & parameters,
/*const*/ ElectronHeatCapacity * electronHeatCapacity = NULL); /*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr);
virtual ~ElectronHeatFluxLinear() {}; virtual ~ElectronHeatFluxLinear() {};
virtual void electron_heat_flux(const FIELD_MATS & /* fields */, virtual void electron_heat_flux(const FIELD_MATS & /* fields */,
const GRAD_FIELD_MATS &gradFields, const GRAD_FIELD_MATS &gradFields,
@ -95,7 +95,7 @@ namespace ATC {
{ {
public: public:
ElectronHeatFluxPowerLaw(std::fstream &matfile,std::map<std::string,double> &parameters, ElectronHeatFluxPowerLaw(std::fstream &matfile,std::map<std::string,double> &parameters,
/*const*/ ElectronHeatCapacity * electronHeatCapacity = NULL); /*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr);
virtual ~ElectronHeatFluxPowerLaw() {}; virtual ~ElectronHeatFluxPowerLaw() {};
virtual void electron_heat_flux(const FIELD_MATS &fields, virtual void electron_heat_flux(const FIELD_MATS &fields,
const GRAD_FIELD_MATS &gradFields, const GRAD_FIELD_MATS &gradFields,
@ -134,8 +134,8 @@ ctivity proportional to the ratio of the electron and phonon temperatures with t
public: public:
ElectronHeatFluxThermopower(std::fstream &matfile, ElectronHeatFluxThermopower(std::fstream &matfile,
std::map<std::string,double> & parameters, std::map<std::string,double> & parameters,
/*const*/ ElectronFlux * electronFlux = NULL, /*const*/ ElectronFlux * electronFlux = nullptr,
/*const*/ ElectronHeatCapacity * electronHeatCapacity = NULL); /*const*/ ElectronHeatCapacity * electronHeatCapacity = nullptr);
virtual ~ElectronHeatFluxThermopower() {}; virtual ~ElectronHeatFluxThermopower() {};
virtual void electron_heat_flux(const FIELD_MATS &fields, virtual void electron_heat_flux(const FIELD_MATS &fields,
const GRAD_FIELD_MATS &gradFields, const GRAD_FIELD_MATS &gradFields,

View File

@ -114,7 +114,7 @@ namespace ATC {
ATC::LammpsInterface::instance()->print_msg_once(ss.str()); ATC::LammpsInterface::instance()->print_msg_once(ss.str());
myModel = new ExtrinsicModelElectrostatic myModel = new ExtrinsicModelElectrostatic
(this,modelType,matFileName); (this,modelType,matFileName);
} else myModel = NULL; } else myModel = nullptr;
extrinsicModels_.push_back(myModel); extrinsicModels_.push_back(myModel);
// add new fields to fields data // add new fields to fields data
@ -157,7 +157,7 @@ namespace ATC {
for(imodel=extrinsicModels_.begin(); imodel!=extrinsicModels_.end(); imodel++) { for(imodel=extrinsicModels_.begin(); imodel!=extrinsicModels_.end(); imodel++) {
if ((*imodel)->model_type()==type) return *imodel; if ((*imodel)->model_type()==type) return *imodel;
} }
return NULL; return nullptr;
} }
@ -343,7 +343,7 @@ namespace ATC {
atc_(modelManager->atc()), atc_(modelManager->atc()),
modelManager_(modelManager), modelManager_(modelManager),
modelType_(modelType), modelType_(modelType),
physicsModel_(NULL) physicsModel_(nullptr)
{ {
rhsMaskIntrinsic_.reset(NUM_FIELDS,NUM_FLUX); rhsMaskIntrinsic_.reset(NUM_FIELDS,NUM_FLUX);
rhsMaskIntrinsic_ = false; rhsMaskIntrinsic_ = false;

View File

@ -38,17 +38,17 @@ namespace ATC {
ExtrinsicModelType modelType, ExtrinsicModelType modelType,
string matFileName) : string matFileName) :
ExtrinsicModelTwoTemperature(modelManager,modelType,matFileName), ExtrinsicModelTwoTemperature(modelManager,modelType,matFileName),
continuityIntegrator_(NULL), continuityIntegrator_(nullptr),
poissonSolverType_(DIRECT), // ITERATIVE | DIRECT poissonSolverType_(DIRECT), // ITERATIVE | DIRECT
poissonSolver_(NULL), poissonSolver_(nullptr),
baseSize_(0), baseSize_(0),
electronDensityEqn_(ELECTRON_CONTINUITY), electronDensityEqn_(ELECTRON_CONTINUITY),
fluxUpdateFreq_(1), fluxUpdateFreq_(1),
schrodingerSolverType_(DIRECT), // ITERATIVE | DIRECT schrodingerSolverType_(DIRECT), // ITERATIVE | DIRECT
schrodingerSolver_(NULL), schrodingerSolver_(nullptr),
schrodingerPoissonMgr_(), schrodingerPoissonMgr_(),
schrodingerPoissonSolver_(NULL), schrodingerPoissonSolver_(nullptr),
maxConsistencyIter_(0), maxConstraintIter_(1), maxConsistencyIter_(0), maxConstraintIter_(1),
safe_dEf_(0.1), Ef_shift_(0.0), safe_dEf_(0.1), Ef_shift_(0.0),
oneD_(false), oneDcoor_(0), oneDconserve_(0) oneD_(false), oneDcoor_(0), oneDconserve_(0)
@ -351,7 +351,7 @@ namespace ATC {
ExtrinsicModelType modelType, ExtrinsicModelType modelType,
string matFileName) : string matFileName) :
ExtrinsicModelDriftDiffusion(modelManager,modelType,matFileName), ExtrinsicModelDriftDiffusion(modelManager,modelType,matFileName),
cddmPoissonSolver_(NULL), cddmPoissonSolver_(nullptr),
baseSize_(0) baseSize_(0)
{ {
// delete base class's version of the physics model // delete base class's version of the physics model

View File

@ -38,15 +38,15 @@ namespace ATC {
poissonSolverType_(DIRECT), // ITERATIVE | DIRECT poissonSolverType_(DIRECT), // ITERATIVE | DIRECT
poissonSolverTol_(0), poissonSolverTol_(0),
poissonSolverMaxIter_(0), poissonSolverMaxIter_(0),
poissonSolver_(NULL), poissonSolver_(nullptr),
maxSolves_(0), maxSolves_(0),
baseSize_(0), baseSize_(0),
chargeRegulator_(NULL), chargeRegulator_(nullptr),
useSlab_(false), useSlab_(false),
includeShortRange_(true), includeShortRange_(true),
atomForces_(NULL), atomForces_(nullptr),
nodalAtomicCharge_(NULL), nodalAtomicCharge_(nullptr),
nodalAtomicGhostCharge_(NULL) nodalAtomicGhostCharge_(nullptr)
{ {
physicsModel_ = new PhysicsModelSpeciesElectrostatic(matFileName); physicsModel_ = new PhysicsModelSpeciesElectrostatic(matFileName);
// set up correct masks for coupling // set up correct masks for coupling

View File

@ -26,7 +26,7 @@ namespace ATC {
string matFileName) : string matFileName) :
ExtrinsicModel(modelManager,modelType,matFileName), ExtrinsicModel(modelManager,modelType,matFileName),
electronTimeIntegration_(TimeIntegrator::IMPLICIT), electronTimeIntegration_(TimeIntegrator::IMPLICIT),
temperatureIntegrator_(NULL), temperatureIntegrator_(nullptr),
nsubcycle_(1), nsubcycle_(1),
exchangeFlag_(true), exchangeFlag_(true),
baseSize_(0) baseSize_(0)
@ -164,7 +164,7 @@ namespace ATC {
rhsMask(ELECTRON_TEMPERATURE,i) = atc_->fieldMask_(ELECTRON_TEMPERATURE,i); rhsMask(ELECTRON_TEMPERATURE,i) = atc_->fieldMask_(ELECTRON_TEMPERATURE,i);
} }
if (electronTimeIntegration_ == TimeIntegrator::NONE) { if (electronTimeIntegration_ == TimeIntegrator::NONE) {
temperatureIntegrator_ = NULL; temperatureIntegrator_ = nullptr;
return; return;
} }
if (temperatureIntegrator_) delete temperatureIntegrator_; if (temperatureIntegrator_) delete temperatureIntegrator_;

View File

@ -36,7 +36,7 @@ static const double localCoordinatesTolerance = 1.e-09;
tolerance_(localCoordinatesTolerance), tolerance_(localCoordinatesTolerance),
projectionGuess_(COORDINATE_ALIGNED) projectionGuess_(COORDINATE_ALIGNED)
{ {
feInterpolate_ = NULL; feInterpolate_ = nullptr;
} }
FE_Element::~FE_Element() FE_Element::~FE_Element()

View File

@ -32,7 +32,7 @@ namespace ATC{
//----------------------------------------------------------------- //-----------------------------------------------------------------
FE_Engine::FE_Engine(MPI_Comm comm) FE_Engine::FE_Engine(MPI_Comm comm)
: communicator_(comm), : communicator_(comm),
feMesh_(NULL), feMesh_(nullptr),
initialized_(false), initialized_(false),
outputManager_() outputManager_()
{ {

View File

@ -90,7 +90,7 @@ namespace ATC {
/** write data: data is arrayed over _unique_ nodes /** write data: data is arrayed over _unique_ nodes
and then mapped by the engine */ 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_data(double time, OUTPUT_LIST *data);
void write_restart_file(std::string fileName, RESTART_LIST *data) void write_restart_file(std::string fileName, RESTART_LIST *data)
@ -150,7 +150,7 @@ namespace ATC {
const PhysicsModel *physicsModel, const PhysicsModel *physicsModel,
const Array<int> &elementMaterials, const Array<int> &elementMaterials,
SPAR_MAT &tangent, SPAR_MAT &tangent,
const DenseMatrix<bool> *elementMask=NULL) const; const DenseMatrix<bool> *elementMask=nullptr) const;
/** compute tangent matrix for a pair of fields - given quadrature */ /** compute tangent matrix for a pair of fields - given quadrature */
void compute_tangent_matrix(const RHS_MASK &rhsMask, void compute_tangent_matrix(const RHS_MASK &rhsMask,
@ -162,7 +162,7 @@ namespace ATC {
const SPAR_MAT &N, const SPAR_MAT &N,
const SPAR_MAT_VEC &dN, const SPAR_MAT_VEC &dN,
SPAR_MAT &tangent, SPAR_MAT &tangent,
const DenseMatrix<bool> *elementMask=NULL) const; const DenseMatrix<bool> *elementMask=nullptr) const;
/** compute a consistent mass matrix for a field */ /** compute a consistent mass matrix for a field */
void compute_mass_matrix( void compute_mass_matrix(
@ -171,7 +171,7 @@ namespace ATC {
const PhysicsModel *physicsModel, const PhysicsModel *physicsModel,
const Array<int> &elementMaterials, const Array<int> &elementMaterials,
CON_MASS_MATS &mass_matrix, CON_MASS_MATS &mass_matrix,
const DenseMatrix<bool> *elementMask=NULL) const; const DenseMatrix<bool> *elementMask=nullptr) const;
/** compute a dimensionless mass matrix */ /** compute a dimensionless mass matrix */
void compute_mass_matrix(SPAR_MAT &mass_matrix) const; void compute_mass_matrix(SPAR_MAT &mass_matrix) const;
@ -191,7 +191,7 @@ namespace ATC {
const PhysicsModel *physicsModel, const PhysicsModel *physicsModel,
const Array<int> &elementMaterials, const Array<int> &elementMaterials,
MASS_MATS &mass_matrix, MASS_MATS &mass_matrix,
const DenseMatrix<bool> *elementMask=NULL) const; const DenseMatrix<bool> *elementMask=nullptr) const;
/** compute dimensional lumped mass matrix using given quadrature */ /** compute dimensional lumped mass matrix using given quadrature */
void compute_lumped_mass_matrix( void compute_lumped_mass_matrix(
@ -212,7 +212,7 @@ namespace ATC {
const PhysicsModel *physicsModel, const PhysicsModel *physicsModel,
const Array<int> &elementMaterials, const Array<int> &elementMaterials,
FIELD_MATS &energy, FIELD_MATS &energy,
const DenseMatrix<bool> *elementMask=NULL, const DenseMatrix<bool> *elementMask=nullptr,
const IntegrationDomainType domain=FULL_DOMAIN) const; const IntegrationDomainType domain=FULL_DOMAIN) const;
/** compute residual or RHS of the dynamic weak eqn */ /** compute residual or RHS of the dynamic weak eqn */
@ -223,7 +223,7 @@ namespace ATC {
const Array<int> &elementMaterials, const Array<int> &elementMaterials,
FIELDS &rhs, FIELDS &rhs,
bool freeOnly=false, bool freeOnly=false,
const DenseMatrix<bool> *elementMask=NULL) const; const DenseMatrix<bool> *elementMask=nullptr) const;
/** compute RHS for given quadrature */ /** compute RHS for given quadrature */
void compute_rhs_vector(const RHS_MASK &rhsMask, void compute_rhs_vector(const RHS_MASK &rhsMask,
@ -251,7 +251,7 @@ namespace ATC {
const PhysicsModel *physicsModel, const PhysicsModel *physicsModel,
const Array<int> &elementMaterials, const Array<int> &elementMaterials,
GRAD_FIELD_MATS &flux, GRAD_FIELD_MATS &flux,
const DenseMatrix<bool> *elementMask=NULL) const; const DenseMatrix<bool> *elementMask=nullptr) const;
/** compute the flux on the MD/FE boundary */ /** compute the flux on the MD/FE boundary */
void compute_boundary_flux(const RHS_MASK &rhsMask, void compute_boundary_flux(const RHS_MASK &rhsMask,
@ -272,8 +272,8 @@ namespace ATC {
const SPAR_MAT_VEC &dN, const SPAR_MAT_VEC &dN,
const DIAG_MAT &flux_mask, const DIAG_MAT &flux_mask,
FIELDS &rhs, FIELDS &rhs,
const DenseMatrix<bool> *elementMask=NULL, const DenseMatrix<bool> *elementMask=nullptr,
const std::set<int> *nodeSet=NULL) const; const std::set<int> *nodeSet=nullptr) const;
/** compute prescribed flux given an array of functions of x & t */ /** compute prescribed flux given an array of functions of x & t */
void add_fluxes(const Array<bool> &fieldMask, void add_fluxes(const Array<bool> &fieldMask,
@ -465,7 +465,7 @@ namespace ATC {
int nsd() const { return feMesh_->num_spatial_dimensions(); } int nsd() const { return feMesh_->num_spatial_dimensions(); }
/** return if the FE mesh has been created */ /** 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 */ /** get nodal coordinates for a given element */
void element_coordinates(const int eltIdx, DENS_MAT &coords) void element_coordinates(const int eltIdx, DENS_MAT &coords)

View File

@ -46,7 +46,7 @@ namespace ATC {
partitioned_(false), partitioned_(false),
nNodes_(0), nNodes_(0),
nNodesUnique_(0), nNodesUnique_(0),
feElement_(NULL), feElement_(nullptr),
twoDimensional_(false), twoDimensional_(false),
hasPlanarFaces_(false) hasPlanarFaces_(false)
@ -1708,7 +1708,7 @@ namespace ATC {
const Array< pair< string, set<int> > > *nodeSets): const Array< pair< string, set<int> > > *nodeSets):
FE_Mesh(), FE_Mesh(),
minEltSize_(0), minEltSize_(0),
tree_(NULL) tree_(nullptr)
{ {
// Pick which element class to make // Pick which element class to make
if (elementType == "HEX8") { if (elementType == "HEX8") {
@ -1774,7 +1774,7 @@ namespace ATC {
} }
// Insert nodes and elements into KD-tree for PIE search. // 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_, tree_ = KD_Tree::create_KD_tree(feElement_->num_elt_nodes(), nNodes_,
&nodalCoords_, nElts_, connectivity_); &nodalCoords_, nElts_, connectivity_);
} }
@ -2107,7 +2107,7 @@ namespace ATC {
// use the KD tree for partitioning, getting more blocks than // use the KD tree for partitioning, getting more blocks than
// processors // processors
if (tree_ == NULL) { if (tree_ == nullptr) {
tree_ = KD_Tree::create_KD_tree(feElement_->num_elt_nodes(), tree_ = KD_Tree::create_KD_tree(feElement_->num_elt_nodes(),
nNodes_, &nodalCoords_, nNodes_, &nodalCoords_,
nElts_, connectivity_); nElts_, connectivity_);
@ -2519,7 +2519,7 @@ namespace ATC {
const double zscale) const double zscale)
: hx_(hx), hy_(hy), hz_(hz) : hx_(hx), hy_(hy), hz_(hz)
{ {
tree_ = NULL; tree_ = nullptr;
hasPlanarFaces_ = true; hasPlanarFaces_ = true;
xscale_ = xscale; xscale_ = xscale;
yscale_ = yscale; yscale_ = yscale;
@ -2820,7 +2820,7 @@ namespace ATC {
const double zscale) const double zscale)
{ {
hasPlanarFaces_ = true; hasPlanarFaces_ = true;
tree_ = NULL; tree_ = nullptr;
xscale_ = xscale; xscale_ = xscale;
yscale_ = yscale; yscale_ = yscale;
zscale_ = zscale; zscale_ = zscale;

View File

@ -112,7 +112,7 @@ FieldImplicitDirectEulerIntegrator::FieldImplicitDirectEulerIntegrator(
const Array2D< bool > & rhsMask, // copy const Array2D< bool > & rhsMask, // copy
const double alpha const double alpha
) : FieldEulerIntegrator(fieldName,physicsModel,feEngine,atc,rhsMask), ) : FieldEulerIntegrator(fieldName,physicsModel,feEngine,atc,rhsMask),
alpha_(alpha),solver_(NULL) alpha_(alpha),solver_(nullptr)
{ {
rhsMask_(fieldName_,FLUX) = false; // handle laplacian term with stiffness rhsMask_(fieldName_,FLUX) = false; // handle laplacian term with stiffness
const BC_SET & bcs = (atc_->prescribed_data_manager()->bcs(fieldName_))[0]; const BC_SET & bcs = (atc_->prescribed_data_manager()->bcs(fieldName_))[0];

View File

@ -271,7 +271,7 @@ typedef PerAtomQuantity<double> PAQ;
u = new AtfShapeFunctionMdProjection(atc_,restricted,VELOCITY); u = new AtfShapeFunctionMdProjection(atc_,restricted,VELOCITY);
} }
else { else {
DENS_MAN * q = NULL; DENS_MAN * q = nullptr;
if (atc_->kernel_on_the_fly()) { if (atc_->kernel_on_the_fly()) {
if (atc_->kernel_based()) { if (atc_->kernel_based()) {
q = new OnTheFlyKernelAccumulationNormalized(atc_, atomic, q = new OnTheFlyKernelAccumulationNormalized(atc_, atomic,

View File

@ -47,7 +47,7 @@ namespace ATC {
case SPECIES_FLUX: return species_flux(name); case SPECIES_FLUX: return species_flux(name);
case INTERNAL_ENERGY: return internal_energy(name); case INTERNAL_ENERGY: return internal_energy(name);
case ENERGY: return 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){ CanonicalName string_to_canonical_name(std::string name){
@ -83,11 +83,11 @@ namespace ATC {
case PROLONGED_VELOCITY: case PROLONGED_VELOCITY:
return prolonged_field(VELOCITY); return prolonged_field(VELOCITY);
default: 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 */ /** 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: protected:
ATC_Method * atc_; ATC_Method * atc_;
InterscaleManager & interscaleManager_; InterscaleManager & interscaleManager_;
@ -120,10 +120,10 @@ namespace ATC {
PAQ * atomic_species_vector(); PAQ * atomic_species_vector();
// internal functions // internal functions
DENS_MAN * projected_atom_quantity(FieldName field,std::string name, PAQ * atomic, DIAG_MAN * normalization = 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 = NULL); 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 = NULL); 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 NULL;}; DENS_MAN * inferred_atom_quantity(FieldName /* field */, std::string /* name */, PAQ * /* atomic */){return nullptr;};
PAQ * prolonged_field(FieldName field); PAQ * prolonged_field(FieldName field);
private: private:
FieldManager(void); FieldManager(void);

View File

@ -26,13 +26,13 @@ namespace ATC {
//==================================================================== //====================================================================
// UXT_Function_Mgr // UXT_Function_Mgr
//==================================================================== //====================================================================
UXT_Function_Mgr * UXT_Function_Mgr::myInstance_ = NULL; UXT_Function_Mgr * UXT_Function_Mgr::myInstance_ = nullptr;
// ----------------------------------------------------------------- // -----------------------------------------------------------------
// instance() // instance()
// ----------------------------------------------------------------- // -----------------------------------------------------------------
UXT_Function_Mgr * UXT_Function_Mgr::instance() UXT_Function_Mgr * UXT_Function_Mgr::instance()
{ {
if (myInstance_ == NULL) { if (myInstance_ == nullptr) {
myInstance_ = new UXT_Function_Mgr(); myInstance_ = new UXT_Function_Mgr();
} }
return myInstance_; return myInstance_;
@ -90,7 +90,7 @@ namespace ATC {
{ {
string tag = other->tag(); string tag = other->tag();
UXT_Function * returnFunction = NULL; UXT_Function * returnFunction = nullptr;
if (tag=="linear") { if (tag=="linear") {
ScalarLinearFunction * other_cast = (ScalarLinearFunction*) other; ScalarLinearFunction * other_cast = (ScalarLinearFunction*) other;
returnFunction = new ScalarLinearFunction(*other_cast); returnFunction = new ScalarLinearFunction(*other_cast);
@ -144,14 +144,14 @@ namespace ATC {
// XT_Function_Mgr // XT_Function_Mgr
//-------------------------------------------------------------------- //--------------------------------------------------------------------
//-------------------------------------------------------------------- //--------------------------------------------------------------------
XT_Function_Mgr * XT_Function_Mgr::myInstance_ = NULL; XT_Function_Mgr * XT_Function_Mgr::myInstance_ = nullptr;
// ----------------------------------------------------------------- // -----------------------------------------------------------------
// instance() // instance()
// ----------------------------------------------------------------- // -----------------------------------------------------------------
XT_Function_Mgr * XT_Function_Mgr::instance() XT_Function_Mgr * XT_Function_Mgr::instance()
{ {
if (myInstance_ == NULL) { if (myInstance_ == nullptr) {
myInstance_ = new XT_Function_Mgr(); myInstance_ = new XT_Function_Mgr();
} }
return myInstance_; return myInstance_;
@ -227,7 +227,7 @@ XT_Function_Mgr * XT_Function_Mgr::myInstance_ = NULL;
{ {
string tag = other->tag(); string tag = other->tag();
XT_Function * returnFunction = NULL; XT_Function * returnFunction = nullptr;
if (tag=="linear") { if (tag=="linear") {
LinearFunction * other_cast = (LinearFunction*) other; LinearFunction * other_cast = (LinearFunction*) other;
returnFunction = new LinearFunction(*other_cast); returnFunction = new LinearFunction(*other_cast);

View File

@ -126,7 +126,7 @@ namespace ATC {
double unitsConversion, double unitsConversion,
AtomType atomType) : AtomType atomType) :
ShallowAtomQuantity<double>(atc,0,atomType), ShallowAtomQuantity<double>(atc,0,atomType),
computePointer_(NULL), computePointer_(nullptr),
computeTag_(tag), computeTag_(tag),
unitsConversion_(unitsConversion) unitsConversion_(unitsConversion)
{ {

View File

@ -131,11 +131,11 @@ namespace ATC {
/** gets appropriate pointer for lammps data */ /** gets appropriate pointer for lammps data */
virtual double * lammps_scalar() const virtual double * lammps_scalar() const
{return NULL;}; {return nullptr;};
/** gets appropriate pointer for lammps data */ /** gets appropriate pointer for lammps data */
virtual double ** lammps_vector() const virtual double ** lammps_vector() const
{return NULL;}; {return nullptr;};
private: private:

View File

@ -23,7 +23,7 @@ namespace ATC {
// Constructor // Constructor
//-------------------------------------------------------- //--------------------------------------------------------
GhostManager::GhostManager(ATC_Method * atc) : GhostManager::GhostManager(ATC_Method * atc) :
ghostModifier_(NULL), ghostModifier_(nullptr),
atc_(atc), atc_(atc),
boundaryDynamics_(NO_BOUNDARY_DYNAMICS), boundaryDynamics_(NO_BOUNDARY_DYNAMICS),
needReset_(true) needReset_(true)
@ -116,7 +116,7 @@ namespace ATC {
{ {
if (ghostModifier_) { if (ghostModifier_) {
delete ghostModifier_; delete ghostModifier_;
ghostModifier_ = NULL; ghostModifier_ = nullptr;
} }
if (!atc_->groupbit_ghost()) { if (!atc_->groupbit_ghost()) {
@ -252,7 +252,7 @@ namespace ATC {
//-------------------------------------------------------- //--------------------------------------------------------
GhostModifier::GhostModifier(GhostManager * ghostManager) : GhostModifier::GhostModifier(GhostManager * ghostManager) :
ghostManager_(ghostManager), ghostManager_(ghostManager),
atomTimeIntegrator_(NULL), atomTimeIntegrator_(nullptr),
integrateAtoms_(false) integrateAtoms_(false)
{ {
// do nothing // do nothing
@ -321,9 +321,9 @@ namespace ATC {
//-------------------------------------------------------- //--------------------------------------------------------
GhostModifierPrescribed::GhostModifierPrescribed(GhostManager * ghostManager) : GhostModifierPrescribed::GhostModifierPrescribed(GhostManager * ghostManager) :
GhostModifier(ghostManager), GhostModifier(ghostManager),
atomPositions_(NULL), atomPositions_(nullptr),
atomFeDisplacement_(NULL), atomFeDisplacement_(nullptr),
atomRefPositions_(NULL) atomRefPositions_(nullptr)
{ {
// do nothing // do nothing
} }
@ -382,9 +382,9 @@ namespace ATC {
const vector<double> & gamma, const vector<double> & gamma,
const vector<double> & mu) : const vector<double> & mu) :
GhostModifierPrescribed(ghostManager), GhostModifierPrescribed(ghostManager),
atomVelocities_(NULL), atomVelocities_(nullptr),
atomFeVelocity_(NULL), atomFeVelocity_(nullptr),
atomForces_(NULL), atomForces_(nullptr),
kappa_(kappa), kappa_(kappa),
gamma_(gamma), gamma_(gamma),
mu_(mu) mu_(mu)
@ -486,8 +486,8 @@ namespace ATC {
const vector<double> & gamma, const vector<double> & gamma,
const vector<double> & mu) : const vector<double> & mu) :
GhostModifierDampedHarmonic(ghostManager,kappa,gamma,mu), GhostModifierDampedHarmonic(ghostManager,kappa,gamma,mu),
ghostToBoundaryDistance_(NULL), ghostToBoundaryDistance_(nullptr),
layerId_(NULL) layerId_(nullptr)
{ {
// do nothing // do nothing
@ -731,8 +731,8 @@ namespace ATC {
GhostModifier(ghostManager), GhostModifier(ghostManager),
lammpsInterface_(LammpsInterface::instance()), lammpsInterface_(LammpsInterface::instance()),
elementSet_((((ghostManager_->atc())->fe_engine())->fe_mesh())->elementset((ghostManager_->atc())->internal_element_set())), elementSet_((((ghostManager_->atc())->fe_engine())->fe_mesh())->elementset((ghostManager_->atc())->internal_element_set())),
atomElement_(NULL), atomElement_(nullptr),
atomGhostElement_(NULL), atomGhostElement_(nullptr),
internalToAtom_((ghostManager_->atc())->internal_to_atom_map()), internalToAtom_((ghostManager_->atc())->internal_to_atom_map()),
ghostToAtom_((ghostManager_->atc())->ghost_to_atom_map()), ghostToAtom_((ghostManager_->atc())->ghost_to_atom_map()),
groupbit_((ghostManager_->atc())->groupbit()), groupbit_((ghostManager_->atc())->groupbit()),

View File

@ -30,7 +30,7 @@ namespace ATC{
for (unsigned int i = 0; i < NUM_ATOM_TYPES; i++) { for (unsigned int i = 0; i < NUM_ATOM_TYPES; i++) {
fundamentalAtomQuantities_[i].resize(LammpsInterface::NUM_FUNDAMENTAL_ATOM_QUANTITIES); fundamentalAtomQuantities_[i].resize(LammpsInterface::NUM_FUNDAMENTAL_ATOM_QUANTITIES);
for (unsigned int j = 0; j < LammpsInterface::NUM_FUNDAMENTAL_ATOM_QUANTITIES; j++) 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]) { if (fundamentalAtomQuantities_[i][j]) {
index = dfs_visit(fundamentalAtomQuantities_[i][j],index); index = dfs_visit(fundamentalAtomQuantities_[i][j],index);
if ((fundamentalAtomQuantities_[i][j])->memory_type()==TEMPORARY) { 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) DependencyManager * InterscaleManager::find(const string & tag)
{ {
// REFACTOR add check for duplicate entries // REFACTOR add check for duplicate entries
DependencyManager * quantity = NULL; DependencyManager * quantity = nullptr;
quantity = find_in_list(perAtomQuantities_,tag); quantity = find_in_list(perAtomQuantities_,tag);
if (quantity) return quantity; if (quantity) return quantity;
@ -482,7 +482,7 @@ namespace ATC{
quantity = find_in_list(smallMoleculeSets_,tag); quantity = find_in_list(smallMoleculeSets_,tag);
if (quantity) return quantity; if (quantity) return quantity;
return NULL; return nullptr;
} }
//-------------------------------------------------------- //--------------------------------------------------------

View File

@ -277,7 +277,7 @@ namespace ATC {
data * return_quantity(std::map<std::string,data * > & list, const std::string & tag) data * return_quantity(std::map<std::string,data * > & list, const std::string & tag)
{ {
typename std::map<std::string,data * >::iterator it = list.find(tag); typename std::map<std::string,data * >::iterator it = list.find(tag);
if (it==list.end()) return NULL; if (it==list.end()) return nullptr;
return it->second; return it->second;
} }
@ -310,7 +310,7 @@ namespace ATC {
{ {
typename std::map<std::string,data * >::iterator it = list.find(tag); typename std::map<std::string,data * >::iterator it = list.find(tag);
if (it!=list.end()) return it->second; if (it!=list.end()) return it->second;
return NULL; return nullptr;
} }
/** helper function to force the reset of all data in a list */ /** helper function to force the reset of all data in a list */

View File

@ -83,17 +83,17 @@ KD_Tree::KD_Tree(vector<Node> *points, vector<Elem> *elements,
if (foundElemRight) rightElems->push_back(*elit); 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) { if (candElems_->size() - leftElems->size() < 4 || leftElems->size() == 0) {
leftChild_ = NULL; leftChild_ = nullptr;
delete leftPts; delete leftPts;
delete leftElems; delete leftElems;
} else { } else {
leftChild_ = new KD_Tree(leftPts, leftElems, (dimension+1) % 3); 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) { if (candElems_->size() - rightElems->size() < 4 || rightElems->size() == 0) {
rightChild_ = NULL; rightChild_ = nullptr;
delete rightPts; delete rightPts;
delete rightElems; delete rightElems;
} else { } else {
@ -109,7 +109,7 @@ vector<int> KD_Tree::find_nearest_elements(Node query, int dimension) {
// tree, either recurse to the left or return this node's elements // tree, either recurse to the left or return this node's elements
// if there is no left child. // if there is no left child.
if (query.lessThanInDimension(value_, dimension)) { if (query.lessThanInDimension(value_, dimension)) {
if (leftChild_ == NULL) { if (leftChild_ == nullptr) {
vector<int> result = vector<int>(); vector<int> result = vector<int>();
for (vector<Elem>::iterator elem = candElems_->begin(); for (vector<Elem>::iterator elem = candElems_->begin();
elem != candElems_->end(); elem++) { elem != candElems_->end(); elem++) {
@ -119,7 +119,7 @@ vector<int> KD_Tree::find_nearest_elements(Node query, int dimension) {
} }
return leftChild_->find_nearest_elements(query, (dimension+1) % 3); return leftChild_->find_nearest_elements(query, (dimension+1) % 3);
} else { } else {
if (rightChild_ == NULL) { if (rightChild_ == nullptr) {
vector<int> result = vector<int>(); vector<int> result = vector<int>();
for (vector<Elem>::iterator elem = candElems_->begin(); for (vector<Elem>::iterator elem = candElems_->begin();
elem != candElems_->end(); elem++) { elem != candElems_->end(); elem++) {
@ -147,7 +147,7 @@ vector<vector<int> > KD_Tree::getElemIDs(int depth) {
sort(candElemIDs.begin(), candElemIDs.end()); sort(candElemIDs.begin(), candElemIDs.end());
result.push_back(candElemIDs); result.push_back(candElemIDs);
} else if (leftChild_ == NULL || rightChild_ == NULL) { } else if (leftChild_ == nullptr || rightChild_ == nullptr) {
// Insert all nodes at this level once, // Insert all nodes at this level once,
// then insert a bunch of empty vectors. // then insert a bunch of empty vectors.
temp = this->getElemIDs(0); temp = this->getElemIDs(0);

View File

@ -20,13 +20,13 @@ namespace ATC {
//======================================================================== //========================================================================
// KernelFunctionMgr // KernelFunctionMgr
//======================================================================== //========================================================================
KernelFunctionMgr * KernelFunctionMgr::myInstance_ = NULL; KernelFunctionMgr * KernelFunctionMgr::myInstance_ = nullptr;
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// instance // instance
//------------------------------------------------------------------------ //------------------------------------------------------------------------
KernelFunctionMgr * KernelFunctionMgr::instance() KernelFunctionMgr * KernelFunctionMgr::instance()
{ {
if (myInstance_ == NULL) { if (myInstance_ == nullptr) {
myInstance_ = new KernelFunctionMgr(); myInstance_ = new KernelFunctionMgr();
} }
return myInstance_; return myInstance_;
@ -65,7 +65,7 @@ namespace ATC {
No default No default
*/ */
int argIdx = 0; int argIdx = 0;
KernelFunction * ptr = NULL; KernelFunction * ptr = nullptr;
char* type = arg[argIdx++]; char* type = arg[argIdx++];
if (strcmp(type,"step")==0) { if (strcmp(type,"step")==0) {
double parameters[1] = {atof(arg[argIdx])}; // cutoff radius double parameters[1] = {atof(arg[argIdx])}; // cutoff radius

View File

@ -151,7 +151,7 @@ namespace ATC {
VelocityRescaleCombined::VelocityRescaleCombined(AtomicRegulator * kinetostat) : VelocityRescaleCombined::VelocityRescaleCombined(AtomicRegulator * kinetostat) :
VelocityGlc(kinetostat), VelocityGlc(kinetostat),
velocity_(atc_->field(VELOCITY)), velocity_(atc_->field(VELOCITY)),
thermostatCorrection_(NULL) thermostatCorrection_(nullptr)
{ {
// do nothing // do nothing
} }
@ -188,7 +188,7 @@ namespace ATC {
//-------------------------------------------------------- //--------------------------------------------------------
ThermostatRescaleCombined::ThermostatRescaleCombined(AtomicRegulator * thermostat) : ThermostatRescaleCombined::ThermostatRescaleCombined(AtomicRegulator * thermostat) :
ThermostatRescale(thermostat), ThermostatRescale(thermostat),
kinetostatCorrection_(NULL) kinetostatCorrection_(nullptr)
{ {
// do nothing // do nothing
} }
@ -226,14 +226,14 @@ namespace ATC {
KinetoThermostatRescale::KinetoThermostatRescale(AtomicRegulator * kinetoThermostat, KinetoThermostatRescale::KinetoThermostatRescale(AtomicRegulator * kinetoThermostat,
int couplingMaxIterations) : int couplingMaxIterations) :
KinetoThermostatShapeFunction(kinetoThermostat,couplingMaxIterations), KinetoThermostatShapeFunction(kinetoThermostat,couplingMaxIterations),
atomVelocities_(NULL), atomVelocities_(nullptr),
nodalVelocities_(atc_->field(VELOCITY)), nodalVelocities_(atc_->field(VELOCITY)),
lambdaMomentum_(NULL), lambdaMomentum_(nullptr),
lambdaEnergy_(NULL), lambdaEnergy_(nullptr),
atomicFluctuatingVelocityRescaled_(NULL), atomicFluctuatingVelocityRescaled_(nullptr),
atomicStreamingVelocity_(NULL), atomicStreamingVelocity_(nullptr),
thermostat_(NULL), thermostat_(nullptr),
kinetostat_(NULL) kinetostat_(nullptr)
{ {
thermostat_ = this->construct_rescale_thermostat(); thermostat_ = this->construct_rescale_thermostat();
kinetostat_ = new VelocityRescaleCombined(kinetoThermostat); kinetostat_ = new VelocityRescaleCombined(kinetoThermostat);
@ -389,7 +389,7 @@ namespace ATC {
//-------------------------------------------------------- //--------------------------------------------------------
ThermostatRescaleMixedKePeCombined::ThermostatRescaleMixedKePeCombined(AtomicRegulator * thermostat) : ThermostatRescaleMixedKePeCombined::ThermostatRescaleMixedKePeCombined(AtomicRegulator * thermostat) :
ThermostatRescaleMixedKePe(thermostat), ThermostatRescaleMixedKePe(thermostat),
kinetostatCorrection_(NULL) kinetostatCorrection_(nullptr)
{ {
// do nothing // do nothing
} }
@ -458,21 +458,21 @@ namespace ATC {
velocity_(atc_->field(VELOCITY)), velocity_(atc_->field(VELOCITY)),
temperature_(atc_->field(TEMPERATURE)), temperature_(atc_->field(TEMPERATURE)),
timeFilter_(atomicRegulator_->time_filter()), timeFilter_(atomicRegulator_->time_filter()),
nodalAtomicLambdaForce_(NULL), nodalAtomicLambdaForce_(nullptr),
lambdaForceFiltered_(NULL), lambdaForceFiltered_(nullptr),
nodalAtomicLambdaPower_(NULL), nodalAtomicLambdaPower_(nullptr),
lambdaPowerFiltered_(NULL), lambdaPowerFiltered_(nullptr),
atomRegulatorForces_(NULL), atomRegulatorForces_(nullptr),
atomThermostatForces_(NULL), atomThermostatForces_(nullptr),
atomMasses_(NULL), atomMasses_(nullptr),
atomVelocities_(NULL), atomVelocities_(nullptr),
isFirstTimestep_(true), isFirstTimestep_(true),
nodalAtomicMomentum_(NULL), nodalAtomicMomentum_(nullptr),
nodalAtomicEnergy_(NULL), nodalAtomicEnergy_(nullptr),
atomPredictedVelocities_(NULL), atomPredictedVelocities_(nullptr),
nodalAtomicPredictedMomentum_(NULL), nodalAtomicPredictedMomentum_(nullptr),
nodalAtomicPredictedEnergy_(NULL), nodalAtomicPredictedEnergy_(nullptr),
firstHalfAtomForces_(NULL), firstHalfAtomForces_(nullptr),
dtFactor_(0.) dtFactor_(0.)
{ {
// construct/obtain data corresponding to stage 3 of ATC_Method::initialize // construct/obtain data corresponding to stage 3 of ATC_Method::initialize

View File

@ -307,11 +307,11 @@ namespace ATC {
RegulatorShapeFunction(kinetostat,regulatorPrefix), RegulatorShapeFunction(kinetostat,regulatorPrefix),
mdMassMatrix_(atc_->set_mass_mat_md(VELOCITY)), mdMassMatrix_(atc_->set_mass_mat_md(VELOCITY)),
timeFilter_(atomicRegulator_->time_filter()), timeFilter_(atomicRegulator_->time_filter()),
nodalAtomicLambdaForce_(NULL), nodalAtomicLambdaForce_(nullptr),
lambdaForceFiltered_(NULL), lambdaForceFiltered_(nullptr),
atomKinetostatForce_(NULL), atomKinetostatForce_(nullptr),
atomVelocities_(NULL), atomVelocities_(nullptr),
atomMasses_(NULL) atomMasses_(nullptr)
{ {
// data associated with stage 3 in ATC_Method::initialize // data associated with stage 3 in ATC_Method::initialize
lambda_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaMomentum",nsd_); lambda_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaMomentum",nsd_);
@ -376,7 +376,7 @@ namespace ATC {
//-------------------------------------------------------- //--------------------------------------------------------
GlcKinetostat::GlcKinetostat(AtomicRegulator *kinetostat) : GlcKinetostat::GlcKinetostat(AtomicRegulator *kinetostat) :
KinetostatShapeFunction(kinetostat), KinetostatShapeFunction(kinetostat),
atomPositions_(NULL) atomPositions_(nullptr)
{ {
// do nothing // do nothing
} }
@ -462,7 +462,7 @@ namespace ATC {
//-------------------------------------------------------- //--------------------------------------------------------
DisplacementGlc::DisplacementGlc(AtomicRegulator * kinetostat) : DisplacementGlc::DisplacementGlc(AtomicRegulator * kinetostat) :
GlcKinetostat(kinetostat), GlcKinetostat(kinetostat),
nodalAtomicMassWeightedDisplacement_(NULL), nodalAtomicMassWeightedDisplacement_(nullptr),
nodalDisplacements_(atc_->field(DISPLACEMENT)) nodalDisplacements_(atc_->field(DISPLACEMENT))
{ {
// do nothing // do nothing
@ -763,7 +763,7 @@ namespace ATC {
//-------------------------------------------------------- //--------------------------------------------------------
VelocityGlc::VelocityGlc(AtomicRegulator * kinetostat) : VelocityGlc::VelocityGlc(AtomicRegulator * kinetostat) :
GlcKinetostat(kinetostat), GlcKinetostat(kinetostat),
nodalAtomicMomentum_(NULL), nodalAtomicMomentum_(nullptr),
nodalVelocities_(atc_->field(VELOCITY)) nodalVelocities_(atc_->field(VELOCITY))
{ {
// do nothing // do nothing
@ -1095,8 +1095,8 @@ namespace ATC {
StressFlux::StressFlux(AtomicRegulator * kinetostat) : StressFlux::StressFlux(AtomicRegulator * kinetostat) :
GlcKinetostat(kinetostat), GlcKinetostat(kinetostat),
nodalForce_(atc_->field_rhs(VELOCITY)), nodalForce_(atc_->field_rhs(VELOCITY)),
nodalAtomicForce_(NULL), nodalAtomicForce_(nullptr),
nodalGhostForce_(NULL), nodalGhostForce_(nullptr),
momentumSource_(atc_->atomic_source(VELOCITY)) momentumSource_(atc_->atomic_source(VELOCITY))
{ {
// flag for performing boundary flux calculation // flag for performing boundary flux calculation
@ -1540,14 +1540,14 @@ namespace ATC {
KinetostatShapeFunction(kinetostat,regulatorPrefix), KinetostatShapeFunction(kinetostat,regulatorPrefix),
velocity_(atc_->field(VELOCITY)), velocity_(atc_->field(VELOCITY)),
//timeFilter_(atomicRegulator_->time_filter()), //timeFilter_(atomicRegulator_->time_filter()),
//nodalAtomicLambdaForce_(NULL), //nodalAtomicLambdaForce_(nullptr),
//lambdaPowerFiltered_(NULL), //lambdaPowerFiltered_(nullptr),
//atomKinetostatForces_(NULL), //atomKinetostatForces_(nullptr),
//atomMasses_(NULL), //atomMasses_(nullptr),
nodalAtomicMomentum_(NULL), nodalAtomicMomentum_(nullptr),
isFirstTimestep_(true), isFirstTimestep_(true),
atomPredictedVelocities_(NULL), atomPredictedVelocities_(nullptr),
nodalAtomicPredictedMomentum_(NULL), nodalAtomicPredictedMomentum_(nullptr),
dtFactor_(0.) dtFactor_(0.)
{ {
// constuct/obtain data corresponding to stage 3 of ATC_Method::initialize // constuct/obtain data corresponding to stage 3 of ATC_Method::initialize
@ -1796,8 +1796,8 @@ namespace ATC {
const string & regulatorPrefix) : const string & regulatorPrefix) :
KinetostatGlcFs(kinetostat,regulatorPrefix), KinetostatGlcFs(kinetostat,regulatorPrefix),
momentumSource_(atc_->atomic_source(VELOCITY)), momentumSource_(atc_->atomic_source(VELOCITY)),
nodalGhostForce_(NULL), nodalGhostForce_(nullptr),
nodalGhostForceFiltered_(NULL) nodalGhostForceFiltered_(nullptr)
{ {
// flag for performing boundary flux calculation // flag for performing boundary flux calculation
fieldMask_(VELOCITY,FLUX) = true; fieldMask_(VELOCITY,FLUX) = true;
@ -2403,9 +2403,9 @@ namespace ATC {
KinetostatFluxFixed::KinetostatFluxFixed(AtomicRegulator * kinetostat, KinetostatFluxFixed::KinetostatFluxFixed(AtomicRegulator * kinetostat,
bool constructKinetostats) : bool constructKinetostats) :
RegulatorMethod(kinetostat), RegulatorMethod(kinetostat),
kinetostatFlux_(NULL), kinetostatFlux_(nullptr),
kinetostatFixed_(NULL), kinetostatFixed_(nullptr),
kinetostatBcs_(NULL) kinetostatBcs_(nullptr)
{ {
if (constructKinetostats) { if (constructKinetostats) {
if (kinetostat->coupling_mode(VELOCITY) == AtomicRegulator::GHOST_FLUX) { if (kinetostat->coupling_mode(VELOCITY) == AtomicRegulator::GHOST_FLUX) {

View File

@ -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]); } 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() // instance()
// ----------------------------------------------------------------- // -----------------------------------------------------------------
LammpsInterface * LammpsInterface::instance() LammpsInterface * LammpsInterface::instance()
{ {
if (myInstance_ == NULL) { if (myInstance_ == nullptr) {
myInstance_ = new LammpsInterface(); myInstance_ = new LammpsInterface();
} }
return myInstance_; return myInstance_;
@ -77,7 +77,7 @@ LammpsInterface * LammpsInterface::instance()
void LammpsInterface::Destroy() void LammpsInterface::Destroy()
{ {
if (myInstance_) delete myInstance_; if (myInstance_) delete myInstance_;
myInstance_ = NULL; myInstance_ = nullptr;
} }
@ -85,13 +85,13 @@ void LammpsInterface::Destroy()
// constructor // constructor
// ----------------------------------------------------------------- // -----------------------------------------------------------------
LammpsInterface::LammpsInterface() LammpsInterface::LammpsInterface()
: lammps_(NULL), : lammps_(nullptr),
fixPointer_(NULL), fixPointer_(nullptr),
commRank_(0), commRank_(0),
atomPE_(NULL), atomPE_(nullptr),
refBoxIsSet_(false), refBoxIsSet_(false),
random_(NULL), random_(nullptr),
globalrandom_(NULL) globalrandom_(nullptr)
{ {
} }
@ -225,7 +225,7 @@ void LammpsInterface::sparse_allsum(SparseMatrix<double> &toShare) const
std::string LammpsInterface::read_file(std::string filename) const std::string LammpsInterface::read_file(std::string filename) const
{ {
FILE *fp = NULL; FILE *fp = nullptr;
if (! comm_rank()) { if (! comm_rank()) {
fp = fopen(filename.c_str(),"r"); fp = fopen(filename.c_str(),"r");
if (!fp) throw ATC_Error("can't open file: "+filename); if (!fp) throw ATC_Error("can't open file: "+filename);
@ -343,7 +343,7 @@ double * LammpsInterface::atom_scalar(FundamentalAtomQuantity quantityType) cons
} }
else else
throw ATC_Error("BAD type requested in atom_scalar"); throw ATC_Error("BAD type requested in atom_scalar");
return NULL; return nullptr;
} }
double ** LammpsInterface::atom_vector(FundamentalAtomQuantity quantityType) const double ** LammpsInterface::atom_vector(FundamentalAtomQuantity quantityType) const
@ -356,7 +356,7 @@ double ** LammpsInterface::atom_vector(FundamentalAtomQuantity quantityType) con
return fatom(); return fatom();
else else
throw ATC_Error("BAD type requested in atom_vector"); throw ATC_Error("BAD type requested in atom_vector");
return NULL; return nullptr;
} }
int LammpsInterface::atom_quantity_ndof(FundamentalAtomQuantity quantityType) const int LammpsInterface::atom_quantity_ndof(FundamentalAtomQuantity quantityType) const
@ -948,10 +948,10 @@ POTENTIAL LammpsInterface::potential() const
"lj/cut/coul/long", "lj/cut/coul/long",
"lj/cut/coul/cut", "lj/cut/coul/cut",
"lj/charmm/coul/long"}; "lj/charmm/coul/long"};
LAMMPS_NS::Pair *pair = NULL; LAMMPS_NS::Pair *pair = nullptr;
for (int i = 0; i < nStyles; i++){ for (int i = 0; i < nStyles; i++){
pair = lammps_->force->pair_match(pairStyles[i].c_str(),1); pair = lammps_->force->pair_match(pairStyles[i].c_str(),1);
if (pair != NULL) break; if (pair != nullptr) break;
} }
return pair; return pair;
} }
@ -979,8 +979,8 @@ bool LammpsInterface::epsilons(int itype, POTENTIAL pair, double * epsilon0) con
int dim = 2; // a return value for extract int dim = 2; // a return value for extract
double ** epsilons = (double**) ( pair->extract(pair_parameter,dim) ); double ** epsilons = (double**) ( pair->extract(pair_parameter,dim) );
delete [] pair_parameter; delete [] pair_parameter;
if (epsilons == NULL) return false; if (epsilons == nullptr) return false;
//if (epsilons == NULL) error->all(FLERR,"Fix concentration adapted pair style parameter not supported"); //if (epsilons == nullptr) error->all(FLERR,"Fix concentration adapted pair style parameter not supported");
int i1,i2; int i1,i2;
for (int i=1; i < ntypes()+1; i++) { for (int i=1; i < ntypes()+1; i++) {
if (i < itype) { i1 = i; i2 = itype; } 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 int dim = 2; // a return value for extract
double ** epsilons = (double**) ( pair->extract(pair_parameter,dim) ); double ** epsilons = (double**) ( pair->extract(pair_parameter,dim) );
delete [] pair_parameter; delete [] pair_parameter;
if (epsilons == NULL) return false; if (epsilons == nullptr) return false;
//if (epsilons == NULL) error->all(FLERR,"Fix concentration adapted pair style parameter not supported"); //if (epsilons == nullptr) error->all(FLERR,"Fix concentration adapted pair style parameter not supported");
// scale interactions // scale interactions
int i1,i2; int i1,i2;
for (int i = 1; i < ntypes()+1; i++) { for (int i = 1; i < ntypes()+1; i++) {
@ -1498,7 +1498,7 @@ double * LammpsInterface::compute_pe_peratom(void) const
return atomPE_->vector_atom; return atomPE_->vector_atom;
} }
else { else {
return NULL; return nullptr;
} }
} }
@ -1542,7 +1542,7 @@ LAMMPS_NS::PairEAM* LammpsInterface::pair_eam() const
// return lammps_->force->pair; // return lammps_->force->pair;
//} //}
LAMMPS_NS::PairEAM* pair_eam = dynamic_cast<LAMMPS_NS::PairEAM*> (lammps_->force->pair); LAMMPS_NS::PairEAM* pair_eam = dynamic_cast<LAMMPS_NS::PairEAM*> (lammps_->force->pair);
if (pair_eam != NULL) { if (pair_eam != nullptr) {
return pair_eam; return pair_eam;
} }
else { else {

View File

@ -534,7 +534,7 @@ class LammpsInterface {
/** Dulong-Petit heat capacity per volume in M,L,T,t units */ /** Dulong-Petit heat capacity per volume in M,L,T,t units */
double heat_capacity(void) const; double heat_capacity(void) const;
/** mass per volume in reference configuraturation in M,L units */ /** 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) */ /** 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 epsilon0(void) const;
double coulomb_constant(void) const; double coulomb_constant(void) const;

View File

@ -35,9 +35,9 @@ LinearSolver::LinearSolver(
allowReinitialization_(false), allowReinitialization_(false),
homogeneousBCs_(false), homogeneousBCs_(false),
bcs_(&bcs), bcs_(&bcs),
rhs_(NULL), rhs_(nullptr),
rhsDense_(), rhsDense_(),
b_(NULL), b_(nullptr),
matrix_(A), matrix_(A),
matrixDense_(), matrixDense_(),
matrixFreeFree_(), matrixFreeFixed_(),matrixInverse_(), matrixFreeFree_(), matrixFreeFixed_(),matrixInverse_(),
@ -65,9 +65,9 @@ LinearSolver::LinearSolver(
matrixModified_(false), matrixModified_(false),
allowReinitialization_(false), allowReinitialization_(false),
homogeneousBCs_(false), homogeneousBCs_(false),
bcs_(NULL), // null implies no constraints will be added later bcs_(nullptr), // null implies no constraints will be added later
rhs_(NULL), rhs_(nullptr),
rhsDense_(), b_(NULL), rhsDense_(), b_(nullptr),
matrix_(A), matrix_(A),
matrixDense_(), matrixDense_(),
matrixFreeFree_(), matrixFreeFixed_(),matrixInverse_(), 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 */ void LinearSolver::eigen_system( DENS_MAT & eigenvalues, DENS_MAT & eigenvectors, const DENS_MAT * M) /* const */
{ {
initialize_matrix(); // no inverse needed initialize_matrix(); // no inverse needed
const DENS_MAT * Kp = NULL; const DENS_MAT * Kp = nullptr;
const DENS_MAT * Mp =M; const DENS_MAT * Mp =M;
DENS_MAT MM; DENS_MAT MM;
DENS_MAT KM; 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) bool LinearSolver::solve(VECTOR & x, const VECTOR & b)
{ {
SPAR_MAT * A = NULL; SPAR_MAT * A = nullptr;
rhs_ = &b; rhs_ = &b;
initialized_ = false; initialized_ = false;
@ -479,7 +479,7 @@ bool LinearSolver::solve(VECTOR & x, const VECTOR & b)
void LinearSolver::greens_function(int I, VECTOR & G_I) void LinearSolver::greens_function(int I, VECTOR & G_I)
{ {
SPAR_MAT * A = NULL; SPAR_MAT * A = nullptr;

View File

@ -64,7 +64,7 @@ class LinearSolver {
allow_reinitialization must be called before first solve, etc */ allow_reinitialization must be called before first solve, etc */
void allow_reinitialization(void); // depending on method save a copy of A 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 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 /** solve
- solves A x = b - solves A x = b
@ -80,7 +80,7 @@ class LinearSolver {
- returns the e-values & e-vectors for constrained system Ax + v x = 0 - 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*/ - if M is provided the eval problem : ( A + v M ) x = 0 is solved*/
void eigen_system(DENS_MAT & eigenvalues, DENS_MAT & eigenvectors, void eigen_system(DENS_MAT & eigenvalues, DENS_MAT & eigenvectors,
const DENS_MAT * M = NULL); const DENS_MAT * M = nullptr);
/** access to penalty coefficient /** access to penalty coefficient
- if a penalty method is not being used this returns zero */ - if a penalty method is not being used this returns zero */

View File

@ -28,21 +28,21 @@ namespace ATC {
Material::Material() Material::Material()
: rhoCp_(0), : rhoCp_(0),
heatCapacity_(0), heatCapacity_(0),
electronHeatCapacity_(NULL), electronHeatCapacity_(nullptr),
massDensity_(0), massDensity_(0),
heatConductivity_(0), heatConductivity_(0),
electronHeatFlux_(NULL), electronHeatFlux_(nullptr),
stress_(NULL), stress_(nullptr),
viscousStress_(NULL), viscousStress_(nullptr),
bodyForce_(NULL), bodyForce_(nullptr),
electronPhononExchange_(NULL), electronPhononExchange_(nullptr),
electronDragPower_(NULL), electronDragPower_(nullptr),
electronFlux_(NULL), electronFlux_(nullptr),
permittivity_(1.), permittivity_(1.),
invEffectiveMass_(1.), invEffectiveMass_(1.),
electronEquilibriumDensity_(0), electronEquilibriumDensity_(0),
electronRecombinationInvTau_(0), electronRecombinationInvTau_(0),
electronChargeDensity_(NULL) electronChargeDensity_(nullptr)
{ {
} }
//-------------------------------------------------------------- //--------------------------------------------------------------
@ -70,21 +70,21 @@ namespace ATC {
: tag_(tag), : tag_(tag),
rhoCp_(0), rhoCp_(0),
heatCapacity_(0), heatCapacity_(0),
electronHeatCapacity_(NULL), electronHeatCapacity_(nullptr),
massDensity_(0), massDensity_(0),
heatConductivity_(0), heatConductivity_(0),
electronHeatFlux_(NULL), electronHeatFlux_(nullptr),
stress_(NULL), stress_(nullptr),
viscousStress_(NULL), viscousStress_(nullptr),
bodyForce_(NULL), bodyForce_(nullptr),
electronPhononExchange_(NULL), electronPhononExchange_(nullptr),
electronDragPower_(NULL), electronDragPower_(nullptr),
electronFlux_(NULL), electronFlux_(nullptr),
permittivity_(1.), permittivity_(1.),
invEffectiveMass_(1.), invEffectiveMass_(1.),
electronEquilibriumDensity_(0), electronEquilibriumDensity_(0),
electronRecombinationInvTau_(0), electronRecombinationInvTau_(0),
electronChargeDensity_(NULL) electronChargeDensity_(nullptr)
{ {
/*! \page man_material material /*! \page man_material material
\section syntax \section syntax

View File

@ -33,7 +33,7 @@ namespace ATC {
virtual void clear(); virtual void clear();
/** initialize global data */ /** initialize global data */
virtual void initialize(std::map<int, double> * globalAtomsPerMolecule = NULL); virtual void initialize(std::map<int, double> * globalAtomsPerMolecule = nullptr);
/** reset the number of atoms/molecules on this processor */ /** reset the number of atoms/molecules on this processor */
void reset_nlocal() {this->set_reset();}; void reset_nlocal() {this->set_reset();};
@ -108,8 +108,8 @@ namespace ATC {
public: public:
SmallMoleculeSet(ATC_Method * atc, int groupBit, SmallMoleculeSet(ATC_Method * atc, int groupBit,
PerAtomQuantity<int> * bondList = NULL, PerAtomQuantity<int> * bondList = nullptr,
PerAtomQuantity<int> * numBond = NULL); PerAtomQuantity<int> * numBond = nullptr);
virtual ~SmallMoleculeSet(); virtual ~SmallMoleculeSet();
@ -117,7 +117,7 @@ namespace ATC {
virtual void clear(); virtual void clear();
/** initialize global data */ /** initialize global data */
virtual void initialize(std::map<int, double> * globalAtomsPerMolecule = NULL); virtual void initialize(std::map<int, double> * globalAtomsPerMolecule = nullptr);
/** access molecule atoms by lammps id */ /** access molecule atoms by lammps id */
std::set<int> atoms_by_global_molecule(int id) const; std::set<int> atoms_by_global_molecule(int id) const;

View File

@ -43,7 +43,7 @@ class NonLinearSolver {
/** Constructor */ /** Constructor */
NonLinearSolver( NonLinearSolver(
TangentOperator * f, // provides f and f' at x, pointer for polymorphism 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, const int dof = 0,
bool parallel = false bool parallel = false
); );

View File

@ -48,8 +48,8 @@ OutputManager::OutputManager(string outputPrefix, set<int> & otypes)
firstStep_(true), firstStep_(true),
firstGlobalsWrite_(true), firstGlobalsWrite_(true),
writeGlobalsHeader_(true), writeGlobalsHeader_(true),
coordinates_(NULL), coordinates_(nullptr),
connectivities_(NULL), connectivities_(nullptr),
dataType_(POINT), dataType_(POINT),
outputPrefix_(outputPrefix), outputPrefix_(outputPrefix),
ensightOutput_(otypes.count(ENSIGHT)), ensightOutput_(otypes.count(ENSIGHT)),
@ -68,8 +68,8 @@ OutputManager::OutputManager()
firstStep_(true), firstStep_(true),
firstGlobalsWrite_(true), firstGlobalsWrite_(true),
writeGlobalsHeader_(true), writeGlobalsHeader_(true),
coordinates_(NULL), coordinates_(nullptr),
connectivities_(NULL), connectivities_(nullptr),
dataType_(POINT), dataType_(POINT),
outputPrefix_("NULL"), outputPrefix_("NULL"),
ensightOutput_(true), ensightOutput_(true),
@ -132,7 +132,7 @@ void OutputManager::print_custom_names() {
// Dump text-based fields to disk for later restart // Dump text-based fields to disk for later restart
void OutputManager::write_restart_file(string fileName, RESTART_LIST *data) void OutputManager::write_restart_file(string fileName, RESTART_LIST *data)
{ {
FILE * fp=NULL; FILE * fp=nullptr;
fp=fopen(fileName.c_str(),"wb"); // open fp=fopen(fileName.c_str(),"wb"); // open
RESTART_LIST::iterator iter; RESTART_LIST::iterator iter;
for (iter = data->begin(); iter != data->end(); 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) void OutputManager::read_restart_file(string fileName, RESTART_LIST *data)
{ {
FILE * fp=NULL; FILE * fp=nullptr;
fp=fopen(fileName.c_str(),"rb"); // open fp=fopen(fileName.c_str(),"rb"); // open
RESTART_LIST::iterator iter; RESTART_LIST::iterator iter;
for (iter = data->begin(); iter != data->end(); 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"; string geom_file_name = outputPrefix_ + ".geo";
// open file // open file
FILE * fp=NULL; FILE * fp=nullptr;
char buffer[80]; char buffer[80];
if ( ! initialized_ ) { if ( ! initialized_ ) {
fp=fopen(geom_file_name.c_str(),"wb"); // open fp=fopen(geom_file_name.c_str(),"wb"); // open
@ -240,7 +240,7 @@ void OutputManager::write_geometry_ensight(void)
else { else {
fp=fopen(geom_file_name.c_str(),"ab"); // append fp=fopen(geom_file_name.c_str(),"ab"); // append
} }
if (fp == NULL) { if (fp == nullptr) {
throw ATC_Error("can not create Ensight geometry file"); 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 // open or append data file
string data_file_name = filenames[ifile]; string data_file_name = filenames[ifile];
FILE * fp=NULL; FILE * fp=nullptr;
if ( outputTimes_.size() == 1 ) { if ( outputTimes_.size() == 1 ) {
fp=fopen(data_file_name.c_str(),"wb"); // open fp=fopen(data_file_name.c_str(),"wb"); // open
} }
else { else {
fp=fopen(data_file_name.c_str(),"ab"); // append 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); 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"; string geom_file_name = outputPrefix_ + ".geo";
// open file // open file
FILE * fp=NULL; FILE * fp=nullptr;
if ((fp=fopen(dict_file_name.c_str(),"w")) == NULL) if ((fp=fopen(dict_file_name.c_str(),"w")) == nullptr)
{ {
throw ATC_Error("can not create Ensight case file"); throw ATC_Error("can not create Ensight case file");
} }

View File

@ -52,13 +52,13 @@ namespace ATC {
coordinates : num _total_ points/nodes X num spatial dim coordinates : num _total_ points/nodes X num spatial dim
connectivities : num elements X num nodes per element*/ connectivities : num elements X num nodes per element*/
void write_geometry(const MATRIX *coordinates, void write_geometry(const MATRIX *coordinates,
const Array2D<int> *connectivity=NULL); const Array2D<int> *connectivity=nullptr);
/** write data from a time step /** write data from a time step
specify node_map to handle periodic soln & data */ 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, 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 */ /** add custom names for any field */
void add_field_names(const std::string& name, const std::vector<std::string>& list) { void add_field_names(const std::string& name, const std::vector<std::string>& list) {

View File

@ -18,7 +18,7 @@ namespace ATC {
AtomType atomType) : AtomType atomType) :
atc_(atc), atc_(atc),
atomType_(atomType), atomType_(atomType),
myNlocal(NULL) myNlocal(nullptr)
{ {
switch (atomType_) { switch (atomType_) {
case ALL: case ALL:

View File

@ -148,7 +148,7 @@ namespace ATC_matrix {
#endif #endif
// Clear out the local matrix's pointer so we don't double-free // Clear out the local matrix's pointer so we don't double-free
A_local._data = NULL; A_local._data = nullptr;
delete [] majorCounts; delete [] majorCounts;
delete [] offsets; delete [] offsets;

View File

@ -233,8 +233,8 @@ DenseMatrix<double> ParSparseMatrix<double>::transMat(
SparseMatrix<double> C_local = ((SparseMatrix<double>)A_local) * B; SparseMatrix<double> C_local = ((SparseMatrix<double>)A_local) * B;
// destroy newA intelligently // destroy newA intelligently
A_local._val = NULL; A_local._val = nullptr;
A_local._ja = NULL; A_local._ja = nullptr;
// Add all the result vectors together on each processor. // Add all the result vectors together on each processor.
sumSparse(C_local, C); sumSparse(C_local, C);
@ -285,8 +285,8 @@ void ParSparseMatrix<double>::partition(
// Prepare an A_local matrix for deletion after it has been loaded with // Prepare an A_local matrix for deletion after it has been loaded with
// data members from another matrix. // data members from another matrix.
void ParSparseMatrix<double>::finalize() { void ParSparseMatrix<double>::finalize() {
_val = NULL; _val = nullptr;
_ja = NULL; _ja = nullptr;
} }
void ParSparseMatrix<double>::operator=(const SparseMatrix<double> &source) void ParSparseMatrix<double>::operator=(const SparseMatrix<double> &source)

View File

@ -135,9 +135,9 @@ namespace ATC_matrix {
Avar.hasTemplate_ = Ap.hasTemplate_; Avar.hasTemplate_ = Ap.hasTemplate_;
// Avoid catastrophe // Avoid catastrophe
Ap._val = NULL; Ap._val = nullptr;
Ap._ja = NULL; Ap._ja = nullptr;
Ap._ia = NULL; Ap._ia = nullptr;
} }

View File

@ -24,8 +24,8 @@ namespace ATC {
atomType_(atomType), atomType_(atomType),
nCols_(nCols), nCols_(nCols),
quantityToLammps_(atc_.atc_to_lammps_map()), quantityToLammps_(atc_.atc_to_lammps_map()),
lammpsScalar_(NULL), lammpsScalar_(nullptr),
lammpsVector_(NULL) lammpsVector_(nullptr)
{ {
// do nothing // do nothing
} }
@ -452,7 +452,7 @@ namespace ATC {
lammpsInterface_(LammpsInterface::instance()), lammpsInterface_(LammpsInterface::instance()),
atomType_(atomType), atomType_(atomType),
quantityToLammps_(atc_.atc_to_lammps_map()), quantityToLammps_(atc_.atc_to_lammps_map()),
lammpsScalar_(NULL) lammpsScalar_(nullptr)
{ {
// do nothing // do nothing
} }
@ -610,8 +610,8 @@ namespace ATC {
nCols_(nCols), nCols_(nCols),
maxEntriesPerRow_(maxEntriesPerRow), maxEntriesPerRow_(maxEntriesPerRow),
quantityToLammps_(atc_.atc_to_lammps_map()), quantityToLammps_(atc_.atc_to_lammps_map()),
lammpsVector_(NULL), lammpsVector_(nullptr),
lammpsColIndices_(NULL) lammpsColIndices_(nullptr)
{ {
// do nothing // do nothing
} }

View File

@ -441,10 +441,10 @@ namespace ATC {
virtual void set_lammps_to_quantity() const {}; virtual void set_lammps_to_quantity() const {};
/** gets appropriate pointer for lammps data */ /** 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 */ /** gets appropriate pointer for lammps data */
virtual T ** lammps_vector() const {return NULL;}; virtual T ** lammps_vector() const {return nullptr;};
private: private:
@ -1452,10 +1452,10 @@ namespace ATC {
virtual void set_quantity_to_lammps() const {}; virtual void set_quantity_to_lammps() const {};
/** gets appropriate data for lammps pointer */ /** 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 */ /** 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: private:

View File

@ -125,7 +125,7 @@ namespace ATC {
// constructor // constructor
AtomToElementMap(ATC_Method * atc, AtomToElementMap(ATC_Method * atc,
PerAtomQuantity<double> * atomPositions = NULL, PerAtomQuantity<double> * atomPositions = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -304,7 +304,7 @@ namespace ATC {
// constructor // constructor
AtomVolumeElement(ATC_Method * atc, AtomVolumeElement(ATC_Method * atc,
PerAtomQuantity<int> * atomElement = NULL, PerAtomQuantity<int> * atomElement = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -349,7 +349,7 @@ namespace ATC {
// constructor // constructor
AtomVolumeRegion(ATC_Method * atc, AtomVolumeRegion(ATC_Method * atc,
DENS_MAN * atomCoarseGrainingPositions = NULL, DENS_MAN * atomCoarseGrainingPositions = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -422,9 +422,9 @@ namespace ATC {
// constructor // constructor
AtomicMassWeightedDisplacement(ATC_Method * atc, AtomicMassWeightedDisplacement(ATC_Method * atc,
PerAtomQuantity<double> * atomPositions = NULL, PerAtomQuantity<double> * atomPositions = nullptr,
PerAtomQuantity<double> * atomMasses = NULL, PerAtomQuantity<double> * atomMasses = nullptr,
PerAtomQuantity<double> * atomReferencePositions = NULL, PerAtomQuantity<double> * atomReferencePositions = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -462,8 +462,8 @@ namespace ATC {
// constructor // constructor
FluctuatingVelocity(ATC_Method * atc, FluctuatingVelocity(ATC_Method * atc,
PerAtomQuantity<double> * atomVelocities = NULL, PerAtomQuantity<double> * atomVelocities = nullptr,
PerAtomQuantity<double> * atomMeanVelocities = NULL, PerAtomQuantity<double> * atomMeanVelocities = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -497,8 +497,8 @@ namespace ATC {
// constructor // constructor
ChargeVelocity(ATC_Method * atc, ChargeVelocity(ATC_Method * atc,
PerAtomQuantity<double> * fluctuatingVelocities = NULL, PerAtomQuantity<double> * fluctuatingVelocities = nullptr,
FundamentalAtomQuantity * atomCharges = NULL, FundamentalAtomQuantity * atomCharges = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -532,8 +532,8 @@ namespace ATC {
// constructor // constructor
SpeciesVelocity(ATC_Method * atc, SpeciesVelocity(ATC_Method * atc,
PerAtomQuantity<double> * fluctuatingVelocities = NULL, PerAtomQuantity<double> * fluctuatingVelocities = nullptr,
PerAtomQuantity<double> * atomTypeVector = NULL, PerAtomQuantity<double> * atomTypeVector = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -567,8 +567,8 @@ namespace ATC {
// constructor // constructor
AtomicMomentum(ATC_Method * atc, AtomicMomentum(ATC_Method * atc,
PerAtomQuantity<double> * atomVelocities = NULL, PerAtomQuantity<double> * atomVelocities = nullptr,
PerAtomQuantity<double> * atomMasses = NULL, PerAtomQuantity<double> * atomMasses = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -631,8 +631,8 @@ namespace ATC {
// constructor // constructor
TwiceKineticEnergy(ATC_Method * atc, TwiceKineticEnergy(ATC_Method * atc,
PerAtomQuantity<double> * atomVelocities = NULL, PerAtomQuantity<double> * atomVelocities = nullptr,
PerAtomQuantity<double> * atomMasses = NULL, PerAtomQuantity<double> * atomMasses = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -670,8 +670,8 @@ namespace ATC {
// constructor // constructor
KineticTensor(ATC_Method * atc, KineticTensor(ATC_Method * atc,
PerAtomQuantity<double> * atomVelocities = NULL, PerAtomQuantity<double> * atomVelocities = nullptr,
PerAtomQuantity<double> * atomMasses = NULL, PerAtomQuantity<double> * atomMasses = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -707,9 +707,9 @@ namespace ATC {
// constructor // constructor
FluctuatingKineticTensor(ATC_Method * atc, FluctuatingKineticTensor(ATC_Method * atc,
PerAtomQuantity<double> * atomVelocities = NULL, PerAtomQuantity<double> * atomVelocities = nullptr,
PerAtomQuantity<double> * atomMasses = NULL, PerAtomQuantity<double> * atomMasses = nullptr,
PerAtomQuantity<double> * atomMeanVelocities = NULL, PerAtomQuantity<double> * atomMeanVelocities = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -747,9 +747,9 @@ namespace ATC {
// constructor // constructor
TwiceFluctuatingKineticEnergy(ATC_Method * atc, TwiceFluctuatingKineticEnergy(ATC_Method * atc,
PerAtomQuantity<double> * atomVelocities = NULL, PerAtomQuantity<double> * atomVelocities = nullptr,
PerAtomQuantity<double> * atomMasses = NULL, PerAtomQuantity<double> * atomMasses = nullptr,
PerAtomQuantity<double> * atomMeanVelocities = NULL, PerAtomQuantity<double> * atomMeanVelocities = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -793,8 +793,8 @@ namespace ATC {
MixedKePeEnergy(ATC_Method * atc, MixedKePeEnergy(ATC_Method * atc,
double keMultiplier, double keMultiplier,
double peMultiplier, double peMultiplier,
PerAtomQuantity<double> * twiceKineticEnergy = NULL, PerAtomQuantity<double> * twiceKineticEnergy = nullptr,
PerAtomQuantity<double> * potentialEnergy = NULL, PerAtomQuantity<double> * potentialEnergy = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -838,8 +838,8 @@ namespace ATC {
// constructor // constructor
TotalEnergy(ATC_Method * atc, TotalEnergy(ATC_Method * atc,
PerAtomQuantity<double> * twiceKineticEnergy = NULL, PerAtomQuantity<double> * twiceKineticEnergy = nullptr,
PerAtomQuantity<double> * potentialEnergy = NULL, PerAtomQuantity<double> * potentialEnergy = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -871,8 +871,8 @@ namespace ATC {
// constructor // constructor
FluctuatingPotentialEnergy(ATC_Method * atc, FluctuatingPotentialEnergy(ATC_Method * atc,
PerAtomQuantity<double> * potentialEnergy = NULL, PerAtomQuantity<double> * potentialEnergy = nullptr,
PerAtomQuantity<double> * referencePotential = NULL, PerAtomQuantity<double> * referencePotential = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -911,8 +911,8 @@ namespace ATC {
// constructor // constructor
DotTwiceKineticEnergy(ATC_Method * atc, DotTwiceKineticEnergy(ATC_Method * atc,
PerAtomQuantity<double> * atomForces = NULL, PerAtomQuantity<double> * atomForces = nullptr,
PerAtomQuantity<double> * atomVelocities = NULL, PerAtomQuantity<double> * atomVelocities = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -948,7 +948,7 @@ namespace ATC {
// constructor // constructor
VelocitySquared(ATC_Method *atc, VelocitySquared(ATC_Method *atc,
PerAtomQuantity<double> * atomVelocities = NULL, PerAtomQuantity<double> * atomVelocities = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -981,9 +981,9 @@ namespace ATC {
// constructor // constructor
LambdaSquared(ATC_Method *atc, LambdaSquared(ATC_Method *atc,
PerAtomQuantity<double> * atomMasses = NULL, PerAtomQuantity<double> * atomMasses = nullptr,
PerAtomQuantity<double> * atomVelocitiesSquared = NULL, PerAtomQuantity<double> * atomVelocitiesSquared = nullptr,
PerAtomQuantity<double> * atomLambdas = NULL, PerAtomQuantity<double> * atomLambdas = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -1149,7 +1149,7 @@ namespace ATC {
// constructor // constructor
AtomToNodeset(ATC_Method * atc, AtomToNodeset(ATC_Method * atc,
SetDependencyManager<int> * subsetNodes, SetDependencyManager<int> * subsetNodes,
PerAtomQuantity<int> * atomElement = NULL, PerAtomQuantity<int> * atomElement = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -1194,7 +1194,7 @@ namespace ATC {
// constructor // constructor
AtomToElementset(ATC_Method * atc, AtomToElementset(ATC_Method * atc,
MatrixDependencyManager<DenseMatrix, bool> * elementMask, MatrixDependencyManager<DenseMatrix, bool> * elementMask,
PerAtomQuantity<int> * atomElement = NULL, PerAtomQuantity<int> * atomElement = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -1273,7 +1273,7 @@ namespace ATC {
// constructor // constructor
VelocitySquaredMapped(ATC_Method *atc, VelocitySquaredMapped(ATC_Method *atc,
MatrixDependencyManager<DenseMatrix, int> * atomMap, MatrixDependencyManager<DenseMatrix, int> * atomMap,
PerAtomQuantity<double> * atomVelocities = NULL, PerAtomQuantity<double> * atomVelocities = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -1307,9 +1307,9 @@ namespace ATC {
// constructor // constructor
LambdaSquaredMapped(ATC_Method *atc, LambdaSquaredMapped(ATC_Method *atc,
MatrixDependencyManager<DenseMatrix, int> * atomMap, MatrixDependencyManager<DenseMatrix, int> * atomMap,
PerAtomQuantity<double> * atomMasses = NULL, PerAtomQuantity<double> * atomMasses = nullptr,
PerAtomQuantity<double> * atomVelocitiesSquared = NULL, PerAtomQuantity<double> * atomVelocitiesSquared = nullptr,
PerAtomQuantity<double> * atomLambdas = NULL, PerAtomQuantity<double> * atomLambdas = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -1371,7 +1371,7 @@ namespace ATC {
// constructor // constructor
AtomicVelocityRescaleFactor(ATC_Method * atc, AtomicVelocityRescaleFactor(ATC_Method * atc,
PerAtomQuantity<double> * atomLambdas = NULL, PerAtomQuantity<double> * atomLambdas = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -1403,8 +1403,8 @@ namespace ATC {
// constructor // constructor
AtomicFluctuatingVelocityRescaled(ATC_Method * atc, AtomicFluctuatingVelocityRescaled(ATC_Method * atc,
PerAtomQuantity<double> * atomRescaleFactor = NULL, PerAtomQuantity<double> * atomRescaleFactor = nullptr,
PerAtomQuantity<double> * atomFluctuatingVelocity = NULL, PerAtomQuantity<double> * atomFluctuatingVelocity = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -1439,10 +1439,10 @@ namespace ATC {
// constructor // constructor
AtomicCombinedRescaleThermostatError(ATC_Method * atc, AtomicCombinedRescaleThermostatError(ATC_Method * atc,
PerAtomQuantity<double> * atomFluctuatingMomentumRescaled = NULL, PerAtomQuantity<double> * atomFluctuatingMomentumRescaled = nullptr,
PerAtomQuantity<double> * atomMeanVelocity = NULL, PerAtomQuantity<double> * atomMeanVelocity = nullptr,
PerAtomQuantity<double> * atomStreamingVelocity = NULL, PerAtomQuantity<double> * atomStreamingVelocity = nullptr,
PerAtomQuantity<double> * atomMass = NULL, PerAtomQuantity<double> * atomMass = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -1483,8 +1483,8 @@ namespace ATC {
// constructor // constructor
AtomicThermostatForce(ATC_Method * atc, AtomicThermostatForce(ATC_Method * atc,
PerAtomQuantity<double> * atomLambdas = NULL, PerAtomQuantity<double> * atomLambdas = nullptr,
PerAtomQuantity<double> * atomVelocities = NULL, PerAtomQuantity<double> * atomVelocities = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -1519,8 +1519,8 @@ namespace ATC {
// constructor // constructor
AtomicKinetostatForceDisplacement(ATC_Method * atc, AtomicKinetostatForceDisplacement(ATC_Method * atc,
PerAtomQuantity<double> * atomLambda = NULL, PerAtomQuantity<double> * atomLambda = nullptr,
PerAtomQuantity<double> * atomMass = NULL, PerAtomQuantity<double> * atomMass = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -1558,8 +1558,8 @@ namespace ATC {
// constructor // constructor
AtomicKinetostatForceVelocity(ATC_Method * atc, AtomicKinetostatForceVelocity(ATC_Method * atc,
PerAtomQuantity<double> * atomLambda = NULL, PerAtomQuantity<double> * atomLambda = nullptr,
PerAtomQuantity<double> * atomMass = NULL, PerAtomQuantity<double> * atomMass = nullptr,
AtomType atomType = INTERNAL) : AtomType atomType = INTERNAL) :
AtomicKinetostatForceDisplacement(atc,atomLambda,atomMass,atomType) {}; AtomicKinetostatForceDisplacement(atc,atomLambda,atomMass,atomType) {};
@ -1589,7 +1589,7 @@ namespace ATC {
// constructor // constructor
AtomicKinetostatForceStress(ATC_Method * atc, AtomicKinetostatForceStress(ATC_Method * atc,
PerAtomQuantity<double> * atomLambda = NULL, PerAtomQuantity<double> * atomLambda = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -1621,7 +1621,7 @@ namespace ATC {
// constructor // constructor
PerAtomKernelFunction(ATC_Method * atc, PerAtomKernelFunction(ATC_Method * atc,
PerAtomQuantity<double> * atomPositions = NULL, PerAtomQuantity<double> * atomPositions = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -1656,8 +1656,8 @@ namespace ATC {
// constructor // constructor
PerAtomShapeFunction(ATC_Method * atc, PerAtomShapeFunction(ATC_Method * atc,
PerAtomQuantity<double> * atomPositions = NULL, PerAtomQuantity<double> * atomPositions = nullptr,
PerAtomQuantity<int> * atomElements = NULL, PerAtomQuantity<int> * atomElements = nullptr,
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);
// destructor // destructor
@ -1695,8 +1695,8 @@ namespace ATC {
// constructor // constructor
LambdaCouplingMatrix(ATC_Method * atc, LambdaCouplingMatrix(ATC_Method * atc,
MatrixDependencyManager<DenseMatrix, int> * nodeToOverlapMap = NULL, MatrixDependencyManager<DenseMatrix, int> * nodeToOverlapMap = nullptr,
SPAR_MAN * shapeFunction = NULL); SPAR_MAN * shapeFunction = nullptr);
// destructor // destructor
virtual ~LambdaCouplingMatrix() { virtual ~LambdaCouplingMatrix() {
@ -1734,9 +1734,9 @@ namespace ATC {
// constructor // constructor
LocalLambdaCouplingMatrix(ATC_Method * atc, LocalLambdaCouplingMatrix(ATC_Method * atc,
MatrixDependencyManager<DenseMatrix, int> * lambdaAtomMap = NULL, MatrixDependencyManager<DenseMatrix, int> * lambdaAtomMap = nullptr,
MatrixDependencyManager<DenseMatrix, int> * nodeToOverlapMap = NULL, MatrixDependencyManager<DenseMatrix, int> * nodeToOverlapMap = nullptr,
SPAR_MAN * shapeFunction = NULL); SPAR_MAN * shapeFunction = nullptr);
// destructor // destructor
virtual ~LocalLambdaCouplingMatrix() { virtual ~LocalLambdaCouplingMatrix() {
@ -1771,7 +1771,7 @@ namespace ATC {
GhostCouplingMatrix(ATC_Method * atc, GhostCouplingMatrix(ATC_Method * atc,
SPAR_MAN * shapeFunction, SPAR_MAN * shapeFunction,
SetDependencyManager<int> * subsetNodes, SetDependencyManager<int> * subsetNodes,
MatrixDependencyManager<DenseMatrix, int> * nodeToOverlapMap = NULL); MatrixDependencyManager<DenseMatrix, int> * nodeToOverlapMap = nullptr);
// destructor // destructor
virtual ~GhostCouplingMatrix() { virtual ~GhostCouplingMatrix() {

View File

@ -272,7 +272,7 @@ BondMatrixKernel::BondMatrixKernel(LammpsInterface * lammpsInterface,
BondMatrix(lammpsInterface,pairMap,x,feMesh), BondMatrix(lammpsInterface,pairMap,x,feMesh),
kernelFunction_(kernelFunction) kernelFunction_(kernelFunction)
{ {
if (kernelFunction_ == NULL) if (kernelFunction_ == nullptr)
throw ATC_Error("No AtC kernel function initialized"); throw ATC_Error("No AtC kernel function initialized");
}; };
void BondMatrixKernel::reset(void) const void BondMatrixKernel::reset(void) const

View File

@ -105,7 +105,7 @@ namespace ATC
const WeakEquation * weak_equation(FieldName field) const const WeakEquation * weak_equation(FieldName field) const
{ {
std::map<FieldName,WeakEquation *>::const_iterator itr = weakEqns_.find(field); std::map<FieldName,WeakEquation *>::const_iterator itr = weakEqns_.find(field);
if (itr == weakEqns_.end()) return NULL; if (itr == weakEqns_.end()) return nullptr;
return (weakEqns_.find(field))->second; return (weakEqns_.find(field))->second;
} }

View File

@ -33,9 +33,9 @@ PoissonSolver::PoissonSolver(
fieldName_(fieldName), fieldName_(fieldName),
rhsMask_(rhsMask), rhsMask_(rhsMask),
linear_(false), linear_(false),
solver_(NULL), solver_(nullptr),
solverNL_(NULL), solverNL_(nullptr),
tangent_(NULL), tangent_(nullptr),
solverType_(solverType), solverType_(solverType),
solverTol_(0), solverTol_(0),
solverMaxIter_(0), solverMaxIter_(0),

View File

@ -34,8 +34,8 @@ namespace ATC {
bcs_[thisField].reset(nNodes_,thisSize); bcs_[thisField].reset(nNodes_,thisSize);
for (int inode = 0; inode < nNodes_ ; ++inode) { for (int inode = 0; inode < nNodes_ ; ++inode) {
for (int idof = 0; idof < thisSize ; ++idof) { for (int idof = 0; idof < thisSize ; ++idof) {
ics_[thisField](inode,idof) = NULL; ics_[thisField](inode,idof) = nullptr;
bcs_[thisField](inode,idof) = NULL; bcs_[thisField](inode,idof) = nullptr;
} }
} }
// compact inode, value lists // compact inode, value lists
@ -44,7 +44,7 @@ namespace ATC {
elementSources_[thisField].reset(nElems_,thisSize); elementSources_[thisField].reset(nElems_,thisSize);
for (int ielem = 0; ielem < nElems_ ; ++ielem) { for (int ielem = 0; ielem < nElems_ ; ++ielem) {
for (int idof = 0; idof < thisSize ; ++idof) { for (int idof = 0; idof < thisSize ; ++idof) {
elementSources_[thisField](ielem,idof) = NULL; elementSources_[thisField](ielem,idof) = nullptr;
} }
} }
// node based sources // node based sources
@ -76,8 +76,8 @@ namespace ATC {
bcs_[fieldName].reset(nNodes_,size); bcs_[fieldName].reset(nNodes_,size);
for (int inode = 0; inode < nNodes_ ; ++inode) { for (int inode = 0; inode < nNodes_ ; ++inode) {
for (int idof = 0; idof < size ; ++idof) { for (int idof = 0; idof < size ; ++idof) {
ics_[fieldName](inode,idof) = NULL; ics_[fieldName](inode,idof) = nullptr;
bcs_[fieldName](inode,idof) = NULL; bcs_[fieldName](inode,idof) = nullptr;
} }
} }
@ -85,7 +85,7 @@ namespace ATC {
elementSources_[fieldName].reset(nElems_,size); elementSources_[fieldName].reset(nElems_,size);
for (int ielem = 0; ielem < nElems_ ; ++ielem) { for (int ielem = 0; ielem < nElems_ ; ++ielem) {
for (int idof = 0; idof < size ; ++idof) { for (int idof = 0; idof < size ; ++idof) {
elementSources_[fieldName](ielem,idof) = NULL; elementSources_[fieldName](ielem,idof) = nullptr;
} }
} }
} }
@ -159,7 +159,7 @@ namespace ATC {
set<int>::const_iterator iset; set<int>::const_iterator iset;
for (iset = nodeSet.begin(); iset != nodeSet.end(); iset++) { for (iset = nodeSet.begin(); iset != nodeSet.end(); iset++) {
int inode = *iset; int inode = *iset;
bcs_[thisField](inode,thisIndex) = NULL; bcs_[thisField](inode,thisIndex) = nullptr;
} }
} }
@ -182,7 +182,7 @@ namespace ATC {
const FieldName thisField, const FieldName thisField,
const int thisIndex) const int thisIndex)
{ {
bcs_[thisField](nodeId,thisIndex) = NULL; bcs_[thisField](nodeId,thisIndex) = nullptr;
} }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// fix_flux // fix_flux
@ -203,7 +203,7 @@ namespace ATC {
if (dof.size() == 0) { if (dof.size() == 0) {
int ndof = (fieldSizes_.find(thisField))->second; int ndof = (fieldSizes_.find(thisField))->second;
dof.reset(ndof); 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; dof(thisIndex) = (XT_Function*) f;
} }
@ -222,7 +222,7 @@ namespace ATC {
for (iset = fset->begin(); iset != fset->end(); iset++) { for (iset = fset->begin(); iset != fset->end(); iset++) {
pair<int,int> face = *iset; pair<int,int> face = *iset;
Array < XT_Function * > & dof = faceSources_[thisField][face]; Array < XT_Function * > & dof = faceSources_[thisField][face];
dof(thisIndex) = NULL; dof(thisIndex) = nullptr;
} }
} }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
@ -244,7 +244,7 @@ namespace ATC {
if (dof.size() == 0) { if (dof.size() == 0) {
int ndof = (fieldSizes_.find(thisField))->second; int ndof = (fieldSizes_.find(thisField))->second;
dof.reset(ndof); 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; dof(thisIndex) = (UXT_Function*) f;
} }
@ -263,7 +263,7 @@ namespace ATC {
for (iset = fset->begin(); iset != fset->end(); iset++) { for (iset = fset->begin(); iset != fset->end(); iset++) {
pair<int,int> face = *iset; pair<int,int> face = *iset;
Array < UXT_Function * > & dof = faceSourcesRobin_[thisField][face]; Array < UXT_Function * > & dof = faceSourcesRobin_[thisField][face];
dof(thisIndex) = NULL; dof(thisIndex) = nullptr;
} }
} }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
@ -342,7 +342,7 @@ namespace ATC {
set<int>::const_iterator iset; set<int>::const_iterator iset;
for (iset = elemSet.begin(); iset != elemSet.end(); iset++) { for (iset = elemSet.begin(); iset != elemSet.end(); iset++) {
int ielem = *iset; int ielem = *iset;
elementSources_[thisField](ielem,thisIndex) = NULL; elementSources_[thisField](ielem,thisIndex) = nullptr;
} }
} }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------

View File

@ -5,14 +5,14 @@
using namespace std; using namespace std;
namespace ATC { namespace ATC {
Quadrature * Quadrature::myInstance_ = NULL; Quadrature * Quadrature::myInstance_ = nullptr;
// ----------------------------------------------------------------- // -----------------------------------------------------------------
// instance() // instance()
// ----------------------------------------------------------------- // -----------------------------------------------------------------
Quadrature * Quadrature::instance() Quadrature * Quadrature::instance()
{ {
if (myInstance_ == NULL) { if (myInstance_ == nullptr) {
myInstance_ = new Quadrature(); myInstance_ = new Quadrature();
} }
return myInstance_; return myInstance_;
@ -24,7 +24,7 @@ Quadrature * Quadrature::instance()
void Quadrature::Destroy() void Quadrature::Destroy()
{ {
if (myInstance_) delete myInstance_; if (myInstance_) delete myInstance_;
myInstance_ = NULL; myInstance_ = nullptr;
} }

View File

@ -646,7 +646,7 @@ double fermi_dirac(const double E, const double T)
double mu, double D double mu, double D
) : ) :
SliceSchrodingerPoissonSolver(atc,schrodingerSolver,poissonSolver,physicsModel,maxConsistencyIter,maxConstraintIter,oneDconserve,0,0), SliceSchrodingerPoissonSolver(atc,schrodingerSolver,poissonSolver,physicsModel,maxConsistencyIter,maxConstraintIter,oneDconserve,0,0),
solver_(NULL), solver_(nullptr),
mobility_(mu),diffusivity_(D) mobility_(mu),diffusivity_(D)
{ {
Ef0_ = Ef0; Ef0_ = Ef0;

View File

@ -17,14 +17,14 @@ TRI_COORD<T>::TRI_COORD(INDEX row, INDEX col, T val, bool add_to)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template<typename T> template<typename T>
SparseMatrix<T>::SparseMatrix(INDEX rows, INDEX cols) SparseMatrix<T>::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) {} _nRows(rows),_nCols(cols) {}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// copy constructor // copy constructor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template<typename T> template<typename T>
SparseMatrix<T>::SparseMatrix(const SparseMatrix<T>& C) SparseMatrix<T>::SparseMatrix(const SparseMatrix<T>& C)
: Matrix<T>(), _val(NULL), _ia(NULL), _ja(NULL), hasTemplate_(false) : Matrix<T>(), _val(nullptr), _ia(nullptr), _ja(nullptr), hasTemplate_(false)
{ {
_copy(C); _copy(C);
} }
@ -33,7 +33,7 @@ SparseMatrix<T>::SparseMatrix(const SparseMatrix<T>& C)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template<typename T> template<typename T>
SparseMatrix<T>::SparseMatrix(const DenseMatrix<T>& C) SparseMatrix<T>::SparseMatrix(const DenseMatrix<T>& C)
: Matrix<T>(), _val(NULL), _ia(NULL), _ja(NULL), hasTemplate_(false) : Matrix<T>(), _val(nullptr), _ia(nullptr), _ja(nullptr), hasTemplate_(false)
{ {
reset(C); reset(C);
} }
@ -67,9 +67,9 @@ void SparseMatrix<T>::_create(INDEX size, INDEX nrows)
// assign memory to hold matrix // assign memory to hold matrix
try try
{ {
_val = (_size && nrows) ? new T [_size] : NULL; _val = (_size && nrows) ? new T [_size] : nullptr;
_ia = (_size && nrows) ? new INDEX [_nRowsCRS+1] : NULL; _ia = (_size && nrows) ? new INDEX [_nRowsCRS+1] : nullptr;
_ja = (_size && nrows) ? new INDEX [_size] : NULL; _ja = (_size && nrows) ? new INDEX [_size] : nullptr;
} }
catch (std::exception &e) catch (std::exception &e)
{ {
@ -94,8 +94,8 @@ void SparseMatrix<T>::_delete()
if (_ia) delete [] _ia; if (_ia) delete [] _ia;
if (_ja) delete [] _ja; if (_ja) delete [] _ja;
_size = _nRowsCRS = 0; _size = _nRowsCRS = 0;
_val = NULL; _val = nullptr;
_ia = _ja = NULL; _ia = _ja = nullptr;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// full memory copy of C into this // full memory copy of C into this

View File

@ -88,7 +88,7 @@ protected:
//@{ //@{
SparseVector(const Matrix<T> &c); SparseVector(const Matrix<T> &c);
SparseVector<T>& operator=(Matrix<T> &c); SparseVector<T>& operator=(Matrix<T> &c);
T* ptr() const {return NULL; } T* ptr() const {return nullptr; }
//@} //@}
STORE data_; //*> sparse data structure STORE data_; //*> sparse data structure

View File

@ -108,9 +108,9 @@ namespace ATC {
timeFilter_(speciesTimeIntegrator->time_filter()), timeFilter_(speciesTimeIntegrator->time_filter()),
massDensity_(atc_->field(MASS_DENSITY)), massDensity_(atc_->field(MASS_DENSITY)),
nodalAtomicMassDensityOut_(atc_->nodal_atomic_field(MASS_DENSITY)), nodalAtomicMassDensityOut_(atc_->nodal_atomic_field(MASS_DENSITY)),
nodalAtomicMassDensity_(NULL), nodalAtomicMassDensity_(nullptr),
speciesConcentration_(atc_->field(SPECIES_CONCENTRATION)), speciesConcentration_(atc_->field(SPECIES_CONCENTRATION)),
nodalAtomicSpeciesConcentration_(NULL), nodalAtomicSpeciesConcentration_(nullptr),
nodalAtomicSpeciesConcentrationFiltered_(speciesTimeIntegrator->nodal_atomic_species_concentration_filtered()), nodalAtomicSpeciesConcentrationFiltered_(speciesTimeIntegrator->nodal_atomic_species_concentration_filtered()),
moleculeIds_(moleculeIds) moleculeIds_(moleculeIds)
{ {

View File

@ -71,7 +71,7 @@ namespace ATC {
const std::map<std::string,std::pair<MolSize,int> > & moleculeIds); const std::map<std::string,std::pair<MolSize,int> > & moleculeIds);
// destructor // destructor
virtual ~SpeciesIntegrationMethod() {nodalAtomicMassDensity_=NULL;}; virtual ~SpeciesIntegrationMethod() {nodalAtomicMassDensity_=nullptr;};
/** create and get necessary transfer operators */ /** create and get necessary transfer operators */
virtual void construct_transfers(); virtual void construct_transfers();

View File

@ -299,10 +299,10 @@ void StressCubicElasticDamped::stress(const FIELD_MATS &fields,
// cauchy born model // cauchy born model
//============================================================================== //==============================================================================
StressCauchyBorn::StressCauchyBorn(fstream &fileId, CbData &cb) StressCauchyBorn::StressCauchyBorn(fstream &fileId, CbData &cb)
: cblattice_(NULL), : cblattice_(nullptr),
potential_(NULL), potential_(nullptr),
makeLinear_(false), makeLinear_(false),
cubicMat_(NULL), cubicMat_(nullptr),
initialized_(false), initialized_(false),
fixed_temperature_(0.), fixed_temperature_(0.),
cbdata_(cb) cbdata_(cb)

View File

@ -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 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; DENS_VEC elasticity_tensor(const MATRIX &F, MATRIX &C, const ElasticityTensorType type=FIRST_ELASTICITY_TENSOR) const;
protected: protected:
void linearize(MATRIX *F=NULL); void linearize(MATRIX *F=nullptr);
CBLattice *cblattice_; //*> CbLattice -> makes atom clusters. CBLattice *cblattice_; //*> CbLattice -> makes atom clusters.
CbPotential *potential_; //*> CbPotential -> interatomic forces. CbPotential *potential_; //*> CbPotential -> interatomic forces.
bool makeLinear_; bool makeLinear_;

View File

@ -150,7 +150,7 @@ namespace ATC {
temperatureRoc_(atc_->field_roc(TEMPERATURE)), temperatureRoc_(atc_->field_roc(TEMPERATURE)),
temperature2Roc_(atc_->field_2roc(TEMPERATURE)), temperature2Roc_(atc_->field_2roc(TEMPERATURE)),
nodalAtomicTemperatureOut_(atc_->nodal_atomic_field(TEMPERATURE)), nodalAtomicTemperatureOut_(atc_->nodal_atomic_field(TEMPERATURE)),
nodalAtomicTemperature_(NULL), nodalAtomicTemperature_(nullptr),
temperatureRhs_(atc_->field_rhs(TEMPERATURE)), temperatureRhs_(atc_->field_rhs(TEMPERATURE)),
nodalAtomicPowerOut_(atc_->nodal_atomic_field_roc(TEMPERATURE)) nodalAtomicPowerOut_(atc_->nodal_atomic_field_roc(TEMPERATURE))
{ {
@ -384,7 +384,7 @@ namespace ATC {
nodalAtomicEnergyFiltered_(thermalTimeIntegrator->nodal_atomic_energy_filtered()), nodalAtomicEnergyFiltered_(thermalTimeIntegrator->nodal_atomic_energy_filtered()),
nodalAtomicPowerFiltered_(thermalTimeIntegrator->nodal_atomic_power_filtered()), nodalAtomicPowerFiltered_(thermalTimeIntegrator->nodal_atomic_power_filtered()),
atomicTemperatureDelta_(atc_->num_nodes(),1), atomicTemperatureDelta_(atc_->num_nodes(),1),
nodalAtomicEnergy_(NULL), nodalAtomicEnergy_(nullptr),
nodalAtomicEnergyOld_(atc_->num_nodes(),1), nodalAtomicEnergyOld_(atc_->num_nodes(),1),
nodalAtomicTemperatureOld_(atc_->num_nodes(),1) nodalAtomicTemperatureOld_(atc_->num_nodes(),1)
{ {

View File

@ -367,7 +367,7 @@ namespace ATC {
const string & regulatorPrefix) : const string & regulatorPrefix) :
RegulatorShapeFunction(thermostat,regulatorPrefix), RegulatorShapeFunction(thermostat,regulatorPrefix),
mdMassMatrix_(atc_->set_mass_mat_md(TEMPERATURE)), mdMassMatrix_(atc_->set_mass_mat_md(TEMPERATURE)),
atomVelocities_(NULL) atomVelocities_(nullptr)
{ {
fieldMask_(TEMPERATURE,FLUX) = true; fieldMask_(TEMPERATURE,FLUX) = true;
lambda_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaEnergy",1); // data associated with stage 3 in ATC_Method::initialize 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) : ThermostatRescale::ThermostatRescale(AtomicRegulator * thermostat) :
ThermostatShapeFunction(thermostat), ThermostatShapeFunction(thermostat),
nodalTemperature_(atc_->field(TEMPERATURE)), nodalTemperature_(atc_->field(TEMPERATURE)),
atomVelocityRescalings_(NULL) atomVelocityRescalings_(nullptr)
{ {
// do nothing // do nothing
} }
@ -535,7 +535,7 @@ namespace ATC {
//-------------------------------------------------------- //--------------------------------------------------------
ThermostatRescaleMixedKePe::ThermostatRescaleMixedKePe(AtomicRegulator * thermostat) : ThermostatRescaleMixedKePe::ThermostatRescaleMixedKePe(AtomicRegulator * thermostat) :
ThermostatRescale(thermostat), ThermostatRescale(thermostat),
nodalAtomicFluctuatingPotentialEnergy_(NULL) nodalAtomicFluctuatingPotentialEnergy_(nullptr)
{ {
// do nothing // do nothing
} }
@ -607,7 +607,7 @@ namespace ATC {
const string & regulatorPrefix) : const string & regulatorPrefix) :
RegulatorShapeFunction(thermostat,regulatorPrefix), RegulatorShapeFunction(thermostat,regulatorPrefix),
lambdaMaxIterations_(lambdaMaxIterations), lambdaMaxIterations_(lambdaMaxIterations),
rhsLambdaSquared_(NULL), rhsLambdaSquared_(nullptr),
dtFactor_(1.) dtFactor_(1.)
{ {
fieldMask_(TEMPERATURE,FLUX) = true; fieldMask_(TEMPERATURE,FLUX) = true;
@ -741,21 +741,21 @@ namespace ATC {
int /* lambdaMaxIterations */, int /* lambdaMaxIterations */,
const string & regulatorPrefix) : const string & regulatorPrefix) :
RegulatorMethod(thermostat,regulatorPrefix), RegulatorMethod(thermostat,regulatorPrefix),
lambdaSolver_(NULL), lambdaSolver_(nullptr),
mdMassMatrix_(atc_->set_mass_mat_md(TEMPERATURE)), mdMassMatrix_(atc_->set_mass_mat_md(TEMPERATURE)),
atomVelocities_(NULL), atomVelocities_(nullptr),
temperature_(atc_->field(TEMPERATURE)), temperature_(atc_->field(TEMPERATURE)),
timeFilter_(atomicRegulator_->time_filter()), timeFilter_(atomicRegulator_->time_filter()),
nodalAtomicLambdaPower_(NULL), nodalAtomicLambdaPower_(nullptr),
lambdaPowerFiltered_(NULL), lambdaPowerFiltered_(nullptr),
atomLambdas_(NULL), atomLambdas_(nullptr),
atomThermostatForces_(NULL), atomThermostatForces_(nullptr),
atomMasses_(NULL), atomMasses_(nullptr),
isFirstTimestep_(true), isFirstTimestep_(true),
nodalAtomicEnergy_(NULL), nodalAtomicEnergy_(nullptr),
atomPredictedVelocities_(NULL), atomPredictedVelocities_(nullptr),
nodalAtomicPredictedEnergy_(NULL), nodalAtomicPredictedEnergy_(nullptr),
firstHalfAtomForces_(NULL) firstHalfAtomForces_(nullptr)
{ {
// construct/obtain data corresponding to stage 3 of ATC_Method::initialize // construct/obtain data corresponding to stage 3 of ATC_Method::initialize
nodalAtomicLambdaPower_ = thermostat->regulator_data(regulatorPrefix_+"NodalAtomicLambdaPower",1); nodalAtomicLambdaPower_ = thermostat->regulator_data(regulatorPrefix_+"NodalAtomicLambdaPower",1);
@ -1389,7 +1389,7 @@ namespace ATC {
int lambdaMaxIterations, int lambdaMaxIterations,
const string & regulatorPrefix) : const string & regulatorPrefix) :
ThermostatGlcFs(thermostat,lambdaMaxIterations,regulatorPrefix), ThermostatGlcFs(thermostat,lambdaMaxIterations,regulatorPrefix),
atomThermostatForcesPredVel_(NULL), atomThermostatForcesPredVel_(nullptr),
filterCoefficient_(1.) filterCoefficient_(1.)
{ {
lambdaSolver_ = new ThermostatSolverFixed(thermostat, lambdaSolver_ = new ThermostatSolverFixed(thermostat,
@ -1887,9 +1887,9 @@ namespace ATC {
int lambdaMaxIterations, int lambdaMaxIterations,
bool constructThermostats) : bool constructThermostats) :
RegulatorMethod(thermostat), RegulatorMethod(thermostat),
thermostatFlux_(NULL), thermostatFlux_(nullptr),
thermostatFixed_(NULL), thermostatFixed_(nullptr),
thermostatBcs_(NULL) thermostatBcs_(nullptr)
{ {
if (constructThermostats) { if (constructThermostats) {
thermostatFlux_ = new ThermostatIntegratorFlux(thermostat,lambdaMaxIterations,regulatorPrefix_+"Flux"); thermostatFlux_ = new ThermostatIntegratorFlux(thermostat,lambdaMaxIterations,regulatorPrefix_+"Flux");
@ -2022,10 +2022,10 @@ namespace ATC {
ThermostatGlc::ThermostatGlc(AtomicRegulator * thermostat) : ThermostatGlc::ThermostatGlc(AtomicRegulator * thermostat) :
ThermostatShapeFunction(thermostat), ThermostatShapeFunction(thermostat),
timeFilter_(atomicRegulator_->time_filter()), timeFilter_(atomicRegulator_->time_filter()),
lambdaPowerFiltered_(NULL), lambdaPowerFiltered_(nullptr),
atomThermostatForces_(NULL), atomThermostatForces_(nullptr),
prescribedDataMgr_(atc_->prescribed_data_manager()), prescribedDataMgr_(atc_->prescribed_data_manager()),
atomMasses_(NULL) atomMasses_(nullptr)
{ {
// consistent with stage 3 of ATC_Method::initialize // consistent with stage 3 of ATC_Method::initialize
lambdaPowerFiltered_= atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaPowerFiltered",1); lambdaPowerFiltered_= atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaPowerFiltered",1);
@ -2080,8 +2080,8 @@ namespace ATC {
ThermostatGlc(thermostat), ThermostatGlc(thermostat),
nodalTemperatureRoc_(atc_->field_roc(TEMPERATURE)), nodalTemperatureRoc_(atc_->field_roc(TEMPERATURE)),
heatSource_(atc_->atomic_source(TEMPERATURE)), heatSource_(atc_->atomic_source(TEMPERATURE)),
nodalAtomicPower_(NULL), nodalAtomicPower_(nullptr),
nodalAtomicLambdaPower_(NULL) nodalAtomicLambdaPower_(nullptr)
{ {
// do nothing // do nothing
} }
@ -2287,8 +2287,8 @@ namespace ATC {
//-------------------------------------------------------- //--------------------------------------------------------
ThermostatHooverVerlet::ThermostatHooverVerlet(AtomicRegulator * thermostat) : ThermostatHooverVerlet::ThermostatHooverVerlet(AtomicRegulator * thermostat) :
ThermostatPowerVerlet(thermostat), ThermostatPowerVerlet(thermostat),
lambdaHoover_(NULL), lambdaHoover_(nullptr),
nodalAtomicHooverLambdaPower_(NULL) nodalAtomicHooverLambdaPower_(nullptr)
{ {
// set up data consistent with stage 3 of ATC_Method::initialize // set up data consistent with stage 3 of ATC_Method::initialize
lambdaHoover_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaHoover",1); lambdaHoover_ = atomicRegulator_->regulator_data(regulatorPrefix_+"LambdaHoover",1);
@ -2505,8 +2505,8 @@ namespace ATC {
//-------------------------------------------------------- //--------------------------------------------------------
ThermostatHooverVerletFiltered::ThermostatHooverVerletFiltered(AtomicRegulator * thermostat) : ThermostatHooverVerletFiltered::ThermostatHooverVerletFiltered(AtomicRegulator * thermostat) :
ThermostatPowerVerletFiltered(thermostat), ThermostatPowerVerletFiltered(thermostat),
lambdaHoover_(NULL), lambdaHoover_(nullptr),
nodalAtomicHooverLambdaPower_(NULL) nodalAtomicHooverLambdaPower_(nullptr)
{ {
// consistent with stage 3 of ATC_Method::initialize // consistent with stage 3 of ATC_Method::initialize
lambdaHoover_ = atomicRegulator_->regulator_data("LambdaHoover",1); lambdaHoover_ = atomicRegulator_->regulator_data("LambdaHoover",1);

View File

@ -210,7 +210,7 @@ namespace ATC {
} }
else if (filterType_ == STEP_FILTER) { else if (filterType_ == STEP_FILTER) {
newTimeFilter = new TimeFilterStep(*this); newTimeFilter = new TimeFilterStep(*this);
} else newTimeFilter = NULL; } else newTimeFilter = nullptr;
} }
else { // default to return base class else { // default to return base class
newTimeFilter = new TimeFilter(*this); newTimeFilter = new TimeFilter(*this);

View File

@ -17,10 +17,10 @@ namespace ATC {
AtomTimeIntegratorType::AtomTimeIntegratorType(ATC_Method * atc, AtomType atomType) : AtomTimeIntegratorType::AtomTimeIntegratorType(ATC_Method * atc, AtomType atomType) :
atc_(atc), atc_(atc),
atomType_(atomType), atomType_(atomType),
mass_(NULL), mass_(nullptr),
position_(NULL), position_(nullptr),
velocity_(NULL), velocity_(nullptr),
force_(NULL) force_(nullptr)
{ {
// do nothing // do nothing
} }
@ -90,9 +90,9 @@ namespace ATC {
//-------------------------------------------------------- //--------------------------------------------------------
TimeIntegrator::TimeIntegrator(ATC_Coupling * atc, TimeIntegrator::TimeIntegrator(ATC_Coupling * atc,
TimeIntegrationType timeIntegrationType) : TimeIntegrationType timeIntegrationType) :
timeIntegrationMethod_(NULL), timeIntegrationMethod_(nullptr),
atc_(atc), atc_(atc),
timeFilter_(NULL), timeFilter_(nullptr),
timeFilterManager_(atc_->time_filter_manager()), timeFilterManager_(atc_->time_filter_manager()),
timeIntegrationType_(timeIntegrationType), timeIntegrationType_(timeIntegrationType),
needReset_(true) needReset_(true)

View File

@ -816,7 +816,7 @@ namespace ATC {
for (unsigned i = 0; i < quantity_.size(); ++i) { for (unsigned i = 0; i < quantity_.size(); ++i) {
if (quantity_[i]) delete quantity_[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++) { for (unsigned i = 0; i < source.size(); i++) {
quantity_[i] = new SPAR_MAT(map_->size(),source[i]->nCols()); quantity_[i] = new SPAR_MAT(map_->size(),source[i]->nCols());
} }
@ -1363,7 +1363,7 @@ namespace ATC {
{ {
pointToElementMap_->register_dependence(this); pointToElementMap_->register_dependence(this);
pointPositions_->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) { for (int i = 0; i < atc->nsd(); ++i) {
quantity_[i] = new SPAR_MAT(); quantity_[i] = new SPAR_MAT();
} }
@ -1428,7 +1428,7 @@ namespace ATC {
atomPositions_->register_dependence(this); atomPositions_->register_dependence(this);
// storage container // storage container
matrices_.resize(atc->nsd(),NULL); matrices_.resize(atc->nsd(),nullptr);
for (int i = 0; i < atc->nsd(); ++i) { for (int i = 0; i < atc->nsd(); ++i) {
matrices_[i] = new AtcAtomSparseMatrix<double>(atc,feEngine_->num_nodes(), matrices_[i] = new AtcAtomSparseMatrix<double>(atc,feEngine_->num_nodes(),
feEngine_->num_nodes_per_element(), feEngine_->num_nodes_per_element(),
@ -1440,7 +1440,7 @@ namespace ATC {
matrices_[i]->register_dependence(this); matrices_[i]->register_dependence(this);
} }
quantity_.resize(atc->nsd(),NULL); quantity_.resize(atc->nsd(),nullptr);
} }
//-------------------------------------------------------- //--------------------------------------------------------
@ -1926,7 +1926,7 @@ namespace ATC {
VectorTransfer<SPAR_MAT * >(), VectorTransfer<SPAR_MAT * >(),
feEngine_(atc->fe_engine()) feEngine_(atc->fe_engine())
{ {
quantity_.resize(atc->nsd(),NULL); quantity_.resize(atc->nsd(),nullptr);
for (int i = 0; i < atc->nsd(); ++i) { for (int i = 0; i < atc->nsd(); ++i) {
quantity_[i] = new SPAR_MAT(); quantity_[i] = new SPAR_MAT();
} }

View File

@ -115,7 +115,7 @@ namespace ATC {
// constructor // constructor
NodalAtomVolumeElement(ATC_Method * atc, SPAR_MAN * shapeFunction, NodalAtomVolumeElement(ATC_Method * atc, SPAR_MAN * shapeFunction,
PerAtomQuantity<int> * atomElement=NULL); PerAtomQuantity<int> * atomElement=nullptr);
// destructor // destructor
virtual ~NodalAtomVolumeElement() { virtual ~NodalAtomVolumeElement() {
@ -173,7 +173,7 @@ namespace ATC {
// constructor // constructor
AtomTypeElement(ATC_Coupling * atc, AtomTypeElement(ATC_Coupling * atc,
PerAtomQuantity<int> * atomElement = NULL); PerAtomQuantity<int> * atomElement = nullptr);
// destructor // destructor
virtual ~AtomTypeElement() { virtual ~AtomTypeElement() {
@ -211,8 +211,8 @@ namespace ATC {
// constructor // constructor
ElementMask(ATC_Coupling * atc, ElementMask(ATC_Coupling * atc,
MatrixDependencyManager<DenseMatrix, int> * hasInternal = NULL, MatrixDependencyManager<DenseMatrix, int> * hasInternal = nullptr,
MatrixDependencyManager<DenseMatrix, int> * hasGhost = NULL); MatrixDependencyManager<DenseMatrix, int> * hasGhost = nullptr);
// destructor // destructor
virtual ~ElementMask() { virtual ~ElementMask() {
@ -251,7 +251,7 @@ namespace ATC {
// constructor // constructor
AtomElementMask(ATC_Coupling * atc, AtomElementMask(ATC_Coupling * atc,
MatrixDependencyManager<DenseMatrix, int> * hasAtoms = NULL); MatrixDependencyManager<DenseMatrix, int> * hasAtoms = nullptr);
// destructor // destructor
virtual ~AtomElementMask() { virtual ~AtomElementMask() {
@ -287,8 +287,8 @@ namespace ATC {
// constructor // constructor
NodalGeometryType(ATC_Coupling * atc, NodalGeometryType(ATC_Coupling * atc,
MatrixDependencyManager<DenseMatrix, int> * hasInternal = NULL, MatrixDependencyManager<DenseMatrix, int> * hasInternal = nullptr,
MatrixDependencyManager<DenseMatrix, int> * hasGhost = NULL); MatrixDependencyManager<DenseMatrix, int> * hasGhost = nullptr);
// destructor // destructor
virtual ~NodalGeometryType() { virtual ~NodalGeometryType() {
@ -338,7 +338,7 @@ namespace ATC {
// constructor // constructor
NodalGeometryTypeElementSet(ATC_Coupling * atc, NodalGeometryTypeElementSet(ATC_Coupling * atc,
MatrixDependencyManager<DenseMatrix, int> * hasInternal = NULL); MatrixDependencyManager<DenseMatrix, int> * hasInternal = nullptr);
// destructor // destructor
virtual ~NodalGeometryTypeElementSet() { virtual ~NodalGeometryTypeElementSet() {
@ -659,7 +659,7 @@ namespace ATC {
// constructor // constructor
RegulatedNodes(ATC_Coupling * atc, RegulatedNodes(ATC_Coupling * atc,
FieldName fieldName = NUM_TOTAL_FIELDS, FieldName fieldName = NUM_TOTAL_FIELDS,
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = NULL); MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = nullptr);
// destructor // destructor
virtual ~RegulatedNodes() { virtual ~RegulatedNodes() {
@ -721,7 +721,7 @@ namespace ATC {
// constructor // constructor
FluxNodes(ATC_Coupling * atc, FluxNodes(ATC_Coupling * atc,
FieldName fieldName = NUM_TOTAL_FIELDS, FieldName fieldName = NUM_TOTAL_FIELDS,
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = NULL) : MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = nullptr) :
RegulatedNodes(atc,fieldName,nodalGeometryType) {}; RegulatedNodes(atc,fieldName,nodalGeometryType) {};
// destructor // destructor
@ -751,7 +751,7 @@ namespace ATC {
// constructor // constructor
BoundaryNodes(ATC_Coupling * atc, BoundaryNodes(ATC_Coupling * atc,
FieldName fieldName = NUM_TOTAL_FIELDS, FieldName fieldName = NUM_TOTAL_FIELDS,
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = NULL) : MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = nullptr) :
RegulatedNodes(atc,fieldName,nodalGeometryType) {}; RegulatedNodes(atc,fieldName,nodalGeometryType) {};
// destructor // destructor
@ -781,7 +781,7 @@ namespace ATC {
// constructor // constructor
FluxBoundaryNodes(ATC_Coupling * atc, FluxBoundaryNodes(ATC_Coupling * atc,
FieldName fieldName = NUM_TOTAL_FIELDS, FieldName fieldName = NUM_TOTAL_FIELDS,
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = NULL) : MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = nullptr) :
FluxNodes(atc,fieldName,nodalGeometryType) {}; FluxNodes(atc,fieldName,nodalGeometryType) {};
// destructor // destructor
@ -811,7 +811,7 @@ namespace ATC {
// constructor // constructor
AllRegulatedNodes(ATC_Coupling * atc, AllRegulatedNodes(ATC_Coupling * atc,
FieldName fieldName = NUM_TOTAL_FIELDS, FieldName fieldName = NUM_TOTAL_FIELDS,
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = NULL) : MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = nullptr) :
FluxBoundaryNodes(atc,fieldName,nodalGeometryType) {}; FluxBoundaryNodes(atc,fieldName,nodalGeometryType) {};
// destructor // destructor
@ -841,7 +841,7 @@ namespace ATC {
// constructor // constructor
FixedNodes(ATC_Coupling * atc, FixedNodes(ATC_Coupling * atc,
FieldName fieldName = NUM_TOTAL_FIELDS, FieldName fieldName = NUM_TOTAL_FIELDS,
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = NULL) : MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = nullptr) :
RegulatedNodes(atc,fieldName,nodalGeometryType) {}; RegulatedNodes(atc,fieldName,nodalGeometryType) {};
// destructor // destructor
@ -871,7 +871,7 @@ namespace ATC {
// constructor // constructor
FixedBoundaryNodes(ATC_Coupling * atc, FixedBoundaryNodes(ATC_Coupling * atc,
FieldName fieldName = NUM_TOTAL_FIELDS, FieldName fieldName = NUM_TOTAL_FIELDS,
MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = NULL) : MatrixDependencyManager<DenseMatrix, int> * nodalGeometryType = nullptr) :
FixedNodes(atc,fieldName,nodalGeometryType) {}; FixedNodes(atc,fieldName,nodalGeometryType) {};
// destructor // destructor
@ -1052,8 +1052,8 @@ namespace ATC {
// constructor // constructor
PerAtomShapeFunctionGradient(ATC_Method * atc, PerAtomShapeFunctionGradient(ATC_Method * atc,
MatrixDependencyManager<DenseMatrix, int>* atomToElementMap = NULL, MatrixDependencyManager<DenseMatrix, int>* atomToElementMap = nullptr,
DENS_MAN* atomPositions = NULL, DENS_MAN* atomPositions = nullptr,
const std::string & tag = "AtomicShapeFunctionGradient", const std::string & tag = "AtomicShapeFunctionGradient",
AtomType atomType = INTERNAL); AtomType atomType = INTERNAL);

View File

@ -542,7 +542,7 @@ namespace ATC {
AtfProjection(ATC_Method * atc, AtfProjection(ATC_Method * atc,
PerAtomQuantity<double> * source, PerAtomQuantity<double> * source,
SPAR_MAN * accumulant, SPAR_MAN * accumulant,
DIAG_MAN * weights = NULL); DIAG_MAN * weights = nullptr);
// destructor // destructor
virtual ~AtfProjection(); virtual ~AtfProjection();
@ -587,7 +587,7 @@ namespace ATC {
PerAtomQuantity<double> * source, PerAtomQuantity<double> * source,
SPAR_MAN * accumulant, SPAR_MAN * accumulant,
const double scale, const double scale,
DIAG_MAN * weights = NULL); DIAG_MAN * weights = nullptr);
// destructor // destructor
virtual ~AtfProjectionScaled(); virtual ~AtfProjectionScaled();
@ -620,7 +620,7 @@ namespace ATC {
PerAtomQuantity<double> * source, PerAtomQuantity<double> * source,
SPAR_MAN * accumulant, SPAR_MAN * accumulant,
DENS_MAN * reference, DENS_MAN * reference,
DIAG_MAN * weights = NULL); DIAG_MAN * weights = nullptr);
// destructor // destructor
virtual ~AtfProjectionReferenced(); virtual ~AtfProjectionReferenced();

View File

@ -226,7 +226,7 @@ namespace ATC_Utility
{ {
char *endptr; char *endptr;
strtod(s.c_str(), &endptr); strtod(s.c_str(), &endptr);
if(endptr != NULL && *endptr == '\0') return true; if(endptr != nullptr && *endptr == '\0') return true;
return false; return false;
} }

View File

@ -129,7 +129,7 @@ public:
message_logger(const string &descriptor_="", int out_level=vblALLBAD|vblMESS1, message_logger(const string &descriptor_="", int out_level=vblALLBAD|vblMESS1,
int stop_level=vblFATAL, int throw_exceptions=0, int use_globally=0) 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_throw(throw_exceptions);
set_levels(out_level,stop_level); set_levels(out_level,stop_level);
extra_levels(0,0); extra_levels(0,0);
@ -157,8 +157,8 @@ public:
return -1; return -1;
glogp=prev; glogp=prev;
if(glogp) if(glogp)
glogp->next=NULL; glogp->next=nullptr;
prev=NULL; prev=nullptr;
} }
return 1; return 1;
} }
@ -244,7 +244,7 @@ public:
FILE *out=stdout, FILE *err=stderr, FILE *out=stdout, FILE *err=stderr,
int out_level=vblALLBAD|vblMESS1,int stop_level=vblFATAL, int out_level=vblALLBAD|vblMESS1,int stop_level=vblFATAL,
int use_globally=0) 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_out(out);
set_err(err); set_err(err);
} }

View File

@ -146,7 +146,7 @@ public:
public: public:
iterator(const iterator &other):ptr(other.ptr),incr(other.incr){ iterator(const iterator &other):ptr(other.ptr),incr(other.incr){
} }
iterator():ptr(NULL),incr(0){} iterator():ptr(nullptr),incr(0){}
iterator &operator++(){ // prefix iterator &operator++(){ // prefix
ptr+=incr; ptr+=incr;
return *this; return *this;
@ -173,13 +173,13 @@ public:
size_t sizex, sizey; size_t sizex, sizey;
//e default constructor //e default constructor
recmatrix(): parr(NULL,1) { recmatrix(): parr(nullptr,1) {
sizey=sizex=0; sizey=sizex=0;
arr=NULL; arr=nullptr;
} }
//e copy constructor: makes a managed copy //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; *this=other;
} }
@ -222,7 +222,7 @@ public:
virtual int init(size_t nx, size_t ny, int smanaged=-1){ virtual int init(size_t nx, size_t ny, int smanaged=-1){
int managed=parr.managed(); int managed=parr.managed();
if(managed && (sizex!=nx || sizey!=ny)){ if(managed && (sizex!=nx || sizey!=ny)){
parr.reset(NULL,0); parr.reset(nullptr,0);
} }
if(smanaged>=0){ // for changing the managed flag? if(smanaged>=0){ // for changing the managed flag?
parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0 ); parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0 );
@ -355,7 +355,7 @@ public:
public: public:
iterator(const iterator &other):ptr(other.ptr),incr(other.incr){ iterator(const iterator &other):ptr(other.ptr),incr(other.incr){
} }
iterator():ptr(NULL),incr(0){} iterator():ptr(nullptr),incr(0){}
iterator &operator++(){ // prefix iterator &operator++(){ // prefix
ptr+=incr; ptr+=incr;
return *this; return *this;
@ -382,13 +382,13 @@ public:
size_t size; size_t size;
//e default constructor //e default constructor
sqmatrix(): parr(NULL,1) { sqmatrix(): parr(nullptr,1) {
size=0; size=0;
arr=NULL; arr=nullptr;
} }
//e copy constructor: makes a managed copy //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; *this=other;
} }
@ -430,7 +430,7 @@ public:
virtual int init(size_t n, int smanaged=-1){ virtual int init(size_t n, int smanaged=-1){
int managed=parr.managed(); int managed=parr.managed();
if(managed && size!=n){ if(managed && size!=n){
parr.reset(NULL,0); parr.reset(nullptr,0);
} }
if(smanaged>=0){ // for changing the managed flag? if(smanaged>=0){ // for changing the managed flag?
parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0 ); parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0 );
@ -600,9 +600,9 @@ class PairHash{
public: public:
//e find the value with indexes i, j //e find the value with indexes i, j
//e @return 0 if not found, 1 otherwise //e @return 0 if not found, 1 otherwise
//e if retval is not NULL, puts the found value there //e if retval is not a null pointer, 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=nullptr)=0;
virtual int Find(long i, long j, T **retval=NULL)=0; virtual int Find(long i, long j, T **retval=nullptr)=0;
virtual int Del(long i, long j)=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;
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); indm.Set(-1);
arr= new T[n*(n+1)/2]; 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); long ind=indm(i,j);
if(ind>=0){ if(ind>=0){
if(retval){ if(retval){

View File

@ -158,7 +158,7 @@ public:
using base_t::second; using base_t::second;
using base_t::first; using base_t::first;
mngptr(T* ptr=NULL, int managed=0): pair<T*,int>(ptr,managed){ mngptr(T* ptr=nullptr, int managed=0): pair<T*,int>(ptr,managed){
//if(managed==2)ptr= new T(*ptr); //if(managed==2)ptr= new T(*ptr);
} }
mngptr(const mngarg<T> &arg): pair<T*,int>(arg.first,arg.second){} mngptr(const mngarg<T> &arg): pair<T*,int>(arg.first,arg.second){}
@ -166,7 +166,7 @@ public:
reset(arg.first,arg.second); reset(arg.first,arg.second);
return *this; 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 && first && first!=ptr){
if(second&0x8)delete [] first; if(second&0x8)delete [] first;
else delete first; else delete first;
@ -313,7 +313,7 @@ template<class T, class delete_t=delete_ptr<T> >
class shptr{ class shptr{
template<class Y, class Z> friend class shptr; template<class Y, class Z> friend class shptr;
T *p; 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){ void set(T *p_, int managed){
p=p_; p=p_;
@ -321,7 +321,7 @@ class shptr{
num=new int; num=new int;
*num=1; *num=1;
} }
else num=NULL; else num=nullptr;
} }
template<class Y> template<class Y>
void set(const Y &other){ void set(const Y &other){
@ -330,7 +330,7 @@ class shptr{
num=other.num; num=other.num;
if(num)(*num)++; if(num)(*num)++;
} }
else num=NULL; else num=nullptr;
} }
void set(const shptr &other){ void set(const shptr &other){
p=other.p; p=other.p;
@ -338,11 +338,11 @@ class shptr{
num=other.num; num=other.num;
if(num)(*num)++; if(num)(*num)++;
} }
else num=NULL; else num=nullptr;
} }
public: public:
shptr(T* p=NULL, int managed=1){ shptr(T* p=nullptr, int managed=1){
set(p,managed); set(p,managed);
} }
shptr(const mngarg<T> &arg){ shptr(const mngarg<T> &arg){
@ -398,14 +398,14 @@ public:
delete_t()(p); delete_t()(p);
delete num; delete num;
} }
num=NULL; num=nullptr;
} }
p=NULL; p=nullptr;
} }
} }
bool valid() const { bool valid() const {
return p!=NULL; return p!=nullptr;
} }
T* ptr() const { T* ptr() const {

View File

@ -374,7 +374,7 @@ struct Vector_Nt {
} }
T maxcoord(int *ind=NULL) const { T maxcoord(int *ind=nullptr) const {
int im=0; int im=0;
T vv=v[0]; T vv=v[0];
for (int i=1; i<N; i++) { for (int i=1; i<N; i++) {
@ -389,7 +389,7 @@ struct Vector_Nt {
//e returns the corrd having maximal absolute value //e returns the corrd having maximal absolute value
T maxabscoord(int *ind=NULL) const { T maxabscoord(int *ind=nullptr) const {
int im=0; int im=0;
T vv=fabs(v[0]); T vv=fabs(v[0]);
for (int i=1; i<N; i++) { for (int i=1; i<N; i++) {
@ -403,7 +403,7 @@ struct Vector_Nt {
} }
//e returns the corrd having minimal absolute value //e returns the corrd having minimal absolute value
T minabscoord(int *ind=NULL) const { T minabscoord(int *ind=nullptr) const {
int im=0; int im=0;
T vv=fabs(v[0]); T vv=fabs(v[0]);
for (int i=1; i<N; i++) { for (int i=1; i<N; i++) {
@ -417,7 +417,7 @@ struct Vector_Nt {
} }
T mincoord(int *ind=NULL) const { T mincoord(int *ind=nullptr) const {
int im=0; int im=0;
T vv=v[0]; T vv=v[0];
for (int i=1; i<N; i++) { for (int i=1; i<N; i++) {
@ -485,7 +485,7 @@ vec_type dist_av(Vector_3 *va1,Vector_3 *va2,int n);
//e finds the average difference norm between two vector sets of the same length //e finds the average difference norm between two vector sets of the same length
/*e optionally gives the indexes for maximal and minimal difference /*e optionally gives the indexes for maximal and minimal difference
va2 can be NULL, then the norm of va1 is used */ va2 can be nullptr, then the norm of va1 is used */
vec_type diff_av(Vector_3 *va1,Vector_3 *va2,int n, int *minind=0, int *maxind=0); vec_type diff_av(Vector_3 *va1,Vector_3 *va2,int n, int *minind=0, int *maxind=0);
@ -615,9 +615,9 @@ inline Vector_3 randdir(){
///\en Calculates extent of the vector container. ///\en Calculates extent of the vector container.
/// \return the center of the vector set, optionally /// \return the center of the vector set, optionally
/// (if arguments are not NULL) fills the bounding box in \a box_min, \a box_max. /// (if arguments are not null pointers) fills the bounding box in \a box_min, \a box_max.
template<class vec_inp_it> template<class vec_inp_it>
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) if(beg==end)
return Vector_3(); return Vector_3();
Vector_3 center(*beg++); Vector_3 center(*beg++);

View File

@ -13,7 +13,7 @@ message_logger &message_logger::global(){
return *glogp; 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); stdfile_logger default_log("",0,stdout,stderr,vblALLBAD|vblMESS1,vblFATAL,1);
const char *logfmt(const char *format,...){ const char *logfmt(const char *format,...){

View File

@ -255,7 +255,7 @@ public:
} }
//e Create NormDeriv object and calculate the derivatived for the given WP //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_; w2=w2_;
d2.set(w2); d2.set(w2);
w12=conj(w1)*w2; w12=conj(w1)*w2;
@ -558,13 +558,13 @@ public:
//e if PBCs are used, the corresponding coordinates of electrons and ions //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 in periodic directions must be within the range [0, cell[per_dir])
//e @returns 1 if OK //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. ///\en Setup electrons: forms internal wave packet representations.
/// If PBCs are used the coords must be within a range [0, cell). /// If PBCs are used the coords must be within a range [0, cell).
/// Default electron mass is AWPMD::me. /// Default electron mass is AWPMD::me.
/// Default (q=NULL )electron charges are -1. /// 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=NULL); 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 setup ion charges and coordinates
//e if PBCs are used the coords must be within a range [0, cell) //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 // 0x2 -- add ion forces to the existing set
// 0x4 -- calculate derivatives for electronic time step (NOT IMPLEMENTED) // 0x4 -- calculate derivatives for electronic time step (NOT IMPLEMENTED)
//e if PBCs are used the coords must be within a range [0, cell) //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, virtual int interaction(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr,
Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); 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) //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, virtual int interaction_hartree(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr,
Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); 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 ///\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. /// 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 Calculates Norm matrix
//e The result is saved in AWPMD::Norm[s] //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() ///\en Prepares force arrays according to \a flag setting for interaction()
virtual void clear_forces(int flagi,Vector_3P fi, Vector_3P fe_x, 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. ///\en Creates wave packet according to the given physical parameters.

View File

@ -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, 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){ Vector_3P fe_p, double *fe_w, double *fe_pw, Vector_2P fe_c){
if(flag&0x4) //need to replace the forces 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 // recalculating derivatives
if(flag&(0x8|0x4)){ //electron forces needed 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 /// 0x4 -- calculate electronic forces \n
/// 0x8 -- add electronic forces to the existing arrays \n /// 0x8 -- add electronic forces to the existing arrays \n
/// 0x10 -- calculate internal electronic derivatives only: \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 /// 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() /// or separately for each WP using \ref get_wp_force()
/// if PBCs are used the coords must be within a range [0, cell) /// if PBCs are used the coords must be within a range [0, cell)

View File

@ -116,8 +116,8 @@ public:
/// \a n is the number of electrons of a given spin component /// \a n is the number of electrons of a given spin component
/// Electron velocity v is multiplied by mass to obtain momentum. /// Electron velocity v is multiplied by mass to obtain momentum.
/// Default mass (-1) means me. /// Default mass (-1) means me.
/// Electronic charges q are -1 by default (when q=NULL), otherwise the charges are assigned for each split /// 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=NULL); 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. ///\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 ///\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, 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); cdouble overlap(int ic1, int s1, int c1,int ic2, int s2, int c2);
//e same as interaction, but using Hartee factorization (no antisymmetrization) //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, int interaction_hartree(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr,
Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); 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 ///\en Calculates interaction in the system of ni ions + electrons
/// the electonic subsystem must be previously setup by set_electrons, ionic by set_ions /// the electonic subsystem must be previously setup by set_electrons, ionic by set_ions
@ -174,12 +174,12 @@ public:
/// 0x4 -- calculate electronic forces \n /// 0x4 -- calculate electronic forces \n
/// 0x8 -- add electronic forces to the existing arrays \n /// 0x8 -- add electronic forces to the existing arrays \n
/// 0x10 -- calculate internal electronic derivatives only: \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 /// 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() /// or separately for each WP using \ref get_wp_force()
/// if PBCs are used the coords must be within a range [0, cell) /// 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, int interaction(int flag=0, Vector_3P fi=nullptr, Vector_3P fe_x=nullptr,
Vector_3P fe_p=NULL, double *fe_w=NULL, double *fe_pw=NULL, Vector_2P fe_c=NULL); 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 ///\en Get electronic forcess in the arrays provided, using calculated internal representation
/// Valid flag settings are:\n /// Valid flag settings are:\n

View File

@ -38,6 +38,7 @@ COLVARS_SRCS = \
colvarcomp_gpath.cpp \ colvarcomp_gpath.cpp \
colvarcomp_protein.cpp \ colvarcomp_protein.cpp \
colvarcomp_rotations.cpp \ colvarcomp_rotations.cpp \
colvarcomp_volmaps.cpp \
colvar.cpp \ colvar.cpp \
colvardeps.cpp \ colvardeps.cpp \
colvargrid.cpp \ colvargrid.cpp \
@ -46,7 +47,12 @@ COLVARS_SRCS = \
colvarparse.cpp \ colvarparse.cpp \
colvarproxy.cpp \ colvarproxy.cpp \
colvarproxy_replicas.cpp \ colvarproxy_replicas.cpp \
colvarproxy_tcl.cpp \
colvarproxy_volmaps.cpp \
colvarscript.cpp \ colvarscript.cpp \
colvarscript_commands.cpp \
colvarscript_commands_bias.cpp \
colvarscript_commands_colvar.cpp \
colvartypes.cpp \ colvartypes.cpp \
colvarvalue.cpp colvarvalue.cpp
@ -61,7 +67,7 @@ ifeq ($(COLVARS_LEPTON),no)
LEPTON_INCFLAGS = LEPTON_INCFLAGS =
COLVARS_OBJS = $(COLVARS_SRCS:.cpp=.o) COLVARS_OBJS = $(COLVARS_SRCS:.cpp=.o)
else else
LEPTON_INCFLAGS = -Ilepton/include -DLEPTON -DLEPTON_USE_STATIC_LIBRARIES LEPTON_INCFLAGS = -Ilepton/include -DLEPTON
COLVARS_OBJS = $(COLVARS_SRCS:.cpp=.o) $(LEPTON_SRCS:.cpp=.o) COLVARS_OBJS = $(COLVARS_SRCS:.cpp=.o) $(LEPTON_SRCS:.cpp=.o)
endif endif
@ -77,25 +83,9 @@ Makefile.deps: $(COLVARS_SRCS)
@echo > $@ @echo > $@
@for src in $^ ; do \ @for src in $^ ; do \
obj=`basename $$src .cpp`.o ; \ obj=`basename $$src .cpp`.o ; \
$(CXX) -MM $(COLVARS_INCFLAGS) $(LEPTON_INCFLAGS) \ $(CXX) $(CXXFLAGS) -MM $(COLVARS_INCFLAGS) $(LEPTON_INCFLAGS) \
-MT '$$(COLVARS_OBJ_DIR)'$$obj $$src >> $@ ; \ -MT '$$(COLVARS_OBJ_DIR)'$$obj $$src >> $@ ; \
done done
include Makefile.deps include Makefile.deps
# Exceptions to pattern rule above for Lepton objects
lepton/src/CompiledExpression.o: lepton/src/CompiledExpression.cpp
$(CXX) $(CXXFLAGS) -Ilepton/include -DLEPTON_BUILDING_STATIC_LIBRARY -c -o $@ $<
lepton/src/ExpressionProgram.o: lepton/src/ExpressionProgram.cpp
$(CXX) $(CXXFLAGS) -Ilepton/include -DLEPTON_BUILDING_STATIC_LIBRARY -c -o $@ $<
lepton/src/ExpressionTreeNode.o: lepton/src/ExpressionTreeNode.cpp
$(CXX) $(CXXFLAGS) -Ilepton/include -DLEPTON_BUILDING_STATIC_LIBRARY -c -o $@ $<
lepton/src/Operation.o: lepton/src/Operation.cpp
$(CXX) $(CXXFLAGS) -Ilepton/include -DLEPTON_BUILDING_STATIC_LIBRARY -c -o $@ $<
lepton/src/ParsedExpression.o: lepton/src/ParsedExpression.cpp
$(CXX) $(CXXFLAGS) -Ilepton/include -DLEPTON_BUILDING_STATIC_LIBRARY -c -o $@ $<
lepton/src/Parser.o: lepton/src/Parser.cpp
$(CXX) $(CXXFLAGS) -Ilepton/include -DLEPTON_BUILDING_STATIC_LIBRARY -c -o $@ $<
include Makefile.lepton.deps # Hand-generated include Makefile.lepton.deps # Hand-generated

View File

@ -1,84 +1,103 @@
$(COLVARS_OBJ_DIR)colvaratoms.o: colvaratoms.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvaratoms.o: colvaratoms.cpp colvarmodule.h \
colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \ colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \
colvarparse.h colvarparams.h colvaratoms.h colvardeps.h colvarproxy_tcl.h colvarproxy_volmaps.h colvarparse.h colvarparams.h \
colvaratoms.h colvardeps.h
$(COLVARS_OBJ_DIR)colvarbias_abf.o: colvarbias_abf.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarbias_abf.o: colvarbias_abf.cpp colvarmodule.h \
colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h colvar.h \ colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \
colvarparse.h colvarparams.h colvardeps.h colvarbias_abf.h colvarbias.h \ colvarproxy_tcl.h colvarproxy_volmaps.h colvar.h colvarparse.h \
colvargrid.h colvar_UIestimator.h colvarparams.h colvardeps.h colvarbias_abf.h colvarbias.h colvargrid.h \
colvar_UIestimator.h
$(COLVARS_OBJ_DIR)colvarbias_alb.o: colvarbias_alb.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarbias_alb.o: colvarbias_alb.cpp colvarmodule.h \
colvars_version.h colvarbias.h colvar.h colvarvalue.h colvartypes.h \ colvars_version.h colvarbias.h colvar.h colvarvalue.h colvartypes.h \
colvarparse.h colvarparams.h colvardeps.h colvarbias_alb.h colvarparse.h colvarparams.h colvardeps.h colvarbias_alb.h
$(COLVARS_OBJ_DIR)colvarbias.o: colvarbias.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarbias.o: colvarbias.cpp colvarmodule.h \
colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h colvarbias.h \ colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \
colvar.h colvarparse.h colvarparams.h colvardeps.h colvargrid.h colvarproxy_tcl.h colvarproxy_volmaps.h colvarbias.h colvar.h \
colvarparse.h colvarparams.h colvardeps.h colvargrid.h
$(COLVARS_OBJ_DIR)colvarbias_histogram.o: colvarbias_histogram.cpp \ $(COLVARS_OBJ_DIR)colvarbias_histogram.o: colvarbias_histogram.cpp \
colvarmodule.h colvars_version.h colvarproxy.h colvartypes.h \ colvarmodule.h colvars_version.h colvarproxy.h colvartypes.h \
colvarvalue.h colvar.h colvarparse.h colvarparams.h colvardeps.h \ colvarvalue.h colvarproxy_tcl.h colvarproxy_volmaps.h colvar.h \
colvarbias_histogram.h colvarbias.h colvargrid.h colvarparse.h colvarparams.h colvardeps.h colvarbias_histogram.h \
colvarbias.h colvargrid.h
$(COLVARS_OBJ_DIR)colvarbias_meta.o: colvarbias_meta.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarbias_meta.o: colvarbias_meta.cpp colvarmodule.h \
colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h colvar.h \ colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \
colvarparse.h colvarparams.h colvardeps.h colvarbias_meta.h colvarbias.h \ colvarproxy_tcl.h colvarproxy_volmaps.h colvar.h colvarparse.h \
colvargrid.h colvarparams.h colvardeps.h colvarbias_meta.h colvarbias.h colvargrid.h
$(COLVARS_OBJ_DIR)colvarbias_restraint.o: colvarbias_restraint.cpp \ $(COLVARS_OBJ_DIR)colvarbias_restraint.o: colvarbias_restraint.cpp \
colvarmodule.h colvars_version.h colvarproxy.h colvartypes.h \ colvarmodule.h colvars_version.h colvarproxy.h colvartypes.h \
colvarvalue.h colvarbias_restraint.h colvarbias.h colvar.h colvarparse.h \ colvarvalue.h colvarproxy_tcl.h colvarproxy_volmaps.h \
colvarbias_restraint.h colvarbias.h colvar.h colvarparse.h \
colvarparams.h colvardeps.h colvarparams.h colvardeps.h
$(COLVARS_OBJ_DIR)colvarcomp_angles.o: colvarcomp_angles.cpp \ $(COLVARS_OBJ_DIR)colvarcomp_angles.o: colvarcomp_angles.cpp \
colvarmodule.h colvars_version.h colvar.h colvarvalue.h colvartypes.h \ colvarmodule.h colvars_version.h colvar.h colvarvalue.h colvartypes.h \
colvarparse.h colvarparams.h colvardeps.h colvarcomp.h colvaratoms.h \ colvarparse.h colvarparams.h colvardeps.h colvarcomp.h colvaratoms.h \
colvarproxy.h colvar_arithmeticpath.h colvar_geometricpath.h colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \
colvar_arithmeticpath.h colvar_geometricpath.h
$(COLVARS_OBJ_DIR)colvarcomp_apath.o: colvarcomp_apath.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarcomp_apath.o: colvarcomp_apath.cpp colvarmodule.h \
colvars_version.h colvarvalue.h colvartypes.h colvarparse.h \ colvars_version.h colvarvalue.h colvartypes.h colvarparse.h \
colvarparams.h colvar.h colvardeps.h colvarcomp.h colvaratoms.h \ colvarparams.h colvar.h colvardeps.h colvarcomp.h colvaratoms.h \
colvarproxy.h colvar_arithmeticpath.h colvar_geometricpath.h colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \
colvar_arithmeticpath.h colvar_geometricpath.h
$(COLVARS_OBJ_DIR)colvarcomp_coordnums.o: colvarcomp_coordnums.cpp \ $(COLVARS_OBJ_DIR)colvarcomp_coordnums.o: colvarcomp_coordnums.cpp \
colvarmodule.h colvars_version.h colvarparse.h colvarvalue.h \ colvarmodule.h colvars_version.h colvarparse.h colvarvalue.h \
colvartypes.h colvarparams.h colvaratoms.h colvarproxy.h colvardeps.h \ colvartypes.h colvarparams.h colvaratoms.h colvarproxy.h \
colvar.h colvarcomp.h colvar_arithmeticpath.h colvar_geometricpath.h colvarproxy_tcl.h colvarproxy_volmaps.h colvardeps.h colvar.h \
colvarcomp.h colvar_arithmeticpath.h colvar_geometricpath.h
$(COLVARS_OBJ_DIR)colvarcomp.o: colvarcomp.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarcomp.o: colvarcomp.cpp colvarmodule.h \
colvars_version.h colvarvalue.h colvartypes.h colvar.h colvarparse.h \ colvars_version.h colvarvalue.h colvartypes.h colvar.h colvarparse.h \
colvarparams.h colvardeps.h colvarcomp.h colvaratoms.h colvarproxy.h \ colvarparams.h colvardeps.h colvarcomp.h colvaratoms.h colvarproxy.h \
colvar_arithmeticpath.h colvar_geometricpath.h colvarproxy_tcl.h colvarproxy_volmaps.h colvar_arithmeticpath.h \
colvar_geometricpath.h
$(COLVARS_OBJ_DIR)colvarcomp_distances.o: colvarcomp_distances.cpp \ $(COLVARS_OBJ_DIR)colvarcomp_distances.o: colvarcomp_distances.cpp \
colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \ colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \
colvarparse.h colvarparams.h colvar.h colvardeps.h colvarcomp.h \ colvarparse.h colvarparams.h colvar.h colvardeps.h colvarcomp.h \
colvaratoms.h colvarproxy.h colvar_arithmeticpath.h \ colvaratoms.h colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \
colvar_geometricpath.h colvar_arithmeticpath.h colvar_geometricpath.h
$(COLVARS_OBJ_DIR)colvarcomp_gpath.o: colvarcomp_gpath.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarcomp_gpath.o: colvarcomp_gpath.cpp colvarmodule.h \
colvars_version.h colvarvalue.h colvartypes.h colvarparse.h \ colvars_version.h colvarvalue.h colvartypes.h colvarparse.h \
colvarparams.h colvar.h colvardeps.h colvarcomp.h colvaratoms.h \ colvarparams.h colvar.h colvardeps.h colvarcomp.h colvaratoms.h \
colvarproxy.h colvar_arithmeticpath.h colvar_geometricpath.h colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \
colvar_arithmeticpath.h colvar_geometricpath.h
$(COLVARS_OBJ_DIR)colvarcomp_protein.o: colvarcomp_protein.cpp \ $(COLVARS_OBJ_DIR)colvarcomp_protein.o: colvarcomp_protein.cpp \
colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \ colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \
colvarparse.h colvarparams.h colvar.h colvardeps.h colvarcomp.h \ colvarparse.h colvarparams.h colvar.h colvardeps.h colvarcomp.h \
colvaratoms.h colvarproxy.h colvar_arithmeticpath.h \ colvaratoms.h colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \
colvar_geometricpath.h colvar_arithmeticpath.h colvar_geometricpath.h
$(COLVARS_OBJ_DIR)colvarcomp_rotations.o: colvarcomp_rotations.cpp \ $(COLVARS_OBJ_DIR)colvarcomp_rotations.o: colvarcomp_rotations.cpp \
colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \ colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \
colvarparse.h colvarparams.h colvar.h colvardeps.h colvarcomp.h \ colvarparse.h colvarparams.h colvar.h colvardeps.h colvarcomp.h \
colvaratoms.h colvarproxy.h colvar_arithmeticpath.h \ colvaratoms.h colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \
colvar_geometricpath.h colvar_arithmeticpath.h colvar_geometricpath.h
$(COLVARS_OBJ_DIR)colvarcomp_volmaps.o: colvarcomp_volmaps.cpp \
colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \
colvarparse.h colvarparams.h colvar.h colvardeps.h colvarcomp.h \
colvaratoms.h colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \
colvar_arithmeticpath.h colvar_geometricpath.h
$(COLVARS_OBJ_DIR)colvar.o: colvar.cpp colvarmodule.h colvars_version.h \ $(COLVARS_OBJ_DIR)colvar.o: colvar.cpp colvarmodule.h colvars_version.h \
colvarvalue.h colvartypes.h colvarparse.h colvarparams.h colvar.h \ colvarvalue.h colvartypes.h colvarparse.h colvarparams.h colvar.h \
colvardeps.h colvarcomp.h colvaratoms.h colvarproxy.h \ colvardeps.h colvarcomp.h colvaratoms.h colvarproxy.h colvarproxy_tcl.h \
colvar_arithmeticpath.h colvar_geometricpath.h colvarscript.h \ colvarproxy_volmaps.h colvar_arithmeticpath.h colvar_geometricpath.h \
colvarbias.h colvarscript.h colvarbias.h colvarscript_commands.h \
colvarscript_commands_colvar.h colvarscript_commands_bias.h
$(COLVARS_OBJ_DIR)colvardeps.o: colvardeps.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvardeps.o: colvardeps.cpp colvarmodule.h \
colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h colvardeps.h \ colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \
colvarparse.h colvarparams.h colvarproxy_tcl.h colvarproxy_volmaps.h colvardeps.h colvarparse.h \
colvarparams.h
$(COLVARS_OBJ_DIR)colvargrid.o: colvargrid.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvargrid.o: colvargrid.cpp colvarmodule.h \
colvars_version.h colvarvalue.h colvartypes.h colvarparse.h \ colvars_version.h colvarvalue.h colvartypes.h colvarparse.h \
colvarparams.h colvar.h colvardeps.h colvarcomp.h colvaratoms.h \ colvarparams.h colvar.h colvardeps.h colvarcomp.h colvaratoms.h \
colvarproxy.h colvar_arithmeticpath.h colvar_geometricpath.h \ colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \
colvargrid.h colvar_arithmeticpath.h colvar_geometricpath.h colvargrid.h
$(COLVARS_OBJ_DIR)colvarmodule.o: colvarmodule.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarmodule.o: colvarmodule.cpp colvarmodule.h \
colvars_version.h colvarparse.h colvarvalue.h colvartypes.h \ colvars_version.h colvarparse.h colvarvalue.h colvartypes.h \
colvarparams.h colvarproxy.h colvar.h colvardeps.h colvarbias.h \ colvarparams.h colvarproxy.h colvarproxy_tcl.h colvarproxy_volmaps.h \
colvarbias_abf.h colvargrid.h colvar_UIestimator.h colvarbias_alb.h \ colvar.h colvardeps.h colvarbias.h colvarbias_abf.h colvargrid.h \
colvarbias_histogram.h colvarbias_meta.h colvarbias_restraint.h \ colvar_UIestimator.h colvarbias_alb.h colvarbias_histogram.h \
colvarscript.h colvaratoms.h colvarcomp.h colvar_arithmeticpath.h \ colvarbias_meta.h colvarbias_restraint.h colvarscript.h \
colvar_geometricpath.h colvarscript_commands.h colvarscript_commands_colvar.h \
colvarscript_commands_bias.h colvaratoms.h colvarcomp.h \
colvar_arithmeticpath.h colvar_geometricpath.h
$(COLVARS_OBJ_DIR)colvarparams.o: colvarparams.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarparams.o: colvarparams.cpp colvarmodule.h \
colvars_version.h colvarvalue.h colvartypes.h colvarparams.h colvars_version.h colvarvalue.h colvartypes.h colvarparams.h
$(COLVARS_OBJ_DIR)colvarparse.o: colvarparse.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarparse.o: colvarparse.cpp colvarmodule.h \
@ -86,15 +105,43 @@ $(COLVARS_OBJ_DIR)colvarparse.o: colvarparse.cpp colvarmodule.h \
colvarparams.h colvarparams.h
$(COLVARS_OBJ_DIR)colvarproxy.o: colvarproxy.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvarproxy.o: colvarproxy.cpp colvarmodule.h \
colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \ colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \
colvarscript.h colvarbias.h colvar.h colvarparse.h colvarparams.h \ colvarproxy_tcl.h colvarproxy_volmaps.h colvarscript.h colvarbias.h \
colvardeps.h colvaratoms.h colvar.h colvarparse.h colvarparams.h colvardeps.h \
colvarscript_commands.h colvarscript_commands_colvar.h \
colvarscript_commands_bias.h colvaratoms.h
$(COLVARS_OBJ_DIR)colvarproxy_replicas.o: colvarproxy_replicas.cpp \ $(COLVARS_OBJ_DIR)colvarproxy_replicas.o: colvarproxy_replicas.cpp \
colvarmodule.h colvars_version.h colvarproxy.h colvartypes.h \ colvarmodule.h colvars_version.h colvarproxy.h colvartypes.h \
colvarvalue.h colvarvalue.h colvarproxy_tcl.h colvarproxy_volmaps.h
$(COLVARS_OBJ_DIR)colvarscript.o: colvarscript.cpp colvarscript.h \ $(COLVARS_OBJ_DIR)colvarproxy_tcl.o: colvarproxy_tcl.cpp colvarmodule.h \
colvarmodule.h colvars_version.h colvarvalue.h colvartypes.h \ colvars_version.h colvarproxy.h colvartypes.h colvarvalue.h \
colvarbias.h colvar.h colvarparse.h colvarparams.h colvardeps.h \ colvarproxy_tcl.h colvarproxy_volmaps.h colvaratoms.h colvarparse.h \
colvarproxy.h colvarparams.h colvardeps.h
$(COLVARS_OBJ_DIR)colvarproxy_volmaps.o: colvarproxy_volmaps.cpp \
colvarmodule.h colvars_version.h colvarproxy_volmaps.h
$(COLVARS_OBJ_DIR)colvarscript.o: colvarscript.cpp colvarproxy.h \
colvarmodule.h colvars_version.h colvartypes.h colvarvalue.h \
colvarproxy_tcl.h colvarproxy_volmaps.h colvardeps.h colvarparse.h \
colvarparams.h colvarscript.h colvarbias.h colvar.h \
colvarscript_commands.h colvarscript_commands_colvar.h \
colvarscript_commands_bias.h
$(COLVARS_OBJ_DIR)colvarscript_commands.o: colvarscript_commands.cpp \
colvarproxy.h colvarmodule.h colvars_version.h colvartypes.h \
colvarvalue.h colvarproxy_tcl.h colvarproxy_volmaps.h colvardeps.h \
colvarparse.h colvarparams.h colvarscript.h colvarbias.h colvar.h \
colvarscript_commands.h colvarscript_commands_colvar.h \
colvarscript_commands_bias.h
$(COLVARS_OBJ_DIR)colvarscript_commands_bias.o: \
colvarscript_commands_bias.cpp colvarproxy.h colvarmodule.h \
colvars_version.h colvartypes.h colvarvalue.h colvarproxy_tcl.h \
colvarproxy_volmaps.h colvardeps.h colvarparse.h colvarparams.h \
colvarscript.h colvarbias.h colvar.h colvarscript_commands.h \
colvarscript_commands_colvar.h colvarscript_commands_bias.h
$(COLVARS_OBJ_DIR)colvarscript_commands_colvar.o: \
colvarscript_commands_colvar.cpp colvarproxy.h colvarmodule.h \
colvars_version.h colvartypes.h colvarvalue.h colvarproxy_tcl.h \
colvarproxy_volmaps.h colvardeps.h colvarparse.h colvarparams.h \
colvarscript.h colvarbias.h colvar.h colvarscript_commands.h \
colvarscript_commands_colvar.h colvarscript_commands_bias.h
$(COLVARS_OBJ_DIR)colvartypes.o: colvartypes.cpp colvarmodule.h \ $(COLVARS_OBJ_DIR)colvartypes.o: colvartypes.cpp colvarmodule.h \
colvars_version.h colvartypes.h colvarparse.h colvarvalue.h \ colvars_version.h colvartypes.h colvarparse.h colvarvalue.h \
colvarparams.h colvarparams.h

View File

@ -541,7 +541,7 @@ int colvar::init_grid_parameters(std::string const &conf)
cvm::log("Reading legacy options lowerWall and lowerWallConstant: " cvm::log("Reading legacy options lowerWall and lowerWallConstant: "
"consider using a harmonicWalls restraint (caution: force constant would then be scaled by width^2).\n"); "consider using a harmonicWalls restraint (caution: force constant would then be scaled by width^2).\n");
if (!get_keyval(conf, "lowerWall", lower_wall)) { if (!get_keyval(conf, "lowerWall", lower_wall)) {
error_code != cvm::error("Error: the value of lowerWall must be set " error_code |= cvm::error("Error: the value of lowerWall must be set "
"explicitly.\n", INPUT_ERROR); "explicitly.\n", INPUT_ERROR);
} }
lw_conf = std::string("\n\ lw_conf = std::string("\n\
@ -554,7 +554,7 @@ int colvar::init_grid_parameters(std::string const &conf)
cvm::log("Reading legacy options upperWall and upperWallConstant: " cvm::log("Reading legacy options upperWall and upperWallConstant: "
"consider using a harmonicWalls restraint (caution: force constant would then be scaled by width^2).\n"); "consider using a harmonicWalls restraint (caution: force constant would then be scaled by width^2).\n");
if (!get_keyval(conf, "upperWall", upper_wall)) { if (!get_keyval(conf, "upperWall", upper_wall)) {
error_code != cvm::error("Error: the value of upperWall must be set " error_code |= cvm::error("Error: the value of upperWall must be set "
"explicitly.\n", INPUT_ERROR); "explicitly.\n", INPUT_ERROR);
} }
uw_conf = std::string("\n\ uw_conf = std::string("\n\
@ -616,7 +616,7 @@ harmonicWalls {\n\
"are enabled).\n", INPUT_ERROR); "are enabled).\n", INPUT_ERROR);
} }
return COLVARS_OK; return error_code;
} }
@ -681,6 +681,9 @@ int colvar::init_extended_Lagrangian(std::string const &conf)
// Adjust Langevin sigma for slow time step if time_step_factor != 1 // Adjust Langevin sigma for slow time step if time_step_factor != 1
ext_sigma = cvm::sqrt(2.0 * cvm::boltzmann() * temp * ext_gamma * ext_mass / (cvm::dt() * cvm::real(time_step_factor))); ext_sigma = cvm::sqrt(2.0 * cvm::boltzmann() * temp * ext_gamma * ext_mass / (cvm::dt() * cvm::real(time_step_factor)));
} }
get_keyval_feature(this, conf, "reflectingLowerBoundary", f_cv_reflecting_lower_boundary, false);
get_keyval_feature(this, conf, "reflectingUpperBoundary", f_cv_reflecting_upper_boundary, false);
} }
return COLVARS_OK; return COLVARS_OK;
@ -863,6 +866,8 @@ int colvar::init_components(std::string const &conf)
error_code |= init_components_type<aspathCV>(conf, "arithmetic path collective variables (s) for other CVs", "aspathCV"); error_code |= init_components_type<aspathCV>(conf, "arithmetic path collective variables (s) for other CVs", "aspathCV");
error_code |= init_components_type<azpathCV>(conf, "arithmetic path collective variables (s) for other CVs", "azpathCV"); error_code |= init_components_type<azpathCV>(conf, "arithmetic path collective variables (s) for other CVs", "azpathCV");
error_code |= init_components_type<map_total>(conf, "total value of atomic map", "mapTotal");
if (!cvcs.size() || (error_code != COLVARS_OK)) { if (!cvcs.size() || (error_code != COLVARS_OK)) {
cvm::error("Error: no valid components were provided " cvm::error("Error: no valid components were provided "
"for this collective variable.\n", "for this collective variable.\n",
@ -1040,85 +1045,93 @@ int colvar::init_dependencies() {
init_feature(f_cv_gradient, "gradient", f_type_dynamic); init_feature(f_cv_gradient, "gradient", f_type_dynamic);
require_feature_children(f_cv_gradient, f_cvc_gradient); require_feature_children(f_cv_gradient, f_cvc_gradient);
init_feature(f_cv_collect_gradient, "collect gradient", f_type_dynamic); init_feature(f_cv_collect_gradient, "collect_gradient", f_type_dynamic);
require_feature_self(f_cv_collect_gradient, f_cv_gradient); require_feature_self(f_cv_collect_gradient, f_cv_gradient);
require_feature_self(f_cv_collect_gradient, f_cv_scalar); require_feature_self(f_cv_collect_gradient, f_cv_scalar);
// The following exlusion could be lifted by implementing the feature // The following exlusion could be lifted by implementing the feature
exclude_feature_self(f_cv_collect_gradient, f_cv_scripted); exclude_feature_self(f_cv_collect_gradient, f_cv_scripted);
require_feature_children(f_cv_collect_gradient, f_cvc_explicit_gradient); require_feature_children(f_cv_collect_gradient, f_cvc_explicit_gradient);
init_feature(f_cv_fdiff_velocity, "velocity from finite differences", f_type_dynamic); init_feature(f_cv_fdiff_velocity, "velocity_from_finite_differences", f_type_dynamic);
// System force: either trivial (spring force); through extended Lagrangian, or calculated explicitly // System force: either trivial (spring force); through extended Lagrangian, or calculated explicitly
init_feature(f_cv_total_force, "total force", f_type_dynamic); init_feature(f_cv_total_force, "total_force", f_type_dynamic);
require_feature_alt(f_cv_total_force, f_cv_extended_Lagrangian, f_cv_total_force_calc); require_feature_alt(f_cv_total_force, f_cv_extended_Lagrangian, f_cv_total_force_calc);
// Deps for explicit total force calculation // Deps for explicit total force calculation
init_feature(f_cv_total_force_calc, "total force calculation", f_type_dynamic); init_feature(f_cv_total_force_calc, "total_force_calculation", f_type_dynamic);
require_feature_self(f_cv_total_force_calc, f_cv_scalar); require_feature_self(f_cv_total_force_calc, f_cv_scalar);
require_feature_self(f_cv_total_force_calc, f_cv_linear); require_feature_self(f_cv_total_force_calc, f_cv_linear);
require_feature_children(f_cv_total_force_calc, f_cvc_inv_gradient); require_feature_children(f_cv_total_force_calc, f_cvc_inv_gradient);
require_feature_self(f_cv_total_force_calc, f_cv_Jacobian); require_feature_self(f_cv_total_force_calc, f_cv_Jacobian);
init_feature(f_cv_Jacobian, "Jacobian derivative", f_type_dynamic); init_feature(f_cv_Jacobian, "Jacobian_derivative", f_type_dynamic);
require_feature_self(f_cv_Jacobian, f_cv_scalar); require_feature_self(f_cv_Jacobian, f_cv_scalar);
require_feature_self(f_cv_Jacobian, f_cv_linear); require_feature_self(f_cv_Jacobian, f_cv_linear);
require_feature_children(f_cv_Jacobian, f_cvc_Jacobian); require_feature_children(f_cv_Jacobian, f_cvc_Jacobian);
init_feature(f_cv_hide_Jacobian, "hide Jacobian force", f_type_user); init_feature(f_cv_hide_Jacobian, "hide_Jacobian_force", f_type_user);
require_feature_self(f_cv_hide_Jacobian, f_cv_Jacobian); // can only hide if calculated require_feature_self(f_cv_hide_Jacobian, f_cv_Jacobian); // can only hide if calculated
init_feature(f_cv_extended_Lagrangian, "extended Lagrangian", f_type_user); init_feature(f_cv_extended_Lagrangian, "extended_Lagrangian", f_type_user);
require_feature_self(f_cv_extended_Lagrangian, f_cv_scalar); require_feature_self(f_cv_extended_Lagrangian, f_cv_scalar);
require_feature_self(f_cv_extended_Lagrangian, f_cv_gradient); require_feature_self(f_cv_extended_Lagrangian, f_cv_gradient);
init_feature(f_cv_Langevin, "Langevin dynamics", f_type_user); init_feature(f_cv_Langevin, "Langevin_dynamics", f_type_user);
require_feature_self(f_cv_Langevin, f_cv_extended_Lagrangian); require_feature_self(f_cv_Langevin, f_cv_extended_Lagrangian);
init_feature(f_cv_single_cvc, "single component", f_type_static); init_feature(f_cv_single_cvc, "single_component", f_type_static);
init_feature(f_cv_linear, "linear", f_type_static); init_feature(f_cv_linear, "linear", f_type_static);
init_feature(f_cv_scalar, "scalar", f_type_static); init_feature(f_cv_scalar, "scalar", f_type_static);
init_feature(f_cv_output_energy, "output energy", f_type_user); init_feature(f_cv_output_energy, "output_energy", f_type_user);
init_feature(f_cv_output_value, "output value", f_type_user); init_feature(f_cv_output_value, "output_value", f_type_user);
init_feature(f_cv_output_velocity, "output velocity", f_type_user); init_feature(f_cv_output_velocity, "output_velocity", f_type_user);
require_feature_self(f_cv_output_velocity, f_cv_fdiff_velocity); require_feature_self(f_cv_output_velocity, f_cv_fdiff_velocity);
init_feature(f_cv_output_applied_force, "output applied force", f_type_user); init_feature(f_cv_output_applied_force, "output_applied_force", f_type_user);
init_feature(f_cv_output_total_force, "output total force", f_type_user); init_feature(f_cv_output_total_force, "output_total_force", f_type_user);
require_feature_self(f_cv_output_total_force, f_cv_total_force); require_feature_self(f_cv_output_total_force, f_cv_total_force);
init_feature(f_cv_subtract_applied_force, "subtract applied force from total force", f_type_user); init_feature(f_cv_subtract_applied_force, "subtract_applied_force_from_total_force", f_type_user);
require_feature_self(f_cv_subtract_applied_force, f_cv_total_force); require_feature_self(f_cv_subtract_applied_force, f_cv_total_force);
init_feature(f_cv_lower_boundary, "lower boundary", f_type_user); init_feature(f_cv_lower_boundary, "lower_boundary", f_type_user);
require_feature_self(f_cv_lower_boundary, f_cv_scalar); require_feature_self(f_cv_lower_boundary, f_cv_scalar);
init_feature(f_cv_upper_boundary, "upper boundary", f_type_user); init_feature(f_cv_upper_boundary, "upper_boundary", f_type_user);
require_feature_self(f_cv_upper_boundary, f_cv_scalar); require_feature_self(f_cv_upper_boundary, f_cv_scalar);
init_feature(f_cv_hard_lower_boundary, "hard lower boundary", f_type_user); init_feature(f_cv_hard_lower_boundary, "hard_lower_boundary", f_type_user);
require_feature_self(f_cv_hard_lower_boundary, f_cv_lower_boundary); require_feature_self(f_cv_hard_lower_boundary, f_cv_lower_boundary);
init_feature(f_cv_hard_upper_boundary, "hard upper boundary", f_type_user); init_feature(f_cv_hard_upper_boundary, "hard_upper_boundary", f_type_user);
require_feature_self(f_cv_hard_upper_boundary, f_cv_upper_boundary); require_feature_self(f_cv_hard_upper_boundary, f_cv_upper_boundary);
init_feature(f_cv_reflecting_lower_boundary, "reflecting_lower_boundary", f_type_user);
require_feature_self(f_cv_reflecting_lower_boundary, f_cv_lower_boundary);
require_feature_self(f_cv_reflecting_lower_boundary, f_cv_extended_Lagrangian);
init_feature(f_cv_reflecting_upper_boundary, "reflecting_upper_boundary", f_type_user);
require_feature_self(f_cv_reflecting_upper_boundary, f_cv_upper_boundary);
require_feature_self(f_cv_reflecting_upper_boundary, f_cv_extended_Lagrangian);
init_feature(f_cv_grid, "grid", f_type_dynamic); init_feature(f_cv_grid, "grid", f_type_dynamic);
require_feature_self(f_cv_grid, f_cv_lower_boundary); require_feature_self(f_cv_grid, f_cv_lower_boundary);
require_feature_self(f_cv_grid, f_cv_upper_boundary); require_feature_self(f_cv_grid, f_cv_upper_boundary);
init_feature(f_cv_runave, "running average", f_type_user); init_feature(f_cv_runave, "running_average", f_type_user);
init_feature(f_cv_corrfunc, "correlation function", f_type_user); init_feature(f_cv_corrfunc, "correlation_function", f_type_user);
init_feature(f_cv_scripted, "scripted", f_type_user); init_feature(f_cv_scripted, "scripted", f_type_user);
init_feature(f_cv_custom_function, "custom function", f_type_user); init_feature(f_cv_custom_function, "custom_function", f_type_user);
exclude_feature_self(f_cv_custom_function, f_cv_scripted); exclude_feature_self(f_cv_custom_function, f_cv_scripted);
init_feature(f_cv_periodic, "periodic", f_type_static); init_feature(f_cv_periodic, "periodic", f_type_static);
@ -1129,7 +1142,7 @@ int colvar::init_dependencies() {
// because total forces are obtained from the previous time step, // because total forces are obtained from the previous time step,
// we cannot (currently) have colvar values and total forces for the same timestep // we cannot (currently) have colvar values and total forces for the same timestep
init_feature(f_cv_multiple_ts, "multiple timestep colvar", f_type_static); init_feature(f_cv_multiple_ts, "multiple_timestep", f_type_static);
exclude_feature_self(f_cv_multiple_ts, f_cv_total_force_calc); exclude_feature_self(f_cv_multiple_ts, f_cv_total_force_calc);
// check that everything is initialized // check that everything is initialized
@ -1199,8 +1212,17 @@ colvar::~colvar()
(*ci)->remove_all_children(); (*ci)->remove_all_children();
delete *ci; delete *ci;
} }
cvcs.clear();
// remove reference to this colvar from the CVM while (biases.size() > 0) {
size_t const i = biases.size()-1;
cvm::log("Warning: before deleting colvar " + name
+ ", deleting related bias " + biases[i]->name);
delete biases[i];
}
biases.clear();
// remove reference to this colvar from the module
colvarmodule *cv = cvm::main(); colvarmodule *cv = cvm::main();
for (std::vector<colvar *>::iterator cvi = cv->variables()->begin(); for (std::vector<colvar *>::iterator cvi = cv->variables()->begin();
cvi != cv->variables()->end(); cvi != cv->variables()->end();
@ -1211,6 +1233,8 @@ colvar::~colvar()
} }
} }
cv->config_changed();
#ifdef LEPTON #ifdef LEPTON
for (std::vector<Lepton::CompiledExpression *>::iterator cei = value_evaluators.begin(); for (std::vector<Lepton::CompiledExpression *>::iterator cei = value_evaluators.begin();
cei != value_evaluators.end(); cei != value_evaluators.end();
@ -1599,6 +1623,15 @@ int colvar::calc_colvar_properties()
// just calculated from the cvcs // just calculated from the cvcs
if ((cvm::step_relative() == 0 && !after_restart) || x_ext.type() == colvarvalue::type_notset) { if ((cvm::step_relative() == 0 && !after_restart) || x_ext.type() == colvarvalue::type_notset) {
x_ext = x; x_ext = x;
if (is_enabled(f_cv_reflecting_lower_boundary) && x_ext < lower_boundary) {
cvm::log("Warning: initializing extended coordinate to reflective lower boundary, as colvar value is below.");
x_ext = lower_boundary;
}
if (is_enabled(f_cv_reflecting_upper_boundary) && x_ext > upper_boundary) {
cvm::log("Warning: initializing extended coordinate to reflective upper boundary, as colvar value is above.");
x_ext = upper_boundary;
}
v_ext.reset(); // (already 0; added for clarity) v_ext.reset(); // (already 0; added for clarity)
} }
@ -1672,10 +1705,10 @@ cvm::real colvar::update_forces_energy()
cvm::log("Updating extended-Lagrangian degree of freedom.\n"); cvm::log("Updating extended-Lagrangian degree of freedom.\n");
} }
if (prev_timestep > -1) { if (prev_timestep > -1L) {
// Keep track of slow timestep to integrate MTS colvars // Keep track of slow timestep to integrate MTS colvars
// the colvar checks the interval after waking up twice // the colvar checks the interval after waking up twice
int n_timesteps = cvm::step_relative() - prev_timestep; cvm::step_number n_timesteps = cvm::step_relative() - prev_timestep;
if (n_timesteps != 0 && n_timesteps != time_step_factor) { if (n_timesteps != 0 && n_timesteps != time_step_factor) {
cvm::error("Error: extended-Lagrangian " + description + " has timeStepFactor " + cvm::error("Error: extended-Lagrangian " + description + " has timeStepFactor " +
cvm::to_str(time_step_factor) + ", but was activated after " + cvm::to_str(n_timesteps) + cvm::to_str(time_step_factor) + ", but was activated after " + cvm::to_str(n_timesteps) +
@ -1737,6 +1770,14 @@ cvm::real colvar::update_forces_energy()
} }
v_ext += (0.5 * dt) * f_ext / ext_mass; v_ext += (0.5 * dt) * f_ext / ext_mass;
x_ext += dt * v_ext; x_ext += dt * v_ext;
cvm::real delta = 0; // Length of overshoot past either reflecting boundary
if ((is_enabled(f_cv_reflecting_lower_boundary) && (delta = x_ext - lower_boundary) < 0) ||
(is_enabled(f_cv_reflecting_upper_boundary) && (delta = x_ext - upper_boundary) > 0)) {
x_ext -= 2.0 * delta;
v_ext *= -1.0;
}
x_ext.apply_constraints(); x_ext.apply_constraints();
this->wrap(x_ext); this->wrap(x_ext);
} else { } else {
@ -2082,7 +2123,7 @@ void colvar::wrap(colvarvalue &x_unwrapped) const
std::istream & colvar::read_state(std::istream &is) std::istream & colvar::read_state(std::istream &is)
{ {
size_t const start_pos = is.tellg(); std::streampos const start_pos = is.tellg();
std::string conf; std::string conf;
if ( !(is >> colvarparse::read_block("colvar", &conf)) ) { if ( !(is >> colvarparse::read_block("colvar", &conf)) ) {
@ -2163,7 +2204,7 @@ std::istream & colvar::read_state(std::istream &is)
std::istream & colvar::read_traj(std::istream &is) std::istream & colvar::read_traj(std::istream &is)
{ {
size_t const start_pos = is.tellg(); std::streampos const start_pos = is.tellg();
if (is_enabled(f_cv_output_value)) { if (is_enabled(f_cv_output_value)) {

Some files were not shown because too many files have changed in this diff Show More