Esempio n. 1
0
""" test run for gromacs calculator """

import unittest

from ase.calculators.gromacs import Gromacs

g = Gromacs()
if g.command is None:
    raise unittest.SkipTest(getattr(g, "missing_gmx", "missing gromacs"))

GRO_INIT_FILE = 'hise_box.gro'

# write structure file
with open(GRO_INIT_FILE, 'w') as outfile:
    outfile.write("""HISE for testing
   20
    3HISE     N    1   1.966   1.938   1.722
    3HISE    H1    2   2.053   1.892   1.711
    3HISE    H2    3   1.893   1.882   1.683
    3HISE    H3    4   1.969   2.026   1.675
    3HISE    CA    5   1.939   1.960   1.866
    3HISE    HA    6   1.934   1.869   1.907
    3HISE    CB    7   2.055   2.041   1.927
    3HISE   HB1    8   2.141   2.007   1.890
    3HISE   HB2    9   2.043   2.137   1.903
    3HISE   ND1   10   1.962   2.069   2.161
    3HISE    CG   11   2.065   2.032   2.077
    3HISE   CE1   12   2.000   2.050   2.287
    3HISE   HE1   13   1.944   2.069   2.368
    3HISE   NE2   14   2.123   2.004   2.287
    3HISE   HE2   15   2.177   1.981   2.369
Esempio n. 2
0
infile_name = sys.argv[1]

CALC_MM_RELAX = Gromacs(init_structure_file=infile_name,
                        structure_file='gromacs_mm-relax.g96',
                        force_field='oplsaa',
                        water_model='tip3p',
                        base_filename='gromacs_mm-relax',
                        doing_qmmm=False,
                        freeze_qm=True,
                        index_filename='index.ndx',
                        extra_mdrun_parameters=' -nt 1 ',
                        define='-DFLEXIBLE',
                        integrator='cg',
                        nsteps='10000',
                        nstfout='10',
                        nstlog='10',
                        nstenergy='10',
                        nstlist='10',
                        ns_type='grid',
                        pbc='xyz',
                        rlist='1.15',
                        coulombtype='PME-Switch',
                        rcoulomb='0.8',
                        vdwtype='shift',
                        rvdw='0.8',
                        rvdw_switch='0.75',
                        DispCorr='Ener')
CALC_MM_RELAX.generate_topology_and_g96file()
CALC_MM_RELAX.generate_gromacs_run_file()
CALC_MM_RELAX.run()
Esempio n. 3
0
infile_name = sys.argv[1]

CALC_MM_RELAX = Gromacs(
    init_structure_file=infile_name,
    structure_file = 'gromacs_mm-relax.g96',
    force_field='oplsaa', 
    water_model='tip3p',    
    base_filename = 'gromacs_mm-relax',
    doing_qmmm = False, freeze_qm = True,
    index_filename = 'index.ndx',
    extra_mdrun_parameters = ' -nt 1 ',
    define = '-DFLEXIBLE',
    integrator = 'cg',
    nsteps = '10000',
    nstfout = '10',
    nstlog = '10',
    nstenergy = '10',
    nstlist = '10',
    ns_type = 'grid',
    pbc = 'xyz',
    rlist = '1.15',
    coulombtype = 'PME-Switch',
    rcoulomb = '0.8',
    vdwtype = 'shift',
    rvdw = '0.8',
    rvdw_switch = '0.75',
    DispCorr = 'Ener')
CALC_MM_RELAX.generate_topology_and_g96file()
CALC_MM_RELAX.generate_gromacs_run_file()
CALC_MM_RELAX.run()
Esempio n. 4
0
                species_dir = SPECIES_DIR,
                run_command = RUN_COMMAND)
CALC_QM3.set(output = 'hirshfeld')

CALC_MM = Gromacs(
    init_structure_file = infile_name,
    structure_file = 'gromacs_qm.g96', \
    force_field = 'oplsaa', 
    water_model = 'tip3p',
    base_filename = 'gromacs_qm',
    doing_qmmm = True, freeze_qm = False,
    index_filename = 'index.ndx',
    define = '-DFLEXIBLE',
    integrator = 'md',
    nsteps = '0',
    nstfout = '1',
    nstlog = '1',
    nstenergy = '1',
    nstlist = '1',
    ns_type = 'grid',
    pbc = 'xyz',
    rlist = '1.15',
    coulombtype = 'PME-Switch',
    rcoulomb = '0.8',
    vdwtype = 'shift',
    rvdw = '0.8',
    rvdw_switch = '0.75',
    DispCorr = 'Ener')
CALC_MM.generate_topology_and_g96file()
CALC_MM.generate_gromacs_run_file()

CALC_QMMM = AseQmmmManyqm(nqm_regions = 3, 
Esempio n. 5
0
def test_gromacs():
    g = Gromacs()
    if g.command is None:
        raise unittest.SkipTest(getattr(g, "missing_gmx", "missing gromacs"))

    GRO_INIT_FILE = 'hise_box.gro'

    # write structure file
    with open(GRO_INIT_FILE, 'w') as outfile:
        outfile.write(data)

    CALC_MM_RELAX = Gromacs(force_field='charmm27',
                            define='-DFLEXIBLE',
                            integrator='cg',
                            nsteps='10000',
                            nstfout='10',
                            nstlog='10',
                            nstenergy='10',
                            nstlist='10',
                            ns_type='grid',
                            pbc='xyz',
                            rlist='0.7',
                            coulombtype='PME-Switch',
                            rcoulomb='0.6',
                            vdwtype='shift',
                            rvdw='0.6',
                            rvdw_switch='0.55',
                            DispCorr='Ener')
    CALC_MM_RELAX.set_own_params_runs('init_structure', GRO_INIT_FILE)
    CALC_MM_RELAX.generate_topology_and_g96file()
    CALC_MM_RELAX.write_input()
    CALC_MM_RELAX.generate_gromacs_run_file()
    CALC_MM_RELAX.run()
    atoms = CALC_MM_RELAX.get_atoms()
    final_energy = CALC_MM_RELAX.get_potential_energy(atoms)

    # e.g., -4.17570101 eV = -402.893902 kJ / mol by Gromacs 2019.1 double precision
    final_energy_ref = -4.175
    tolerance = 0.010
    assert abs(final_energy - final_energy_ref) < tolerance
Esempio n. 6
0
 def calc(self, **kwargs):
     from ase.calculators.gromacs import Gromacs
     return Gromacs(command=self.executable, **kwargs)
Esempio n. 7
0
outfile.write('    3HISE     C   18   1.806   2.032   1.888 \n')
outfile.write('    3HISE   OT1   19   1.736   2.000   1.987 \n')
outfile.write('    3HISE   OT2   20   1.770   2.057   2.016 \n')
outfile.write('   4.00000   4.00000   4.00000 \n')
outfile.close()


CALC_MM_RELAX = Gromacs(force_field='charmm27',
    define = '-DFLEXIBLE',
    integrator = 'cg',
    nsteps = '10000',
    nstfout = '10',
    nstlog = '10',
    nstenergy = '10',
    nstlist = '10',
    ns_type = 'grid',
    pbc = 'xyz',
    rlist = '0.7',
    coulombtype = 'PME-Switch',
    rcoulomb = '0.6',
    vdwtype = 'shift',
    rvdw = '0.6',
    rvdw_switch = '0.55',
    DispCorr = 'Ener')
CALC_MM_RELAX.set_own_params_runs(
    'init_structure', 'hise_box.gro')
CALC_MM_RELAX.generate_topology_and_g96file()
CALC_MM_RELAX.write_input()
CALC_MM_RELAX.generate_gromacs_run_file()
CALC_MM_RELAX.run()
atoms = CALC_MM_RELAX.get_atoms()
Esempio n. 8
0
""" An example for using gromacs calculator in ase.
    Atom positions are relaxed.
    A sample call:

   python ./gromacs_example_mm_relax.py his.pdb
"""

from ase.calculators.gromacs import Gromacs

import sys
from ase.io import read

infile_name = sys.argv[1]

CALC_MM_RELAX = Gromacs(clean=True)
CALC_MM_RELAX.set_own_params_runs(
    'extra_pdb2gmx_parameters','-ignh')
CALC_MM_RELAX.set_own_params_runs(
    'init_structure',infile_name)
CALC_MM_RELAX.generate_topology_and_g96file()
CALC_MM_RELAX.write_input()
CALC_MM_RELAX.set_own_params_runs(
    'extra_editconf_parameters','-bt cubic -c -d 0.8')
CALC_MM_RELAX.run_editconf()
CALC_MM_RELAX.set_own_params_runs(
    'extra_genbox_parameters','-cs spc216.gro')
CALC_MM_RELAX.run_genbox()
CALC_MM_RELAX.generate_gromacs_run_file()
CALC_MM_RELAX.run()
Esempio n. 9
0
""" An example for using gromacs calculator in ase.
    Atom positions are relaxed.
    A sample call:

   python ./gromacs_example_mm_relax.py his.pdb
"""

from ase.calculators.gromacs import Gromacs

import sys
from ase.io import read

infile_name = sys.argv[1]

CALC_MM_RELAX = Gromacs(clean=True)
CALC_MM_RELAX.set_own_params_runs('extra_pdb2gmx_parameters', '-ignh')
CALC_MM_RELAX.set_own_params_runs('init_structure', infile_name)
CALC_MM_RELAX.generate_topology_and_g96file()
CALC_MM_RELAX.write_input()
CALC_MM_RELAX.set_own_params_runs('extra_editconf_parameters',
                                  '-bt cubic -c -d 0.8')
CALC_MM_RELAX.run_editconf()
CALC_MM_RELAX.set_own_params_runs('extra_genbox_parameters', '-cs spc216.gro')
CALC_MM_RELAX.run_genbox()
CALC_MM_RELAX.generate_gromacs_run_file()
CALC_MM_RELAX.run()
Esempio n. 10
0
""" test run for gromacs calculator """

from ase.test import NotAvailable

from ase.calculators.gromacs import Gromacs

if Gromacs().get_command() is None:
    raise NotAvailable('Gromacs required')

import sys, os, glob
from ase.io import read, write

GRO_INIT_FILE = 'hise_box.gro'

#write structure file 
outfile=open('hise_box.gro','w')
outfile.write('HISE for testing  \n')
outfile.write('   20 \n')
outfile.write('    3HISE     N    1   1.966   1.938   1.722 \n')
outfile.write('    3HISE    H1    2   2.053   1.892   1.711 \n')
outfile.write('    3HISE    H2    3   1.893   1.882   1.683 \n')
outfile.write('    3HISE    H3    4   1.969   2.026   1.675 \n')
outfile.write('    3HISE    CA    5   1.939   1.960   1.866 \n')
outfile.write('    3HISE    HA    6   1.934   1.869   1.907 \n')
outfile.write('    3HISE    CB    7   2.055   2.041   1.927 \n')
outfile.write('    3HISE   HB1    8   2.141   2.007   1.890 \n')
outfile.write('    3HISE   HB2    9   2.043   2.137   1.903 \n')
outfile.write('    3HISE   ND1   10   1.962   2.069   2.161 \n')
outfile.write('    3HISE    CG   11   2.065   2.032   2.077 \n')
outfile.write('    3HISE   CE1   12   2.000   2.050   2.287 \n')
outfile.write('    3HISE   HE1   13   1.944   2.069   2.368 \n')