Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/python-testsuite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ ${{matrix.python-version}} -eq 2.7 ]; then pip install -r requirements2.txt;
else pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Install
run: |
sudo apt-get update
sudo apt-get install git gfortran libblas-dev liblapack-dev
git clone https://github.com/mesonepigreco/CellConstructor.git
cd cellconstructor
python setup.py install --user
cd ..

python setup.py install --user
- name: Test with pytest
run: |
export OMP_NUM_THREADS=1
cd tests
# Test excluding very long running tests
pytest -v -m "not release"
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ Python implementation of the stochastic self-consistent harmonic approximation (
This program, when istalled, contains both the python libraries to perform a
custom minimization, and manipulate the simulation at your will.

## Why do I need python-sscha?

If you are simulating transport or thermal properties of materials, phase diagrams, or phonon-related properties of materials, than you need python-sscha.
This is a package that enables you to include the effect of both thermal and quantum phonon fluctuations into your *ab initio* simulations.

The method used by this package is the Stochastic self-consistent Harmonic Approximation (SSCHA). This is a full-quantum method that optimizes the nuclear wave-function (or density matrix at finite temperature) to minimize the free energy.
In this way you can simulatie highly anharmonic systems, like those close to a second order phase transition (as charge density waves and thermoelectric materials).
Despite the full quantum and thermal nature of the algorithm, the overall computational cost is the comparable to standard classical molecular dynamics. Since the algorithm correctly exploits the symmetries of the crystal, in highly symmetric cases it is also much cheaper.

python-sscha comes both as a python library that can be runned inside your own workflows and as a stand-alone software, initialized by input scripts with the same syntax as Quantum ESPRESSO.

It can be coupled with any *ab initio* engine for force and energy calculations. It can interact through the Atomic Simulation Environment (ASE), and has an implemented interface for automatic submission of jobs in a remote cluster.

Moreover, it is quite easy to use, a standard input is highly human readable and less than 10 lines!
So, what are you waiting? Download and install python-sscha, and start enjoing the Tutorials!


## Requirements

The requirements of the python-sscha package are:
Expand Down Expand Up @@ -51,8 +68,11 @@ Please, remember that if you use the intel compiler, you need to delete the lapa
setup.py and include the -mkl (as done for cellconstructor).
Note that you must force to use the same liker compiler as the one used for the compilation.
it may be necessary to specify

MPICC=mpiicc LDSHARED="mpiicc -shared" python setup.py install

A specific setup.py script is provided to install it easily in FOSS clusters.

Remember to use the same compiler that you used to compile the pypar library,
otherwise when calling MPI_Init() on the initialization, the code will complain and crash.

Expand All @@ -67,6 +87,8 @@ sscha -i input_file
Where the "input_file" is a valid input for the code. Please look at the SimpleExample
inside the Examples directory to see a template and how to create it.

You are strongly encouraged to follow the Tutorials (in the Tutorial directory).

Alternative the code can be used directly as a python library (expert mode).
This will allow much more customization on the input and the behaviour of the
code, and the easy interface with calculators different from Quantum ESPRESSO.
Expand Down
58 changes: 58 additions & 0 deletions Tutorials/SnSe_ToyModel/ffield_dynq1
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Dynamical matrix file

2 2 0 12.4000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
Basis vectors
-0.500000000 0.000000000 0.500000000
0.000000000 0.500000000 0.500000000
-0.500000000 0.500000000 0.000000000
1 'Sn ' 108197.545983522
2 'Te ' 116300.285296078
1 2 -0.2500000000 -0.2500000000 -0.2500000000
2 1 0.2500000000 0.2500000000 0.2500000000

Dynamical Matrix in cartesian axes

q = ( 0.000000000 0.000000000 0.000000000 )

1 1
-0.01395957 0.00000000 -0.00000000 0.00000000 0.00000000 0.00000000
-0.00000000 0.00000000 -0.01395957 0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 0.00000000 0.00000000 -0.01395957 0.00000000
1 2
0.01391577 0.00000000 -0.00000000 0.00000000 0.00000000 0.00000000
-0.00000000 0.00000000 0.01391577 0.00000000 -0.00000000 0.00000000
0.00000000 0.00000000 -0.00000000 0.00000000 0.01391577 0.00000000
2 1
0.01391577 0.00000000 -0.00000000 0.00000000 0.00000000 0.00000000
-0.00000000 0.00000000 0.01391577 0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 0.00000000 0.00000000 0.01391577 0.00000000
2 2
-0.01388290 0.00000000 -0.00000000 0.00000000 0.00000000 0.00000000
-0.00000000 0.00000000 -0.01388290 0.00000000 -0.00000000 0.00000000
0.00000000 0.00000000 -0.00000000 0.00000000 -0.01388290 0.00000000


Diagonalizing the dynamical matrix

q = ( 0.000000000 0.000000000 0.000000000 )

**************************************************************************
freq ( 1) = -1.639295 [THz] = -54.681001 [cm-1]
( -0.466359 0.000000 -0.457469 0.000000 0.196340 0.000000 )
( 0.499911 0.000000 0.490382 0.000000 -0.210466 0.000000 )
freq ( 2) = -1.639295 [THz] = -54.681001 [cm-1]
( -0.146624 0.000000 -0.130879 0.000000 -0.653215 0.000000 )
( 0.157173 0.000000 0.140295 0.000000 0.700211 0.000000 )
freq ( 3) = -1.639295 [THz] = -54.681001 [cm-1]
( -0.475740 0.000000 0.488785 0.000000 0.008854 0.000000 )
( 0.509968 0.000000 -0.523951 0.000000 -0.009491 0.000000 )
freq ( 4) = -0.022835 [THz] = -0.761710 [cm-1]
( 0.223143 0.000000 0.507189 0.000000 -0.437717 0.000000 )
( 0.223756 0.000000 0.508581 0.000000 -0.438919 0.000000 )
freq ( 5) = -0.022835 [THz] = -0.761710 [cm-1]
( -0.390600 0.000000 -0.276341 0.000000 -0.519324 0.000000 )
( -0.391672 0.000000 -0.277100 0.000000 -0.520749 0.000000 )
freq ( 6) = -0.022835 [THz] = -0.761710 [cm-1]
( -0.544306 0.000000 0.406232 0.000000 0.193226 0.000000 )
( -0.545800 0.000000 0.407347 0.000000 0.193756 0.000000 )
**************************************************************************
120 changes: 120 additions & 0 deletions Tutorials/SnSe_ToyModel/ffield_dynq2
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
Dynamical matrix file

2 2 0 12.4000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
Basis vectors
-0.500000000 0.000000000 0.500000000
0.000000000 0.500000000 0.500000000
-0.500000000 0.500000000 0.000000000
1 'Sn ' 108197.545983522
2 'Te ' 116300.285296078
1 2 -0.2500000000 -0.2500000000 -0.2500000000
2 1 0.2500000000 0.2500000000 0.2500000000

Dynamical Matrix in cartesian axes

q = ( 0.500000000 -0.500000000 0.500000000 )

1 1
0.07290665 0.00000000 -0.00592402 0.00000000 0.00592402 0.00000000
-0.00592402 0.00000000 0.07290665 0.00000000 -0.00592402 0.00000000
0.00592402 0.00000000 -0.00592402 0.00000000 0.07290665 0.00000000
1 2
0.00000000 0.00000000 0.00000000 -0.00000000 0.00000000 0.00000000
0.00000000 -0.00000000 0.00000000 0.00000000 0.00000000 -0.00000000
0.00000000 0.00000000 0.00000000 -0.00000000 0.00000000 0.00000000
2 1
0.00000000 -0.00000000 -0.00000000 0.00000000 0.00000000 -0.00000000
0.00000000 0.00000000 -0.00000000 -0.00000000 0.00000000 0.00000000
0.00000000 -0.00000000 0.00000000 0.00000000 0.00000000 -0.00000000
2 2
0.05733547 0.00000000 -0.02415651 0.00000000 0.02415651 0.00000000
-0.02415651 0.00000000 0.05733547 0.00000000 -0.02415651 0.00000000
0.02415651 0.00000000 -0.02415651 0.00000000 0.05733547 0.00000000

Dynamical Matrix in cartesian axes

q = ( 0.500000000 0.500000000 -0.500000000 )

1 1
0.07290665 0.00000000 0.00592402 0.00000000 -0.00592402 0.00000000
0.00592402 0.00000000 0.07290665 0.00000000 -0.00592402 0.00000000
-0.00592402 0.00000000 -0.00592402 0.00000000 0.07290665 0.00000000
1 2
0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 -0.00000000
0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 -0.00000000
0.00000000 -0.00000000 0.00000000 -0.00000000 0.00000000 0.00000000
2 1
0.00000000 -0.00000000 0.00000000 -0.00000000 0.00000000 0.00000000
0.00000000 -0.00000000 0.00000000 -0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 -0.00000000
2 2
0.05733547 0.00000000 0.02415651 0.00000000 -0.02415651 0.00000000
0.02415651 0.00000000 0.05733547 0.00000000 -0.02415651 0.00000000
-0.02415651 0.00000000 -0.02415651 0.00000000 0.05733547 0.00000000

Dynamical Matrix in cartesian axes

q = ( -0.500000000 -0.500000000 -0.500000000 )

1 1
0.07290665 0.00000000 0.00592402 0.00000000 0.00592402 0.00000000
0.00592402 0.00000000 0.07290665 0.00000000 0.00592402 0.00000000
0.00592402 0.00000000 0.00592402 0.00000000 0.07290665 0.00000000
1 2
-0.00000000 0.00000000 -0.00000000 0.00000000 -0.00000000 0.00000000
-0.00000000 0.00000000 -0.00000000 0.00000000 -0.00000000 0.00000000
-0.00000000 0.00000000 -0.00000000 0.00000000 -0.00000000 0.00000000
2 1
0.00000000 -0.00000000 0.00000000 -0.00000000 0.00000000 -0.00000000
0.00000000 -0.00000000 0.00000000 -0.00000000 0.00000000 -0.00000000
-0.00000000 -0.00000000 -0.00000000 -0.00000000 -0.00000000 -0.00000000
2 2
0.05733547 0.00000000 0.02415651 0.00000000 0.02415651 0.00000000
0.02415651 0.00000000 0.05733547 0.00000000 0.02415651 0.00000000
0.02415651 0.00000000 0.02415651 0.00000000 0.05733547 0.00000000

Dynamical Matrix in cartesian axes

q = ( 0.500000000 -0.500000000 -0.500000000 )

1 1
0.07290665 0.00000000 -0.00592402 0.00000000 -0.00592402 0.00000000
-0.00592402 0.00000000 0.07290665 0.00000000 0.00592402 0.00000000
-0.00592402 0.00000000 0.00592402 0.00000000 0.07290665 0.00000000
1 2
0.00000000 -0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
-0.00000000 0.00000000 -0.00000000 -0.00000000 -0.00000000 -0.00000000
-0.00000000 0.00000000 -0.00000000 -0.00000000 -0.00000000 -0.00000000
2 1
0.00000000 0.00000000 0.00000000 -0.00000000 0.00000000 -0.00000000
0.00000000 -0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
0.00000000 -0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
2 2
0.05733547 0.00000000 -0.02415651 0.00000000 -0.02415651 0.00000000
-0.02415651 0.00000000 0.05733547 0.00000000 0.02415651 0.00000000
-0.02415651 0.00000000 0.02415651 0.00000000 0.05733547 0.00000000

Diagonalizing the dynamical matrix

q = ( 0.500000000 -0.500000000 0.500000000 )

**************************************************************************
freq ( 1) = 1.821788 [THz] = 60.768295 [cm-1]
( 0.000000 0.000000 -0.000000 0.000000 0.000000 0.000000 )
( -0.669340 0.000000 0.070285 0.000000 0.739624 0.000000 )
freq ( 2) = 1.821788 [THz] = 60.768295 [cm-1]
( -0.000000 0.000000 -0.000000 0.000000 0.000000 0.000000 )
( 0.467601 0.000000 0.813466 0.000000 0.345865 0.000000 )
freq ( 3) = 2.496696 [THz] = 83.280831 [cm-1]
( -0.811256 0.000000 -0.485614 0.000000 0.325642 0.000000 )
( -0.000000 0.000000 -0.000000 0.000000 0.000000 0.000000 )
freq ( 4) = 2.496696 [THz] = 83.280831 [cm-1]
( 0.092359 0.000000 -0.656389 0.000000 -0.748748 0.000000 )
( -0.000000 0.000000 -0.000000 0.000000 0.000000 0.000000 )
freq ( 5) = 2.808449 [THz] = 93.679768 [cm-1]
( -0.577350 0.000000 0.577350 0.000000 -0.577350 0.000000 )
( -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 )
freq ( 6) = 3.250858 [THz] = 108.436946 [cm-1]
( -0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000 )
( 0.577350 0.000000 -0.577350 0.000000 0.577350 0.000000 )
**************************************************************************
99 changes: 99 additions & 0 deletions Tutorials/SnSe_ToyModel/ffield_dynq3
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
Dynamical matrix file

2 2 0 12.4000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
Basis vectors
-0.500000000 0.000000000 0.500000000
0.000000000 0.500000000 0.500000000
-0.500000000 0.500000000 0.000000000
1 'Sn ' 108197.545983522
2 'Te ' 116300.285296078
1 2 -0.2500000000 -0.2500000000 -0.2500000000
2 1 0.2500000000 0.2500000000 0.2500000000

Dynamical Matrix in cartesian axes

q = ( 0.000000000 -1.000000000 0.000000000 )

1 1
0.01675451 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 0.02864983 0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 0.00000000 0.00000000 0.01675451 0.00000000
1 2
-0.00855040 0.00000000 -0.00000000 -0.00000000 -0.00000000 0.00000000
0.00000000 -0.00000000 0.01335965 -0.00000000 0.00000000 0.00000000
-0.00000000 0.00000000 -0.00000000 0.00000000 -0.00855040 0.00000000
2 1
-0.00855040 -0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
-0.00000000 -0.00000000 0.01335965 0.00000000 -0.00000000 0.00000000
0.00000000 0.00000000 0.00000000 0.00000000 -0.00855040 -0.00000000
2 2
-0.00488336 0.00000000 -0.00000000 0.00000000 -0.00000000 0.00000000
-0.00000000 0.00000000 -0.00193680 0.00000000 -0.00000000 0.00000000
0.00000000 0.00000000 0.00000000 0.00000000 -0.00488336 0.00000000

Dynamical Matrix in cartesian axes

q = ( -1.000000000 0.000000000 0.000000000 )

1 1
0.02864983 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 0.01675451 0.00000000 -0.00000000 0.00000000
0.00000000 0.00000000 -0.00000000 0.00000000 0.01675451 0.00000000
1 2
0.01335965 -0.00000000 0.00000000 -0.00000000 0.00000000 0.00000000
0.00000000 -0.00000000 -0.00855040 0.00000000 0.00000000 -0.00000000
0.00000000 -0.00000000 0.00000000 -0.00000000 -0.00855040 0.00000000
2 1
0.01335965 0.00000000 0.00000000 -0.00000000 -0.00000000 -0.00000000
-0.00000000 -0.00000000 -0.00855040 -0.00000000 -0.00000000 -0.00000000
0.00000000 0.00000000 -0.00000000 -0.00000000 -0.00855040 -0.00000000
2 2
-0.00193680 0.00000000 0.00000000 0.00000000 -0.00000000 0.00000000
0.00000000 0.00000000 -0.00488336 0.00000000 -0.00000000 0.00000000
-0.00000000 0.00000000 -0.00000000 0.00000000 -0.00488336 0.00000000

Dynamical Matrix in cartesian axes

q = ( 0.000000000 0.000000000 1.000000000 )

1 1
0.01675451 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 0.01675451 0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 -0.00000000 0.00000000 0.02864983 0.00000000
1 2
-0.00855040 -0.00000000 0.00000000 -0.00000000 0.00000000 0.00000000
0.00000000 -0.00000000 -0.00855040 -0.00000000 -0.00000000 -0.00000000
0.00000000 0.00000000 -0.00000000 -0.00000000 0.01335965 0.00000000
2 1
-0.00855040 0.00000000 0.00000000 -0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 -0.00855040 0.00000000 0.00000000 -0.00000000
0.00000000 0.00000000 0.00000000 -0.00000000 0.01335965 -0.00000000
2 2
-0.00488336 0.00000000 0.00000000 0.00000000 -0.00000000 0.00000000
-0.00000000 0.00000000 -0.00488336 0.00000000 0.00000000 0.00000000
-0.00000000 0.00000000 0.00000000 0.00000000 -0.00193680 0.00000000

Diagonalizing the dynamical matrix

q = ( 0.000000000 -1.000000000 0.000000000 )

**************************************************************************
freq ( 1) = -0.882888 [THz] = -29.449985 [cm-1]
( -0.311224 0.000000 -0.000000 0.000000 -0.083015 0.000000 )
( -0.914722 0.000000 0.000000 0.000000 -0.243990 0.000000 )
freq ( 2) = -0.882888 [THz] = -29.449985 [cm-1]
( -0.083015 0.000000 0.000000 0.000000 0.311224 0.000000 )
( -0.243990 0.000000 -0.000000 0.000000 0.914722 0.000000 )
freq ( 3) = -0.830025 [THz] = -27.686649 [cm-1]
( -0.000000 0.000000 0.347468 0.000000 -0.000000 0.000000 )
( -0.000000 0.000000 -0.937692 0.000000 -0.000000 0.000000 )
freq ( 4) = 1.360222 [THz] = 45.372124 [cm-1]
( 0.396490 0.000000 -0.000000 0.000000 0.851366 0.000000 )
( -0.145004 0.000000 -0.000000 0.000000 -0.311360 0.000000 )
freq ( 5) = 1.360222 [THz] = 45.372124 [cm-1]
( -0.851366 0.000000 0.000000 0.000000 0.396490 0.000000 )
( 0.311360 0.000000 -0.000000 0.000000 -0.145004 0.000000 )
freq ( 6) = 1.778031 [THz] = 59.308718 [cm-1]
( -0.000000 0.000000 -0.929018 0.000000 -0.000000 0.000000 )
( 0.000000 0.000000 -0.370034 0.000000 0.000000 0.000000 )
**************************************************************************