コード例 #1
0
class CLF4(Molecule):
    _FORCE_FIELD = None
    ai1 = AtomInfo("CH", "C", "CH", 0.42, 12.0107, 0.0, 1.0, ' ', "C24 ",
                   "CLF", "A", 1)
    #ai1 = AtomInfo("CH", "C", "CH",    0.2659, 12.0107,  0.0, 1.0, ' ', "C24 ", "CLF", "A", 1)
    ai2 = AtomInfo("CL1", "CL", "CL", -0.14, 35.453, 0.0, 1.0, ' ', "CL1 ",
                   "CLF", "A", 1)
    ai3 = AtomInfo("CL2", "CL", "CL", -0.14, 35.453, 0.0, 1.0, ' ', "CL2 ",
                   "CLF", "A", 1)
    ai4 = AtomInfo("CL3", "CL", "CL", -0.14, 35.453, 0.0, 1.0, ' ', "CL3 ",
                   "CLF", "A", 1)

    #ai4 = AtomInfo("CL3", "CL", "CL", 0.0396, 35.453,   0.0, 1.0, ' ', "CL3 ", "CLF", "A", 1)

    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()
コード例 #2
0
class WATER(Molecule):
    _FORCE_FIELD = None
    otObj = AtomInfo("OT", "O", "OT", -0.834, 15.9994, 0.0, 1.0, ' ', "OT  ",
                     "WAT", "A", 1)
    htObj = AtomInfo("HT1", "H", "HT", 0.417, 1.00794, 0.0, 1.0, ' ', "HT ",
                     "WAT", "A", 1)

    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()
コード例 #3
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()
コード例 #4
0
class Na(Molecule):
    _FORCE_FIELD = None
    ai = AtomInfo("NA", "NA", "NA", 1., 22.9898, 0.0, 1.0, ' ', "NA ", "NA",
                  "A", 1)

    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()
