support setting electron spin and radius with the set command

This commit is contained in:
Axel Kohlmeyer
2022-08-30 06:11:17 -04:00
parent 58fcf26581
commit bfb15c6cc6
2 changed files with 37 additions and 3 deletions

View File

@ -976,6 +976,8 @@ void Set::set(int keyword)
// set magnetic moments
else if (keyword == SPIN_ATOM) {
if (dvalue < 0.0)
error->one(FLERR,"Incorrect value for atomic spin magnitude: {}", dvalue);
double **sp = atom->sp;
double inorm = 1.0/sqrt(xvalue*xvalue+yvalue*yvalue+zvalue*zvalue);
sp[i][0] = inorm*xvalue;
@ -984,6 +986,23 @@ void Set::set(int keyword)
sp[i][3] = dvalue;
}
// set electron radius
else if (keyword == RADIUS_ELECTRON) {
atom->eradius[i] = dvalue;
if (dvalue < 0.0)
error->one(FLERR,"Incorrect value for electron radius: {}", dvalue);
}
// set electron spin
else if (keyword == SPIN_ELECTRON) {
if ((dvalue == -1) || (dvalue == 1) || (dvalue == 0) || (dvalue == 2) || (dvalue == 3))
atom->spin[i] = (int)dvalue;
else
error->one(FLERR,"Incorrect value for electron spin: {}", dvalue);
}
// set quaternion orientation of ellipsoid or tri or body particle or sphere/bpm
// enforce quat rotation vector in z dir for 2d systems