There is a module, that realizes data structure - molecule and methods for its modification.
It only compares number of atoms, links and identity of atom types in two structures.
It returns array of neighbours of all atoms, array of numbers of all atoms, full number of atoms
It forms new structure from selected atoms. For example:
Some_structure.getsubstr([(0,20),(30,45)]) - it returns new object of class Structure, that is made from 0-20 and 30-45 atoms of initial structure.
There are some overrided methods for structure, as __add__, __iadd__, __getslice__, __delitem__.
And here is a python code of example of usage of module:
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
A += B
You will get modified structure A (A = A + B)
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).
del A[[(0,0), (1,2)]]
It deletes atoms of structure: 0,1,2. It changes initial structure.
E = C.getsubstr([(1,2)])
You will get new structure, that made of atoms 1,2.
It’s a class for structure loading from files. Possible extensions of files for loading are ACD, ACC, PDB. Now there is only one possible extension for saving: ACD. Also class checks existance of direcory and makes the new one, if needed. Raise exception in the case of unknown extension.
There is an example of fileman.py usage in package:
from kvazar.fileman import FileManager
fm = FileManager()
struct1 = fm.load("path/to/c28.ACD")
It loads model of fullerene C28
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/”
It’s a class for saving intermediate data of calculation and archive it in one output file.
It provides an interface to the molecular dynamic data. It allows:
python
from kvazar.record import Record
rec = Record('path/to/file.nmd', 'a')
rec.update_state(1)
rec.params
There are two possible modifiers in initializing of object of class Record: