Skip to content

Commit

Permalink
Fix issue in input.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
stanmoore1 committed Feb 5, 2018
1 parent fbe8b07 commit 05679ec
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions src/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,38 @@ void Input::create_lattice(Comm* comm) {
// zero out momentum of the whole system afterwards, to eliminate
// drift (bad for energy statistics)

for(T_INT iz=iz_start; iz<=iz_end; iz++) {
T_FLOAT ztmp = lattice_constant * (iz+lattice_offset_z);
for(T_INT iy=iy_start; iy<=iy_end; iy++) {
T_FLOAT ytmp = lattice_constant * (iy+lattice_offset_y);
for(T_INT ix=ix_start; ix<=ix_end; ix++) {
T_FLOAT xtmp = lattice_constant * (ix+lattice_offset_x);
if((xtmp >= s.sub_domain_lo_x) &&
(ytmp >= s.sub_domain_lo_y) &&
(ztmp >= s.sub_domain_lo_z) &&
(xtmp < s.sub_domain_hi_x) &&
(ytmp < s.sub_domain_hi_y) &&
(ztmp < s.sub_domain_hi_z) ) {
n++;
}
}
}
}
system->grow(n);
System s = *system;
h_x = Kokkos::create_mirror_view(s.x);
h_v = Kokkos::create_mirror_view(s.v);
h_q = Kokkos::create_mirror_view(s.q);
h_type = Kokkos::create_mirror_view(s.type);
h_id = Kokkos::create_mirror_view(s.id);

n = 0;

// Initialize system using the equivalent of the LAMMPS
// velocity geom option, i.e. uniform random kinetic energies.
// zero out momentum of the whole system afterwards, to eliminate
// drift (bad for energy statistics)

for(T_INT iz=iz_start; iz<=iz_end; iz++) {
T_FLOAT ztmp = lattice_constant * (iz+lattice_offset_z);
for(T_INT iy=iy_start; iy<=iy_end; iy++) {
Expand Down Expand Up @@ -575,6 +607,40 @@ void Input::create_lattice(Comm* comm) {
// zero out momentum of the whole system afterwards, to eliminate
// drift (bad for energy statistics)

for(T_INT iz=iz_start; iz<=iz_end; iz++) {
for(T_INT iy=iy_start; iy<=iy_end; iy++) {
for(T_INT ix=ix_start; ix<=ix_end; ix++) {
for(int k = 0; k<4; k++) {
T_FLOAT xtmp = lattice_constant * (1.0*ix+basis[k][0]);
T_FLOAT ytmp = lattice_constant * (1.0*iy+basis[k][1]);
T_FLOAT ztmp = lattice_constant * (1.0*iz+basis[k][2]);
if((xtmp >= s.sub_domain_lo_x) &&
(ytmp >= s.sub_domain_lo_y) &&
(ztmp >= s.sub_domain_lo_z) &&
(xtmp < s.sub_domain_hi_x) &&
(ytmp < s.sub_domain_hi_y) &&
(ztmp < s.sub_domain_hi_z) ) {
n++;
}
}
}
}
}
system->grow(n);
System s = *system;
h_x = Kokkos::create_mirror_view(s.x);
h_v = Kokkos::create_mirror_view(s.v);
h_q = Kokkos::create_mirror_view(s.q);
h_type = Kokkos::create_mirror_view(s.type);
h_id = Kokkos::create_mirror_view(s.id);

n = 0;

// Initialize system using the equivalent of the LAMMPS
// velocity geom option, i.e. uniform random kinetic energies.
// zero out momentum of the whole system afterwards, to eliminate
// drift (bad for energy statistics)

for(T_INT iz=iz_start; iz<=iz_end; iz++) {
for(T_INT iy=iy_start; iy<=iy_end; iy++) {
for(T_INT ix=ix_start; ix<=ix_end; ix++) {
Expand Down

0 comments on commit 05679ec

Please sign in to comment.