pysimm.lmps module

class pysimm.lmps.CreateBox(n=1, region=<pysimm.lmps.Region object>, *args, **kwargs)[source]

Bases: pysimm.utils.Item

Template object to create a box in a LAMMPS simulation. See LAMMPS documentation for further information

n

number of atom types

region

Region object

**kwargs

optional kwargs for create_box command (replace / with _)

write(sim=None)[source]
class pysimm.lmps.CustomInput(custom_input)[source]

Bases: object

Template object to contain custom LAMMPS input.

custom_input

custom input string

write(sim=None)[source]

Create LAMMPS input for a custom simulation.

Parameters:sim – pysimm.lmps.Simulation object reference
Returns:input string
class pysimm.lmps.Group(name='all', style='id', *args, **kwargs)[source]

Bases: pysimm.utils.Item

Template object to define a group in a LAMMPS simulation. See LAMMPS documentation for further information

name

name for the group

style

style for the group

*args

arguments for the given style

write(sim=None)[source]
class pysimm.lmps.Init(**kwargs)[source]

Bases: object

Template object to contain LAMMPS initialization settings

forcefield

name of a supported force field; simulation settings will be chosen based on the force field name

units

LAMMPS set of units to use during simulation; default=real

atom_style

LAMMPS aomt_style to use during simulation; default=full

charge

option to define if any particles in system a non-zero charge

kspace_style

LAMMPS kspace_style to use during simulation if system has charges; default=pppm 1e-4

cutoff

dictionary of cutoff distances for nonbonded interactions; default={‘lj’: 12.0, ‘coul’: 12.0, ‘inner_lj’: 10.0}

pair_style

LAMMPS pair_style to use during simulation

bond_style

LAMMPS bond_style to use during simulation

angle_style

LAMMPS angle_style to use during simulation

dihedral_style

LAMMPS dihedral_style to use during simulation

improper_style

LAMMPS improper_style to use during simulation

special_bonds

LAMMPS special_bonds to use during simulation

pair_modify

LAMMPS pair_modify to use during simulation

read_data

name of data file to read instead of using System object

write(sim=None)[source]

Prepare LAMMPS input with initialization settings

Parameters:simSimulation object reference
Returns:string of LAMMPS input
class pysimm.lmps.LogFile(fname)[source]

Bases: object

Class to read LAMMPS log file into Pandas DataFrame stored in LogFile.data

fname

filename of log file

data

resulting DataFrame with log file data

class pysimm.lmps.Minimization(**kwargs)[source]

Bases: object

Template object to contain LAMMPS energy minimization settings.

min_style

LAMMPS minimization style default=’sd’

dmax

how far any atom can move in a single line search in any dimension

etol

energy tolerance default=1e-3

ftol

force tolerance default=1e-3

maxiter

maximum iterations default=10000

max eval

maximum force evaluations default=100000

write(sim=None)[source]

Create LAMMPS input for an energy minimization simulation.

Parameters:simSimulation object reference
Returns:input string
class pysimm.lmps.MolecularDynamics(**kwargs)[source]

Bases: object

Template object to contain LAMMPS MD settings

name

name to identify MD

group

Group object for integrator

timestep

timestep value to use during MD

ensemble

‘nvt’ or ‘npt’ or ‘nve’; default=nve

limit

numerical value to use with nve when limiting particle displacement

temperature

dictionary of settings for temperature (start, stop, damp)

pressure

dictionary of settings for pressure (start, stop, damp)

run

length of MD simulation in number of timesteps or False to omit run command

unfix

True to include command to unfix integrator after run

rigid

dictionary of settings for a rigid simulation

extra_keywords

dictionary of extra keywords to append at the end of the LAMMPS fix integrator

write(sim=None)[source]

Create LAMMPS input for a molecular dynamics simulation.

Parameters:sim – pysimm.lmps.Simulation object reference
Returns:input string
class pysimm.lmps.OutputSettings(**kwargs)[source]

Bases: object

Template object to define thermo and dump output settings in a LAMMPS simulation. See LAMMPS documentation for further information

thermo

dictionary of settings for thermo output

dump

dictionary of settings for dump output

write(sim=None)[source]
class pysimm.lmps.Qeq(**kwargs)[source]

Bases: object

pysimm.lmps.MolecularDynamics

Template object to contain LAMMPS qeq settings

cutoff

distance cutoff for charge equilibration

tol

tolerance (precision) for charge equilibration

max_iter

maximum iterations

qfile

file with qeq parameters (leave undefined for defaults)

write(sim=None)[source]

Create LAMMPS input for a charge equilibration calculation

Parameters:simSimulation object reference
Returns:input string
class pysimm.lmps.Region(name='all', style='block', *args, **kwargs)[source]

