pysimm.system

Module Contents

Classes

Particle

pysimm.system.Particle

ParticleType

pysimm.system.ParticleType

Bond

pysimm.system.Bond

BondType

pysimm.system.BondType

Angle

pysimm.system.Angle

AngleType

pysimm.system.AngleType

Dihedral

pysimm.system.Dihedral

DihedralType

pysimm.system.DihedralType

Improper

pysimm.system.Improper

ImproperType

pysimm.system.ImproperType

Dimension

pysimm.system.Dimension

System

pysimm.system.System

Molecule

pysimm.system.Molecule

Functions

read_yaml(file_, **kwargs)

pysimm.system.read_yaml

read_xyz(file_, **kwargs)

pysimm.system.read_xyz

read_chemdoodle_json(file_, **kwargs)

pysimm.system.read_chemdoodle_json

read_lammps(data_file, **kwargs)

pysimm.system.read_lammps

read_pubchem_smiles(smiles, quiet=False, type_with=None)

pysimm.system.read_pubchem_smiles

read_pubchem_cid(cid, type_with=None)

pysimm.system.read_pubchem_smiles

read_cml(cml_file, **kwargs)

pysimm.system.read_cml

read_mol(mol_file, type_with=None, version='V2000')

pysimm.system.read_mol

read_mol2(mol2_file, type_with=None)

pysimm.system.read_mol2

read_prepc(prec_file)

pysimm.system.read_prepc

read_ac(ac_file)

pysimm.system.read_ac

read_pdb(pdb_file, str_file=None, **kwargs)

pysimm.system.read_pdb

compare(s1, s2)

get_types(*arg, **kwargs)

pysimm.system.get_types

distance_to_origin(p)

pysimm.system.distance_to_origin

replicate(ref, nrep, s_=None, density=0.3, rand=True, print_insertions=True)

pysimm.system.replicate

Attributes

call

np

pd

pysimm.system.call[source]
pysimm.system.np[source]
pysimm.system.pd[source]
class pysimm.system.Particle(**kwargs)[source]

Bases: pysimm.utils.Item

pysimm.system.Particle

Objects inheriting from Item can contain arbitrary data. Keyword arguments are assigned as attributes. Attributes usually used are given below.

x

x coordinate

y

y coordinate

z

z coordinate

charge

partial charge

type

ParticleType object reference

coords(self)[source]
check(self, style='full')[source]
delete_bonding(self, s)[source]

pysimm.system.Particle.delete_bonding

Iterates through s.bonds, s.angles, s.dihedrals, and s.impropers and removes those which contain this Particle.

Parameters

sSystem object from which bonding objects will be removed

Returns

None

translate(self, dx, dy, dz)[source]

pysimm.system.Particle.translate

Shifts Particle position by dx, dy, dz.

Parameters
  • dx – distance to shift in x direction

  • dy – distance to shift in y direction

  • dz – distance to shift in z direction

Returns

None

__sub__(self, other)[source]

pysimm.system.Particle.__sub__

Implements subtraction between Particle objects to calculate distance.

Parameters

otherParticle object

Returns

distance calculated by distance(). This does not consider pbc

__rsub__(self, other)[source]
class pysimm.system.ParticleType(**kwargs)[source]

Bases: pysimm.utils.Item

pysimm.system.ParticleType

Objects inheriting from Item can contain arbitrary data. Keyword arguments are assigned as attributes. Attributes usually used are given below.

sigma

LJ sigma value (Angstrom)

epsilon

LJ epsilon value (kcal/mol)

elem

element abbreviation, i.e. ‘H’ for Hydrogen, ‘Cl’ for Chlorine

name

force field particle type name

form(self, style='lj_12-6', d_range=None)[source]

pysimm.system.ParticleType.form

Returns data to plot functional form for the potential energy with the given style.

Parameters

style – string for pair style of ParticleType (lj_12-6, lj_9-6, buck)

Returns

x, y for plotting functional form (energy vs distance)

classmethod guess_style(cls, nparam)[source]
classmethod parse_lammps(cls, line, style)[source]
write_lammps(self, style='lj')[source]

pysimm.system.ParticleType.write_lammps

Formats a string to define particle type coefficients for a LAMMPS data file given the provided style.

Parameters

style – string for pair style of ParticleType (lj, class2, mass, buck)

Returns

LAMMPS formatted string with pair coefficients

