readlines () num = int ( lines ) title = lines if feature = 'title' : return title if feature = 'molecule' : type_array = r_array = for l in lines : type, x, y, z = l. check_feature ( feature, "read" ) lines = self. ''' can_read = can_write = def read ( self, feature ): self. method:: write("molecule", mol) Writes a :py:class:`~` instance in the XYZ format. method:: read("molecule") Read the coordinates in a :py:class:`~` instance. Import numpy as np from chemlab.io.handlers import IOHandler from re import Molecule class XyzIO ( IOHandler ): '''The XYZ format is described in this wikipedia article. The recommended way for automatically opening a file: Handler by using the utility function chemlab.io.datafile() this is You can easily open a data file without even having to search his format Initialize your Atom, Molecule and System. Those attributes are especially important where you write in some dataįormat, since you may have to provide those attribute when you Molecule.atom_export_array, System.mol_export and Molecule.export, and their array-based counterparts Such issues, you can write this information in the export arraysĬontained in the data structures, such as Atom.export, The atoms in a water molecule: OW, HW1, HW2. For example the ”.gro” file formats have his own way to call Some file formats may have some extra data for each atom, molecule or You can read a certain feature provided by the handler. You first create the handler instance for a certain format and then fd = open ( 'waterbox_out.gro', 'w' ) outfile = GromacsIO ( fd ) outfile. read ( 'system' ) # Modify system as you wish. From chemlab.io.handlers import GromacsIO fd = open ( 'o', 'rb' ) infile = GromacsIO ( fd ) system = infile.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |