def test_condition_number():
    with open(TEST_DIR.joinpath("inputs/overlap_condition_snippet.out"),
              "r") as fhandle:
        result = next(
            parse_iter(fhandle.read(),
                       matchers=[match_overlap_matrix_condition_number]))

        assert result
        assert result == {
            "overlap_matrix_condition_number": {
                "1-norm (estimate)": {
                    "|A|": 15.13,
                    "|A^-1|": 7525.0,
                    "CN": 113900.0,
                    "Log(CN)": 5.0563
                },
                "1-norm (using diagonalization)": {
                    "|A|": 15.13,
                    "|A^-1|": 22980.0,
                    "CN": 347700.0,
                    "Log(CN)": 5.5412
                },
                "2-norm (using diagonalization)": {
                    "max EV": 10.81,
                    "min EV": 0.0001036,
                    "CN": 104400.0,
                    "Log(CN)": 5.0187
                },
            }
        }
Esempio n. 2
0
def test_mulliken_unrestricted():
    with open(TEST_DIR.joinpath("inputs/mulliken_unrestricted_snippet.out"), "r") as fhandle:
        result = next(parse_iter(fhandle.read(), matchers=[match_mulliken_population_analysis]))

        assert result
        assert result == {
            "mulliken population analysis": {
                "per atom": [
                    {
                        "element": "Co",
                        "kind": 1,
                        "population alpha": 9.332183,
                        "population beta": 7.66782,
                        "charge": -2e-06,
                        "spin": 1.664363,
                    },
                    {
                        "element": "Co",
                        "kind": 1,
                        "population alpha": 9.332177,
                        "population beta": 7.66782,
                        "charge": 2e-06,
                        "spin": 1.664357,
                    },
                ],
                "total": {"population alpha": 18.66436, "population beta": 15.33564, "charge": -0.0, "spin": 3.32872},
            }
        }
Esempio n. 3
0
def test_energies():
    with open(TEST_DIR.joinpath("inputs/Si.out"), "r") as fhandle:
        result = next(parse_iter(fhandle.read(), matchers=[match_energies]))

        assert result
        assert result == {
            "energies": {
                "total force_eval": -251.687390311050706
            }
        }
def test_no_stop():
    with open(TEST_DIR.joinpath("inputs/Si-truncated.out"), "r") as fhandle:
        result = next(parse_iter(fhandle.read(), matchers=[match_program_info]))
        assert result
        assert result == {
            "program info": {
                "started at": "2019-09-17 17:01:19.273",
                "started on": "tcpc18",
                "started by": "tiziano",
                "process id": "23773",
                "started in": "/users/tiziano/work/phonopy/example/Si-CP2K",
            }
        }
Esempio n. 5
0
def test_warnings():
    with open(TEST_DIR.joinpath("inputs/warning-snippet.out"), "r") as fhandle:
        result = next(parse_iter(fhandle.read(), matchers=[match_warnings]))

        assert result
        assert result == {
            "nwarnings": 2,
            "warnings": [
                {
                    "filename": "qs_scf_post_gpw.F",
                    "line": 2162,
                    "message": "Spin contamination estimate not implemented for k-points.",
                }
            ],
        }
