ipymd package¶
Subpackages¶
- ipymd.atom_analysis package
- ipymd.data_input package
- ipymd.plotting package
- ipymd.shared package
- ipymd.test_data package
- ipymd.visualise package
- Subpackages
- ipymd.visualise.opengl package
- Subpackages
- ipymd.visualise.opengl.postprocessing package
- ipymd.visualise.opengl.renderers package
- Subpackages
- Submodules
- ipymd.visualise.opengl.renderers.atom module
- ipymd.visualise.opengl.renderers.base module
- ipymd.visualise.opengl.renderers.box module
- ipymd.visualise.opengl.renderers.hexagon module
- ipymd.visualise.opengl.renderers.line module
- ipymd.visualise.opengl.renderers.point module
- ipymd.visualise.opengl.renderers.sphere module
- ipymd.visualise.opengl.renderers.sphere_imp module
- ipymd.visualise.opengl.renderers.triangle module
- ipymd.visualise.opengl.renderers.triangles module
- Module contents
- Submodules
- ipymd.visualise.opengl.buffers module
- ipymd.visualise.opengl.camera module
- ipymd.visualise.opengl.qchemlabwidget module
- ipymd.visualise.opengl.qtviewer module
- ipymd.visualise.opengl.shaders module
- ipymd.visualise.opengl.textures module
- Module contents
- Subpackages
- ipymd.visualise.opengl package
- Submodules
- ipymd.visualise.visualise_sim module
- Module contents
- Subpackages
Submodules¶
ipymd.atom_manipulation module¶
Created on Mon May 16 08:15:13 2016
@author: cjs14
-
class
ipymd.atom_manipulation.
Atom_Manipulation
(atom_df, meta_series=None, undos=1)[source]¶ Bases:
object
a class to manipulate atom data
- atom_df : pandas.DataFrame
- containing columns; x, y, z, type
- meta_series : pandas.Series
- containing columns; origin, a, b, c to define unit cell if none it will be constructed from the min/max x, y, z values
- undos : int
- number of past dataframes to save
-
apply_map
(vmap, column, default=False, type_col='type')[source]¶ change values in a column, according to a mapping of another column
- vmap : dict or str
- A dictionary mapping values, or a string associated with a column in the ipymd.shared.atom_data() dataframe (e.g. color and RVdW)
- column : str
- the column to change
- default : various
- the default value to put when the type key cannot be found, if False then the original value will not be overwritten
-
change_type_variable
(atom_type, variable, value, type_col='type')[source]¶ change particular variable for one atom type
-
change_variables
(map_dict, vtype='type')[source]¶ change particular variables according to the map_dict
-
color_by_categories
(colname, cmap='jet', sort=True)[source]¶ change colors to map
- colname : string
- a column of the dataframe that contains categories by which to color
- cmap : string
- the colormap to apply, see available at http://matplotlib.org/examples/color/colormaps_reference.html
-
color_by_index
(cmap='jet', minv=None, maxv=None)[source]¶ change colors to map index values
- cmap : string
- the colormap to apply, see available at http://matplotlib.org/examples/color/colormaps_reference.html
- minv, maxv : float
- optional min, max cmap value, otherwise take min, max value found in column
-
color_by_variable
(colname, cmap='jet', minv=None, maxv=None)[source]¶ change colors to map
- colname : string
- a coloumn of the dataframe that contains numbers by which to color
- cmap : string
- the colormap to apply, see available at http://matplotlib.org/examples/color/colormaps_reference.html
- minv, maxv : float
- optional min, max cmap value, otherwise take min, max value found in column
-
df
¶
-
filter_inside_box
(vectors, origin=<Mock object>)[source]¶ return only atoms inside box
- vectors : np.array((3,3))
- a, b, c vectors
origin : np.array((1,3))
-
filter_inside_hexagon
(vectors, origin=<Mock object>)[source]¶ return only atoms inside hexagonal prism
- vectors : np.array((2,3))
- a, c vectors
origin : np.array((1,3))
-
filter_inside_pts
(points)[source]¶ return only atoms inside the bounding shape of a set of points
points : np.array((N,3))
-
group_atoms_as_mols
(atom_ids, name, remove_atoms=True, mean_xyz=True, color='red', transparency=1.0, radius=1.0)[source]¶ combine atoms into a molecule atom_ids : list of lists
list of dataframe indexes for each molecule- name : string
- name of molecule
- remove_atoms : bool
- remove the grouped atoms from the dataframe
- mean_xyz : bool
- use the mean coordinate of atoms for molecule, otherwise use coordinate of first atom
-
meta
¶
-
repeat_cell
(a=1, b=1, c=1, original_first=False)[source]¶ repeat atoms along a, b, c directions (and update unit cell)
- a : int or tuple
- repeats in ‘a’ direction, if tuple then defines repeats in -/+ direction
- b : int or tuple
- repeats in ‘b’ direction, if tuple then defines repeats in -/+ direction
- c : int or tuple
- repeats in ‘c’ direction, if tuple then defines repeats in -/+ direction
- original_first: bool
- if True, the original atoms will be first in the DataFrame
-
rotate
(angle, vector=[1, 0, 0], update_uc=True)[source]¶ rotate the clockwise about the given axis vector by theta degrees.
e.g. for rotate_atoms(90,[0,0,1]); [0,1,0] -> [1,0,0]
- angle : float
- rotation angle in degrees
- vector : iterable
- vector to rotate around [x0,y0,z0]
- update_uc : bool
- update unit cell (a,b,c,origin) to match rotation
-
slice_absolute
(amin=0, amax=None, bmin=0, bmax=None, cmin=0, cmax=None, incl_max=False, update_uc=True, delta=0.01)[source]¶ slice along a,b,c directions (from origin) given absolute vector length
if amax, bmax or cmax is None, then will use the vector length
- update_uc : bool
- update unit cell (a,b,c,origin) to match slice
- incl_max : bool
- whether to slice < (False) <= (True) max values
- delta : float
- retain atoms within ‘delta’ fraction outside of slice plane)
-
slice_fraction
(amin=0, amax=1, bmin=0, bmax=1, cmin=0, cmax=1, incl_max=False, update_uc=True, delta=0.01)[source]¶ slice along a,b,c directions (from origin) as fraction of vector length
- incl_max : bool
- whether to slice < (False) <= (True) max values
- update_uc : bool
- update unit cell (a,b,c,origin) to match slice
- delta : float
- retain atoms within ‘delta’ fraction outside of slice plane)
ipymd.data_output module¶
Created on Mon May 23 17:55:14 2016
@author: cjs14
-
class
ipymd.data_output.
Data_Output
(atom_df, abc, origin=<Mock object>)[source]¶ Bases:
object
-
save_lammps
(outpath='out.lammps', overwrite=False, atom_type='atomic', header='', mass_map={})[source]¶ to adhere to http://lammps.sandia.gov/doc/read_data.html?highlight=read_data
Parameters: Example
In [1]: import pandas as pd In [2]: df = pd.DataFrame([[‘Fe’,2,3,4,1],
[‘Cr’,2,3,3,-1], [‘Fe’,4,3,1,1]],columns=[‘type’,’xs’,’ys’,’zs’,’q’])In [3]: from ipymd.data_output import Data_Output as data_out In [4]: data = data_out(df, [[1,0,0],[0,1,0],[0,0,1]]) In [5]: data.save_lammps(‘test.lammps’, atom_type=’charge’, overwrite=True,
header=’my header’)In [6]: cat test.lammps # This file was created by ipymd (v0.0.1) on 2016-05-23 20:51:16 # type map: {‘Cr’: 2, ‘Fe’: 1} # my header
3 atoms 2 atom types
# simulation box boundaries 0.0000 1.0000 xlo xhi 0.0000 1.0000 ylo yhi 0.0000 1.0000 zlo zhi 0.0000 0.0000 0.0000 xy xz yz
Atoms
1 1 1.0000 2.0000 3.0000 4.0000 2 2 -1.0000 2.0000 3.0000 3.0000 3 1 1.0000 4.0000 3.0000 1.0000
-