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
0 answers
51 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 ...
user avatar
3 votes
0 answers
32 views

How to transform fractionary 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.
user avatar
5 votes
1 answer
101 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 ...
user avatar
  • 123
3 votes
0 answers
41 views

Calculating the Diffusion coffecients from Trajectory file in ASE

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 ...
user avatar
  • 715
3 votes
0 answers
109 views

Molecular MC simulation is not equilibrating

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 ...
user avatar
3 votes
0 answers
72 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 ...
user avatar
  • 715
5 votes
0 answers
36 views

Getting Internal Calculator Data in ASE

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 ...
user avatar
5 votes
1 answer
86 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 ...
user avatar
  • 111
11 votes
0 answers
73 views

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 1D s-band - which is easy because ...
user avatar
9 votes
2 answers
262 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 ...
user avatar
6 votes
0 answers
43 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 ...
user avatar
  • 61
5 votes
1 answer
63 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 ...
user avatar
6 votes
0 answers
84 views

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

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-...
user avatar
14 votes
1 answer
641 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 ...
user avatar
10 votes
1 answer
143 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: ...
user avatar
6 votes
1 answer
86 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 ...
user avatar
4 votes
0 answers
57 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, ...
user avatar
6 votes
0 answers
62 views

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

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 ...
user avatar
  • 61
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 ...
user avatar
  • 715
8 votes
1 answer
414 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 ...
user avatar
7 votes
0 answers
57 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 ...
user avatar
7 votes
1 answer
194 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: ...
user avatar
  • 5,501
6 votes
1 answer
240 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 ...
user avatar
9 votes
2 answers
1k 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). ...
user avatar
  • 5,544
7 votes
1 answer
87 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 ...
user avatar
5 votes
0 answers
199 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 ...
user avatar
  • 715
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 ...
user avatar
  • 1,601
13 votes
1 answer
483 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 ...
user avatar
  • 231
5 votes
4 answers
455 views

How to edit the first line of XYZ file?

...
user avatar
  • 715
6 votes
1 answer
88 views

How is the atom selection going wrong when creating the collective variable?

I'm trying to create a CV for angle theta. To make this calculation, the right atom selections need to be made. The function is given below: ...
user avatar
  • 115
5 votes
1 answer
207 views

How do I select atoms using mdtraj_topology when creating a CV?

I am adding a new collective variable (CV) that I will use to calculate a path density with OpenPathSampling. I played around a bit with the CVs and I have one error that I'm not sure how to fix. I'm ...
user avatar
  • 115
12 votes
0 answers
217 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 ...
user avatar
  • 5,544
7 votes
2 answers
508 views

RDkit and PySmiles results differ on some SMILES strings

I recently started using both pysmiles and RDkit to parse SMILES strings into molecules. ...
user avatar
4 votes
0 answers
56 views

RDkit parse zero-order bonds (python) [closed]

I'm a computer scientist, helping with a chemistry project in python. I have been working with the library pysmiles in order to parse ...
user avatar
5 votes
1 answer
97 views

Have I missed something? RDF (radial distribution) script cannot capture the correct .xyz

I am trying to learn how RDF is working. To learn how RDF is working in practice I am testing the script (below) by printing all of the variables using this .xyz file example: I passed cartesian ...
user avatar
  • 788
8 votes
0 answers
77 views

Bloch wave function extraction for the specific k-points and specific band from QE calculation [closed]

I would like to use QE to obtain u_K(r), which is the Bloch wave function of spin-up maximum valance band at K point. If I define the K point in the input file and do an SCF calculation by QE ...
user avatar
6 votes
0 answers
216 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: ...
user avatar
7 votes
1 answer
98 views

Thermo-Calc: how to suspend specific composition sets?

I am attempting to calculate the driving force of nucleation for several different precipitate phases using TC-Python. To this I want to suspend all phases, except for the matrix phase (e.g. FCC_L12). ...
user avatar
  • 611
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 ...
user avatar
  • 151
11 votes
1 answer
851 views

How should I generate a radial distribution function (RDF) for an MD trajectory with python?

I am attempting to analyse the radial distribution function (oxygen to oxygen) for a ~400ps simulation on a droplet of water (MD done with NAMD). I am using the python library MDAnalysis to do this. ...
user avatar
  • 5,544
8 votes
1 answer
383 views

Functional group detection for group contribution methods

I would like to be able to parse a molecule into its functional groups, and, also, know the number of occurrences of each. A similar question was asked on matter modelling specifically for xyz files. ...
user avatar
  • 3,870
8 votes
1 answer
57 views

Error when using pycotem to index an electron diffraction pattern?

In the pycotem code, this error comes up when using the Diffraction GUI. ...
user avatar
  • 151
2 votes
0 answers
70 views

How to plot a charge density from a CHGCAR file in Python? [duplicate]

I can convert a CHGCAR file on the NxNxN grid into a 3D array of shape (N,N,N) for better handling, if that helps. At the end of the day, I want plot/visualize the ...
user avatar
  • 1,134
7 votes
2 answers
222 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 ...
user avatar
  • 1,134
11 votes
1 answer
195 views

How to use wavefunctions/density to determine which orbitals lead to edge states?

I have a large matrix for a 1D zigzag edge model of an otherwise $3\times 3$ tight-binding Hamiltonian (3 basis functions, each corresponding to an atomic orbital), involving the variable $k_x$. The ...
user avatar
  • 2,091
9 votes
0 answers
61 views

Is there a script that will suggest (hkl) indices based on distances in an electron diffraction pattern for a known crystal structure? [closed]

I am looking for a script (preferably in Python) that will suggest (hkl) indices based on distances in an electron diffraction pattern. The crystal structure is known,i.e. I have the CIF file and know ...
user avatar
  • 179
13 votes
1 answer
204 views

Generating numpy-compatible electron density from Molden / QC calculation

I'd like to use a variety of Python tools (e.g., matplotlib and Mayavi) to analyze orbitals plot electron density contours, etc. ...
user avatar
3 votes
1 answer
63 views

How to make left and right handed material interface using python

I have a crystal structure, a B20 compound. I want to make an interface of that bulk compound with left and right-hand material. Is there any python code for writing such interfaces. or for writing ...
user avatar
  • 47
7 votes
1 answer
129 views

Help with Definitions in Numerical Calculation of Multiband Berry Phase

In the third chapter of Vanderbilt's book, they discuss the so-called multiband parallel transport and provide a scheme for numerical calculations that is similar to the single band case (where the ...
user avatar
  • 2,091
8 votes
1 answer
132 views

What are open source options to simulate kinematical electron diffraction patterns?

I tried using the python package diffsims. I get an image, but not a diffraction pattern I was expecting. ...
user avatar
  • 179