Esempio n. 1
0
import os
from pdbParser.pdbParser import pdbParser
from pdbParser.Utilities.Collection import get_path
from pdbParser.Utilities.Construct import AmorphousSystem
from pdbParser.Utilities.Geometry import get_satisfactory_records_indexes, translate, get_geometric_center
from pdbParser.Utilities.Modify import delete_records_and_models_records, reset_records_serial_number, reset_sequence_number_per_residue
from pdbParser.Utilities.Database import __WATER__

# read thf molecule and translate to the center
thfNAGMA = pdbParser(os.path.join(get_path("pdbparser"), "Data/NAGMA.pdb"))
center = get_geometric_center(thfNAGMA.indexes, thfNAGMA)
translate(thfNAGMA.indexes, thfNAGMA, -center)

# create pdbWATER
pdbWATER = pdbParser()
pdbWATER.records = __WATER__
pdbWATER.set_name("water")

# create amorphous
pdbWATER = AmorphousSystem(pdbWATER, boxSize=[40, 40, 40],
                           density=0.75).construct().get_pdb()
center = get_geometric_center(pdbWATER.indexes, pdbWATER)
translate(pdbWATER.indexes, pdbWATER, -center)

# make hollow
hollowIndexes = get_satisfactory_records_indexes(
    pdbWATER.indexes, pdbWATER, "np.sqrt(x**2 + y**2 + z**2) <= 10")
delete_records_and_models_records(hollowIndexes, pdbWATER)

# concatenate
thfNAGMA.concatenate(pdbWATER, pdbWATER.boundaryConditions)
Esempio n. 2
0
from pdbParser.pdbParser import pdbParser
from pdbParser.Utilities.Construct import AmorphousSystem
from pdbParser.Utilities.Database import __WATER__
from pdbParser.Utilities.Geometry import translate, get_center

# create pdbWATER of a single molecule of water
pdbWATER = pdbParser()
pdbWATER.records = __WATER__
pdbWATER.set_name("water")

# create amorphous water box
pdbWATER = AmorphousSystem(pdbWATER, density=1,
                           boxSize=[10, 10, 10]).construct().get_pdb()

# translate water box to center
translate(pdbWATER.indexes, pdbWATER, -get_center(pdbWATER.indexes, pdbWATER))

# export water box
pdbWATER.export_pdb("waterBox.pdb")
Esempio n. 3
0
from pdbParser.Utilities.Modify import delete_records_and_models_records

from pdbParser.Utilities.Database import __WATER__

# create pdbWATER
pdbWATER = pdbParser()
pdbWATER.records = __WATER__
pdbWATER.set_name("water")

Logger.info("Create water box")
pdbWATER = AmorphousSystem(pdbWATER, density = 0.5).construct().get_pdb()
pdbWATERhollow = pdbWATER.get_copy()

# make sphere
Logger.info("Create a water sphere of 15A radius")
sphereIndexes = get_satisfactory_records_indexes(pdbWATER.indexes, pdbWATER, "np.sqrt(x**2 + y**2 + z**2) >= 15")
delete_records_and_models_records(sphereIndexes, pdbWATER)

# make hollow
Logger.info("Remove a water sphere of 15A radius")
hollowIndexes = get_satisfactory_records_indexes(pdbWATERhollow.indexes, pdbWATERhollow, "np.sqrt(x**2 + y**2 + z**2) <= 15")
delete_records_and_models_records(hollowIndexes, pdbWATERhollow)

# translate hollow
translate(pdbWATERhollow.indexes, pdbWATERhollow, vector =[60,0,0])

# concatenate
pdbWATER.concatenate(pdbWATERhollow)

pdbWATER.visualize()
Esempio n. 4
0
"""
Construct a graphene sheet in two orientations
"""
from pdbParser.log import Logger
from pdbParser import pdbParser
from pdbParser.Utilities.Geometry import translate
from pdbParser.Utilities.Construct import Sheet, Nanotube, MultipleWallNanotube

Logger.info("Constructing arm-chair sheet")
pdbGS_armchair = Sheet().construct().get_pdb()

Logger.info("Constructing zig-zag sheet")
pdbGS_zigzag = Sheet(orientation="zigzag").construct().pdb
translate(pdbGS_zigzag.indexes, pdbGS_zigzag, vector=[0, 0, 10])

Logger.info("Constructing carbon nanotube from scratch")
pdbCNT1 = Sheet(orientation="zigzag").construct().wrap().get_pdb()
translate(pdbCNT1.indexes, pdbCNT1, vector=[0, 40, 30])

Logger.info("constructing nanotube using appropriate class")
pdbCNT2 = Nanotube().construct().get_pdb()
translate(pdbCNT2.indexes, pdbCNT2, vector=[0, 10, 30])

Logger.info("constructing 5 walls multi-walled nanotube")
pdbMWNT = MultipleWallNanotube(
    wallsNumber=5,
    orientation=["armchair", "zig-zag", "zig-zag", "zig-zag",
                 "armchair"]).construct().get_pdb()
translate(pdbMWNT.indexes, pdbMWNT, vector=[0, 25, -40])

pdbALL = pdbGS_armchair
Esempio n. 5
0
Logger.info("Create selection")
# create selection
sel = NanotubeSelection(pdbCNT, nanotubeIndexes=cntIndexes).select()

Logger.info("Get models inside nanotube")
# construct models out of residues
indexes = get_models_records_indexes_by_records_indexes(
    sel.selections["inside_nanotube"], pdbCNT)

#indexes.extend(sel.selections["nanotube"])
pdb = pdbCNT.get_copy(cntIndexes + indexes)

# orient along X axis
Logger.info("Orient to OX and translate to nanotube center")
center, _, _, _, vect1, _, _ = get_principal_axis(cntIndexes, pdbCNT)
translate(pdb.indexes, pdb, -1. * np.array(center))
orient(axis=[1, 0, 0], indexes=pdb.indexes, pdb=pdb, records_axis=vect1)

# delete extra molecules
Logger.info(
    "Delete extra molecules to refine selection and reset models and records serial number"
)
#delete_records_by_sequence_number(26, pdb)
#delete_records_by_sequence_number(527, pdb)

Logger.info("Reset serial number and sequence identifier")
reset_records_serial_number(pdb)
reset_sequence_identifier_per_record(pdb)

# visualize
pdb.visualize()