M11 MD++ Powered by Python: Difference between revisions

From Micro and Nano Mechanics Group
Jump to navigation Jump to search
(Created page with "MD++ with Python scripting language (Python) example scripts <UL> <LI> si.py <LI> si2.py <LI> si-arg.py <LI> si-temp.py </UL>")
 
mNo edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
MD++ with Python scripting language ([[M11_MD++_v3.pdf |Python]])
MD++ with Python scripting language ([http://micro.stanford.edu/~caiwei/Forum/2004-12-12-MD++/PDF_Manuals/M11_MD++_v3.pdf Python])

commands

<pre>
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
'''
</pre>
<pre>
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
'''
</pre>
<pre>
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
'''
</pre>
<pre>
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
'''
</pre>


example scripts
example scripts


<UL>
<UL>
<LI> [http://micro.stanford.edu/~caiwei/Forum/2004-12-12-MD++/Python/si.py si.py]
<LI> [[si.py]]
<LI> [http://micro.stanford.edu/~caiwei/Forum/2004-12-12-MD++/Python/si2.py si2.py]
<LI> [[si2.py]]
<LI> [http://micro.stanford.edu/~caiwei/Forum/2004-12-12-MD++/Python/si-arg.py si-arg.py]
<LI> [[si-arg.py]]
<LI> [[si-temp.py]]
<LI> [http://micro.stanford.edu/~caiwei/Forum/2004-12-12-MD++/Python/si-temp.py si-temp.py]
</UL>
</UL>

Latest revision as of 03:37, 12 October 2019

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