예제 #1
0
def manager_bmim():
    manager = Manager.from_files(BMIMBF4_SYS, BMIM_CG_ITP, BF4_CG_ITP)
    bmim = Molecule.from_files(BMIM_AA_GRO, BMIM_AA_ITP)
    bf4 = Molecule.from_files(BF4_AA_GRO, BF4_AA_ITP)

    manager.molecule_correspondence['BMIM'].end = bmim
    manager.molecule_correspondence['BF4'].end = bf4

    return manager
예제 #2
0
 def test_init_from_files(self):
     """
     Test the molecule initialization from files.
     """
     fitp = os.path.join(ACTUAL_PATH, '../../gaddlemaps/data/BMIM_AA.itp')
     fgro = os.path.join(ACTUAL_PATH, '../../gaddlemaps/data/BMIM_AA.gro')
     bmim = Molecule.from_files(fgro, fitp)
     assert len(bmim) == 25
     fitp = os.path.join(ACTUAL_PATH, '../../gaddlemaps/data/BMIM_CG.itp')
     fgro = os.path.join(ACTUAL_PATH, '../../gaddlemaps/data/system_bmimbf4_cg.gro')
     with pytest.raises(IOError):
         bmim = Molecule.from_files(fgro, fitp)
예제 #3
0
# Now, we need to specify the molecules in the final resolution (AA). In this
# example, we initialize two instances of Molecule, one for the BMIM molecule
# and other for the BF4 one. For this task, we create a System object with the
# gro and the corresponding topology files. Then, we take the first element of
# these systems which are the desired molecules (as the input gro files only
# contain one molecule).

bmim_aa = System('../../gaddlemaps/data/BMIM_AA.gro',
                 '../../gaddlemaps/data/BMIM_AA.itp')[0]
bf4_aa = System('../../gaddlemaps/data/BF4_AA.gro',
                '../../gaddlemaps/data/BF4_AA.itp')[0]

# We could also have created these molecules with the Molecule.from_file method

bmim_aa = Molecule.from_files('../../gaddlemaps/data/BMIM_AA.gro',
                              '../../gaddlemaps/data/BMIM_AA.itp')
bf4_aa = Molecule.from_files('../../gaddlemaps/data/BF4_AA.gro',
                             '../../gaddlemaps/data/BF4_AA.itp')

# Once the molecules are created, we need to specify which one correspond with
# the molecules in the initial resolution. For that, we have 2 options. First,
# we can use the add_end_molecules method of Manager, which will automatically
# detect the corresponding molecules based on their names attribute.

manager.add_end_molecules(bmim_aa, bf4_aa)

# The second option is to assign the molecules manually. For this, we have to
# access the element with the correct name in molecule_correspondence attribute
# and set the "end" attribute. This option has the advantage that it is not
# necessary that the molecules have the same name in both resolution.
예제 #4
0
# need a representation for each type of molecules in both initial and final
# resolution. For the initial resolution we can take them from the already
# loaded system. For the final resolution we need to load new `Molecule`
# objects. Once we have all the requirements we are going to use the
# `Alignment` class to deal with the process of finding the optimal mapping.
# Lets see how to proceed:

from gaddlemaps import Alignment
from gaddlemaps.components import Molecule

# Initial resolution molecules
# Check the order in different_molecules before the assignment
dna_initial, vte_initial, dpsm_initial = system.different_molecules

# Load final resolution molecules
dna_final = Molecule.from_files(DATA_FILES_PATH['DNA_AA.gro'],
                                DATA_FILES_PATH['DNA_AA.itp'])
dpsm_final = Molecule.from_files(DATA_FILES_PATH['DPSM_AA.gro'],
                                 DATA_FILES_PATH['DPSM_AA.itp'])
vte_final = Molecule.from_files(DATA_FILES_PATH['VTE_AA.gro'],
                                DATA_FILES_PATH['VTE_AA.itp'])

# Initialize the alignments
dna_align = Alignment(start=dna_initial, end=dna_final)
dpsm_align = Alignment(start=dpsm_initial, end=dpsm_final)
vte_align = Alignment(start=vte_initial, end=vte_final)

# Take into account that in the initialization of the `Alignment` objects you
# can set whichever molecule you want as end resolution. This opens the door to
# use gaddlemaps to change molecules in your system. For example change a
# membrane of POPC with one of PCCP keeping the configuration of the initial
# molecules. Now we need to align molecules in both resolution to finally