def test_dos(parser): archive = EntryArchive() parser.parse('tests/data/NiO-dos.out', archive, None) sec_dos = archive.section_run[0].section_single_configuration_calculation[ 0].section_dos[0] assert np.shape(sec_dos.dos_values) == (2, 158) assert sec_dos.dos_energies[78].magnitude == approx(-8.6717613e-20) assert sec_dos.dos_values[1][19] == approx(4.66493971e+14) archive = EntryArchive() parser.parse('tests/data/NiO-dos-restricted.out', archive, None) sec_dos = archive.section_run[0].section_single_configuration_calculation[ 0].section_dos[0] assert np.shape(sec_dos.dos_values) == (1, 154)
def parse_exciting_results(directory: str): """ Parse all exciting outputs in 'directory' into a dictionary, via NOMAD's exciting parser. :param directory: :return: dict """ archive = EntryArchive() parser = ExcitingParser() parser.parse(directory + '/INFO.OUT', archive, None) data_as_json_str = archive.m_to_json() data_as_dict = json.loads(data_as_json_str)['section_run'][0] # dict_keys(['program_basis_set_type', 'program_name', 'program_version', 'section_frame_sequence', 'section_method', 'section_sampling_method', 'section_single_configuration_calculation', 'section_system']) print(data_as_dict)
def test_relaxation(parser): archive = EntryArchive() parser.parse('tests/data/relaxation.nc', archive, None) assert archive.section_workflow.workflow_type == 'geometry_optimization' assert len(archive.section_run) == 1 sec_attrs = archive.section_run[0].section_method[ 0].x_fhi_vibes_section_attributes[0] assert sec_attrs.x_fhi_vibes_attributes_timestep.magnitude == approx(1e-15) assert len(sec_attrs.x_fhi_vibes_section_attributes_atoms) == 1 sec_atoms = sec_attrs.x_fhi_vibes_section_attributes_atoms[0] assert len(sec_atoms.x_fhi_vibes_atoms_symbols) == 2 assert sec_atoms.x_fhi_vibes_atoms_masses.magnitude == approx( 4.66362397e-26) sec_metadata = sec_attrs.x_fhi_vibes_section_attributes_metadata[0] sec_relaxation = sec_metadata.x_fhi_vibes_section_metadata_relaxation[0] assert sec_relaxation.x_fhi_vibes_relaxation_maxstep == 0.2 assert not sec_relaxation.x_fhi_vibes_relaxation_hydrostatic_strain assert sec_relaxation.x_fhi_vibes_relaxation_type == 'optimization' sec_sccs = archive.section_run[0].section_single_configuration_calculation assert len(sec_sccs) == 3 assert sec_sccs[2].x_fhi_vibes_volume.magnitude == approx(3.97721030e-29) assert sec_sccs[0].section_energy_contribution[ 1].energy_contribution_value.magnitude == approx(-2.52313962e-15)
def test_molecular_dynamics(parser): archive = EntryArchive() parser.parse('tests/data/molecular_dynamics.nc', archive, None) assert archive.section_workflow.workflow_type == 'molecular_dynamics' sec_attrs = archive.section_run[0].section_method[ 0].x_fhi_vibes_section_attributes[0] sec_md = sec_attrs.x_fhi_vibes_section_attributes_metadata[ 0].x_fhi_vibes_section_metadata_MD[0] assert sec_md.x_fhi_vibes_MD_md_type == 'Langevin' assert sec_md.x_fhi_vibes_MD_friction == 0.02 sec_systems = archive.section_run[0].section_system assert len(sec_systems) == 11 assert sec_systems[3].atom_positions[6][1].magnitude == approx( 1.39537854e-10) assert sec_systems[7].atom_velocities[1][0].magnitude == approx( -249.97586102) assert sec_systems[2].lattice_vectors[0][2].magnitude == approx( 2.20004000e-21) sec_sccs = archive.section_run[0].section_single_configuration_calculation assert sec_sccs[4].x_fhi_vibes_heat_flux_0_harmonic[1].magnitude == approx( 1.40863863e+13) assert sec_sccs[5].x_fhi_vibes_atom_forces_harmonic[3][ 0].magnitude == approx(8.40976902e-10) assert sec_sccs[6].x_fhi_vibes_momenta[7][2].magnitude == approx( -1.18929315e-24)
def test_single_point(parser): archive = EntryArchive() parser.parse('tests/data/basic/ok.scf', archive, None) sec_run = archive.section_run[0] assert sec_run.program_version == '12.1 22/7/2012' assert sec_run.time_run_date_start.magnitude == 1397313280.0 sec_method = archive.section_run[0].section_method[0] assert sec_method.section_XC_functionals[1].XC_functional_name == 'GGA_C_PBE_SOL' assert sec_method.x_wien2k_ifft[1] == 120 assert sec_method.x_wien2k_rkmax[2] == 4 assert sec_method.smearing_kind == 'tetrahedra' assert sec_method.x_wien2k_in2_espermin == 0.50 sec_scc = archive.section_run[0].section_single_configuration_calculation[0] assert sec_scc.energy_total.magnitude == approx(-8.09654094e-15) assert np.shape(sec_scc.atom_forces) == (49, 3) assert sec_scc.atom_forces[19][1].magnitude == approx(-2.76650574e-10) assert sec_scc.energy_reference_fermi[0].magnitude == approx(-4.46784636e-19) sec_scfs = sec_scc.section_scf_iteration assert len(sec_scfs) == 40 assert sec_scfs[21].energy_total_scf_iteration.magnitude == approx(-8.09654095e-15) assert sec_scfs[6].x_wien2k_noe == 196.000 assert sec_scfs[17].x_wien2k_tot_diff_charge[9] == approx(0.0001539) sec_system = archive.section_run[0].section_system[0] assert np.shape(sec_system.atom_positions) == (49, 3) assert sec_system.atom_positions[18][1].magnitude == approx(9.94126646e-10) assert sec_system.lattice_vectors[1][1].magnitude == approx(1.06500038e-09) assert sec_system.atom_labels == ['C'] * 49
def test_scf(parser): archive = EntryArchive() parser.parse('tests/data/Si_scf/stdout.txt', archive, None) sec_run = archive.section_run[0] assert sec_run.program_version == 'wolfi' assert sec_run.x_octopus_input_Spacing == approx(0.28345892) assert sec_run.x_octopus_parserlog_SpeciesProjectorSphereThreshold == 0.001 sec_method = sec_run.section_method[0] assert sec_method.smearing_kind == 'empty' assert sec_method.electronic_structure_method == 'DFT' assert sec_method.section_XC_functionals[0].XC_functional_name == 'LDA_C_PZ_MOD' sec_system = sec_run.section_system[0] assert False not in sec_system.configuration_periodic_dimensions assert sec_system.atom_labels == ['Si', 'Si', 'Si', 'Si'] assert sec_system.atom_positions[1][0].magnitude == approx(1.91979671e-10) sec_scc = sec_run.section_single_configuration_calculation[0] assert sec_scc.energy_total.magnitude == approx(-6.91625667e-17) assert sec_scc.energy_electrostatic.magnitude == approx(4.79087203e-18) assert np.count_nonzero(sec_scc.atom_forces_free_raw) == 0 sec_eig = sec_scc.section_eigenvalues[0] assert np.shape(sec_eig.eigenvalues_values) == (1, 18, 8) assert sec_eig.eigenvalues_kpoints[11][2] == 0.25 assert sec_eig.eigenvalues_values[0][4][6].magnitude == approx(5.26639723e-19) assert sec_eig.eigenvalues_occupation[0][16][1] == 2.0 sec_scf = sec_scc.section_scf_iteration assert len(sec_scf) == 8 assert sec_scf[3].energy_total_scf_iteration.magnitude == approx(-6.91495422e-17) assert sec_scf[7].time_scf_iteration.magnitude == 9.42
def test_gpw2(parser): archive = EntryArchive() parser.parse('tests/data/Si_pw.gpw2', archive, None) assert archive.section_run[0].program_version == '1.1.1b1' assert archive.section_run[0].program_basis_set_type == 'plane waves' assert archive.section_run[0].section_basis_set_cell_dependent[ 0].basis_set_planewave_cutoff.magnitude == approx(4.8065299e-17) sec_method = archive.section_run[0].section_method[0] assert sec_method.scf_threshold_energy_change.magnitude == approx( 8.01088317e-23) assert sec_method.smearing_width == approx(1.60217663e-20) assert not sec_method.x_gpaw_fix_density assert sec_method.section_XC_functionals[0].XC_functional_name == 'LDA_X' sec_system = archive.section_run[0].section_system[0] assert sec_system.atom_labels == ['Si', 'Si'] assert sec_system.lattice_vectors[0][1].magnitude == approx(2.715e-10) assert False not in sec_system.configuration_periodic_dimensions assert sec_system.atom_positions[1][0].magnitude == approx(1.3575e-10) sec_scc = archive.section_run[0].section_single_configuration_calculation[ 0] assert sec_scc.energy_XC.magnitude == approx(-2.19623851e-18) assert sec_scc.energy_reference_fermi[0].magnitude == approx( 8.60653138e-19) assert np.shape(sec_scc.section_eigenvalues[0].eigenvalues_values) == (1, 10, 8) assert sec_scc.section_eigenvalues[0].eigenvalues_values[0][7][ 4].magnitude == approx(9.50790908e-19) assert sec_scc.section_eigenvalues[0].eigenvalues_occupation[0][0][ 0] == 1.0 assert sec_scc.single_configuration_calculation_converged
def test_grad_statpt_dscf(parser): archive = EntryArchive() parser.parse('tests/data/acrolein_grad_statpt_dscf.out', archive, None) assert archive.section_run[0].section_basis_set_atom_centered[ 1].basis_set_atom_centered_short_name == 'def2-SVP' sec_methods = archive.section_run[0].section_method assert len(sec_methods) == 3 assert sec_methods[0].section_XC_functionals[ 0].XC_functional_name == 'HYB_GGA_XC_B3LYP' sec_systems = archive.section_run[0].section_system assert len(sec_systems) == 3 assert sec_systems[1].atom_positions[5][1].magnitude == approx( 1.22377337e-10, ) sec_sccs = archive.section_run[0].section_single_configuration_calculation assert sec_sccs[0].atom_forces_raw[6][0].magnitude == approx( -4.2984543e-12) sec_scfs = sec_sccs[2].section_scf_iteration assert len(sec_scfs) == 3 assert sec_scfs[1].energy_total_scf_iteration.magnitude == approx( -8.35592725e-16) assert sec_scfs[0].x_turbomole_delta_eigenvalues.magnitude == approx( 2.92683961e-22) assert sec_sccs[2].electronic_kinetic_energy.magnitude == approx( 8.27834082e-16) sec_sampling = archive.section_run[0].section_sampling_method[0] assert sec_sampling.x_turbomole_geometry_optimization_trustregion_min.magnitude == approx( 5.29177211e-14) assert sec_sampling.geometry_optimization_method == 'BFGS' assert sec_sampling.geometry_optimization_threshold_force.magnitude == approx( 8.2387235e-11)
def test_strucopt(parser): archive = EntryArchive() parser.parse('tests/data/GaO_strucopt/INFO.OUT', archive, None) sec_systems = archive.section_run[0].section_system assert len(sec_systems) == 15 assert sec_systems[0].atom_labels == [ 'Ga', 'Ga', 'Ga', 'Ga', 'O', 'O', 'O', 'O', 'O', 'O' ] assert sec_systems[0].x_exciting_gkmax.magnitude == approx(1.13383567e+11) assert sec_systems[3].atom_positions[1][1].magnitude == approx( 3.07695918e-10) assert sec_systems[10].atom_positions[-1][0].magnitude == approx( 3.67156876e-11) assert sec_systems[1].lattice_vectors[2][1].magnitude == approx( sec_systems[13].lattice_vectors[2][1].magnitude) sec_sccs = archive.section_run[0].section_single_configuration_calculation assert len(sec_sccs) == 15 assert len(sec_sccs[0].section_scf_iteration) == 19 assert sec_sccs[0].section_scf_iteration[ 10].time_scf_iteration.magnitude == approx(431.84) assert sec_sccs[0].section_scf_iteration[ 18].x_exciting_effective_potential_convergence_scf_iteration[ 0].magnitude == approx(4.62350928e-26) assert sec_sccs[3].x_exciting_maximum_force_magnitude.magnitude == approx( 1.64771998e-10) assert sec_sccs[6].energy_total.magnitude == approx(-3.58415586e-14) assert sec_sccs[9].time_calculation.magnitude == approx(724.33) assert len(sec_sccs[-1].x_exciting_section_MT_charge_atom) == 10 assert sec_sccs[-1].x_exciting_fermi_energy.magnitude == approx( 1.03200886e-18)
def test_metagga(parser): archive = EntryArchive() parser.parse('tests/data/hle17_vasprun.xml.gz', archive, None) sec_xc_functional = archive.section_run[-1].section_method[ -1].section_XC_functionals[0] assert sec_xc_functional.XC_functional_name == 'MGGA_XC_HLE17'
def test_hybrid(parser): archive = EntryArchive() parser.parse('tests/data/hybrid_vasprun.xml.gz', archive, None) sec_xc_functional = archive.section_run[-1].section_method[ -1].section_XC_functionals[0] assert sec_xc_functional.XC_functional_name == 'HYB_GGA_XC_HSE06'
def run(self, mainfile: str, archive: EntryArchive, logger): # Log a hello world, just to get us started. TODO remove from an actual parser. logger.info('Hello World') # Use the previously defined parsers on the given mainfile mainfile_parser.mainfile = mainfile mainfile_parser.parse() # Output all parsed data into the given archive. run = archive.m_create(Run) run.program_name = 'super_code' run.program_version = str(mainfile_parser.get('program_version')) date = datetime.datetime.strptime( mainfile_parser.get('date'), '%Y/%m/%d') - datetime.datetime(1970, 1, 1) run.program_compilation_datetime = date.total_seconds() for calculation in mainfile_parser.get('calculation'): system = run.m_create(System) system.lattice_vectors = calculation.get('lattice_vectors') sites = calculation.get('sites') system.atom_labels = [site[0] for site in sites] system.atom_positions = [site[1] for site in sites] scc = run.m_create(SCC) scc.single_configuration_calculation_to_system_ref = system scc.energy_total = calculation.get('energy') * units.eV scc.single_configuration_calculation_to_system_ref = system magic_source = calculation.get('magic_source') if magic_source is not None: scc.x_example_magic_value = magic_source
def test_scf_multirun(parser): archive = EntryArchive() parser.parse('tests/data/Al_multistep/m61b5.out', archive, None) sec_runs = archive.section_run assert len(sec_runs) == 2 assert len(sec_runs[0].section_single_configuration_calculation) == 6 assert len(sec_runs[1].section_single_configuration_calculation) == 1 assert len(sec_runs[0].section_single_configuration_calculation[2]. section_scf_iteration) == 11 assert len(sec_runs[1].section_single_configuration_calculation[0]. section_scf_iteration) == 1 assert len(sec_runs[0].section_system) == 6 assert len(sec_runs[1].section_system) == 1 assert len(sec_runs[0].section_method) == 1 assert len(sec_runs[1].section_method) == 1 sec_scc = sec_runs[0].section_single_configuration_calculation[4] assert sec_scc.atom_forces_raw[0][2].magnitude == approx(-9.69697756e-14) assert sec_scc.section_scf_iteration[ 3].x_gaussian_delta_energy_total_scf_iteration.magnitude == approx( -8.82412332e-27) sec_thermo = sec_runs[1].x_gaussian_section_thermochem[0] assert sec_thermo.x_gaussian_temperature == approx(298.15) assert sec_thermo.x_gaussian_moments[1] == approx(8.59409221e-45) assert sec_thermo.x_gaussian_thermal_correction_free_energy == approx( -1.00274129e-19)
def test_scf(parser): archive = EntryArchive() parser.parse('tests/data/phenylrSmall-metagga.out', archive, None) sec_run = archive.section_run[0] assert sec_run.program_version == '70630 2018-11-24' assert sec_run.time_run_date_start.magnitude == 1550053118.0 sec_method = archive.section_run[0].section_method[0] assert sec_method.number_of_spin_channels == 2 assert sec_method.section_XC_functionals[ 0].XC_functional_name == 'MGGA_XC_TPSS' sec_system = archive.section_run[0].section_system[0] assert sec_system.atom_positions[2][1].magnitude == approx(2.31103866e-10) assert sec_system.lattice_vectors[0][0].magnitude == approx(8.72113987e-10) assert sec_system.configuration_periodic_dimensions == [True, True, False] sec_scc = archive.section_run[0].section_single_configuration_calculation[ 0] assert sec_scc.energy_total.magnitude == approx(-1.11415974e-17) assert sec_scc.electronic_kinetic_energy.magnitude == approx( 1.11552116e-17) assert sec_scc.energy_XC.magnitude == approx(-1.01588269e-17) assert sec_scc.energy_electrostatic.magnitude == approx(-8.69562185e-18) sec_scfs = sec_scc.section_scf_iteration assert len(sec_scfs) == 20 assert sec_scfs[11].energy_change_scf_iteration.magnitude == approx( 2.1449944e-21)
def test_md_verbose(parser): archive = EntryArchive() parser.parse('tests/data/fe_test/md.log', archive, None) sec_run = archive.section_run[0] assert sec_run.program_version == '5.1.4' sec_control = sec_run.x_gromacs_section_control_parameters[0] assert sec_control.x_gromacs_inout_control_coulombtype == 'PME' assert np.shape(sec_control.x_gromacs_inout_control_deform) == (3, 3) sec_sampling = sec_run.section_sampling_method[0] assert sec_sampling.ensemble_type == 'NPT' assert sec_sampling.x_gromacs_integrator_dt.magnitude == 0.0005 assert sec_sampling.x_gromacs_barostat_target_pressure.magnitude == approx( 33333.33) sec_sccs = sec_run.section_single_configuration_calculation assert len(sec_sccs) == 7 assert sec_sccs[2].energy_total.magnitude == approx( -3.2711290665182795e-17) assert sec_sccs[5].pressure.magnitude == approx(-63926916.5) assert sec_sccs[-2].section_energy_contribution[ 1].energy_contribution_value.magnitude == approx(-4.15778738e-17) assert sec_sccs[0].atom_forces[5][2].magnitude == approx( -7.932968909721231e-10) sec_systems = sec_run.section_system assert len(sec_systems) == 2 assert np.shape(sec_systems[0].atom_positions) == (1516, 3) assert sec_systems[1].atom_positions[800][1].magnitude == approx( 2.4609454e-09) assert sec_systems[0].atom_velocities[500][0].magnitude == approx(869.4773) assert sec_systems[1].lattice_vectors[2][2].magnitude == approx( 2.469158e-09)
def test_md(parser): archive = EntryArchive() parser.parse('tests/data/Si8-md-NPT.castep', archive, None) sec_sampling = archive.section_run[0].section_sampling_method[0] assert sec_sampling.sampling_method == 'molecular_dynamics' assert sec_sampling.ensemble_type == 'NPT' assert sec_sampling.x_castep_thermostat_type == 'Nose-Hoover chain thermostat' assert sec_sampling.x_castep_frame_energy_tolerance.magnitude == approx( 1.60217663e-24) sec_sccs = archive.section_run[0].section_single_configuration_calculation assert len(sec_sccs) == 13 assert sec_sccs[2].energy_total.magnitude == approx(-1.37059981e-16) assert sec_sccs[6].stress_tensor[2][1].magnitude == approx(4.06626e+09) assert sec_sccs[9].pressure.magnitude == approx(1.111e+09) assert sec_sccs[11].energy_total_T0.magnitude == approx(-1.37069057e-16) assert len(sec_sccs[12].section_scf_iteration) == 7 assert sec_sccs[7].section_scf_iteration[ 3].energy_change_scf_iteration.magnitude == approx(-1.90981043e-21) sec_systems = archive.section_run[0].section_system assert len(sec_systems) == 13 assert sec_systems[0].atom_positions[7][2].magnitude == approx(1.3575e-10) assert sec_systems[1].atom_velocities[1][1].magnitude == approx(324.536) assert sec_systems[12].lattice_vectors[2][2].magnitude == approx( 5.5475876e-10)
def test_pnoccsd(parser): archive = EntryArchive() parser.parse('tests/data/pnoccsd.out', archive, None) assert np.shape( archive.section_run[0].section_system[0].atom_positions) == (51, 3) sec_methods = archive.section_run[0].section_method assert len(sec_methods) == 4 assert sec_methods[0].electronic_structure_method == 'CCSD(T)' assert sec_methods[1].electronic_structure_method == 'MP2' assert sec_methods[2].electronic_structure_method == 'CCSD' assert sec_methods[3].electronic_structure_method == 'CCSD(T0)' sec_sccs = archive.section_run[0].section_single_configuration_calculation assert len(sec_sccs) == 4 assert sec_sccs[0].energy_total.magnitude == approx(-5.63810959e-15) assert sec_sccs[1].energy_total.magnitude == approx(-5.63669838e-15) assert sec_sccs[2].energy_current.magnitude == approx(-2.19140251e-17) assert sec_sccs[3].energy_total.magnitude == approx(-5.6380984e-15) sec_scfs = sec_sccs[0].section_scf_iteration assert len(sec_scfs) == 13 assert sec_scfs[6].energy_total_scf_iteration.magnitude == approx( -5.63708622e-15)
def test_basic(parser): archive = EntryArchive() parser.parse('tests/data/n2_output.out', archive, None) sec_run = archive.section_run[0] assert sec_run.program_version == '1.8' sec_method = sec_run.section_method[0] assert sec_method.scf_max_iteration == 50 assert sec_method.number_of_spin_channels == 1 assert sec_method.section_XC_functionals[ 0].XC_functional_name == 'LDA_XC_TETER93' sec_system = sec_run.section_system[0] assert sec_system.atom_positions[0][2].magnitude == approx(3.60977554e-10) assert sec_system.lattice_vectors[2][2].magnitude == approx(8.3345e-10) assert True not in sec_system.configuration_periodic_dimensions sec_scc = sec_run.section_single_configuration_calculation[0] assert sec_scc.energy_total.magnitude == approx(-8.66869132e-17) assert sec_scc.atom_forces[0][2].magnitude == approx(4.67181276e-09) sec_scfs = sec_scc.section_scf_iteration assert len(sec_scfs) == 11 assert sec_scfs[3].energy_total_scf_iteration.magnitude == approx( -8.66861188e-17) assert sec_scfs[6].energy_XC_potential_scf_iteration.magnitude == approx( -2.7272656e-17) assert sec_scfs[ 7].electronic_kinetic_energy_scf_iteration.magnitude == approx( 6.34717211e-17)
def test_xs_tddft(parser): archive = EntryArchive() parser.parse('tests/data/CSi_tddft/INFO_QMT001.OUT', archive, None) sec_sccs = archive.section_run[0].section_single_configuration_calculation assert len(sec_sccs) == 2 assert len(sec_sccs[1].x_exciting_xs_tddft_epsilon_energies) == 10001 assert np.shape( sec_sccs[1].x_exciting_xs_tddft_dielectric_function_local_field) == ( 2, 1, 3, 10001) assert np.shape( sec_sccs[1].x_exciting_xs_tddft_dielectric_function_no_local_field ) == (2, 1, 3, 10001) assert np.shape( sec_sccs[1].x_exciting_xs_tddft_loss_function_local_field) == (1, 3, 10001) assert np.shape( sec_sccs[1].x_exciting_xs_tddft_loss_function_no_local_field) == ( 1, 3, 10001) assert np.shape( sec_sccs[1].x_exciting_xs_tddft_loss_function_no_local_field) == ( 1, 3, 10001) assert np.shape( sec_sccs[1].x_exciting_xs_tddft_sigma_local_field) == (2, 1, 3, 10001) assert np.shape( sec_sccs[1].x_exciting_xs_tddft_sigma_no_local_field) == (2, 1, 3, 10001)
def test_dos_spinpol(parser): archive = EntryArchive() parser.parse('tests/data/CeO_dos/INFO.OUT', archive, None) sec_scc = archive.section_run[0].section_single_configuration_calculation[ 0] assert len(sec_scc.section_dos) == 1 sec_doss = sec_scc.section_dos assert np.shape(sec_doss[0].dos_values) == (2, 500) assert sec_doss[0].dos_energies[79].magnitude == approx(-1.70772016e-18) assert sec_doss[0].dos_values[0][126] == approx(1.8925127e-10) assert sec_doss[0].dos_values[1][136] == approx(1.91606129e-11) assert sec_doss[0].dos_energies[240].magnitude == approx(1.09995544e-18) assert sec_doss[0].dos_values[0][220] == approx(5.63875821e-10) assert sec_doss[0].dos_values[1][78] == approx(4.33359121e-10) sec_pdoss = sec_scc.section_atom_projected_dos assert len(sec_pdoss) == 1 assert np.shape(sec_pdoss[0].atom_projected_dos_values_lm) == (25, 2, 3, 500) assert sec_doss[0].dos_energies[100].magnitude == approx( sec_pdoss[0].atom_projected_dos_energies[100].magnitude) assert sec_pdoss[0].atom_projected_dos_values_lm[1][0][1][116] == approx( 1.07677456e+16) assert sec_pdoss[0].atom_projected_dos_values_lm[20][1][0][85] == approx( 7.81205293e+11)
def test_CrO2(parser): ''' Single run of feromagnetic CrO2 using LDA+U ''' archive = EntryArchive() parser.parse('tests/CrO2_single_point/CrO2.out', archive, logging) run = archive.section_run[0] method = run.section_method[0] assert method.number_of_spin_channels == 2 assert method.electronic_structure_method == 'DFT+U' assert method.smearing_width == approx(K_to_J(500)) assert method.section_XC_functionals[0].XC_functional_name == 'LDA_X' assert method.section_XC_functionals[1].XC_functional_name == 'LDA_C_PW' assert method.scf_max_iteration == 40 assert method.scf_threshold_energy_change.magnitude == approx( Ha_to_J(1e-7)) eigenvalues = run.section_single_configuration_calculation[ -1].section_eigenvalues[0] assert eigenvalues.eigenvalues_kind == 'normal' assert eigenvalues.number_of_eigenvalues_kpoints == 100 assert np.shape(eigenvalues.eigenvalues_kpoints) == (100, 3) assert eigenvalues.eigenvalues_kpoints[39, 2] == approx(0.43750) assert eigenvalues.number_of_eigenvalues == 90 assert np.shape(eigenvalues.eigenvalues_values) == (2, 100, 90) assert eigenvalues.eigenvalues_values[0, 42, 8].magnitude == approx( Ha_to_J(-0.92962144255459)) assert eigenvalues.eigenvalues_values[1, 99, 89].magnitude == approx( Ha_to_J(13.66867939417960))
def test_band_spinpol(parser): archive = EntryArchive() parser.parse('tests/data/Fe_band_spinpol/Fe_band_structure_dos_spin.out', archive, None) assert len(archive.section_run[0].section_single_configuration_calculation) == 1 sec_scc = archive.section_run[0].section_single_configuration_calculation[0] sec_k_band = sec_scc.section_k_band[0] assert len(sec_k_band.section_k_band_segment) == 3 assert np.shape(sec_k_band.section_k_band_segment[0].band_energies) == (2, 15, 19) assert np.shape(sec_k_band.section_k_band_segment[1].band_k_points) == (15, 3) assert np.shape(sec_k_band.section_k_band_segment[2].band_occupations) == (2, 15, 19) assert sec_k_band.section_k_band_segment[0].band_occupations[1][9][2] == approx(1.0) assert sec_k_band.section_k_band_segment[1].band_energies[0][3][5].magnitude == approx(-1.54722007e-17) assert sec_k_band.section_k_band_segment[2].band_k_points[14][2] == approx(0.5) sec_dos = sec_scc.section_dos[0] assert np.shape(sec_dos.dos_energies) == (50,) assert np.shape(sec_dos.dos_values) == (2, 50) assert sec_dos.dos_energies[46].magnitude == approx(-1.1999976e-18) assert sec_dos.dos_values[0][46] == approx(1.2418252951253564e-11) assert sec_dos.dos_values[1][15] == approx(3.9151704709731774e-11) sec_atom_dos = sec_scc.section_atom_projected_dos[0] assert np.shape(sec_atom_dos.atom_projected_dos_energies) == (50,) assert np.shape(sec_atom_dos.atom_projected_dos_values_lm) == (4, 2, 1, 50) assert np.shape(sec_atom_dos.atom_projected_dos_values_total) == (2, 1, 50) assert sec_atom_dos.atom_projected_dos_energies[49].magnitude == approx(-1.12152364e-18) assert sec_atom_dos.atom_projected_dos_values_lm[2][1][0][22] == approx(6.61986474e+18) assert sec_atom_dos.atom_projected_dos_values_lm[0][0][0][8] == approx(3.35029976e+17) assert sec_atom_dos.atom_projected_dos_values_total[0][0][40] == approx(9.950877863070872e+17)
def test_1(parser): archive = EntryArchive() parser.parse('tests/data/test003.input.out', archive, None) sec_sccs = archive.section_run[0].section_single_configuration_calculation assert len(sec_sccs) == 61 assert sec_sccs[4].energy_total.magnitude == approx(-9.14252116e-15)
def test_2(parser): archive = EntryArchive() parser.parse('tests/data/GaAs/INFO.OUT', archive, None) sec_system = archive.section_run[0].section_system[0] assert sec_system.atom_labels == ['Ga', 'As'] assert sec_system.atom_positions[1][2].magnitude == approx(1.41382921e-10)
def test_example(parser): archive = EntryArchive() parser.parse('tests/Test1/metadata.json', archive, logging) measurement = archive.section_measurement[0] assert measurement.section_metadata[0].section_sample[0].sample_id is not None assert measurement.section_metadata[0].section_experiment[0].method_name is not None assert measurement.section_data[0].section_spectrum[0].n_values == 226
def test_example(parser): archive = EntryArchive() parser.run('tests/data/example.out', archive, logging) run = archive.section_run[0] assert len(run.section_system) == 2 assert len(run.section_single_configuration_calculation) == 2 assert run.section_single_configuration_calculation[0].x_example_magic_value == 42
def test_1(parser): archive = EntryArchive() parser.parse('tests/data/example18.got', archive, None) sec_sccs = archive.section_run[0].section_single_configuration_calculation assert len(sec_sccs) == 4 assert sec_sccs[2].energy_total.magnitude == approx(-2.10631951e-16)
def test_1(parser): archive = EntryArchive() parser.parse('tests/data/test08/ethene_relax.out', archive, None) sec_sccs = archive.section_run[0].section_single_configuration_calculation assert len(sec_sccs) == 33 assert sec_sccs[8].energy_total.magnitude == approx(-5.95750082e-17) assert sec_sccs[2].atom_forces[5][1].magnitude == approx(-6.68217323e-10)
def test_C2N2(parser): ''' Molecular dynamics using the Nose-Hover thermostat for simple N2H2 molecule ''' archive = EntryArchive() parser.parse('tests/C2H2_molecular_dynamics/C2H2.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) == 100 assert scc[0].temperature.magnitude == approx(300.0) assert scc[99].temperature.magnitude == approx(46.053) assert np.shape(scc[0].atom_forces) == (4, 3) assert scc[0].atom_forces[0][0].magnitude == approx(HaB_to_N(0.10002)) assert scc[99].atom_forces[2][2].magnitude == approx(HaB_to_N(-0.00989)) assert len(run.section_system) == 100 method = run.section_method[0] assert method.number_of_spin_channels == 1 assert method.electronic_structure_method == 'DFT' assert method.smearing_width == approx(K_to_J(500)) assert method.section_XC_functionals[0].XC_functional_name == 'LDA_X' assert method.section_XC_functionals[1].XC_functional_name == 'LDA_C_PZ' sampling_method = run.section_sampling_method assert len(sampling_method) == 1 assert sampling_method[0].sampling_method == "molecular_dynamics" assert sampling_method[0].ensemble_type == "NVT" system = run.section_system[0] assert np.shape(system.velocities) == (4, 3) assert system.velocities[0][0].magnitude == approx(396.15464) assert system.velocities[3][2].magnitude == approx(2359.24208) system = run.section_system[99] assert system.velocities[0][1].magnitude == approx(-353.94304) assert system.velocities[3][0].magnitude == approx(-315.74184) eigenvalues = run.section_single_configuration_calculation[ -1].section_eigenvalues[0] assert eigenvalues.eigenvalues_kind == 'normal' assert eigenvalues.number_of_eigenvalues_kpoints == 1 assert np.shape(eigenvalues.eigenvalues_kpoints) == (1, 3) assert all([ a == pytest.approx(b) for a, b in zip(eigenvalues.eigenvalues_kpoints[0], [0, 0, 0]) ]) assert eigenvalues.number_of_eigenvalues == 64 assert np.shape(eigenvalues.eigenvalues_values) == (1, 1, 64) assert eigenvalues.eigenvalues_values[0, 0, 0].magnitude == approx( Ha_to_J(-0.67352892393426)) assert eigenvalues.eigenvalues_values[0, 0, 63].magnitude == approx( Ha_to_J(7.29352095903235))
def test_bfgs(parser): archive = EntryArchive() parser.parse('tests/data/Si2_opt.castep', archive, None) assert archive.section_run[0].section_sampling_method[ 0].sampling_method == 'geometry_optimization' sec_sccs = archive.section_run[0].section_single_configuration_calculation assert len(sec_sccs) == 9 sec_sccs[7].pressure.magnitude == approx(400000.0)