diff --git a/doc/source/components/cluster.rst b/doc/source/components/cluster.rst index 7052f42..a66d16f 100644 --- a/doc/source/components/cluster.rst +++ b/doc/source/components/cluster.rst @@ -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: diff --git a/doc/source/components/latticestate.rst b/doc/source/components/latticestate.rst index 2d32155..52b8ab8 100644 --- a/doc/source/components/latticestate.rst +++ b/doc/source/components/latticestate.rst @@ -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: diff --git a/doc/source/components/zacrosjob.rst b/doc/source/components/zacrosjob.rst index 9a8e34b..f17cbc1 100644 --- a/doc/source/components/zacrosjob.rst +++ b/doc/source/components/zacrosjob.rst @@ -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``. diff --git a/doc/source/components/zacrosresults.rst b/doc/source/components/zacrosresults.rst index b2664e2..92fb286 100644 --- a/doc/source/components/zacrosresults.rst +++ b/doc/source/components/zacrosresults.rst @@ -10,17 +10,17 @@ For our example (see :ref:`use case system `), 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). diff --git a/doc/source/extended_components/zacrosparametersscanresults.rst b/doc/source/extended_components/zacrosparametersscanresults.rst index d606909..1b4c731 100644 --- a/doc/source/extended_components/zacrosparametersscanresults.rst +++ b/doc/source/extended_components/zacrosparametersscanresults.rst @@ -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 `). Here, the ``ZacrosParametersScanResults`` object ``results`` is created by calling the method ``run()`` of the corresponding ``ZacrosParametersScanJob`` job (line 8).