fflag and tflag with fix particletemplate/multisphere

Submitted by estefan31 on Fri, 05/12/2017 - 07:32

How do you use the fflag and tflag options in fix particletemplate/multisphere? I'm getting an "unknown keyword" error when I use it as follows:

fix particle_template all particletemplate/multisphere 608519 atom_type 1 density constant 1 nspheres 1000 ntry 100000 spheres file template_file.multisphere scale 1.0 type 1 mass 10 inertia_tensor 100 0. 0. 100 0. 100 use_volume fflag off on on tflag on off off

And if I put only two flag keywords "on on" instead of three "on on off" I get an error saying "not enough arguments for 'fflag'". Is there a bug in the source code or am I not using fflag and tflag the right way?

aaigner's picture

aaigner | Fri, 05/12/2017 - 13:11

Hello estefan31,

Thank you for bringing this up. This is a nice copy-paste-bug / not-thinking-during-coding-bug. I fixed it in the internal dev-version and it will be included in the next release.

If you need a quick fix for your version, you have to modify fix_template_multisphere.cpp:

  • Add iarg++ between lines 146/147 and 171/172
  • Change all strcmp(arg[iarg], XXX) to strcmp(arg[iarg], XXX) == 0 ( add the missing ' == 0')

Best wishes
Andreas

estefan31 | Fri, 05/12/2017 - 20:55

The changes you suggested help get rid of the error output, but the fflag and tflag options still aren't working. When I set fflag off off off and tflag off off off, the particles still move. I tried outputting the flag options in fix_template_multisphere.cpp and fix_multisphere.cpp to see if the flag options are even being considered. It seems that the flags are set properly in fix_template_multisphere.cpp, but lines 567-569 in fix_multisphere.cpp (if(fflag[ibody][0]) vcm[ibody][0] += dtfm * fcm[ibody][0];) always read fflag[i] as being equal to 1. So somehow the flag options are not being considered during integration of multisphere motion.

estefan31 | Sat, 05/13/2017 - 02:50

On line 132 of multisphere.cpp it says bool flags[3] = {true,true,true}. This is overriding any fflag and tflag inputs. It needs to be changed to take *fflag and *tflag arguments in place of "true". The fflag and tflag arguments are currently not being used in Multisphere::add_body(). And of course your fixes need to be implemented as well. This seems to work for my own purposes but I don't know if there are any other changes that need to be made.