Пример #1
0
 def write_to_file(self, name):
     self.additional_input_dict['modred'] = [
         m.write() for m in self.modreds
     ]
     with open(name, 'w') as gaussian_com_file:
         for line in self.link_0_commands:
             gaussian_com_file.write(line)
         gaussian_com_file.write(self.route_section.write().replace(
             '\n ', '\n'))  # FIXME
         gaussian_com_file.write("\n")
         gaussian_com_file.write(self.title_line)
         gaussian_com_file.write("\n")
         gaussian_com_file.write(self.multiplicity_line)
         for atom in self.atoms_list:
             line = iolines.atom2zmat(atom)
             gaussian_com_file.write(line)
         for section in self.additional_input_dict:
             if self.additional_input_dict[section]:
                 gaussian_com_file.write("\n")
                 if section == 'first' and 'soft' in self.route_section.text:
                     gaussian_com_file.write("\n")
                 elif section == 'dftb=read' and 'dftb=read' in self.route_section.text:
                     gaussian_com_file.write("\n")
                 for line in self.additional_input_dict[section]:
                     gaussian_com_file.write(line)
         gaussian_com_file.write("\n\n\n\n\n")
Пример #2
0
    def _gen_zmat(self, inpcrd_name):

        text = ''

        chargelist = self.read_flag('CHARGE')
        if 'ATOMIC_NUMBER' in self._flags:  # old amboniom_elements.py (glycam)
            elements = self._guess_elements()
        else:
            elements = self._read_elements()

        total_charge = 0

        X, Y, Z = self._coords_from_inpcrd(inpcrd_name)

        j = 0
        for i in self.atom_sel_idx:
            name = self.pdb_atom_name[i].replace('-', '').replace('+', '')
            residue_name = self.pdb_resname[i].replace('-',
                                                       '').replace('+', '')
            residue_number = self.pdb_resid[i]
            mm_type = self.upper_atom_types[i]
            charge = chargelist[i] / 18.2223
            total_charge += charge
            mask = '0'
            x = X[i]
            y = Y[i]
            z = Z[i]
            chain = ''
            layer = 'L'
            element = elements[j]
            j += 1
            link_element = link_mm_type = link_bound_to = link_scale1 = None

            # create atom
            this_atom = atoms.Atom(element, (x, y, z))
            resinfo = atoms.RESinfo(name, residue_name, residue_number, chain)
            this_atom.set_resinfo(resinfo)
            oniominfo = atoms.Oniom(mask, layer)
            this_atom.set_oniom(oniominfo)
            mm = atoms.MM(mm_type, charge)
            this_atom.set_mm(mm)

            # print z-matrix for atom
            text += iolines.atom2zmat(this_atom)

        # Add stuff to text
        header = ''
        #header += '%nproc=4\n'
        #header += '%mem=2GB\n'
        #header += '%chk=chk.chk\n'
        header += '# amber=softonly geom=connectivity\n\n'
        header += 'Se amanha nao chover vai estar um lindo dia de sol\n\n'
        header += 'Sum of partial charges: %f\n' % (total_charge)
        return header + text
Пример #3
0
    def _gen_zmat(self, inpcrd_name):

        text = ''

        chargelist = self.read_flag('CHARGE')
        if 'ATOMIC_NUMBER' in self._flags: # old amboniom_elements.py (glycam)
            elements = self._guess_elements()
        else:
            elements = self._read_elements()
            
        total_charge = 0

        X,Y,Z = self._coords_from_inpcrd(inpcrd_name)

        j = 0
        for i in self.atom_sel_idx:
            name = self.pdb_atom_name[i].replace('-','').replace('+','')
            residue_name = self.pdb_resname[i].replace('-','').replace('+','')
            residue_number = self.pdb_resid[i]
            mm_type = self.upper_atom_types[i]
            charge = chargelist[i] / 18.2223
            total_charge += charge
            mask = '0'
            x = X[i]
            y = Y[i]
            z = Z[i]
            chain = ''
            layer = 'L'
            element = elements[j]
            j += 1
            link_element = link_mm_type = link_bound_to = link_scale1 = None

            # create atom
            this_atom = atoms.Atom(element, (x, y, z))
            resinfo = atoms.RESinfo(name, residue_name, residue_number, chain)
            this_atom.set_resinfo(resinfo)
            oniominfo = atoms.Oniom(mask, layer)
            this_atom.set_oniom(oniominfo)
            mm = atoms.MM(mm_type, charge)
            this_atom.set_mm(mm)

            # print z-matrix for atom
            text += iolines.atom2zmat(this_atom)
            
        # Add stuff to text
        header = ''
        #header += '%nproc=4\n'
        #header += '%mem=2GB\n'
        #header += '%chk=chk.chk\n'
        header += '# amber=softonly geom=connectivity\n\n' 
        header += 'Se amanha nao chover vai estar um lindo dia de sol\n\n'
        header +=  'Sum of partial charges: %f\n' % (total_charge) 
        return header + text
Пример #4
0
 def write_to_file(self,name):
     self.additional_input_dict['modred'] = [m.write() for m in self.modreds]
     with open(name, 'w') as gaussian_com_file:
         for line in self.link_0_commands:
             gaussian_com_file.write(line)
         gaussian_com_file.write(self.route_section.write().replace('\n ','\n')) # FIXME
         gaussian_com_file.write("\n")   
         gaussian_com_file.write(self.title_line)
         gaussian_com_file.write("\n")
         gaussian_com_file.write(self.multiplicity_line)
         for atom in self.atoms_list:
             line = iolines.atom2zmat(atom)
             gaussian_com_file.write(line)                
         for section in self.additional_input_dict:
             if self.additional_input_dict[section]:
                 gaussian_com_file.write("\n")
                 if section == 'first' and 'soft' in self.route_section.text:
                     gaussian_com_file.write("\n")
                 elif section == 'dftb=read' and 'dftb=read' in self.route_section.text:
                     gaussian_com_file.write("\n")
                 for line in self.additional_input_dict[section]:
                     gaussian_com_file.write(line)
         gaussian_com_file.write("\n\n\n\n\n")