Beispiel #1
0
    def __init__(self):
        Molecule.__init__(self, "WATER")

        # print NANOCAD_PDB_DIR + "/Solvents/WATER.pdb" , NANOCAD_PDB_DIR + "/Solvents/WATER.psf"
        #self.load(NANOCAD_PDB_DIR + "/Solvents/WATER.pdb" , NANOCAD_PDB_DIR + "/Solvents/WATER.psf")

        # build water molecule
        atr = AtomAttributes(WATER.otObj,
                             [4.01300001, 0.83099997, -9.08300018])
        #print "----------------------->", str(atr)
        self.add_atom(atr, [])

        atr = AtomAttributes(WATER.htObj,
                             [4.94099998, 0.84399998, -8.83699989])
        #print "----------------------->", str(atr)
        self.add_atom(atr, [1])

        atr = AtomAttributes(WATER.htObj, [3.75, -0.068, -9.29300022])
        #print "----------------------->", str(atr)
        self.add_atom(atr, [1])

        if WATER._FORCE_FIELD == None:
            print("WATER generating FF")
            WATER._FORCE_FIELD = ForceField(
                self, NANOCAD_FORCE_FIELDS + "/WATER.prm")
        #print "WATER1", WATER._FORCE_FIELD._BONDS
        self.setForceField(WATER._FORCE_FIELD)
        #print "WATER2", self.getForceField()._BONDS
        self.copyChargesToForceField()
Beispiel #2
0
	def __init__(self):
		Molecule.__init__(self, "H2O2")

		# print NANOCAD_PDB_DIR + "/Solvents/WATER.pdb" , NANOCAD_PDB_DIR + "/Solvents/WATER.psf" 
		#self.load(NANOCAD_PDB_DIR + "/Solvents/WATER.pdb" , NANOCAD_PDB_DIR + "/Solvents/WATER.psf")

		# build water H2O2
		atr = AtomAttributes("OT1", "O", "OT", [ -0.077,   0.000,   0.730 ], 0.834, 15.9994, 0.0, 1.0, ' ', "OT  ", "XXX", "A", 1)
		#print "----------------------->", str(atr)
		self.add_node(1, attrs=[atr])

		atr = AtomAttributes("OT2", "O", "OT", [  0.077,   0.000,  -0.730], 0.834, 15.9994, 0.0, 1.0, ' ', "OT  ", "XXX", "A", 1)
		#print "----------------------->", str(atr)
		self.add_node(2, attrs=[atr])

		atr = AtomAttributes("HT1", "H", "HT", [  -1.077,   0.000,   1.730], 0.417, 1.00794, 0.0, 1.0, ' ', "HT ", "XXX", "A", 1)
		#print "----------------------->", str(atr)
		self.add_node(3, attrs=[atr])

		atr = AtomAttributes("HT2", "H", "HT", [   1.077,   0.000,  -1.730], 0.417, 1.00794, 0.0, 1.0, ' ', "HT ", "XXX", "A", 1)
		#print "----------------------->", str(atr)
		self.add_node(4, attrs=[atr])

		self.addBond(1, 2)
		self.addBond(1, 3)
		self.addBond(2, 4)

		#self.add_angle(3,1,2)
		#self.add_angle(1,2,4)

		#self.add_dihedral(1,2,3,4)

		
		self.setForceField(_FORCE_FIELD )
		self.copyChargesToForceField()
Beispiel #3
0
 def __init__(self):
     mix = Mixture()
     mix.loadWFM(WOLFFIA_WFY_DIR + "/PABApentane.wfm")
     print(mix.molecules())
     Molecule.__init__(self,
                       "PABA-Pentane",
                       molecule=mix.getMolecule("PABA-Pentane_1"))
     self.changeResidues("PAB")
