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 Jun 25, 2024
1 parent b5a4fb6 commit ab89b0d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
9 changes: 9 additions & 0 deletions src/inputCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ 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 +237,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
10 changes: 6 additions & 4 deletions src/inputFile_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,12 @@ 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 ab89b0d

Please sign in to comment.