New answers tagged

2

I tried to answer the question in the github issue github.com/pyxem/diffsims/issues/176 Answer: The reason it doesn't work is that the calibration parameter of the diffraction pattern is not set. A diffraction pattern in diffsims is represented by a list of (x, y) coordinates in projected reciprocal space, and an associated intensities I. Together they ...


3

It should be easy to achieve what you want with a bash script. For a file named test.xyz, it can be achieved with: fname=test.xyz nlines=`wc -l $fname | awk '{print $1}'` natoms=$((nlines-2)) sed -i "1s/.*/$natoms/" $fname This follows the logic given in the answer by @Prasanta. It should be easy to change this to a script taking the filename as ...


3

More a comment than an answer, note that e.g., for methane 5 C 0.92745 -0.05402 0.04264 H 2.01965 -0.05402 0.04264 H 0.56338 0.81142 0.60065 H 0.56338 -0.96998 0.51313 H 0.56338 -0.00348 -0.98585 the first line including 5 (in this example) ...


2

This is a strange type question. First, there is something wrong with the xyz file having total 5 columns. For you answer, Find total row number (let it be r) calculate r-2 (since the format of the xyz is that after the total number of atoms, there is a gap followed by atomic coordinates. The end of atomic coordinate specifications ends the file) replace ...


5

You could do this by just modifying the first line of the file. But here are some more general purpose utilities you could use (note it requires the re module) def read_xyz( filename, scale=1.): """ Read xyz file Params: filename (str) - name of xyz file to read Returns: geom ((natoms,4) np.ndarray) - ...


2

Unfortunately, due to my reputation, I cannot comment yet. However, to the surprise of Typerius, I would like to note that the function young_modulus does not return the Young's modulus, but the compliance. The code looks as follows return (lin_elastic_region[-1,1],lin_elastic_region[0,1])/(lin_elastic_region[-1,0]-lin_elastic_region[0,0]) with ...


Top 50 recent answers are included