Add EAM force field

Signed-off-by: Rafael Ravedutti <rafaelravedutti@gmail.com>
This commit is contained in:
Rafael Ravedutti
2021-10-26 00:40:39 +02:00
parent 9d16bb46c8
commit 2dac10469c
5 changed files with 538 additions and 6 deletions

54
src/includes/eam.h Normal file
View File

@@ -0,0 +1,54 @@
/*
* =======================================================================================
*
* Author: Jan Eitzinger (je), jan.eitzinger@fau.de
* Copyright (c) 2020 RRZE, University Erlangen-Nuremberg
*
* This file is part of MD-Bench.
*
* 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.
*
* 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.
*
* 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/>.
* =======================================================================================
*/
#include <atom.h>
#include <parameter.h>
#ifndef __EAM_H_
#define __EAM_H_
typedef struct {
int nrho, nr;
MD_FLOAT drho, dr, cut, mass;
MD_FLOAT *frho, *rhor, *zr;
} Funcfl;
typedef struct {
MD_FLOAT* fp;
int nmax;
int nrho, nr;
int nrho_tot, nr_tot;
MD_FLOAT dr, rdr, drho, rdrho;
MD_FLOAT *frho, *rhor, *z2r;
MD_FLOAT *rhor_spline, *frho_spline, *z2r_spline;
MD_FLOAT *cutforcesq;
Funcfl* file;
} Eam;
void init_eam(Eam* eam, int ntypes);
void coeff(Eam* eam, const char* arg);
void init_style(Eam* eam);
void read_file(Funcfl* file, const char* filename);
void file2array(Eam* eam);
void array2spline(Eam* eam);
void interpolate(MMD_int n, MMD_float delta, MMD_float* f, MMD_float* spline);
void grab(FILE* fptr, MMD_int n, MMD_float* list);
#endif

View File

@@ -23,6 +23,9 @@
#ifndef __PARAMETER_H_
#define __PARAMETER_H_
#define FF_LJ 0
#define FF_EAM 1
#if PRECISION == 1
#define MD_FLOAT float
#else
@@ -30,6 +33,7 @@
#endif
typedef struct {
char* input_file;
MD_FLOAT epsilon;
MD_FLOAT sigma6;
MD_FLOAT temp;