2020-08-18 14:27:28 +02:00
|
|
|
/*
|
2024-05-13 12:33:08 +02:00
|
|
|
* Copyright (C) NHR@FAU, University Erlangen-Nuremberg.
|
2022-09-05 10:39:42 +02:00
|
|
|
* All rights reserved. This file is part of MD-Bench.
|
|
|
|
* Use of this source code is governed by a LGPL-3.0
|
|
|
|
* license that can be found in the LICENSE file.
|
2020-08-18 14:27:28 +02:00
|
|
|
*/
|
|
|
|
#include <parameter.h>
|
|
|
|
|
|
|
|
#ifndef __ATOM_H_
|
|
|
|
#define __ATOM_H_
|
|
|
|
|
2022-08-09 18:53:53 +02:00
|
|
|
#ifdef CUDA_TARGET
|
|
|
|
# define KERNEL_NAME "CUDA"
|
|
|
|
# define computeForceLJFullNeigh computeForceLJFullNeigh_cuda
|
|
|
|
# define initialIntegrate initialIntegrate_cuda
|
|
|
|
# define finalIntegrate finalIntegrate_cuda
|
|
|
|
# define buildNeighbor buildNeighbor_cuda
|
|
|
|
# define updatePbc updatePbc_cuda
|
|
|
|
# define updateAtomsPbc updateAtomsPbc_cuda
|
|
|
|
#else
|
|
|
|
# ifdef USE_SIMD_KERNEL
|
|
|
|
# define KERNEL_NAME "SIMD"
|
|
|
|
# define computeForceLJFullNeigh computeForceLJFullNeigh_simd
|
|
|
|
# else
|
|
|
|
# define KERNEL_NAME "plain-C"
|
|
|
|
# define computeForceLJFullNeigh computeForceLJFullNeigh_plain_c
|
|
|
|
# endif
|
|
|
|
# define initialIntegrate initialIntegrate_cpu
|
|
|
|
# define finalIntegrate finalIntegrate_cpu
|
|
|
|
# define buildNeighbor buildNeighbor_cpu
|
|
|
|
# define updatePbc updatePbc_cpu
|
|
|
|
# define updateAtomsPbc updateAtomsPbc_cpu
|
|
|
|
#endif
|
|
|
|
|
2022-08-12 17:28:06 +02:00
|
|
|
typedef struct {
|
|
|
|
MD_FLOAT *x, *y, *z;
|
|
|
|
MD_FLOAT *vx, *vy, *vz;
|
|
|
|
MD_FLOAT *fx, *fy, *fz;
|
|
|
|
int *border_map;
|
|
|
|
int *type;
|
|
|
|
MD_FLOAT *epsilon;
|
|
|
|
MD_FLOAT *sigma6;
|
|
|
|
MD_FLOAT *cutforcesq;
|
|
|
|
MD_FLOAT *cutneighsq;
|
|
|
|
} DeviceAtom;
|
|
|
|
|
2020-08-18 14:27:28 +02:00
|
|
|
typedef struct {
|
|
|
|
int Natoms, Nlocal, Nghost, Nmax;
|
2020-11-05 12:41:44 +01:00
|
|
|
MD_FLOAT *x, *y, *z;
|
|
|
|
MD_FLOAT *vx, *vy, *vz;
|
|
|
|
MD_FLOAT *fx, *fy, *fz;
|
2021-11-03 00:57:24 +01:00
|
|
|
int *border_map;
|
2021-05-19 23:51:02 +02:00
|
|
|
int *type;
|
|
|
|
int ntypes;
|
|
|
|
MD_FLOAT *epsilon;
|
|
|
|
MD_FLOAT *sigma6;
|
|
|
|
MD_FLOAT *cutforcesq;
|
|
|
|
MD_FLOAT *cutneighsq;
|
2022-08-12 17:28:06 +02:00
|
|
|
|
2022-07-05 15:33:31 +02:00
|
|
|
// DEM
|
2022-07-06 01:07:39 +02:00
|
|
|
MD_FLOAT *radius;
|
2022-07-05 15:33:31 +02:00
|
|
|
MD_FLOAT *av;
|
|
|
|
MD_FLOAT *r;
|
2022-08-12 17:28:06 +02:00
|
|
|
|
|
|
|
// Device data
|
|
|
|
DeviceAtom d_atom;
|
2020-08-18 14:27:28 +02:00
|
|
|
} Atom;
|
|
|
|
|
2020-08-19 09:00:35 +02:00
|
|
|
extern void initAtom(Atom*);
|
2020-08-18 14:27:28 +02:00
|
|
|
extern void createAtom(Atom*, Parameter*);
|
2021-11-30 01:33:55 +01:00
|
|
|
extern int readAtom(Atom*, Parameter*);
|
2022-02-24 15:17:51 +01:00
|
|
|
extern int readAtom_pdb(Atom*, Parameter*);
|
2022-03-17 02:44:34 +01:00
|
|
|
extern int readAtom_gro(Atom*, Parameter*);
|
2022-02-24 15:17:51 +01:00
|
|
|
extern int readAtom_dmp(Atom*, Parameter*);
|
2022-07-07 02:11:50 +02:00
|
|
|
extern int readAtom_in(Atom*, Parameter*);
|
2023-12-13 10:52:47 +01:00
|
|
|
extern void writeAtom(Atom*, Parameter*);
|
2020-08-18 14:27:28 +02:00
|
|
|
extern void growAtom(Atom*);
|
2021-03-20 18:32:50 +01:00
|
|
|
|
|
|
|
#ifdef AOS
|
2022-08-09 19:19:48 +02:00
|
|
|
# define POS_DATA_LAYOUT "AoS"
|
|
|
|
# define atom_x(i) atom->x[(i) * 3 + 0]
|
|
|
|
# define atom_y(i) atom->x[(i) * 3 + 1]
|
|
|
|
# define atom_z(i) atom->x[(i) * 3 + 2]
|
|
|
|
# define atom_vx(i) atom->vx[(i) * 3 + 0]
|
|
|
|
# define atom_vy(i) atom->vx[(i) * 3 + 1]
|
|
|
|
# define atom_vz(i) atom->vx[(i) * 3 + 2]
|
|
|
|
# define atom_fx(i) atom->fx[(i) * 3 + 0]
|
|
|
|
# define atom_fy(i) atom->fx[(i) * 3 + 1]
|
|
|
|
# define atom_fz(i) atom->fx[(i) * 3 + 2]
|
2021-03-20 18:32:50 +01:00
|
|
|
#else
|
2022-08-09 19:19:48 +02:00
|
|
|
# define POS_DATA_LAYOUT "SoA"
|
|
|
|
# define atom_x(i) atom->x[i]
|
|
|
|
# define atom_y(i) atom->y[i]
|
|
|
|
# define atom_z(i) atom->z[i]
|
|
|
|
# define atom_vx(i) atom->vx[i]
|
|
|
|
# define atom_vy(i) atom->vy[i]
|
|
|
|
# define atom_vz(i) atom->vz[i]
|
|
|
|
# define atom_fx(i) atom->fx[i]
|
|
|
|
# define atom_fy(i) atom->fy[i]
|
|
|
|
# define atom_fz(i) atom->fz[i]
|
2021-03-20 18:32:50 +01:00
|
|
|
#endif
|
|
|
|
|
2020-08-18 14:27:28 +02:00
|
|
|
#endif
|