class pysimm.system.Bond(**kwargs)[source]

Bases: pysimm.utils.Item

pysimm.system.Bond

Bond between particle a and b

a–b

Objects inheriting from Item can contain arbitrary data. Keyword arguments are assigned as attributes. Attributes usually used are given below.

a

Particle object involved in bond

b

Particle object involved in bond

type

BondType object reference

get_other_particle(self, p)[source]
distance(self)[source]

pysimm.system.Bond.distance

Calculates distance between Particle a and Particle b in this Bond object. Sets distance to dist attribute of self. Does not consider pbc.

Parameters

None

Returns

Distance between Particle a and Particle b (not considering pbc)

class pysimm.system.BondType(**kwargs)[source]

Bases: pysimm.utils.Item

pysimm.system.BondType

Objects inheriting from Item can contain arbitrary data. Keyword arguments are assigned as attributes. Attributes usually used are given below.

k

harmonic bond force constant (kcal/mol/A^2)

r0

bond equilibrium distance (Angstrom)

name

force field bond type name

classmethod guess_style(cls, nparam)[source]
classmethod parse_lammps(cls, line, style)[source]
write_lammps(self, style='harmonic')[source]

pysimm.system.BondType.write_lammps

Formats a string to define bond type coefficients for a LAMMPS data file given the provided style.

Parameters

style – string for pair style of BondType (harmonic, class2)

Returns

LAMMPS formatted string with bond coefficients

form(self, style='harmonic', d_range=None)[source]

pysimm.system.BondType.form

Returns data to plot functional form for the potential energy with the given style.

Parameters

style – string for pair style of BondType (harmonic, class2)

Returns

x, y for plotting functional form (energy vs distance)

class pysimm.system.Angle(**kwargs)[source]

Bases: pysimm.utils.Item

pysimm.system.Angle

Angle between particles a, b, and c

a–b–c

Objects inheriting from Item can contain arbitrary data. Keyword arguments are assigned as attributes. Attributes usually used are given below.

a

Particle object involved in angle

b

Particle object involved in angle (middle particle)

c

Particle object involved in angle

type

AngleType object reference

angle(self, radians=False)[source]

pysimm.system.Angle.angle

Calculate angle.

Parameters

radians – True to return value in radians (default: False)

Returns

Angle between Particle a, b, and c

class pysimm.system.AngleType(**kwargs)[source]

Bases: pysimm.utils.Item

pysimm.system.AngleType

Objects inheriting from Item can contain arbitrary data. Keyword arguments are assigned as attributes. Attributes usually used are given below.

k

harmonic angle bend force constant (kcal/mol/radian^2)

theta0

angle equilibrium value (degrees)

name

force field angle type name

classmethod guess_style(cls, nparam)[source]
classmethod parse_lammps(cls, line, style)[source]
write_lammps(self, style='harmonic', cross_term=None)[source]

pysimm.system.AngleType.write_lammps

Formats a string to define angle type coefficients for a LAMMPS data file given the provided style.

Parameters
  • style – string for pair style of AngleType (harmonic, class2, charmm)

  • cross_term – type of class2 cross term to write (default=None) - BondBond - BondAngle

Returns

LAMMPS formatted string with angle coefficients

form(self, style='harmonic', d_range=None)[source]

pysimm.system.AngleType.form

Returns data to plot functional form for the potential energy with the given style.

Parameters

style – string for pair style of AngleType (harmonic, class2, charmm)

Returns

x, y for plotting functional form (energy vs angle)

class pysimm.system.Dihedral(**kwargs)[source]

Bases: pysimm.utils.Item

pysimm.system.Dihedral

Dihedral between particles a, b, c, and d

a–b–c–d

Objects inheriting from Item can contain arbitrary data. Keyword arguments are assigned as attributes. Attributes usually used are given below.

a

Particle object involved in dihedral

b

Particle object involved in dihedral (middle particle)

c

Particle object involved in dihedral (middle particle)

d

Particle object involved in dihedral

type

DihedralType object reference

class pysimm.system.DihedralType(**kwargs)[source]

Bases: pysimm.utils.Item

pysimm.system.DihedralType

Objects inheriting from Item can contain arbitrary data. Keyword arguments are assigned as attributes. Attributes usually used are given below.

k

dihedral energy barrier (kcal/mol)

d

minimum (+1 or -1)

n

multiplicity (integer >= 0)

