Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: lammps #10

Draft
wants to merge 13 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ option(ENABLE_MANDELBROT "Enable Mandelbrot AMR miniapp" ON)
option(ENABLE_VORTEX "Enable Vortex miniapp (experimental)" OFF)
option(ENABLE_CONDUITTEST "Enable Conduit miniapp (experimental)" OFF)
option(ENABLE_KRIPKE "Enable Kripke miniapp (experimental)" OFF)
option(ENABLE_LAMMPS "Enable LAMMPS driver" OFF)
option(SENSEI_USE_EXTERNAL_pugixml "Use external pugixml library" OFF)

message(STATUS "ENABLE_SENSEI=${ENABLE_SENSEI}")
Expand All @@ -104,6 +105,7 @@ message(STATUS "ENABLE_OPTS=${ENABLE_OPTS}")
message(STATUS "ENABLE_OSCILLATORS=${ENABLE_OSCILLATORS}")
message(STATUS "ENABLE_CONDUITTEST=${ENABLE_CONDUITTEST}")
message(STATUS "ENABLE_KRIPKE=${ENABLE_KRIPKE}")
message(STATUS "ENABLE_LAMMPS=${ENABLE_LAMMPS}")
message(STATUS "SENSEI_USE_EXTERNAL_pugixml=${SENSEI_USE_EXTERNAL_pugixml}")

if (ENABLE_ADIOS1 AND ENABLE_ADIOS2)
Expand Down
1 change: 1 addition & 0 deletions endpoints/SENSEIEndPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ using AnalysisAdaptorPtr = vtkSmartPointer<sensei::ConfigurableAnalysis>;

