# IT4Innovations 2017

easyblock = 'CmdCp'

name = 'LAMMPS'
version = '17Jan2018'
versionsuffix = '-MIC-test'


homepage = 'http://lammps.sandia.gov'
description = """LAMMPS is a classical molecular dynamics code,
and an acronym for Large-scale Atomic/Molecular Massively Parallel Simulator.
Has potentials for solid-state materials (metals, semiconductors) and soft
matter (biomolecules, polymers) and coarse-grained or mesoscopic systems.
It can be used to model atoms or, more generically, as a parallel particle simulator at the atomic,
meso, or continuum scale.
"""

toolchain = {'name': 'intel', 'version': '2017a'}

source_urls = ['https://github.com/lammps/lammps/archive']
sources = ['patch_17Jan2018.tar.gz']

patches = [
    #   'LAMMPS-Makefile.intel_coprocessor.patch',
]

dependencies = [
    ('tbb', '2017.6.196', '', True),
    ('libjpeg-turbo', '1.5.1', '', True),
]

builddependencies = [
    ('Python', '2.7.13', '-base', True),
    ('CMake', '3.5.2', '', True)
]

maxparallel = 1

local_commands = "cd src && "
local_commands += "make lib-reax args='-m ifort' && make yes-reax && "
local_commands += "make yes-kspace && make yes-manybody && make yes-molecule && "
local_commands += "make yes-qeq && make yes-rigid && make yes-user-misc && "
local_commands += "make yes-user-reaxc && make yes-user-omp && make yes-user-intel && "
local_commands += "make yes-user-phonon && make yes-kokkos && "
local_commands += "make -j 16 intel_coprocessor && mv lmp_intel_coprocessor lammps"

cmds_map = [('.*', local_commands)]

files_to_copy = [
    (['src/lammps'], 'bin'),
]

sanity_check_paths = {
    'files': ['bin/lammps'],
    'dirs': [''],
}

modluafooter = 'add_property("arch","offload")'

moduleclass = 'chem'
