First commit

- added spin/kk style files
- modified few necessary files
- compiles, but SegFault when running
This commit is contained in:
julient31
2020-09-30 11:43:01 -06:00
parent e0e4e516fc
commit c4579a7502
7 changed files with 1518 additions and 0 deletions

View File

@ -63,6 +63,8 @@ action atom_vec_bond_kokkos.cpp atom_vec_bond.cpp
action atom_vec_bond_kokkos.h atom_vec_bond.h
action atom_vec_charge_kokkos.cpp
action atom_vec_charge_kokkos.h
action atom_vec_spin_kokkos.cpp
action atom_vec_spin_kokkos.h
action atom_vec_dpd_kokkos.cpp atom_vec_dpd.cpp
action atom_vec_dpd_kokkos.h atom_vec_dpd.h
action atom_vec_full_kokkos.cpp atom_vec_full.cpp

View File

@ -76,6 +76,12 @@ AtomKokkos::~AtomKokkos()
memoryKK->destroy_kokkos(k_improper_atom3, improper_atom3);
memoryKK->destroy_kokkos(k_improper_atom4, improper_atom4);
// SPIN package
memoryKK->destroy_kokkos(k_sp, sp);
memoryKK->destroy_kokkos(k_fm, fm);
memoryKK->destroy_kokkos(k_fm_long, fm_long);
// USER-DPD package
memoryKK->destroy_kokkos(k_uCond,uCond);
memoryKK->destroy_kokkos(k_uMech,uMech);

View File