Beispiel #4
0
    def __init__(self):
        Molecule.__init__(self, "SDSplusNA")

        #print NANOCAD_PDB_DIR + "/Solvents/THF.pdb" , NANOCAD_PDB_DIR + "/Solvents/THF.psf"
        self.load(NANOCAD_PDB_DIR + "/Surfactant/SDSplusNA.pdb",
                  NANOCAD_PDB_DIR + "/Surfactant/SDSplusNA.psf")

        self.setForceField(_FORCE_FIELD)
Beispiel #5
0
    def __init__(self):
        Molecule.__init__(self, "Argon")

        atr = AtomAttributes("AR", "AR", "AR", [0.0, 0.0, 0.0], 0.0, 39.9500,
                             0.0, 1.0, ' ', "OT  ", "WAT", "A", 1)
        #print "----------------------->", str(atr)
        self.add_node(1, attrs=[atr])

        self.setForceField(self._FORCE_FIELD)
        self.copyChargesToForceField()
Beispiel #6
0
    def __init__(self):
        Molecule.__init__(self, "AcetoneAllH")

        #print NANOCAD_PDB_DIR + "/Solvents/Acetone-All-H.pdb" , NANOCAD_PDB_DIR + "/Solvents/Acetone-All-H.psf"
        self.load(NANOCAD_PDB_DIR + "/Solvents/AcetoneAllH.pdb",
                  NANOCAD_PDB_DIR + "/Solvents/AcetoneAllH.psf")

        if AcetoneAllH._FORCE_FIELD == None:
            AcetoneAllH._FORCE_FIELD = ForceField(
                self, NANOCAD_FORCE_FIELDS + "/AcetoneAllH.prm")
        self.setForceField(AcetoneAllH._FORCE_FIELD)
        self.copyChargesToForceField()
Beispiel #7
0
    def __init__(self, chain, molname=None):
        print("Polymer")
        if type(self) == Polymer:
            raise Molecule.MoleculeError(
                "Polymer is an abstract class.  Should not be directly instantiated."
            )

        if molname == None:
            molname = str(chain)

        Molecule.__init__(self, molname)

        if hasattr(self, 'MONOMERS_PDBS'): self.chainOldStyle(chain)
        else: self.chainMolStyle(chain)
Beispiel #8
0
    def __init__(self):
        Molecule.__init__(self, "Na")

        atr = AtomAttributes(Na.ai, [0.0, 0.0, 0.0])
        self.add_atom(atr, [])

        #print NANOCAD_PDB_DIR + "/Solvents/THF.pdb" , NANOCAD_PDB_DIR + "/Solvents/THF.psf"
        self.load(NANOCAD_PDB_DIR + "/Ions/Na.pdb",
                  NANOCAD_PDB_DIR + "/Ions/Na.psf")

        if Na._FORCE_FIELD == None:
            Na._FORCE_FIELD = ForceField(self)
            Na._FORCE_FIELD.setNonBond("Na", -0.1153, NonBond._EPSILON)
            Na._FORCE_FIELD.setNonBond("Na", 2.275, NonBond._SIGMA)
            Na._FORCE_FIELD.setNonBond("Na", 1., NonBond._CHARGE)
        self.setForceField(Na._FORCE_FIELD)
        self.copyChargesToForceField()
Beispiel #9
0
    def __init__(self):
        Molecule.__init__(self, "CLF4")

        atr = AtomAttributes(CLF4.ai1, [0., 0., 0.])
        self.add_atom(atr, [])
        atr = AtomAttributes(CLF4.ai2, [0.58099997, -1.07599998, -1.27499998])
        self.add_atom(atr, [1])
        atr = AtomAttributes(CLF4.ai3, [1.29900002, 0.29100001, 1.16199994])
        self.add_atom(atr, [1])
        atr = AtomAttributes(CLF4.ai4, [-0.509, 1.53499997, -0.71100003])
        self.add_atom(atr, [1])

        if CLF4._FORCE_FIELD == None:
            CLF4._FORCE_FIELD = ForceField(self,
                                           NANOCAD_FORCE_FIELDS + "/CLF4.prm")
        self.setForceField(CLF4._FORCE_FIELD)
        self.copyChargesToForceField()
Beispiel #10
0
	def __init__(self,n,m,length, element="C", bondLength=1.421, mass=12.011):
		Molecule.__init__(self, element + "_hP4(" + str(n) + "," + str(n) + ")")

		self.coords = []
		self._n = n
		self._m = m
		self._length = length
		self._mass = mass
		self._bondLength = bondLength
		self._element = element
		self._ribbonWidth = 0.
		self.ai  = AtomInfo("C", self._element, "C", 0., self._mass, 'HP4')

		self.generateZigZag()
		self.rotateSheet()
		#self.removeLoneAtoms()
		self.recalculateDimensions()
Beispiel #11
0
    def __init__(self, symbol):
        try:
            symbol = symbol.upper()
            nbParameters = Element._FORCE_FIELD_PARAMETERS[symbol]
        except:
            import logging
            logger = logging.getLogger(self.__class__.__name__)
            logger.error("Invalid element symbol \"" + str(symbol) + "\"")
            print("Invalid element symbol \"" + str(symbol) + "\"")
            return

        Molecule.__init__(self, symbol)

        self.add_node(1, attrs=[copy.deepcopy(Element._ATTRIBUTES[symbol])])

        ff = ForceField(self)
        ff.setNonBond(symbol, nbParameters[NonBond._EPSILON], NonBond._EPSILON)
        ff.setNonBond(symbol, nbParameters[NonBond._SIGMA] / 2.,
                      NonBond._SIGMA)  # VDw DISTANCE DIVIDED BY 2!!!!!

        self.setForceField(ff)
Beispiel #12
0
    def __init__(self):
        Molecule.__init__(self, "DMF")

        #print NANOCAD_PDB_DIR + "/Solvents/DMF.pdb" , NANOCAD_PDB_DIR + "/Solvents/DMF.psf"
        #self.load(NANOCAD_PDB_DIR + "/Solvents/DMF.pdb" , NANOCAD_PDB_DIR + "/Solvents/DMF.psf")

        atr = AtomAttributes(DMF.ai1, [0.045, -0.12800001, 0.038])
        self.add_atom(atr, [])
        atr = AtomAttributes(DMF.ai2, [-0.38, 1.09099996, -0.31900001])
        self.add_atom(atr, [1])
        atr = AtomAttributes(DMF.ai3, [0.45500001, 2.171, -0.19499999])
        self.add_atom(atr, [2])
        atr = AtomAttributes(DMF.ai4, [1.38699996, -0.30599999, 0.55500001])
        self.add_atom(atr, [1])
        atr = AtomAttributes(DMF.ai5, [-0.838, -1.26999998, -0.094])
        self.add_atom(atr, [1])
        atr = AtomAttributes(DMF.ai6, [-1.38, 1.22399998, -0.70499998])
        self.add_atom(atr, [2])
        atr = AtomAttributes(DMF.ai7, [1.37600005, -0.192, 1.63900006])
        self.add_atom(atr, [4])
        atr = AtomAttributes(DMF.ai8, [2.04699993, 0.442, 0.117])
        self.add_atom(atr, [4])
        atr = AtomAttributes(DMF.ai9, [1.74600005, -1.30299997, 0.29800001])
        self.add_atom(atr, [4])
        atr = AtomAttributes(DMF.ai10, [-1.12800002, -1.38699996, -1.13800001])
        self.add_atom(atr, [5])
        atr = AtomAttributes(DMF.ai11, [-1.72899997, -1.11199999, 0.51499999])
        self.add_atom(atr, [5])
        atr = AtomAttributes(DMF.ai12, [-0.322, -2.16899991, 0.243])
        self.add_atom(atr, [5])

        if DMF._FORCE_FIELD == None:
            DMF._FORCE_FIELD = ForceField(self,
                                          NANOCAD_FORCE_FIELDS + "/DMF.prm")
        self.setForceField(DMF._FORCE_FIELD)
        self.copyChargesToForceField()
