Reading different force values from a file and using addforce to add the external force (editing source code)

Thanks for the suggestion as to edit the source code of fix_addforce for reading from file. Just to make sure I am not doing a blunder as i am editing a source file, I would just like to know whether I am supposed to edit the class void FixSetForce::post_force(int vflag) and in that under // variable force, wrap with clear/add i need to add a for loop such that f[i][0] = fxvalue[i] read from file and foriginal[0]+ = f[i][0] to add this to the present force. Do I need to take care of anything else in any other files if i add these?

Thanks in advance

Vaidyanathan M S

Dept of Chemical Engg

UT Austin

Am I missing here something really fundamental?

yes, variable file doesn’t work the way you are using it. It
is designed to provide single values, on successive
evaluations of an equal-style variable. The doc page
explains this. To use a file of values to populate
an entire atom-style variable would require
different coding.

The simplest thing for you to do would be
to add some code to fix setforce to read
in the file and set the forces like you want them.

Steve

Without coding it myself, I don’t know. I suggest
you try it out, and debug the results.

Steve