In this thesis, a new method that constructs the free energy profile of systems in equilibrium and in nonequilibrium, that is, under a gradient of either pressure, temperature, or chemical potential, was developed. This method is based on tracking the initial and final positions of unrestricted trajectories that are launched in short simulations. This tracking populates a transition matrix, where each matrix entry corresponds to predetermined states defined in the initial step of the method. The steady-state probability distribution of the system and, consequently, its free energy curve are obtained from the eigenvector corresponding to the main eigenvalue of the transition matrix. We see this method being applied potentially in research to discovery new materials, specially for the design of nanofiltration membranes.