Questions tagged [programming]
Questions about programming.
23
questions
22
votes
9
answers
9k
views
How to master Fortran with minimal effort?
Fortran language is used in many first-principles matter modeling codes, such as VASP and QE. These codes usually include many ...
20
votes
7
answers
6k
views
Convert XYZ coordinates to Z-matrix
I want to make a python script that will load an xyz file. From the xyz parameters, I need to find the distance between atoms, angle and dihedral between atoms.
The file xyz have this structure:
...
14
votes
3
answers
905
views
Script to generate input files for benchmark purpose
I would like to run some benchmark of different DFT functionals.
The most time consuming part is obviously the generation of the input files.
I'm not a programmer, but I think this could be done by ...
14
votes
1
answer
183
views
Looking for crystal generator library
I am looking for a C or a C++ library that can do crystal generation, that is, multiply unit cells in one or more directions with symmetry information. (in other words, generate supercells).
I have ...
13
votes
3
answers
262
views
Improving my programming for computational chemistry/physics
What are some good textbooks or online resources to improve my skills in C++, C and Fortran, specifically for computational chemistry.
For example, I am interested in learning about parallelisation ...
9
votes
1
answer
345
views
Help with translating Hamiltonian into matrix
Eq. 19 in this paper gives the following Hamiltonian:
$\sigma_a, \tau_a, \eta_a$ are respectively the spin, sublattice pseudospin and valley pseudospin respectively.
Normally, I would have chosen a ...
8
votes
2
answers
396
views
Python to extract data from two files, and then do a calculation with those data
There are two files named ‘OUTCAR’ and ‘POSCAR’.
The ‘OUTCAR’ file consists of many lines including the following (Screenshot 1):
(It is noted that, there are data for 48 ions in that OUTCAR file, ...
7
votes
3
answers
3k
views
Running an ORCA calculation from Python
I'm a master's student and recently I started doing computational chemistry calculations using ORCA program.
This program works by command line and I saw that the majority of computational chemistry ...
7
votes
3
answers
348
views
Extracting data from a file, using python or bash. Requesting help
I have some directories, named ‘abc-000, abc-001, abc-002, …… abc-100’. The path of the directory can be, for example, \home\abc-000 and so on.
Inside each directory, there is a file named ‘OUTCAR’. ...
7
votes
1
answer
600
views
pyscf: Why should the choice of pseudopotential determine the total energy, and not the physics?
I have limited experience with DFT, but as an exercise I have written a DFT program of an atom (from scratch using nothing more than python built in functions and numpy) by following Richard Martin's ...
7
votes
1
answer
289
views
Calculate number of electrons per shell for an atom
Suppose you are given the atomic number of an element, e.g. Technetium, which is 43. Is it possible to return an array which shows the distribution of electrons across different shells of an atom ...
6
votes
3
answers
2k
views
What programming language do matter modelers generally use?
I thought Python was a reasonably popular language among matter modelers.
However, I saw a comment in one of my posted questions (in which I posted a Python code) that the commenter was unfamiliar ...
6
votes
1
answer
1k
views
Why does VASP use -O2 optimization by default rather than -O3?
When compiling VASP, I am wondering why the
OFLAG = -O2
is suggested as default. For performance reason, I would use
...
6
votes
1
answer
238
views
Which functionals should I include for a simple hydrogen atom system?
I am writing my own (orbital-free, for now) 3D density functional theory code from scratch. It currently works correctly for the simple harmonic oscillator potential $V_\text{ext}(\mathbf r) = \frac12\...
6
votes
1
answer
235
views
Symmetrization of elastic constants based on rotational symmetry in Pymatgen
I am trying to write a small python script which will symmetrize an elastic tensor based on rotational symmetry of the space group. I started with this link and created a new python script as below.
I ...
5
votes
1
answer
4k
views
How may I run a .py file in a Jupyter notebook?
In terminal, I run a python code like this way:
python code.py file.txt
Or it might also work as:
./code.py file.txt
Where the ...
5
votes
2
answers
119
views
Explicit form of Hartree Fock analytic gradient with contracted GTOs? With or without density fitting
Does anyone know of a paper, textbook, or other resource which outlines the expression for the analytic gradient of the HF energy (restricted or otherwise) in terms of Dunning's contracted Gaussian-...
4
votes
2
answers
638
views
Find with grep in terminal last hit in log file
I use grep to find the string "Converged?" with the terminal in several folders to read the output from my gaussian ...
3
votes
2
answers
263
views
How to use the GDB debugger with OpenMolcas?
I would like to follow how some variables are changing during an OpenMolcas calculation, and adding WRITE statements has become too tedious. I've compiled with the <...
3
votes
2
answers
267
views
Is this "internal error" reproducible when compiling OpenMolcas on other Intel compilers?
The procedure I've been following to build OpenMolcas with an Intel Fortran compiler in the Compute Canada environment is as follows:
...
3
votes
2
answers
510
views
How to merge two files (molecule structure and file property) into one?
I've run some calculations with the xtb software. From its output I got XYZ and MOL files ...
3
votes
0
answers
33
views
Writing a plugin in LAMMPS
I am trying to write a plugin in LAMMPS that would need to compute the energy between two atoms as a function of the first atoms coordination number. From the LAMMPS GitHub repository, I found that ...
1
vote
1
answer
96
views
Interstitial charge from a cube file: Need help in python coding
I have a test material- two silicon atoms in an unit cell. This particular structure shows evidence of having interstitial charge between the two atoms. I need to find out the amount of this ...