Skip to main content

Questions tagged [programming]

Questions about programming.

Filter by
Sorted by
Tagged with
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 ...
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 ...
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-...
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: ...
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 ...
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 ...
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 ...
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, ...
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: ...
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’. ...
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 ...
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 ...
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 <...
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 ...
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\...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...