Skip to content

Commit

Permalink
Merge branch 'develop' into maintenance
Browse files Browse the repository at this point in the history
# Conflicts:
#	USER-REBOMOS/CMakeLists.txt
  • Loading branch information
akohlmey committed Aug 4, 2023
2 parents fc5093c + 7dbe3f9 commit 2a234cd
Show file tree
Hide file tree
Showing 14 changed files with 765 additions and 2,328 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ include(LAMMPSInterfacePlugin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_custom_target(package DEPENDS package-USER-AEAM package-USER-REBOMOS package-USER-VCSGC)
add_custom_target(package DEPENDS package-USER-AEAM package-USER-BFIELD package-USER-REBOMOS)
endif()
add_subdirectory(USER-AEAM)
add_subdirectory(USER-BFIELD)
add_subdirectory(USER-REBOMOS)
add_subdirectory(USER-VCSGC)
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
This repository contains source code written for LAMMPS from
various sources that is not part of the LAMMPS distribution
for a number of reasons, but ported to be compatible with the
23 June 2022 LAMMPS release and converted to create plugins.
2 August 2023 LAMMPS release and converted to create plugins.

| Folders | Origin of source code |
|--------------|----------------------------------------------------|
| USER-AEAM | https://github.com/psaidi/AEAM |
| USER-REBOMOS | https://matsci.org/t/pair-rebomos/30503 |
| USER-VCSGC | https://gitlab.com/materials-modeling/vcsgc-lammps |
| Folders | Origin of source code |
|--------------|-----------------------------------------------------------------------------|
| USER-AEAM | https://github.com/psaidi/AEAM |
| USER-BFIELD | https://matsci.org/t/discrepency-beween-old-version-and-new-version/50014/5 |
| USER-REBOMOS | https://matsci.org/t/pair-rebomos/30503 |

As of the 22 December 2022 LAMMPS release, the USER-VCSGC package
code has been merged with upstream and the corresponding fix is now
available in the MC package. The plugin package has thus been removed.

To compile and configure all plugins

Expand Down
15 changes: 11 additions & 4 deletions USER-AEAM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,17 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(mytarget package)
endif()
if(BUILD_MPI)
add_custom_target(${mytarget} ${MAKENSIS_PATH} -V1 -DVERSION=${LAMMPS_VERSION}-MPI aeamplugin.nsis
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS aeamplugin ${CMAKE_BINARY_DIR}/lammps.ico ${CMAKE_BINARY_DIR}/lammps-text-logo-wide.bmp ${CMAKE_BINARY_DIR}/aeamplugin.nsis
BYPRODUCTS ${CMAKE_BINARY_DIR}/LAMMPS-USER-AEAM-plugin-${LAMMPS_VERSION}-MPI.exe)
if(USE_MSMPI AND CMAKE_CROSSCOMPILING)
add_custom_target(${mytarget} ${MAKENSIS_PATH} -V1 -DVERSION=${LAMMPS_VERSION}-MSMPI aeamplugin.nsis
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS aeamplugin ${CMAKE_BINARY_DIR}/lammps.ico ${CMAKE_BINARY_DIR}/lammps-text-logo-wide.bmp ${CMAKE_BINARY_DIR}/aeamplugin.nsis
BYPRODUCTS ${CMAKE_BINARY_DIR}/LAMMPS-USER-AEAM-plugin-${LAMMPS_VERSION}-MSMPI.exe)
else()
add_custom_target(${mytarget} ${MAKENSIS_PATH} -V1 -DVERSION=${LAMMPS_VERSION}-MPI aeamplugin.nsis
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS aeamplugin ${CMAKE_BINARY_DIR}/lammps.ico ${CMAKE_BINARY_DIR}/lammps-text-logo-wide.bmp ${CMAKE_BINARY_DIR}/aeamplugin.nsis
BYPRODUCTS ${CMAKE_BINARY_DIR}/LAMMPS-USER-AEAM-plugin-${LAMMPS_VERSION}-MPI.exe)
endif()
else()
add_custom_target(${mytarget} ${MAKENSIS_PATH} -V1 -DVERSION=${LAMMPS_VERSION} aeamplugin.nsis
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
Expand Down
71 changes: 71 additions & 0 deletions USER-BFIELD/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
##########################################
# CMake build system for plugin examples.
# The is meant to be used as a template for plugins that are
# distributed independent from the LAMMPS package.
##########################################

cmake_minimum_required(VERSION 3.10)
if(POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif()

project(bfieldplugin VERSION 1.0 LANGUAGES CXX)

if(NOT LAMMPS_SOURCE_DIR)
message(FATAL_ERROR "Must set LAMMPS_SOURCE_DIR variable")
endif()
set(CMAKE_MODULE_PATH "${LAMMPS_SOURCE_DIR}/../cmake/Modules")
if (NOT TARGET lammps)
include(CheckIncludeFileCXX)
include(LAMMPSInterfacePlugin)
endif()

##########################
# building the plugins

add_library(bfieldplugin MODULE bfieldplugin.cpp ${CMAKE_CURRENT_SOURCE_DIR}/fix_bfield.cpp)
target_link_libraries(bfieldplugin PRIVATE lammps)
set_target_properties(bfieldplugin PROPERTIES PREFIX "" SUFFIX ".so")

# MacOS seems to need this
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set_target_properties(bfieldplugin PROPERTIES LINK_FLAGS "-Wl,-undefined,dynamic_lookup")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
# tell CMake to export all symbols to a .dll on Windows with special case for MinGW cross-compilers
set_target_properties(bfieldplugin PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
if(CMAKE_CROSSCOMPILING)
set_target_properties(bfieldplugin PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols")
endif()

get_lammps_version(${LAMMPS_SOURCE_DIR}/version.h LAMMPS_VERSION)
find_program(MAKENSIS_PATH makensis)
if(MAKENSIS_PATH)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/../lammps.ico
${CMAKE_CURRENT_SOURCE_DIR}/../lammps-text-logo-wide.bmp ${CMAKE_CURRENT_SOURCE_DIR}/bfieldplugin.nsis ${CMAKE_BINARY_DIR})
if(TARGET package)
set(mytarget package-USER-BFIELD)
else()
set(mytarget package)
endif()
if(BUILD_MPI)
if(USE_MSMPI AND CMAKE_CROSSCOMPILING)
add_custom_target(${mytarget} ${MAKENSIS_PATH} -V1 -DVERSION=${LAMMPS_VERSION}-MSMPI bfieldplugin.nsis
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS bfieldplugin ${CMAKE_BINARY_DIR}/lammps.ico ${CMAKE_BINARY_DIR}/lammps-text-logo-wide.bmp ${CMAKE_BINARY_DIR}/bfieldplugin.nsis
BYPRODUCTS ${CMAKE_BINARY_DIR}/LAMMPS-USER-BFIELD-plugin-${LAMMPS_VERSION}-MSMPI.exe)
else()
add_custom_target(${mytarget} ${MAKENSIS_PATH} -V1 -DVERSION=${LAMMPS_VERSION}-MPI bfieldplugin.nsis
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS bfieldplugin ${CMAKE_BINARY_DIR}/lammps.ico ${CMAKE_BINARY_DIR}/lammps-text-logo-wide.bmp ${CMAKE_BINARY_DIR}/bfieldplugin.nsis
BYPRODUCTS ${CMAKE_BINARY_DIR}/LAMMPS-USER-BFIELD-plugin-${LAMMPS_VERSION}-MPI.exe)
endif()
else()
add_custom_target(${mytarget} ${MAKENSIS_PATH} -V1 -DVERSION=${LAMMPS_VERSION} bfieldplugin.nsis
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS bfieldplugin ${CMAKE_BINARY_DIR}/lammps.ico ${CMAKE_BINARY_DIR}/lammps-text-logo-wide.bmp ${CMAKE_BINARY_DIR}/bfieldplugin.nsis
BYPRODUCTS LAMMPS-USER-BFIELD-plugin-${LAMMPS_VERSION}.exe)
endif()
endif()
else()
set_target_properties(bfieldplugin PROPERTIES LINK_FLAGS "-rdynamic")
endif()
15 changes: 8 additions & 7 deletions USER-VCSGC/vcsgcplugin.cpp → USER-BFIELD/bfieldplugin.cpp
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@

#include "lammpsplugin.h"

#include "version.h"

#include "fix_semigrandcanonical_mc.h"
#include "fix_bfield.h"

using namespace LAMMPS_NS;

static Fix *fix_vcscg_creator(LAMMPS *lmp, int argc, char **argv)
static Fix *bfieldcreator(LAMMPS *lmp, int argc, char **argv)
{
return new FixSemiGrandCanonicalMC(lmp, argc, argv);
return new FixBfield(lmp, argc, argv);
}

extern "C" void lammpsplugin_init(void *lmp, void *handle, void *regfunc)
{
lammpsplugin_t plugin;
lammpsplugin_regfunc register_plugin = (lammpsplugin_regfunc) regfunc;

// register pace pair style
// register bfield fix style
plugin.version = LAMMPS_VERSION;
plugin.style = "fix";
plugin.name = "sgcmc";
plugin.info = "VCSGC plugin fix style v1.0";
plugin.name = "bfield";
plugin.info = "fix bfield plugin v1.0";
plugin.author = "Axel Kohlmeyer ([email protected])";
plugin.creator.v2 = (lammpsplugin_factory2 *) &fix_vcscg_creator;
plugin.creator.v2 = (lammpsplugin_factory2 *) &bfieldcreator;
plugin.handle = handle;
(*register_plugin)(&plugin, lmp);
}
52 changes: 26 additions & 26 deletions USER-VCSGC/vcsgcplugin.nsis → USER-BFIELD/bfieldplugin.nsis
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ ${If} $0 != "admin"
${EndIf}
!macroend

!define VCSGCPLUGIN "LAMMPS USER-VCSGC Plugin ${VERSION}"
OutFile "LAMMPS-USER-VCSGC-plugin-${VERSION}.exe"
!define BFIELDPLUGIN "LAMMPS USER-BFIELD Plugin ${VERSION}"
OutFile "LAMMPS-USER-BFIELD-plugin-${VERSION}.exe"

Name "${VCSGCPLUGIN}"
InstallDir "$LOCALAPPDATA\${VCSGCPLUGIN}"
Name "${BFIELDPLUGIN}"
InstallDir "$LOCALAPPDATA\${BFIELDPLUGIN}"

ShowInstDetails show
ShowUninstDetails show
Expand All @@ -55,7 +55,7 @@ function .onInit
# Determine if LAMMPS was already installed and check whether it was in 32-bit
# or 64-bit. Then look up path to uninstaller and offer to uninstall or quit
SetRegView 32
ReadRegDWORD $0 HKCU "Software\LAMMPS-USER-VCSGC" "Bits"
ReadRegDWORD $0 HKCU "Software\LAMMPS-USER-BFIELD" "Bits"
SetRegView LastUsed
${If} $0 == "32"
SetRegView 32
Expand All @@ -65,12 +65,12 @@ function .onInit
SetRegView 64
${EndIf}
ClearErrors
ReadRegStr $R0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-VCSGC" "UninstallString"
ReadRegStr $R0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-BFIELD" "UninstallString"
SetRegView LastUsed
${If} ${Errors}
DetailPrint "LAMMPS USER-VCSGC plugin not (yet) installed"
DetailPrint "LAMMPS USER-BFIELD plugin not (yet) installed"
${Else}
MessageBox MB_YESNO "LAMMPS USER-VCSGC plugin ($0 bit) is already installed. Uninstall existing version?" /SD IDYES IDNO Quit
MessageBox MB_YESNO "LAMMPS USER-BFIELD plugin ($0 bit) is already installed. Uninstall existing version?" /SD IDYES IDNO Quit
Pop $R1
StrCmp $R1 2 Quit +1
Exec $R0
Expand All @@ -80,42 +80,42 @@ function .onInit
setShellVarContext all
functionEnd

Section "${VCSGCPLUGIN}" SecVcsgcplugin
Section "${BFIELDPLUGIN}" SecPaceplugin
SectionIn RO
# Write LAMMPS installation bitness marker. Always use 32-bit registry view
SetRegView 32
IntFmt $0 "0x%08X" 64
WriteRegDWORD HKCU "Software\LAMMPS-USER-VCSGC" "Bits" $0
WriteRegDWORD HKCU "Software\LAMMPS-USER-BFIELD" "Bits" $0

# Switch to "native" registry view
SetRegView 64
SetShellVarContext current

SetOutPath "$INSTDIR"
File lammps.ico
File vcsgcplugin.so
File bfieldplugin.so

# Register Application and its uninstaller
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-VCSGC" \
"DisplayName" "${VCSGCPLUGIN}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-VCSGC" \
"Publisher" "The LAMMPS and USER-VCSGC Developers"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-VCSGC" \
"URLInfoAbout" "vcsgc-lammps.materialsmodeling.org"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-VCSGC" \
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-BFIELD" \
"DisplayName" "${BFIELDPLUGIN}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-BFIELD" \
"Publisher" "The LAMMPS and USER-BFIELD Developers"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-BFIELD" \
"URLInfoAbout" "lammps.org"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-BFIELD" \
"DisplayIcon" "$INSTDIR\lammps.ico"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-VCSGC" \
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-BFIELD" \
"DisplayVersion" "${VERSION}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-VCSGC" \
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-BFIELD" \
"InstallLocation" "$INSTDIR"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-VCSGC" \
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-BFIELD" \
"UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-VCSGC" \
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-BFIELD" \
"QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"

${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
IntFmt $0 "0x%08X" $0
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-VCSGC" \
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-BFIELD" \
"EstimatedSize" "$0"

# update path variables
Expand All @@ -133,20 +133,20 @@ functionEnd
Section "Uninstall"
# remove LAMMPS bitness/installation indicator always in 32-bit registry view
SetRegView 32
DeleteRegKey HKCU "Software\LAMMPS-USER-VCSGC"
DeleteRegKey HKCU "Software\LAMMPS-USER-BFIELD"

# unregister extension, and uninstall info
SetRegView 64
SetShellVarContext current
# unregister installation
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-VCSGC"
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\LAMMPS-USER-BFIELD"

# update path variables
EnVar::SetHKCU
# remove entry from LAMMPS plugin search path
EnVar::DeleteValue "LAMMPS_PLUGIN_PATH" "$INSTDIR"

Delete /REBOOTOK "$INSTDIR\vcsgcplugin.so"
Delete /REBOOTOK "$INSTDIR\bfieldplugin.so"
Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
Delete /REBOOTOK "$INSTDIR\lammps.ico"
RMDir /REBOOTOK "$INSTDIR"
Expand Down
Loading

0 comments on commit 2a234cd

Please sign in to comment.