File: test_core.py

package info (click to toggle)
phonopy 2.47.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 29,380 kB
  • sloc: python: 43,690; xml: 12,080; ansic: 3,227; cpp: 525; sh: 213; makefile: 20
file content (39 lines) | stat: -rw-r--r-- 805 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
32
33
34
35
36
37
38
39
"""Tests for MLP SSCHA."""

import pathlib

import pytest

from phonopy import Phonopy
from phonopy.interface.mlp import PhonopyMLP
from phonopy.sscha.core import MLPSSCHA

cwd = pathlib.Path(__file__).parent


def test_MLPSSCHA(ph_kcl: Phonopy):
    """Test MLPSSCHA class."""
    pytest.importorskip("pypolymlp")
    mlp = PhonopyMLP().load(cwd / ".." / "polymlp_KCL-120.yaml")
    sscha = MLPSSCHA(
        ph_kcl,
        mlp,
        number_of_snapshots=2,
        max_iterations=2,
        temperature=300,
        log_level=2,
    )
    sscha.run()

    sscha = MLPSSCHA(
        ph_kcl,
        mlp,
        number_of_snapshots=2,
        max_iterations=2,
        temperature=300,
        log_level=1,
    )
    count = 0
    for i, _ in enumerate(sscha):
        count = i
    assert count == 2