Creating a new Lattice with a scaling constant

I created an (unscaled, ideal) hcp lattice: hcp = mg.Lattice([[1,0,0],[1/2,math.sqrt(3)/2,0],[0,0,math.sqrt(8/3)]]) but I’d like to scale the whole thing by the a lattice parameter. What’s the expected way to do this in pymatgen?

Or maybe the lattice constant should be added when using the defined Lattice when calling Structure?
hcpZr = mg.Structure(hcp,["Zr","Zr"],[[0,0,0],[1/3,1/3,1/2]]) (If so, where does one specify the lattice parameter?)

Hi @glwhart,

You specify the lattice constants in the lattice and there is a useful function generating a lattice from the lattice parameters for you:

from pymatgen import Lattice, Structure
a = 3#first hcp lattice parameter
c = 7#second hcp lattice parameter
hcp = Lattice.from_parameters(a, a, c, 90, 90, 120)#parameters: a, b, c, alpha, beta, gamma
hcpZr = Structure(hcp, ["Zr","Zr"],[[0,0,0],[1/3,1/3,1/2]])#these are fractional coordinates


Perfect! That’s exactly the kind of feedback that I was hoping for. Thanks Peter.

1 Like