To compile: g++ random_struc.cpp -o executable To run: ./executable
This code generates a periodic liquid structure in a box for Molecular Dynamics (MD) simulations. It is capable of generating a pure liquid (with only one type of molecule) OR a binary liquid with 2 molecule types. Params.txt file can be used to set various relevant parameters for generating the structure. Unit : Angstrom Ovito can be used to visualize the system generated by this code.
Quick help is also printed in the params.txt file. Here is a slightly detailed description of each parameter.
- density : This is the number density of the liquid sturcture and corresponds to the number of molecules per unit volume. E.g., if the box_dim is 10 Ang, and the number density is set to be 0.003 then a total of 3 molecules will be generated in the system. This is the total number of molecules (solvent + solute).
- percent_solute : percentage of final structure that should contain solute molecules. The number of molecules of solvent and solute in the final structure is based on this parameter.
- box_dim : The system creates a cube of side length specified here (in Angstroms).
- min_dist : This is the minimum distance between 2 molecules (float value).
- seed : This program uses a random number generator (RNG) and the seed for this RNG can be set from 0 to 4,294,967,295. This parameter is included for reproducibility of the initial structure.
- out_file : The name of the output file for the generated structure can be given here. Remember to give the name with the .xyz extension.
- dimensions : USE 3 for a 3d system
- inp_mols : This parameter is used to decide whether the system will be a pure liquid or binary (with solute molecules). It can be 1 or 2.
- solute_filename : Provide the generator with a solute molecule in .xyz format
- solvent_filename : Provide the generator with a solvent molecule in .xyz format
Main code to generate the specified molecular system
Generates Carbon Nanotubes (CNT) for a given diameter and length