예제 #1
0
    def __init__(self, atom1=0, atom2=0):
        self.vectors = []
        self.keys = []

        # store vectors for all configurations of atoms
        if atom1 != 0:
            self.keys = lib.get_sorted_configurations(
                atom1.configurations.keys())
            if atom2 != 0:
                keys2 = lib.get_sorted_configurations(
                    atom2.configurations.keys())
                if self.keys != keys2:
                    pka_print(
                        "ERROR: Inequivalent configurations for atoms, please correct your pdbfile to single configuration"
                    )
                    pka_print("%s\n%s" % (atom1, atom2))
                    sys.exit(8)
                    #raise 'Cannot make multi vector: Atomic configurations mismatch for\n   %s\n   %s\n'%(atom1,atom2)
            for key in self.keys:
                atom1.setConfiguration(key)
                if atom2 != 0:
                    atom2.setConfiguration(key)
                v = vector(atom1=atom1, atom2=atom2)
                self.vectors.append(v)
                #pka_print(key,v)
        return
예제 #2
0
    def writePDB(self,
                 file=None,
                 filename=None,
                 all_configuration=False,
                 hydrogens=False,
                 options=None):
        """ 
        Writes a new pdbfile based on what is in the protein
        """

        configurations = lib.get_sorted_configurations(self.configurations)

        if len(configurations) == 1 or all_configuration == False:
            output.writePDB(self, filename=filename, hydrogens=hydrogens)
        else:
            # file is opened here
            if file == None:
                if filename == None:
                    filename = "%s.pdb" % (protein.name)
                file = open(filename, 'w')
            # write configurations
            for configuration in configurations:
                self.setConfiguration(configuration)
                file.write("MODEL%9d\n" % (int(configuration[1])))
                output.writePDB(self, file=file, hydrogens=hydrogens)
                file.write('ENDMDL\n')
            # file is closed here
            if file == None:
                file.close()
예제 #3
0
    def __init__(self, atom1=0, atom2=0):
        self.vectors = []
        self.keys = []

        # store vectors for all configurations of atoms
        if atom1!=0:
            self.keys = lib.get_sorted_configurations(atom1.configurations.keys())
            if atom2!=0:
                keys2 = lib.get_sorted_configurations(atom2.configurations.keys())
                if self.keys != keys2:
                    pka_print("ERROR: Inequivalent configurations for atoms, please correct your pdbfile to single configuration")
                    pka_print("%s\n%s" % (atom1, atom2))
                    sys.exit(8)
                    #raise 'Cannot make multi vector: Atomic configurations mismatch for\n   %s\n   %s\n'%(atom1,atom2)
            for key in self.keys:
                atom1.setConfiguration(key)
                if atom2!=0:
                    atom2.setConfiguration(key)
                v = vector(atom1=atom1, atom2=atom2)
                self.vectors.append(v)
                #pka_print(key,v)
        return
예제 #4
0
    def writePDB(self, pdbname):
        print("writing pdbfile %s" % (pdbname))
        file = open(pdbname, 'w')

        configurations = lib.get_sorted_configurations(self.configuration_keys)
        if len(configurations)==1:        
            self.write_atoms(file)
        else:
            for configuration in configurations:
                self.setConfiguration(configuration)
                file.write('MODEL%9d\n'%int(configuration[1]))
                self.write_atoms(file)
                file.write('ENDMDL\n')
        file.close()

        return
예제 #5
0
    def writePDB(self, pdbname):
        pka_print("writing pdbfile %s" % (pdbname))
        file = open(pdbname, 'w')

        configurations = lib.get_sorted_configurations(self.configuration_keys)
        if len(configurations) == 1:
            self.write_atoms(file)
        else:
            for configuration in configurations:
                self.setConfiguration(configuration)
                file.write('MODEL%9d\n' % int(configuration[1]))
                self.write_atoms(file)
                file.write('ENDMDL\n')
        file.close()

        return
예제 #6
0
    def writePDB(self, file=None, filename=None, all_configuration=False, hydrogens=False, options=None):
        """ 
        Writes a new pdbfile based on what is in the protein
        """ 

        configurations = lib.get_sorted_configurations(self.configurations)

        if len(configurations) == 1 or all_configuration == False:
            output.writePDB(self, filename=filename, hydrogens=hydrogens)
        else:
            # file is opened here
            if file == None:
              if filename == None:
                filename = "%s.pdb" % (protein.name)
              file = open(filename, 'w')
            # write configurations
            for configuration in configurations:
                self.setConfiguration(configuration)
                file.write("MODEL%9d\n" % (int(configuration[1])))
                output.writePDB(self, file=file, hydrogens=hydrogens)
                file.write('ENDMDL\n')
            # file is closed here
            if file == None:
              file.close()