Micro and Nano Mechanics Group

MD++ with Python scripting language (Python)

commands

mdpp.cmd(command_string)
'''Execute one command or multiple commands in MD++
Parameters
----------
command_string : string
    a string that follows MD++ script command format
Returns
-------
exit_code : int
    0 if success
'''
mdpp.get(varname)
'''Obtain the value of a variable in MD++ object
Parameters
----------
varname : string
    variable name to obtain from the MD++ object
Returns
-------
value : int, long, double, or string
    depends on the type of the variable
'''
mdpp.get_array(array_name, istart, iend, iskip=0)
'''Obtain an array from MD++ object to a python list
Parameters
----------
array_name : string
    array name to obtain from the MD++ object
istart,iend,iskip : int
    the starting position, end position, and number of elements to skip
Returns
-------
array : list
    flattened list of requested array in MD++ object
'''
mdpp.set_array(input_list, array_name, istart, iskip=0)
'''Obtain an array from MD++ object to a python list
Parameters
----------
input_list : list
    1D python list of flattened array values to be inserted.
array_name : string
    array name to set in the MD++ object
istart,iskip : int
    the starting position, and number of elements to skip
Returns
-------
exit_code : int
    0 if success
'''

example scripts