Beispiel #13
0
    def chainOldStyle(self, chain):
        print("chainOldStyle")
        if len(chain) == 1:
            self.load(self.ONE_MONOMER_PDB[chain[0]])
            return

        for dn in range(len(chain)):
            # print "Polymer(",NANOCAD_PDB_DIR+self.MONOMERS_PDBS[chain[dn]],")"
            monomer = Molecule(chain[dn])
            monomer.load(NANOCAD_PDB_DIR + self.MONOMERS_PDBS[chain[dn]],
                         NANOCAD_PDB_DIR + self.MONOMERS_PSFS[chain[dn]])
            monomer.rotateRad(0.0, dn * self.ANGLE, 0.0)
            monomer.moveby([0.0, self.DISPL * dn, 0.0])
            if self.order() == 0:
                self.merge(monomer, [])
            elif hasattr(self, 'START_ATOM'):
                self.merge(monomer, [[
                    self.order() - self.NUM_ATOMS_BACKBONE_MONOMER +
                    self.END_ATOM, self.START_ATOM
                ]])
            else:
                self.merge(monomer, [[self.order(), 1]])
Beispiel #14
0
    def __init__(self, parent, molecule=None):
        '''
        Constructor
        '''
        super(CHARMMParameterFinderDialog, self).__init__(parent, modal=1)
        self.ui = Ui_CHARMMParameterFinderDialog()
        self.ui.setupUi(self)
        self.parent = parent
        self.forceField = None
        self.pairing = None
        self.thread = None
        self.molecule = Molecule(molecule.molname(), molecule)
        self.originalMolecule = molecule
        self.ui.timeLeftClock.setValue(self.ui.timeLimitSlider.value())

        self.timer = QtCore.QTimer()
        self.connect(self.timer, QtCore.SIGNAL('timeout()'), self.on_timer)

        self.ui.acceptButton.setEnabled(False)
        self.ui.reportTextEdit.setReadOnly(True)
        self.ui.startButton.setEnabled(False)
Beispiel #15
0
    def __init__(self):
        Molecule.__init__(self, "THF")

        #print NANOCAD_PDB_DIR + "/Solvents/THF.pdb" , NANOCAD_PDB_DIR + "/Solvents/THF.psf"
        #self.load(NANOCAD_PDB_DIR + "/Solvents/THF.pdb" , NANOCAD_PDB_DIR + "/Solvents/THF.psf")

        atr = AtomAttributes(THF.atr1, [0.180, 0.300, -2.690])
        self.add_atom(atr, [])
        atr = AtomAttributes(THF.atr2, [1.084, 0.909, -2.675])
        self.add_atom(atr, [1])
        atr = AtomAttributes(THF.atr3, [-0.637, 0.671, -3.309])
        self.add_atom(atr, [1])
        atr = AtomAttributes(THF.atr4, [-0.350, 0.030, -1.310])
        self.add_atom(atr, [1])
        atr = AtomAttributes(THF.atr5, [-1.282, -0.535, -1.328])
        self.add_atom(atr, [4])
        atr = AtomAttributes(THF.atr6, [-0.371, 0.969, -0.757])
        self.add_atom(atr, [4])
        atr = AtomAttributes(THF.atr7, [0.820, -0.800, -0.800])
        self.add_atom(atr, [4])
        atr = AtomAttributes(THF.atr8, [0.539, -1.361, 0.091])
        self.add_atom(atr, [7])
        atr = AtomAttributes(THF.atr9, [1.667, -0.126, -0.669])
        self.add_atom(atr, [7])
        atr = AtomAttributes(THF.atr10, [1.110, -1.690, -1.900])
        self.add_atom(atr, [7])
        atr = AtomAttributes(THF.atr11, [0.460, -1.140, -3.080])
        self.add_atom(atr, [1, 10])
        atr = AtomAttributes(THF.atr12, [-0.501, -1.639, -3.207])
        self.add_atom(atr, [11])
        atr = AtomAttributes(THF.atr13, [1.120, -1.188, -3.946])
        self.add_atom(atr, [11])
        '''
		self.addBond(1,2)
		self.addBond(1,3)
		self.addBond(1,4)
		self.addBond(1,11)
		self.addBond(4,5)
		self.addBond(4,6)
		self.addBond(4,7)
		self.addBond(7,8)
		self.addBond(7,9)
		self.addBond(7,10)
		self.addBond(10,11)
		self.addBond(11,12)
		self.addBond(11,13)
		'''

        #self.add_angle()
        #self.add_angle()
        #self.add_angle()
        #self.add_angle()

        #self.add_dihedrals ()
        #self.add_dihedrals ()

        if THF._FORCE_FIELD == None:
            THF._FORCE_FIELD = ForceField(self,
                                          NANOCAD_FORCE_FIELDS + "/THF.prm")
        self.setForceField(THF._FORCE_FIELD)
        self.copyChargesToForceField()
