diff --git a/lammpsparser/lammps_parser.py b/lammpsparser/lammps_parser.py index 1b7135114bc8183a402ee932adb8018f4f95a236..6ccbdc70d880d0cf2b3687d286e7ab76b11382fb 100644 --- a/lammpsparser/lammps_parser.py +++ b/lammpsparser/lammps_parser.py @@ -2,62 +2,88 @@ import numpy as np import os import logging from ase import data as asedata - -from .LammpsCommon import converter +import pint from nomad.parsing.text_parser import Quantity, UnstructuredTextFileParser from nomad.datamodel.metainfo.public import section_run, section_sampling_method,\ section_system, section_single_configuration_calculation, section_energy_contribution,\ Workflow, MolecularDynamics from nomad.datamodel.metainfo.common import section_topology, section_interaction - - -class Parser: +from .metainfo.lammps import x_lammps_section_input_output_files, x_lammps_section_control_parameters + + +def get_unit(units_type, property_type=None, dimension=3): + mole = 6.022140857e+23 + + units_type = units_type.lower() + if units_type == 'real': + units = dict( + mass=pint.Quantity(1 / mole, 'g'), distance='angstrom', time='fs', + energy=pint.Quantity(1 / mole, 'kcal'), velocity='angstrom/fs', + force=pint.Quantity(1 / mole, 'kcal/angstrom'), torque=pint.Quantity(1 / mole, 'kcal'), + temperature='K', pressure='atm', dynamic_viscosity='poise', charge='elementary_charge', + dipole='elementary_charge*angstrom', electric_field='V/angstrom', + density='g/cm^%d' % dimension) + + elif units_type == 'metal': + units = dict( + mass=pint.Quantity(1 / mole, 'g'), distance='angstrom', time='ps', + energy='eV', velocity='angstrom/ps', force='eV/angstrom', torque='eV', + temperature='K', pressure='bar', dynamic_viscosity='poise', charge='elementary_charge', + dipole='elementary_charge*angstrom', electric_field='V/angstrom', + density='g/cm^%d' % dimension) + + elif units_type == 'si': + units = dict( + mass='kg', distance='m', time='s', energy='J', velocity='m/s', force='N', + torque='N*m', temperature='K', pressure='Pa', dynamic_viscosity='Pa*s', + charge='C', dipole='C*m', electric_field='V/m', density='kg/m^%d' % dimension) + + elif units_type == 'cgs': + units = dict( + mass='g', distance='cm', time='s', energy='erg', velocity='cm/s', force='dyne', + torque='dyne*cm', temperature='K', pressure='dyne/cm^2', dynamic_viscosity='poise', + charge='esu', dipole='esu*cm', electric_field='dyne/esu', + density='g/cm^%d' % dimension) + + elif units_type == 'electron': + units = dict( + mass='amu', distance='bohr', time='fs', energy='hartree', + velocity='bohr/atomic_unit_of_time', force='hartree/bohr', temperature='K', + pressure='Pa', charge='elementary_charge', dipole='debye', electric_field='V/cm') + + elif units_type == 'micro': + units = dict( + mass='pg', distance='microm', time='micros', energy='pg*microm^2/micros^2', + velocity='microm/micros', force='pg*microm/micros^2', torque='pg*microm^2/micros^2', + temperature='K', pressure='pg/(microm*micros^2)', dynamic_viscosity='pg/(microm*micros)', + charge='pC', dipole='pC*microm', electric_field='V/microm', + density='pg/microm^%d' % dimension) + + elif units_type == 'nano': + units = dict( + mass='ag', distance='nm', time='ns', energy='ag*nm^2/ns^2', velocity='nm/ns', + force='ag*nm/ns^2', torque='ag*nm^2/ns^2', temperature='K', pressure='ag/(nm*ns^2)', + dynamic_viscosity='ag/(nm*ns)', charge='elementary_charge', + dipole='elementary_charge*nm', electric_field='V/nm', density='ag/nm^%d' % dimension) + + else: + units = dict() + + if property_type: + unit = units.get(property_type, None) + if isinstance(unit, str): + unit = pint.Quantity(1, unit) + return unit + else: + for key, val in units.items(): + if isinstance(val, str): + units[key] = pint.Quantity(1, val) + return units + + +class DataParser(UnstructuredTextFileParser): def __init__(self, mainfile, logger): - self._mainfile = mainfile - self._results = None - self._quantities = None - self.logger = logger - - def __getitem__(self, key): - val = self.results.get(key, None) - return val - - def get(self, key, default=None): - val = self[key] - if not val: - return default - return val - - @property - def maindir(self): - return os.path.dirname(self._mainfile) - - @property - def mainfile(self): - return self._mainfile - - @mainfile.setter - def mainfile(self, value): - self._mainfile = value - self._results = None - - @property - def results(self): - if self._results is None: - self.parse() - if self._results is None: - self._results = {} - - return self._results - - def parse(self): - pass - - -class DataParser(Parser): - def __init__(self, mainfile, logger): - super().__init__(mainfile, logger) self._headers = [ 'atoms', 'bonds', 'angles', 'dihedrals', 'impropers', 'atom types', 'bond types', 'angle types', 'dihedral types', 'improper types', 'extra bond per atom', @@ -75,50 +101,40 @@ class DataParser(Parser): 'BondBond13 Coeffs', 'AngleAngle Coeffs'] self._interactions = [ section for section in self._sections if section.endswith('Coeffs')] + super().__init__(mainfile, logger=logger) - def parse(self): - if self.mainfile is None: - return - - if not os.path.isfile(self.mainfile): - return - - if self._quantities is None: - self._quantities = [] - for header in self._headers: - self._quantities.append( - Quantity(header, r'\s*([\+\-eE\d\. ]+)\s*%s\s*\n' % header, comment='#')) - - def get_section_value(val): - val = val.split('\n') - name = None - - if val[0][0] == '#': - name = val[0][1:].strip() - val = val[1:] + def init_quantities(self): + self._quantities = [] + for header in self._headers: + self._quantities.append( + Quantity(header, r'\s*([\+\-eE\d\. ]+)\s*%s\s*\n' % header, comment='#')) - value = [] - for i in range(len(val)): - v = val[i].split('#')[0].split() - if not v: - continue + def get_section_value(val): + val = val.split('\n') + name = None - try: - value.append(np.array(v, dtype=float)) - except Exception: - break + if val[0][0] == '#': + name = val[0][1:].strip() + val = val[1:] - return name, np.array(value) + value = [] + for i in range(len(val)): + v = val[i].split('#')[0].split() + if not v: + continue - for section in self._sections: - self._quantities.append( - Quantity( - section, r'\s*%s\s*(#*\s*[\s\S]*?\n)\n*([\deE\-\+\.\s]+)\n' % section, - str_operation=get_section_value)) + try: + value.append(np.array(v, dtype=float)) + except Exception: + break - parser = UnstructuredTextFileParser(self.mainfile, self._quantities) + return name, np.array(value) - self._results = {key: parser[key] for key in parser.keys() if parser[key]} + for section in self._sections: + self._quantities.append( + Quantity( + section, r'\s*%s\s*(#*\s*[\s\S]*?\n)\n*([\deE\-\+\.\s]+)\n' % section, + str_operation=get_section_value)) def get_interactions(self): styles_coeffs = [] @@ -134,61 +150,49 @@ class DataParser(Parser): return styles_coeffs -class TrajParser(Parser): +class TrajParser(UnstructuredTextFileParser): def __init__(self, mainfile, logger): - super().__init__(mainfile, logger) self._masses = None self._reference_masses = dict( masses=np.array(asedata.atomic_masses), symbols=asedata.chemical_symbols) self._chemical_symbols = None - - def parse(self): - if self.mainfile is None: - return - - if not os.path.isfile(self.mainfile): - return - - if self._quantities is None: - def get_pbc_cell(val): - val = val.split() - pbc = [v == 'pp' for v in val[:3]] - - cell = np.zeros((3, 3)) - for i in range(3): - cell[i][i] = float(val[i * 2 + 4]) - float(val[i * 2 + 3]) - - return pbc, cell - - def get_atoms_info(val): - val = val.split('\n') - keys = val[0].split() - values = np.array([v.split() for v in val[1:] if v], dtype=float) - values = values[values[:, 0].argsort()].T - return {keys[i]: values[i] for i in range(len(keys))} - - self._quantities = [ - Quantity( - 'time_step', r'\s*ITEM:\s*TIMESTEP\s*\n\s*(\d+)\s*\n', comment='#'), - Quantity( - 'n_atoms', r'\s*ITEM:\s*NUMBER OF ATOMS\s*\n\s*(\d+)\s*\n', comment='#'), - Quantity( - 'pbc_cell', r'\s*ITEM: BOX BOUNDS\s*([\s\w]+)([\+\-\d\.eE\s]+)\n', - str_operation=get_pbc_cell, comment='#'), - Quantity( - 'atoms_info', r's*ITEM:\s*ATOMS\s*([ \w]+\n)*?([\+\-eE\d\.\n ]+)\n*I*', - str_operation=get_atoms_info, comment='#') - ] - - parser = UnstructuredTextFileParser(self.mainfile, self._quantities) - - self._results = {key: parser[key] for key in parser.keys() if parser[key]} + self._units = None + super().__init__(mainfile, logger=logger) + + def init_quantities(self): + + def get_pbc_cell(val): + val = val.split() + pbc = [v == 'pp' for v in val[:3]] + + cell = np.zeros((3, 3)) + for i in range(3): + cell[i][i] = float(val[i * 2 + 4]) - float(val[i * 2 + 3]) + + return pbc, cell + + def get_atoms_info(val): + val = val.split('\n') + keys = val[0].split() + values = np.array([v.split() for v in val[1:] if v], dtype=float) + values = values[values[:, 0].argsort()].T + return {keys[i]: values[i] for i in range(len(keys))} + + self._quantities = [ + Quantity( + 'time_step', r'\s*ITEM:\s*TIMESTEP\s*\n\s*(\d+)\s*\n', comment='#'), + Quantity( + 'n_atoms', r'\s*ITEM:\s*NUMBER OF ATOMS\s*\n\s*(\d+)\s*\n', comment='#'), + Quantity( + 'pbc_cell', r'\s*ITEM: BOX BOUNDS\s*([\s\w]+)([\+\-\d\.eE\s]+)\n', + str_operation=get_pbc_cell, comment='#'), + Quantity( + 'atoms_info', r's*ITEM:\s*ATOMS\s*([ \w]+\n)*?([\+\-eE\d\.\n ]+)\n*I*', + str_operation=get_atoms_info, comment='#') + ] def with_trajectory(self): - if self._results is None: - return False - - return self._results.get('atoms_info', None) is not None + return self.get('atoms_info') is not None @property def masses(self): @@ -209,8 +213,11 @@ class TrajParser(Parser): self._chemical_symbols[masses[i][0]] = self._reference_masses['symbols'][symbol_idx] def get_atom_labels(self, idx): - atoms_info = self.results.get('atoms_info')[idx] - atoms_type = atoms_info.get('type', None) + atoms_info = self.get('atoms_info') + if atoms_info is None: + return + + atoms_type = atoms_info[idx].get('type') if atoms_type is None: return @@ -222,9 +229,17 @@ class TrajParser(Parser): return atom_labels def get_positions(self, idx): - atoms_info = self.results.get('atoms_info')[idx] + atoms_info = self.get('atoms_info') + if atoms_info is None: + return + + atoms_info = atoms_info[idx] - cell = self.results.get('pbc_cell')[idx][1] + cell = self.get('pbc_cell') + if cell is None: + return + + cell = cell[idx][1] if 'xs' in atoms_info and 'ys' in atoms_info and 'zs' in atoms_info: positions = np.array([atoms_info['xs'], atoms_info['ys'], atoms_info['zs']]).T @@ -240,30 +255,41 @@ class TrajParser(Parser): positions += positions_img * np.linalg.norm(cell, axis=1) - return positions + return pint.Quantity(positions, self._units.get('distance', None)) def get_velocities(self, idx): - atoms_info = self.results.get('atoms_info')[idx] + atoms_info = self.get('atoms_info') + + if atoms_info is None: + return + + atoms_info = atoms_info[idx] if 'vx' not in atoms_info or 'vy' not in atoms_info or 'vz' not in atoms_info: return - return np.array([atoms_info['vx'], atoms_info['vy'], atoms_info['vz']]).T + velocities = np.array([atoms_info['vx'], atoms_info['vy'], atoms_info['vz']]).T + + return pint.Quantity(velocities, self._units.get('velocity', None)) def get_forces(self, idx): - atoms_info = self.results.get('atoms_info')[idx] + atoms_info = self.get('atoms_info') + + if atoms_info is None: + return + + atoms_info = atoms_info[idx] if 'fx' not in atoms_info or 'fy' not in atoms_info or 'fz' not in atoms_info: return - return np.array([atoms_info['fx'], atoms_info['fy'], atoms_info['fz']]).T + forces = np.array([atoms_info['fx'], atoms_info['fy'], atoms_info['fz']]).T + return pint.Quantity(forces, self._units.get('force', None)) -class LogParser(Parser): + +class LogParser(UnstructuredTextFileParser): def __init__(self, mainfile, logger): - super().__init__(mainfile, logger) - self.logger = logger - self._thermo_data = None self._commands = [ 'angle_coeff', 'angle_style', 'atom_modify', 'atom_style', 'balance', 'bond_coeff', 'bond_style', 'bond_write', 'boundary', 'change_box', 'clear', @@ -286,6 +312,36 @@ class LogParser(Parser): 'write_data', 'write_dump', 'write_restart'] self._interactions = [ 'atom', 'pair', 'bond', 'angle', 'dihedral', 'improper', 'kspace'] + self._thermo_data = None + self._units = None + super().__init__(mainfile, logger=logger) + + def init_quantities(self): + def str_op(val): + val = val.split('#')[0] + val = val.replace('&\n', ' ').split() + val = val if len(val) > 1 else val[0] + return val + + self._quantities = [ + Quantity( + name, r'\n\s*%s\s+([\w\. \/\#\-]+)(\&\n[\w\. \/\#\-]*)*' % name, + str_operation=str_op, comment='#') for name in self._commands] + + self._quantities.append( + Quantity('program_version', r'\s*LAMMPS\s*\(([\w ]+)\)\n', dtype=str) + ) + + self._quantities.append( + Quantity('finished', r'\s*Dangerous builds\s*=\s*(\d+)') + ) + + @property + def units(self): + if self._file_handler is None or self._units is None: + units_type = self.get('units', ['lj'])[0] + self._units = get_unit(units_type) + return self._units def get_thermodynamic_data(self): def str_operation(val): @@ -319,10 +375,19 @@ class LogParser(Parser): self._thermo_data = list(thermo_data)[0] if thermo_data is not None else thermo_data + for key, val in self._thermo_data.items(): + low_key = key.lower() + if low_key.startswith('e_') or low_key.endswith('eng'): + self._thermo_data[key] = val * self.units['energy'] + elif low_key == 'press': + self._thermo_data[key] = val * self.units['pressure'] + elif low_key == 'temp': + self._thermo_data[key] = val * self.units['temperature'] + return self._thermo_data def get_traj_files(self): - dump = self.results.get('dump', None) + dump = self.get('dump') if dump is None: self.logger.warn( 'Trajectory not specified in %s, will scan directory' % self.maindir) @@ -338,7 +403,7 @@ class LogParser(Parser): return [os.path.join(self.maindir, f) for f in traj_files] def get_data_files(self): - read_data = self.results.get('read_data', None) + read_data = self.get('read_data') if read_data is None: self.logger.warn( 'Data file not specified in %s, will scan directory' % self.maindir) @@ -351,11 +416,11 @@ class LogParser(Parser): return [os.path.join(self.maindir, f) for f in data_files] def get_pbc(self): - pbc = self.results.get('boundary', ['p', 'p', 'p']) + pbc = self.get('boundary', ['p', 'p', 'p']) return [v == 'p' for v in pbc] def get_program_version(self): - version = self.results.get('program_version', [''])[0] + version = self.get('program_version', [''])[0] return ' '.join(version) def get_sampling_method(self): @@ -374,34 +439,38 @@ class LogParser(Parser): except IndexError: return {} + temp_unit = self.units['temperature'] + press_unit = self.units['pressure'] + time_unit = self.units['time'] + res = dict() if fix_style.lower() == 'nvt': try: - res['target_T'] = float(fix[5]) - res['thermostat_tau'] = float(fix[6]) + res['target_T'] = float(fix[5]) * temp_unit + res['thermostat_tau'] = float(fix[6]) * time_unit except Exception: pass elif fix_style.lower() == 'npt': try: - res['target_T'] = float(fix[5]) - res['thermostat_tau'] = float(fix[6]) - res['target_P'] = float(fix[9]) - res['barostat_tau'] = float(fix[10]) + res['target_T'] = float(fix[5]) * temp_unit + res['thermostat_tau'] = float(fix[6]) * time_unit + res['target_P'] = float(fix[9]) * press_unit + res['barostat_tau'] = float(fix[10]) * time_unit except Exception: pass elif fix_style.lower() == 'nph': try: - res['target_P'] = float(fix[5]) - res['barostat_tau'] = float(fix[6]) + res['target_P'] = float(fix[5]) * press_unit + res['barostat_tau'] = float(fix[6]) * time_unit except Exception: pass elif fix_style.lower() == 'langevin': try: - res['target_T'] = float(fix[4]) - res['langevin_gamma'] = float(fix[5]) + res['target_T'] = float(fix[4]) * temp_unit + res['langevin_gamma'] = float(fix[5]) * time_unit except Exception: pass @@ -434,43 +503,11 @@ class LogParser(Parser): return styles_coeffs def finished_normally(self): - return self.get('finished', None) is not None + return self.get('finished') is not None def with_thermodynamics(self): return self._thermo_data is not None - def parse(self): - if self.mainfile is None: - return - - if not os.path.isfile(self.mainfile): - return - - if self._quantities is None: - def str_op(val): - val = val.split('#')[0] - val = val.replace('&\n', ' ').split() - val = val if len(val) > 1 else val[0] - return val - - self._quantities = [ - Quantity( - name, r'\n\s*%s\s+([\w\. \/\#\-]+)(\&\n[\w\. \/\#\-]*)*' % name, - str_operation=str_op, comment='#') for name in self._commands] - - self._quantities.append( - Quantity('program_version', r'\s*LAMMPS\s*\(([\w ]+)\)\n', dtype=str) - ) - - self._quantities.append( - Quantity('finished', r'\s*Dangerous builds\s*=\s*(\d+)') - ) - - parser = UnstructuredTextFileParser(self.mainfile, self._quantities) - - self._results = { - key: parser[key] for key in parser.keys() if parser[key]} - class LammpsOutput: def __init__(self, filepath, archive, logger=None): @@ -480,7 +517,6 @@ class LammpsOutput: self.log_parser = LogParser(filepath, self.logger) self.traj_parser = TrajParser(None, self.logger) self.data_parser = DataParser(None, self.logger) - self._converter = None def parse_thermodynamic_data(self): thermo_data = self.log_parser.get_thermodynamic_data() @@ -521,16 +557,16 @@ class LammpsOutput: if key in energy_keys_mapping: sec_energy = sec_scc.m_create(section_energy_contribution) sec_energy.energy_contibution_kind = energy_keys_mapping[key] - sec_energy.energy_contribution_value = self._converter.Energy(val[n]) + sec_energy.energy_contribution_value = val[n] elif key == 'toteng': - sec_scc.energy_method_current = self._converter.Energy(val[n]) + sec_scc.energy_method_current = val[n] elif key == 'press': - sec_scc.pressure = self._converter.Press(val[n]) + sec_scc.pressure = val[n] elif key == 'temp': - sec_scc.temperature = self._converter.Temp(val[n]) + sec_scc.temperature = val[n] elif key == 'step': sec_scc.time_step = int(val[n]) @@ -549,7 +585,10 @@ class LammpsOutput: run_style = self.log_parser.get('run_style', ['verlet'])[0] run = self.log_parser.get('run', [0])[0] - timestep = self._converter.Time(self.log_parser.get('timestep', [0])[0]) + + units = self.log_parser.get('units', ['lj'])[0] + time_unit = get_unit(units, 'time') + timestep = self.log_parser.get('timestep', [0], unit=time_unit)[0] sampling_method, ensemble_type = self.log_parser.get_sampling_method() sec_sampling_method.x_lammps_integrator_type = run_style @@ -561,30 +600,23 @@ class LammpsOutput: thermo_settings = self.log_parser.get_thermostat_settings() target_T = thermo_settings.get('target_T', None) if target_T is not None: - target_T = self._converter.Temp(target_T) sec_sampling_method.x_lammps_thermostat_target_temperature = target_T thermostat_tau = thermo_settings.get('thermostat_tau', None) if thermostat_tau is not None: - thermostat_tau = self._converter.Time(thermostat_tau) sec_sampling_method.x_lammps_thermostat_tau = thermostat_tau target_P = thermo_settings.get('target_P', None) if target_P is not None: - target_P = self._converter.Press(target_P) sec_sampling_method.x_lammps_barostat_target_pressure = target_P barostat_tau = thermo_settings.get('barostat_P', None) if barostat_tau is not None: - barostat_tau = self._converter.Time(barostat_tau) sec_sampling_method.x_lammps_barostat_tau = barostat_tau langevin_gamma = thermo_settings.get('langevin_gamma', None) if langevin_gamma is not None: - langevin_gamma = self._converter.Time(langevin_gamma) sec_sampling_method.x_lammps_langevin_gamma = langevin_gamma - def parse_system(self, trajfile): + def parse_system(self): sec_run = self.archive.section_run[-1] - self.traj_parser.mainfile = trajfile - pbc_cell = self.traj_parser.get('pbc_cell', []) n_atoms = self.traj_parser.get('n_atoms', []) @@ -600,11 +632,14 @@ class LammpsOutput: else: create_scc = False + distance_unit = self.log_parser.units.get('distance', None) + self.traj_parser._units = self.log_parser.units + for i in range(len(pbc_cell)): sec_system = sec_run.m_create(section_system) sec_system.number_of_atoms = n_atoms[i] sec_system.configuration_periodic_dimensions = pbc_cell[i][0] - sec_system.simulation_cell = self._converter.Distance(pbc_cell[i][1]) + sec_system.simulation_cell = pbc_cell[i][1] * distance_unit sec_system.atom_positions = self.traj_parser.get_positions(i) atom_labels = self.traj_parser.get_atom_labels(i) if atom_labels is None: @@ -613,7 +648,7 @@ class LammpsOutput: velocities = self.traj_parser.get_velocities(i) if velocities is not None: - sec_system.atom_velocities = self._converter.Velocity(velocities) + sec_system.atom_velocities = velocities forces = self.traj_parser.get_forces(i) if forces is not None: @@ -622,13 +657,11 @@ class LammpsOutput: else: sec_scc = sec_sccs[i] - sec_scc.atom_forces = self._converter.Force(forces) + sec_scc.atom_forces = forces - def parse_topology(self, datafile): + def parse_topology(self): sec_run = self.archive.section_run[-1] - self.data_parser.mainfile = datafile - masses = self.data_parser.get('Masses', None) self.traj_parser.masses = masses @@ -647,10 +680,33 @@ class LammpsOutput: sec_interaction.interaction_kind = str(interaction[0]) sec_interaction.interaction_parameters = [list(a) for a in interaction[1]] + def parse_input(self): + sec_run = self.archive.section_run[-1] + sec_input_output_files = sec_run.m_create(x_lammps_section_input_output_files) + + if self.data_parser.mainfile is not None: + sec_input_output_files.x_lammps_inout_file_data = os.path.basename( + self.data_parser.mainfile) + + if self.traj_parser.mainfile is not None: + sec_input_output_files.x_lammps_inout_file_trajectory = os.path.basename( + self.traj_parser.mainfile) + + sec_control_parameters = sec_run.m_create(x_lammps_section_control_parameters) + keys = self.log_parser._commands + for key in keys: + val = self.log_parser.get(key, None) + if val is None: + continue + val = val[0] if len(val) == 1 else val + key = 'x_lammps_inout_control_%s' % key.replace('_', '').replace('/', '').lower() + if hasattr(sec_control_parameters, key): + if isinstance(val, list): + val = ' '.join([str(v) for v in val]) + setattr(sec_control_parameters, key, str(val)) + def parse(self): sec_run = self.archive.m_create(section_run) - # TODO Warning! lj units are not supported in LammpsCommon! - self._converter = converter(self.log_parser.get('units', ['lj'])[0]) # parse basic sec_run.program_name = 'LAMMPS' @@ -663,17 +719,22 @@ class LammpsOutput: # specified in log file, otherwise will scan directory data_files = self.log_parser.get_data_files() for data_file in data_files: - self.parse_topology(data_file) + self.data_parser.mainfile = data_file + self.parse_topology() # parse all trajectorty files associated with calculation, normally only one # specified in log file, otherwise will scan directory traj_files = self.log_parser.get_traj_files() for traj_file in traj_files: - self.parse_system(traj_file) + self.traj_parser.mainfile = traj_file + self.parse_system() # parse thermodynamic data from log file self.parse_thermodynamic_data() + # include input controls from log file + self.parse_input() + # create workflow if sec_run.section_sampling_method[0].sampling_method: sec_workflow = self.archive.m_create(Workflow) diff --git a/lammpsparser/metainfo/lammps.py b/lammpsparser/metainfo/lammps.py index 10f7cd0c89237f029c7021666c045e5efb9647ef..38726292aa3a61a728557ea3d1fdfab5c489f75c 100644 --- a/lammpsparser/metainfo/lammps.py +++ b/lammpsparser/metainfo/lammps.py @@ -279,25 +279,1001 @@ class section_molecule_interaction(common.section_molecule_interaction): a_legacy=LegacyDefinition(name='x_lammps_pair_molecule_interaction_to_atom_type_ref')) -class section_run(public.section_run): +class x_lammps_section_input_output_files(MSection): + ''' + Section to store input and output file names + ''' + + m_def = Section(validate=False, a_legacy=LegacyDefinition(name='x_lammps_section_input_output_files')) + + x_lammps_inout_file_data = Quantity( + type=str, + shape=[], + description=''' + Lammps input data file. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_file_data')) + + x_lammps_inout_file_trajectory = Quantity( + type=str, + shape=[], + description=''' + Lammps input trajectory file. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_file_trajectory')) + + +class x_lammps_section_control_parameters(MSection): + ''' + Section to store the input and output control parameters + ''' + + m_def = Section(validate=False, a_legacy=LegacyDefinition(name='x_lammps_section_control_parameters')) + + x_lammps_inout_control_anglecoeff = Quantity( + type=str, + shape=[], + description=''' + Specify the angle force field coefficients for one or more angle types. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_anglecoeff')) + + x_lammps_inout_control_anglestyle = Quantity( + type=str, + shape=[], + description=''' + Set the formula(s) LAMMPS uses to compute angle interactions between triplets of + atoms, which remain in force for the duration of the simulation. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_anglestyle')) + + x_lammps_inout_control_atommodify = Quantity( + type=str, + shape=[], + description=''' + Modify certain attributes of atoms defined and stored within LAMMPS, in addition + to what is specified by the atom_style command. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_atommodify')) + + x_lammps_inout_control_atomstyle = Quantity( + type=str, + shape=[], + description=''' + Define what style of atoms to use in a simulation. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_atomstyle')) + + x_lammps_inout_control_balance = Quantity( + type=str, + shape=[], + description=''' + This command adjusts the size and shape of processor sub-domains within the + simulation box, to attempt to balance the number of atoms or particles and thus + indirectly the computational cost (load) more evenly across processors. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_balance')) + + x_lammps_inout_control_bondcoeff = Quantity( + type=str, + shape=[], + description=''' + Specify the bond force field coefficients for one or more bond type. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_bondcoeff')) + + x_lammps_inout_control_bondstyle = Quantity( + type=str, + shape=[], + description=''' + Set the formula(s) LAMMPS uses to compute bond interactions between pairs of atoms. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_bondstyle')) + + x_lammps_inout_control_bondwrite = Quantity( + type=str, + shape=[], + description=''' + Write energy and force values to a file as a function of distance for the + currently defined bond potential. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_bondwrite')) + + x_lammps_inout_control_boundary = Quantity( + type=str, + shape=[], + description=''' + Set the style of boundaries for the global simulation box in each dimension. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_boundary')) + + x_lammps_inout_control_box = Quantity( + type=str, + shape=[], + description=''' + Set attributes of the simulation box. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_box')) + + x_lammps_inout_control_changebox = Quantity( + type=str, + shape=[], + description=''' + Change the volume and/or shape and/or boundary conditions for the simulation box. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_change_box')) + + x_lammps_inout_control_clear = Quantity( + type=str, + shape=[], + description=''' + This command deletes all atoms, restores all settings to their default values, + and frees all memory allocated by LAMMPS. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_clear')) + + x_lammps_inout_control_commmodify = Quantity( + type=str, + shape=[], + description=''' + This command sets parameters that affect the inter-processor communication of atom + information that occurs each timestep as coordinates and other properties are + exchanged between neighboring processors and stored as properties of ghost atoms. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_commmodify')) + + x_lammps_inout_control_commstyle = Quantity( + type=str, + shape=[], + description=''' + This command sets the style of inter-processor communication of atom information + that occurs each timestep as coordinates and other properties are exchanged + between neighboring processors and stored as properties of ghost atoms. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_commstyle')) + + x_lammps_inout_control_compute = Quantity( + type=str, + shape=[], + description=''' + Define a computation that will be performed on a group of atoms. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_compute')) + + x_lammps_inout_control_computemodify = Quantity( + type=str, + shape=[], + description=''' + Modify one or more parameters of a previously defined compute. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_computemodify')) + + x_lammps_inout_control_createatoms = Quantity( + type=str, + shape=[], + description=''' + This command creates atoms (or molecules) on a lattice, or a single atom + (or molecule), or a random collection of atoms (or molecules), as an alternative + to reading in their coordinates explicitly via a read_data or read_restart command. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_createatoms')) + + x_lammps_inout_control_createbonds = Quantity( + type=str, + shape=[], + description=''' + Create bonds between pairs of atoms that meet a specified distance criteria. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_createbonds')) + + x_lammps_inout_control_createbox = Quantity( + type=str, + shape=[], + description=''' + This command creates a simulation box based on the specified region. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_createbox')) + + x_lammps_inout_control_deleteatoms = Quantity( + type=str, + shape=[], + description=''' + Delete the specified atoms. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_deleteatoms')) + + x_lammps_inout_control_deletebonds = Quantity( + type=str, + shape=[], + description=''' + Turn off (or on) molecular topology interactions, i.e. bonds, angles, dihedrals, + impropers. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_deletebonds')) + + x_lammps_inout_control_dielectric = Quantity( + type=str, + shape=[], + description=''' + Set the dielectric constant for Coulombic interactions (pairwise and long-range) + to this value. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_dielectric')) + + x_lammps_inout_control_dihedralcoeff = Quantity( + type=str, + shape=[], + description=''' + Specify the dihedral force field coefficients for one or more dihedral types. + ''', + a_legacy=LegacyDefinition(name='')) + + x_lammps_inout_control_dihedralstyle = Quantity( + type=str, + shape=[], + description=''' + Set the formula(s) LAMMPS uses to compute dihedral interactions between quadruplets + of atoms, which remain in force for the duration of the simulation. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_dihedralstyle')) + + x_lammps_inout_control_dimension = Quantity( + type=str, + shape=[], + description=''' + Set the dimensionality of the simulation. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_dimension')) + + x_lammps_inout_control_displaceatoms = Quantity( + type=str, + shape=[], + description=''' + Displace a group of atoms. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_displaceatoms')) + + x_lammps_inout_control_dump = Quantity( + type=str, + shape=[], + description=''' + Dump a snapshot of atom quantities to one or more files every N timesteps in one + of several styles. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_dump')) + + x_lammps_inout_control_dynamicalmatrix = Quantity( + type=str, + shape=[], + description=''' + Calculate the dynamical matrix by finite difference of the selected group. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_dynamicalmatrix')) + + x_lammps_inout_control_echo = Quantity( + type=str, + shape=[], + description=''' + This command determines whether LAMMPS echoes each input script command to the + screen and/or log file as it is read and processed. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_echo')) + + x_lammps_inout_control_fix = Quantity( + type=str, + shape=[], + description=''' + Set a fix that will be applied to a group of atoms. In LAMMPS, a “fix” is any + operation that is applied to the system during timestepping or minimization + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_fix')) + + x_lammps_inout_control_fixmodify = Quantity( + type=str, + shape=[], + description=''' + Modify one or more parameters of a previously defined fix. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_fixmodify')) + + x_lammps_inout_control_group = Quantity( + type=str, + shape=[], + description=''' + Identify a collection of atoms as belonging to a group. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_group')) + + x_lammps_inout_control_group2ndx = Quantity( + type=str, + shape=[], + description=''' + Write or read a Gromacs style index file in text format that associates atom IDs + with the corresponding group definitions. The group2ndx command will write group + definitions to an index file. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_group2ndx')) + + x_lammps_inout_control_ndx2group = Quantity( + type=str, + shape=[], + description=''' + Write or read a Gromacs style index file in text format that associates atom IDs + with the corresponding group definitions. The ndx2group command will create of + update group definitions from those stored in an index file. + ''', + a_legacy=LegacyDefinition(name='')) + + x_lammps_inout_control_hyper = Quantity( + type=str, + shape=[], + description=''' + Run a bond-boost hyperdynamics (HD) simulation where time is accelerated by + application of a bias potential to one or more pairs of nearby atoms in the system. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_hyper')) + + x_lammps_inout_control_if = Quantity( + type=str, + shape=[], + description=''' + This command provides an if-then-else capability within an input script. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_if')) + + x_lammps_inout_control_impropercoeff = Quantity( + type=str, + shape=[], + description=''' + Specify the improper force field coefficients for one or more improper types. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_impropercoeff')) + + x_lammps_inout_control_improperstyle = Quantity( + type=str, + shape=[], + description=''' + Set the formula(s) LAMMPS uses to compute improper interactions between + quadruplets of atoms, which remain in force for the duration of the simulation. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_improperstyle')) + + x_lammps_inout_control_include = Quantity( + type=str, + shape=[], + description=''' + This command opens a new input script file and begins reading LAMMPS commands + from that file. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_include')) + + x_lammps_inout_control_info = Quantity( + type=str, + shape=[], + description=''' + Print out information about the current internal state of the running LAMMPS process. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_info')) + + x_lammps_inout_control_jump = Quantity( + type=str, + shape=[], + description=''' + This command closes the current input script file, opens the file with the + specified name, and begins reading LAMMPS commands from that file. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_jump')) + + x_lammps_inout_control_kiminit = Quantity( + type=str, + shape=[], + description=''' + The set of kim_commands provide a high-level wrapper around the Open Knowledgebase + of Interatomic Models (OpenKIM) repository of interatomic models (IMs) + (potentials and force fields), so that they can be used by LAMMPS scripts. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_kiminit')) + + x_lammps_inout_control_kiminteractions = Quantity( + type=str, + shape=[], + description=''' + The set of kim_commands provide a high-level wrapper around the Open Knowledgebase + of Interatomic Models (OpenKIM) repository of interatomic models (IMs) + (potentials and force fields), so that they can be used by LAMMPS scripts. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_kiminteractions')) + + x_lammps_inout_control_kimquery = Quantity( + type=str, + shape=[], + description=''' + The set of kim_commands provide a high-level wrapper around the Open Knowledgebase + of Interatomic Models (OpenKIM) repository of interatomic models (IMs) + (potentials and force fields), so that they can be used by LAMMPS scripts. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_kimquery')) + + x_lammps_inout_control_kimparam = Quantity( + type=str, + shape=[], + description=''' + The set of kim_commands provide a high-level wrapper around the Open Knowledgebase + of Interatomic Models (OpenKIM) repository of interatomic models (IMs) + (potentials and force fields), so that they can be used by LAMMPS scripts. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_kimparam')) + + x_lammps_inout_control_kimproperty = Quantity( + type=str, + shape=[], + description=''' + The set of kim_commands provide a high-level wrapper around the Open Knowledgebase + of Interatomic Models (OpenKIM) repository of interatomic models (IMs) + (potentials and force fields), so that they can be used by LAMMPS scripts. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_kimproperty')) + + x_lammps_inout_control_kspacemodify = Quantity( + type=str, + shape=[], + description=''' + Set parameters used by the kspace solvers defined by the kspace_style command. + Not all parameters are relevant to all kspace styles. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_kspacemodify')) + + x_lammps_inout_control_kspacestyle = Quantity( + type=str, + shape=[], + description=''' + Define a long-range solver for LAMMPS to use each timestep to compute long-range + Coulombic interactions or long-range interactions. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_kspacestyle')) + + x_lammps_inout_control_label = Quantity( + type=str, + shape=[], + description=''' + Label this line of the input script with the chosen ID. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_label')) + + x_lammps_inout_control_lattice = Quantity( + type=str, + shape=[], + description=''' + Define a lattice for use by other commands. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_lattice')) + + x_lammps_inout_control_log = Quantity( + type=str, + shape=[], + description=''' + This command closes the current LAMMPS log file, opens a new file with the + specified name, and begins logging information to it. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_log')) + + x_lammps_inout_control_mass = Quantity( + type=str, + shape=[], + description=''' + Set the mass for all atoms of one or more atom types. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_mass')) + + x_lammps_inout_control_message = Quantity( + type=str, + shape=[], + description=''' + Establish a messaging protocol between LAMMPS and another code for the purpose of + client/server coupling. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_message')) + + x_lammps_inout_control_minmodify = Quantity( + type=str, + shape=[], + description=''' + This command sets parameters that affect the energy minimization algorithms + selected by the min_style command. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_minmodify')) + + x_lammps_inout_control_minstyle = Quantity( + type=str, + shape=[], + description=''' + Apply a minimization algorithm to use when a minimize command is performed. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_minstyle')) + + x_lammps_inout_control_minimize = Quantity( + type=str, + shape=[], + description=''' + Perform an energy minimization of the system, by iteratively adjusting atom + coordinates. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_minimize')) + + x_lammps_inout_control_molecule = Quantity( + type=str, + shape=[], + description=''' + Define a molecule template that can be used as part of other LAMMPS commands, + typically to define a collection of particles as a bonded molecule or a rigid body. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_molecule')) - m_def = Section(validate=False, extends_base_section=True, a_legacy=LegacyDefinition(name='section_run')) + x_lammps_inout_control_neb = Quantity( + type=str, + shape=[], + description=''' + Perform a nudged elastic band (NEB) calculation using multiple replicas of a system. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_neb')) + + x_lammps_inout_control_neighmodify = Quantity( + type=str, + shape=[], + description=''' + This command sets parameters that affect the building and use of pairwise neighbor + lists. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_neighmodify')) + + x_lammps_inout_control_neighbor = Quantity( + type=str, + shape=[], + description=''' + This command sets parameters that affect the building of pairwise neighbor lists. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_neighbor')) + + x_lammps_inout_control_newton = Quantity( + type=str, + shape=[], + description=''' + This command turns Newton’s third law on or off for pairwise and bonded interactions. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_newton')) + + x_lammps_inout_control_next = Quantity( + type=str, + shape=[], + description=''' + This command is used with variables defined by the variable command. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_next')) + + x_lammps_inout_control_package = Quantity( + type=str, + shape=[], + description=''' + This command invokes package-specific settings for the various accelerator + packages available in LAMMPS. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_package')) + + x_lammps_inout_control_paircoeff = Quantity( + type=str, + shape=[], + description=''' + Specify the pairwise force field coefficients for one or more pairs of + atom types. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_paircoeff')) + + x_lammps_inout_control_pairmodify = Quantity( + type=str, + shape=[], + description=''' + Modify the parameters of the currently defined pair style. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_pairmodify')) + + x_lammps_inout_control_pairstyle = Quantity( + type=str, + shape=[], + description=''' + Set the formula(s) LAMMPS uses to compute pairwise interactions. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_pairstyle')) + + x_lammps_inout_control_pairwrite = Quantity( + type=str, + shape=[], + description=''' + Write energy and force values to a file as a function of distance for + the currently defined pair potential. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_pairwrite')) + + x_lammps_inout_control_partition = Quantity( + type=str, + shape=[], + description=''' + This command invokes the specified command on a subset of the + partitions of processors you have defined via the -partition command-line switch. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_partition')) + + x_lammps_inout_control_prd = Quantity( + type=str, + shape=[], + description=''' + Run a parallel replica dynamics (PRD) simulation using multiple + replicas of a system. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_prd')) + + x_lammps_inout_control_print = Quantity( + type=str, + shape=[], + description=''' + Print a text string to the screen and logfile. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_print')) + + x_lammps_inout_control_processors = Quantity( + type=str, + shape=[], + description=''' + Specify how processors are mapped as a regular 3d grid to the global + simulation box. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_processors')) + + x_lammps_inout_control_quit = Quantity( + type=str, + shape=[], + description=''' + This command causes LAMMPS to exit, after shutting down all output + cleanly. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_quit')) + + x_lammps_inout_control_readdata = Quantity( + type=str, + shape=[], + description=''' + Read in a data file containing information LAMMPS needs to run a + simulation. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_readdata')) + + x_lammps_inout_control_readdump = Quantity( + type=str, + shape=[], + description=''' + Read atom information from a dump file to overwrite the current atom + coordinates, and optionally the atom velocities and image flags and + the simulation box dimensions. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_readdump')) + + x_lammps_inout_control_readrestart = Quantity( + type=str, + shape=[], + description=''' + Read in a previously saved system configuration from a restart file. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_readrestart')) + + x_lammps_inout_control_region = Quantity( + type=str, + shape=[], + description=''' + This command defines a geometric region of space. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_region')) + + x_lammps_inout_control_replicate = Quantity( + type=str, + shape=[], + description=''' + Replicate the current simulation one or more times in each dimension. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_replicate')) + + x_lammps_inout_control_rerun = Quantity( + type=str, + shape=[], + description=''' + Perform a pseudo simulation run where atom information is read one + snapshot at a time from a dump file(s), and energies and forces are + computed on the shapshot to produce thermodynamic or other output. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_rerun')) + + x_lammps_inout_control_resetatomids = Quantity( + type=str, + shape=[], + description=''' + Reset atom IDs for the system, including all the global IDs stored + for bond, angle, dihedral, improper topology data. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_resetatomids')) + + x_lammps_inout_control_resetmolids = Quantity( + type=str, + shape=[], + description=''' + Reset molecule IDs for a group of atoms based on current bond + connectivity. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_resetmolids')) + + x_lammps_inout_control_resettimestep = Quantity( + type=str, + shape=[], + description=''' + Set the timestep counter to the specified value. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_resettimestep')) + + x_lammps_inout_control_restart = Quantity( + type=str, + shape=[], + description=''' + Write out a binary restart file with the current state of the + simulation every so many timesteps, in either or both of two modes, as + a run proceeds. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_restart')) - x_lammps_program_version_date = Quantity( + x_lammps_inout_control_run = Quantity( type=str, shape=[], description=''' - Program version date. + Run or continue dynamics for a specified number of timesteps. ''', - a_legacy=LegacyDefinition(name='x_lammps_program_version_date')) + a_legacy=LegacyDefinition(name='x_lammps_inout_control_run')) - x_lammps_dummy_text = Quantity( + x_lammps_inout_control_runstyle = Quantity( type=str, shape=[], description=''' - dummy text + Choose the style of time integrator used for molecular dynamics + simulations performed by LAMMPS. ''', - a_legacy=LegacyDefinition(name='x_lammps_dummy_text')) + a_legacy=LegacyDefinition(name='x_lammps_inout_control_runstyle')) + + x_lammps_inout_control_server = Quantity( + type=str, + shape=[], + description=''' + This command starts LAMMPS running in “server” mode, where it receives + messages from a separate “client” code and responds by sending a reply + message back to the client. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_server')) + + x_lammps_inout_control_set = Quantity( + type=str, + shape=[], + description=''' + Set one or more properties of one or more atoms. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_set')) + + x_lammps_inout_control_shell = Quantity( + type=str, + shape=[], + description=''' + Execute a shell command. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_shell')) + + x_lammps_inout_control_specialbonds = Quantity( + type=str, + shape=[], + description=''' + Set weighting coefficients for pairwise energy and force contributions + between pairs of atoms that are also permanently bonded to each other, + either directly or via one or two intermediate bonds. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_specialbonds')) + + x_lammps_inout_control_suffix = Quantity( + type=str, + shape=[], + description=''' + This command allows you to use variants of various styles if they + exist. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_suffix')) + + x_lammps_inout_control_tad = Quantity( + type=str, + shape=[], + description=''' + Run a temperature accelerated dynamics (TAD) simulation. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_tad')) + + x_lammps_inout_control_tempergrem = Quantity( + type=str, + shape=[], + description=''' + Run a parallel tempering or replica exchange simulation in LAMMPS + partition mode using multiple generalized replicas (ensembles) of a + system defined by fix grem, which stands for the + generalized replica exchange method (gREM) originally developed by + (Kim). + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_tempergrem')) + + x_lammps_inout_control_tempernpt = Quantity( + type=str, + shape=[], + description=''' + Run a parallel tempering or replica exchange simulation using multiple + replicas (ensembles) of a system in the isothermal-isobaric (NPT) + ensemble. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_tempernpt')) + + x_lammps_inout_control_thermo = Quantity( + type=str, + shape=[], + description=''' + Compute and print thermodynamic info (e.g. temperature, energy, + pressure) on timesteps that are a multiple of N and at the beginning + and end of a simulation. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_thermo')) + + x_lammps_inout_control_thermomodify = Quantity( + type=str, + shape=[], + description=''' + Set options for how thermodynamic information is computed and printed + by LAMMPS. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_thermomodify')) + + x_lammps_inout_control_thermostyle = Quantity( + type=str, + shape=[], + description=''' + Set the style and content for printing thermodynamic data to the + screen and log file. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_thermostyle')) + + x_lammps_inout_control_thirdorder = Quantity( + type=str, + shape=[], + description=''' + Calculate the third order force constant tensor by finite difference of the selected group, + + where Phi is the third order force constant tensor. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_thirdorder')) + + x_lammps_inout_control_timer = Quantity( + type=str, + shape=[], + description=''' + Select the level of detail at which LAMMPS performs its CPU timings. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_timer')) + + x_lammps_inout_control_timestep = Quantity( + type=str, + shape=[], + description=''' + Set the timestep size for subsequent molecular dynamics simulations. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_timestep')) + + x_lammps_inout_control_uncompute = Quantity( + type=str, + shape=[], + description=''' + Delete a compute that was previously defined with a compute + command. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_uncompute')) + + x_lammps_inout_control_undump = Quantity( + type=str, + shape=[], + description=''' + Turn off a previously defined dump so that it is no longer active. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_undump')) + + x_lammps_inout_control_unfix = Quantity( + type=str, + shape=[], + description=''' + Delete a fix that was previously defined with a fix + command. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_unfix')) + + x_lammps_inout_control_units = Quantity( + type=str, + shape=[], + description=''' + This command sets the style of units used for a simulation. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_units')) + + x_lammps_inout_control_variable = Quantity( + type=str, + shape=[], + description=''' + This command assigns one or more strings to a variable name for + evaluation later in the input script or during a simulation. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_variable')) + + x_lammps_inout_control_velocity = Quantity( + type=str, + shape=[], + description=''' + Set or change the velocities of a group of atoms in one of several + styles. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_velocity')) + + x_lammps_inout_control_writecoeff = Quantity( + type=str, + shape=[], + description=''' + Write a text format file with the currently defined force field + coefficients in a way, that it can be read by LAMMPS with the + include command. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_writecoeff')) + + x_lammps_inout_control_writedata = Quantity( + type=str, + shape=[], + description=''' + Write a data file in text format of the current state of the + simulation. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_writedata')) + + x_lammps_inout_control_writedump = Quantity( + type=str, + shape=[], + description=''' + Dump a single snapshot of atom quantities to one or more files for the + current state of the system. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_writedump')) + + x_lammps_inout_control_writerestart = Quantity( + type=str, + shape=[], + description=''' + Write a binary restart file of the current state of the simulation. + ''', + a_legacy=LegacyDefinition(name='x_lammps_inout_control_writerestart')) + + +class section_run(public.section_run): + + m_def = Section(validate=False, extends_base_section=True, a_legacy=LegacyDefinition(name='section_run')) + + x_lammps_section_input_output_files = SubSection( + sub_section=SectionProxy('x_lammps_section_input_output_files'), + repeats=True, + a_legacy=LegacyDefinition(name='x_lammps_section_input_output_files')) + + x_lammps_section_control_parameters = SubSection( + sub_section=SectionProxy('x_lammps_section_control_parameters'), + repeats=True, + a_legacy=LegacyDefinition(name='x_lammps_section_control_parameters')) class section_topology(common.section_topology):