コード例 #5
0
class Element(Molecule):
    _FORCE_FIELD_PARAMETERS = {  # reference
        "H": [-0.03, 1.3582],
        "B": [-.0100, 2.085],  # (1)
        "HE": [-.0100, 2.495],  # (1)
        "KR": [-.0100, 3.599],  # (1)
        "RN": [-.0100, 4.009],  # (1)
        "SE": [-.0430, 3.510],  # (1)
        "AT": [-.3200, 3.884],  # (1)
        "BR": [-.3200, 3.884],  # (1)
        "XE": [-.0100, 3.849],  # (1)
        "I": [-.8000, 3.635],  # (1)
        "AL": [-.2500, 4.740],  # (1)
        "AS": [-.0600, 3.564],  # (1)
        "BA": [-.1600, 3.385],  # (1)
        "BE": [-.0030, 1.960],  # (1)
        "CA": [-.0600, 3.107],  # (1)
        "CS": [-.0045, 5.183],  # (1)
        "CU": [-.0600, 2.459],  # (1)
        "FE": [-.0200, 2.610],  # (1)
        "GE": [-.0450, 3.029],  # (1)
        "K": [-.0100, 4.187],  # (1)
        "LI": [-.0070, 2.202],  # (1)
        "MG": [-.0450, 2.564],  # (1)
        "MN": [-.7000, 2.851],  # (1)
        "NI": [-.0500, 1.782],  # (1)
        "PD": [-.0100, 2.388],  # (1)
        "PT": [-.0100, 2.370],  # (1)
        "RB": [-.0065, 4.741],  # (1)
        "RH": [-.0250, 2.797],  # (1)
        "RU": [-.0250, 2.940],  # (1)
        "SI": [-.3100, 4.455],  # (1)
        "SN": [-.0450, 3.385],  # (1)
        "SR": [-.1719, 3.523],  # (1)
        "YB": [-.0600, 3.127],  # (1)
        "ZN": [-.2500, 1.942],  # (1)
        "ZR": [-.0100, 3.617],  # (1)
        "C": [-0.032, 2.0],
        "N": [-0.18, 1.79],
        "O": [-0.12, 1.7],
        "F": [-.1000, 2.029],  # (1)
        "NA": [-0.1153, 2.275],
        "P": [-0.585, 2.15],
        "S": [-0.565, 2.05],
        "CL": [-0.3002, 1.735],
        "AR": [-.01, 3.35],
        "AU": [-0.53537, 3.2]
    }

    _ATTRIBUTES = {
        "H":
        AtomAttributes(
            AtomInfo("H", "H", "H", 0.417, 1.00794, 0.0, 1.0, ' ', "H", "ELT",
                     "A", 1), [0., 0., 0.]),
        "O":
        AtomAttributes(
            AtomInfo("O", "O", "O", -0.834, 15.9994, 0.0, 1.0, ' ', "O", "ELT",
                     "A", 1), [0., 0., 0.]),
        "C":
        AtomAttributes(
            AtomInfo("C", "C", "C", 0.147156, 12.0107, 1.0, 1.0, ' ', "C",
                     "ELT", "A", 1), [0., 0., 0.]),
        "F":
        AtomAttributes(
            AtomInfo("F", "F", "F", -1, 18.9984032, 1.0, 1.0, ' ', "F", "ELT",
                     "A", 1), [0., 0., 0.]),
        "N":
        AtomAttributes(
            AtomInfo("N", "N", "N", -0.341313, 14.0067, 1.0, 1.0, ' ', "N",
                     "ELT", "A", 1), [0., 0., 0.]),
        "NA":
        AtomAttributes(
            AtomInfo("NA", "NA", "NA", 1.0, 22.98977, 1.0, 1.0, ' ', "NA",
                     "ELT", "A", 1), [0., 0., 0.]),
        "P":
        AtomAttributes(
            AtomInfo("P", "P", "P", 0.39354, 30.9738, 1.0, 1.0, ' ', "P",
                     "ELT", "A", 1), [0., 0., 0.]),
        "S":
        AtomAttributes(
            AtomInfo("S", "S", "S", 0.0, 32.065, 1.0, 1.0, ' ', "S", "ELT",
                     "A", 1), [0., 0., 0.]),
        "CL":
        AtomAttributes(
            AtomInfo("CL", "CL", "CL", -0.14, 35.453, 0.0, 1.0, ' ', "CL",
                     "ELT", "A", 1), [0., 0., 0.]),
        "AR":
        AtomAttributes(
            AtomInfo("AR", "AR", "AR", 0.0, 39.9500, 0.0, 1.0, ' ', "O", "ELT",
                     "A", 1), [0., 0., 0.]),
        "AU":
        AtomAttributes(
            AtomInfo("AU", "AU", "AU", 0.0, 96.96657, 0.0, 1.0, ' ', "AU",
                     "ELT", "A", 1), [0., 0., 0.])
    }
    _ENAME_TO_SYMBOL = {
        "Argon": "AR",
        "Carbon": "C",
        "Chlorine": "CL",
        "Hydrogen": "H",
        "Fluorine": "F",
        "Gold": "AU",
        "Nitrogen": "N",
        "Oxygen": "O",
        "Phosphorous": "P",
        "Sodium": "NA",
        "Sulfur": "S"
    }

    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)
        #self.copyChargesToForceField()

    @staticmethod
    def nameToSymbol(ename):
        return Element._ENAME_TO_SYMBOL[ename]
