Modules for modeling of molecular structure =========================================== Module for class 'Structure' ---------------------------- There is a module, that realizes data structure - molecule and methods for its modification. .. automodule:: kvazar.core.structure :members: There are some overrided methods for structure, as ``__add__``, ``__iadd__``, ``__getslice__``, ``__delitem__``. And here is a python code of example of usage of module: .. code-block:: python struct_data = dict() n_atoms = 2 n_links = 10 struct_data['n_atoms'] = n_atoms struct_data['n_links'] = n_links struct_data['atom_names'] = ['Carbon','Carbon'] struct_data['coords'] = numpy.zeros((n_atoms,3), numpy.float) struct_data['coords'][1][0] = 1.42 struct_data['links'] = numpy.zeros((n_atoms,n_links), numpy.int32)-1 struct_data['links'][0][0] = 1 struct_data['num_links'] = numpy.zeros(n_atoms, numpy.float) struct_data['num_links'][0] = 1 A = structure.Structure(struct_data) B = A.copy() B.coords[0][1] = B.coords[1][1] = 1.42 C = A + B You will get new structure with 4 atoms, where coordinates are concatenated, when velocities, links are still the same as in original A and B .. code-block:: python A += B You will get modified structure A (A = A + B) .. code-block:: python D = A[1:2] You will get new structure, which is a part of structure A and has 2 atoms (from 1 to 2 inclusive). .. code-block:: python del A[[(0,0), (1,2)]] It deletes atoms of structure: 0,1,2. It changes initial structure. .. code-block:: python E = C.getsubstr([(1,2)]) You will get new structure, that made of atoms 1,2. Module of class for structure loading and saving ------------------------------------------------ .. automodule:: kvazar.fileman :members: There is an example of fileman.py usage in package: .. code-block:: python from kvazar.fileman import FileManager fm = FileManager() struct1 = fm.load("path/to/c28.ACD") It loads model of fullerene C28 .. code-block:: python fm.set_struct(struct1) fm.save("path/to/c28_new.ACD") It saves copy of model of fullerene in new file. Examples of input files can be found in kvazar's directory: Path_to_kvazar + "/test/test_data/" Module for saving output file ----------------------------- .. automodule:: kvazar.record :members: It provides an interface to the molecular dynamic data. It allows: * To load any state of calculated file. States are from 0 to the last of states .. code-block:: python python from kvazar.record import Record rec = Record('path/to/file.nmd', 'a') rec.update_state(1) * To see parameters, that were calculated, for any state: .. code-block:: python rec.params There are two possible modifiers in initializing of object of class ``Record``: * 'a' - it will append new data to already existed * 'w' - it will rewrite data