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);
|
||||
|
||||
// change types of selected atoms
|
||||
// flag vecftor from select_subset() is only for eligible atoms
|
||||
|
||||
count = 0;
|
||||
for (i = 0; i < nlocal; i++)
|
||||
if (select[i] && flag[i]) {
|
||||
int eligible = 0;
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
if (!select[i]) continue;
|
||||
if (flag[eligible]) {
|
||||
atom->type[i] = newtype;
|
||||
count++;
|
||||
}
|
||||
eligible++;
|
||||
}
|
||||
|
||||
// clean up
|
||||
|
||||
|
||||
Reference in New Issue
Block a user