Skip to content

Commit

Permalink
added bond list
Browse files Browse the repository at this point in the history
  • Loading branch information
jrudz committed Oct 30, 2023
1 parent 33ae2ef commit e43f8ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion atomisticparsers/gromacs/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
)
from .metainfo.gromacs import x_gromacs_section_control_parameters, x_gromacs_section_input_output_files
from atomisticparsers.utils import MDAnalysisParser, MDParser
from nomad.atomutils import get_bond_list_from_model_contributions

re_float = r'[-+]?\d+\.*\d*(?:[Ee][-+]\d+)?'
re_n = r'[\n\r]'
Expand Down Expand Up @@ -704,14 +705,19 @@ def get_composition(children_names):
if positions is None:
continue

bond_list = []
if n == 0: # TODO add references to the bond list for other steps
bond_list = get_bond_list_from_model_contributions(sec_run, method_index=-1, model_index=-1)

self.parse_trajectory_step({
'atoms': {
'n_atoms': self.traj_parser.get_n_atoms(n),
'periodic': pbc,
'lattice_vectors': self.traj_parser.get_lattice_vectors(n),
'labels': self.traj_parser.get_atom_labels(n),
'positions': positions,
'velocities': self.traj_parser.get_velocities(n)
'velocities': self.traj_parser.get_velocities(n),
'bond_list': bond_list
}
})

Expand Down
7 changes: 6 additions & 1 deletion atomisticparsers/lammps/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
)
from .metainfo.lammps import x_lammps_section_input_output_files, x_lammps_section_control_parameters
from atomisticparsers.utils import MDAnalysisParser, MDParser
from nomad.atomutils import get_bond_list_from_model_contributions


re_float = r'[-+]?\d+\.*\d*(?:[Ee][-+]\d+)?'
Expand Down Expand Up @@ -958,14 +959,18 @@ def get_composition(children_names):
velocities = self.traj_parsers.eval('get_velocities', traj_n)
if velocities is not None:
velocities = apply_unit(velocities, 'velocity')
bond_list = []
if traj_n == 0: # TODO add references to the bond list for other steps
bond_list = get_bond_list_from_model_contributions(sec_run, method_index=-1, model_index=-1)
self.parse_trajectory_step({
'atoms': {
'n_atoms': self.traj_parsers.eval('get_n_atoms', traj_n),
'lattice_vectors': lattice_vectors,
'periodic': self.traj_parsers.eval('get_pbc', traj_n),
'positions': apply_unit(self.traj_parsers.eval('get_positions', traj_n), 'distance'),
'labels': self.traj_parsers.eval('get_atom_labels', traj_n),
'velocities': velocities
'velocities': velocities,
'bond_list': bond_list
}
})

Expand Down

0 comments on commit e43f8ae

Please sign in to comment.