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

add a new command #861

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft

Conversation

dongxianchao
Copy link

mc local_minimize mc_trials scale_factor force_tolerance maximal_number_of_relaxation_steps [group grouping_method group_id]
This can perform simple mc and local relaxation.

Previously, we need to write a python jobscript to do the work, randomly select two atoms and swap - relax the structure - get the energy difference to calculate the probability of swap.
Now the work flow has been implemented in GPUMD, although there still need some modification. The local relaxation method has been implemented, which means each time swap 2 atoms, we don't need to relax the whole system to get the energy, and the volumn of relax area can be controlled by the scale factor. The sphere area with radius scale_factor radial_cutoff will be calculated.
In mcmd.out file, the Maximum displacement, Average displacement and Accept ratio will be calculated. The two displacement value are calculated from the atoms falls in the range from (scale_factor - 1) * cutoff_radius to scale_factor * cutoff_radius, where is the edge of the sphere we are going to relax. One can adjust the scale factor to a reasonable value according to this. The smaller they are, the smaller the energy difference with the global relaxation will be.

TO DO: modify the output file
modify the code structure

@brucefan1983 brucefan1983 marked this pull request as draft January 8, 2025 18:21
@brucefan1983
Copy link
Owner

brucefan1983 commented Jan 8, 2025

This is a very specialized feature, so I suggest you make your code localized. You should nearly not touch the existing files, but just create new files.

@dongxianchao
Copy link
Author

This is a very specialized feature, so I suggest you make your code localized. You should nearly not touch the existing files, but just create new files.

How about write a new key word like mc_local, and construct that class totally independent of mc, but still depend on nep_energy? The minimize part, I write a new function in minimize_fire which can only update the labelled atoms by input an array like [0, 0, 1, 1, 0......], 1 means the atoms need to update and 0 means not change. I'm not sure if it's useful for other function, if it is we may keep it in minimize to increase code reusability.

@brucefan1983
Copy link
Owner

You can create a new folder mc_minimize/ and put all the new code there. The function added to the fire minimizer class is ok.

@brucefan1983
Copy link
Owner

mc_minimize is at the same level of mc

@brucefan1983
Copy link
Owner

Good change. Now you need to resotre the residual changes in the files within the mc/ folder.

You can view the changes online. For example:

image

@dongxianchao
Copy link
Author

Hi Prof. Fan,

I've finished the major part work. I add a new key word "mc_minimize", and you can use command
mc_minimize global mc_trials force_tolerance maximal_number_of_relaxation_steps [group grouping_method group_id]
for a simple MC with global relaxation. For local relaxation, here is the command
mc_minimize local mc_trials force_tolerance maximal_number_of_relaxation_steps scale_factor [group grouping_method group_id].

Now this part is highly modular. It's independent of nep_energy in mc, instead, I use the potential.cuh directly to calculate the force and energy. It's not that beautiful in minimize part. The code still use Minimizer_fire object directly. Later I may try to modify this part if there is any requirement. I feel it's better to use the interface of minimizer. But till now, the fire method seems enough for relaxation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants