跳至主要內容

01-Homework 01

AI悦创原创1v1Python一对一辅导留学生Python辅导Python 1v11v1Python一对一辅导留学生Python辅导Python 1v1大约 15 分钟...约 4412 字

Notes: Refer to the Lennard-Jones (L-J) pair potential for solid Argon. You need to know the form of this potential along with the smooth cut-off to zero that is needed for modeling studies.

Both the potential and the cut-off are described in Prof. Vitek’s notes in a separate file titled the L-J potential. Please read this before attempting the homework or wait until Sep 12 class lecture to know more. In the meantime, you may look up or convince yourself what close-packed crystal structures are in one, two and three dimensional space. You may search the web if you are not familiar with this concept. Once you know how a close-packed structure is defined, you should be able to figure out the close-packed lattice in two dimensions. Draw a rough sketch by hand or make a plot using a code and identify how many neighbors an atom has in this lattice. Make a table of the nearest neighbors, next-nearest neighbors, etc., at least up to the fourth neighbor shell along with their distances in terms of a lattice parameter ‘a’ for the lattice. The pair potential only depends on the distance between the atoms and not their orientation. Such potentials are called “central” potentials in physics. With this background, you may proceed to do the homework. Please prepare your answers in the form of a report (in pdf format) where you explain your thinking and procedure in words briefly before solving the problem.

The homework should be uploaded in canvas by the due date in two separate formats: (i) A pdf file should include any analytical calculations, results, discussion and analysis and the code used should also be appended in pdf format to this file. (ii) Separately also upload the code as a python file. This format needs to be followed for all homework sets in this course.

Simulation Problem:

Consider a material in which atoms interact via the Lennard-Jones potential that is smoothly cut-off at rcut=7.5A˚r_{cut} = 7.5\text{Å}, as explained in the description of the Lennard-Jones potential (see Vitek’s notes). Note that the potential has a different form for r<roandforro<r<rcutr < r_{o}\quad and\quad for\quad r_{o} < r < rcut.

  1. Determine analytically the equilibrium lattice parameter for the two- dimensional periodic close-packed structure with no surfaces.

    The L-J potential parameters given in the notes are for three-dimensional face- centered cubic close-packed structure. In this HW 1, you are asked to determine the equilibrium lattice parameter for a close-packed lattice in two dimensions with the same L-J potential. Use the following method:Decide first geometrically the close-packed two-dimensional structure. Make a sketch showing several tens of atoms.

  2. Determine how many first, second, third etc. interacting neighbors are within the cut-off radius. First, choose just the neighbors which are the closest to the central atom which is chosen as the origin. Analytically, minimize the potential energy assuming only nearest neighbor interactions and obtain the lattice parameter. Now check, if the second neighbor shell atoms lie within the cut-off value of the potential using the lattice parameter calculated with first neighbor interactions. Repeat the minimization analytically by including the first and second neighbors. Obtain the equilibrium lattice parameter. Now, check if the third neighbors lie within the cut-off of the potential. If they do, repeat the procedure and find the two dimensional equilibrium lattice parameter for your chosen close-packed lattice. Include more neighboring shells if necessary and repeat. (30 points)

  3. In order to get the first training in coding solve this problem using your own code. Proceed as in the analytical case: build your 2D close-packed lattice and calculate the radius of first, second, third and fourth neighbor shells. Determine the number of neighbors in each shell. Evaluate the energy of the system as a function of the lattice parameter and taking into account only the first shell, the first and second shell, etc., up to the fourth shell of neighbors. Plot this dependence of the potential energy as a function of the lattice parameter. The minimum of the potential energy determines the equilibrium lattice parameter. In the computer code you have to make logical decisions whether two atoms interact with each other or not, what is their separation and what is the contribution of this interaction to the potential energy. Comment on the agreement/disagreement between your analytical and numerical answers to the first and second part of this homework respectively. (40 points)

  4. Use the same L-J potential with the cut-off parameter but now for a two- dimensional non close-packed lattice. Draw this lattice by hand and calculate the distance and the number of neighbors each atom has in the first three/four neighbor shells. By analytical means, find the minimum of the L-J potential form for this lattice and determine the equilibrium lattice parameter using the cut-off value as before. Comment on the value you obtain for the non-close-packed and the close- packed lattice you chose in questions 1 and 2. (30 points)

详情

注释: 参考固态氩的 Lennard-Jones (L-J)对势。你需要知道这种势的形式,以及模型研究所需的平滑截止为零。

这个势和截止在Vitek教授的笔记中有描述,文件名为L-J势。请在尝试做作业之前阅读它,或等到9月12日的课上了解更多。同时,你可以查找或确信一维、二维和三维空间中的紧密堆积晶体结构是什么。如果你对这个概念不熟悉,可以搜索网页。一旦你知道如何定义一个紧密堆积结构,你应该能够确定二维空间中的紧密堆积晶格。用手画一个粗略的草图或用代码制作一个图,并确定这个晶格中的原子有多少邻居。为晶格制作一个最近邻、次近邻等至少到第四邻居壳的表,并给出以晶格参数‘a’为单位的距离。对势只取决于原子之间的距离,而不是它们的方向。这种势在物理学中被称为“中心”势。有了这些背景知识,你可以开始做作业。请以报告形式(PDF格式)准备你的答案,在解决问题之前简要地用文字解释你的思考和步骤。

作业应在到期日之前以两种不同的格式上传到Canvas中: (i) PDF文件应包括任何分析计算、结果、讨论和分析,并应将所使用的代码以PDF格式附加到该文件中。 (ii) 另外还要将代码作为Python文件上传。这种格式需要在本课程的所有作业集中遵循。

模拟问题

考虑一种材料,其中的原子通过 Lennard-Jones 势相互作用,并在rcut=7.5A˚r_{cut} = 7.5\text{Å}处平滑截止,如Lennard-Jones势的描述中所解释的(见Vitek的笔记)。注意,对于r<ror < r_{o}ro<r<rcutr_{o} < r < rcut,势的形式是不同的。

  1. 解析地确定没有表面的二维周期紧密堆积结构的平衡晶格参数。

    笔记中给出的L-J势参数是针对三维面心立方紧密堆积结构的。在这个HW 1中,你被要求确定与相同的L-J势相对应的二维空间中的紧密堆积晶格的平衡晶格参数。首先从几何上决定二维的紧密堆积结构。做一个显示几十个原子的草图。

  2. 确定在截止半径内有多少第一、第二、第三等相互作用的邻居。首先,只选择离中心原子最近的邻居,这个中心原子被选择为原点。解析地,假设只有最近邻相互作用来最小化势能,并得到晶格参数。现在检查,如果第二邻居壳的原子位于潜在的截止值内,使用第一邻居相互作用计算的晶格参数。通过包括第一和第二邻居重复解析地最小化。获得平衡晶格参数。现在,检查第三邻居是否位于势的截止值内。如果是,重复该过程,并找出你选择的紧密堆积晶格的二维平衡晶格参数。如有必要,再包括更多的邻居壳并重复。(30分)

  3. 为了获得第一次编码训练,使用你自己的代码解决这个问题。像解析情况那样进行:建立你的2D紧密堆积晶格并计算第一、第二、第三和第四邻居壳的半径。确定每个壳中的邻居数量。作为晶格参数的函数,评估系统的能量,并只考虑第一壳、第一和第二壳等,直到邻居的第四壳。绘制潜在能量与晶格参数的关系。潜在能量的最小值确定了平衡晶格参数。在计算机代码中,你必须逻辑地决定两个原子是否相互作用,它们之间的间隔是多少,以及这种相互作用对潜在能量的贡献是什么。对于你的解析和数值答案之间的一致性/不一致性进行评论。(40分)

  4. 使用相同的L-J势和截止参数,但现在对于一个二维的非紧密堆积晶格。手工绘制这个晶格,并计算每个原子在第一、第二、第三/第四邻居壳中的距离和邻居数量。通过解析手段,找到这个晶格的L-J势形式的最小值,并使用前面的截止值确定平衡晶格参数。评论你在问题1和2中为非紧密堆积和紧密堆积选择的晶格得到

无注释
import numpy as np
import matplotlib.pyplot as plt

class Lattice:
    def __init__(self):
        self.atoms = []

    def populate_atoms(self):
        for x in np.arange(-2, 3):
            for y in np.arange(-2, 3):
                self.atoms.extend([
                    [4 * x, 2 * y * np.sqrt(3)],
                    [2 + 4 * x, 2 * y * np.sqrt(3)],
                    [1 + 4 * x, np.sqrt(3) + 2 * y * np.sqrt(3)],
                    [3 + 4 * x, np.sqrt(3) + 2 * y * np.sqrt(3)]
                ])

    def plot_atoms(self, ax):
        for atom in self.atoms:
            ax.plot(atom[0], atom[1], "yo")

    def plot_circle(self, ax, radius, color="r", fill=False):
        circle = plt.Circle(xy=(0, 0), radius=radius, color=color, fill=fill)
        ax.add_patch(circle)

    def visualize(self):
        x_vals, y_vals = zip(*self.atoms)
        x_dim = max(x_vals) - min(x_vals)
        y_dim = max(y_vals) - min(y_vals)
        
        fig, ax = plt.subplots(figsize=(9 * x_dim / y_dim, 9))
        
        self.plot_atoms(ax)
        self.plot_circle(ax, 2, "r")
        self.plot_circle(ax, 2 * np.sqrt(3), "g")
        self.plot_circle(ax, 4, "b")
        
        plt.axis("off")
        plt.show()

