Skip to main content

Questions tagged [programming]

Questions about programming.

Filter by
Sorted by
Tagged with
22 votes
9 answers

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 ...
Jack's user avatar
  • 15.2k
20 votes
7 answers

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: ...
Jose Pinto's user avatar
14 votes
3 answers

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 ...
NickZ's user avatar
  • 1,499
14 votes
1 answer

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 ...
alfC's user avatar
  • 281
13 votes
3 answers

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 ...
Fracton's user avatar
  • 271
9 votes
1 answer

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 ...
TribalChief's user avatar
  • 2,361
8 votes
2 answers

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, ...
Bip's user avatar
  • 81
7 votes
3 answers

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 ...
Al1010's user avatar
  • 165
7 votes
3 answers

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’. ...
Sak's user avatar
  • 981
7 votes
1 answer

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 ...
Mikke Mus's user avatar
  • 263
7 votes
1 answer

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 ...
Rithish's user avatar
  • 71
6 votes
3 answers

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 ...
user366312's user avatar
  • 2,546
6 votes
1 answer

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 ...
Memories's user avatar
  • 353
6 votes
1 answer

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\...
dftsolo's user avatar
  • 61
6 votes
1 answer

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 ...
Pranav kumar's user avatar
  • 4,278
5 votes
1 answer

How may I run a .py file in a Jupyter notebook?

In terminal, I run a python code like this way: python file.txt Or it might also work as: ./ file.txt Where the ...
Sak's user avatar
  • 981
5 votes
2 answers

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-...
Rob L's user avatar
  • 51
4 votes
2 answers

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 ...
Andrea's user avatar
  • 856
3 votes
2 answers

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 <...
Nike Dattani - No Free Time's user avatar
3 votes
2 answers

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: ...
Nike Dattani - No Free Time's user avatar
3 votes
2 answers

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 ...
Camps's user avatar
  • 23.6k
3 votes
0 answers

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 ...
Hemanth Haridas's user avatar
1 vote
1 answer

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 ...
Sak's user avatar
  • 981