Skip to content

Commit

Permalink
Updated the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mesonepigreco committed Dec 18, 2023
1 parent bab8ca4 commit cbdf4ca
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 10 deletions.
6 changes: 6 additions & 0 deletions UserGuide/_static/about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<h3>About</h3>
<p>SSCHA code documentation</p>
<p><a href="https://www.sscha.eu">
<img src="http://sscha.eu/img/SSCHA_Logo_original_Horizontala_leyeda_Gabe.png"
alt="www.sscha.eu" width="200" height="50" />
</a></p>
50 changes: 50 additions & 0 deletions UserGuide/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,56 @@ You can plot all the minimization path (frequencies, free energy, gradients) cal
The sscha-plot-data.py script is automatically installed within the SSCHA code.


Load from the output files
--------------------------

It is possible to load an ensemble directly from a list of output files from a specific program,
like quantum ESPRESSO.
This is usefull when a calculation ended with an error on the cluster,
and the ensemble has not been saved on the disk (but you have the output files of the
configurations that have been already computed succesfully).

In this case, you can restart the minimization using an ensemble with the following code:

.. code-block:: python
# Load the dynamical matrix
dyn = CC.Phonons.Phonons("dyn", 4)
# Load the ensemble
ens = sscha.Ensemble.Ensemble(dyn, 300)
# Load the ensemble from the output of the calculator
# In this case, the pwo files are output of the quantum espresso program.
# Any output file that ASE is able to read can be used to load the ensemble.
ens.load_from_calculator_output(directory="data", out_ext=".pwo")
# Run the minimization
minim = sscha.SchaMinimizer.SSCHA_Minimizer(ens)
minim.init()
minim.set_minimization_step(0.01)
minim.run()
minim.finalize()
An example of this procedure is provided in the ``tests/test_load_ensemble_from_calculator_output`` directory.

Alternatively, you can also use the ensemble to restart a full relax procedure.
In this case, you need to provide the key ``restart_from_ens = True`` to the
``relax`` or ``vc_relax`` methods of the ``SSCHA`` class in the ``Relax`` module.

.. code-block:: python
# Initialize the minimizer minim (see example above)
relax = sscha.Relax.SSCHA(minim, ase_calculator=calculator,
N_configs = 100, max_pop = 20)
relax.relax(restart_from_ens = True)
# Or, if you want to perform a variable cell relaxation
relax.vc_relax(restart_from_ens = True)
Cluster configuration with a code different from Quantum ESPRESSO
-----------------------------------------------------------------

Expand Down
31 changes: 22 additions & 9 deletions UserGuide/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
# built documents.
#
# The short X.Y version.
version = u'1.2'
version = u'1.4'
# The full version, including alpha/beta/rc tags.
release = u'1.2'
release = u'1.4'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -93,11 +93,24 @@
#
html_theme = 'alabaster'


# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
html_theme_options = {
"rightsidebar": "true",
"relbarbgcolor": "black"
}

html_sidebars = {
"**": [
"about.html",
"navigation.html",
"relations.html",
"searchbox.html"
]
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand All @@ -109,12 +122,12 @@
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
'**': [
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
]
}
# html_sidebars = {
# '**': [
# 'relations.html', # needs 'show_related': True theme option to display
# 'searchbox.html',
# ]
# }


# -- Options for HTMLHelp output ------------------------------------------
Expand Down
48 changes: 47 additions & 1 deletion UserGuide/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,57 @@ The SSCHA code is a collection of 2 python packages: CellConstructor and python-
In this guide, we refer to the installation of python-sscha.


Easy installation using Anaconda
--------------------------------

The easy way to install python-sscha is to use the anaconda distribution of python.

.. code-block:: console
conda create -n sscha -c conda-forge python=3.11 gfortran libblas lapack openmpi julia openmpi-mpicc pip numpy scipy spglib
conda activate sscha
pip install ase julia mpi4py
pip install cellconstructor python-sscha tdscha
This will create a new environment called sscha, install all the dependencies and the packages.
To use the code, you need to activate the environment:

.. code-block:: console
conda activate sscha
The sscha code exploits the julia language to speed up the calculation.
To install the julia dependencies, you need to run the following command:

.. code-block:: console
python -c 'import julia; julia.install()'
And that's it! You can now run the sscha code.

.. code-block:: console
sscha -h
SSCHA also works as a library, so you can import it in your python scripts.
To check that everything is working, you can run the following script:

.. code-blocK:: python
import sscha, sscha.Ensemble
print("Hello world!")
If it runs without problems, the SSCHA code is working correctly.

Requirements
------------

To install python-sscha you need:
1. python (either 2.7 or 3.*)
1. python<=3.11
2. numpy
3. scipy
4. matplotlib
Expand Down

0 comments on commit cbdf4ca

Please sign in to comment.