Cuda-accelerated lattice spring model (CuLSM) is the CUDA C++ code implementing GPU parallelization on particle and spring lists. The code is associated with the paper "ImageMech: From Image to Particle Spring Network for Mechanical Characterization" published in Frontiers in Materials.
If you happen to use this code in your work, please cite:
Chiang Y, Chiu T-W and Chang S-W (2022) ImageMech: From Image to Particle Spring Network for Mechanical Characterization. Front. Mater. 8:803875. doi: 10.3389/fmats.2021.803875
Instead of spatial decomposition as used in LAMMPS, CuLSM applies parallization to atom and bond lists and therefore secures remarkable speedup for large-scale lattice spring model simulations.
- GPU compute capabtility > 6.x for 64-bit floating point operation
- CUDA Toolkit >= 10.1 recommended
To buld culsm
on your device, GPU architecture must be specified at the time of compilation. In build/Makefile
, make sure the NVFLAGS
fit your device.
NVFLAGS = -O3 -I$(CUDIR)/include -m64 -arch=compute_75 -code=sm_75 -Xptxas -v -rdc=true
The GPU architecture (e.g. Kepler, Turing, etc.) may be found here, and the cooresponding CUDA naming scheme can be found in Nvidia GPU Feature List.
To compile the code, enter build
directory and simply execute make in the terminal.
cd build
make
./culsm < [input] > [output] &
# read lammps data file
read_data <file>
# set particle mass by type
mass <type> <mass>
# set spring type and coefficients
bond <type> <bond type> <coeff 1> <coeff 2> ... <coeff n>
# displace certain type of particles every timestep
fix <type> <disp x> <disp y> <disp z>
# save particle trajectory every N timesteps to file
dump <file name> <timesteps>
# output thermodynamic observables every N timesteps
thermo <timesteps>
# verlocity Verlet integration for N timesteps of dt seconds
run <dt> <timesteps>