def test_kv_sections():
    with open(TEST_DIR.joinpath("inputs/Si.out"), "r") as fhandle:
        result = next(parse_iter(fhandle.read(), matchers=[match_kv_sections]))

        assert result
        assert result == {
            "cp2k": {
                "cp2kflags": "libint fftw3 libxc xsmm spglib",
                "data directory path": "/data/tiziano/cp2k/data",
                "input file name": "Si-supercell-001.inp",
                "is freely available from": "https://www.cp2k.org/",
                "program compiled at": "Mon Sep 16 14:42:43 CEST 2019",
                "program compiled for": "local",
                "program compiled on": "tcpc18",
                "source code revision number": "git:43f50e2",
                "version string": "CP2K version 7.0 (Development Version)",
            },
            "dbcsr": {
                "cpu multiplication driver": "XSMM",
                "maximum elements for images": "UNLIMITED",
                "multiplication size stacks": 3,
                "multiplication stack size": 1000,
                "multiplicative factor virtual images": 1,
                "multrec recursion limit": 512,
                "use multiplication densification": True,
            },
            "dft": {
                "charge": 0,
                "cutoffs": {
                    "cutoff_smoothing_range": 0.0,
                    "density": 1e-10,
                    "gradient": 1e-10,
                    "tau": 1e-10
                },
                "multiplicity": 1,
                "number of spin states": 1,
                "self-interaction correction (sic)": "NO",
                "spin restricted kohn-sham (rks) calculation": "RKS",
                "xc density smoothing": "NONE",
                "xc derivatives": "PW",
            },
            "global": {
                "all-to-all communication in single precision": False,
                "basis set file name": "BASIS_MOLOPT",
                "coordinate file name": "__STD_INPUT__",
                "cpu model name": "Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz",
                "cpuid": 1002,
                "ffts using library dependent lengths": False,
                "force environment number": 1,
                "global print level": "MEDIUM",
                "method name": "CP2K",
                "mm potential file name": "MM_POTENTIAL",
                "mpi i/o enabled": True,
                "number of threads for this process": 1,
                "potential file name": "POTENTIAL",
                "preferred diagonalization lib.": "SL",
                "preferred fft library": "FFTW3",
                "project name": "Si-supercell-001",
                "run type": "ENERGY_FORCE",
                "this output is from process": 0,
                "total number of message passing processes": 1,
            },
            "qs": {
                "density cutoff [a.u.]": 140.0,
                "density plane wave grid type": "NON-SPHERICAL FULLSPACE",
                "grid level progression factor": 3.0,
                "interaction thresholds": {
                    "eps_core_charge": 1e-12,
                    "eps_filter_matrix": 0.0,
                    "eps_gvg_rspace": 1e-05,
                    "eps_ppl": 0.01,
                    "eps_ppnl": 1e-07,
                    "eps_rho_gspace": 1e-10,
                    "eps_rho_rspace": 1e-10,
                    "ps_pgf_orb": 1e-05,
                },
                "method": "GPW",
                "multi grid cutoff [a.u.]": {
                    "1) grid level": 140.0,
                    "2) grid level": 46.7,
                    "3) grid level": 15.6,
                    "4) grid level": 5.2,
                },
                "number of grid levels": 4,
                "relative density cutoff [a.u.]": 20.0,
            },
        }
Esempio n. 7
0
def test_parse_safe_keys():
    with open(TEST_DIR.joinpath("inputs/Si.out"), "r") as fhandle:
        for match in parse_iter(fhandle.read(), key_mangling=True):
            assert not any(c in key for c in FORBIDDEN_CHARS
                           for key in _key_iter(match))
def test_no_start_and_stop():
    with open(TEST_DIR.joinpath("inputs/mulliken_restricted_snippet.out"), "r") as fhandle:
        with pytest.raises(StopIteration):
            next(parse_iter(fhandle.read(), matchers=[match_program_info]))
