diff --git a/cmake/Modules/Packages/COLVARS.cmake b/cmake/Modules/Packages/COLVARS.cmake index da5b685536..2a29553a67 100644 --- a/cmake/Modules/Packages/COLVARS.cmake +++ b/cmake/Modules/Packages/COLVARS.cmake @@ -8,13 +8,9 @@ option(COLVARS_DEBUG "Debugging messages for Colvars (quite verbose)" OFF) option(COLVARS_LEPTON "Build and link the Lepton library" ON) if(COLVARS_LEPTON) - set(LEPTON_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars/lepton) - file(GLOB LEPTON_SOURCES ${LEPTON_DIR}/src/[^.]*.cpp) - add_library(lepton STATIC ${LEPTON_SOURCES}) - # Change the define below to LEPTON_BUILDING_SHARED_LIBRARY when linking Lepton as a DLL with MSVC - target_compile_definitions(lepton PRIVATE -DLEPTON_BUILDING_STATIC_LIBRARY) - set_target_properties(lepton PROPERTIES OUTPUT_NAME lammps_lepton${LAMMPS_MACHINE}) - target_include_directories(lepton PRIVATE ${LEPTON_DIR}/include) + if(NOT LEPTON_SOURCE_DIR) + include(Packages/LEPTON) + endif() endif() add_library(colvars STATIC ${COLVARS_SOURCES}) @@ -35,9 +31,6 @@ if(COLVARS_DEBUG) endif() if(COLVARS_LEPTON) - target_link_libraries(lammps PRIVATE lepton) target_compile_definitions(colvars PRIVATE -DLEPTON) - # Disable the line below when linking Lepton as a DLL with MSVC - target_compile_definitions(colvars PRIVATE -DLEPTON_USE_STATIC_LIBRARIES) - target_include_directories(colvars PUBLIC ${LEPTON_DIR}/include) + target_link_libraries(colvars PRIVATE lepton) endif() diff --git a/cmake/Modules/Packages/LEPTON.cmake b/cmake/Modules/Packages/LEPTON.cmake index a40047bae0..df8a201c6b 100644 --- a/cmake/Modules/Packages/LEPTON.cmake +++ b/cmake/Modules/Packages/LEPTON.cmake @@ -1,3 +1,7 @@ +# avoid including this file twice +if(LEPTON_SOURCE_DIR) + return() +endif() set(LEPTON_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/lepton) file(GLOB LEPTON_SOURCES ${LEPTON_SOURCE_DIR}/src/[^.]*.cpp) @@ -14,18 +18,18 @@ if(LEPTON_ENABLE_JIT) file(GLOB ASMJIT_SOURCES ${LEPTON_SOURCE_DIR}/asmjit/*/[^.]*.cpp) endif() -add_library(lmplepton STATIC ${LEPTON_SOURCES} ${ASMJIT_SOURCES}) -set_target_properties(lmplepton PROPERTIES OUTPUT_NAME lammps_lmplepton${LAMMPS_MACHINE}) -target_compile_definitions(lmplepton PUBLIC LEPTON_BUILDING_STATIC_LIBRARY=1) -target_include_directories(lmplepton PUBLIC ${LEPTON_SOURCE_DIR}/include) +add_library(lepton STATIC ${LEPTON_SOURCES} ${ASMJIT_SOURCES}) +set_target_properties(lepton PROPERTIES OUTPUT_NAME lammps_lepton${LAMMPS_MACHINE}) +target_compile_definitions(lepton PUBLIC LEPTON_BUILDING_STATIC_LIBRARY=1) +target_include_directories(lepton PUBLIC ${LEPTON_SOURCE_DIR}/include) if(CMAKE_SYSTEM_NAME STREQUAL "Linux") find_library(LIB_RT rt QUIET) - target_link_libraries(lmplepton PUBLIC ${LIB_RT}) + target_link_libraries(lepton PUBLIC ${LIB_RT}) endif() if(LEPTON_ENABLE_JIT) - target_compile_definitions(lmplepton PUBLIC "LEPTON_USE_JIT=1;ASMJIT_BUILD_X86=1;ASMJIT_STATIC=1;ASMJIT_BUILD_RELEASE=1") - target_include_directories(lmplepton PUBLIC ${LEPTON_SOURCE_DIR}) + target_compile_definitions(lepton PUBLIC "LEPTON_USE_JIT=1;ASMJIT_BUILD_X86=1;ASMJIT_STATIC=1;ASMJIT_BUILD_RELEASE=1") + target_include_directories(lepton PUBLIC ${LEPTON_SOURCE_DIR}) endif() -target_link_libraries(lammps PRIVATE lmplepton) +target_link_libraries(lammps PRIVATE lepton) diff --git a/lib/lepton/Common.mk b/lib/lepton/Common.mk index 40fecc9368..4dc2b95d94 100644 --- a/lib/lepton/Common.mk +++ b/lib/lepton/Common.mk @@ -89,7 +89,7 @@ EXTRAMAKE=Makefile.lammps.empty INC=-I include DEF=-DLEPTON_BUILDING_STATIC_LIBRARY=1 -LIB=liblmplepton.a +LIB=liblepton.a ifeq ($(ENABLE_JIT),1) OBJ += $(JITOBJ) diff --git a/lib/lepton/Install.py b/lib/lepton/Install.py index e3b1b836e1..84ac16b0d0 100755 --- a/lib/lepton/Install.py +++ b/lib/lepton/Install.py @@ -51,7 +51,7 @@ if not os.path.exists("Makefile.%s" % machine): # make the library with parallel make n_cpus = get_cpus() -print("Building liblmp%s.a ..." % lib) +print("Building lib%s.a ..." % lib) cmd = "make -f Makefile.%s clean; make -f Makefile.%s -j%d" % (machine, machine, n_cpus) try: txt = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT) @@ -60,10 +60,10 @@ except subprocess.CalledProcessError as e: print("Make failed with:\n %s" % e.output.decode('UTF-8')) sys.exit(1) -if os.path.exists("liblmp%s.a" % lib): +if os.path.exists("lib%s.a" % lib): print("Build was successful") else: - sys.exit("Build of lib/%s/liblmp%s.a was NOT successful" % (lib, lib)) + sys.exit("Build of lib/%s/lib%s.a was NOT successful" % (lib, lib)) if not os.path.exists("Makefile.lammps"): print("WARNING: lib/%s/Makefile.lammps was NOT created" % lib) diff --git a/lib/lepton/include/LMP_Lepton.h b/lib/lepton/include/Lepton.h similarity index 100% rename from lib/lepton/include/LMP_Lepton.h rename to lib/lepton/include/Lepton.h diff --git a/lib/lepton/include/lepton/CompiledExpression.h b/lib/lepton/include/lepton/CompiledExpression.h index 6c940e081c..82d66d5c6a 100644 --- a/lib/lepton/include/lepton/CompiledExpression.h +++ b/lib/lepton/include/lepton/CompiledExpression.h @@ -47,7 +47,7 @@ #endif #endif -namespace LMP_Lepton { +namespace Lepton { class Operation; class ParsedExpression; @@ -119,6 +119,6 @@ private: #endif }; -} // namespace LMP_Lepton +} // namespace Lepton #endif /*LEPTON_COMPILED_EXPRESSION_H_*/ diff --git a/lib/lepton/include/lepton/CompiledVectorExpression.h b/lib/lepton/include/lepton/CompiledVectorExpression.h index e097e3eae1..ea3586f1b0 100644 --- a/lib/lepton/include/lepton/CompiledVectorExpression.h +++ b/lib/lepton/include/lepton/CompiledVectorExpression.h @@ -48,7 +48,7 @@ #endif #endif -namespace LMP_Lepton { +namespace Lepton { class Operation; class ParsedExpression; @@ -140,6 +140,6 @@ private: #endif }; -} // namespace LMP_Lepton +} // namespace Lepton #endif /*LEPTON_VECTOR_EXPRESSION_H_*/ diff --git a/lib/lepton/include/lepton/CustomFunction.h b/lib/lepton/include/lepton/CustomFunction.h index 4b8121a87f..cbfff26637 100644 --- a/lib/lepton/include/lepton/CustomFunction.h +++ b/lib/lepton/include/lepton/CustomFunction.h @@ -34,7 +34,7 @@ #include "windowsIncludes.h" -namespace LMP_Lepton { +namespace Lepton { /** * This class is the interface for defining your own function that may be included in expressions. @@ -104,6 +104,6 @@ private: int numArgs; }; -} // namespace LMP_Lepton +} // namespace Lepton #endif /*LEPTON_CUSTOM_FUNCTION_H_*/ diff --git a/lib/lepton/include/lepton/Exception.h b/lib/lepton/include/lepton/Exception.h index 413b08f52e..5ad55714d1 100644 --- a/lib/lepton/include/lepton/Exception.h +++ b/lib/lepton/include/lepton/Exception.h @@ -35,7 +35,7 @@ #include #include -namespace LMP_Lepton { +namespace Lepton { /** * This class is used for all exceptions thrown by Lepton. @@ -54,6 +54,6 @@ private: std::string message; }; -} // namespace LMP_Lepton +} // namespace Lepton #endif /*LEPTON_EXCEPTION_H_*/ diff --git a/lib/lepton/include/lepton/ExpressionProgram.h b/lib/lepton/include/lepton/ExpressionProgram.h index 3737cf8082..a49a9094d0 100644 --- a/lib/lepton/include/lepton/ExpressionProgram.h +++ b/lib/lepton/include/lepton/ExpressionProgram.h @@ -38,7 +38,7 @@ #include #include -namespace LMP_Lepton { +namespace Lepton { class ParsedExpression; @@ -98,6 +98,6 @@ private: int maxArgs, stackSize; }; -} // namespace LMP_Lepton +} // namespace Lepton #endif /*LEPTON_EXPRESSION_PROGRAM_H_*/ diff --git a/lib/lepton/include/lepton/ExpressionTreeNode.h b/lib/lepton/include/lepton/ExpressionTreeNode.h index eba791fbaa..dde26103cb 100644 --- a/lib/lepton/include/lepton/ExpressionTreeNode.h +++ b/lib/lepton/include/lepton/ExpressionTreeNode.h @@ -36,7 +36,7 @@ #include #include -namespace LMP_Lepton { +namespace Lepton { class Operation; class ParsedExpression; @@ -106,6 +106,6 @@ private: mutable int tag; }; -} // namespace LMP_Lepton +} // namespace Lepton #endif /*LEPTON_EXPRESSION_TREE_NODE_H_*/ diff --git a/lib/lepton/include/lepton/Operation.h b/lib/lepton/include/lepton/Operation.h index bde9cfe37f..165a56b332 100644 --- a/lib/lepton/include/lepton/Operation.h +++ b/lib/lepton/include/lepton/Operation.h @@ -42,7 +42,7 @@ #include #include -namespace LMP_Lepton { +namespace Lepton { class ExpressionTreeNode; @@ -1188,6 +1188,6 @@ public: ExpressionTreeNode differentiate(const std::vector& children, const std::vector& childDerivs, const std::string& variable) const; }; -} // namespace LMP_Lepton +} // namespace Lepton #endif /*LEPTON_OPERATION_H_*/ diff --git a/lib/lepton/include/lepton/ParsedExpression.h b/lib/lepton/include/lepton/ParsedExpression.h index 05081f677c..e2a7572c4a 100644 --- a/lib/lepton/include/lepton/ParsedExpression.h +++ b/lib/lepton/include/lepton/ParsedExpression.h @@ -37,7 +37,7 @@ #include #include -namespace LMP_Lepton { +namespace Lepton { class CompiledExpression; class ExpressionProgram; @@ -137,6 +137,6 @@ LEPTON_EXPORT std::ostream& operator<<(std::ostream& out, const ExpressionTreeNo LEPTON_EXPORT std::ostream& operator<<(std::ostream& out, const ParsedExpression& exp); -} // namespace LMP_Lepton +} // namespace Lepton #endif /*LEPTON_PARSED_EXPRESSION_H_*/ diff --git a/lib/lepton/include/lepton/Parser.h b/lib/lepton/include/lepton/Parser.h index 9eefe3f59e..63d5988d5f 100644 --- a/lib/lepton/include/lepton/Parser.h +++ b/lib/lepton/include/lepton/Parser.h @@ -37,7 +37,7 @@ #include #include -namespace LMP_Lepton { +namespace Lepton { class CustomFunction; class ExpressionTreeNode; @@ -72,6 +72,6 @@ private: static Operation* getFunctionOperation(const std::string& name, const std::map& customFunctions); }; -} // namespace LMP_Lepton +} // namespace Lepton #endif /*LEPTON_PARSER_H_*/ diff --git a/lib/lepton/src/CompiledExpression.cpp b/lib/lepton/src/CompiledExpression.cpp index b85c3a08f7..61dd942c62 100644 --- a/lib/lepton/src/CompiledExpression.cpp +++ b/lib/lepton/src/CompiledExpression.cpp @@ -34,7 +34,7 @@ #include "lepton/ParsedExpression.h" #include -using namespace LMP_Lepton; +using namespace Lepton; using namespace std; #ifdef LEPTON_USE_JIT using namespace asmjit; diff --git a/lib/lepton/src/CompiledVectorExpression.cpp b/lib/lepton/src/CompiledVectorExpression.cpp index 7e4dfcad9c..c8262b3873 100644 --- a/lib/lepton/src/CompiledVectorExpression.cpp +++ b/lib/lepton/src/CompiledVectorExpression.cpp @@ -35,7 +35,7 @@ #include #include -using namespace LMP_Lepton; +using namespace Lepton; using namespace std; #ifdef LEPTON_USE_JIT using namespace asmjit; diff --git a/lib/lepton/src/ExpressionProgram.cpp b/lib/lepton/src/ExpressionProgram.cpp index 74c545287b..bbbae8533f 100644 --- a/lib/lepton/src/ExpressionProgram.cpp +++ b/lib/lepton/src/ExpressionProgram.cpp @@ -33,7 +33,7 @@ #include "lepton/Operation.h" #include "lepton/ParsedExpression.h" -using namespace LMP_Lepton; +using namespace Lepton; using namespace std; ExpressionProgram::ExpressionProgram() : maxArgs(0), stackSize(0) { diff --git a/lib/lepton/src/ExpressionTreeNode.cpp b/lib/lepton/src/ExpressionTreeNode.cpp index 3b34a0a1c0..758515b123 100644 --- a/lib/lepton/src/ExpressionTreeNode.cpp +++ b/lib/lepton/src/ExpressionTreeNode.cpp @@ -34,7 +34,7 @@ #include "lepton/Operation.h" #include -using namespace LMP_Lepton; +using namespace Lepton; using namespace std; ExpressionTreeNode::ExpressionTreeNode(Operation* operation, const vector& children) : operation(operation), children(children) { diff --git a/lib/lepton/src/Operation.cpp b/lib/lepton/src/Operation.cpp index 08deff8584..8bddc8d1c8 100644 --- a/lib/lepton/src/Operation.cpp +++ b/lib/lepton/src/Operation.cpp @@ -34,7 +34,7 @@ #include "lepton/ExpressionTreeNode.h" #include "MSVC_erfc.h" -using namespace LMP_Lepton; +using namespace Lepton; using namespace std; static bool isZero(const ExpressionTreeNode& node) { diff --git a/lib/lepton/src/ParsedExpression.cpp b/lib/lepton/src/ParsedExpression.cpp index a6f41ae354..6a9df8097a 100644 --- a/lib/lepton/src/ParsedExpression.cpp +++ b/lib/lepton/src/ParsedExpression.cpp @@ -37,7 +37,7 @@ #include #include -using namespace LMP_Lepton; +using namespace Lepton; using namespace std; ParsedExpression::ParsedExpression() : rootNode(ExpressionTreeNode()) { @@ -402,7 +402,7 @@ ExpressionTreeNode ParsedExpression::renameNodeVariables(const ExpressionTreeNod return ExpressionTreeNode(node.getOperation().clone(), children); } -ostream& LMP_Lepton::operator<<(ostream& out, const ExpressionTreeNode& node) { +ostream& Lepton::operator<<(ostream& out, const ExpressionTreeNode& node) { if (node.getOperation().isInfixOperator() && node.getChildren().size() == 2) { out << "(" << node.getChildren()[0] << ")" << node.getOperation().getName() << "(" << node.getChildren()[1] << ")"; } @@ -424,7 +424,7 @@ ostream& LMP_Lepton::operator<<(ostream& out, const ExpressionTreeNode& node) { return out; } -ostream& LMP_Lepton::operator<<(ostream& out, const ParsedExpression& exp) { +ostream& Lepton::operator<<(ostream& out, const ParsedExpression& exp) { out << exp.getRootNode(); return out; } diff --git a/lib/lepton/src/Parser.cpp b/lib/lepton/src/Parser.cpp index d094b8e4e4..2829b443b6 100644 --- a/lib/lepton/src/Parser.cpp +++ b/lib/lepton/src/Parser.cpp @@ -38,7 +38,7 @@ #include #include -using namespace LMP_Lepton; +using namespace Lepton; using namespace std; static const string Digits = "0123456789"; @@ -47,7 +47,7 @@ static const bool LeftAssociative[] = {true, true, true, true, false}; static const int Precedence[] = {0, 0, 1, 1, 3}; static const Operation::Id OperationId[] = {Operation::ADD, Operation::SUBTRACT, Operation::MULTIPLY, Operation::DIVIDE, Operation::POWER}; -class LMP_Lepton::ParseToken { +class Lepton::ParseToken { public: enum Type {Number, Operator, Variable, Function, LeftParen, RightParen, Comma, Whitespace}; diff --git a/src/LEPTON/Install.sh b/src/LEPTON/Install.sh index b7e80c9d1c..6696d0c776 100755 --- a/src/LEPTON/Install.sh +++ b/src/LEPTON/Install.sh @@ -40,7 +40,7 @@ if (test $1 = 1) then sed -i -e 's/[^ \t]*lepton[^ \t]* //g' ../Makefile.package sed -i -e 's|^PKG_INC =[ \t]*|&-I..\/..\/lib\/lepton\/include -I..\/..\/lib\/lepton |' ../Makefile.package sed -i -e 's|^PKG_PATH =[ \t]*|&-L..\/..\/lib\/lepton$(LIBOBJDIR) |' ../Makefile.package - sed -i -e 's|^PKG_LIB =[ \t]*|&-llmplepton |' ../Makefile.package + sed -i -e 's|^PKG_LIB =[ \t]*|&-llepton |' ../Makefile.package sed -i -e 's|^PKG_SYSINC =[ \t]*|&$(lepton_SYSINC) |' ../Makefile.package sed -i -e 's|^PKG_SYSLIB =[ \t]*|&$(lepton_SYSLIB) |' ../Makefile.package sed -i -e 's|^PKG_SYSPATH =[ \t]*|&$(lepton_SYSPATH) |' ../Makefile.package diff --git a/src/LEPTON/angle_lepton.cpp b/src/LEPTON/angle_lepton.cpp index 8893b422f1..e985509b1f 100644 --- a/src/LEPTON/angle_lepton.cpp +++ b/src/LEPTON/angle_lepton.cpp @@ -28,7 +28,7 @@ #include -#include "LMP_Lepton.h" +#include "Lepton.h" #include "lepton_utils.h" using namespace LAMMPS_NS; @@ -88,10 +88,10 @@ void AngleLepton::compute(int eflag, int vflag) template void AngleLepton::eval() { - std::vector angleforce; - std::vector anglepot; + std::vector angleforce; + std::vector anglepot; for (const auto &expr : expressions) { - auto parsed = LMP_Lepton::Parser::parse(LeptonUtils::substitute(expr, lmp)); + auto parsed = Lepton::Parser::parse(LeptonUtils::substitute(expr, lmp)); angleforce.emplace_back(parsed.differentiate("theta").createCompiledExpression()); if (EFLAG) anglepot.emplace_back(parsed.createCompiledExpression()); } @@ -221,7 +221,7 @@ void AngleLepton::coeff(int narg, char **arg) std::string exp_one = LeptonUtils::condense(arg[2]); double offset_one = 0.0; try { - auto parsed = LMP_Lepton::Parser::parse(LeptonUtils::substitute(exp_one, lmp)); + auto parsed = Lepton::Parser::parse(LeptonUtils::substitute(exp_one, lmp)); auto anglepot = parsed.createCompiledExpression(); auto angleforce = parsed.differentiate("theta").createCompiledExpression(); anglepot.getVariableReference("theta") = 0.0; @@ -361,7 +361,7 @@ double AngleLepton::single(int type, int i1, int i2, int i3) double dtheta = acos(c) - theta0[type]; auto expr = expressions[type2expression[type]]; - auto parsed = LMP_Lepton::Parser::parse(LeptonUtils::substitute(expr, lmp)); + auto parsed = Lepton::Parser::parse(LeptonUtils::substitute(expr, lmp)); auto anglepot = parsed.createCompiledExpression(); anglepot.getVariableReference("theta") = dtheta; return anglepot.evaluate() - offset[type]; diff --git a/src/LEPTON/bond_lepton.cpp b/src/LEPTON/bond_lepton.cpp index 7ac999c5b2..4a168902b8 100644 --- a/src/LEPTON/bond_lepton.cpp +++ b/src/LEPTON/bond_lepton.cpp @@ -26,7 +26,7 @@ #include -#include "LMP_Lepton.h" +#include "Lepton.h" #include "lepton_utils.h" using namespace LAMMPS_NS; @@ -80,11 +80,11 @@ void BondLepton::compute(int eflag, int vflag) /* ---------------------------------------------------------------------- */ template void BondLepton::eval() { - std::vector bondforce; - std::vector bondpot; + std::vector bondforce; + std::vector bondpot; try { for (const auto &expr : expressions) { - auto parsed = LMP_Lepton::Parser::parse(LeptonUtils::substitute(expr, lmp)); + auto parsed = Lepton::Parser::parse(LeptonUtils::substitute(expr, lmp)); bondforce.emplace_back(parsed.differentiate("r").createCompiledExpression()); if (EFLAG) bondpot.emplace_back(parsed.createCompiledExpression()); } @@ -176,7 +176,7 @@ void BondLepton::coeff(int narg, char **arg) std::string exp_one = LeptonUtils::condense(arg[2]); double offset_one = 0.0; try { - auto parsed = LMP_Lepton::Parser::parse(LeptonUtils::substitute(exp_one, lmp)); + auto parsed = Lepton::Parser::parse(LeptonUtils::substitute(exp_one, lmp)); auto bondpot = parsed.createCompiledExpression(); auto bondforce = parsed.differentiate("r").createCompiledExpression(); bondpot.getVariableReference("r") = 0.0; @@ -299,7 +299,7 @@ double BondLepton::single(int type, double rsq, int /*i*/, int /*j*/, double &ff const double dr = r - r0[type]; auto expr = expressions[type2expression[type]]; - auto parsed = LMP_Lepton::Parser::parse(LeptonUtils::substitute(expr, lmp)); + auto parsed = Lepton::Parser::parse(LeptonUtils::substitute(expr, lmp)); auto bondpot = parsed.createCompiledExpression(); auto bondforce = parsed.differentiate("r").createCompiledExpression(); bondforce.getVariableReference("r") = dr; diff --git a/src/LEPTON/dihedral_lepton.cpp b/src/LEPTON/dihedral_lepton.cpp index acd0a4574d..7549d771e0 100644 --- a/src/LEPTON/dihedral_lepton.cpp +++ b/src/LEPTON/dihedral_lepton.cpp @@ -30,7 +30,7 @@ #include -#include "LMP_Lepton.h" +#include "Lepton.h" #include "lepton_utils.h" using namespace LAMMPS_NS; @@ -90,11 +90,11 @@ void DihedralLepton::compute(int eflag, int vflag) template void DihedralLepton::eval() { - std::vector dihedralforce; - std::vector dihedralpot; + std::vector dihedralforce; + std::vector dihedralpot; try { for (const auto &expr : expressions) { - auto parsed = LMP_Lepton::Parser::parse(LeptonUtils::substitute(expr, lmp)); + auto parsed = Lepton::Parser::parse(LeptonUtils::substitute(expr, lmp)); dihedralforce.emplace_back(parsed.differentiate("phi").createCompiledExpression()); if (EFLAG) dihedralpot.emplace_back(parsed.createCompiledExpression()); } @@ -359,7 +359,7 @@ void DihedralLepton::coeff(int narg, char **arg) // check if the expression can be parsed and evaluated without error std::string exp_one = LeptonUtils::condense(arg[1]); try { - auto parsed = LMP_Lepton::Parser::parse(LeptonUtils::substitute(exp_one, lmp)); + auto parsed = Lepton::Parser::parse(LeptonUtils::substitute(exp_one, lmp)); auto dihedralpot = parsed.createCompiledExpression(); auto dihedralforce = parsed.differentiate("phi").createCompiledExpression(); dihedralpot.getVariableReference("phi") = 0.0; diff --git a/src/LEPTON/pair_lepton.cpp b/src/LEPTON/pair_lepton.cpp index bc4e97f2b6..ab23d18368 100644 --- a/src/LEPTON/pair_lepton.cpp +++ b/src/LEPTON/pair_lepton.cpp @@ -25,7 +25,7 @@ #include "neigh_list.h" #include "update.h" -#include "LMP_Lepton.h" +#include "Lepton.h" #include "lepton_utils.h" #include @@ -99,11 +99,11 @@ template void PairLepton::eval() const int *const *const firstneigh = list->firstneigh; double fxtmp, fytmp, fztmp; - std::vector pairforce; - std::vector pairpot; + std::vector pairforce; + std::vector pairpot; try { for (const auto &expr : expressions) { - auto parsed = LMP_Lepton::Parser::parse(LeptonUtils::substitute(expr, lmp)); + auto parsed = Lepton::Parser::parse(LeptonUtils::substitute(expr, lmp)); pairforce.emplace_back(parsed.differentiate("r").createCompiledExpression()); if (EFLAG) pairpot.emplace_back(parsed.createCompiledExpression()); } @@ -215,7 +215,7 @@ void PairLepton::coeff(int narg, char **arg) // check if the expression can be parsed and evaluated without error auto exp_one = LeptonUtils::condense(arg[2]); try { - auto parsed = LMP_Lepton::Parser::parse(LeptonUtils::substitute(exp_one, lmp)); + auto parsed = Lepton::Parser::parse(LeptonUtils::substitute(exp_one, lmp)); auto pairforce = parsed.differentiate("r").createCompiledExpression(); auto pairpot = parsed.createCompiledExpression(); pairpot.getVariableReference("r") = 1.0; @@ -258,7 +258,7 @@ double PairLepton::init_one(int i, int j) if (offset_flag) { try { auto expr = LeptonUtils::substitute(expressions[type2expression[i][j]], lmp); - auto pairpot = LMP_Lepton::Parser::parse(expr).createCompiledExpression(); + auto pairpot = Lepton::Parser::parse(expr).createCompiledExpression(); pairpot.getVariableReference("r") = cut[i][j]; offset[i][j] = pairpot.evaluate(); } catch (std::exception &) { @@ -402,7 +402,7 @@ double PairLepton::single(int /* i */, int /* j */, int itype, int jtype, double double /* factor_coul */, double factor_lj, double &fforce) { auto expr = expressions[type2expression[itype][jtype]]; - auto parsed = LMP_Lepton::Parser::parse(LeptonUtils::substitute(expr, lmp)); + auto parsed = Lepton::Parser::parse(LeptonUtils::substitute(expr, lmp)); auto pairpot = parsed.createCompiledExpression(); auto pairforce = parsed.differentiate("r").createCompiledExpression();