Advertisement
Guest User

Untitled

a guest
May 15th, 2022
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.37 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. from ase.calculators import eam
  4. from ase.geometry.analysis import Analysis
  5. from ase.io.lammpsdata import write_lammps_data
  6.  
  7. import numpy as np
  8. import matplotlib.pyplot as plt
  9. from mpl_toolkits.mplot3d import Axes3D
  10.  
  11. n, m = 4, 4
  12. CH_bond, CC_bond = 1.09, 1.42 # bond lengths in Angstroms
  13. initial_mag = 1.12  # initial magnetic moment in some units
  14.  
  15. flake = build.graphene_nanoribbon(n=n, m=m, type='zigzag', saturated=False,
  16.                                   C_H=CH_bond, C_C=CC_bond, vacuum=2*CC_bond,
  17.                                   magnetic=False, initial_mag=initial_mag,
  18.                                   sheet=False, main_element='C', saturate_element='H')
  19.  
  20. ana = Analysis(flake)
  21. CCBonds = ana.get_bonds('C', 'C', unique=True)
  22. bonds = CCBonds[0]
  23.  
  24. if True:
  25.     with open('wow.data', 'w') as outfile:
  26.         write_lammps_data(outfile, flake)
  27.  
  28. # flake.calc = eam
  29.  
  30. x, y, z = flake.positions.T
  31. n_atoms = len(flake)
  32. indices = np.arange(n_atoms)
  33. sequence = indices / (n_atoms - 1)
  34.  
  35.  
  36. fig = plt.figure(figsize=[12, 7.5])
  37. ax1  = fig.add_subplot(1, 1, 1, projection='3d', proj_type = 'ortho')
  38. ax1.scatter(x, y, z, s=400, c=sequence)
  39. hw = np.abs(flake.positions).max()
  40. ax1.set_xlim(-0.05*hw, 1.05*hw)
  41. ax1.set_ylim(-0.05*hw, 1.05*hw)
  42. ax1.set_zlim(-0.05*hw, 1.05*hw)
  43. ax1.set_box_aspect([1,1,1])
  44.  
  45. plt.show()
  46.  
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement