5 template <typename Coord, typename Bond>
6 __global__ void K_UpdateRestShape(
7 DArrayList<Bond> bonds,
11 int pId = threadIdx.x + (blockIdx.x * blockDim.x);
12 if (pId >= pos.size()) return;
16 List<Bond>& bonds_i = bonds[pId];
17 List<int>& list_id_i = nbr[pId];
18 int nbSize = list_id_i.size();
19 for (int ne = 0; ne < nbSize; ne++)
21 int j = list_id_i[ne];
23 np.xi = pos[j] - pos[pId];
29// Bond np_0 = rest_shape_i[0];
30// rest_shape_i[0] = np;
31// rest_shape_i[ne] = np_0;
37 template<typename Coord, typename Bond>
38 void constructRestShape(DArrayList<Bond>& shape, DArrayList<int>& nbr, DArray<Coord>& pos)
47 __global__ void K_AddOne(
51 int tId = threadIdx.x + (blockIdx.x * blockDim.x);
52 if (tId >= nbr.size()) return;
54 num[tId] = nbr[tId].size();
57// template <typename Coord, typename Bond>
58// __global__ void K_UpdateRestShapeSelf(
59// DArrayList<Bond> shape,
62// int tId = threadIdx.x + (blockIdx.x * blockDim.x);
63// if (tId >= pos.size()) return;
70// shape[tId].insert(np);
73 template<typename Coord, typename Bond>
74 void constructRestShapeWithSelf(DArrayList<Bond>& shape, DArrayList<int>& nbr, DArray<Coord>& pos)
76 DArray<uint> num(nbr.size());
85// cuExecute(nbr.size(),
86// K_UpdateRestShapeSelf,
99 template void constructRestShape<Vec3f, TBond<DataType3f>>(DArrayList<TBond<DataType3f>>& shape, DArrayList<int>& nbr, DArray<Vec3f>& pos);
100 template void constructRestShapeWithSelf<Vec3f, TBond<DataType3f>>(DArrayList<TBond<DataType3f>>& shape, DArrayList<int>& nbr, DArray<Vec3f>& pos);