コード例 #6
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
コード例 #7
0
class DMF(Molecule):
    _FORCE_FIELD = None
    ai1 = AtomInfo("N1", "N", "N1", 0.509, 14.0067, 0.0, 1.0, ' ', "N1  ",
                   "XXX", "A", 1)
    ai2 = AtomInfo("C1", "C", "C1", 0.509, 12.011, 0.0, 1.0, ' ', "C1  ",
                   "XXX", "A", 1)
    ai3 = AtomInfo("O1", "O", "O1", -0.514, 15.9994, 0.0, 1.0, ' ', "O1  ",
                   "XXX", "A", 1)
    ai4 = AtomInfo("C2", "C", "C2", 0.509, 12.011, 0.0, 1.0, ' ', "C2  ",
                   "XXX", "A", 1)
    ai5 = AtomInfo("C3", "C", "C3", 0.509, 12.011, 0.0, 1.0, ' ', "C3  ",
                   "XXX", "A", 1)
    ai6 = AtomInfo("H1", "H", "H1", 1.0, 1.0079, 0.0, 1.0, ' ', "H1  ", "XXX",
                   "A", 1)
    ai7 = AtomInfo("H2", "H", "H2", 1.0, 1.0079, 0.0, 1.0, ' ', "H2  ", "XXX",
                   "A", 1)
    ai8 = AtomInfo("H3", "H", "H3", 1.0, 1.0079, 0.0, 1.0, ' ', "H3  ", "XXX",
                   "A", 1)
    ai9 = AtomInfo("H4", "H", "H4", 1.0, 1.0079, 0.0, 1.0, ' ', "H4  ", "XXX",
                   "A", 1)
    ai10 = AtomInfo("H5", "H", "H5", 1.0, 1.0079, 0.0, 1.0, ' ', "H5  ", "XXX",
                    "A", 1)
    ai11 = AtomInfo("H6", "H", "H6", 1.0, 1.0079, 0.0, 1.0, ' ', "H6  ", "XXX",
                    "A", 1)
    ai12 = AtomInfo("H7", "H", "H7", 1.0, 1.0079, 0.0, 1.0, ' ', "H7  ", "XXX",
                    "A", 1)

    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()
コード例 #8
0
class THF(Molecule):
    _FORCE_FIELD = None
    atr1 = AtomInfo("C2", "C", "C2", -0.012, 14.0270, 0.0, 1.0, ' ', "CAA",
                    "THF", "A", 1)
    atr2 = AtomInfo("HA", "H", "HA", 0.0, 1.0079, 0.0, 1.0, ' ', "HAA", "THF",
                    "A", 1)
    atr3 = AtomInfo("HB", "H", "HB", 0.0, 1.0079, 0.0, 1.0, ' ', "HAB", "THF",
                    "A", 1)
    atr4 = AtomInfo("C3", "C", "C3", 0.011, 14.0270, 0.0, 1.0, ' ', "CAE",
                    "THF", "A", 1)
    atr5 = AtomInfo("HG", "H", "HG", 0.0, 1.0079, 0.0, 1.0, ' ', "HAG", "THF",
                    "A", 1)
    atr6 = AtomInfo("HH", "H", "HH", 0.0, 1.0079, 0.0, 1.0, ' ', "HAH", "THF",
                    "A", 1)
    atr7 = AtomInfo("C4", "C", "C4", 0.081, 14.0270, 0.0, 1.0, ' ', "CAD",
                    "THF", "A", 1)
    atr8 = AtomInfo("HE", "H", "HE", 0.0, 1.0079, 0.0, 1.0, ' ', "HAE", "THF",
                    "A", 1)
    atr9 = AtomInfo("HF", "H", "HF", 0.0, 1.0079, 0.0, 1.0, ' ', "HAF", "THF",
                    "A", 1)
    atr10 = AtomInfo("O", "O", "O", -0.139, 15.9994, 0.0, 1.0, ' ', "OAC",
                     "THF", "A", 1)
    atr11 = AtomInfo("C1", "C", "C1", 0.081, 14.0270, 0.0, 1.0, ' ', "CAB",
                     "THF", "A", 1)
    atr12 = AtomInfo("HD", "H", "HD", 0.0, 1.0079, 0.0, 1.0, ' ', "HAD", "THF",
                     "A", 1)
    atr13 = AtomInfo("HC", "H", "HC", 0.0, 1.0079, 0.0, 1.0, ' ', "HAC", "THF",
                     "A", 1)

    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()