name

force field dihedral type name

classmethod guess_style(cls, nparam)[source]
classmethod parse_lammps(cls, line, style)[source]
write_lammps(self, style='harmonic', cross_term=None)[source]

pysimm.system.DihedralType.write_lammps

Formats a string to define dihedral type coefficients for a LAMMPS data file given the provided style.

Parameters
  • style – string for pair style of DihedralType (harmonic, class2, fourier)

  • cross_term – type of class2 cross term to write (default=None) - MiddleBond - EndBond - Angle - AngleAngle - BondBond13

Returns

LAMMPS formatted string with dihedral coefficients

form(self, style='harmonic', d_range=None)[source]

pysimm.system.DihedralType.form

Returns data to plot functional form for the potential energy with the given style.

Parameters

style – string for pair style of DihedralType (harmonic, class2, fourier)

Returns

x, y for plotting functional form (energy vs angle)

class pysimm.system.Improper(**kwargs)[source]

Bases: pysimm.utils.Item

pysimm.system.Improper

Improper dihedral around particle a, bonded to b, c, and d

b
a–d
c

Objects inheriting from Item can contain arbitrary data. Keyword arguments are assigned as attributes. Attributes usually used are given below.

a

Particle object involved in improper (middle particle)

b

Particle object involved in improper

c

Particle object involved in improper

d

Particle object involved in improper

type

ImproperType object reference

class pysimm.system.ImproperType(**kwargs)[source]

Bases: pysimm.utils.Item

pysimm.system.ImproperType

Objects inheriting from Item can contain arbitrary data. Keyword arguments are assigned as attributes. Attributes usually used are given below.

k

improper energy barrier (kcal/mol)

x0

equilibrium value (degrees)

name

force field improper type name

classmethod guess_style(cls, nparam)[source]
classmethod parse_lammps(cls, line, style)[source]
write_lammps(self, style='harmonic', cross_term=None)[source]

pysimm.system.ImproperType.write_lammps

Formats a string to define improper type coefficients for a LAMMPS data file given the provided style.

Parameters
  • style – string for pair style of ImproperType (harmonic, class2, cvff)

  • cross_term – type of class2 cross term to write (default=None) - AngleAngle

Returns

LAMMPS formatted string with dihedral coefficients

form(self, style='harmonic', d_range=None)[source]

pysimm.system.ImproperType.form

Returns data to plot functional form for the potential energy with the given style.

Parameters

style – string for pair style of ImproperType (harmonic, cvff)

Returns

x, y for plotting functional form (energy vs angle)

class pysimm.system.Dimension(**kwargs)[source]

Bases: pysimm.utils.Item

pysimm.system.Dimension

Objects inheriting from Item can contain arbitrary data. Keyword arguments are assigned as attributes. Attributes usually used are given below.

xlo

minimum value in x dimension

xhi

maximum value in x dimension

ylo

minimum value in y dimension

yhi

maximum value in y dimension

zlo

minimum value in z dimension

zhi

maximum value in z dimension

dx[source]

distance in x dimension

dy[source]

distance in y dimension

dz[source]

distance in z dimension

check(self)[source]
size(self)[source]
translate(self, x, y, z)[source]

pysimm.system.Dimension.translate

Shifts box bounds by x, y, z.

Parameters
  • x – distance to shift box bounds in x direction

  • y – distance to shift box bounds in y direction

  • z – distance to shift box bounds in z direction

Returns

None

property dx(self)[source]
property dy(self)[source]
property dz(self)[source]
class pysimm.system.System(**kwargs)[source]

Bases: object

pysimm.system.System

Object representation of molecular system. Contains information required for molecular simulation.

dim

Dimension object reference

particles

ItemContainer for Particle organization

particle_types

ItemContainer for ParticleType organization

bonds

ItemContainer for Bond organization

bond_types

ItemContainer for BondType organization

angles

ItemContainer for Angle organization

angle_types

ItemContainer for AngleType organization

dihedrals

ItemContainer for Dihedral organization

dihedral_types

ItemContainer for DihedralType organization

impropers

ItemContainer for Improper organization

improper_types

ItemContainer for ImproperType organization

molecules

ItemContainer for Molecule organization

__getattr__(self, name)[source]
copy(self, rotate_x=None, rotate_y=None, rotate_z=None, dx=0, dy=0, dz=0)[source]

pysimm.system.System.copy

