Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default velocity #653

Merged
merged 3 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/gpumd/input_parameters/velocity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ Caveats
This is, however, not a problem since during the MD simulation, the Maxwell distribution will be achieved automatically within a short time.
* The total linear and angular momenta are set to zero.
* If there are already velocity data in the :ref:`simulation model file <model_xyz>`, the initial temperature will not be used and the velocities will be initialized as those in the simulation model file.
**Important:** In this case, you still need to write this keyword, otherwise the velocities will not be initialized at all (and will hence be undefined).
* If there are not velocity data in the :ref:`simulation model file <model_xyz>`, and this keyword is missing, velocities will be initialized with a default temperature of 300 K.
18 changes: 18 additions & 0 deletions src/main_gpumd/run.cu
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,21 @@ Run::Run()

allocate_memory_gpu(group, atom, thermo);

velocity.initialize(
has_velocity_in_xyz,
300,
atom.cpu_mass,
atom.cpu_position_per_atom,
atom.cpu_velocity_per_atom,
atom.velocity_per_atom,
true,
123);
if (has_velocity_in_xyz) {
printf("Initialized velocities with data in model.xyz.\n");
} else {
printf("Initialized velocities with default T = 300 K.\n");
}

print_line_1();
printf("Finished initializing positions and related parameters.\n");
fflush(stdout);
Expand Down Expand Up @@ -487,6 +502,9 @@ void Run::parse_velocity(const char** param, int num_param)
atom.velocity_per_atom,
use_seed,
seed);
if (!has_velocity_in_xyz) {
printf("Initialized velocities with input T = %g K.\n", initial_temperature);
}
}

void Run::parse_correct_velocity(const char** param, int num_param)
Expand Down
2 changes: 0 additions & 2 deletions src/main_gpumd/velocity.cu
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,6 @@ void Velocity::initialize(
}

velocity_per_atom.copy_from_host(cpu_velocity_per_atom.data());

printf("Initialized velocities with T = %g K.\n", initial_temperature);
}

void Velocity::finalize() { do_velocity_correction = false; }
Loading