#pragma once namespace particle { enum lattice{ lattice_sc=0, lattice_bcc=1, lattice_fcc=2 }; template void initialize_lattice( container& particles, lattice lattice_type, const field_t& field ){ const size_t num_p_in_load = field.local_size(); const size_t overload = 1< void set_positions( container& particles, lattice lattice_type, int idim, real_t lunit, field_t& field ) { const size_t num_p_in_load = field.local_size(); for( size_t i=0,ipcount=0; i(i,j,k); particles.set_pos( ipcount++, idim, pos[idim]*lunit + field.relem(i,j,k) ); } } } if( lattice_type == particle::lattice_bcc ){ field.shift_field( 0.5, 0.5, 0.5 ); auto ipcount0 = num_p_in_load; for( size_t i=0,ipcount=ipcount0; i(i,j,k,0.5,0.5,0.5); particles.set_pos( ipcount++, idim, pos[idim]*lunit + field.relem(i,j,k) ); } } } } else if( lattice_type == particle::lattice_fcc ){ // 0.5 0.5 0.0 field.shift_field( 0.5, 0.5, 0.0 ); auto ipcount0 = num_p_in_load; for( size_t i=0,ipcount=ipcount0; i(i,j,k,0.5,0.5,0.0); particles.set_pos( ipcount++, idim, pos[idim]*lunit + field.relem(i,j,k) ); } } } // 0.0 0.5 0.5 field.shift_field( -0.5, 0.0, 0.5 ); ipcount0 = 2*num_p_in_load; for( size_t i=0,ipcount=ipcount0; i(i,j,k,0.0,0.5,0.5); particles.set_pos( ipcount++, idim, pos[idim]*lunit + field.relem(i,j,k) ); } } } // 0.5 0.0 0.5 field.shift_field( 0.5, -0.5, 0.0 ); ipcount0 = 3*num_p_in_load; for( size_t i=0,ipcount=ipcount0; i(i,j,k,0.5,0.0,0.5); particles.set_pos( ipcount++, idim, pos[idim]*lunit + field.relem(i,j,k) ); } } } } } template void set_velocities( container& particles, lattice lattice_type, int idim, field_t& field ) { const size_t num_p_in_load = field.local_size(); for( size_t i=0,ipcount=0; i