Create duplicate System object. Default behavior does not modify particle positions.

Parameters
  • rotate_x – rotate duplicate system around x axis by this value (radians)

  • rotate_y – rotate duplicate system around y axis by this value (radians)

  • rotate_z – rotate duplicate system around z axis by this value (radians)

  • dx – translate duplicate system in x dimension by this value (Angstrom)

  • dy – translate duplicate system in y dimension by this value (Angstrom)

  • dz – translate duplicate system in z dimension by this value (Angstrom)

add(self, other, **kwargs)[source]

pysimm.system.System.add

Add other System to this. Optionally remove duplicate types (default behavior).

Parameters
  • otherSystem object to add

  • unique_types (optional) – Remove duplicate types and reassign references to existing types (True)

  • change_dim (optional) – Update Dimension object so that Particle objects do not exist outside of Dimension extremes (True)

  • update_properties (optional) – Update system-wide mass, volume, density, center of gravity, and velocity properties (True)

distance(self, p1, p2)[source]

pysimm.system.System.distance

Calculate distance between two particles considering pbc.

Parameters
Returns

distance between particles considering pbc

wrap(self)[source]

pysimm.system.System.wrap

Wrap Particle images into box defined by Dimension object. Ensure particles are contained within simulation box.

Parameters

None

Returns

None

unwrap(self)[source]

pysimm.system.System.unwrap()

Unwraps Particle images such that no bonds cross box edges.

Parameters

None

Returns

None

particles_df(self, columns=['tag', 'x', 'y', 'z', 'q'], index='tag', extras=[])[source]
unite_atoms(self)[source]
quality(self, tolerance=0.1)[source]

pysimm.system.System.quality

Attemps to assess quality of System based on bond lengths in unwrapped system.

Parameters

tolerance – fractional value of equilibrium bond length that is acceptable

Returns

number of bonds in system outside tolerance

shift_to_origin(self)[source]

pysimm.system.System.shift_to_origin

Shifts simulation box to begin at origin. i.e. xlo=ylo=zlo=0

Parameters

None

Returns

None

set_charge(self)[source]

pysimm.system.System.set_charge

Sets total charge of all Particle objects in System.particles

Parameters

None

Returns

None

zero_charge(self)[source]

pysimm.system.System.zero_charge

Enforces total System charge to be 0.0 by subtracting excess charge from last particle

Parameters

None

Returns

None

check_items(self)[source]

pysimm.system.System.check_items

Checks particles, bonds, angles, dihedrals, impropers, and molecules containers and raises exception if the length of items in the container does not equal the count property

Parameters

None

Returns

None

update_ff_types_from_ac(self, ff, acname)[source]

pysimm.system.System.update_ff_types_from_ac

Updates ParticleType objects in system using type names given in antechamber (ac) file. Retrieves type from System if possible, then searches force field provided by ff.

Parameters
  • ff – forcefield to search for Type objects

  • acname – ac filename containing type names

Returns

None

update_particle_types_from_forcefield(self, f)[source]

pysimm.system.System.update_types_from_forcefield

Updates ParticleType data from Forcefield object f based on ParticleType.name

Parameters

fForcefield object reference

Returns

None

make_linker_types(self)[source]

pysimm.system.System.make_linker_types

Identifies linker particles and creates duplicate Particle.linker attribute. New ParticleType name is prepended with [H or T]L@ to designate head or tail linker

Parameters

None

Returns

None

remove_linker_types(self)[source]

pysimm.system.System.remove_linker_types

Reassigns Particle.type references to original ParticleType objects without linker prepend

Parameters

None

Returns

None

read_lammps_dump(self, fname)[source]

pysimm.system.System.read_lammps_dump

Updates particle positions and box size from LAMMPS dump file. Assumes following format for each atom line:

tag charge xcoord ycoord zcoord xvelocity yvelocity zvelocity

Parameters

fname – LAMMPS dump file

Returns

None

read_lammpstrj(self, trj, frame=1)[source]

pysimm.system.System.read_lammpstrj

Updates particle positions and box size from LAMMPS trajectory file at given frame.

Assumes one of following formats for each atom line:

tag xcoord ycoord zcoord

OR

tag type_id xcoord ycoord zcoord

OR

tag type_id xcoord ycoord zcoord ximage yimage zimage

Parameters
  • trj – LAMMPS trajectory file

  • frame – sequential frame number (not LAMMPS timestep) default=1