Beispiel #16
0
	def __init__(self):
		Molecule.__init__(self, "Xylene")

		#print NANOCAD_PDB_DIR + "/Solvents/THF.pdb" , NANOCAD_PDB_DIR + "/Solvents/THF.psf" 
		self.load(NANOCAD_PDB_DIR + "/Solvents/Xylene.pdb" , NANOCAD_PDB_DIR + "/Solvents/Xylene.psf")
Beispiel #17
0
    def __init__(self,
                 n,
                 m,
                 length,
                 element="C",
                 bondLength=1.421,
                 mass=12.011):
        self.coords = []
        self._n = n
        self._m = m
        self._length = length
        self._mass = mass
        self._bondLength = bondLength
        self._element = element
        self.EPSILON = bondLength / 2.

        sheet = Hexagonal2D(n, m, length, element, bondLength, mass)
        unitVectLength = self._bondLength * math.sqrt(
            2. - 2. * math.cos(2. * math.pi / 3.))
        #tubePerimeter = unitVectLength * math.sqrt(n*n+m*m)
        tubePerimeter = sheet.getWidth() + self._bondLength
        #print tubePerimeter

        radius = tubePerimeter / 2. / math.pi
        xToAngleFactor = 2. * math.pi / tubePerimeter

        atoms = sheet.atoms()
        for atom in atoms:
            attr = sheet.getAtomAttributes(atom)
            coords = attr.getCoord()
            angle = coords[0] * xToAngleFactor
            attr.setCoord([
                radius * math.cos(angle), radius * math.sin(angle), coords[2]
            ])
            sheet.setAtomAttributes(atom, attr)

        # close tube

        incomplete = []
        #print "degree:",
        for atom in atoms:
            #print sheet.degree(atom),
            if sheet.degree(atom) < 3:
                incomplete.append(atom)
        for atom1 in incomplete:
            for atom2 in incomplete:
                if atom1 != atom2 and not sheet.has_edge(
                        atom1, atom2) and sheet.distance(
                            atom1, atom2) < bondLength + self.EPSILON:
                    sheet.addBond(atom1, atom2)
                    #print "sheet.addBond(",atom1,", ",atom2

        # remove redundant atoms and bonds
        #for i in range(len(atoms)):
        #	for j in range(i+1,len(atoms)):
        #		if sheet.distance(atoms[i], atoms[j]) < self.EPSILON:
        #			print "caca",sheet.distance(atoms[i], atoms[j])
        #			sheet.removeAtom(atoms[i])
        #			break
        molname = element + "_Tube(" + str(m) + "," + str(n) + ")"

        Molecule.__init__(self, molname, sheet)

        if Tube._FORCE_FIELD == None:
            Tube._FORCE_FIELD = ForceField(self,
                                           NANOCAD_FORCE_FIELDS + "/CNT.prm")
        self.setForceField(Tube._FORCE_FIELD)
