Searching and parsing text from a file
One tip: use the argparse module.
import argparse
    
parser = argparse.ArgumentParser()

parser.add_argument(&quot;--log_file&quot;, dest=&quot;log_file&quot;, type=str, required=True, help=&quot;Add some help text here&quot;)
parser.add_argument(&quot;--input_file&quot;, dest=&quot;input_file&quot;, type=str, required=True, help=&quot;Add some help text here&quot;)

args = parser.parse_args()

# show the values, will reach this point only if the two parameters were provided
print(f&quot;log_file: {args.log_file}&quot;)
print(f&quot;input_file: {args.input_file}&quot;)

Then you call your script like this:
python3 generate.py --log_file test.log --input_file test.txt

Parameter order is free.
I have to admit I don't understand much about the purpose since I don't know about your input files.
If they are CSV then you might consider using the csv module. Then you should be able to simplify some statements like this one:
total_force=[float(line.split()[3]) for line in log if line.rfind('Total force =') != -1][-1]

Something is lacking in your script, badly: comments. They will help you too, especially when go back to reviewing code you wrote a few months ago. Probably you will have forgotten details and will have to reanalyze your own code.