def test_conductivity(): trjfilename = [ os.path.join(MODULE_DIR, 'tests/sample_files/NaSCN.lammpstrj') ] datfilename = os.path.join(MODULE_DIR, 'tests/sample_files/data.water_1NaSCN') logfilename = os.path.join(MODULE_DIR, 'tests/sample_files/mol.log') lrun = LammpsRun(datfilename, trjfilename, logfilename) cc = Conductivity() T = 350 # from lammpsio output = {} output['Conductivity'] = {} output['Conductivity']['units'] = 'S/m' (nummoltype, moltypel, moltype) = lrun.get_mols() n = lrun.natoms() (molcharges, atomcharges, n) = lrun.get_mol_charges(n) output = cc.calcConductivity(molcharges, trjfilename, logfilename, datfilename, T, output) print((output['Conductivity']['Green_Kubo']))
def test_other(): """ Sample driver file to calculate the MSD and diffusivity for all molecules in a system as well as the center of mass radial distribution function for all pairs of molecules in the system. Will also integrate the rdf to get the coordination number and calculate the ion pair lifetime for the system Requires the following comments in the lammps data file starting at the third line # 'number' 'molecule' molecules where 'number' is the number of that molecule type and 'molecule' is a name for that molecule Do not include blank lines in between the molecule types Outputs are stored in a dictionary called output to later be stored in JSON format """ trjfilename = [ os.path.join(MODULE_DIR, 'tests/sample_files/NaSCN.lammpstrj') ] datfilename = os.path.join(MODULE_DIR, 'tests/sample_files/data.water_1NaSCN') logfilename = os.path.join(MODULE_DIR, 'tests/sample_files/mol.log') lrun = LammpsRun(datfilename, trjfilename, logfilename) c = CenterOfMass() m = MeanSquareDisplacement() crd = RadialDistributionPure() ne = NernstEinsteinConductivity() cn = CoordinationNumber() ip = IonPair() output = {} output['RDF'] = {} output['RDF']['units'] = 'unitless and angstroms' output['Conductivity'] = {} output['Conductivity']['units'] = 'S/m' T = 298 # get from lammpsio tsjump = lrun.jump() (nummoltype, moltypel, moltype) = lrun.get_mols() dt = lrun.timestep n = lrun.natoms() (molcharges, atomcharges, n) = lrun.get_mol_charges(n) molcharge = lrun.get_mol_charge_dict(molcharges, moltypel, moltype) (comx, comy, comz, Lx, Ly, Lz, Lx2, Ly2, Lz2) = c.calcCOM(trjfilename, datfilename) output = m.runMSD(comx, comy, comz, Lx, Ly, Lz, Lx2, Ly2, Lz2, moltype, moltypel, dt, tsjump, output) output = ne.calcNEconductivity(output, molcharge, Lx, Ly, Lz, nummoltype, moltypel, T) ip.runionpair(comx, comy, comz, Lx, Ly, Lz, moltypel, moltype, tsjump, dt, output, skipframes=0) output = crd.runradial(datfilename, comx, comy, comz, Lx, Ly, Lz, Lx2, Ly2, Lz2, output, nummoltype, moltypel, moltype, firststep=1) output = cn.compute(output, nummoltype, moltypel, Lx * Ly * Lz)
def lampps_properties(self, trjfile, datafile, logfile): """ calculate the MSD and diffusivity for all molecules in a system as well as the center of mass radial distribution function for all pairs of molecules in the system Requires the following comments in the lammps data file starting at the third line # "number" "molecule" molecules where "number" is the number of that molecule type and "molecule" is a name for that molecule Do not include blank lines in between the molecule types Outputs are stored in a dictionary called output to later be stored in JSON format :return: Output """ lrun = LammpsRun(datafile, trjfile, logfile) c = CenterOfMass() m = MeanSquareDisplacement() crd = RadialDistributionPure() ne = NernstEinsteinConductivity() output = {} output['RDF'] = {} output['RDF']['units'] = 'unitless and angstroms' output['Conductivity'] = {} output['Conductivity']['units'] = 'S/m' T = 298 # get from lammpsio tsjump = lrun.jump() (nummoltype, moltypel, moltype) = lrun.get_mols() dt = lrun.timestep n = lrun.natoms() (molcharges, atomcharges, n) = lrun.get_mol_charges(n) molcharge = lrun.get_mol_charge_dict(molcharges, moltypel, moltype) (comx, comy, comz, Lx, Ly, Lz, Lx2, Ly2, Lz2) = c.calcCOM([trjfile], datafile) output = m.runMSD(comx, comy, comz, Lx, Ly, Lz, Lx2, Ly2, Lz2, moltype, moltypel, dt, tsjump, output) output = ne.calcNEconductivity(output, molcharge, Lx, Ly, Lz, nummoltype, moltypel, T) output = crd.runradial(datafile, comx, comy, comz, Lx, Ly, Lz, Lx2, Ly2, Lz2, output, nummoltype, moltypel, moltype, firststep=1) return output