Esempio n. 1
0
    def setUp(self):
        self._atoms = Atoms()
        self._mcount = 5
        self._edge = 100.0

        x = np.linspace(-self._edge/2.0, self._edge/2.0, self._mcount)
        c = 0
        for i in x:
            for j in x:
                for k in x:
                    ch4 = molecule("CH4")
                    self._set_atoms_pos(ch4, (i,j,k))
                    self._atoms.extend(ch4)
                    c += 1
        
        Mixer.set_atom_ids(self._atoms)
Esempio n. 2
0
    def setUp(self):
        self._atoms = Atoms()
        self._mcount = 5
        self._edge = 100.0

        x = np.linspace(-self._edge / 2.0, self._edge / 2.0, self._mcount)
        c = 0
        for i in x:
            for j in x:
                for k in x:
                    ch4 = molecule("CH4")
                    self._set_atoms_pos(ch4, (i, j, k))
                    self._atoms.extend(ch4)
                    c += 1

        Mixer.set_atom_ids(self._atoms)
Esempio n. 3
0
 def test_calcbox_subset(self):
     cb = CalcBox(name="testbox", pos=(0., 0., 0.),
                  cutoff=0.0,
                  dim=(50.0, 50.0, 50.0))
     sa, srmap, sw = cb.select_atoms(self._atoms)
     correct_ids = set([307, 215, 405, 280, 281, 410, 155, 156, 285, 286,
         415, 160, 289, 290, 419, 165, 294, 455, 430, 432, 305, 306, 435,
         180, 414, 310, 439, 312, 185, 186, 315, 188, 190, 181, 193, 343,
         161, 457, 330, 311, 332, 205, 462, 335, 337, 210, 340, 213, 313,
         218, 314, 465, 444, 338, 437, 440, 318, 319, 460])
     self.assertEqual(set(Mixer.get_atom_ids(sa)), correct_ids)
Esempio n. 4
0
 def test_calcbox_moving_ch4(self):
     cb = CalcBox(name="testbox",
                  pos=(0., 0., 0.),
                  cutoff=2.0,
                  dim=(55.0, 55.0, 55.0),
                  debug=0)
     ch4 = [0, 1, 2, 3]  # these are atoms indexes and ids
     z = np.linspace(-self._edge / 2.0 - 25, self._edge / 2.0 + 25, 100)
     x = np.zeros_like(z)
     y = np.zeros_like(z)
     pos = np.column_stack((x, y, z))
     for i in range(len(pos)):
         self._set_molecule_pos(self._atoms, ch4, pos[i])
         sa, srmap, sw = cb.select_atoms(self._atoms)
         s_ids = set(Mixer.get_atom_ids(sa))
         all_ids = set(Mixer.get_atom_ids(self._atoms))
         inside_ids = s_ids.intersection(set(ch4))
         if not (len(inside_ids) == 0 or len(inside_ids) == 4):
             print("CH4 pos: %s" % pos[i])
             print("CH4 in selection: %s" % inside_ids)
Esempio n. 5
0
 def test_calcbox_moving_ch4(self):
     cb = CalcBox(name="testbox", pos=(0., 0., 0.),
                  cutoff=2.0,
                  dim=(55.0, 55.0, 55.0),
                  debug=0)
     ch4 = [0, 1, 2, 3] # these are atoms indexes and ids
     z = np.linspace(-self._edge/2.0 - 25, self._edge/2.0 + 25, 100)
     x = np.zeros_like(z)
     y = np.zeros_like(z)
     pos = np.column_stack((x, y, z))
     for i in range(len(pos)):
         self._set_molecule_pos(self._atoms,
                                ch4,
                                pos[i])
         sa, srmap, sw = cb.select_atoms(self._atoms)
         s_ids = set(Mixer.get_atom_ids(sa))
         all_ids = set(Mixer.get_atom_ids(self._atoms))
         inside_ids = s_ids.intersection(set(ch4))
         if not (len(inside_ids) == 0 or len(inside_ids) == 4):
             print("CH4 pos: %s" % pos[i])
             print("CH4 in selection: %s" % inside_ids)
Esempio n. 6
0
 def test_calcbox_subset(self):
     cb = CalcBox(name="testbox",
                  pos=(0., 0., 0.),
                  cutoff=0.0,
                  dim=(50.0, 50.0, 50.0))
     sa, srmap, sw = cb.select_atoms(self._atoms)
     correct_ids = set([
         307, 215, 405, 280, 281, 410, 155, 156, 285, 286, 415, 160, 289,
         290, 419, 165, 294, 455, 430, 432, 305, 306, 435, 180, 414, 310,
         439, 312, 185, 186, 315, 188, 190, 181, 193, 343, 161, 457, 330,
         311, 332, 205, 462, 335, 337, 210, 340, 213, 313, 218, 314, 465,
         444, 338, 437, 440, 318, 319, 460
     ])
     self.assertEqual(set(Mixer.get_atom_ids(sa)), correct_ids)
