pylammps package

Submodules

pylammps.Analyzer module

Analyzer class: the Analyzer of LAMMPS Systems

class pylammps.Analyzer.Analyzer(computes)[source]

Bases: object

The analyzer class. Has to be instantiated for each simulation, with the computes that we want to calculate

analyze(system)[source]

Main method, that performs all the analysis on the system given

Parameters:

system : System instance

The system that we will use to calculate the computes

computes

Computes for the analyzer

log(path)[source]

Log all the computes

Parameters:

path : str

Path where to write the log

plot(path)[source]

Plot all the computes

Parameters:

path : str

Path where to save the plots

update(system)[source]

Perform the computes and update all the tallies

Parameters:

system : System instance

The system that we will update

zero()[source]

Zero out all the computes

pylammps.DummyLammps module

Dummy lammps class, good for debugging purposes. It only logs everything on a file

class pylammps.DummyLammps.Lammps(args, vals)[source]

Bases: object

Dummy lammps object that just debugs

command(command)[source]

Run a command. The dummy class only logs it.

Parameters:

command :

Command to run

pylammps.Logger module

Logger class

class pylammps.Logger.Logger(system, root_path='./data', style='folder')[source]

Bases: object

Main logger class. Can either plot or write the data on a text file

dump(system, style='text')[source]

Dump the system information.

Parameters:

system : System

The molecular dynamics system. It needs to have a dump method in it. It can be eventually changed so it can be ported outside lammps.

style : {‘text’, ‘image’}

Style to use when dumping

log(analyzer)[source]

Write the logging of the analyzer.

Parameters:

analyzer : Analyzer

The analyzer to be logged

plot(analyzer)[source]

Plot the result of the analyzer.

Parameters:

analyzer : Analyzer

The analyzer to be logged

pylammps.Potential module

Module for the calculation of the potential energy in Neutron Star systems.

pylammps.Potential.build_table(pot, lda, name=None)[source]

This method builds the actual potential table that will be read in lammps. So far, three different potentials are going to be supported:

  • Pandha medium
  • Pandha stiff
  • Horowitz

pylammps.System module

System class: the Lammps Molecular Dynamics main object

class pylammps.System.NeutronStarSystem(gpu=False, silent=True)[source]

Bases: pylammps.System.System

The Neutron Star System. It sets up the typical usage for Neutron Star Simulations

class pylammps.System.System(gpu=False, silent=True)[source]

Bases: dict

Any system will be a dictionary with the parameters of the simulation. It inherits from a dictionary to keep the syntax as clean as possible

box

Get box of the system as a (3, 2) numpy array

Returns:box : 2D numpy array
dump(path, style)[source]

Wrapper to the lammps dump format

Parameters:

path : string

Path where to save the dump

style : {‘text’, ‘image’}

Style to use when dumping

expand(rate)[source]

Set initial condition for an expansion as seen in [Dorso]

[Dorso]Dorso and Strachan, Phys. Rev. B 54, 236
Parameters:

rate : float

Expansion rate, in box per seconds units

minimize(etol, ftol, maxiter, maxeval)[source]

Minimize to remove some of the potential energy, probably due to initial random configuration, and set temperature to Gaussian according to the system temperature if it exists.

Parameters:

etol : float

Stopping tolerance for energy (unitless)

ftol : float

Stopping tolerance for force (force units)

maxiter : int

Maximum number of iterations of minimizer

maxeval : int

Maximum number of force evaulations

read_dump(fname)[source]

Read information from the last snapshot of a dump file. It purges all previous particles, so the particles are exactly the type and ids of the new particles are those of the dump file.

Parameters:

fname : str

LAMMPS-style dump filename to read

Raises:

IOError

In case there is no snapshot in the filename to read

run(steps)[source]

Wrapper for the “run” command in lammps.

Parameters:steps: number of steps to run
t

Get types as a numpy array from the simulation

thermalize(freq, wind)[source]

Runs the system until it has thermalized. The criterion for stability is:

1.- The average temperature of the last freq*steps is close to the set temperature by a standard deviation and

2.- The energy stops decreasing (slope > 0)

Parameters:

freq: int

Number of timesteps between each temperature to be considered in the average and slope

wind: int

Number of timesteps in the slope and average calculation of the temperature.

Notes

Due to criterion 2, this works only when setting temperature from high to low. Nevertheless, when going from low to high temperatures, one would expect that just setting the temperatures and complying with 1 should be enough.

unexpand()[source]

Stop expansion

v

Get v as a numpy array from the simulation

x

Get x as a numpy array from the simulation

Module contents