A series of Python3 script to lower the barrier of computing and simulating molecular and material systems.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

17 lines
360 B

from scipy.constants import N_A
def density(geom):
a1 = 0
a2 = 0
a3 = 0
with open(geom, 'r') as f:
for line in f:
if "CRYST1" in line:
arr = line.split()
a1 = float(arr[1])
a2 = float(arr[2])
a3 = float(arr[3])
V = a1*a2*a3*10**-24 # Volume dalam cm^3
dens = mass/V # Massa jenis dalam g/cm^3
print("Density = {}".format(dens))