# Copyright The NOMAD Authors. # # This file is part of NOMAD. See https://nomad-lab.eu for further info. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import sys import json import logging from nomad.utils import configure_logging from nomad.datamodel import EntryArchive from phonopyparser import PhonopyParser if __name__ == "__main__": configure_logging(console_log_level=logging.DEBUG) archive = EntryArchive() PhonopyParser().parse(sys.argv[1], archive, logging) json.dump(archive.m_to_dict(), sys.stdout, indent=2)
def parse(filepath): """Used to parse a file in the fiven filepath with the Crystal parser.""" archive = EntryArchive() logger = None parser.parse(filepath, archive, logger) return archive
def parse(filename: str): archive = EntryArchive() QBallParser().run(filename, archive, logging) json.dump(archive.m_to_dict(), sys.stdout, indent=2)
def test_md_edr(parser): archive = EntryArchive() parser.parse('tests/data/fe_test/mdrun.out', archive, None) assert len( archive.section_run[0].section_single_configuration_calculation) == 7
def silicon(parser): archive = EntryArchive() parser.parse('tests/data/Si_band_dos/aims_CC.out', archive, None) return archive
def test_4(parser): archive = EntryArchive() parser.parse('tests/data/output.out', archive, None)
def test_scf(parser): archive = EntryArchive() parser.parse('tests/data/HO_scf/benchmark2.out', archive, None) sec_run = archive.section_run[0] assert sec_run.program_version == '5.2.1 (svn rev. 11920)' assert sec_run.x_qe_input_filename == 'uspp1.in' assert sec_run.time_run_date_start.magnitude == 1451140876.0 assert sec_run.x_qe_section_compile_options[0].x_qe_lmaxx == 3 assert sec_run.x_qe_section_parallel[0].x_qe_nproc == 4 assert sec_run.section_basis_set_cell_dependent[0].basis_set_cell_dependent_name == 'PW_25.0' assert sec_run.section_basis_set_cell_dependent[1].basis_set_planewave_cutoff.magnitude == approx(2.17987236e-16,) assert sec_run.section_sampling_method[0].sampling_method == 'geometry_optimization' assert 'rdiaghg' in sec_run.x_qe_profile_function assert sec_run.time_run_date_end.magnitude == 1451140881.0 assert sec_run.run_clean_end sec_method = sec_run.section_method[0] assert sec_method.x_qe_sticks_sum_G_smooth == 135043 assert 'NL pseudopotentials' in sec_method.x_qe_allocated_array_name assert sec_method.x_qe_allocated_array_size[2] == 33554432. assert sec_method.x_qe_temporary_array_dimensions[3] == '262144, 8' assert sec_method.x_qe_per_process_mem == approx(2.84373811e+08) assert sec_method.x_qe_potential_mixing_scheme == 'plain' assert sec_method.x_qe_starting_charge == 7.99998 assert len(sec_method.section_XC_functionals) == 2 assert sec_method.x_qe_xc_igcc_name == 'pbc' assert sec_method.section_XC_functionals[1].XC_functional_name == 'GGA_X_PBE' sec_atoms = sec_method.section_method_atom_kind assert len(sec_atoms) == 2 assert sec_atoms[1].method_atom_kind_label == 'H' assert sec_atoms[0].x_qe_pp_md5sum == '7e325307d184e51bd80757047dcf04f9' assert sec_atoms[1].x_qe_pp_ncoefficients == 8 assert sec_atoms[0].x_qe_kind_mass == 16.0 sec_system = sec_run.section_system[0] assert sec_system.atom_labels == ['O', 'H', 'H'] assert sec_system.atom_positions[2][0].magnitude == approx(5.12015994e-10) assert False not in sec_system.configuration_periodic_dimensions assert sec_system.x_qe_reciprocal_cell[2][2].magnitude == approx(5.93674971e+09) assert len(sec_system.x_qe_k_info_vec) == 1 assert sec_system.x_qe_cell_volume == approx(1.18547769e-27) assert sec_system.x_qe_nsymm == 4 assert sec_system.x_qe_dense_FFT_grid[1] == 64 assert sec_system.number_of_electrons[0] == 8 sec_scc = sec_run.section_single_configuration_calculation[0] assert sec_scc.energy_total.magnitude == approx(-7.49748432e-17) assert 'ewald contribution' in sec_scc.x_qe_energy_decomposition_name assert sec_scc.x_qe_energy_decomposition_value[1] == approx(7.42289975e-17) assert sec_scc.atom_forces_raw[1][1].magnitude == approx(-3.57815176e-10) assert sec_scc.stress_tensor[2][2].magnitude == approx(-1.68e+08) assert np.shape(sec_scc.section_eigenvalues[0].eigenvalues_kpoints) == (1, 3) assert np.shape(sec_scc.section_eigenvalues[0].eigenvalues_values) == (1, 1, 4) assert sec_scc.section_eigenvalues[0].eigenvalues_values[0][0][2].magnitude == approx(-1.42427094e-18) assert sec_scc.energy_reference_highest_occupied.magnitude == approx(-1.15444837e-18) assert sec_scc.x_qe_output_datafile == 'pwscf.save' sec_scfs = sec_scc.section_scf_iteration assert len(sec_scfs) == 8 assert sec_scfs[4].energy_total_scf_iteration.magnitude == approx(-7.49748038e-17) assert sec_scfs[1].x_qe_energy_total_accuracy_estimate_iteration == approx(1.15623477e-18) assert sec_scfs[6].x_qe_iteration_ecutwfc == approx(5.4496809027589626e-17) assert sec_scfs[0].time_scf_iteration_cpu1_end.magnitude == 1.2 assert sec_scfs[3].x_qe_iteration_charge_negative_up == 0.06614
def test_2(parser): archive = EntryArchive() parser.parse('tests/data/abinit_1.out', archive, None)
def test_3(parser): archive = EntryArchive() parser.parse('tests/data/libxc_101130.out', archive, None)
def test_1(parser): archive = EntryArchive() parser.parse('tests/data/periodic.out', archive, None)
def silicon_gw(parser): archive = EntryArchive() parser.parse('tests/data/Si_gw/INFO.OUT', archive, None) return archive
def test_AlN(parser): ''' Geometry optimization (atomic positions only) AlN test case. ''' archive = EntryArchive() parser.parse('tests/AlN_ionic_optimization/AlN.out', archive, logging) run = archive.section_run[0] assert run.program_version == '3.9.2' assert run.program_basis_set_type == 'Numeric AOs' assert run.run_clean_end scc = run.section_single_configuration_calculation assert len(scc) == 5 assert scc[0].energy_total.magnitude == approx(Ha_to_J(-25.194346653540)) assert scc[4].energy_total.magnitude == approx(Ha_to_J(-25.194358042252)) assert np.shape(scc[0].atom_forces) == (4, 3) assert scc[0].atom_forces[0][2].magnitude == approx(HaB_to_N(0.00139)) assert scc[4].atom_forces[3][2].magnitude == approx(HaB_to_N(-0.00018)) scf = scc[0].section_scf_iteration assert len(scf) == 21 scf[20].energy_sum_eigenvalues_scf_iteration == approx( -3.4038353611878345e-17) scf = scc[3].section_scf_iteration assert len(scf) == 6 scf[5].energy_sum_eigenvalues_scf_iteration == approx( -3.4038520917173614e-17) method = run.section_method[0] section_XC_functionals1 = method.section_XC_functionals[0] section_XC_functionals2 = method.section_XC_functionals[1] assert method.number_of_spin_channels == 1 assert method.electronic_structure_method == 'DFT' assert method.smearing_width == approx(K_to_J(300)) assert section_XC_functionals1.XC_functional_name == 'GGA_C_PBE' assert section_XC_functionals2.XC_functional_name == 'GGA_X_PBE' assert method.scf_max_iteration == 100 assert method.scf_threshold_energy_change.magnitude == approx( Ha_to_J(1e-7)) sampling_method = run.section_sampling_method assert len(sampling_method) == 1 assert sampling_method[ 0].geometry_optimization_method == "steepest_descent" assert sampling_method[0].sampling_method == "geometry_optimization" assert sampling_method[ 0].geometry_optimization_threshold_force.magnitude == approx( (0.0003 * units.hartree / units.bohr).to_base_units().magnitude) assert len(run.section_system) == 5 system = run.section_system[0] assert all([ a == b for a, b in zip(system.configuration_periodic_dimensions, [True, True, True]) ]) assert system.lattice_vectors[0][0].magnitude == approx(A_to_m(3.10997)) assert system.lattice_vectors[1][0].magnitude == approx(A_to_m(-1.55499)) assert len(system.atom_positions) == 4 assert system.atom_positions[0][0].magnitude == approx(A_to_m(1.55499)) assert system.atom_positions[3][2].magnitude == approx(A_to_m(4.39210)) assert len(system.atom_labels) == 4 assert system.atom_labels[3] == 'N' system = run.section_system[0] assert np.shape(system.velocities) == (4, 3) assert system.velocities[0][0].magnitude == pytest.approx(0.0) assert system.velocities[3][2].magnitude == pytest.approx(0.0) system = run.section_system[3] assert system.lattice_vectors[1][1].magnitude == approx(A_to_m(2.69331)) assert system.lattice_vectors[2][2].magnitude == approx(A_to_m(4.98010)) assert len(system.atom_positions) == 4 assert system.atom_positions[0][1].magnitude == approx(A_to_m(0.89807)) assert system.atom_positions[2][2].magnitude == approx(A_to_m(1.90030)) assert len(system.atom_labels) == 4 assert system.atom_labels[0] == 'Al' system = run.section_system[4] assert system.lattice_vectors[0][0].magnitude == approx(A_to_m(3.10997)) assert system.lattice_vectors[2][2].magnitude == approx(A_to_m(4.98010)) assert len(system.atom_positions) == 4 assert system.atom_positions[0][2].magnitude == approx(A_to_m(0.00253)) assert system.atom_positions[3][2].magnitude == approx(A_to_m(4.39015)) assert len(system.atom_labels) == 4 assert system.atom_labels[1] == 'Al' eigenvalues = run.section_single_configuration_calculation[ -1].section_eigenvalues[0] assert eigenvalues.eigenvalues_kind == 'normal' assert eigenvalues.number_of_eigenvalues_kpoints == 74 assert np.shape(eigenvalues.eigenvalues_kpoints) == (74, 3) assert eigenvalues.eigenvalues_kpoints[0][0] == approx(-0.42857) assert eigenvalues.eigenvalues_kpoints[0][2] == approx(-0.33333) assert eigenvalues.eigenvalues_kpoints[73][2] == pytest.approx(0.0) assert eigenvalues.number_of_eigenvalues == 52 assert np.shape(eigenvalues.eigenvalues_values) == (1, 74, 52) assert eigenvalues.eigenvalues_values[0, 0, 0].magnitude == approx( Ha_to_J(-0.77128985545768)) assert eigenvalues.eigenvalues_values[0, 73, 51].magnitude == approx( Ha_to_J(4.86822333092339))
def test_1(parser): archive = EntryArchive() parser.parse('tests/data/dhcp_gd/out', archive, None) assert len(archive.section_run[0].section_system[0].atom_positions) == 4
def test_vasp(parser): archive = EntryArchive() parser.parse('tests/data/vasp/phonopy.yaml', archive, None)