forked from lijiext/lammps
Added option to impose fix propel/self only to specific types
This commit is contained in:
parent
768fd8f7fe
commit
60c0270375
|
@ -30,8 +30,25 @@ thermo_style custom time step pe ke etotal temp
|
||||||
thermo 1000
|
thermo 1000
|
||||||
run 25000
|
run 25000
|
||||||
|
|
||||||
|
group one type 1
|
||||||
|
group two type 2
|
||||||
|
|
||||||
|
compute ke1 one ke
|
||||||
|
compute ke2 two ke
|
||||||
|
|
||||||
|
thermo_style custom time step pe ke etotal temp c_ke1 c_ke2
|
||||||
|
|
||||||
fix active all propel/self velocity 1.0
|
fix active all propel/self velocity 1.0
|
||||||
|
|
||||||
# With active force there is more motion so increase bin size:
|
# With active force there is more motion so increase bin size:
|
||||||
neighbor 1.0 bin
|
neighbor 1.0 bin
|
||||||
run 25000
|
run 25000
|
||||||
|
|
||||||
|
# Only make type 1 active:
|
||||||
|
fix active all propel/self velocity 1.0 types 1
|
||||||
|
|
||||||
|
# With active force there is more motion so increase bin size:
|
||||||
|
neighbor 1.0 bin
|
||||||
|
run 25000
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -88,8 +88,10 @@ FixPropelSelf::FixPropelSelf( LAMMPS *lmp, int narg, char **argv )
|
||||||
// In this case we need to allocate the type list.
|
// In this case we need to allocate the type list.
|
||||||
// First find the largest given type:
|
// First find the largest given type:
|
||||||
int max_type_in_list = 0;
|
int max_type_in_list = 0;
|
||||||
while (!isalpha(arg[iarg + n_types_filter][0])) {
|
++iarg;
|
||||||
int curr_type = force->numeric(FLERR, arg[iarg + n_types_filter]);
|
while ( (iarg + n_types_filter < narg) &&
|
||||||
|
(!isalpha(argv[iarg + n_types_filter][0]))) {
|
||||||
|
int curr_type = force->numeric(FLERR, argv[iarg + n_types_filter]);
|
||||||
if (curr_type > max_type_in_list) max_type_in_list = curr_type;
|
if (curr_type > max_type_in_list) max_type_in_list = curr_type;
|
||||||
++n_types_filter;
|
++n_types_filter;
|
||||||
}
|
}
|
||||||
|
@ -110,10 +112,11 @@ FixPropelSelf::FixPropelSelf( LAMMPS *lmp, int narg, char **argv )
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < n_types_filter; ++i) {
|
for (int i = 0; i < n_types_filter; ++i) {
|
||||||
int curr_type = force->numeric(FLERR, arg[iarg + i]);
|
int curr_type = force->numeric(FLERR, argv[iarg + i]);
|
||||||
apply_to_type[curr_type] = 1;
|
apply_to_type[curr_type] = 1;
|
||||||
}
|
}
|
||||||
// Done handling types argument.
|
// Done handling types argument.
|
||||||
|
iarg += n_types_filter; // -1 because we incremented by 1 previously.
|
||||||
} else {
|
} else {
|
||||||
char msg[2048];
|
char msg[2048];
|
||||||
sprintf(msg, "Illegal fix propel/self command: "
|
sprintf(msg, "Illegal fix propel/self command: "
|
||||||
|
@ -158,6 +161,7 @@ void FixPropelSelf::post_force(int vflag )
|
||||||
case VELOCITY:
|
case VELOCITY:
|
||||||
if (n_types_filter) post_force_velocity<1>(vflag);
|
if (n_types_filter) post_force_velocity<1>(vflag);
|
||||||
else post_force_velocity<0>(vflag);
|
else post_force_velocity<0>(vflag);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
error->all(FLERR, "reached statement that should be unreachable");
|
error->all(FLERR, "reached statement that should be unreachable");
|
||||||
}
|
}
|
||||||
|
@ -173,6 +177,8 @@ void FixPropelSelf::post_force_quaternion(int /* vflag */ )
|
||||||
|
|
||||||
int *mask = atom->mask;
|
int *mask = atom->mask;
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
|
int *type = atom->type;
|
||||||
|
int* ellipsoid = atom->ellipsoid;
|
||||||
|
|
||||||
AtomVecEllipsoid::Bonus *bonus = av->bonus;
|
AtomVecEllipsoid::Bonus *bonus = av->bonus;
|
||||||
// Add the active force to the atom force:
|
// Add the active force to the atom force:
|
||||||
|
@ -185,7 +191,6 @@ void FixPropelSelf::post_force_quaternion(int /* vflag */ )
|
||||||
double f_act[3] = { 0.0, 0.0, 1.0 };
|
double f_act[3] = { 0.0, 0.0, 1.0 };
|
||||||
double f_rot[3];
|
double f_rot[3];
|
||||||
|
|
||||||
int* ellipsoid = atom->ellipsoid;
|
|
||||||
double *quat = bonus[ellipsoid[i]].quat;
|
double *quat = bonus[ellipsoid[i]].quat;
|
||||||
tagint *tag = atom->tag;
|
tagint *tag = atom->tag;
|
||||||
|
|
||||||
|
@ -228,6 +233,7 @@ void FixPropelSelf::post_force_velocity(int /*vflag*/ )
|
||||||
int *mask = atom->mask;
|
int *mask = atom->mask;
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
tagint *tag = atom->tag;
|
tagint *tag = atom->tag;
|
||||||
|
int *type = atom->type;
|
||||||
|
|
||||||
// Add the active force to the atom force:
|
// Add the active force to the atom force:
|
||||||
for( int i = 0; i < nlocal; ++i ){
|
for( int i = 0; i < nlocal; ++i ){
|
||||||
|
|
Loading…
Reference in New Issue