-
Notifications
You must be signed in to change notification settings - Fork 127
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 the calculation of the minimum interatomic distance #890
base: master
Are you sure you want to change the base?
Conversation
This is too slow for big systems. |
You need to study the MD book more carefully :) |
Ok, I'll learn from the MD book and change it to cuda. |
It is not about CUDA, but about |
double min_distance = 5.0; | ||
int min_n1 = -1, min_n2 = -1; | ||
|
||
double thickness[3]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thicknesses are not correctly calculated.
Add a new file
check_distance.cu
to the model folder to check if there are any two atoms with a spacing less than 1 angstrom in themodel.xyz
file at the beginning of the calculation.For orthogonal lattices, firstly, using the example of hnemd, the original
model.xyz
file will not report errors, but it will print out which two atoms are closest to each other normally. The atomic number starts from index 0 and serves only as a prompt, as shown in the following figure.Then, I changed the coordinates of atom 0 to
0 0 0
, so that it differs from atom 1 only by 0.71 angstroms in the y direction. This will result in an error message as shown in the following figure and prompt as an input error.Finally, there are periodic boundary conditions, as shown in the figure below. The left figure represents a non periodic boundary condition in the z-direction, while the right figure represents a periodic boundary condition. Non periodic boundary conditions do not generate errors, while periodic boundary conditions result in
3.35=0
in the z-direction, which is the same as the situation in the above figure.For non orthogonal lattices, I used a two-dimensional material that I had manually rubbed myself, and applied a vacuum layer of 20 angstroms to the original cell.
Similarly, a normal structure will not produce errors, only prompts. You will find
atom 1 Si
andatom 4 N
, where1
and4
start from the third line index of 0 in themodel.xyz
file, line by line, from0
toN-1
(N is the total number of atoms in the structure)Next, we will still use these two atoms. I want to change the xy coordinate of N atom to be the same as that of Si atom, and there will be an error message after execution.
Finally, it is still a periodic issue, due to the presence of a large vacuum layer in the z-direction, I applied non periodic boundary conditions in the x-direction and doubled the expansion in the x-direction.Here, two Mo atoms are used as a demonstration, and the abscissa of the last Mo atom is added by 2 angstroms.
I also tested a structure with 10 million atoms, which only takes about ten seconds. From the initial screen printing to the red box in the picture, it takes about half a minute. However, when checking the atomic distance, it only takes a little over ten seconds.