Returns

None

read_xyz(self, xyz, frame=1, quiet=False)[source]

pysimm.system.System.read_xyz

Updates particle positions and box size from xyz file at given frame

Parameters
  • xyz – xyz trajectory file

  • frame – sequential frame number default=1

  • quiet – True to print status default=False

Returns

None

update_types(self, ptypes, btypes, atypes, dtypes, itypes)[source]

pysimm.system.System.update_types

Updates type objects from a given list of types.

Parameters
  • ptypes – list of ParticleType objects from which to update

  • btypes – list of BondType objects from which to update

  • atypes – list of AngleType objects from which to update

  • dtypes – list of DihedralType objects from which to update

  • itypes – list of ImproperType objects from which to update

read_type_names(self, types_file)[source]

pysimm.system.System.read_type_names

Update ParticleType names from file.

Parameters

types_file – type dictionary file name

Returns

None

remove_spare_bonding(self, update_tags=True)[source]

pysimm.system.System.remove_spare_bonding

Removes bonds, angles, dihedrals and impropers that reference particles not in System.particles

Parameters

update_tags – True to update all tags after removal of bonding items default=True

update_tags(self)[source]

pysimm.system.System.update_tags

Update Item tags in ItemContainer objects to preserve continuous tags. Removes all objects and then reinserts them.

Args:

None

Returns:

None

set_references(self)[source]

pysimm.system.System.set_references

Set object references when System information read from text file. For example, if bond type value 2 is read from file, set Bond.type to bond_types[2]

Parameters

None

Returns

None

objectify(self)[source]

pysimm.system.System.objectify

Set references for Bond, Angle, Dihedral, Improper objects. For example, if read from file that bond #1 is between particle 1 and 2 set Bond.a to particles[1], etc.

Parameters

None

Returns

None

add_particle_bonding(self)[source]

pysimm.system.System.add_particle_bonding

Update Particle objects such that Particle.bonded_to contains other Particle objects invloved in bonding

Parameters

None

Returns

None

set_excluded_particles(self, bonds=True, angles=True, dihedrals=True)[source]

pysimm.system.System.set_excluded_particles

Updates Particle object such that Particle.excluded_particles contains other Particle objects involved in 1-2, 1-3, and/or 1-4 interactions

Parameters
  • bonds – exclude particles involved in 1-2 interactions

  • angles – exclude particles involved in 1-3 interactions

  • dihedrals – exclude particles involved in 1-4 interactions

set_atomic_numbers(self)[source]

pysimm.system.System.set_atomic_numbers

Updates ParticleType objects with atomic number based on ParticleType.elem

Parameters

None

Returns

None

add_particle_bonded_to(self, p, p0, f=None, sep=1.5)[source]

pysimm.system.System.add_particle_bonded_to

Add new Particle to System bonded to p0 and automatically update new forcefield types

Parameters
  • p – new Particle object to be added

  • p0 – original Particle object in System to which p will be bonded

  • fForcefield object from which new force field types will be retrieved

Returns

new Particle being added to system for convenient reference

add_particle(self, p)[source]

pysimm.system.System.add_particle

Add new Particle to System.

Parameters

p – new Particle object to be added

Returns

None

rotate(self, around=None, theta_x=0, theta_y=0, theta_z=0, rot_matrix=None)[source]

pysimm.system.System.rotate

* REQUIRES NUMPY *

Rotates entire system around given Particle by user defined angles

Parameters
  • aroundParticle around which System will be rotated default=None

  • theta_x – angle around which system will be rotated on x axis

  • theta_y – angle around which system will be rotated on y axis

  • theta_z – angle around which system will be rotated on z axis

  • rot_matrix – rotation matrix to use for rotation

Returns

None

make_new_bonds(self, p1=None, p2=None, f=None, angles=True, dihedrals=True, impropers=True)[source]

pysimm.system.System.make_new_bonds

Makes new bond between two particles and updates new force field types

Parameters
  • p1Particle object involved in new bond

  • p2Particle object involved in new bond

  • fForcefield object from which new force field types will be retrieved

  • angles – True to update new angles default=True

  • dihedrals – True to update new dihedrals default=True

  • impropers – True to update new impropers default=True

Returns

None

add_bond(self, a=None, b=None, f=None)[source]

pysimm.system.System.add_bond

Add Bond to system between two particles