Bases: pysimm.utils.Item

Template object to create a region in a LAMMPS simulation. See LAMMPS documentation for further information

name

name id for region

style

LAMMPS region style

*args

args for given style

**kwargs

optional kwargs for region command

write(sim=None)[source]
class pysimm.lmps.Simulation(s, **kwargs)[source]

Bases: object

Organizational object for LAMMPS simulation. Should contain combination of MolecularDynamics, Minimization, and/or CustomInput object.

forcefield

name of force field for simulation settings

name

name for simulation

log

LAMMPS log filename

write

file name to write final LAMMPS data file default=None

print_to_screen

True to have LAMMPS output printed to stdout after simulation ends

debug

True to have LAMMPS output streamed to stdout during simulation (WARNING: this may degrade performance)

custom

option to flag simulation as purley custom input to skip prepaing initialization

add(*args)[source]
add_custom(custom='')[source]

Add custom input string to simulation

Parameters:custom – custom LAMMPS input string to add to Simulation
add_md(template=None, **kwargs)[source]

Add MolecularDyanmics template to simulation

Parameters:
add_min(template=None, **kwargs)[source]

Add Minimization template to simulation

Parameters:
  • templateMinimization object reference
  • **kwargs – if template is None these are passed to Minimization constructor to create new template
add_qeq(template=None, **kwargs)[source]

Add Qeq template to simulation

Parameters:
  • templateQeq object reference
  • **kwargs – if template is None these are passed to Qeq constructor to create new template
input
run(np=None, nanohub=None, save_input=True, prefix='mpiexec')[source]

Begin LAMMPS simulation.

Parameters:
  • np – number of threads to use (serial by default) default=None
  • nanohub – dictionary containing nanohub resource information default=None
  • init – True to write initialization part of LAMMPS input script (set to False if using complete custom input)
  • save_input – True to save input as pysimm.sim.in
  • prefix – prefix for running LAMMPS (i.e. - mpiexec)
write_input(init=True)[source]

Creates LAMMPS input string including initialization and input from templates/custom input

Parameters:None
Returns:None
class pysimm.lmps.SteeredMolecularDynamics(**kwargs)[source]

Bases: pysimm.lmps.MolecularDynamics

write(sim=None)[source]

Create LAMMPS input for a steered molecular dynamics simulation.

Parameters:simSimulation object reference
Returns:input string
class pysimm.lmps.Velocity(group=<pysimm.lmps.Group object>, style='create', *args, **kwargs)[source]

Bases: pysimm.utils.Item

Template object to define velocity initialization in a LAMMPS simulation. See LAMMPS documentation for further information

group

group for velocity command

style

style for the velocity command

*args

arguments for the given style

write(sim=None)[source]
pysimm.lmps.call_lammps(simulation, np, nanohub, prefix='mpiexec')[source]

Wrapper to call LAMMPS using executable name defined in pysimm.lmps module.

Parameters:
  • simulationSimulation object reference
  • np – number of threads to use
  • nanohub – dictionary containing nanohub resource information default=None
  • prefix – prefix for running LAMMPS (i.e. - mpiexec)
Returns:

None

pysimm.lmps.check_lmps_attr(s)[source]
pysimm.lmps.check_lmps_exec()[source]
pysimm.lmps.energy(s, all=False, np=None, **kwargs)[source]

Convenience function to calculate energy of a given System object.

Parameters:
  • s – system to calculate energy
  • all – returns decomposition of energy if True (default: False)
  • np – number of threads to use for simulation
Returns:

total energy or disctionary of energy components

pysimm.lmps.enqueue_output(out, queue)[source]

Helps queue output for printing to screen during simulation.

pysimm.lmps.qeq(s, np=None, nanohub=None, **kwargs)[source]

Convenience function to call a qeq calculation. kwargs are passed to Qeq constructor

Parameters:
  • s – system to perform simulation on
  • np – number of threads to use
  • nanohub – dictionary containing nanohub resource information default=None
Returns:

None

pysimm.lmps.quick_md(s, np=None, nanohub=None, **kwargs)[source]

Convenience function to call an individual MD simulation. kwargs are passed to MD constructor

Parameters:
  • s – system to perform simulation on
  • np – number of threads to use
  • nanohub – dictionary containing nanohub resource information default=None
Returns:

None

pysimm.lmps.quick_min(s, np=None, nanohub=None, **kwargs)[source]

Convenience function to call an individual energy minimization simulation. kwargs are passed to min constructor

Parameters:
  • s – system to perform simulation on
  • np – number of threads to use
  • nanohub – dictionary containing nanohub resource information default=None
Returns:

None