Esempio n. 9
0
def test_mulliken_restricted():
    with open(TEST_DIR.joinpath("inputs/mulliken_restricted_snippet.out"), "r") as fhandle:
        result = next(parse_iter(fhandle.read(), matchers=[match_mulliken_population_analysis]))

        assert result
        assert result == {
            "mulliken population analysis": {
                "per atom": [
                    {"element": "Si", "kind": 1, "population": 3.999993, "charge": 7e-06},
                    {"element": "Si", "kind": 1, "population": 4.0, "charge": 0.0},
                    {"element": "Si", "kind": 1, "population": 4.0, "charge": -0.0},
                    {"element": "Si", "kind": 1, "population": 4.000001, "charge": -1e-06},
                    {"element": "Si", "kind": 1, "population": 4.0, "charge": -0.0},
                    {"element": "Si", "kind": 1, "population": 4.000001, "charge": -1e-06},
                    {"element": "Si", "kind": 1, "population": 4.000001, "charge": -1e-06},
                    {"element": "Si", "kind": 1, "population": 4.0, "charge": -0.0},
                    {"element": "Si", "kind": 1, "population": 3.999863, "charge": 0.000137},
                    {"element": "Si", "kind": 1, "population": 4.00002, "charge": -2e-05},
                    {"element": "Si", "kind": 1, "population": 4.000133, "charge": -0.000133},
                    {"element": "Si", "kind": 1, "population": 3.999979, "charge": 2.1e-05},
                    {"element": "Si", "kind": 1, "population": 4.000133, "charge": -0.000133},
                    {"element": "Si", "kind": 1, "population": 3.999979, "charge": 2.1e-05},
                    {"element": "Si", "kind": 1, "population": 3.999863, "charge": 0.000137},
                    {"element": "Si", "kind": 1, "population": 4.00002, "charge": -2e-05},
                    {"element": "Si", "kind": 1, "population": 4.000039, "charge": -3.9e-05},
                    {"element": "Si", "kind": 1, "population": 3.999964, "charge": 3.6e-05},
                    {"element": "Si", "kind": 1, "population": 4.00001, "charge": -1e-05},
                    {"element": "Si", "kind": 1, "population": 3.99999, "charge": 1e-05},
                    {"element": "Si", "kind": 1, "population": 4.000039, "charge": -3.9e-05},
                    {"element": "Si", "kind": 1, "population": 3.999964, "charge": 3.6e-05},
                    {"element": "Si", "kind": 1, "population": 4.00001, "charge": -1e-05},
                    {"element": "Si", "kind": 1, "population": 3.99999, "charge": 1e-05},
                    {"element": "Si", "kind": 1, "population": 4.000039, "charge": -3.9e-05},
                    {"element": "Si", "kind": 1, "population": 3.999964, "charge": 3.6e-05},
                    {"element": "Si", "kind": 1, "population": 4.000039, "charge": -3.9e-05},
                    {"element": "Si", "kind": 1, "population": 3.999964, "charge": 3.6e-05},
                    {"element": "Si", "kind": 1, "population": 4.00001, "charge": -1e-05},
                    {"element": "Si", "kind": 1, "population": 3.99999, "charge": 1e-05},
                    {"element": "Si", "kind": 1, "population": 4.00001, "charge": -1e-05},
                    {"element": "Si", "kind": 1, "population": 3.99999, "charge": 1e-05},
                    {"element": "Si", "kind": 1, "population": 3.999994, "charge": 6e-06},
                    {"element": "Si", "kind": 1, "population": 3.999965, "charge": 3.5e-05},
                    {"element": "Si", "kind": 1, "population": 3.999967, "charge": 3.3e-05},
                    {"element": "Si", "kind": 1, "population": 3.999991, "charge": 9e-06},
                    {"element": "Si", "kind": 1, "population": 3.999967, "charge": 3.3e-05},
                    {"element": "Si", "kind": 1, "population": 3.999991, "charge": 9e-06},
                    {"element": "Si", "kind": 1, "population": 3.999997, "charge": 3e-06},
                    {"element": "Si", "kind": 1, "population": 4.000312, "charge": -0.000312},
                    {"element": "Si", "kind": 1, "population": 3.999997, "charge": 3e-06},
                    {"element": "Si", "kind": 1, "population": 4.000311, "charge": -0.000311},
                    {"element": "Si", "kind": 1, "population": 3.999966, "charge": 3.4e-05},
                    {"element": "Si", "kind": 1, "population": 3.99999, "charge": 1e-05},
                    {"element": "Si", "kind": 1, "population": 3.999966, "charge": 3.4e-05},
                    {"element": "Si", "kind": 1, "population": 3.99999, "charge": 1e-05},
                    {"element": "Si", "kind": 1, "population": 3.999994, "charge": 6e-06},
                    {"element": "Si", "kind": 1, "population": 3.999965, "charge": 3.5e-05},
                    {"element": "Si", "kind": 1, "population": 4.000009, "charge": -9e-06},
                    {"element": "Si", "kind": 1, "population": 4.000033, "charge": -3.3e-05},
                    {"element": "Si", "kind": 1, "population": 3.999692, "charge": 0.000308},
                    {"element": "Si", "kind": 1, "population": 4.000004, "charge": -4e-06},
                    {"element": "Si", "kind": 1, "population": 4.000036, "charge": -3.6e-05},
                    {"element": "Si", "kind": 1, "population": 4.000007, "charge": -7e-06},
                    {"element": "Si", "kind": 1, "population": 4.000009, "charge": -9e-06},
                    {"element": "Si", "kind": 1, "population": 4.000033, "charge": -3.3e-05},
                    {"element": "Si", "kind": 1, "population": 4.000008, "charge": -8e-06},
                    {"element": "Si", "kind": 1, "population": 4.000033, "charge": -3.3e-05},
                    {"element": "Si", "kind": 1, "population": 4.000035, "charge": -3.5e-05},
                    {"element": "Si", "kind": 1, "population": 4.000006, "charge": -6e-06},
                    {"element": "Si", "kind": 1, "population": 3.999692, "charge": 0.000308},
                    {"element": "Si", "kind": 1, "population": 4.000004, "charge": -4e-06},
                    {"element": "Si", "kind": 1, "population": 4.000008, "charge": -8e-06},
                    {"element": "Si", "kind": 1, "population": 4.000033, "charge": -3.3e-05},
                ],
                "total": {"population": 256.0, "charge": 0.0},
            }
        }
Esempio n. 10
0
def test_no_mulliken():
    with pytest.raises(StopIteration):
        next(parse_iter("", matchers=[match_mulliken_population_analysis]))