Parameters
Returns

None

add_angle(self, a=None, b=None, c=None, f=None)[source]

pysimm.system.System.add_angle

Add Angle to system between three particles

Parameters
Returns

None

add_dihedral(self, a=None, b=None, c=None, d=None, f=None)[source]

pysimm.system.System.add_dihedral

Add Dihedral to system between four particles

Parameters
Returns

None

add_improper(self, a=None, b=None, c=None, d=None, f=None)[source]

pysimm.system.System.add_improper

Add Improper to system between four particles

Parameters
  • aParticle involved in new Improper (middle particle)

  • bParticle involved in new Improper

  • cParticle involved in new Improper

  • dParticle involved in new Improper

  • fForcefield object from which new force field type will be retrieved

Returns

None

check_forcefield(self)[source]

pysimm.system.System.check_forcefield

Iterates through particles and prints the following:

tag type name type element type description bonded elements

Parameters

None

Returns

None

apply_forcefield(self, f, charges='default', set_box=True, box_padding=10, update_ptypes=False, skip_ptypes=False)[source]

pysimm.system.System.apply_forcefield

Applies force field data to System based on typing rules defined in Forcefield object f

Parameters
  • fForcefield object from which new force field type will be retrieved

  • charges – type of charges to be applied default=’default’

  • set_box – Update simulation box information based on particle positions default=True

  • box_padding – Add padding to simulation box if updating dimensions default=10 (Angstroms)

  • update_ptypes – If True, update particle types based on current ParticleType names default=False

  • skip_ptypes – if True, do not change particle types

Returns

None

apply_charges(self, f, charges='default')[source]

pysimm.system.System.apply_charges

Applies charges derived using method provided by user. Defaults to ‘default’. Calls assign_charges() method of forcefield object provided.

Parameters
  • fForcefield object

  • charges – type of charges to be applied default=’default’

Returns

None

write_lammps_mol(self, out_data)[source]

pysimm.system.System.write_lammps_mol

Write System data formatted as LAMMPS molecule template

Parameters

out_data – where to write data, file name or ‘string’

Returns

None or string if data file if out_data=’string’

write_lammps(self, out_data, **kwargs)[source]

pysimm.system.System.write_lammps

Write System data formatted for LAMMPS

Parameters

out_data – where to write data, file name or ‘string’

Returns

None or string if data file if out_data=’string’

write_xyz(self, outfile='data.xyz', **kwargs)[source]

pysimm.system.System.write_xyz

Write System data in xyz format

Parameters

outfile – where to write data, file name or ‘string’

Returns

None or string of data file if out_data=’string’

write_chemdoodle_json(self, outfile, **kwargs)[source]

pysimm.system.System.write_chemdoodle_json

Write System data in chemdoodle json format

Parameters

outfile – where to write data, file name or ‘string’

Returns

None or string of data file if out_data=’string’

write_mol(self, outfile='data.mol')[source]

pysimm.system.System.write_mol

Write System data in mol format

Parameters

outfile – where to write data, file name or ‘string’

Returns

None or string of data file if out_data=’string’

write_pdb(self, outfile='data.pdb', type_names=True)[source]

pysimm.system.System.write_pdb

Write System data in pdb format

Parameters

outfile – where to write data, file name or ‘string’

Returns

None or string of data file if out_data=’string’

write_yaml(self, file_)[source]

pysimm.system.System.write_yaml

Write System data in yaml format

Parameters

outfile – file name to write data

Returns

None

write_cssr(self, outfile='data.cssr', **kwargs)[source]

pysimm.system.System.write_cssr

Write System data in cssr format file format: line, format, contents 1: 38X, 3F8.3 : - length of the three cell parameters (a, b, and c) in angstroms. 2: 21X, 3F8.3, 4X, ‘SPGR =’, I3, 1X, A11 : - a, b, g in degrees, space group number, space group name. 3: 2I4, 1X, A60 : - Number of atoms stored, coordinate system flag (0=fractional, 1=orthogonal coordinates in Angstrom), first title. 4: A53 : - A line of text that can be used to describe the file. 5-: I4, 1X, A4, 2X, 3(F9.5.1X), 8I4, 1X, F7.3 : - Atom serial number, atom name, x, y, z coordinates, bonding connectivities (max 8), charge. Note: The atom name is a concatenation of the element symbol and the atom serial number.