Beispiel #18
0
    def __init__(self, m, n, q):

        diamondMix = Mixture()
        diamondMix.loadWFM(WOLFFIA_WFY_DIR + "/diamond.wfm")
        diamondCell = diamondMix.getMolecule('Diamond_1')

        sal = Element("NA")
        sal.moveBy([-1, -1, -1])  # put it out of the way

        #'Crece' el diamante
        tempMixture = Mixture()
        for dm in range(m):
            for dn in range(n):
                for dq in range(q):
                    newCell = diamondCell.copy()
                    newCell.moveby([dm * 5.43, dn * 5.43, dq * 5.43])
                    tempMixture.add(newCell)

        tempMixture.add(sal)

        G = tempMixture.copy()
        H = tempMixture.copy()
        Coord = []
        overlapAtoms = []
        atomNeighbors = []
        toEliminate = []

        #Hace que las moleculas se conecten al atomo de Na y hace de la mezcla una molecula
        for p, mol in enumerate(G):
            molecule = G.getMolecule(mol)
            for idx, atom1 in enumerate(molecule):
                if molecule.getAttributes(
                        atom1).getInfo().getElement() == "NA":
                    molSal = mol
                    numMolecule = p
                    atomSal = molecule.atom(idx)

        for p, mol in enumerate(G):
            molecule = G.getMolecule(mol)
            if p != numMolecule:
                molC = mol
                atomC = molecule.atom(1)
                H.addBond([molSal, atomSal], [molC, atomC])

        #Pone las coordenadas de la mezcla en una lista
        for p, mol in enumerate(H):
            molecule = H.getMolecule(mol)
            for atom in molecule:
                coordinates = molecule.getAttributes(atom).getCoord()
                Coord.append(coordinates)

        #Te da los atomos que estan en la misma posicion
        for a, coord1 in enumerate(Coord):
            #print a,coord1
            for x, coord2 in enumerate(Coord):
                if a < x and math.fabs(
                        coord1[0] - coord2[0]) < TOLERANCE and math.fabs(
                            coord1[1] - coord2[1]) < TOLERANCE and math.fabs(
                                coord1[2] - coord2[2]) < TOLERANCE:
                    overlapAtoms.append(a)
                    overlapAtoms.append(x)
                    toEliminate.append(x)

        #Te dice los vecinos de los atomos
        for mol in H:
            molecule = H.getMolecule(mol)
            for i in range(len(overlapAtoms) / 2):
                vecinos = molecule.neighbors(overlapAtoms[2 * i + 1] + 1)
                #atomNeighbors.append(overlapAtoms[2*i+1]+1)
                atomNeighbors.append(vecinos)

        G = H.copy()

        for p, mol in enumerate(G):
            molecule = G.getMolecule(mol)
            for i, j in enumerate(atomNeighbors):
                #print i, len(j), j[0]

                mol1 = mol
                atom1 = molecule.atom(overlapAtoms[2 * i])
                #print atom1, "atomo 1", i
                if len(j) == 1:
                    atom2 = molecule.atom(j[0] - 1)
                    #print j[0]
                    #print atom2, atom1
                    H.addBond([mol1, atom1], [mol1, atom2])
                elif len(j) == 2:
                    atom2A = molecule.atom(j[0] - 1)
                    atom2B = molecule.atom(j[1] - 1)
                    H.addBond([mol1, atom1], [mol1, atom2A])
                    H.addBond([mol1, atom1], [mol1, atom2B])

        #toEliminate.sort()
        G = H.copy()
        #print "a Eliminarse", toEliminate

        toEliminate = sorted(set(toEliminate))

        #Busca el indice del atomo Na
        for p, mol in enumerate(G):
            molecule = G.getMolecule(mol)
            for idx, atom1 in enumerate(molecule):
                if molecule.getAttributes(
                        atom1).getInfo().getElement() == "NA":
                    idxNa = idx + 1

        #Elimina los atomos 'repetidos' y el atomo de Na
        for p, mol in enumerate(G):
            molecule = G.getMolecule(mol)
            for i in reversed(toEliminate):
                #print i+1
                molecule.removeAtom(i + 1)
            molecule.removeAtom(idxNa)

        Molecule.__init__(self, "Diamond", next(G.moleculeGenerator()))

        # Fix atom types
        for atom in self:
            N = len(self.neighbors(atom))
            if N == 4:
                self.getAtomAttributes(atom).getInfo().setType("C")
            if N == 1:
                self.getAtomAttributes(atom).getInfo().setType("C2")
            if N == 2:
                self.getAtomAttributes(atom).getInfo().setType("C3")

        self.getForceField().setBond(('C', 'C'), 222., NonBond._EPSILON)
        self.getForceField().setBond(('C', 'C'), 1.512, NonBond._SIGMA)
