File: test_strain.py

package info (click to toggle)
python-ase 3.26.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,484 kB
  • sloc: python: 148,112; xml: 2,728; makefile: 110; javascript: 47
file content (31 lines) | stat: -rw-r--r-- 608 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# fmt: off
from math import sqrt

import pytest

from ase.build import bulk
from ase.filters import StrainFilter
from ase.optimize.mdmin import MDMin

a = 3.6


@pytest.mark.optimize()
def test_strain_fcc(asap3):
    cu = bulk('Cu', a=a) * (6, 6, 6)
    cu.calc = asap3.EMT()
    f = StrainFilter(cu, [1, 1, 1, 0, 0, 0])
    opt = MDMin(f, dt=0.01)
    opt.run(0.001)


@pytest.mark.optimize()
def test_strain_hcp(asap3):
    cu = bulk('Cu', 'hcp', a=a / sqrt(2))
    cu.cell[1, 0] -= 0.05
    cu *= (6, 6, 3)

    cu.calc = asap3.EMT()
    f = StrainFilter(cu)
    opt = MDMin(f, dt=0.01)
    opt.run(0.01)