Parameters
  • outfile – where to write data, file name or ‘string’

  • frac – 0 for using fractional coordinates

  • aname – 0 for using element as atom name; else using atom type name

Returns

None or string of data file if out_data=’string’

consolidate_types(self)[source]

pysimm.system.System.consolidate_types

Removes duplicate types and reassigns references

Parameters

None

Returns

None

set_cog(self)[source]

pysimm.system.System.set_cog

Calculate center of gravity of System and assign to System.cog

Parameters

None

Returns

None

shift_particles(self, shiftx, shifty, shiftz)[source]

pysimm.system.System.shift_particles

Shifts all particles by shiftx, shifty, shiftz. Recalculates cog.

Parameters
  • shiftx – distance to shift particles in x direction

  • shifty – distance to shift particles in y direction

  • shiftz – distance to shift particles in z direction

Returns

None

center(self, what='particles', at=[0, 0, 0], move_both=True)[source]

pysimm.system.System.center

Centers particles center of geometry or simulation box at given coordinate. A vector is defined based on the current coordinate for the center of either the particles or the simulation box and the “at” parameter. This shift vector is applied to the entity defined by the “what” parameter. Optionally, both the particles and the box can be shifted by the same vector.

Parameters
  • what – what is being centered: “particles” or “box”

  • at – new coordinate for center of particles or box

  • move_both – if True, determines vector for shift defined by “what” and “at” parameters, and applies shift to both particles and box. If false, only shift what is defined by “what” parameter.

Returns

None

center_system(self)[source]

pysimm.system.System.center_system

DEPRECATED: Use System.center(‘box’, [0, 0, 0], True) instead

Parameters

None

Returns

None

center_at_origin(self)[source]

pysimm.system.System.center_at_origin

DEPRECATED: Use System.center(‘particles’, [0, 0, 0], True) instead

Parameters

None

Returns

None

set_mass(self)[source]

pysimm.system.System.set_mass

Set total mass of particles in System

Parameters

None

Returns

None

set_volume(self)[source]

pysimm.system.System.set_volume

Set volume of System based on Dimension

Parameters

None

Returns

None

set_density(self)[source]

pysimm.system.System.set_density

Calculate density of System from mass and volume

Parameters

None

Returns

None

set_velocity(self)[source]

pysimm.system.System.set_velocity

Calculate total velocity of particles in System

Parameters

None

Returns

None

zero_velocity(self)[source]

pysimm.system.System.zero_velocity

Enforce zero shift velocity in System

Parameters

None

Returns

None

set_box(self, padding=0.0, center=True)[source]

pysimm.system.System.set_box

Update System.dim with user defined padding. Used to construct a simulation box if it doesn’t exist, or adjust the size of the simulation box following system modifications.

Parameters
  • padding – add padding to all sides of box (Angstrom)

  • center – if True, place center of box at origin default=True

Returns

None

set_mm_dist(self, molecules=None)[source]

pysimm.system.System.set_mm_dist

Calculate molecular mass distribution (mainly for polymer systems). Sets System.mw, System.mn, and System.disperisty

Parameters

moleculesItemContainer of molecules to calculate distributions defaul=’all’

Returns

None

set_frac_free_volume(self, v_void=None)[source]

pysimm.system.System.set_frac_free_volume

Calculates fractional free volume from void volume and bulk density

Parameters

v_void – void volume if not defined in System.void_volume default=None

Returns

None

visualize(self, vis_exec='vmd', **kwargs)[source]

pysimm.system.System.visualize

Visualize system in third party software with given executable. Software must accept pdb or xyz as first command line argument.

Parameters
  • vis_exec – executable to launch visualization software default=’vmd’

  • unwrap (optional) – if True, unwrap System first default=None

  • format (optional) – set format default=’xyz’

Returns

None

viz(self, **kwargs)[source]
class pysimm.system.Molecule(**kwargs)[source]

Bases: System

pysimm.system.Molecule

Very similar to System, but requires less information

pysimm.system.read_yaml(file_, **kwargs)[source]

pysimm.system.read_yaml

Interprets yaml file and creates System object

Parameters

file – yaml file name

Returns

System object

pysimm.system.read_xyz(file_, **kwargs)[source]

pysimm.system.read_xyz

Interprets xyz file and creates System object

Parameters
  • file – xyz file name

  • quiet (optional) – if False, print status

Returns

System object

