fix bug in set type/ratio when operating on subsets
This commit is contained in:
@ -1084,13 +1084,18 @@ void Set::setrandom(int keyword)
|
|||||||
ranmars->select_subset(nsubset,count,flag,work);
|
ranmars->select_subset(nsubset,count,flag,work);
|
||||||
|
|
||||||
// change types of selected atoms
|
// change types of selected atoms
|
||||||
|
// flag vecftor from select_subset() is only for eligible atoms
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for (i = 0; i < nlocal; i++)
|
int eligible = 0;
|
||||||
if (select[i] && flag[i]) {
|
for (i = 0; i < nlocal; i++) {
|
||||||
|
if (!select[i]) continue;
|
||||||
|
if (flag[eligible]) {
|
||||||
atom->type[i] = newtype;
|
atom->type[i] = newtype;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
eligible++;
|
||||||
|
}
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user