SCM-NV/pyZacros

Load_external function for just one Zacros input

Closed this issue · 3 comments

Hi @nfaguirrec,

I was wondering if the load_external function

def load_external(cls, path, settings=None, finalize=False, restart=None):

could be more flexible so not all the input files have to be present. I am trying to load from disk just the lattice_input.dat but it is complaining that simulation_input.dat, mechanism_input.dat etc. are not present. I don't need to read them because they are pyZacros scripts, similar to this:

# Gas species:
CO_g = pz.Species("CO")
O2_g = pz.Species("O2")
CO2_g = pz.Species("CO2", gas_energy=-2.337)

# Surface species:
s0 = pz.Species("*", 1)      # Empty adsorption site
CO_s = pz.Species("CO*", 1)
O_s = pz.Species("O*", 1)

# Clusters:
CO_p = pz.Cluster( species=[CO_s], cluster_energy=-1.3 )
O_p = pz.Cluster( species=[O_s], cluster_energy=-2.3 )

# Elementary Reactions
CO_ads = pz.ElementaryReaction( initial=[s0, CO_g], final=[CO_s],
                                reversible=False, pre_expon=10.0, activation_energy=0.0 )

O2_ads = pz.ElementaryReaction( initial=[s0, s0, O2_g], final=[O_s, O_s], neighboring=[(0, 1)],
                                reversible=False, pre_expon=2.5, activation_energy=0.0 )

CO_oxi = pz.ElementaryReaction( initial=[CO_s, O_s], final=[s0, s0, CO2_g], neighboring=[(0, 1)],
                                reversible=False, pre_expon=1.0e+20, activation_energy=0.0)

scm.plams.init()

# Settings:
sett = pz.Settings()
sett.temperature = 500.0
sett.pressure = 1.0
sett.snapshots = ('time', 5.e-1)
sett.process_statistics = ('time', 1.e-2)
sett.species_numbers = ('time', 1.e-2)
sett.max_time = 25.0

sett.molar_fraction.CO = 0.45
sett.molar_fraction.O2 = 0.55

input_job = pz.ZacrosJob.load_external(./)
myJob = pz.ZacrosJob( settings=sett, lattice=input_job.lattice,
                        mechanism=[CO_ads, O2_ads, CO_oxi],
                        cluster_expansion=[CO_p, O_p] )

Basically to make the method __recreate_lattice_input public.

Thanks

Hi Pablo,

That's a great idea. I'll take a look at it.

Nestor

Hi @lopeztarifa,

Now you can do this:

mylatt = Lattice( fileName='myjob/lattice_input.dat')

Even more, now you can do the same for Mechanism and ClusterExpansion. However, for these cases, you need to use the gas_species or surfaces_species (previously defined somewhere else) as follows:

myclus = ClusterExpansion( fileName='myjob/energetics_input.dat', surface_species=surface_species )
mymech = Mechanism(fileName='myjob/mechanism_input.dat', , gas_species=gas_species, surface_species=surface_species )

I hope this helps you!

Best,
Nestor

I tested the Lattice and it's working, thanks @nfaguirrec !