SMArt package

Submodules

SMArt.geometry module

SMArt.geometry.add_ring_path_3D(path2add, coord_df, anchor_point, temp_v, new_ap, v_fact, **kwargs)[source]
SMArt.geometry.add_ring_path_simple(path2add, coord_df, anchor_point, temp_v, new_ap, v_fact, **kwargs)[source]
SMArt.geometry.generate_new_coordinates(path2add, anchor_points, coord_df, v_fact=0.2, **kwargs)[source]
SMArt.geometry.rot(v, theta=90, axis=None)[source]
SMArt.geometry.rot_2D(v, theta=90)[source]

SMArt.incl module

class SMArt.incl.DataDumping[source]

Bases: object

class providing pickle of yaml dump functionality

dump(f_path, dump_format='pickle', **kwargs)[source]

dumps data in a file :param f_path: :param dump_format: (‘pickle’, ‘yaml’) :param kwargs:

mode: same as file open mode prep4dump - additional function to call before dumping post_dump_load - additional function to call after dumping (usually opposite from prep4dump) other kwargs from SMArt.incl.FileHandler

Returns

classmethod load(f_path, load_format='pickle', **kwargs)[source]

loads data from a file :param f_path: :param load_format: (‘pickle’, ‘yaml’) :param kwargs:

mode: same as file open mode post_dump_load - additional function to call after loading other kwargs from SMArt.incl.FileHandler

Returns

data

class SMArt.incl.Defaults[source]

Bases: SMArt.incl.__VersionCompatibility

takes care of default values:
  1. normal defaults (instance based), where each instance is independent

  2. class defaults where each instance inherit from the class, so change affects all instances

get_current_dvalues()[source]

get current values of default variables (normal, instance-based)

classmethod get_defaults(*vars)[source]

get normal (instance-based) defaults - list all options

reset_dvalues(temp_dvalues)[source]

reset values of default variables from some state obtained using get_current_dvalues function

set_defaults(*vars, **kwargs)[source]

set normal (instance-based) defaults

class SMArt.incl.FileHandler(f_path, write=False, bck_num=False, pre=False, suf=False, flag_bck=True, **kwargs)[source]

Bases: SMArt.incl.Defaults

get_f()[source]

returns the file

class SMArt.incl.FileStream(f_path, write=False, bck_num=False, pre=False, suf=False, flag_bck=True, **kwargs)[source]

Bases: SMArt.incl.FileHandler

lines()[source]

generator yielding line by line (comments removed)

parse_line(l)

removes comments

reset_stream()[source]
class SMArt.incl.GeneralContainer[source]

Bases: object

add2container(item, replace=None, create=False, container_name=None, db_type=<class 'collections.OrderedDict'>, **kwargs)[source]

adds an item to a container, container name comes from the item, but can be passed as a variable kwargs: list_index - if the container is a list, the item will get inserted to the given index

item_id - can be passed if the item doesnt have its own it replace = (-1, 0, 1) -1 used to ignore if an item is already in the container, 0 raises an error flag_find_next_id

find_next_code(container_name, c=1, pref=None, suf=None, create=False, **kwargs)[source]

finds the next available code in a dict (of e.g. bonds) :param kwargs:

id_type - defines the type

Returns

static get_code(c, pref='', suf='', **kwargs)[source]
get_container(container_name, create=False, db_type=<class 'collections.OrderedDict'>, **kwargs)[source]

gets the container by the name kwargs: flag_item - searches for the container name from the item (e.g. flag_item = Bond())

flag_class - searches for the container name from the class (e.g. flag_item = Bond) flag_item and flag_class finds the container name that is usually defined from container2write pre_containers - list of pre_containers (e.g. top.ff with cont_name = bonds gives top.ff.bonds) cont_pref cont_suf

get_item(item_id, klass, create=False, create_container=False, **kwargs)[source]
static get_num_from_code(code, pref='', suf='', **kwargs)[source]
renumber_container(container_name, c_init=1, attrib='id', flag_id_map=False, **kwargs)[source]
Parameters
  • container_name

  • c_init

  • attrib

  • flag_id_map

  • kwargs – id_type - str or int

Returns

sort_container(container_name, attrib='id', pref='', suf='', **kwargs)[source]
class SMArt.incl.StringStream(s=None)[source]

Bases: SMArt.incl.Defaults

f = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
lines()[source]

generator yielding line by line (comments removed) - from string

parse_line(l)

removes comments

reset_stream()[source]
exception SMArt.incl.WARN[source]

Bases: UserWarning

flag_traceback = 0
SMArt.incl.do_warn(m)[source]
SMArt.incl.get_id_string(item, flag_id='id', default_id='id')[source]
SMArt.incl.set_print_warnings(flag=1)[source]
SMArt.incl.split_gen(s, pattern=None)[source]

the same as s.split() but it makes a generator out of it

SMArt.incl.test_time(f, *args, **kwargs)[source]

SMArt.mp_fnc module

SMArt.mp_fnc.run_comm_n_mp(n, comm_fd, fnc_v=2)[source]
SMArt.mp_fnc.run_n_mp(n, f2run, args)[source]

Module contents

SimulationsModellingArt