remove lmp/LMP_ prefix from Lepton namespace and files to share it with colvars
This commit is contained in:
@ -8,13 +8,9 @@ option(COLVARS_DEBUG "Debugging messages for Colvars (quite verbose)" OFF)
|
|||||||
option(COLVARS_LEPTON "Build and link the Lepton library" ON)
|
option(COLVARS_LEPTON "Build and link the Lepton library" ON)
|
||||||
|
|
||||||
if(COLVARS_LEPTON)
|
if(COLVARS_LEPTON)
|
||||||
set(LEPTON_DIR ${LAMMPS_LIB_SOURCE_DIR}/colvars/lepton)
|
if(NOT LEPTON_SOURCE_DIR)
|
||||||
file(GLOB LEPTON_SOURCES ${LEPTON_DIR}/src/[^.]*.cpp)
|
include(Packages/LEPTON)
|
||||||
add_library(lepton STATIC ${LEPTON_SOURCES})
|
endif()
|
||||||
# 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)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(colvars STATIC ${COLVARS_SOURCES})
|
add_library(colvars STATIC ${COLVARS_SOURCES})
|
||||||
@ -35,9 +31,6 @@ if(COLVARS_DEBUG)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(COLVARS_LEPTON)
|
if(COLVARS_LEPTON)
|
||||||
target_link_libraries(lammps PRIVATE lepton)
|
|
||||||
target_compile_definitions(colvars PRIVATE -DLEPTON)
|
target_compile_definitions(colvars PRIVATE -DLEPTON)
|
||||||
# Disable the line below when linking Lepton as a DLL with MSVC
|
target_link_libraries(colvars PRIVATE lepton)
|
||||||
target_compile_definitions(colvars PRIVATE -DLEPTON_USE_STATIC_LIBRARIES)
|
|
||||||
target_include_directories(colvars PUBLIC ${LEPTON_DIR}/include)
|
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
|
# avoid including this file twice
|
||||||
|
if(LEPTON_SOURCE_DIR)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
set(LEPTON_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/lepton)
|
set(LEPTON_SOURCE_DIR ${LAMMPS_LIB_SOURCE_DIR}/lepton)
|
||||||
|
|
||||||
file(GLOB LEPTON_SOURCES ${LEPTON_SOURCE_DIR}/src/[^.]*.cpp)
|
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)
|
file(GLOB ASMJIT_SOURCES ${LEPTON_SOURCE_DIR}/asmjit/*/[^.]*.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(lmplepton STATIC ${LEPTON_SOURCES} ${ASMJIT_SOURCES})
|
add_library(lepton STATIC ${LEPTON_SOURCES} ${ASMJIT_SOURCES})
|
||||||
set_target_properties(lmplepton PROPERTIES OUTPUT_NAME lammps_lmplepton${LAMMPS_MACHINE})
|
set_target_properties(lepton PROPERTIES OUTPUT_NAME lammps_lepton${LAMMPS_MACHINE})
|
||||||
target_compile_definitions(lmplepton PUBLIC LEPTON_BUILDING_STATIC_LIBRARY=1)
|
target_compile_definitions(lepton PUBLIC LEPTON_BUILDING_STATIC_LIBRARY=1)
|
||||||
target_include_directories(lmplepton PUBLIC ${LEPTON_SOURCE_DIR}/include)
|
target_include_directories(lepton PUBLIC ${LEPTON_SOURCE_DIR}/include)
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
find_library(LIB_RT rt QUIET)
|
find_library(LIB_RT rt QUIET)
|
||||||
target_link_libraries(lmplepton PUBLIC ${LIB_RT})
|
target_link_libraries(lepton PUBLIC ${LIB_RT})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(LEPTON_ENABLE_JIT)
|
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_compile_definitions(lepton 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_include_directories(lepton PUBLIC ${LEPTON_SOURCE_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(lammps PRIVATE lmplepton)
|
target_link_libraries(lammps PRIVATE lepton)
|
||||||
|
|||||||
@ -89,7 +89,7 @@ EXTRAMAKE=Makefile.lammps.empty
|
|||||||
INC=-I include
|
INC=-I include
|
||||||
DEF=-DLEPTON_BUILDING_STATIC_LIBRARY=1
|
DEF=-DLEPTON_BUILDING_STATIC_LIBRARY=1
|
||||||
|
|
||||||
LIB=liblmplepton.a
|
LIB=liblepton.a
|
||||||
|
|
||||||
ifeq ($(ENABLE_JIT),1)
|
ifeq ($(ENABLE_JIT),1)
|
||||||
OBJ += $(JITOBJ)
|
OBJ += $(JITOBJ)
|
||||||
|
|||||||
@ -51,7 +51,7 @@ if not os.path.exists("Makefile.%s" % machine):
|
|||||||
# make the library with parallel make
|
# make the library with parallel make
|
||||||
n_cpus = get_cpus()
|
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)
|
cmd = "make -f Makefile.%s clean; make -f Makefile.%s -j%d" % (machine, machine, n_cpus)
|
||||||
try:
|
try:
|
||||||
txt = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
|
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'))
|
print("Make failed with:\n %s" % e.output.decode('UTF-8'))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if os.path.exists("liblmp%s.a" % lib):
|
if os.path.exists("lib%s.a" % lib):
|
||||||
print("Build was successful")
|
print("Build was successful")
|
||||||
else:
|
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"):
|
if not os.path.exists("Makefile.lammps"):
|
||||||
print("WARNING: lib/%s/Makefile.lammps was NOT created" % lib)
|
print("WARNING: lib/%s/Makefile.lammps was NOT created" % lib)
|
||||||
|
|||||||
@ -47,7 +47,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace LMP_Lepton {
|
namespace Lepton {
|
||||||
|
|
||||||
class Operation;
|
class Operation;
|
||||||
class ParsedExpression;
|
class ParsedExpression;
|
||||||
@ -119,6 +119,6 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace LMP_Lepton
|
} // namespace Lepton
|
||||||
|
|
||||||
#endif /*LEPTON_COMPILED_EXPRESSION_H_*/
|
#endif /*LEPTON_COMPILED_EXPRESSION_H_*/
|
||||||
|
|||||||
@ -48,7 +48,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace LMP_Lepton {
|
namespace Lepton {
|
||||||
|
|
||||||
class Operation;
|
class Operation;
|
||||||
class ParsedExpression;
|
class ParsedExpression;
|
||||||
@ -140,6 +140,6 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace LMP_Lepton
|
} // namespace Lepton
|
||||||
|
|
||||||
#endif /*LEPTON_VECTOR_EXPRESSION_H_*/
|
#endif /*LEPTON_VECTOR_EXPRESSION_H_*/
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include "windowsIncludes.h"
|
#include "windowsIncludes.h"
|
||||||
|
|
||||||
namespace LMP_Lepton {
|
namespace Lepton {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is the interface for defining your own function that may be included in expressions.
|
* This class is the interface for defining your own function that may be included in expressions.
|
||||||
@ -104,6 +104,6 @@ private:
|
|||||||
int numArgs;
|
int numArgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace LMP_Lepton
|
} // namespace Lepton
|
||||||
|
|
||||||
#endif /*LEPTON_CUSTOM_FUNCTION_H_*/
|
#endif /*LEPTON_CUSTOM_FUNCTION_H_*/
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
#include <exception>
|
#include <exception>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace LMP_Lepton {
|
namespace Lepton {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is used for all exceptions thrown by Lepton.
|
* This class is used for all exceptions thrown by Lepton.
|
||||||
@ -54,6 +54,6 @@ private:
|
|||||||
std::string message;
|
std::string message;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace LMP_Lepton
|
} // namespace Lepton
|
||||||
|
|
||||||
#endif /*LEPTON_EXCEPTION_H_*/
|
#endif /*LEPTON_EXCEPTION_H_*/
|
||||||
|
|||||||
@ -38,7 +38,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace LMP_Lepton {
|
namespace Lepton {
|
||||||
|
|
||||||
class ParsedExpression;
|
class ParsedExpression;
|
||||||
|
|
||||||
@ -98,6 +98,6 @@ private:
|
|||||||
int maxArgs, stackSize;
|
int maxArgs, stackSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace LMP_Lepton
|
} // namespace Lepton
|
||||||
|
|
||||||
#endif /*LEPTON_EXPRESSION_PROGRAM_H_*/
|
#endif /*LEPTON_EXPRESSION_PROGRAM_H_*/
|
||||||
|
|||||||
@ -36,7 +36,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace LMP_Lepton {
|
namespace Lepton {
|
||||||
|
|
||||||
class Operation;
|
class Operation;
|
||||||
class ParsedExpression;
|
class ParsedExpression;
|
||||||
@ -106,6 +106,6 @@ private:
|
|||||||
mutable int tag;
|
mutable int tag;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace LMP_Lepton
|
} // namespace Lepton
|
||||||
|
|
||||||
#endif /*LEPTON_EXPRESSION_TREE_NODE_H_*/
|
#endif /*LEPTON_EXPRESSION_TREE_NODE_H_*/
|
||||||
|
|||||||
@ -42,7 +42,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
namespace LMP_Lepton {
|
namespace Lepton {
|
||||||
|
|
||||||
class ExpressionTreeNode;
|
class ExpressionTreeNode;
|
||||||
|
|
||||||
@ -1188,6 +1188,6 @@ public:
|
|||||||
ExpressionTreeNode differentiate(const std::vector<ExpressionTreeNode>& children, const std::vector<ExpressionTreeNode>& childDerivs, const std::string& variable) const;
|
ExpressionTreeNode differentiate(const std::vector<ExpressionTreeNode>& children, const std::vector<ExpressionTreeNode>& childDerivs, const std::string& variable) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace LMP_Lepton
|
} // namespace Lepton
|
||||||
|
|
||||||
#endif /*LEPTON_OPERATION_H_*/
|
#endif /*LEPTON_OPERATION_H_*/
|
||||||
|
|||||||
@ -37,7 +37,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace LMP_Lepton {
|
namespace Lepton {
|
||||||
|
|
||||||
class CompiledExpression;
|
class CompiledExpression;
|
||||||
class ExpressionProgram;
|
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);
|
LEPTON_EXPORT std::ostream& operator<<(std::ostream& out, const ParsedExpression& exp);
|
||||||
|
|
||||||
} // namespace LMP_Lepton
|
} // namespace Lepton
|
||||||
|
|
||||||
#endif /*LEPTON_PARSED_EXPRESSION_H_*/
|
#endif /*LEPTON_PARSED_EXPRESSION_H_*/
|
||||||
|
|||||||
@ -37,7 +37,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace LMP_Lepton {
|
namespace Lepton {
|
||||||
|
|
||||||
class CustomFunction;
|
class CustomFunction;
|
||||||
class ExpressionTreeNode;
|
class ExpressionTreeNode;
|
||||||
@ -72,6 +72,6 @@ private:
|
|||||||
static Operation* getFunctionOperation(const std::string& name, const std::map<std::string, CustomFunction*>& customFunctions);
|
static Operation* getFunctionOperation(const std::string& name, const std::map<std::string, CustomFunction*>& customFunctions);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace LMP_Lepton
|
} // namespace Lepton
|
||||||
|
|
||||||
#endif /*LEPTON_PARSER_H_*/
|
#endif /*LEPTON_PARSER_H_*/
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
#include "lepton/ParsedExpression.h"
|
#include "lepton/ParsedExpression.h"
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
using namespace LMP_Lepton;
|
using namespace Lepton;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#ifdef LEPTON_USE_JIT
|
#ifdef LEPTON_USE_JIT
|
||||||
using namespace asmjit;
|
using namespace asmjit;
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
using namespace LMP_Lepton;
|
using namespace Lepton;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#ifdef LEPTON_USE_JIT
|
#ifdef LEPTON_USE_JIT
|
||||||
using namespace asmjit;
|
using namespace asmjit;
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
#include "lepton/Operation.h"
|
#include "lepton/Operation.h"
|
||||||
#include "lepton/ParsedExpression.h"
|
#include "lepton/ParsedExpression.h"
|
||||||
|
|
||||||
using namespace LMP_Lepton;
|
using namespace Lepton;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
ExpressionProgram::ExpressionProgram() : maxArgs(0), stackSize(0) {
|
ExpressionProgram::ExpressionProgram() : maxArgs(0), stackSize(0) {
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
#include "lepton/Operation.h"
|
#include "lepton/Operation.h"
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
using namespace LMP_Lepton;
|
using namespace Lepton;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
ExpressionTreeNode::ExpressionTreeNode(Operation* operation, const vector<ExpressionTreeNode>& children) : operation(operation), children(children) {
|
ExpressionTreeNode::ExpressionTreeNode(Operation* operation, const vector<ExpressionTreeNode>& children) : operation(operation), children(children) {
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
#include "lepton/ExpressionTreeNode.h"
|
#include "lepton/ExpressionTreeNode.h"
|
||||||
#include "MSVC_erfc.h"
|
#include "MSVC_erfc.h"
|
||||||
|
|
||||||
using namespace LMP_Lepton;
|
using namespace Lepton;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
static bool isZero(const ExpressionTreeNode& node) {
|
static bool isZero(const ExpressionTreeNode& node) {
|
||||||
|
|||||||
@ -37,7 +37,7 @@
|
|||||||
#include <limits>
|
#include <limits>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
using namespace LMP_Lepton;
|
using namespace Lepton;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
ParsedExpression::ParsedExpression() : rootNode(ExpressionTreeNode()) {
|
ParsedExpression::ParsedExpression() : rootNode(ExpressionTreeNode()) {
|
||||||
@ -402,7 +402,7 @@ ExpressionTreeNode ParsedExpression::renameNodeVariables(const ExpressionTreeNod
|
|||||||
return ExpressionTreeNode(node.getOperation().clone(), children);
|
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) {
|
if (node.getOperation().isInfixOperator() && node.getChildren().size() == 2) {
|
||||||
out << "(" << node.getChildren()[0] << ")" << node.getOperation().getName() << "(" << node.getChildren()[1] << ")";
|
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;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ostream& LMP_Lepton::operator<<(ostream& out, const ParsedExpression& exp) {
|
ostream& Lepton::operator<<(ostream& out, const ParsedExpression& exp) {
|
||||||
out << exp.getRootNode();
|
out << exp.getRootNode();
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,7 +38,7 @@
|
|||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace LMP_Lepton;
|
using namespace Lepton;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
static const string Digits = "0123456789";
|
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 int Precedence[] = {0, 0, 1, 1, 3};
|
||||||
static const Operation::Id OperationId[] = {Operation::ADD, Operation::SUBTRACT, Operation::MULTIPLY, Operation::DIVIDE, Operation::POWER};
|
static const Operation::Id OperationId[] = {Operation::ADD, Operation::SUBTRACT, Operation::MULTIPLY, Operation::DIVIDE, Operation::POWER};
|
||||||
|
|
||||||
class LMP_Lepton::ParseToken {
|
class Lepton::ParseToken {
|
||||||
public:
|
public:
|
||||||
enum Type {Number, Operator, Variable, Function, LeftParen, RightParen, Comma, Whitespace};
|
enum Type {Number, Operator, Variable, Function, LeftParen, RightParen, Comma, Whitespace};
|
||||||
|
|
||||||
|
|||||||
@ -40,7 +40,7 @@ if (test $1 = 1) then
|
|||||||
sed -i -e 's/[^ \t]*lepton[^ \t]* //g' ../Makefile.package
|
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_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_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_SYSINC =[ \t]*|&$(lepton_SYSINC) |' ../Makefile.package
|
||||||
sed -i -e 's|^PKG_SYSLIB =[ \t]*|&$(lepton_SYSLIB) |' ../Makefile.package
|
sed -i -e 's|^PKG_SYSLIB =[ \t]*|&$(lepton_SYSLIB) |' ../Makefile.package
|
||||||
sed -i -e 's|^PKG_SYSPATH =[ \t]*|&$(lepton_SYSPATH) |' ../Makefile.package
|
sed -i -e 's|^PKG_SYSPATH =[ \t]*|&$(lepton_SYSPATH) |' ../Makefile.package
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "LMP_Lepton.h"
|
#include "Lepton.h"
|
||||||
#include "lepton_utils.h"
|
#include "lepton_utils.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
@ -88,10 +88,10 @@ void AngleLepton::compute(int eflag, int vflag)
|
|||||||
|
|
||||||
template <int EVFLAG, int EFLAG, int NEWTON_BOND> void AngleLepton::eval()
|
template <int EVFLAG, int EFLAG, int NEWTON_BOND> void AngleLepton::eval()
|
||||||
{
|
{
|
||||||
std::vector<LMP_Lepton::CompiledExpression> angleforce;
|
std::vector<Lepton::CompiledExpression> angleforce;
|
||||||
std::vector<LMP_Lepton::CompiledExpression> anglepot;
|
std::vector<Lepton::CompiledExpression> anglepot;
|
||||||
for (const auto &expr : expressions) {
|
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());
|
angleforce.emplace_back(parsed.differentiate("theta").createCompiledExpression());
|
||||||
if (EFLAG) anglepot.emplace_back(parsed.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]);
|
std::string exp_one = LeptonUtils::condense(arg[2]);
|
||||||
double offset_one = 0.0;
|
double offset_one = 0.0;
|
||||||
try {
|
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 anglepot = parsed.createCompiledExpression();
|
||||||
auto angleforce = parsed.differentiate("theta").createCompiledExpression();
|
auto angleforce = parsed.differentiate("theta").createCompiledExpression();
|
||||||
anglepot.getVariableReference("theta") = 0.0;
|
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];
|
double dtheta = acos(c) - theta0[type];
|
||||||
auto expr = expressions[type2expression[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();
|
auto anglepot = parsed.createCompiledExpression();
|
||||||
anglepot.getVariableReference("theta") = dtheta;
|
anglepot.getVariableReference("theta") = dtheta;
|
||||||
return anglepot.evaluate() - offset[type];
|
return anglepot.evaluate() - offset[type];
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "LMP_Lepton.h"
|
#include "Lepton.h"
|
||||||
#include "lepton_utils.h"
|
#include "lepton_utils.h"
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
@ -80,11 +80,11 @@ void BondLepton::compute(int eflag, int vflag)
|
|||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
template <int EVFLAG, int EFLAG, int NEWTON_BOND> void BondLepton::eval()
|
template <int EVFLAG, int EFLAG, int NEWTON_BOND> void BondLepton::eval()
|
||||||
{
|
{
|
||||||
std::vector<LMP_Lepton::CompiledExpression> bondforce;
|
std::vector<Lepton::CompiledExpression> bondforce;
|
||||||
std::vector<LMP_Lepton::CompiledExpression> bondpot;
|
std::vector<Lepton::CompiledExpression> bondpot;
|
||||||
try {
|
try {
|
||||||
for (const auto &expr : expressions) {
|
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());
|
bondforce.emplace_back(parsed.differentiate("r").createCompiledExpression());
|
||||||
if (EFLAG) bondpot.emplace_back(parsed.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]);
|
std::string exp_one = LeptonUtils::condense(arg[2]);
|
||||||
double offset_one = 0.0;
|
double offset_one = 0.0;
|
||||||
try {
|
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 bondpot = parsed.createCompiledExpression();
|
||||||
auto bondforce = parsed.differentiate("r").createCompiledExpression();
|
auto bondforce = parsed.differentiate("r").createCompiledExpression();
|
||||||
bondpot.getVariableReference("r") = 0.0;
|
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];
|
const double dr = r - r0[type];
|
||||||
|
|
||||||
auto expr = expressions[type2expression[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 bondpot = parsed.createCompiledExpression();
|
||||||
auto bondforce = parsed.differentiate("r").createCompiledExpression();
|
auto bondforce = parsed.differentiate("r").createCompiledExpression();
|
||||||
bondforce.getVariableReference("r") = dr;
|
bondforce.getVariableReference("r") = dr;
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "LMP_Lepton.h"
|
#include "Lepton.h"
|
||||||
#include "lepton_utils.h"
|
#include "lepton_utils.h"
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
@ -90,11 +90,11 @@ void DihedralLepton::compute(int eflag, int vflag)
|
|||||||
|
|
||||||
template <int EVFLAG, int EFLAG, int NEWTON_BOND> void DihedralLepton::eval()
|
template <int EVFLAG, int EFLAG, int NEWTON_BOND> void DihedralLepton::eval()
|
||||||
{
|
{
|
||||||
std::vector<LMP_Lepton::CompiledExpression> dihedralforce;
|
std::vector<Lepton::CompiledExpression> dihedralforce;
|
||||||
std::vector<LMP_Lepton::CompiledExpression> dihedralpot;
|
std::vector<Lepton::CompiledExpression> dihedralpot;
|
||||||
try {
|
try {
|
||||||
for (const auto &expr : expressions) {
|
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());
|
dihedralforce.emplace_back(parsed.differentiate("phi").createCompiledExpression());
|
||||||
if (EFLAG) dihedralpot.emplace_back(parsed.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
|
// check if the expression can be parsed and evaluated without error
|
||||||
std::string exp_one = LeptonUtils::condense(arg[1]);
|
std::string exp_one = LeptonUtils::condense(arg[1]);
|
||||||
try {
|
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 dihedralpot = parsed.createCompiledExpression();
|
||||||
auto dihedralforce = parsed.differentiate("phi").createCompiledExpression();
|
auto dihedralforce = parsed.differentiate("phi").createCompiledExpression();
|
||||||
dihedralpot.getVariableReference("phi") = 0.0;
|
dihedralpot.getVariableReference("phi") = 0.0;
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
#include "neigh_list.h"
|
#include "neigh_list.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
|
||||||
#include "LMP_Lepton.h"
|
#include "Lepton.h"
|
||||||
#include "lepton_utils.h"
|
#include "lepton_utils.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
@ -99,11 +99,11 @@ template <int EVFLAG, int EFLAG, int NEWTON_PAIR> void PairLepton::eval()
|
|||||||
const int *const *const firstneigh = list->firstneigh;
|
const int *const *const firstneigh = list->firstneigh;
|
||||||
double fxtmp, fytmp, fztmp;
|
double fxtmp, fytmp, fztmp;
|
||||||
|
|
||||||
std::vector<LMP_Lepton::CompiledExpression> pairforce;
|
std::vector<Lepton::CompiledExpression> pairforce;
|
||||||
std::vector<LMP_Lepton::CompiledExpression> pairpot;
|
std::vector<Lepton::CompiledExpression> pairpot;
|
||||||
try {
|
try {
|
||||||
for (const auto &expr : expressions) {
|
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());
|
pairforce.emplace_back(parsed.differentiate("r").createCompiledExpression());
|
||||||
if (EFLAG) pairpot.emplace_back(parsed.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
|
// check if the expression can be parsed and evaluated without error
|
||||||
auto exp_one = LeptonUtils::condense(arg[2]);
|
auto exp_one = LeptonUtils::condense(arg[2]);
|
||||||
try {
|
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 pairforce = parsed.differentiate("r").createCompiledExpression();
|
||||||
auto pairpot = parsed.createCompiledExpression();
|
auto pairpot = parsed.createCompiledExpression();
|
||||||
pairpot.getVariableReference("r") = 1.0;
|
pairpot.getVariableReference("r") = 1.0;
|
||||||
@ -258,7 +258,7 @@ double PairLepton::init_one(int i, int j)
|
|||||||
if (offset_flag) {
|
if (offset_flag) {
|
||||||
try {
|
try {
|
||||||
auto expr = LeptonUtils::substitute(expressions[type2expression[i][j]], lmp);
|
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];
|
pairpot.getVariableReference("r") = cut[i][j];
|
||||||
offset[i][j] = pairpot.evaluate();
|
offset[i][j] = pairpot.evaluate();
|
||||||
} catch (std::exception &) {
|
} 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)
|
double /* factor_coul */, double factor_lj, double &fforce)
|
||||||
{
|
{
|
||||||
auto expr = expressions[type2expression[itype][jtype]];
|
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 pairpot = parsed.createCompiledExpression();
|
||||||
auto pairforce = parsed.differentiate("r").createCompiledExpression();
|
auto pairforce = parsed.differentiate("r").createCompiledExpression();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user