# Usage
lattice = Lattice()
lattice.populate_atoms()
lattice.visualize()
1
self.atoms.extend([
                    [4 * x, 2 * y * np.sqrt(3)],
                    [2 + 4 * x, 2 * y * np.sqrt(3)],
                    [1 + 4 * x, np.sqrt(3) + 2 * y * np.sqrt(3)],
                    [3 + 4 * x, np.sqrt(3) + 2 * y * np.sqrt(3)]
                ])

这段代码的关键在于生成一个表示二维晶格原子位置的点集。我们逐行来详细解释:

  1. self.atoms.extend([])extend是一个 Python 列表方法,用于将另一个列表的所有元素添加到当前列表的末尾。此行的目的是将定义的原子位置集合添加到 self.atoms 这个列表中。

  2. [4 * x, 2 * y * np.sqrt(3)]:这是晶格中原子的一个位置。它的 x 坐标是4 * x,y 坐标是 2 * y * np.sqrt(3)。这个位置是基于一个矩形网格,但 y坐标乘以了np.sqrt(3)的因子,使得在y方向上的间距与x方向上的间距不同,从而形成了一个密集的二维晶格。

  3. [2 + 4 * x, 2 * y * np.sqrt(3)]:这是另一个原子位置。它的 x 坐标是 4 * x 向右偏移了2个单位。y坐标和前面的原子位置相同。

  4. [1 + 4 * x, np.sqrt(3) + 2 * y * np.sqrt(3)][3 + 4 * x, np.sqrt(3) + 2 * y * np.sqrt(3)]:这两个原子位置在 y 方向上都比前两个原子上移了 np.sqrt(3) 的距离,而在 x 方向上分别向左和向右偏移了 1 和 3 个单位。

这四个原子位置组成了一个单元格,在二维平面上形成一个密集的原子阵列。通过 for x in np.arange(-2, 3):for y in np.arange(-2, 3):两个嵌套的循环,这个单元格被重复多次,从而生成了一个更大的区域上的原子位置集合。

简而言之,这段代码通过一系列计算生成了一个代表二维密集晶格的原子位置点集。

1
import matplotlib.pyplot as plt

def L_J_potential(r):
    if r <= 7.0:
        return 4 * 0.010323 * ((3.405/r)**12 - (3.405/r)**6)
    elif r <= 7.5:
        return -6.8102128 * 0.001 * (r-7.5)**3 - 5.5640876 * 0.001 * (r-7.5)**2
    else:
        return 0

def compute_energy_and_plot(r_start=3, r_end=10, delta_r=0.001):
    r_values = [r for r in frange(r_start, r_end, delta_r)]
    E_total = [6 * L_J_potential(r) for r in r_values]
    E_min = min(E_total)
    r_min = r_values[E_total.index(E_min)]
    
    plt.plot(r_values, E_total)
    plt.xlabel('distance/Angstrom')
    plt.ylabel('L-J potential energy/eV')
    plt.title('the first shell')
    plt.show()
    
    return E_min, r_min

def frange(start, stop, step):
    r = start
    while r < stop:
        yield r
        r += step

E_min_1, r_min_1 = compute_energy_and_plot()
print(E_min_1, r_min_1)

公众号:AI悦创【二维码】

AI悦创·编程一对一

AI悦创·推出辅导班啦,包括「Python 语言辅导班、C++ 辅导班、java 辅导班、算法/数据结构辅导班、少儿编程、pygame 游戏开发、Web、Linux」,全部都是一对一教学:一对一辅导 + 一对一答疑 + 布置作业 + 项目实践等。当然,还有线下线上摄影课程、Photoshop、Premiere 一对一教学、QQ、微信在线,随时响应!微信:Jiabcdefh

C++ 信息奥赛题解,长期更新!长期招收一对一中小学信息奥赛集训,莆田、厦门地区有机会线下上门,其他地区线上。微信:Jiabcdefh

方法一:QQopen in new window

方法二:微信:Jiabcdefh

上次编辑于:
贡献者: AndersonHJB
你认为这篇文章怎么样?
  • 0
  • 0
  • 0
  • 0
  • 0
  • 0
评论
  • 按正序
  • 按倒序
  • 按热度