diff --git a/common/python/nomadcore/atoms2nomad.py b/common/python/nomadcore/atoms2nomad.py deleted file mode 100644 index 95fc97ff0531798a67edaea2a1a8288a66a88ece..0000000000000000000000000000000000000000 --- a/common/python/nomadcore/atoms2nomad.py +++ /dev/null @@ -1,27 +0,0 @@ -import numpy as np - -from nomadcore.unit_conversion.unit_conversion import convert_unit - - -def ase_atoms_to_section_system(backend, atoms, new_section=True): - """Add ASE Atoms object as metainfo to section_system. - - If new_section is True, open and close a new section_system, - returning its gIndex.""" - - if new_section: - gIndex = backend.openSection('section_system') - - backend.addArrayValues('atom_labels', - np.array(atoms.get_chemical_symbols())) - backend.addArrayValues('atom_positions', - convert_unit(atoms.positions, 'angstrom')) - backend.addArrayValues('simulation_cell', - convert_unit(atoms.cell, 'angstrom')) - backend.addArrayValues('configuration_periodic_dimensions', - np.array(atoms.pbc)) - - # Return system ref if we opened it, else None: - if new_section: - backend.closeSection('section_system', gIndex) - return gIndex diff --git a/common/python/nomadcore/cube_reader.py b/common/python/nomadcore/cube_reader.py deleted file mode 100644 index 5aa48c6cd5d1e5a318388bf50f2b0c18d8938f6c..0000000000000000000000000000000000000000 --- a/common/python/nomadcore/cube_reader.py +++ /dev/null @@ -1,40 +0,0 @@ -import numpy as np -from ase.io import read - -from nomadcore.atoms2nomad import ase_atoms_to_section_system - -class CubeError(OSError): - pass - - -def read_cube_file(backend, file_name): - try: - d = read(file_name, format = 'cube', full_output = True) - - except Exception as err: - raise CubeError(err) - - data = d['data'] - atoms = d['atoms'] - origin = d['origin'] - nx, ny, nz = data.shape - displacements = np.array([atoms.cell[i]/data.shape[i] for i in range(3)]) - - system = ase_atoms_to_section_system(backend, atoms) - - singleconfig = backend.openSection('section_single_configuration_calculation') - volumetric = backend.openSection('section_volumetric_data') - - backend.addValue('volumetric_data_nx', nx) - backend.addValue('volumetric_data_ny', ny) - backend.addValue('volumetric_data_nz', nz) - - backend.addArrayValues('volumetric_data_origin', origin) - backend.addArrayValues('volumetric_data_displacements', displacements) - - backend.addValue('volumetric_data_multiplicity', 1) - backend.addArrayValues('volumetric_data_values', data[None]) - backend.closeSection('section_volumetric_data', volumetric) - - backend.addValue('single_configuration_calculation_to_system_ref', system) - backend.closeSection('section_single_configuration_calculation', singleconfig)