postmd.log package

class postmd.log.LogFile[source]

Bases: object

set_path(path=None)[source]

set the path of log file(log.lammps) and judge the validity of the path

Parameters:

path (str, optional) – the path to the log file. Defaults to None.

get_lammps_version()[source]

get the version of lammps used.

extract_thermodata(*, block_start='Per MPI rank', block_end='Loop time of', path=None, output='extracted-log.lammps')[source]

extract the thermo data from log file

Parameters:
  • block_start (str, optional) – the start string of the block of thermo data. Defaults to “Per MPI rank”.

  • block_end (str, optional) – the end string of the block of thermo data. Defaults to “Loop time of”.

  • paths (str, optional) – the path to the log file. Default to None, which means use self.path

Note

1. block_start=’Step’ and block_end=”Loop time of” usually works for most case in LAMMPS (29 Oct 2020). If the block changed with lammps, you can change it with keyword arguments.

2. If the block of thermo data contain the WARNING, for example, sub-domain…, this function can not omit the WARNING. Maybe a good choice is to add a judgement depend on the percent of characters exceeding 50% with Regular Expression!

Submodules

postmd.log.dir module

postmd.log.logfile module

This script is to process the files generated from log file(log.lammps). @Author : Shusong Zhang @Email : sszhang@mail.nwpu.edu.cn, zhangshusong789@gmail.com @File : FileOperation.py @Time : 2023/05/05 10:46:11

class postmd.log.logfile.LogFile[source]

Bases: object

set_path(path=None)[source]

set the path of log file(log.lammps) and judge the validity of the path

Parameters:

path (str, optional) – the path to the log file. Defaults to None.

get_lammps_version()[source]

get the version of lammps used.

extract_thermodata(*, block_start='Per MPI rank', block_end='Loop time of', path=None, output='extracted-log.lammps')[source]

extract the thermo data from log file

Parameters:
  • block_start (str, optional) – the start string of the block of thermo data. Defaults to “Per MPI rank”.

  • block_end (str, optional) – the end string of the block of thermo data. Defaults to “Loop time of”.

  • paths (str, optional) – the path to the log file. Default to None, which means use self.path

Note

1. block_start=’Step’ and block_end=”Loop time of” usually works for most case in LAMMPS (29 Oct 2020). If the block changed with lammps, you can change it with keyword arguments.

2. If the block of thermo data contain the WARNING, for example, sub-domain…, this function can not omit the WARNING. Maybe a good choice is to add a judgement depend on the percent of characters exceeding 50% with Regular Expression!