下图是一张词云的照片。 The image below is a photo of a wordcloud. 首先,安装wordcloud包。对于汉语用户,需额外安装jieba包。 Firstly, install the wordcloud package. For Chinese users, install an additional package, jieba. ```bash pip install jieba pip install wordcloud ``` 上图词云的文本来源是本篇博客,通过爬虫爬取内容,再用BeautifulSoup包解码。读者也可以从文本中读取,或者直接向程序中粘贴文本来源。 The text for the word cloud above was obtained from this blog post, extracted through web scraping, and then decoded with the BeautifulSoup package. Readers could also read from a text file or directly paste the text into the program. ```python url = 'https://blog.tennisatw.com/2023/09/how-to-make-wordcloud.html' r = requests.get(url=url).text soup = BeautifulSoup(r, 'lxml') paragraphs = soup.find_all('p') blog_text = '' for text in paragraphs: blog_text += text.text ``` ```python blog_text = '文本 text' ``` 如果是汉语用户,由于汉语词汇中间没有空格,需使用jieba分词,执行以下代码: For Chinese users, as Chinese vocabul...
首先,泡好一壶浓红茶。最好用锡兰红茶,我用的是祁门红茶,也可以用英式红茶包。 First, make a pot of strong black tea. It is best to use Ceylon black tea, I use Keemun black tea, but English black tea bags can also be used. 然后,泡上一些咖啡。我认为用黑咖啡就好了,因为反正之后还要加糖和牛奶。 Then, make some coffee. I think it would be fine to use black coffee, since sugar and milk will be added afterwards anyway. 牛奶用的是乳脂率2%的。乳脂率越高口感越丝滑,越好喝。用0%或1%做出的奶茶就勉强能喝。 I use the milk with 2% milkfat. The higher the milk fat percentage, the smoother and better the taste. Milk tea made with 0% or 1% milkfat milk is barely drinkable. 将红茶和咖啡和牛奶按照大约5:2:3的比例掺在一起。然后加入大量的糖,搅拌均匀。因为之前用的是黑咖啡,如果糖不够的话,就几乎没有甜味。(在奶茶店里面的奶茶总是能喝到很明显的甜味,我自己试验表明这需要加入致死量的糖。) Mix black tea, coffee and milk in a ratio of about 5:2:3. Then add a generous amount of sugar and mix well. Because I used black coffee before, if there is not enough sugar, there will be almost no sweetness. (The milk tea in the milk tea shop can always drink a very obvious sweetness. My own experiments have shown that this r...
想要计算lammps模拟系统的密度,需要知道系统的尺寸,和系统内的原子数。 To calculate the density of a lammps simulated system, you need to know the system's dimensions and the number of atoms within it. 对于尺寸在模拟中不发生变化的系统,可以读取其输入文件的结构文件来获得系统的三维尺寸。以下为一个典型的结构文件的例子: For systems whose dimensions do not change during simulation, you can obtain the three-dimensional size of the system by reading the structure file in its input file. Here's an example of a typical structure file: ``` LAMMPS data file 3072 atoms 2 atom types 2048 bonds 1 bond types 1024 angles 1 angle types -1.2631399999999999e+01 1.2631399999999999e+01 xlo xhi -1.2631399999999999e+01 1.2631399999999999e+01 ylo yhi -2.5262750000000000e+01 2.5262750000000000e+01 zlo zhi Masses 1 1.008 2 15.9994 ``` 最长的那三行是盒子的尺寸。x方向的尺寸为12.6314-(-12.6314)=25.2628A。y和z方向的尺寸计算方法类似。 The three longest lines represent the dimensions of the box. The size in the x-direction is 12.6314 - (-12.6314) = 25.2628 Å. The size in the y and z directions is calculated similarl...