2020-08-18 14:27:28 +02:00
|
|
|
/*
|
|
|
|
* =======================================================================================
|
|
|
|
*
|
2020-08-19 10:47:40 +02:00
|
|
|
* Author: Jan Eitzinger (je), jan.eitzinger@fau.de
|
|
|
|
* Copyright (c) 2020 RRZE, University Erlangen-Nuremberg
|
2020-08-18 14:27:28 +02:00
|
|
|
*
|
2020-08-19 10:47:40 +02:00
|
|
|
* This file is part of MD-Bench.
|
2020-08-18 14:27:28 +02:00
|
|
|
*
|
2020-08-19 10:47:40 +02:00
|
|
|
* MD-Bench is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU Lesser General Public License as published
|
|
|
|
* by the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2020-08-18 14:27:28 +02:00
|
|
|
*
|
2020-08-19 10:47:40 +02:00
|
|
|
* MD-Bench is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
|
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
|
|
|
* details.
|
2020-08-18 14:27:28 +02:00
|
|
|
*
|
2020-08-19 10:47:40 +02:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License along
|
|
|
|
* with MD-Bench. If not, see <https://www.gnu.org/licenses/>.
|
2020-08-18 14:27:28 +02:00
|
|
|
* =======================================================================================
|
|
|
|
*/
|
|
|
|
#include <parameter.h>
|
|
|
|
|
|
|
|
#ifndef __ATOM_H_
|
|
|
|
#define __ATOM_H_
|
|
|
|
|
|
|
|
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;
|
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*);
|
|
|
|
extern void growAtom(Atom*);
|
2021-03-20 18:32:50 +01:00
|
|
|
|
|
|
|
#ifdef AOS
|
2021-03-22 21:51:47 +01:00
|
|
|
#define POS_DATA_LAYOUT "AoS"
|
|
|
|
/* FIXME: these macros are resulting in segfault
|
|
|
|
#define set_atom_x(atom, i, v) (atom->x[i * 3 + 0] = v)
|
|
|
|
#define set_atom_y(atom, i, v) (atom->x[i * 3 + 1] = v)
|
|
|
|
#define set_atom_z(atom, i, v) (atom->x[i * 3 + 2] = v)
|
|
|
|
*/
|
2021-03-20 18:32:50 +01:00
|
|
|
inline void set_atom_x(Atom *atom, int i, MD_FLOAT x) { atom->x[i * 3 + 0] = x; }
|
|
|
|
inline void set_atom_y(Atom *atom, int i, MD_FLOAT y) { atom->x[i * 3 + 1] = y; }
|
|
|
|
inline void set_atom_z(Atom *atom, int i, MD_FLOAT z) { atom->x[i * 3 + 2] = z; }
|
2021-03-22 21:51:47 +01:00
|
|
|
#define get_atom_x(atom, i) (atom->x[i * 3 + 0])
|
|
|
|
#define get_atom_y(atom, i) (atom->x[i * 3 + 1])
|
|
|
|
#define get_atom_z(atom, i) (atom->x[i * 3 + 2])
|
2021-03-20 18:32:50 +01:00
|
|
|
#else
|
2021-03-22 21:51:47 +01:00
|
|
|
#define POS_DATA_LAYOUT "SoA"
|
|
|
|
#define set_atom_x(atom, i, v) (atom->x[i] = v)
|
|
|
|
#define set_atom_y(atom, i, v) (atom->y[i] = v)
|
|
|
|
#define set_atom_z(atom, i, v) (atom->z[i] = v)
|
|
|
|
#define get_atom_x(atom, i) (atom->x[i])
|
|
|
|
#define get_atom_y(atom, i) (atom->y[i])
|
|
|
|
#define get_atom_z(atom, i) (atom->z[i])
|
2021-03-20 18:32:50 +01:00
|
|
|
#endif
|
|
|
|
|
2020-08-18 14:27:28 +02:00
|
|
|
#endif
|