pysimm.system.read_chemdoodle_json(file_, **kwargs)[source]

pysimm.system.read_chemdoodle_json

Interprets ChemDoodle JSON (Java Script Object Notation) file and creates System object

Parameters
  • file – json file name

  • quiet (optional) – if False, print status

Returns

System object

pysimm.system.read_lammps(data_file, **kwargs)[source]

pysimm.system.read_lammps

Interprets LAMMPS data file and creates System object

Parameters
  • data_file – LAMMPS data file name

  • quiet (optional) – if False, print status

  • atom_style (optional) – option to let user override (understands charge, molecular, full)

  • pair_style (optional) – option to let user override

  • bond_style (optional) – option to let user override

  • angle_style (optional) – option to let user override

  • dihedral_style (optional) – option to let user override

  • improper_style (optional) – option to let user override

  • set_types (optional) – if True, objectify default=True

  • name (optional) – provide name for system

Returns

System object

pysimm.system.read_pubchem_smiles(smiles, quiet=False, type_with=None)[source]

pysimm.system.read_pubchem_smiles

Interface with pubchem restful API to create molecular system from SMILES format

Parameters
  • smiles – smiles formatted string of molecule

  • type_withForcefield object to type with default=None

Returns

System object

pysimm.system.read_pubchem_cid(cid, type_with=None)[source]

pysimm.system.read_pubchem_smiles

Interface with pubchem restful API to create molecular system from SMILES format

Parameters
  • smiles – smiles formatted string of molecule

  • type_withForcefield object to type with default=None

Returns

System object

pysimm.system.read_cml(cml_file, **kwargs)[source]

pysimm.system.read_cml

Interprets cml file and creates System object

Parameters
  • cml_file – cml file name

  • linkers (optional) – if True, use spinMultiplicity to determine linker default=None

Returns

System object

pysimm.system.read_mol(mol_file, type_with=None, version='V2000')[source]

pysimm.system.read_mol

Interprets mol file and creates System object

Parameters
  • mol_file – mol file name

  • f (optional) – Forcefield object to get data from

  • version – version of mol file to expect default=’V2000’

Returns

System object

pysimm.system.read_mol2(mol2_file, type_with=None)[source]

pysimm.system.read_mol2

Interprets .mol2 file and creates System object

Parameters
  • mol_file2 – a full name (including path) of a Tripos Mol2 text file

  • type_with (optional) – Forcefield object to use for attempt to assighn

  • system (forcefield parameters to the) –

Returns

System object

pysimm.system.read_prepc(prec_file)[source]

pysimm.system.read_prepc

Interprets prepc file and creates System object

Parameters

prepc_file – ac file name

Returns

System object

pysimm.system.read_ac(ac_file)[source]

pysimm.system.read_ac

Interprets ac file and creates System object

Parameters

ac_file – ac file name

Returns

System object

pysimm.system.read_pdb(pdb_file, str_file=None, **kwargs)[source]

pysimm.system.read_pdb

Interprets pdb file and creates System object

Parameters

pdb_file – pdb file name

Keyword Arguments
  • str_file – (str) optional CHARMM topology (stream) file which can be used as source of charges and description

  • topology (of bonded) –

  • use_ptypes – (bool) flag to either use the forcefield atom type names from the .str file or not

Returns

System object

pysimm.system.compare(s1, s2)[source]
pysimm.system.get_types(*arg, **kwargs)[source]

pysimm.system.get_types

Get unique type names from list of systems

Parameters

write (optional) – if True, write types dictionary to filename

Returns

(ptypes, btypes, atypes, dtypes, itypes) * for use with update_types *

pysimm.system.distance_to_origin(p)[source]

pysimm.system.distance_to_origin

Calculates distance of particle to origin.

Parameters

p – Particle object with x, y, and z attributes

Returns

Distance of particle to origin

pysimm.system.replicate(ref, nrep, s_=None, density=0.3, rand=True, print_insertions=True)[source]

pysimm.system.replicate

Replicates list of System objects into new (or exisintg) System. Can be random insertion.

Parameters
  • ref – reference :class:`~pysimm.system.System`(s) (this can be a list)

  • nrep – number of insertions to perform (can be list but must match length of ref)

  • sSystem into which insertions will be performed default=None

  • density – density of new System default=0.3 (set to None to not change box)

  • rand – if True, random insertion is performed

  • print_insertions – if True, update screen with number of insertions