<commit_before>'''
    Script to plot total force trend.
'''
import sys

import numpy as np
from matplotlib import animation
import matplotlib.pyplot as plt

from vaspy.iter import OutCar

outcar = OutCar()
# plot
fig = plt.figure(figsize=(12, 7))
ax = fig.add_subplot(111)
forces = outcar.total_forces
step = range(forces.shape[0])
ax.plot(step, forces, linewidth=5, color='#4F94CD')
ax.set_xlabel(r'$\bf{Step}$')
ax.set_ylabel(r'$\bf{Total Force(eV/Angst)}$')
ax.set_ylim(0.0, np.max(forces)+0.5)

if len(sys.argv) > 1 and 'movie' in sys.argv[1]:
    line, = ax.plot([], [], linewidth=5, color='#CD6889')

    def init():
        line.set_data([], [])
        return line,

    def animate(i):
        y = np.linspace(0, np.max(forces)+0.5, 100)
        x = np.array([1.0*i]*100)
        line.set_data(x, y)
        return line,

    anim = animation.FuncAnimation(fig, animate, init_func=init, frames=step-2,
                                   interval=1.0/16*1000, blit=True)
    anim.save('max_forces.MP4')

plt.show()  # use plt to avoid window being closed
<commit_msg>add double color walking line<commit_after>'''
    Script to plot total force trend.
'''
import sys
import logging

import numpy as np
from matplotlib import animation
import matplotlib.pyplot as plt

from vaspy.iter import OutCar

outcar = OutCar()
# plot
fig = plt.figure(figsize=(12, 7))
ax = fig.add_subplot(111)
forces = outcar.total_forces
step = range(forces.shape[0])
ax.plot(step, forces, linewidth=5, color='#4F94CD')
ax.set_xlabel(r'$\bf{Step}$')
ax.set_ylabel(r'$\bf{Total Force(eV/Angst)}$')
ax.set_ylim(0.0, np.max(forces)+0.5)

if len(sys.argv) > 1 and 'movie' in sys.argv[1]:
    ax.plot([], [], linewidth=3, color='#CD6889')  # line below forces
    ax.plot([], [], linewidth=3, color='#668B8B')  # line above forces
    line_below, line_above = ax.lines[1:]

    def init():
        line_below.set_data([], [])
        line_above.set_data([], [])
        return line_below, line_above

    def animate(i):
        logging.info('frame %d', i)
        y_below = np.linspace(0, forces[i], 100)
        x = np.array([1.0*i]*100)
        y_above = np.linspace(forces[i], np.max(forces)+0.5, 100)
        line_below.set_data(x, y_below)
        line_above.set_data(x, y_above)

        return line_below, line_above

    anim = animation.FuncAnimation(fig, animate, init_func=init, frames=forces.shape[0],
                                   interval=1.0/16*1000, blit=True)
    anim.save('max_forces.MP4')

plt.show()  # use plt to avoid window being closed

{'fraction_non_alphanumeric': 0.15710919088766692, 'fraction_numerical': 0.03731343283582089, 'mean_word_length': 3.287878787878788, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4587214', 'n_tokens_mistral': 1013, 'n_tokens_neox': 934, 'n_words': 209}