Creating a bash script or something to run through several directories

خرید بک لینک

I had a quick question. I have the code below, which as you can see, I am loading in a file. Note that I am in the folder "Angle1" and that I am in the subfolder "1eV"

The code works fine and does what I want it to for this folder. It just prints the number of vacancies to the screen in that file of interest. Is there a way I can loop through with a bash script though? I don't want to manually change "1eV" to "2eV" and so on, up to "150eV"

Also, it would be nice if as it loops though, it writes the number of vacancies to a file, rather than just the terminal. That way, at the end, I'll have a single file in parent directory which has 150 numbers. I can do this manually, it just takes time. I thought I'd check here in case anyone knows how to speed this up for me.

As an extra, I also have to loop all of this through all the Angle folders, which goes Angle1 to Angle24

Thanks!

# Import OVITO modules.
from ovito.io import *
from ovito.modifiers import *

# Import NumPy module.
import numpy


node = import_file("/media/isnps/Seagate Backup Plus Drive/metal_oxides/chromia/TDE/Oxygen/timestep_0.2fs/PKA3_YZ/Angle1/1eV/cascade.dump",multiple_frames = True)

ovito.dataset.anim.current_frame = 1


mod = WignerSeitzAnalysisModifier()
mod.reference.load("/media/isnps/Seagate Backup Plus Drive/metal_oxides/chromia/TDE/STP/position_perfect_300.dump")
node.modifiers.append(mod)
node.compute()
print("Number of vacant sites: %i" % mod.vacancy_count)

Recent Questions...

ما را در سایت Recent Questions دنبال می‌کنید

برچسب: نویسنده: استخدام کار بازدید: 174 تاريخ: شنبه 1 خرداد 1395 ساعت: 5:24

صفحه بندی