Esempio n. 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()
Esempio n. 2
0
    def __init__(self, n):
        # initialize base class
        Homopolymer.__init__(self, n, "PMMA(" + str(n) + ")")

        PMMA._FORCE_FIELD = ForceField(self,
                                       NANOCAD_FORCE_FIELDS + "/PMMA.prm")

        self.setForceField(PMMA._FORCE_FIELD)
        self.copyChargesToForceField()
Esempio n. 3
0
    def __init__(self, n):
        global _FORCE_FIELD
        # initialize base class
        Homopolymer.__init__(self, n, "Chitosan(" + str(n) + ")")

        if Chitosan._FORCE_FIELD == None:
            Chitosan._FORCE_FIELD = ForceField(
                self, NANOCAD_FORCE_FIELDS + "/Chitosan.prm")
        self.setForceField(Chitosan._FORCE_FIELD)
        self.copyChargesToForceField()
Esempio n. 4
0
    def __init__(self,n):
        # initialize base class
        Homopolymer.__init__(self, n, "PolyTHY(" + str(n) +")")

        global _FORCE_FIELD
        #self.setForceField(_FORCE_FIELD)
        #self.copyChargesToForceField()
        if PolyTHY._FORCE_FIELD == None: 
            PolyTHY._FORCE_FIELD = ForceField(self, NANOCAD_FORCE_FIELDS + "/PolyTHY.prm")
        self.setForceField(PolyTHY._FORCE_FIELD )
        self.copyChargesToForceField()
Esempio n. 5
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()
Esempio n. 6
0
class Argon(Molecule):
    _FORCE_FIELD = ForceField("Argon", NANOCAD_FORCE_FIELDS + "/Argon.prm")

    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()
Esempio n. 7
0
 def on_loadButton_pressed(self):
     if self.selectedMolecule == None:
         errorgui = QtGui.QErrorMessage(self)
         errorgui.setModal(True) # blocks Wolffia
         errorgui.showMessage( "Please select a molecule by clicking on its name in the NONBONDED section.")
         return
 
     file1 = QtGui.QFileDialog.getOpenFileName(self, "Load a force field file", self.history.currentState().getBuildDirectory(), "*.prm")
     #print file +"***file***"
     if len(file1) > 0:
         self.history.push()
         for molName in self.history.currentState().mixture:
             molecule = self.history.currentState().mixture.getMolecule(molName)
             #print "on_loadButton_pressed changing ff of " , self.selectedMolecule , " ... checking ", molecule.molname()
             if molecule.molname() == self.selectedMolecule:
                 #print "       on_loadButton_pressed YES, changing ff of " , self.selectedMolecule
                 #molecule.getForceField().loadCHARMM(file1)
                 ff = ForceField()
                 ff.loadCHARMM(file1)
                 molecule.setForceField(ff)
                 #print "       on_loadButton_pressed ", molecule.getForceField(),molecule.getForceField()._NONBONDED
         self.update()
Esempio n. 8
0
	def __init__(self):
		Mixture.__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")

		#print "SDS ff", _FORCE_FIELD._NONBONDED
		#print "SDS a", NANOCAD_FORCE_FIELDS + "/SDS.prm"
		p1, p2 = [self.getMolecule(p) for p in self.molecules()]
		if p1.order() == 1:
			p1.rename("NA")
			SDS._FORCE_FIELD_NA = ForceField(p1, NANOCAD_FORCE_FIELDS + "/SDS.prm")
			p1.setForceField(SDS._FORCE_FIELD_NA )
			SDS._FORCE_FIELD_SDS = ForceField(p2, NANOCAD_FORCE_FIELDS + "/SDS.prm")
			p2.setForceField(SDS._FORCE_FIELD_SDS )
		else:
			p2.rename("NA")
			SDS._FORCE_FIELD_NA = ForceField(p2, NANOCAD_FORCE_FIELDS + "/SDS.prm")
			p2.setForceField(SDS._FORCE_FIELD_NA )
			SDS._FORCE_FIELD_SDS = ForceField(p1, NANOCAD_FORCE_FIELDS + "/SDS.prm")
			p1.setForceField(SDS._FORCE_FIELD_SDS )
		
		p1.copyChargesToForceField()
		p2.copyChargesToForceField()
Esempio n. 9
0
    def __init__(self, n, m, length):
        Hexagonal2D.__init__(self,
                             n,
                             m,
                             length,
                             element="C",
                             bondLength=1.3350,
                             mass=12.011)

        molname = "Graphene(" + str(n) + "," + str(n) + ")"

        if Graphene._FORCE_FIELD == None:
            Graphene._FORCE_FIELD = ForceField(
                self, NANOCAD_FORCE_FIELDS + "/CNT.prm")
        self.setForceField(Graphene._FORCE_FIELD)
Esempio n. 10
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()
Esempio n. 11
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()
Esempio n. 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()
Esempio n. 13
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)
Esempio n. 14
0
    along with this program (gpl.txt).  If not, see <http://www.gnu.org/licenses/>.

    Acknowledgements: The main funding source for this project has been provided
    by the UPR-Penn Partnership for Research and Education in Materials program, 
    USA National Science Foundation grant number DMR-0934195. 
