git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@8725 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2012-08-28 15:07:23 +00:00
parent 664b3aff1d
commit 8a97b39ea3
2 changed files with 118 additions and 90 deletions

View File

@ -38,15 +38,15 @@
namespace LAMMPS_NS
{
class Cuda : protected Pointers
{
class Cuda : protected Pointers
{
public:
Cuda(class LAMMPS *);
Cuda(class LAMMPS*);
~Cuda();
//static void setDevice(class LAMMPS*);
void allocate();
void accelerator(int, char **);
void accelerator(int, char**);
void setSharedDataZero();
void setSystemParams();
@ -54,36 +54,38 @@ namespace LAMMPS_NS
void setDomainParams();
void checkResize();
void evsetup_eatom_vatom(int eflag_atom,int vflag_atom);
void evsetup_eatom_vatom(int eflag_atom, int vflag_atom);
void uploadAll();
void downloadAll();
void upload(int datamask);
void download(int datamask);
void downloadX();
class CudaNeighList* registerNeighborList(class NeighList* neigh_list);
void uploadAllNeighborLists();
void downloadAllNeighborLists();
void set_neighinit(int dist_check, double triggerneighsq)
{
shared_data.atom.dist_check=dist_check;
void set_neighinit(int dist_check, double triggerneighsq) {
shared_data.atom.dist_check = dist_check;
shared_data.atom.triggerneighsq = triggerneighsq;
}
bool decide_by_integrator()
{
bool decide_by_integrator() {
return neighbor_decide_by_integrator && cu_xhold && finished_setup;
}
void update_xhold(int &maxhold,double* xhold);
void update_xhold(int &maxhold, double* xhold);
void setTimingsZero();
void print_timings();
void cu_x_download() {cu_x->download();}
void cu_x_download() {
cu_x->download();
}
bool device_set;
bool dotiming;
bool dotestatom;
int testatom;
double uploadtime,downloadtime;
bool finished_setup,begin_setup;
double uploadtime, downloadtime;
bool finished_setup, begin_setup;
bool oncpu;
bool finished_run;
@ -147,7 +149,7 @@ namespace LAMMPS_NS
private:
std::map<class NeighList*, class CudaNeighList*> neigh_lists;
};
};
}
#endif // CUDA_H

View File

@ -25,7 +25,10 @@
#include "fix.h"
#include "compute.h"
#include "output.h"
#include "input.h"
#include "variable.h"
#include "dump.h"
#include "memory.h"
#include "error.h"
using namespace LAMMPS_NS;
@ -241,6 +244,29 @@ void Group::assign(int narg, char **arg)
delete [] list;
// style = variable
} else if (strcmp(arg[1],"variable") == 0) {
int ivar = input->variable->find(arg[2]);
if (ivar < 0) error->all(FLERR,"Variable name for group does not exist");
if (!input->variable->atomstyle(ivar))
error->all(FLERR,"Variable for group is invalid style");
double *aflag;
// aflag = evaluation of per-atom variable
memory->create(aflag,nlocal,"group:aflag");
input->variable->compute_atom(ivar,0,aflag,1,0);
// add to group if per-atom variable evaluated to non-zero
for (i = 0; i < nlocal; i++)
if (aflag[i] != 0.0) mask[i] |= bit;
memory->destroy(aflag);
// style = subtract
} else if (strcmp(arg[1],"subtract") == 0) {