Esempio n. 7
0
from gpaw import GPAW
from gpaw.mpi import rank
from ase.data import s22

from multiasecalc.mixer.selector import AtomListSelector
from multiasecalc.mixer.mixer import Mixer, EnergyCalculation, ForceCalculation
from multiasecalc.lammps.reaxff import ReaxFF
from multiasecalc.utils import get_datafile

import numpy as np

dimer_name = "2-pyridoxine_2-aminopyridine_complex"

atoms = s22.create_s22_system(dimer_name)  # full system
atom_counts = s22.get_number_of_dimer_atoms(dimer_name)
Mixer.set_atom_ids(atoms)  # sequence of numbers in same order as positions
# were given above, index starts from 0

atoms_m1 = atoms[:atom_counts[0]]  # first molecule
atoms_m2 = atoms[atom_counts[0]:]  # second molecule

calc_gpaw = GPAW(nbands=-2, txt="h2_1.txt")
calc_reaxff = ReaxFF(ff_file_path=get_datafile("ffield.reax.new"),
                     implementation="C")
reaxff_cell = (100.0, 100.0, 100.0)
gpaw_cell = (10.0, 10.0, 10.0)

filter_full_system = AtomListSelector(
    range(len(atoms)), dict(zip(range(len(atoms)), [1.0] * len(atoms))))

filter_qm_region = AtomListSelector(
Esempio n. 8
0
from multiasecalc.mixer.mixer import Mixer, EnergyCalculation, ForceCalculation
from multiasecalc.lammps.reaxff import ReaxFF
from multiasecalc.utils import get_datafile

import numpy as np

d = 0.76470
#d = 1.5
a = 6.0

atoms = Atoms("H2",
                positions = [(0, 0, 0),
                (0, 0, d)],
                cell = (10*a, 10*a, 10*a))

Mixer.set_atom_ids(atoms) # sequence of numbers in same order as positions
                          # were given above, index starts from 0

calc_gpaw = GPAW(nbands=2, txt="h2_1.txt")
calc_reaxff = ReaxFF(ff_file_path=get_datafile("ffield.reax.new"),
                implementation="C")
reaxff_cell = (100*a, 100*a, 100*a)
gpaw_cell = (a, a, a)


filter_full_system = AtomListSelector((0, 1),
                        {0: 1.0,
                         1: 1.0})

filter_qm_region = AtomListSelector((0, 1), {0: 1.0, 1: 0.0})
Esempio n. 9
0
        log_interval = int(a)
    if o in ["-H", "--langevin-temp"]:
        langevin_temp = float(a)
    if o in ["-b", "--bands"]:
        bands = int(a)


# verify that MPI is actually working
print("rank: %i" % rank)



pt = PickleTrajectory(input_file, "r")
atoms = pt[-1] # get the last step

Mixer.set_atom_ids(atoms) # this one is important!

calc_gpaw = GPAW(nbands=bands, txt="mixer_box_gpaw.log")
calc_reaxff_full = ReaxFF(ff_file_path=get_datafile("ffield.reax.new"),
                          implementation="C")
calc_reaxff_qbox = ReaxFF(ff_file_path=get_datafile("ffield.reax.new"),
                          implementation="C")

# debug disabled for non-master nodes, this is so on purpose!
debug = 0
if rank == 0:
    debug = set_debug

filter_full_sys = CalcBox(name="full_sys",
                pos=(0,0,0), dim=cell,
                cutoff=cutoff, pbc=(1,1,1),
Esempio n. 10
0
    if o in ["-P", "--position"]:
        qbox_pos = tuple([float(f) for f in a.split(",")])
    if o in ["-L", "--log-interval"]:
        log_interval = int(a)
    if o in ["-H", "--langevin-temp"]:
        langevin_temp = float(a)
    if o in ["-b", "--bands"]:
        bands = int(a)

# verify that MPI is actually working
print("rank: %i" % rank)

pt = PickleTrajectory(input_file, "r")
atoms = pt[-1]  # get the last step

Mixer.set_atom_ids(atoms)  # this one is important!

calc_gpaw = GPAW(nbands=bands, txt="mixer_box_gpaw.log")
calc_reaxff_full = ReaxFF(ff_file_path=get_datafile("ffield.reax.new"),
                          implementation="C")
calc_reaxff_qbox = ReaxFF(ff_file_path=get_datafile("ffield.reax.new"),
                          implementation="C")

# debug disabled for non-master nodes, this is so on purpose!
debug = 0
if rank == 0:
    debug = set_debug

filter_full_sys = CalcBox(name="full_sys",
                          pos=(0, 0, 0),
                          dim=cell,