"""
import sys, os
sys.path.append(
    os.path.dirname(os.path.realpath(__file__)) + '/../../../../conf')
from conf.Wolffia_conf import NANOCAD_PDB_DIR, NANOCAD_FORCE_FIELDS

from lib.chemicalGraph.molecule.Molecule import Molecule
from lib.chemicalGraph.molecule.ForceField import ForceField
from lib.chemicalGraph.molecule.AtomAttributes import AtomAttributes
#=========================================================================
_FORCE_FIELD = ForceField("SDSplusNA", NANOCAD_FORCE_FIELDS + "/SDSplusNA.prm")


class SDSplusNA(Molecule):
    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)


#==========================================================================
if __name__ == '__main__':
Esempio n. 15
0
    You should have received a copy of the GNU General Public License
    along with this program (gpl.txt).  If not, see <http://www.gnu.org/licenses/>.

    Acknowledgements: The main funding source for this project has been provided
    by the UPR-Penn Partnership for Research and Education in Materials program, 
    USA National Science Foundation grant number DMR-0934195. 
"""
import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__))+'/../../../../conf')
from conf.Wolffia_conf import NANOCAD_PDB_DIR, NANOCAD_FORCE_FIELDS

from lib.chemicalGraph.molecule.Molecule import Molecule
from lib.chemicalGraph.molecule.ForceField import ForceField
from lib.chemicalGraph.molecule.AtomAttributes import AtomAttributes
#=========================================================================
_FORCE_FIELD = ForceField("H2O2", NANOCAD_FORCE_FIELDS + "/H2O2.prm")
class H2O2(Molecule):
	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])
Esempio n. 16
0
    Acknowledgements: The main funding source for this project has been provided
    by the UPR-Penn Partnership for Research and Education in Materials program, 
    USA National Science Foundation grant number DMR-0934195. 
"""
import sys, os
sys.path.append(os.path.dirname(os.path.realpath(__file__))+'/../../../../conf')

from conf.Wolffia_conf import NANOCAD_FORCE_FIELDS
from lib.chemicalGraph.molecule.ForceField import ForceField
from lib.chemicalGraph.molecule.Molecule import Molecule
from lib.chemicalGraph.molecule.polymer.Homopolymer import Homopolymer
import math

#-----------------------------------------------------------------------------------

_FORCE_FIELD = ForceField("PVP", NANOCAD_FORCE_FIELDS + "/PVP.prm")

class PVP(Homopolymer):
    BACKBONE_MONOMER_PDB = '/Polymers/PVP/backbonePVP.pdb'
    START_MONOMER_PDB    = '/Polymers/PVP/startPVP.pdb'
    END_MONOMER_PDB      = '/Polymers/PVP/endPVP.pdb'
    ONE_MONOMER_PDB      = '/Polymers/PVP/onePVP.pdb'

    BACKBONE_MONOMER_PSF = '/Polymers/PVP/backbonePVP.psf'
    START_MONOMER_PSF    = '/Polymers/PVP/startPVP.psf'
    END_MONOMER_PSF      = '/Polymers/PVP/endPVP.psf'
    ONE_MONOMER_PSF      = '/Polymers/PVP/endPVP.psf'

    NUM_ATOMS_BACKBONE_MONOMER = 15
    NUM_ATOMS_START_MONOMER    = 16
    NUM_ATOMS_LAST_MONOMER     = 4
Esempio n. 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)
Esempio n. 18
0
    Acknowledgements: The main funding source for this project has been provided
    by the UPR-Penn Partnership for Research and Education in Materials program, 
    USA National Science Foundation grant number DMR-0934195. 
"""
import sys, os
sys.path.append(
    os.path.dirname(os.path.realpath(__file__)) + '/../../../../conf')
from conf.Wolffia_conf import NANOCAD_PDB_DIR, NANOCAD_FORCE_FIELDS
from lib.chemicalGraph.molecule.ForceField import ForceField
from lib.chemicalGraph.molecule.Molecule import Molecule

from lib.chemicalGraph.molecule.polymer.Polymer import Polymer
import math

#-----------------------------------------------------------------------------------
_FORCE_FIELD = ForceField(None, NANOCAD_FORCE_FIELDS + "/PANI.prm")


class PANI(Polymer):
    DISPL = 5.68
    ANGLE = 0


    MONOMERS_PDBS={ 'Rs':'/Polymers/PANI/startPANIred.pdb',\
    'Rb':'/Polymers/PANI/backbonePANIred.pdb',\
    'Re': '/Polymers/PANI/endPANIred.pdb',\
    'Os':'/Polymers/PANI/startPANIoxi.pdb',\
    'Ob':'/Polymers/PANI/backbonePANIoxi.pdb',\
    'Oe':'/Polymers/PANI/endPANIoxi.pdb'}
    MONOMERS_PSFS={ 'Rs':'/Polymers/PANI/startPANIred.psf',\
    'Rb':'/Polymers/PANI/backbonePANIred.psf',\
Esempio n. 19
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()