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
3
votes
0answers
21 views

How to implement a Weyl semimetal in tight binding?

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, ...
6
votes
0answers
29 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 ...
4
votes
4answers
1k 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 ...
8
votes
1answer
24 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
0answers
39 views

Pymol is not opening after startup

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 ...
6
votes
0answers
36 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: ...
6
votes
1answer
95 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 ...
8
votes
2answers
87 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
1answer
78 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 ...
5
votes
0answers
72 views

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

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 ...
16
votes
3answers
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 ...
10
votes
0answers
161 views

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

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 ...
5
votes
4answers
371 views
6
votes
1answer
85 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: ...
5
votes
1answer
147 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 ...
12
votes
0answers
157 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 ...
7
votes
2answers
277 views

RDkit and PySmiles results differ on some SMILES strings

I recently started using both pysmiles and RDkit to parse SMILES strings into molecules. ...
4
votes
0answers
52 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 ...
5
votes
1answer
62 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 ...
8
votes
0answers
63 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 ...
6
votes
0answers
118 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: ...
7
votes
1answer
62 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). ...
15
votes
4answers
775 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 ...
10
votes
1answer
529 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. ...
8
votes
1answer
244 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. ...
8
votes
1answer
56 views

Error when using pycotem to index an electron diffraction pattern?

In the pycotem code, this error comes up when using the Diffraction GUI. ...
2
votes
0answers
67 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 ...
6
votes
2answers
157 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 ...
11
votes
1answer
172 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 ...
9
votes
0answers
51 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 ...
13
votes
1answer
158 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. ...
3
votes
1answer
60 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 ...
7
votes
1answer
104 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 ...
8
votes
1answer
121 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. ...
7
votes
0answers
50 views

Convert standard image file format to py4DSTEM datacube? [closed]

I want to analyze a diffraction pattern. Py4dSTEM is asking for a datacube to start with. I thought it might be able to convert an image to this format: ...
11
votes
0answers
117 views

What are good protocols for creating a database based on python?

I am aware of software tools such as atomate, but that is quite specific to crystals. There are other equally specific workflows - I think we all have our own... What I am interested in is making my ...
10
votes
1answer
72 views

Pycalphad most efficient way to gather equilibirum phase data for set of alloy compositions?

What's the most efficient way to get the equilibrium phases and phase fractions for a set of alloy compositions? For context, I'm coming from Thermo-Calc/TC-Python where I would just loop through the ...
6
votes
1answer
153 views

Pycalphad "Failed while parsing" Yttrium from light alloys database

The code in question is just 2 lines used to import the "COST507 database for light alloys" (downloaded from the opencalphad homepage http://www.opencalphad.com/). ...
13
votes
3answers
2k views

Python script for convergence test

I want to do a convergence test of Ni using a Python script in Pyiron. Can someone please suggest how to write a script to test energy and k-mesh convergence?
6
votes
1answer
111 views

Downloading ASE (Atomic Simulation Environment) on older versions of Python

I'm trying to install something called ASE that models atomic structures. I have ASE currently installed on python 3.7, however I need to run scripts that can import and recognize ASE in an older ...
13
votes
1answer
157 views

How to numerically solve real-space 1D time-independent Schrodinger equation using 2D momentum-space Hamiltonian?

Consider the usual simple 2-level graphene Hamiltonian with mass in momentum-space where: $$ H(k,V)=-t \sum_{\delta} [\cos(k\cdot\delta)\sigma_x-\sin(k\cdot\delta)\sigma_y+V\sigma_z], $$ where $t$ is ...
12
votes
3answers
808 views

How to create a 3D band structure from DFT band structure calculation?

How can I create such a 3D plot using matplotlib? Like the one in Figure (a) below: I want to create it using DFT bandstructure calculation result
10
votes
1answer
212 views

What is the right way to calculate <A><A>?

We asked a similar question somewhere else and someone advised trying here instead. How should we calculate $\langle A\rangle \langle A\rangle$ from data on dipole moments? It is a term in an ...
16
votes
6answers
2k 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: ...
9
votes
2answers
749 views

Python program that returns elements from a SMILE string

Given a SMILES string for a molecule, I want to know the elements in the molecule, I then send this to basis_set_exchange to get a "custom" basis set for use in Gaussian. This seems like ...
10
votes
1answer
159 views

Computing optimized 3D structures in python that take solvent into account

I have been using RDKit to generate 3D coordinates, cleaning-up the structures using a general-purpose force field as follows: ...
10
votes
2answers
176 views

Programs/Libraries for calculating solvent excluded surface and excluded volume

Given the 3D structure of a molecule (e.g. as *.mol) and a probe radius r, I want to calculate the solvent excluded surface (SES)...
9
votes
0answers
119 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 ...
6
votes
1answer
65 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 ...
12
votes
1answer
117 views

Metropolis algorithm reduces energy in molecular simulation, but does not decrease euclidean distance

I am using an open source python package openmmtools to run a simple molecular simulation problem using the metropolis algorithm. I first load a default system of particles (alanine-dipeptide in ...