int main(int argc, char **argv)
{
sensei::Profiler::Initialize();
sensei::MPIManager mpiMan(argc, argv);
int rank = mpiMan.GetCommRank();

Expand Down
7 changes: 7 additions & 0 deletions miniapps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,10 @@ else()
message(STATUS "Disabled: Vortex miniapp.")
endif()

if(ENABLE_LAMMPS)
message(STATUS "Enabled: LAMMPS driver.")
add_subdirectory(lammps)
else()
message(STATUS "Disabled: LAMMPS driver.")
endif()

33 changes: 33 additions & 0 deletions miniapps/lammps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
if (NOT LAMMPS_DIR)
message(FATAL_ERROR "To build LAMMPS driver you must set -DLAMMPS_DIR=<root of lammps dir>")
else()
message(STATUS "LAMMPS_DIR: ${LAMMPS_DIR}")
endif()

include_directories(${LAMMPS_DIR}/src)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLAMMPS_LIB_MPI")

set(sources lammpsDriver.cxx)

set(libs
${LAMMPS_DIR}/src/liblammps_mpi.a
)

if(ENABLE_SENSEI)
list(APPEND sources
lammpsDataAdaptor.h
lammpsDataAdaptor.cxx
lammpsBridge.h
lammpsBridge.cxx
)
list(APPEND libs sensei)
endif()

add_executable(lammpsDriver ${sources})

target_link_libraries(lammpsDriver ${libs})

install(TARGETS lammpsDriver
RUNTIME DESTINATION bin
)
17 changes: 17 additions & 0 deletions miniapps/lammps/configs/adiostransport.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<sensei>
<transport type="adios2" filename="test_%05d.bp" debug_mode="1" engine="bp4">
<engine_parameters>
NumAggregators = 0
InitialBufferSize = 1Mb
BufferGrowthFactor = 2
MaxBufferSize = 1024Mb
StatsLevel = 0
Profile = Off
</engine_parameters>

<!-- subset by mesh and array -->
<mesh name="atoms">
<point_arrays> type,id </point_arrays>
</mesh>
</transport>
</sensei>
23 changes: 23 additions & 0 deletions miniapps/lammps/configs/adioswrite.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<sensei>

<!-- configure ADIOS2 write -->
<analysis type="adios2" filename="test_%05d.bp" engine="BP4"
debug_mode="1" enabled="1" steps_per_file="1" >

<!-- ADIOS2 engine parameters -->
<engine_parameters>
NumAggregators = 0
InitialBufferSize = 1Mb
BufferGrowthFactor = 2
MaxBufferSize = 1024Mb
StatsLevel = 0
Profile = Off
</engine_parameters>

<!-- subset by mesh and array -->
<mesh name="atoms">
<point_arrays>type,id </point_arrays>
</mesh>

</analysis>
</sensei>
23 changes: 23 additions & 0 deletions miniapps/lammps/configs/adioswriteosc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<sensei>

<!-- configure ADIOS2 write -->
<analysis type="adios2" filename="test_%05d.bp" engine="BP4"
debug_mode="1" enabled="1" steps_per_file="1" >

<!-- ADIOS2 engine parameters -->
<engine_parameters>
NumAggregators = 0
InitialBufferSize = 1Mb
BufferGrowthFactor = 2
MaxBufferSize = 1024Mb
StatsLevel = 0
Profile = Off
</engine_parameters>

<!-- subset by mesh and array -->
<mesh name="mesh">
<cell_arrays>data</cell_arrays>
</mesh>

</analysis>
</sensei>
11 changes: 11 additions & 0 deletions miniapps/lammps/configs/cmakeconfig_adios.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

export CC=`which gcc`
export CXX=`which g++`


cmake -S ./src/ADIOS2 -B ./build/adios \
-DCMAKE_INSTALL_PREFIX=`pwd`/install/adios \
-DADIOS2_USE_Fortran=OFF \
-DADIOS2_BUILD_EXAMPLES=OFF \
-DCMAKE_BUILD_TYPE=Debug
17 changes: 17 additions & 0 deletions miniapps/lammps/configs/cmakeconfig_sensei.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

export CC=`which gcc`
export CXX=`which g++`
export LAMMPS_DIR=`pwd`/src/lammps/



cmake -S ./src/SENSEI -B ./build/sensei \
-DCMAKE_INSTALL_PREFIX=`pwd`/install/sensei \
-DVTK_DIR=`pwd`/install/vtk/lib64/cmake/vtk-8.2 \
-DENABLE_VTK_IO=ON \
-DLAMMPS_DIR=$LAMMPS_DIR \
-DENABLE_LAMMPS=ON \
-DENABLE_MANDELBROT=OFF \
-DENABLE_OSCILLATORS=OFF \
-DENABLE_ADIOS2=ON \
-DADIOS2_DIR=`pwd`/install/adios/lib64/cmake/adios2
17 changes: 17 additions & 0 deletions miniapps/lammps/configs/cmakeconfig_vtk8.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

export CC=`which gcc`
export CXX=`which g++`

cmake -S src/vtk -B build/vtk \
-DVTK_Group_Imaging=OFF \
-DVTK_Group_MPI=OFF \
-DVTK_Group_Qt=OFF \
-DVTK_Group_Rendering=OFF \
-DVTK_Group_StandAlone=ON \
-DVTK_Group_Tk=OFF \
-DVTK_Group_Views=OFF \
-DVTK_Group_Web=OFF \
-DVTK_RENDERING_BACKEND=None \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_TESTING=OFF \
-DCMAKE_INSTALL_PREFIX=`pwd`/install/vtk
34 changes: 34 additions & 0 deletions miniapps/lammps/configs/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<sensei>
<analysis type="PosthocIO"
output_dir="./vtkfiles" file_name="output" mode="paraview"
enabled="0">
<mesh name="atoms" structure_only="0" ghost_cells="1" ghost_nodes="0">
<point_arrays>type,id</point_arrays>
</mesh>
</analysis>

<!-- configure ADIOS2 write -->
<analysis type="adios2" filename="test_%05d.bp”
engine="BP4" enabled="1”
steps_per_file="1" >

<!-- ADIOS2 engine parameters -->
<engine_parameters>
NumAggregators = 0
InitialBufferSize = 1Mb
BufferGrowthFactor = 2
MaxBufferSize = 1024Mb
StatsLevel = 0
Profile = Off
</engine_parameters>

<!-- subset by mesh and array -->
<mesh name="atoms">
<point_arrays>type,id </point_arrays>
</mesh>

</analysis>



</sensei>
6 changes: 6 additions & 0 deletions miniapps/lammps/configs/endpoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

export LD_LIBRARY_PATH=/lus/grand/projects/visualization/srizzi/BUILDS/sensei-lammps/install/vtk/lib64:/lus/grand/projects/visualization/srizzi/BUILDS/sensei-lammps/install/adios/lib64:$LD_LIBRARY_PATH

#mpiexec -n 4 ./lammpsDriver in.rhodo -n 5 -sensei config.xml
#mpiexec -n 4 ./lammpsDriver in.rhodo -n 5 -sensei adioswrite.xml
./SENSEIEndPoint -a vtkosc.xml -t adiostransport.xml
28 changes: 28 additions & 0 deletions miniapps/lammps/configs/in.rhodo
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Rhodopsin model

units real
neigh_modify delay 5 every 1

atom_style full
bond_style harmonic
angle_style charmm
dihedral_style charmm
improper_style harmonic
pair_style lj/charmm/coul/long 8.0 10.0
pair_modify mix arithmetic
kspace_style pppm 1e-4

read_data data.rhodo

fix 1 all shake 0.0001 5 0 m 1.0 a 232
fix 2 all npt temp 300.0 300.0 100.0 z 0.0 0.0 1000.0 mtk no pchain 0 tchain 1
fix 3 all external pf/callback 1 10000

special_bonds charmm

thermo 50
thermo_style multi
timestep 2.0

#run 100

7 changes: 7 additions & 0 deletions miniapps/lammps/configs/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

export LD_LIBRARY_PATH=/lus/grand/projects/visualization/srizzi/BUILDS/sensei-lammps/install/vtk/lib64:/lus/grand/projects/visualization/srizzi/BUILDS/sensei-lammps/install/adios/lib64:$LD_LIBRARY_PATH

#mpiexec -n 4 ./lammpsDriver in.rhodo -n 5 -sensei config.xml
#mpiexec -n 4 ./lammpsDriver in.rhodo -n 5 -sensei adioswrite.xml
#./lammpsDriver in.rhodo -n 5 -sensei adioswrite.xml
./oscillator --t-end 0.05 -f adioswriteosc.xml sample.osc
6 changes: 6 additions & 0 deletions miniapps/lammps/configs/sample.osc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# type center r omega0 zeta
damped 32 32 32 10. 3.14 .3
damped 16 32 16 10. 9.5 .1
damped 48 32 48 5. 3.14 .1
decaying 16 32 48 15 3.14
periodic 48 32 16 15 3.14
9 changes: 9 additions & 0 deletions miniapps/lammps/configs/vtk.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<sensei>
<analysis type="PosthocIO"
output_dir="./vtkfiles" file_name="output" mode="paraview"
enabled="1">
<mesh name="atoms" structure_only="0" ghost_cells="1" ghost_nodes="0">
<point_arrays>type,id</point_arrays>
</mesh>
</analysis>
</sensei>
9 changes: 9 additions & 0 deletions miniapps/lammps/configs/vtkosc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<sensei>
<analysis type="PosthocIO"
output_dir="./vtkfiles" file_name="output" mode="paraview"
enabled="1">
<mesh name="mesh" structure_only="0" ghost_cells="1" ghost_nodes="0">
<cell_arrays>data</cell_arrays>
</mesh>
</analysis>
</sensei>
49 changes: 49 additions & 0 deletions miniapps/lammps/lammpsBridge.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include "lammpsBridge.h"
#include "lammpsDataAdaptor.h"
#include <vtkSmartPointer.h>
#include <ConfigurableAnalysis.h>
#include <vtkDataObject.h>

namespace lammpsBridge
{
static vtkSmartPointer<senseiLammps::lammpsDataAdaptor> DataAdaptor;
static vtkSmartPointer<sensei::ConfigurableAnalysis> AnalysisAdaptor;

void Initialize(MPI_Comm world, const std::string& config_file)
{
DataAdaptor = vtkSmartPointer<senseiLammps::lammpsDataAdaptor>::New();
DataAdaptor->Initialize();
DataAdaptor->SetCommunicator(world);
DataAdaptor->SetDataTimeStep(-1);

AnalysisAdaptor = vtkSmartPointer<sensei::ConfigurableAnalysis>::New();
AnalysisAdaptor->Initialize(config_file);
}

void SetData(long ntimestep, int nlocal, int *id,
int nghost, int *type, double **x,
double xsublo, double xsubhi,
double ysublo, double ysubhi,
double zsublo, double zsubhi )
{
DataAdaptor->AddLAMMPSData( ntimestep, nlocal, id, nghost, type, x, \
xsublo, xsubhi, ysublo, ysubhi, zsublo, zsubhi);
DataAdaptor->SetDataTimeStep(ntimestep);
DataAdaptor->SetDataTime(ntimestep);
}

void Analyze()
{
AnalysisAdaptor->Execute(DataAdaptor.GetPointer());
DataAdaptor->ReleaseData();
}

//-----------------------------------------------------------------------------
void Finalize()
{
AnalysisAdaptor->Finalize();
AnalysisAdaptor = nullptr;
DataAdaptor = nullptr;
}

} // namespace lammpsBridge
15 changes: 15 additions & 0 deletions miniapps/lammps/lammpsBridge.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once
#include <mpi.h>
#include <string>

namespace lammpsBridge
{
void Initialize(MPI_Comm world, const std::string& config_file);
void SetData(long ntimestep, int nlocal, int *id,
int nghost, int *type, double **x,
double xsublo, double xsubhi,
double ysublo, double ysubhi,
double zsublo, double zsubhi );
void Analyze();
void Finalize();
}
Loading