@ -54,6 +54,11 @@ class AtomKokkos : public Atom {
DAT::tdual_float_2d k_dvector;
// SPIN package
DAT::tdual_sp_array k_sp;
DAT::tdual_fm_array k_fm;
DAT::tdual_fm_long_array k_fm_long;
// USER-DPD package
DAT::tdual_efloat_1d k_uCond, k_uMech, k_uChem, k_uCG, k_uCGnew,

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,132 @@
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef ATOM_CLASS
AtomStyle(spin/kk,AtomVecSpinKokkos)
AtomStyle(spin/kk/device,AtomVecSpinKokkos)
AtomStyle(spin/kk/host,AtomVecSpinKokkos)
#else
#ifndef LMP_ATOM_VEC_SPIN_KOKKOS_H
#define LMP_ATOM_VEC_SPIN_KOKKOS_H
#include "atom_vec_kokkos.h"
#include "kokkos_type.h"
namespace LAMMPS_NS {
class AtomVecSpinKokkos : public AtomVecKokkos {
public:
AtomVecSpinKokkos(class LAMMPS *);
void grow(int);
void copy(int, int, int);
int pack_border(int, int *, double *, int, int *);
int pack_border_vel(int, int *, double *, int, int *);
int pack_border_hybrid(int, int *, double *);
void unpack_border(int, int, double *);
void unpack_border_vel(int, int, double *);
int unpack_border_hybrid(int, int, double *);
int pack_exchange(int, double *);
int unpack_exchange(double *);
int size_restart();
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, imageint, char **);
int data_atom_hybrid(int, char **);
void pack_data(double **);
int pack_data_hybrid(int, double *);
void write_data(FILE *, int, double **);
int write_data_hybrid(FILE *, double *);
double memory_usage();
// clear magnetic and mechanic forces
void force_clear(int, size_t);
void grow_reset();
// input lists to be checked
int pack_border_kokkos(int n, DAT::tdual_int_2d k_sendlist,
DAT::tdual_xfloat_2d buf,int iswap,
int pbc_flag, int *pbc, ExecutionSpace space);
void unpack_border_kokkos(const int &n, const int &nfirst,
const DAT::tdual_xfloat_2d &buf,
ExecutionSpace space);
int pack_exchange_kokkos(const int &nsend,DAT::tdual_xfloat_2d &buf,
DAT::tdual_int_1d k_sendlist,
DAT::tdual_int_1d k_copylist,
ExecutionSpace space, int dim,
X_FLOAT lo, X_FLOAT hi);
int unpack_exchange_kokkos(DAT::tdual_xfloat_2d &k_buf, int nrecv,
int nlocal, int dim, X_FLOAT lo, X_FLOAT hi,
ExecutionSpace space);
void sync(ExecutionSpace space, unsigned int mask);
void modified(ExecutionSpace space, unsigned int mask);
void sync_overlapping_device(ExecutionSpace space, unsigned int mask);
protected:
tagint *tag;
int *type,*mask;
imageint *image;
double **x,**v,**f; // lattice quantities
// spin quantities
double **sp; // sp[i][0-2] direction of the spin i
// sp[i][3] atomic magnetic moment of the spin i
double **fm; // fm[i][0-2] direction of magnetic precession
double **fm_long; // storage of long-range spin prec. components
DAT::t_tagint_1d d_tag;
HAT::t_tagint_1d h_tag;
DAT::t_int_1d d_type, d_mask;
HAT::t_int_1d h_type, h_mask;
DAT::t_imageint_1d d_image;
HAT::t_imageint_1d h_image;
DAT::t_x_array d_x;
DAT::t_v_array d_v;
DAT::t_f_array d_f;
DAT::t_sp_array d_sp;
DAT::t_fm_array d_fm;
DAT::t_fm_long_array d_fm_long;
HAT::t_sp_array h_sp;
HAT::t_fm_array h_fm;
HAT::t_fm_long_array h_fm_long;
DAT::tdual_int_1d k_count;
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: Per-processor system is too big
The number of owned atoms plus ghost atoms on a single
processor must fit in 32-bit integer.
E: Invalid atom type in Atoms section of data file
Atom types must range from 1 to specified # of types.
*/

View File

@ -758,6 +758,38 @@ typedef tdual_virial_array::t_dev_um t_virial_array_um;
typedef tdual_virial_array::t_dev_const_um t_virial_array_const_um;
typedef tdual_virial_array::t_dev_const_randomread t_virial_array_randomread;
// Spin Types
//3d SP_FLOAT array n*4
#ifdef LMP_KOKKOS_NO_LEGACY
typedef Kokkos::DualView<X_FLOAT*[4], Kokkos::LayoutLeft, LMPDeviceType> tdual_sp_array;
#else
typedef Kokkos::DualView<X_FLOAT*[4], Kokkos::LayoutRight, LMPDeviceType> tdual_sp_array;
#endif
typedef tdual_sp_array::t_dev t_sp_array;
typedef tdual_sp_array::t_dev_const t_sp_array_const;
typedef tdual_sp_array::t_dev_um t_sp_array_um;
typedef tdual_sp_array::t_dev_const_um t_sp_array_const_um;
typedef tdual_sp_array::t_dev_const_randomread t_sp_array_randomread;
//3d FM_FLOAT array n*3
typedef Kokkos::DualView<F_FLOAT*[3], Kokkos::LayoutRight, LMPDeviceType> tdual_fm_array;
typedef tdual_fm_array::t_dev t_fm_array;
typedef tdual_fm_array::t_dev_const t_fm_array_const;
typedef tdual_fm_array::t_dev_um t_fm_array_um;
typedef tdual_fm_array::t_dev_const_um t_fm_array_const_um;
typedef tdual_fm_array::t_dev_const_randomread t_fm_array_randomread;
//3d FML_FLOAT array n*3
typedef Kokkos::DualView<F_FLOAT*[3], Kokkos::LayoutRight, LMPDeviceType> tdual_fm_long_array;
typedef tdual_fm_long_array::t_dev t_fm_long_array;
typedef tdual_fm_long_array::t_dev_const t_fm_long_array_const;
typedef tdual_fm_long_array::t_dev_um t_fm_long_array_um;
typedef tdual_fm_long_array::t_dev_const_um t_fm_long_array_const_um;
typedef tdual_fm_long_array::t_dev_const_randomread t_fm_long_array_randomread;
//Energy Types
//1d E_FLOAT array n
@ -994,6 +1026,33 @@ typedef tdual_virial_array::t_host_um t_virial_array_um;
typedef tdual_virial_array::t_host_const_um t_virial_array_const_um;
typedef tdual_virial_array::t_host_const_randomread t_virial_array_randomread;
// Spin types
//2d X_FLOAT array n*3
typedef Kokkos::DualView<X_FLOAT*[3], Kokkos::LayoutRight, LMPDeviceType> tdual_sp_array;
typedef tdual_sp_array::t_host t_sp_array;
typedef tdual_sp_array::t_host_const t_sp_array_const;
typedef tdual_sp_array::t_host_um t_sp_array_um;
typedef tdual_sp_array::t_host_const_um t_sp_array_const_um;
typedef tdual_sp_array::t_host_const_randomread t_sp_array_randomread;
//2d F_FLOAT array n*3
typedef Kokkos::DualView<F_FLOAT*[3], Kokkos::LayoutRight, LMPDeviceType> tdual_fm_array;
//typedef Kokkos::DualView<F_FLOAT*[3], LMPDeviceType::array_layout, LMPDeviceType> tdual_f_array;
typedef tdual_fm_array::t_host t_fm_array;
typedef tdual_fm_array::t_host_const t_fm_array_const;
typedef tdual_fm_array::t_host_um t_fm_array_um;
typedef tdual_fm_array::t_host_const_um t_fm_array_const_um;
typedef tdual_fm_array::t_host_const_randomread t_fm_array_randomread;
//2d F_FLOAT array n*3
typedef Kokkos::DualView<F_FLOAT*[3], Kokkos::LayoutRight, LMPDeviceType> tdual_fm_long_array;
//typedef Kokkos::DualView<F_FLOAT*[3], LMPDeviceType::array_layout, LMPDeviceType> tdual_f_array;
typedef tdual_fm_long_array::t_host t_fm_long_array;
typedef tdual_fm_long_array::t_host_const t_fm_long_array_const;
typedef tdual_fm_long_array::t_host_um t_fm_long_array_um;
typedef tdual_fm_long_array::t_host_const_um t_fm_long_array_const_um;
typedef tdual_fm_long_array::t_host_const_randomread t_fm_long_array_randomread;
//Energy Types

View File

@ -42,6 +42,12 @@
#define ENERGY_MASK 0x00010000
#define VIRIAL_MASK 0x00020000
// SPIN
#define SP_MASK 0x00000001
#define FM_MASK 0x00000002
#define FML_MASK 0x00000004
// DPD
#define DPDRHO_MASK 0x00040000