Note
Go to the end to download the full example code.
Data File Reader¶
The DataFileParser
handles LAMMPS data files containing complete system definitions.
The UniverseSequence
provides a convenient way to have these data files read
into the Universe
objects.
import os
from pylimer_tools_cpp import UniverseSequence
base_structure_path = os.path.join(
os.getcwd(),
"../..",
"tests/pylimer_tools/fixtures/structure",
)
# Load a single data file
data_file = os.path.join(
base_structure_path,
"melt_83_a_100.structure.out",
)
one_universe_seq = UniverseSequence()
one_universe_seq.initialize_from_data_sequence([data_file])
universe = one_universe_seq.at_index(0)
# Load multiple data files as a sequence
sequence = UniverseSequence()
sequence.initialize_from_data_sequence(
[
os.path.join(
base_structure_path,
"3d-diamond-lattice_10x10x10_a_3_d_0.85_imperfect.structure.out",
),
os.path.join(
base_structure_path,
"3d-diamond-lattice_10x10x10_a_3_d_0.85_v_0.V-fixed.structure.out",
),
]
)
for universe in sequence:
print(f"Loaded universe with {universe.get_nr_of_atoms()} atoms")
Loaded universe with 56000 atoms
Loaded universe with 56000 atoms
Please note that the hybrid
and tdpd
atom styles are not fully supported.
If your data files don’t hint the atom style in the line that starts with “Atom”,
you should specify it manually, see read()
and set_data_file_atom_style()
.
Total running time of the script: (0 minutes 0.222 seconds)