Esempio n. 1
0
    olap_region = CPL.get_olap_limits()
    portion = CPL.my_proc_portion(olap_region)
    [ncxl, ncyl, nczl] = CPL.get_no_cells(portion)
    send_array = np.zeros((3, ncxl, ncyl, nczl), order="F", dtype=np.float64)
    for iglob in xrange(portion[0], portion[1] + 1):
        for jglob in xrange(portion[2], portion[3] + 1):
            for kglob in xrange(portion[4], portion[5] + 1):
                iloc, jloc, kloc = CPL.map_glob2loc_cell(portion, [iglob, jglob, kglob])
                if which_test == "cell_test":
                    send_array[0:3, iloc, jloc, kloc] = [iglob, jglob, kglob]
                elif which_test == "coord_test":
                    xglob, yglob, zglob = CPL.map_cell2coord(iglob, jglob, kglob)
                    send_array[0:3, iloc, jloc, kloc] = [xglob, yglob, zglob]

    recv_array = np.zeros((3, 0, 0, 0), order="F", dtype=np.float64)
    CPL.scatter(send_array, olap_region, recv_array)


# Receiving cell coordinates from MD
if CPL.overlap():
    recv_array = np.zeros((3, ncxl, ncyl, nczl), order="F", dtype=np.float64)
    send_array = np.zeros((3, 0, 0, 0), order="F", dtype=np.float64)
    CPL.gather(send_array, olap_region, recv_array)
    for icfd in xrange(portion[0], portion[1] + 1):
        for jcfd in xrange(portion[2], portion[3] + 1):
            for kcfd in xrange(portion[4], portion[5] + 1):
                iloc, jloc, kloc, = CPL.map_glob2loc_cell(portion, [icfd, jcfd, kcfd])

                # Receive cell or coord depending on the test
                ixcfd, jycfd, kzcfd = icfd, jcfd, kcfd
                ixmd, jymd, kzmd = recv_array[0:3, iloc, jloc, kloc]
Esempio n. 2
0
cnstFRegion = CPL.get_cnst_limits()
cnstFPortion = CPL.my_proc_portion(cnstFRegion)
[cnstncx, cnstncy, cnstncz] = CPL.get_no_cells(cnstFPortion)

# Velocity averaging region cell limits and number of cells
velBCRegion = np.copy(olap_limits)
velBCRegion[3] = velBCRegion[2]
velBCPortion = CPL.my_proc_portion(velBCRegion)
[velBCncx, velBCncy, velBCncz] = CPL.get_no_cells(velBCPortion)

# Send dummy stress distribution (constant value of stress = 0) to MD
scatter_array = np.random.rand(9, cnstncx, cnstncy, cnstncz)


recv_array = np.zeros((9, 0, 0, 0), order='F', dtype=np.float64)
CPL.scatter(scatter_array, cnstFRegion, recv_array)

# Receive averaged velocities from LAMMPS socket
recv_array = np.zeros((4, velBCncx, velBCncy, velBCncz), order='F',
                      dtype=np.float64)
gather_array = np.zeros((4, 0, 0, 0), order='F', dtype=np.float64)
CPL.gather(gather_array, velBCRegion, recv_array)

dx, dy, dz = (Lx / NCx, Ly / NCy, Lz / NCz)
lines = ""
md_cell_coords = np.array(3)

dA = dx * dz
if (cnstFPortion[2] >= 0):
    for i in xrange(cnstFPortion[0], cnstFPortion[1]+1):
        for j in xrange(cnstFPortion[2], cnstFPortion[3]+1):
Esempio n. 3
0
# Constrained region cell limits and number of cells
cnstFRegion = lib.get_cnst_limits()
cnstFPortion = lib.my_proc_portion(cnstFRegion)
[cnstncx, cnstncy, cnstncz] = lib.get_no_cells(cnstFPortion)

# Velocity averaging region cell limits and number of cells
velBCRegion = np.copy(olap_limits)
velBCRegion[3] = velBCRegion[2]
velBCPortion = lib.my_proc_portion(velBCRegion)
[velBCncx, velBCncy, velBCncz] = lib.get_no_cells(velBCPortion)

for step in xrange(nsteps):
    # Send dummy stress distribution (constant value of stress = 0) to MD
    send_array = np.zeros((9, 0, 0, 0), order='F', dtype=np.float64)
    recv_array = np.ones((9, cnstncx, cnstncy, cnstncz), order='F', dtype=np.float64)
    lib.scatter(send_array, cnstFRegion, recv_array)
    #if (cnstFPortion[2] >= 0):
    #    print (recv_array)
#with open("forces.dat", "w") as forces_file:
#    forces_file.writelines( str (recv_array))
# Receive averaged velocities from LAMMPS socket
    #send_array = 0.5*np.ones((4, velBCncx, velBCncy, velBCncz), order='F', dtype=np.float64)
    send_array = np.random.rand(4, velBCncx, velBCncy, velBCncz)
    recv_array = np.zeros((4, 0, 0, 0), order='F', dtype=np.float64)
    lib.gather(send_array, velBCRegion, recv_array)
    """
dx, dy, dz = (Lx / NCx, Ly / NCy, Lz / NCz)
lines = ""
md_cell_coords = np.array(3)

dA = dx * dz