Skip to content

Commit

Permalink
Added changes from Paul: Remove extra indent in some pyzacros example…
Browse files Browse the repository at this point in the history
…s. SCMSUITE-9003 SO--
  • Loading branch information
nfaguirrec committed Mar 28, 2024
1 parent 5150b0c commit 604100b
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 39 deletions.
6 changes: 3 additions & 3 deletions doc/source/components/cluster.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ The following lines illustrate an example:
.. code-block:: python
:linenos:
# Cluster Expansion
ce = pz.ClusterExpansion([CO_p, O_p])
print(ce)
# Cluster Expansion
ce = pz.ClusterExpansion([CO_p, O_p])
print(ce)
which produce the following output:

Expand Down
12 changes: 6 additions & 6 deletions doc/source/components/latticestate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ We are going to make the initial state as a randomly populated lattice by ``CO*`
.. code-block:: python
:linenos:
# LatticeState setup (initial state)
ist = pz.LatticeState(lat, surface_species=spl.surface_species())
ist.fill_sites_random(site_name='StTp1', species='CO*', coverage=0.1)
ist.fill_sites_random(site_name='StTp1', species='O*', coverage=0.1)
# LatticeState setup (initial state)
ist = pz.LatticeState(lat, surface_species=spl.surface_species())
ist.fill_sites_random(site_name='StTp1', species='CO*', coverage=0.1)
ist.fill_sites_random(site_name='StTp1', species='O*', coverage=0.1)
print(ist)
print(ist)
ist.plot()
ist.plot()
Similarly to the other classes, the function ``print()`` (see line 6) allows taking a look at the Zacros code that
will be internally generated, which for this example is the following:
Expand Down
8 changes: 4 additions & 4 deletions doc/source/components/zacrosjob.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ The ``ZacrosJob`` class constructor requires a Settings object, and the set of o
.. code-block:: python
:linenos:
job = pz.ZacrosJob( settings=sett, lattice=lat,
mechanism=[CO_ads, O2_ads, CO_oxi],
cluster_expansion=[CO_p, O_p] )
job = pz.ZacrosJob( settings=sett, lattice=lat,
mechanism=[CO_ads, O2_ads, CO_oxi],
cluster_expansion=[CO_p, O_p] )
print(job)
print(job)
In the previous code, we used the function print() to see the content of the files that are going to be used with Zacros. This output information is separated into 4 sections, each corresponding to the zacros input files: ``simulation_input.dat``, ``lattice_input.dat``, ``energetics_input.dat``, and ``mechanism_input.dat``.

Expand Down
16 changes: 8 additions & 8 deletions doc/source/components/zacrosresults.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ For our example (see :ref:`use case system <use_case_model_zgb>`), the following
.. code-block:: python
:linenos:
results = job.run()
results = job.run()
if( job.ok() ):
provided_quantities = results.provided_quantities()
print("nCO2 =", provided_quantities['CO2'])
if( job.ok() ):
provided_quantities = results.provided_quantities()
print("nCO2 =", provided_quantities['CO2'])
results.plot_molecule_numbers( results.gas_species_names() )
results.plot_lattice_states( results.lattice_states() )
results.plot_molecule_numbers( results.gas_species_names() )
results.plot_lattice_states( results.lattice_states() )
pstat = results.get_process_statistics()
results.plot_process_statistics( pstat, key="number_of_events" )
pstat = results.get_process_statistics()
results.plot_process_statistics( pstat, key="number_of_events" )
Here, the ``ZacrosResults`` object ``results`` is created by calling the method ``run()`` of the corresponding ``ZacrosJob`` job (line 1).
Expand Down
36 changes: 18 additions & 18 deletions doc/source/extended_components/zacrosparametersscanresults.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ The following lines of code show an example of how to use the ``ZacrosParameters
.. code-block:: python
:linenos:
ps_parameters = pz.ZacrosParametersScanJob.Parameters()
ps_parameters.add( 'x_CO', 'molar_fraction.CO', numpy.arange(0.1, 1.0, 0.1) )
ps_parameters.add( 'x_O2', 'molar_fraction.O2', lambda params: 1.0-params['x_CO'] )
ps_parameters.set_generator( pz.ZacrosParametersScanJob.zipGenerator )
print(ps_parameters)
ps_job = pz.ZacrosParametersScanJob( reference=z_job, parameters=ps_parameters )
results = ps_job.run()
if( ps_job.ok() ):
results_dict = results.turnover_frequency()
print(results_dict[0])
print("%4s"%"cond", "%8s"%"x_CO", "%10s"%"TOF_CO2")
for i,idx in enumerate(results.indices()):
print( '%4d'%i,
'%8.2f'%results_dict[i]['x_CO'],
'%10.6f'%results_dict[i]['turnover_frequency']['CO2'] )
ps_parameters = pz.ZacrosParametersScanJob.Parameters()
ps_parameters.add( 'x_CO', 'molar_fraction.CO', numpy.arange(0.1, 1.0, 0.1) )
ps_parameters.add( 'x_O2', 'molar_fraction.O2', lambda params: 1.0-params['x_CO'] )
ps_parameters.set_generator( pz.ZacrosParametersScanJob.zipGenerator )
print(ps_parameters)
ps_job = pz.ZacrosParametersScanJob( reference=z_job, parameters=ps_parameters )
results = ps_job.run()
if( ps_job.ok() ):
results_dict = results.turnover_frequency()
print(results_dict[0])
print("%4s"%"cond", "%8s"%"x_CO", "%10s"%"TOF_CO2")
for i,idx in enumerate(results.indices()):
print( '%4d'%i,
'%8.2f'%results_dict[i]['x_CO'],
'%10.6f'%results_dict[i]['turnover_frequency']['CO2'] )
Lines 1-8 were already discusssed before (see :ref:`ZacrosParametersScanJob <zacrosparametersscanjob>`).
Here, the ``ZacrosParametersScanResults`` object ``results`` is created by calling the method ``run()`` of the corresponding ``ZacrosParametersScanJob`` job (line 8).
Expand Down

0 comments on commit 604100b

Please sign in to comment.