Beispiel #19
0
	def _processFirstFrame(self):
		"""
		Gets the first pybel Molecule and puts its Wolffia equivalent Mixture in self.currentMolecule.
		Returns the first frame.
		Raises whichever exception that pybel throws (probably StopIteration).
		"""
		
		mol = next(self.molIterator)
		chemicalGraphMixed = ChemicalGraph()
		etable			 = openbabel.OBElementTable()

		
		n = 0
		for atom in mol.atoms:
			atomType = atom.OBAtom.GetResidue().GetAtomID(atom.OBAtom)
			symbol = etable.GetSymbol(atom.atomicnum)
			coords = list(atom.coords)
			name	 = etable.GetName(atom.atomicnum) 
			residue = atom.OBAtom.GetResidue().GetName()
			psfType = atom.OBAtom.GetResidue().GetAtomID(atom.OBAtom).strip()
			#print "_processFirstFrame: '" + psfType + "'"
			charge = atom.partialcharge
			mass	 = atom.atomicmass	
			if self.psf != None:
				psfType = self.psf.getType(n)
				charge = self.psf.getCharge(n)
				mass	 = self.psf.getMass(n)
				print("CoordinateFile _processFirstFrame charge  ", charge)
		
		
			ai  = AtomInfo(atomType, symbol, psfType, charge, mass, 1, 1, 1, name, residue)
			atr = AtomAttributes(ai, coords, [])
			chemicalGraphMixed.add_node(n + 1, attrs=[atr])
			n += 1
		
		# add edges
		print('_processFirstFrame add edges')
		if self.psf != None:
			for b in self.psf.bonds:
				try:  # avoids adding an edge twice
					chemicalGraphMixed.add_edge(b)
				except AdditionError:
					pass			
			if len(mol.atoms) != len(self.psf.atoms):
				raise MixtureError("Amount of atoms in " + self.fileName + " and psf File files are different (" + str(len(self.atoms)) + " vs " + str(len(self.psf.atoms)) + ").")
		else:			
			for bond in openbabel.OBMolBondIter(mol.OBMol):   
				chemicalGraphMixed.add_edge([bond.GetBeginAtom().GetIdx(), bond.GetEndAtom().GetIdx()])	   
					
		molecules = list(chemicalGraphMixed.connectedComponents())
		self.currentMolecule = Mixture()
		
		#print '_processFirstFrame Añadir'+  str(list(molecules)) + ' moléculas a mezcla:  ', 
		if len(molecules) == 1:
			self.currentMolecule.add(Molecule(self.mixtureName, molecule=molecules[0]))
		else:
			n = 0
			for m in molecules:
				self.currentMolecule.add(
							Molecule(self.mixtureName + "(" + str(n) + ")", molecule=m),
							checkForInconsistentNames=False)
				n += 1

		return self.currentMolecule
Beispiel #20
0
    def __init__(self):
        Molecule.__init__(self, "SDS")

        #print NANOCAD_PDB_DIR + "/Solvents/THF.pdb" , NANOCAD_PDB_DIR + "/Solvents/THF.psf"
        self.load(NANOCAD_PDB_DIR + "/Surfactant/SDS.pdb",
                  NANOCAD_PDB_DIR + "/Surfactant/SDS.psf")