mooonpy.molspace.atom_styles module
- class mooonpy.molspace.atom_styles.Styles(astyles)[source]
Bases:
objectSet up supported styles for LAMMPS and other file formats (NOTE: for the LAMMPS ‘type’ attributes they can be an int or str due to type labels in a LAMMPS datafile or LAMMPS molecule file - so need to use _int_str function).
The self.read, self.styles, and self.defaults dictionaries are meant to provide very easy general purpose way to extend the ability to read and write LAMMPS styles. However, due to the general purpose nature they are not as quick as they could be. Therefore, “hard coded” ways to read and write for speed purposes can be added. These will be set as functions with the names:
def read_STYLE(self, atom, style, data_lst): def line_STYLE(self, atom, style):
where STYLE in def _STYLE() is a LAMMPS style (e.g. def read_full(), will be the hard coded reader to the LAMMPS ‘full’ atom style). *NOTE: to support any LAMMPS style that style key needs to be in self.read, self.styles, and self.defaults dictionaries, even if “hard coded” readers and writers are generated - this is because this will tell the code how to generate an instance of the Atom class, with necessary __slots__ and defaults.
- defaults = {'BO_total': 0.0, 'area': 0.0, 'bodyflag': 0, 'ccN': 0.0, 'comment': '', 'cradius': 0.0, 'cs_im': 0.0, 'cs_re': 0.0, 'curvature': 0.0, 'cv': 0.0, 'density': 0.0, 'diameter': 0.0, 'ed': 0.0, 'edpd_cv': 0.0, 'edpd_temp': 0.0, 'element': '', 'ellipsoidflag': 0, 'em': 0.0, 'energy': 0.0, 'epsilon': 0.0, 'eradius': 0.0, 'esph': 0.0, 'espin': 0, 'etag': 0, 'fx': 0.0, 'fy': 0.0, 'fz': 0.0, 'id': 0, 'ix': 0, 'iy': 0, 'iz': 0, 'kradius': 0.0, 'lineflag': 0, 'mass': 0.0, 'molecule': 0, 'molid': 0, 'mux': 0.0, 'muy': 0.0, 'muz': 0.0, 'name': '', 'q': 0.0, 'rho': 0.0, 'sp': 0.0, 'spx': 0.0, 'spy': 0.0, 'spz': 0.0, 'status': 0, 'sub_styleN': 0.0, 'template_atom': 0, 'template_index': 0, 'theta': 0.0, 'triangleflag': 0, 'type': 0, 'volume': 0.0, 'vx': 0.0, 'vy': 0.0, 'vz': 0.0, 'x': 0.0, 'x0': 0.0, 'xu': 0.0, 'y': 0.0, 'y0': 0.0, 'yu': 0.0, 'z': 0.0, 'z0': 0.0, 'zu': 0.0}
- func_aliases = {'BO_total': <class 'float'>, 'area': <class 'float'>, 'bodyflag': <class 'int'>, 'ccN': <class 'float'>, 'comment': <class 'str'>, 'cradius': <class 'float'>, 'cs_im': <class 'float'>, 'cs_re': <class 'float'>, 'curvature': <class 'float'>, 'cv': <class 'float'>, 'density': <class 'float'>, 'diameter': <class 'float'>, 'ed': <class 'float'>, 'edpd_cv': <class 'float'>, 'edpd_temp': <class 'float'>, 'element': <class 'str'>, 'ellipsoidflag': <class 'int'>, 'em': <class 'float'>, 'energy': <class 'float'>, 'epsilon': <class 'float'>, 'eradius': <class 'float'>, 'esph': <class 'float'>, 'espin': <class 'int'>, 'etag': <class 'int'>, 'fx': <class 'float'>, 'fy': <class 'float'>, 'fz': <class 'float'>, 'id': <class 'int'>, 'ix': <class 'int'>, 'iy': <class 'int'>, 'iz': <class 'int'>, 'kradius': <class 'float'>, 'lineflag': <class 'int'>, 'mass': <class 'float'>, 'molecule': <class 'int'>, 'molid': <class 'int'>, 'mux': <class 'float'>, 'muy': <class 'float'>, 'muz': <class 'float'>, 'name': <class 'str'>, 'q': <class 'float'>, 'rho': <class 'float'>, 'sp': <class 'float'>, 'spx': <class 'float'>, 'spy': <class 'float'>, 'spz': <class 'float'>, 'status': <class 'int'>, 'sub_styleN': <function _int_str_float>, 'template_atom': <class 'int'>, 'template_index': <class 'int'>, 'theta': <class 'float'>, 'triangleflag': <class 'int'>, 'type': <function _int_str>, 'volume': <class 'float'>, 'vx': <class 'float'>, 'vy': <class 'float'>, 'vz': <class 'float'>, 'x': <class 'float'>, 'x0': <class 'float'>, 'xu': <class 'float'>, 'y': <class 'float'>, 'y0': <class 'float'>, 'yu': <class 'float'>, 'z': <class 'float'>, 'z0': <class 'float'>, 'zu': <class 'float'>}
- styles = {'_random': ('comment', 'element', 'name', 'vx', 'vy', 'vz'), 'angle': ('id', 'molid', 'type', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'atomic': ('id', 'type', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'body': ('id', 'type', 'bodyflag', 'mass', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'bond': ('id', 'molid', 'type', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'box': ('xu', 'yu', 'zu'), 'bpm/sphere': ('id', 'molid', 'type', 'diameter', 'density', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'charge': ('id', 'type', 'q', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'custom': (), 'dielectric': ('id', 'type', 'q', 'x', 'y', 'z', 'mux', 'muy', 'muz', 'area', 'ed', 'em', 'epsilon', 'curvature', 'ix', 'iy', 'iz'), 'dipole': ('id', 'type', 'q', 'x', 'y', 'z', 'mux', 'muy', 'muz', 'ix', 'iy', 'iz'), 'dpd': ('id', 'type', 'theta', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'edpd': ('id', 'type', 'edpd_temp', 'edpd_cv', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'electron': ('id', 'type', 'espin', 'eradius', 'q', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'ellipsoid': ('id', 'type', 'ellipsoidflag', 'density', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'force': ('fx', 'fy', 'fz'), 'full': ('id', 'molid', 'type', 'q', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'hybrid': ('id', 'type', 'x', 'y', 'z', 'sub_styleN'), 'line': ('id', 'molid', 'type', 'lineflag', 'density', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'mdpd': ('id', 'type', 'rho', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'molecular': ('id', 'molid', 'type', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'peri': ('id', 'type', 'volume', 'density', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'reax': ('BO_total',), 'rheo': ('id', 'type', 'status', 'rho', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'rheo/thermal': ('id', 'type', 'status', 'rho', 'energy', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'smd': ('id', 'type', 'molecule', 'volume', 'mass', 'kradius', 'cradius', 'x0', 'y0', 'z0', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'sph': ('id', 'type', 'rho', 'esph', 'cv', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'sphere': ('id', 'type', 'diameter', 'density', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'spin': ('id', 'type', 'x', 'y', 'z', 'spx', 'spy', 'spz', 'sp', 'ix', 'iy', 'iz'), 'tdpd': ('id', 'type', 'x', 'y', 'z', 'ccN'), 'template': ('id', 'type', 'molid', 'template_index', 'template_atom', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'tri': ('id', 'molid', 'type', 'triangleflag', 'density', 'x', 'y', 'z', 'ix', 'iy', 'iz'), 'wavepacket': ('id', 'type', 'q', 'espin', 'eradius', 'etag', 'cs_re', 'cs_im', 'x', 'y', 'z', 'ix', 'iy', 'iz')}