Skip to content

Commit

Permalink
Add a CLI flag for unbalanced system
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed Aug 27, 2024
1 parent 9af677b commit f6bcb5a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
7 changes: 7 additions & 0 deletions src/inputCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ void InputCL::read_args( int argc, char *argv[] )
" (N = positive integer)\n",
" (PATH = location of ",
"directory)\n" );
log( std::cout, " --unbalanced : "
"create a vacuum for an unbalanced system\n" );
}

// Read Lammps input deck
Expand Down Expand Up @@ -233,6 +235,11 @@ void InputCL::read_args( int argc, char *argv[] )
i += 3;
}

else if ( ( strcmp( argv[i], "--unbalanced" ) == 0 ) )
{
unbalanced = true;
}

else if ( ( strstr( argv[i], "--kokkos-" ) == NULL ) )
{
log_err( std::cout, "Unknown command line argument: ", argv[i] );
Expand Down
1 change: 1 addition & 0 deletions src/inputCL.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class InputCL
int layout_type;
int nnp_layout_type;
int device_type;
bool unbalanced = false;

int dumpbinary_rate, correctness_rate;
bool dumpbinaryflag, correctnessflag;
Expand Down
11 changes: 7 additions & 4 deletions src/inputFile_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,13 @@ void InputFile<t_System>::create_lattice( Comm<t_System> *comm )
T_X_FLOAT max_z = lattice_constant * lattice_nz;
std::array<T_X_FLOAT, 3> global_low = { 0.0, 0.0, 0.0 };
std::array<T_X_FLOAT, 3> global_high = { max_x, max_y, max_z };
// Uncomment the following to create a vacuum for an unbalanced system.
// global_high[0] *= 2;
// global_high[1] *= 2;
// global_high[2] *= 2;
if ( commandline.unbalanced )
{
// Create a vacuum for an unbalanced system.
global_high[0] *= 2;
global_high[1] *= 2;
global_high[2] *= 2;
}
system->create_domain( global_low, global_high, comm_ghost_cutoff );
s = *system;

Expand Down

0 comments on commit f6bcb5a

Please sign in to comment.