Questions tagged [python]

For questions about materials modeling scripts written in the Python programming language. Questions should focus on interfacing with existing packages and aspects related to modeling, not general debugging.

Filter by
Sorted by
Tagged with
6 votes
1 answer
126 views

How to obtain electron charge density per unit volume about a water molecule using SlowQuant?

@Nike Dattani's answer to How to “get my feet wet” in Density Functional Theory by simulating a water molecule using Python recommends SlowQuant. I've used the install instructions for Linux on my ...
5 votes
2 answers
263 views

How to apply FIRE to many atoms where P=F·v seems to be a vector rather than a scalar?

Introduction/Preamble @SusiLehtola's answer to Basics of numerical energy minimization techniques used in molecular dynamics? mentions conjugate gradients, BFGS for energy minimization, Metropolis ...
16 votes
0 answers
126 views
+100

Easy ways to generate "teaching" band structures in Python?

I'd like to introduce band structure to a class of undergraduate chemists, along the lines of Roald Hoffmann's Solids and Surfaces. That is, I'd like to start with a s-band in 1D, which is easy ...
8 votes
0 answers
103 views

Dynamical features in molecular dynamics

I would like to know how to compute dynamical properties/correlations like self-intermediate scattering function and probability distribution function of displacements (I think it is so called van ...
5 votes
0 answers
56 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 ...
6 votes
2 answers
72 views

How to obtain fingerprint bits as SMARTS pattern in RDKit

I am using RDKit to generate Morgan Fingerprints (similar to ECFP) and then obtaining the bit information. I need the bit information in order to generate a statistics of substructures for each ...
13 votes
0 answers
318 views

How to calculate RDFs for MD trajectories without PBC, directly from coordinates?

I have been running MD simulations on water droplets with an ion in them. I am trying to implement a program that could calculate the radial distribution function from ion to oxygen (or ion to ...
3 votes
0 answers
41 views

Lennard Jones Clusters in Python

I would like to explore the global optimisation of Lennard-Jones clusters in Python. I do not come from a physical chemistry background. I would like to be able to calculate the cluster energy ...
3 votes
2 answers
53 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 ...
1 vote
0 answers
66 views

2D charge density contour plot (how to get arbitrary 'Z' values in the plot using python)

I need to generate a contour plot from a file (named abc.gnu) which has X, Y and Z columns of data. It has 1000000 rows of data. I have got the contour plot with a python code (shown at the end). What ...
1 vote
1 answer
73 views

Suggestion for getting a type of plot

I am planning to use python to get a plot like this . But, I am only able to get this, So, I would appreciate it if someone helps me with this issue, (Maybe how to format the data): How to have ...
2 votes
1 answer
88 views

How to transform fractional coordinates into cartesian?

I need to make this transformation because I need to grow up my unit cell using a code with Python. But, I'm studying it yet and I need some help.
4 votes
0 answers
40 views

Scripts to extract data from MOPAC calculations?

I am doing calculations with MOPAC semi-empirical package. As I have many systems (around 40), extracting the date manually, besides being tiring it can cause errors. I already worked with ASE, but ...
2 votes
1 answer
74 views

Generate grid coordinates from PySCF DFT package for plotting grid points

As can be read in the pyscf.dft documentation, there should be the possibility of generating the coordinates of the grid for numerical integration. According to the documentation, one can generate the ...
6 votes
0 answers
83 views

How to get started into all this?

I am a high schooler and a part-time programmer. I want to become a material scientist. But the thing is that I can't find good resources for getting started in material science except just getting ...
5 votes
1 answer
153 views

How to read QE's wfc*.dat files with python

I'm working with QE 7.0 for the computation of some properties of solids. My working theory requires me to access all the information inside the wfc#c.dat/h5 files, created in the prefix.save ...
20 votes
3 answers
3k views

How to find Young's Modulus using stress strain curve using Python?

I am trying to find the The Young's Modulus of an aluminum alloy The yield stress Below is the data for the stress-strain curve. I tried finding the region where the slope is constant and to my ...
3 votes
0 answers
99 views

Calculating the Diffusion coffecients from Trajectory file in ASE [closed]

I plan to study the Diffusion-Coefficient of my simulation outputs, for this, I want to use ASE. Sadly I am not entirely sure of how to proceed, has anyone done this and if yes, please share your ...
13 votes
1 answer
692 views

How to plot a Gaussian cube file with python/matplotlib?

I know there are programs that can automatically visualize .cube files (like VMD), but I'm trying to do it myself in python/matplotlib (or equivalent) to better understand what the numbers mean. I ...
3 votes
0 answers
123 views

Molecular MC simulation is not equilibrating [closed]

Suppose, a polymer has N monomers in its chain. I want to simulate its movement using the bead-spring model. So, I wrote the following program in Python. Polymer chain simulation with Monte Carlo ...
3 votes
0 answers
144 views

Atomic Simulation Environment (ASE) is unable to read a big trajectory file

The problem that I face is the ASE software can't read the trajectory file and throws this error ValueError: buffer is smaller than requested size. My assumption is ...
6 votes
0 answers
40 views

Getting Internal Calculator Data in ASE [closed]

I am using the framework ASE to do computational chemistry calculations. I am using the calculator GPAW with it. How do I extract data that is internal to the calculator? I mostly want to get the ...
5 votes
1 answer
111 views

Convert SMILES format to Amino Acid masses using RDKit - Cyclopeptides

This is a variation of a question asked on October 30, 2021 here, but it is different enough that I think it warrants a new post. I'm also trying to use RDKit. Is it possible to convert a SMILES ...
9 votes
2 answers
286 views

Numerically integrating the Hartree potential

I'm trying to write a 1D density functional theory code on Python to predict the electronic structure of certain ions using the local density approximation. I'm trying to construct the hamiltonian for ...
5 votes
1 answer
76 views

PyTorch WL Kernel

I’m learning to use PyTorch Geometric, I tried to replicate the WL kernel written by the PyG developers on GitHub (https://github.com/pyg-team/pytorch_geometric/blob/master/examples/wl_kernel.py), but ...
6 votes
0 answers
262 views

Error while installing ShengBTE

I am trying to install the thirdorder script that is mean to work in tandem with ShengBTE on an Ubuntu OS, but I'm getting the following error: ...
6 votes
0 answers
135 views

How to get a Wannier function for a tight-binding model numerically? [closed]

I have a question about construction of a Wannier function for a tight-binding model. Let's say we consider the tight-binding model of a 1D chain with two atoms (site A and B in a unit cell). In k-...
6 votes
0 answers
46 views

Issues with running plasma-modeling sample script [closed]

I am currently trying to use some modeling software for a project I have to do for school. I am currently using Python 3.8.10 on Ubuntu 20.04.4 and VSCode as my IDE. I am trying to use a library ...
14 votes
1 answer
686 views

How to start a Machine Learning project for chemical properties prediction?

I know that is a very general question but I would like to start a ML project in Python to predict some chemical properties with a large set of experimental data. The compounds I would like to study ...
10 votes
1 answer
242 views

Node features matrix with Networkx

I built a function to generate graphs from smiles strings using networkx, inserting various features on the nodes. This is the code: ...
6 votes
1 answer
116 views

BoltzTraP script works with which python version?

BoltzTraP code is giving errors in Quantum espresso of indentation and then Typerror: 'Float' object can not be interpreted as an integer. What should I do to run this properly? What should I update ...
7 votes
1 answer
316 views

How to solve this Phonopy-related problem?

I have used the finite displacements method for phonon spectrum calculation, and when I typed the command to create force sets: ...
4 votes
0 answers
71 views

How to implement a Weyl semimetal in tight binding? [closed]

I want to study electronic and thermal transport properties of a Weyl semimetal. Until now, I have used only the continuum model hamiltonian ($H=k⋅σ$). As the continuum model has several limitations, ...
8 votes
1 answer
787 views

How to compute the synthetic accessibility score in Python?

I come from a mainly computer science background, but have become involved in a project related to artificial intelligence-based drug discovery. I made a model that generates novel molecules, for ...
7 votes
2 answers
307 views

How to process electron-density data from a CHGCAR for better handling?

We all know that Vesta helps us visualize the electron clouds present in the CHGCAR data, but I am looking for a better way to process the electron-density data we get in a CHGCAR file for compact ...
4 votes
4 answers
2k views

Is there a way to do array broadcasting faster, or without using loops?

I would like to optimize the following code. In real applications, the number of snapshots can be 10000, and for each of them, the lengths can be ...
6 votes
0 answers
83 views

Python ASE: How to stack a nanocrystal on top of a graphene slab? [closed]

I'm trying to model a 2D TMD (transition metal dichalcogenide) nanocrystal on a graphene substrate. I know how to generate 2D TMDs through the MX2 module, and I certainly know how to make graphene on ...
15 votes
4 answers
1k views

How to generate the high symmetry paths for band structure calculations?

Suppose I want to calculate the band structure of a material system along a specific high symmetry path in the Brillouin Zone. If the point group of the system is given, how can I easily compute the ...
7 votes
0 answers
90 views

Pymol is not opening after startup [closed]

I installed open-source pymol software using miniconda4 which have been installed successfully. I worked with the software, but whenever I am shutting down my PC and again restarted, the >pymol ...
9 votes
2 answers
2k views

How to input 3D coordinates from xyz file and connectivity from SMILES in rdkit?

I am working on a QSAR project where the 3D structural descriptors are an input to a machine learning model. I am generating the descriptors using the python Mordred API (which uses rdkit). ...
6 votes
1 answer
343 views

How to compute the overlap matrix in Python

I want to calculate the overlap integral (S), I made the code, but it is only worked when I use a basis function that describe 1s and when I include 2s orbital, I start to get error. The First Problem ...
5 votes
0 answers
263 views

How to get the coordination number from RDF in python ovito? [closed]

Basically, I am trying to get the running coordination number (CN), but the result isn't correct? I am multiplying the Radial Distribution Function (RDF) with ...
7 votes
1 answer
96 views

How to read data from an input and form two-electrons integral?

I am doing a code that can calculate the hartree-fock energy. I want to form the two-electrons integral by reading the data from the input like this one below. The first four number are the indices ...
9 votes
0 answers
183 views

How to interpret WannierTools Python code that generates tight-binding model in the wannier90_hr.dat format? [closed]

I am getting myself acquainted with Wannier Tools. Wannier Tools requires two inputs, a wt.in file, and a .dat file. This ...
23 votes
0 answers
360 views

What are the tools available for point defects calculations? [closed]

It would be appreciated if you could explain one of the tools below (or another tool not listed), in the format used here (for example): What software will allow me to combine two images? What ...
8 votes
1 answer
58 views

Error when using pycotem to index an electron diffraction pattern?

In the pycotem code, this error comes up when using the Diffraction GUI. ...
17 votes
6 answers
3k views

How to make a python code that can read a .xyz file and find the distance between atoms?

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
2k views

How can I use a GUI on a supercomputer?

I am trying to make plots based to VASP simulation results, but I am struggling with how to download so much data from the server. A lot of examples on the internet are taught using the local desktop ...
16 votes
2 answers
1k views

Is there a more efficient hard sphere packing algorithm?

I am trying to pack hard-spheres in a unit cubical box, such that these spheres cannot overlap on each other. This is being done in Python. I am given some packing fraction ...
16 votes
2 answers
1k views

Open Source PyMol Conda Package: UnsatisfiableError

I'm having an issue installing the open-source version of Pymol using Anaconda on Windows. I have Python 3.8.3 installed and when I try to add the package with Conda using ...